diff --git a/MuonSpectrometer/MuonConfig/CMakeLists.txt b/MuonSpectrometer/MuonConfig/CMakeLists.txt index 443c6ee11f951307744d9f98ec4c48a352490493..97cc7004569cfc91bd19fc6faf511bbe42b919dc 100644 --- a/MuonSpectrometer/MuonConfig/CMakeLists.txt +++ b/MuonSpectrometer/MuonConfig/CMakeLists.txt @@ -44,11 +44,11 @@ if( NOT SIMULATIONBASE ) POST_EXEC_SCRIPT nopost.sh ) atlas_add_test( MuonReconstructionConfigTest - SCRIPT python -m MuonConfig.MuonReconstructionConfig + SCRIPT python -m MuonConfig.MuonReconstructionConfig --run POST_EXEC_SCRIPT nopost.sh ) atlas_add_test( MuonSegmentFindingConfigTest - SCRIPT python -m MuonConfig.MuonSegmentFindingConfig + SCRIPT python -m MuonConfig.MuonSegmentFindingConfig --run POST_EXEC_SCRIPT nopost.sh ) atlas_add_test( flake8 diff --git a/MuonSpectrometer/MuonConfig/python/MuonRecToolsConfig.py b/MuonSpectrometer/MuonConfig/python/MuonRecToolsConfig.py index 8cb10f8da50304827729329822429b38acd56e15..b5e585e2441e827200e39ac4521d3f4b788490d9 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonRecToolsConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonRecToolsConfig.py @@ -7,6 +7,28 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator # Tracking from TrkDetDescrSvc.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg +def MuonTrackToSegmentToolCfg(flags,name="MuonTrackToSegmentTool", **kwargs): + from MuonTrackFinderTools.MuonTrackFinderToolsConf import Muon__MuonTrackToSegmentTool + #MDT conditions information not available online + if(flags.Common.isOnline): + kwargs.setdefault("MdtCondKey","") + + result = MuonStationIntersectSvcCfg(flags) + msis = result.getPrimary() + kwargs.setdefault("MuonStationIntersectSvc",msis) + + # FIXME - this should have a CA + from TrkExRungeKuttaPropagator.TrkExRungeKuttaPropagatorConf import Trk__RungeKuttaPropagator as RkPropagator + atlasRungeKuttaPropagator = RkPropagator(name = 'AtlasRungeKuttaPropagator') + result.addPublicTool(atlasRungeKuttaPropagator) + kwargs.setdefault("Propagator",atlasRungeKuttaPropagator) + + # Not bothering to explicitly set IdHelper or EDMHelper + muon_track_to_segment_tool = Muon__MuonTrackToSegmentTool(name, **kwargs) + result.setPrivateTools(muon_track_to_segment_tool) + return result + + def MuonSeededSegmentFinderCfg(flags,name="MuonSeededSegmentFinder", **kwargs): from MuonTrackFinderTools.MuonTrackFinderToolsConf import Muon__MuonSeededSegmentFinder from MuonSegmentFindingConfig import DCMathSegmentMakerCfg, MdtMathSegmentFinder # FIXME - should really shift this to RecTools then. diff --git a/MuonSpectrometer/MuonConfig/python/MuonTrackBuildingConfig.py b/MuonSpectrometer/MuonConfig/python/MuonTrackBuildingConfig.py index 58872225c0eecc6e3e4575796ae0949f7c5ca11e..291f94e4bdd41c8f96b73edc21e8e0de3fbc51a1 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonTrackBuildingConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonTrackBuildingConfig.py @@ -53,6 +53,9 @@ def MooTrackFitterCfg(flags, name = 'MooTrackFitter', **kwargs): def MooTrackBuilderCfg(flags, name="MooTrackBuilderTemplate", **kwargs): from MuonTrackSteeringTools.MuonTrackSteeringToolsConf import Muon__MooTrackBuilder from TrkExSTEP_Propagator.TrkExSTEP_PropagatorConf import Trk__STEP_Propagator + from MuonConfig.MuonRIO_OnTrackCreatorConfig import MdtDriftCircleOnTrackCreatorCfg, TriggerChamberClusterOnTrackCreatorCfg + from MuonRecToolsConfig import MuonTrackToSegmentToolCfg + from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg # Based on this: https://gitlab.cern.ch/atlas/athena/blob/release/22.0.3/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MooreTools.py#L221 # ignoring all the name_prefix stuff for the moment, since I'm not sure it's necessary any more. @@ -66,7 +69,6 @@ def MooTrackBuilderCfg(flags, name="MooTrackBuilderTemplate", **kwargs): acc = MCTBFitterCfg(flags, name='MCTBSLFitter', StraightLine=True) mctbslfitter = acc.getPrimary() result.addPublicTool(mctbslfitter) - result.merge(acc) # Just take the default configuration, as per https://gitlab.cern.ch/atlas/athena/blob/release/22.0.3/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonRecExampleConfigDb.py#L56 @@ -83,13 +85,57 @@ def MooTrackBuilderCfg(flags, name="MooTrackBuilderTemplate", **kwargs): kwargs.setdefault("SLFitter", moo_sl_track_fitter) kwargs.setdefault("RecalibrateMDTHitsOnTrack", ( (not flags.Muon.doSegmentT0Fit) and flags.Beam.Type == 'collisions') ) - acc = MuonSeededSegmentFinderCfg(flags) muon_seeded_segment_finder = acc.getPrimary() result.addPublicTool(muon_seeded_segment_finder) result.merge(acc) kwargs.setdefault("SeededSegmentFinder", muon_seeded_segment_finder) + + result = MdtDriftCircleOnTrackCreatorCfg(flags) + mdt_dcot_creator = result.getPrimary() + kwargs.setdefault("MdtRotCreator", mdt_dcot_creator) + result.merge(acc) + + acc = TriggerChamberClusterOnTrackCreatorCfg(flags) + muon_comp_cluster_creator = acc.getPrimary() + kwargs.setdefault("CompetingClustersCreator", muon_comp_cluster_creator) + result.merge(acc) + + acc = MuonSTEP_PropagatorCfg(flags) + muon_prop = acc.getPrimary() + kwargs.setdefault("Propagator", muon_prop) + result.merge(acc) + + acc = MuonChamberHoleRecoveryToolCfg(flags) + hole_recovery_tool = acc.getPrimary() + result.addPublicTool(hole_recovery_tool) + result.merge(acc) + kwargs.setdefault("HitRecoveryTool", hole_recovery_tool) + kwargs.setdefault("ChamberHoleRecoveryTool", hole_recovery_tool) # FIXME? Remove duplicate from cxx? + + acc = MagneticFieldSvcCfg(flags) + magfieldsvc = acc.getPrimary() + kwargs.setdefault( "MagFieldSvc", magfieldsvc ) + result.merge(acc) + acc = MuonTrackToSegmentToolCfg(flags) + track_to_segment_tool = acc.getPrimary() + kwargs.setdefault("TrackToSegmentTool", track_to_segment_tool) + result.merge(acc) + + # FIXME - remove ErrorOptimisationTool from cxx? + # declareProperty("ErrorOptimisationTool","" ); + + acc=MuPatCandidateToolCfg(flags) + cand_tool = acc.getPrimary() + result.merge(acc) + kwargs.setdefault("CandidateTool", cand_tool) + + acc = MooCandidateMatchingToolCfg(flags) + track_segment_matching_tool=acc.getPrimary() + result.merge(acc) + kwargs.setdefault("CandidateMatchingTool", track_segment_matching_tool) + builder = Muon__MooTrackBuilder(name, **kwargs) result.setPrivateTools(builder) return result @@ -150,17 +196,26 @@ def MooCandidateMatchingToolCfg(flags, name="MooCandidateMatchingTool", doSegmen kwargs.setdefault("AlignmentErrorAngleX", 0.004) kwargs.setdefault("AlignmentErrorAngleY", 0.002) + acc=MuPatCandidateToolCfg(flags) + cand_tool = acc.getPrimary() + result.merge(acc) + result.addPublicTool(cand_tool) + kwargs.setdefault("MuPatCandidateTool", cand_tool) + moo_cand_matching_tool = Muon__MooCandidateMatchingTool(name,**kwargs) result.setPrivateTools(moo_cand_matching_tool) return result def MuonSegmentRegionRecoveryToolCfg(flags, name="MuonSegmentRegionRecoveryTool", **kwargs): from MuonTrackFinderTools.MuonTrackFinderToolsConf import Muon__MuonSegmentRegionRecoveryTool + from MuonConfig.MuonRecToolsConfig import MuonExtrapolatorCfg, MuonStationIntersectSvcCfg + # Based on https://gitlab.cern.ch/atlas/athena/blob/release/22.0.3/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MooreTools.py#L426 - result = MCTBFitterCfg(flags) - mctbfitter = result.getPrimary() - result.addPublicTool(mctbfitter) - kwargs.setdefault("Fitter", mctbfitter) + + result = MuonSeededSegmentFinderCfg(flags) + muon_seeded_segment_finder = result.getPrimary() + result.addPublicTool(muon_seeded_segment_finder) + kwargs.setdefault("SeededSegmentFinder", muon_seeded_segment_finder) acc = MooCandidateMatchingToolCfg(flags) track_segment_matching_tool=acc.getPrimary() @@ -168,6 +223,39 @@ def MuonSegmentRegionRecoveryToolCfg(flags, name="MuonSegmentRegionRecoveryTool" result.merge(acc) kwargs.setdefault("TrackSegmentMatchingTool", track_segment_matching_tool) + acc = MuonChamberHoleRecoveryToolCfg(flags) + hole_recovery_tool = acc.getPrimary() + result.addPublicTool(hole_recovery_tool) + result.merge(acc) + kwargs.setdefault("ChamberHoleRecoveryTool", hole_recovery_tool) + + acc = MuonExtrapolatorCfg(flags) + extrap = acc.getPrimary() + acc.addPublicTool(extrap) + result.merge(acc) + kwargs.setdefault("Extrapolator", extrap) + + acc = MCTBFitterCfg(flags, name='MCTBSLFitter', StraightLine=True) + mctbslfitter = acc.getPrimary() + result.addPublicTool(mctbslfitter) + result.merge(acc) + kwargs.setdefault("Fitter", mctbslfitter) + + acc = MuonStationIntersectSvcCfg(flags) + msis = acc.getPrimary() + result.merge(acc) + kwargs.setdefault("MuonStationIntersectSvc",msis) + + # Not bothering to handle IDHelper or EDMHelper or HitSummaryTool. Default is okay. + + # FIXME - this should probably be a CA? + from RegionSelector.RegSelSvcDefault import RegSelSvcDefault + segRecoveryRegSelSvc = RegSelSvcDefault() + segRecoveryRegSelSvc.enableMuon = True + result.addService(segRecoveryRegSelSvc) + + kwargs.setdefault("RegionSelector", segRecoveryRegSelSvc) + segment_region_recovery_tool = Muon__MuonSegmentRegionRecoveryTool(name, **kwargs) result.setPrivateTools(segment_region_recovery_tool) return result @@ -175,7 +263,6 @@ def MuonSegmentRegionRecoveryToolCfg(flags, name="MuonSegmentRegionRecoveryTool" def MuPatCandidateToolCfg(flags, name="MuPatCandidateTool", **kwargs): from MuonTrackSteeringTools.MuonTrackSteeringToolsConf import Muon__MuPatCandidateTool # https://gitlab.cern.ch/atlas/athena/blob/release/22.0.3/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuPatTools.py#L32 - from MuonConfig.MuonRIO_OnTrackCreatorConfig import CscClusterOnTrackCreatorCfg,MdtDriftCircleOnTrackCreatorCfg result = MdtDriftCircleOnTrackCreatorCfg(flags) mdt_dcot_creator = result.getPrimary() @@ -188,8 +275,8 @@ def MuPatCandidateToolCfg(flags, name="MuPatCandidateTool", **kwargs): kwargs.setdefault("SegmentExtender", "") #FIXME If this is always empty, can it be removed? - from AthenaCommon.Constants import VERBOSE - mu_pat_cand_tool = Muon__MuPatCandidateTool(name, OutputLevel=VERBOSE, **kwargs) + # from AthenaCommon.Constants import VERBOSE + mu_pat_cand_tool = Muon__MuPatCandidateTool(name, **kwargs) result.setPrivateTools(mu_pat_cand_tool) return result @@ -278,7 +365,7 @@ def MuonTrackSteeringCfg(flags, name="MuonTrackSteering", **kwargs): result.merge(acc) result.addPublicTool(cand_tool) kwargs.setdefault("MuPatCandidateTool", cand_tool) - + from MuonConfig.MuonRecToolsConfig import MuonAmbiProcessorCfg acc = MuonAmbiProcessorCfg(flags, name='MuonAmbiProcessor') ambi = acc.getPrimary() @@ -414,7 +501,7 @@ if __name__=="__main__": from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg cfg.merge(PoolReadCfg(ConfigFlags)) - log.debug('About to set up Muon Track Building.') + log.debug('About to set up Muon Track Building.') acc = MuonTrackBuildingCfg(ConfigFlags) cfg.merge(acc) @@ -439,7 +526,7 @@ if __name__=="__main__": from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg itemsToRecord = ["TrackCollection#MuonSpectrometerTracks"] - + cfg.merge( OutputStreamCfg( ConfigFlags, 'ESD', ItemList=itemsToRecord) ) outstream = cfg.getEventAlgo("OutputStreamESD") @@ -457,6 +544,7 @@ if __name__=="__main__": f=open("MuonTrackBuilding.pkl","w") cfg.store(f) f.close() - + if args.run: cfg.run(20) + diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MooreTools.py b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MooreTools.py index 7cbb599f09628860a3c3efe260f057698de69333..5647cca1072df8b769c6c397c574bd2a3d852c2c 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MooreTools.py +++ b/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MooreTools.py @@ -173,7 +173,9 @@ def MooCandidateMatchingTool(name,extraFlags=None,**kwargs): kwargs.setdefault("AlignmentErrorPosY", 5.0) kwargs.setdefault("AlignmentErrorAngleX", 0.004) kwargs.setdefault("AlignmentErrorAngleY", 0.002) - + + kwargs.setdefault("MuPatCandidateTool", getPublicTool("MuPatCandidateTool")) + return CfgMgr.Muon__MooCandidateMatchingTool(name,**kwargs) diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools/MuonRecHelperTools/IMuonEDMHelperSvc.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools/MuonRecHelperTools/IMuonEDMHelperSvc.h index 1aaaf6cba540f4707e74e9ccbf0d5215ca408fba..1682fb9ea0f79f4c91af4b1a0760cb4c640687b1 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools/MuonRecHelperTools/IMuonEDMHelperSvc.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools/MuonRecHelperTools/IMuonEDMHelperSvc.h @@ -26,7 +26,6 @@ namespace Trk { namespace Muon { class MuonSegment; - class MuonIdHelperTool; /** Helper tool containing functionality needed by multiple tools. diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools/MuonRecHelperTools/MuonEDMPrinterTool.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools/MuonRecHelperTools/MuonEDMPrinterTool.h index 08934b3496e13eba9b13c2fe7bab09a62c4b31de..cc38a6207421cc6149d027fd06bd29a203286a01 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools/MuonRecHelperTools/MuonEDMPrinterTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools/MuonRecHelperTools/MuonEDMPrinterTool.h @@ -18,6 +18,7 @@ #include "MuonPattern/MuonPatternCollection.h" #include "TrkToolInterfaces/IResidualPullCalculator.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" +#include "MuonIdHelpers/MuonIdHelperTool.h" #include diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools/src/MuonEDMPrinterTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools/src/MuonEDMPrinterTool.cxx index 3a81d4243e6691c51140837e96405ba83d49ca38..25159cd47951216b098828ddaeb6c89bc025fbed 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools/src/MuonEDMPrinterTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools/src/MuonEDMPrinterTool.cxx @@ -4,7 +4,6 @@ #include "MuonRecHelperTools/MuonEDMPrinterTool.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" #include "MuonRecHelperTools/MuonEDMHelperSvc.h" #include "TrkToolInterfaces/ITrackSummaryHelperTool.h" diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.cxx index 78792185fea8893d2000d39c14dbc4938580ccbd..8f68acb5d4befa7f9149a9136389b4ee840357d3 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.cxx @@ -99,7 +99,6 @@ namespace Muon { m_segmentMatchingTool("Muon::MuonSegmentMatchingTool/MuonSegmentMatchingTool"), m_segmentMatchingToolTight("Muon::MuonSegmentMatchingTool/MuonSegmentMatchingToolTight"), m_magFieldSvc("AtlasFieldSvc",n), - m_candidateTool("Muon::MuPatCandidateTool/MuPatCandidateTool"), m_goodSegmentMatches(0), m_goodSegmentMatchesTight(0), m_segmentMatches(0), @@ -158,7 +157,8 @@ namespace Muon { ATH_CHECK( m_magFieldSvc.retrieve() ); ATH_CHECK( m_segmentMatchingTool.retrieve() ); ATH_CHECK( m_segmentMatchingToolTight.retrieve() ); - + ATH_CHECK( m_candidateTool.retrieve() ); + return StatusCode::SUCCESS; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.h index e0584684346cb7f70246f5a1969c9f516902b10a..efedb9b11398d89d16452a48266622195bdadf5d 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.h @@ -181,7 +181,8 @@ namespace Muon { ToolHandle m_segmentMatchingTool; ToolHandle m_segmentMatchingToolTight; ServiceHandle m_magFieldSvc; - ToolHandle m_candidateTool; + ToolHandle m_candidateTool {this, "MuPatCandidateTool", "Muon::MuPatCandidateTool/MuPatCandidateTool"}; + int m_trackSegmentPreMatchingStrategy; //!< 0=no segments match,1=any segment match,2=all segment match bool m_doTrackSegmentMatching; //!< apply track-segment matching or not diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackBuilder.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackBuilder.cxx index ed9a5c804aacd0708cce9ec210a24d13c6acdae9..9b6e433dd0f17e427a6f303f424ef5311baf20b8 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackBuilder.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackBuilder.cxx @@ -2,32 +2,14 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#include "AthenaKernel/Timeout.h" - #include "MooTrackBuilder.h" -#include "MooTrackFitter.h" + +#include "AthenaKernel/Timeout.h" #include "SortMuPatHits.h" -#include "MooCandidateMatchingTool.h" -#include "MuonRecToolInterfaces/IMuonTrackToSegmentTool.h" -#include "MuonRecToolInterfaces/IMuonSeededSegmentFinder.h" -#include "MuPatCandidateTool.h" #include "MuPatTrack.h" #include "MuPatSegment.h" #include "MuonTrackMakerUtils/SortMeasurementsByPosition.h" #include "MuonTrackMakerUtils/SortTracksByHitNumber.h" -#include "MuonRecToolInterfaces/IMuonErrorOptimisationTool.h" - -#include "MuonRecToolInterfaces/IMuonHoleRecoveryTool.h" -#include "MuonRecToolInterfaces/IMuonTrackExtrapolationTool.h" - -#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" -#include "MuonRecHelperTools/MuonEDMPrinterTool.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - -#include "MuonRecToolInterfaces/IMuonCompetingClustersOnTrackCreator.h" -#include "MuonRecToolInterfaces/IMdtDriftCircleOnTrackCreator.h" -#include "TrkExInterfaces/IPropagator.h" -#include "TrkToolInterfaces/IResidualPullCalculator.h" #include "TrkEventPrimitives/ResidualPull.h" #include "TrkSegment/SegmentCollection.h" @@ -41,62 +23,19 @@ #include +#include "CxxUtils/checker_macros.h" +ATLAS_CHECK_FILE_THREAD_SAFETY; + namespace Muon { MooTrackBuilder::MooTrackBuilder(const std::string& t,const std::string& n,const IInterface* p) : - AthAlgTool(t,n,p), - m_fitter("Muon::MooTrackFitter/MooTrackFitter"), - m_slFitter("Muon::MooTrackFitter/MooSLTrackFitter"), - m_candidateHandler("Muon::MuPatCandidateTool/MuPatCandidateTool"), - m_candidateMatchingTool("Muon::MooCandidateMatchingTool/MooCandidateMatchingTool"), - m_trackToSegmentTool("Muon::MuonTrackToSegmentTool/MuonTrackToSegmentTool"), - m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), - m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool"), - m_seededSegmentFinder("Muon::MuonSeededSegmentFinder/MuonSeededSegmentFinder"), - m_mdtRotCreator("Muon::MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator"), - m_compRotCreator("Muon::TriggerChamberClusterOnTrackCreator/TriggerChamberClusterOnTrackCreator"), - m_propagator("Trk::STEP_Propagator/MuonPropagator"), - m_pullCalculator("Trk::ResidualPullCalculator/ResidualPullCalculator"), - m_hitRecoverTool("Muon::MuonChamberHoleRecoveryTool/MuonChamberHoleRecoveryTool"), - m_muonChamberHoleRecoverTool("Muon::MuonChamberHoleRecoveryTool/MuonChamberHoleRecoveryTool"), - m_trackExtrapolationTool("Muon::MuonTrackExtrapolationTool/MuonTrackExtrapolationTool"), - m_errorOptimisationTool(""), - m_magFieldSvc("AtlasFieldSvc",n), - m_magFieldProperties(Trk::FullField), - m_ncalls(0), - m_nTimedOut(0) + AthAlgTool(t,n,p) { - declareInterface(this); declareInterface(this); declareInterface(this); declareInterface(this); - - - declareProperty("Fitter",m_fitter,"Tool to fit segments to tracks"); - declareProperty("SLFitter",m_slFitter,"Tool to fit segments to tracks"); - declareProperty("SeededSegmentFinder",m_seededSegmentFinder,"Second stage segment finding tool"); - declareProperty("MdtRotCreator",m_mdtRotCreator,"Tool to recalibrate MdtDriftCircleOnTrack objects"); - declareProperty("CompetingClustersCreator",m_compRotCreator,"Tool to create CompetingMuonClustersOnTrack objects"); - declareProperty("Propagator",m_propagator,"propagator"); - declareProperty("MagFieldSvc", m_magFieldSvc ); - declareProperty("IdHelper",m_idHelper); - declareProperty("HitRecoveryTool",m_hitRecoverTool); - declareProperty("Printer",m_printer); - declareProperty("CandidateTool",m_candidateHandler); - declareProperty("CandidateMatchingTool",m_candidateMatchingTool); - declareProperty("TrackToSegmentTool",m_trackToSegmentTool); - declareProperty("ErrorOptimisationTool",m_errorOptimisationTool ); - - declareProperty("UseTimeOutGuard",m_doTimeOutChecks = true ); - declareProperty("UseExclusionList",m_useExclusionList = true ); - declareProperty("UseTrackingHistory", m_useTrackingHistory = true ); - declareProperty("RecalibrateMDTHitsOnTrack", m_recalibrateMDTHits = true); - } - - MooTrackBuilder::~MooTrackBuilder() { - } StatusCode MooTrackBuilder::initialize() { @@ -566,13 +505,13 @@ namespace Muon { // for now do not redo segment making for CSCs if( m_idHelper->isCsc( *chIds.begin() ) ){ if( m_candidateMatchingTool->match(candidate,segInfo,true) ) { - Trk::Track* newtrack = m_fitter->fit(candidate,segInfo,externalPhiHits); - if( !newtrack ) return 0; - std::vector* newTracks = new std::vector; - newTracks->push_back(newtrack); - return newTracks; + Trk::Track* newtrack = m_fitter->fit(candidate,segInfo,externalPhiHits); + if( !newtrack ) return 0; + std::vector* newTracks = new std::vector; + newTracks->push_back(newtrack); + return newTracks; }else{ - return 0; + return 0; } } diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackBuilder.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackBuilder.h index 0f3293a196479c3f4d08abcdea1078cdf21f6528..822102238ae746a13be2a822e98bf6e8419a7113 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackBuilder.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackBuilder.h @@ -9,49 +9,52 @@ #include "GaudiKernel/ServiceHandle.h" #include "AthenaBaseComps/AthAlgTool.h" +// Tools & interfaces #include "MuonRecToolInterfaces/IMuonSegmentTrackBuilder.h" #include "MuonRecToolInterfaces/IMuonTrackBuilder.h" #include "MuonRecToolInterfaces/IMuonTrackRefiner.h" - +#include "MuonRecToolInterfaces/IMuonTrackToSegmentTool.h" +#include "MuonRecToolInterfaces/IMuonSeededSegmentFinder.h" +#include "MuonRecToolInterfaces/IMuonHoleRecoveryTool.h" +#include "MuonRecToolInterfaces/IMuonTrackExtrapolationTool.h" +#include "MuonRecToolInterfaces/IMuonErrorOptimisationTool.h" +#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" +#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonRecToolInterfaces/IMuonCompetingClustersOnTrackCreator.h" +#include "MuonRecToolInterfaces/IMdtDriftCircleOnTrackCreator.h" +#include "TrkExInterfaces/IPropagator.h" +#include "TrkToolInterfaces/IResidualPullCalculator.h" #include "MagFieldInterfaces/IMagFieldSvc.h" -#include "TrkGeometry/MagneticFieldProperties.h" +// Tracking EDM +#include "TrkGeometry/MagneticFieldProperties.h" #include "TrkParameters/TrackParameters.h" -#include "Identifier/Identifier.h" - #include "TrkTrack/Track.h" #include "TrkTrack/TrackCollection.h" #include "TrkSegment/SegmentCollection.h" -#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" + +// Local +#include "MooTrackFitter.h" +#include "MooCandidateMatchingTool.h" +#include "MuPatCandidateTool.h" + +// Misc #include +#include "Identifier/Identifier.h" class MsgStream; namespace Trk { class Track; class PrepRawData; - class IPropagator; - class IResidualPullCalculator; - } namespace Muon { class MuonSegment; - class IMuonErrorOptimisationTool; - class IMuonHoleRecoveryTool; - class IMuonTrackExtrapolationTool; - class MooTrackFitter; - class MooCandidateMatchingTool; - class MuPatCandidateTool; - class IMuonTrackToSegmentTool; - class IMuonSeededSegmentFinder; - class MuonEDMPrinterTool; - class MuonIdHelperTool; class MuPatCandidateBase; class MuPatTrack; class MuPatSegment; - class IMdtDriftCircleOnTrackCreator; - class IMuonCompetingClustersOnTrackCreator; } static const InterfaceID IID_MooTrackBuilder("Muon::MooTrackBuilder",1,0); @@ -84,7 +87,7 @@ namespace Muon { MooTrackBuilder(const std::string&, const std::string&, const IInterface*); /** @brief destructor */ - ~MooTrackBuilder(); + ~MooTrackBuilder() = default; /** @brief initialize method, method taken from bass-class AlgTool */ StatusCode initialize(); @@ -253,35 +256,35 @@ namespace Muon { ) const; - ToolHandle m_fitter; - ToolHandle m_slFitter; - ToolHandle m_candidateHandler; //!< candidate handler - ToolHandle m_candidateMatchingTool; - ToolHandle m_trackToSegmentTool; - ServiceHandle m_edmHelperSvc {this, "edmHelper", + ToolHandle m_fitter {this, "Fitter", "Muon::MooTrackFitter/MooTrackFitter", "Tool to fit segments to tracks"}; + ToolHandle m_slFitter {this, "SLFitter", "Muon::MooTrackFitter/MooSLTrackFitter", "Tool to fit segments to tracks"}; + ToolHandle m_candidateHandler {this, "CandidateTool", "Muon::MuPatCandidateTool/MuPatCandidateTool"}; //!< candidate handler + ToolHandle m_candidateMatchingTool {this, "CandidateMatchingTool", "Muon::MooCandidateMatchingTool/MooCandidateMatchingTool"}; + ToolHandle m_trackToSegmentTool {this, "TrackToSegmentTool", "Muon::MuonTrackToSegmentTool/MuonTrackToSegmentTool"}; + ServiceHandle m_edmHelperSvc {this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc", "Handle to the service providing the IMuonEDMHelperSvc interface" }; - ToolHandle m_printer; - ToolHandle m_idHelper; - ToolHandle m_seededSegmentFinder; - ToolHandle m_mdtRotCreator; - ToolHandle m_compRotCreator; - ToolHandle m_propagator; - ToolHandle m_pullCalculator; - ToolHandle m_hitRecoverTool ; // m_muonChamberHoleRecoverTool ; // m_trackExtrapolationTool; // m_errorOptimisationTool; - ServiceHandle m_magFieldSvc; - Trk::MagneticFieldProperties m_magFieldProperties; //!< magnetic field properties - - bool m_doTimeOutChecks; //!< on/off time out check - bool m_useExclusionList; //!< use exclusion list (bit faster at the price of missing chambers) - bool m_useTrackingHistory; //!< use history of the track finding up to now to avoid creating duplicates - mutable unsigned int m_ncalls; - mutable unsigned int m_nTimedOut; - bool m_recalibrateMDTHits; + ToolHandle m_printer {this, "Printer", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"};//!< tool to print out EDM objects; + ToolHandle m_idHelper {this, "IdHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool"}; + ToolHandle m_seededSegmentFinder {this, "SeededSegmentFinder", "Muon::MuonSeededSegmentFinder/MuonSeededSegmentFinder"}; + ToolHandle m_mdtRotCreator {this, "MdtRotCreator", "Muon::MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator"}; + ToolHandle m_compRotCreator {this, "CompetingClustersCreator", "Muon::TriggerChamberClusterOnTrackCreator/TriggerChamberClusterOnTrackCreator"}; + ToolHandle m_propagator {this, "Propagator", "Trk::STEP_Propagator/MuonPropagator"}; + ToolHandle m_pullCalculator {this, "PullCalculator", "Trk::ResidualPullCalculator/ResidualPullCalculator"}; + ToolHandle m_hitRecoverTool {this, "HitRecoveryTool", "Muon::MuonChamberHoleRecoveryTool/MuonChamberHoleRecoveryTool"}; // m_muonChamberHoleRecoverTool {this, "ChamberHoleRecoveryTool", "Muon::MuonChamberHoleRecoveryTool/MuonChamberHoleRecoveryTool"}; // m_trackExtrapolationTool {this, "Extrapolator", "Muon::MuonTrackExtrapolationTool/MuonTrackExtrapolationTool"}; // m_errorOptimisationTool {this, "ErrorOptimisationTool", ""}; + ServiceHandle m_magFieldSvc {this, "MagFieldSvc", "AtlasFieldSvc"}; + Trk::MagneticFieldProperties m_magFieldProperties {Trk::FullField}; //!< magnetic field properties + + Gaudi::Property m_doTimeOutChecks {this,"UseTimeOutGuard" , true }; //!< on/off time out check + Gaudi::Property m_useExclusionList {this, "UseExclusionList" , true }; //!< use exclusion list (bit faster at the price of missing chambers) + Gaudi::Property m_useTrackingHistory {this, "UseTrackingHistory" , true }; //!< use history of the track finding up to now to avoid creating duplicates + Gaudi::Property m_recalibrateMDTHits {this, "RecalibrateMDTHitsOnTrack" , true }; + mutable std::atomic_uint m_ncalls {0}; + mutable std::atomic_uint m_nTimedOut {0}; }; diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.cxx index 819a79598b2a2cd48c60cdd6384d0cb8bdb7bf45..5df62c93eb0a6f7d6f145b0177e4ccfe658b6f1d 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.cxx @@ -6,28 +6,14 @@ #include "MuPatTrack.h" #include "MuPatSegment.h" #include "MuPatCandidateBase.h" -#include "MuPatHitTool.h" #include "MuonTrackMakerUtils/MuonTrackMakerStlTools.h" #include "MuonTrackMakerUtils/SortMeasurementsByPosition.h" #include "SortMuPatHits.h" -#include "MuonRecToolInterfaces/IMuonTrackToSegmentTool.h" -#include "MuonRecToolInterfaces/IMuonSegmentMomentumEstimator.h" -#include "MuonRecToolInterfaces/IMdtDriftCircleOnTrackCreator.h" -#include "MuonRecToolInterfaces/IMuonHitSelector.h" -#include "MuonRecToolInterfaces/IMuonTrackCleaner.h" -#include "MuonSegmentMakerToolInterfaces/IMuonSegmentInOverlapResolvingTool.h" - -#include "MuonRecHelperTools/MuonEDMPrinterTool.h" -#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" - #include "TrkGeometry/MagneticFieldProperties.h" #include "TrkGeometry/MaterialProperties.h" #include "TrkGeometry/Layer.h" -#include "TrkExInterfaces/IPropagator.h" -#include "TrkToolInterfaces/ITrackSummaryHelperTool.h" #include "TrkTrackSummary/TrackSummary.h" #include "TrkTrackSummary/MuonTrackSummary.h" @@ -63,66 +49,17 @@ #include "GeoPrimitives/GeoPrimitivesHelpers.h" #include "EventPrimitives/EventPrimitivesHelpers.h" +#include "CxxUtils/checker_macros.h" +ATLAS_CHECK_FILE_THREAD_SAFETY; + namespace Muon { MooTrackFitter::MooTrackFitter(const std::string& t,const std::string& n,const IInterface* p) : - AthAlgTool(t,n,p), - m_propagator("Trk::RungeKuttaPropagator/AtlasRungeKuttaPropagator"), - m_trackFitter("Trk::GlobalChi2Fitter/MCTBFitter"), - m_trackFitterPrefit("Trk::GlobalChi2Fitter/MCTBFitter"), - m_hitHandler("Muon::MuPatHitTool/MuPatHitTool"), - m_momentumEstimator("MuonSegmentMomentum/MuonSegmentMomentum"), - m_magFieldProperties(Trk::FullField), - m_idHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool"), - m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), - m_trackToSegmentTool("Muon::MuonTrackToSegmentTool/MuonTrackToSegmentTool"), - m_mdtRotCreator("Muon::MdtDriftCircleOnTrackCreator/MdtTubeHitOnTrackCreator"), - m_phiHitSelector("MuonPhiHitSelector/MuonPhiHitSelector"), - m_cleaner("Muon::MuonTrackCleaner/MuonTrackCleaner"), - m_overlapResolver("Muon::MuonSegmentInOverlapResolvingTool/MuonSegmentInOverlapResolvingTool"), - m_trackSummaryTool("Muon::MuonTrackSummaryHelperTool/MuonTrackSummaryHelperTool"), - m_patRecInfo(Trk::TrackInfo::Moore) + AthAlgTool(t,n,p) { declareInterface(this); - - declareProperty("PreCleaningReducedChi2Cut",m_preCleanChi2Cut = 500.,"minimum reduced chi2 for a track to be cleaned"); - declareProperty("ReducedChi2Cut",m_chi2Cut = 100.,"minimum reduced chi2 for a track to be accepted"); - declareProperty("Propagator", m_propagator); - declareProperty("Fitter", m_trackFitter); - declareProperty("FitterPreFit", m_trackFitterPrefit); - declareProperty("SegmentMomentum", m_momentumEstimator); - declareProperty("HitTool",m_hitHandler); - declareProperty("IdHelper",m_idHelperTool); - declareProperty("MuonPrinterTool",m_printer); - declareProperty("TrackToSegmentTool",m_trackToSegmentTool); - declareProperty("MdtRotCreator",m_mdtRotCreator); - declareProperty("PhiHitSelector",m_phiHitSelector); - declareProperty("TrackCleaner",m_cleaner); - declareProperty("SegmentInOverlapTool",m_overlapResolver); - - declareProperty("SLProp", m_slProp = false, "Enable straight line propagation"); - declareProperty("SLFit", m_slFit = true); - declareProperty("RunOutlier", m_runOutlier = false); - declareProperty("MatEffects", m_matEffects = 2); - declareProperty("SeedAtStartOfTrack", m_seedAtStartOfTrack = true ); - declareProperty("SeedWithAvePhi", m_seedWithAvePhi = true ); - declareProperty("SeedWithSegmentTheta",m_seedWithSegmentTheta = true ); - declareProperty("SeedPhiWithEtaHits", m_seedPhiWithEtaHits = false ); - declareProperty("UsePreciseHits", m_usePreciseHits = false ); - declareProperty("UsePrefit", m_usePrefit = true ); - declareProperty("AllowFirstFitResult", m_allowFirstFit = false ); - declareProperty("PThreshold", m_pThreshold = 500. ); - declareProperty("CleanPhiHits", m_cleanPhiHits = true ); - declareProperty("MaxPatternPhiHits", m_phiHitsMax = 40 ); - declareProperty("Cosmics", m_cosmics = false ); - declareProperty("OpeningAngleCut", m_openingAngleCut = 0.3 ); - declareProperty("UsePreciseHitsInFirstStation", m_preciseFirstStation = false ); - - } - - MooTrackFitter::~MooTrackFitter() { } StatusCode MooTrackFitter::initialize() { @@ -148,20 +85,6 @@ namespace Muon { ATH_CHECK( m_mdtRotCreator.retrieve() ); ATH_CHECK( m_phiHitSelector.retrieve() ); - m_nfits=0; - m_nfailedExtractInital=0; - m_nfailedMinMaxPhi=0; - m_nfailedParsInital=0; - m_nfailedExtractCleaning=0; - m_nfailedFakeInitial=0; - m_nfailedTubeFit=0; - m_noPerigee=0; - m_nlowMomentum=0; - m_nfailedExtractPrecise=0; - m_nfailedFakePrecise=0; - m_nfailedFitPrecise=0; - m_nsuccess=0; - return StatusCode::SUCCESS; } @@ -1276,19 +1199,21 @@ namespace Muon { std::map stationDataMap; + // Get a MuonTrackSummary. const Trk::TrackSummary* summary = track.trackSummary(); Trk::MuonTrackSummary muonSummary; if( summary ){ - if( summary->muonTrackSummary() ) muonSummary = *summary->muonTrackSummary(); - else{ - Trk::TrackSummary* tmpSum = const_cast(summary); - if( tmpSum ) m_trackSummaryTool->addDetailedTrackSummary(track,*tmpSum); - if( tmpSum->muonTrackSummary() ) muonSummary = *tmpSum->muonTrackSummary(); + if( summary->muonTrackSummary() ) { + muonSummary = *summary->muonTrackSummary(); + } else { + Trk::TrackSummary tmpSum(*summary); + m_trackSummaryTool->addDetailedTrackSummary(track,tmpSum); + if( tmpSum.muonTrackSummary() ) muonSummary = *(tmpSum.muonTrackSummary()); } }else{ Trk::TrackSummary tmpSummary; m_trackSummaryTool->addDetailedTrackSummary(track,tmpSummary); - if( tmpSummary.muonTrackSummary() ) muonSummary = *tmpSummary.muonTrackSummary(); + if( tmpSummary.muonTrackSummary() ) muonSummary = *(tmpSummary.muonTrackSummary()); } std::vector::const_iterator chit = muonSummary.chamberHitSummary().begin(); diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.h index 2c5df3ed780e0ab4c7a3c28fe1a329fb325cf8fa..fdcb71e4e1ecc37048b247bb94614c3a00aa2703 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.h @@ -9,23 +9,38 @@ #include "GaudiKernel/ServiceHandle.h" #include "AthenaBaseComps/AthAlgTool.h" -#include "TrkParameters/TrackParameters.h" +// Misc +#include "Identifier/Identifier.h" +#include "TrkGeometry/MagneticFieldProperties.h" +#include "MuonIdHelpers/MuonStationIndex.h" +// Tracking EDM +#include "TrkParameters/TrackParameters.h" #include "TrkTrack/TrackInfo.h" #include "TrkMeasurementBase/MeasurementBase.h" +// Tools & tool interfaces #include "TrkFitterInterfaces/ITrackFitter.h" -#include "MuonIdHelpers/MuonStationIndex.h" - -#include "MuPatCandidateBase.h" -#include "MuPatHit.h" - +#include "MuonRecToolInterfaces/IMuonTrackToSegmentTool.h" +#include "MuonRecToolInterfaces/IMuonSegmentMomentumEstimator.h" +#include "MuonRecToolInterfaces/IMdtDriftCircleOnTrackCreator.h" +#include "MuonRecToolInterfaces/IMuonHitSelector.h" +#include "MuonRecToolInterfaces/IMuonTrackCleaner.h" +#include "MuonSegmentMakerToolInterfaces/IMuonSegmentInOverlapResolvingTool.h" +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" +#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" +#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "TrkExInterfaces/IPropagator.h" +#include "TrkToolInterfaces/ITrackSummaryHelperTool.h" #include "TrkDriftCircleMath/SegmentFinder.h" #include "TrkDriftCircleMath/DCSLFitter.h" -#include "Identifier/Identifier.h" -#include "TrkGeometry/MagneticFieldProperties.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" +// Local +#include "MuPatCandidateBase.h" +#include "MuPatHit.h" +#include "MuPatHitTool.h" + #include class MsgStream; @@ -46,22 +61,22 @@ namespace Trk { class IPropagator; class Track; class MeasurementBase; - class PseudoMeasurementOnTrack; + // class PseudoMeasurementOnTrack; class Layer; - class ITrackSummaryHelperTool; + // 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 MuonEDMPrinterTool; +// class MuonIdHelperTool; +// class IMuonTrackCleaner; +// class MuPatHitTool; +// class IMuonSegmentMomentumEstimator; +// class IMuonTrackToSegmentTool; +// class IMdtDriftCircleOnTrackCreator; +// class IMuonSegmentInOverlapResolvingTool; +// class IMuonHitSelector; class MuPatCandidateBase; class MuPatTrack; } @@ -160,21 +175,20 @@ namespace Muon { }; struct GarbageCan{ - MeasVec measurementsToBeDeleted; // parametersToBeDeleted; // mctbHitsToBeDeleted; /** clean up memory managed by tool */ void cleanUp() { - for( const auto meas : measurementsToBeDeleted ) delete meas; - measurementsToBeDeleted.clear(); + for( const auto meas : measurementsToBeDeleted ) delete meas; + measurementsToBeDeleted.clear(); - for(const auto par : parametersToBeDeleted) delete par; - parametersToBeDeleted.clear(); + for(const auto par : parametersToBeDeleted) delete par; + parametersToBeDeleted.clear(); - for(const auto hit : mctbHitsToBeDeleted) delete hit; - mctbHitsToBeDeleted.clear(); + for(const auto hit : mctbHitsToBeDeleted) delete hit; + mctbHitsToBeDeleted.clear(); } }; @@ -183,7 +197,7 @@ namespace Muon { MooTrackFitter(const std::string&, const std::string&, const IInterface*); /** destructor */ - ~MooTrackFitter(); + ~MooTrackFitter() = default; /** initialize method, method taken from bass-class AlgTool */ StatusCode initialize(); @@ -292,61 +306,61 @@ namespace Muon { void cleanSegment( const MuonSegment& seg, std::set& removedIdentifiers ) const; void copyHitList( const MuPatHitList& hitList, MuPatHitList& copy, GarbageCan& garbage ) const; - ToolHandle m_propagator; //!< propagator - ToolHandle m_trackFitter; //!< fitter - ToolHandle m_trackFitterPrefit; //!< fitter used for prefit - ToolHandle m_hitHandler; //!< hit handler - ToolHandle m_momentumEstimator; //!< tool to estimate track momentum + ToolHandle m_propagator {this, "Propagator", "Trk::RungeKuttaPropagator/AtlasRungeKuttaPropagator"}; //!< propagator + ToolHandle m_trackFitter {this, "Fitter", "Trk::GlobalChi2Fitter/MCTBFitter"}; //!< fitter + ToolHandle m_trackFitterPrefit {this, "FitterPreFit", "Trk::GlobalChi2Fitter/MCTBFitter"}; //!< fitter used for prefit + ToolHandle m_hitHandler {this, "HitTool", "Muon::MuPatHitTool/MuPatHitTool"}; //!< hit handler + ToolHandle m_momentumEstimator {this, "SegmentMomentum", "MuonSegmentMomentum/MuonSegmentMomentum"}; //!< tool to estimate track momentum - Trk::RunOutlierRemoval m_runOutlier; //!< switch whether to run outlier logics or not - int m_matEffects; //!< type of material interaction in extrapolation - Trk::ParticleHypothesis m_ParticleHypothesis; //!< nomen est omen - Trk::MagneticFieldProperties m_magFieldProperties; //!< magnetic field properties - ToolHandle m_idHelperTool; //!< id helper tool - ServiceHandle m_edmHelperSvc {this, "edmHelper", + Gaudi::Property m_runOutlier {this, "RunOutlier", false, "Switch whether to run outlier logics or not"}; + Gaudi::Property m_matEffects {this, "MatEffects", 2, "type of material interaction in extrapolation"}; + 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_edmHelperSvc {this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc", - "Handle to the service providing the IMuonEDMHelperSvc interface" }; //!< multi purpose helper tool - ToolHandle m_printer; //!< tool to print out EDM objects - ToolHandle m_trackToSegmentTool; //!< helper tool to convert tracks into segments - ToolHandle m_mdtRotCreator; //!< mdt tube hit creator - ToolHandle m_phiHitSelector; //!< tool to clean phi hits - ToolHandle m_cleaner; - ToolHandle m_overlapResolver; - ToolHandle m_trackSummaryTool; // m_printer {this, "MuonPrinterTool", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"}; //!< tool to print out EDM objects + ToolHandle m_trackToSegmentTool {this, "TrackToSegmentTool", "Muon::MuonTrackToSegmentTool/MuonTrackToSegmentTool"};//!< helper tool to convert tracks into segments + ToolHandle m_mdtRotCreator {this, "MdtRotCreator", "Muon::MdtDriftCircleOnTrackCreator/MdtTubeHitOnTrackCreator"};//!< mdt tube hit creator + ToolHandle m_phiHitSelector {this, "PhiHitSelector", "MuonPhiHitSelector/MuonPhiHitSelector"}; //!< tool to clean phi hits + ToolHandle m_cleaner {this, "TrackCleaner", "Muon::MuonTrackCleaner/MuonTrackCleaner"}; + ToolHandle m_overlapResolver {this, "SegmentInOverlapTool", "Muon::MuonSegmentInOverlapResolvingTool/MuonSegmentInOverlapResolvingTool"}; + ToolHandle m_trackSummaryTool {this, "TrackSummaryTool", "Muon::MuonTrackSummaryHelperTool/MuonTrackSummaryHelperTool"}; // m_slFit {this, "SLFit", true, "Perform sl fit"}; + Gaudi::Property m_slProp {this, "SLProp", false, "Enable straight line propagation"}; + Gaudi::Property m_seedWithSegmentTheta{this, "SeedWithSegmentTheta", true, "Seed with theta connecting first + last eta hit"}; + Gaudi::Property m_seedWithAvePhi {this, "SeedWithAvePhi", true, "Seed with average phi of all phi hits"}; + Gaudi::Property m_seedPhiWithEtaHits {this, "SeedPhiWithEtaHits", false, "Seed phi from positions first last eta hit"}; + Gaudi::Property m_usePreciseHits {this, "UsePreciseHits", false, "Use actual measurement error"}; + Gaudi::Property m_usePrefit {this, "UsePrefit", true, "Use prefit"}; + Gaudi::Property m_allowFirstFit {this, "AllowFirstFitResult", false, "Return the result of the prefit is final fit fails"}; + Gaudi::Property m_pThreshold {this, "PThreshold", 500. , "Momentum cut-off. Seeds below the threshold will not be fitted"};// m_cosmics {this, "Cosmics", false, "Special treatment for cosmics"}; + Gaudi::Property m_cleanPhiHits {this, "CleanPhiHits", true, "Special flag to switch off phi hit cleaning"}; + Gaudi::Property m_phiHitsMax {this, "MaxPatternPhiHits", 40, "If more than maximum number of phi hits on pattern, no hits will be added"}; + Gaudi::Property m_seedAtStartOfTrack {this, "SeedAtStartOfTrack", true, "Provide seed parameters at the start of the track"}; + Gaudi::Property m_preciseFirstStation {this, "UsePreciseHitsInFirstStation", false, "use precise hits in first station to stabalise the fit"}; + + Gaudi::Property m_openingAngleCut {this, "OpeningAngleCut", 0.3 , "cut on the maximum difference in phi between measurements on the track"}; + Gaudi::Property m_preCleanChi2Cut {this, "PreCleaningReducedChi2Cut", 500., "minimum chi2/ndof for a track to be passed to cleaner"}; + Gaudi::Property m_chi2Cut {this, "ReducedChi2Cut", 100., "minimum chi2/ndof for a track to be accepted"}; + + mutable std::atomic_uint m_nfits {0}; + mutable std::atomic_uint m_nfailedExtractInital {0}; + mutable std::atomic_uint m_nfailedMinMaxPhi {0}; + mutable std::atomic_uint m_nfailedParsInital {0}; + mutable std::atomic_uint m_nfailedExtractCleaning {0}; + mutable std::atomic_uint m_nfailedFakeInitial {0}; + mutable std::atomic_uint m_nfailedTubeFit {0}; + mutable std::atomic_uint m_noPerigee {0}; + mutable std::atomic_uint m_nlowMomentum {0}; + mutable std::atomic_uint m_nfailedExtractPrecise {0}; + mutable std::atomic_uint m_nfailedFakePrecise {0}; + mutable std::atomic_uint m_nfailedFitPrecise {0}; + mutable std::atomic_uint m_nsuccess {0}; struct StationPhiData { unsigned int nphiHits; diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.cxx index 7a2a7e0eab2336c1dbf6c7b2385305cacd3a69dc..e5076c3deac26276dc2a474964972ce29148983d 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.cxx @@ -61,8 +61,6 @@ namespace Muon { , m_trackSelector("Muon::MuonTrackSelectorTool/MuonTrackSelectorTool", this) , m_muonHoleRecoverTool("Muon::MuonChamberHoleRecoveryTool/MuonChamberHoleRecoveryTool", this) , m_combinedSLOverlaps(false) - , m_findingDepth(0) - , m_seedCombinatorics(0) { declareInterface(this); @@ -135,15 +133,16 @@ namespace Muon { TrackCollection* MuonTrackSteering::find( const MuonSegmentCollection& coll ) const { TrackCollection* result = 0; - - // Initialise vectors etc. - init(); + SegColVec chamberSegments(MuonStationIndex::ChIndexMax); // print(*aSeg)); continue; } - m_chambersWithSegments.insert(chIndex); - m_stationsWithSegments.insert(stIndex); + chambersWithSegments.insert(chIndex); + stationsWithSegments.insert(stIndex); - std::vector< MuPatSegment*>& segments = m_chamberSegments[chIndex]; + std::vector< MuPatSegment*>& segments = chamberSegments[chIndex]; segments.push_back(aSeg); if( !m_combinedSLOverlaps ){ - std::vector< MuPatSegment*>& segments2 = m_stationSegments[stIndex]; + std::vector< MuPatSegment*>& segments2 = stationSegments[stIndex]; segments2.push_back(aSeg); } m_segmentsToDelete.push_back(aSeg); } if( m_combinedSLOverlaps ){ - combineOverlapSegments(m_chamberSegments[MuonStationIndex::BIS],m_chamberSegments[MuonStationIndex::BIL]); - combineOverlapSegments(m_chamberSegments[MuonStationIndex::BMS],m_chamberSegments[MuonStationIndex::BML]); - combineOverlapSegments(m_chamberSegments[MuonStationIndex::BOS],m_chamberSegments[MuonStationIndex::BOL]); - combineOverlapSegments(m_chamberSegments[MuonStationIndex::EIS],m_chamberSegments[MuonStationIndex::EIL]); - combineOverlapSegments(m_chamberSegments[MuonStationIndex::EMS],m_chamberSegments[MuonStationIndex::EML]); - combineOverlapSegments(m_chamberSegments[MuonStationIndex::EOS],m_chamberSegments[MuonStationIndex::EOL]); - combineOverlapSegments(m_chamberSegments[MuonStationIndex::EES],m_chamberSegments[MuonStationIndex::EEL]); - combineOverlapSegments(m_chamberSegments[MuonStationIndex::CSS],m_chamberSegments[MuonStationIndex::CSL]); - std::vector< MuPatSegment*>& segments = m_chamberSegments[MuonStationIndex::BEE]; + combineOverlapSegments(chamberSegments[MuonStationIndex::BIS],chamberSegments[MuonStationIndex::BIL], stationSegments, stationsWithSegments); + combineOverlapSegments(chamberSegments[MuonStationIndex::BMS],chamberSegments[MuonStationIndex::BML], stationSegments, stationsWithSegments); + combineOverlapSegments(chamberSegments[MuonStationIndex::BOS],chamberSegments[MuonStationIndex::BOL], stationSegments, stationsWithSegments); + combineOverlapSegments(chamberSegments[MuonStationIndex::EIS],chamberSegments[MuonStationIndex::EIL], stationSegments, stationsWithSegments); + combineOverlapSegments(chamberSegments[MuonStationIndex::EMS],chamberSegments[MuonStationIndex::EML], stationSegments, stationsWithSegments); + combineOverlapSegments(chamberSegments[MuonStationIndex::EOS],chamberSegments[MuonStationIndex::EOL], stationSegments, stationsWithSegments); + combineOverlapSegments(chamberSegments[MuonStationIndex::EES],chamberSegments[MuonStationIndex::EEL], stationSegments, stationsWithSegments); + combineOverlapSegments(chamberSegments[MuonStationIndex::CSS],chamberSegments[MuonStationIndex::CSL], stationSegments, stationsWithSegments); + std::vector< MuPatSegment*>& segments = chamberSegments[MuonStationIndex::BEE]; if( !segments.empty() ){ - m_chambersWithSegments.insert(MuonStationIndex::BEE); - m_stationsWithSegments.insert(MuonStationIndex::BE); - std::vector< MuPatSegment*>& segs = m_stationSegments[MuonStationIndex::BE]; + chambersWithSegments.insert(MuonStationIndex::BEE); + stationsWithSegments.insert(MuonStationIndex::BE); + std::vector< MuPatSegment*>& segs = stationSegments[MuonStationIndex::BE]; segs.insert(segs.end(),segments.begin(),segments.end()); } } return true; } - void MuonTrackSteering::combineOverlapSegments( std::vector< MuPatSegment*>& ch1, std::vector< MuPatSegment*>& ch2 ) const + void MuonTrackSteering::combineOverlapSegments( std::vector< MuPatSegment*>& ch1, std::vector< MuPatSegment*>& ch2, SegColVec& stationSegments, StSet& stationsWithSegments) const { /** try to find small/large overlaps, insert segment into stationVec */ @@ -255,7 +254,7 @@ namespace Muon { // get station index from the first segment in the first non empty vector MuonStationIndex::StIndex stIndex = !ch1.empty() ? ch1.front()->stIndex : ch2.front()->stIndex; - SegCol& stationVec = m_stationSegments[stIndex]; + SegCol& stationVec = stationSegments[stIndex]; // vector to flag entries in the second station that were matched std::vector wasMatched2( ch2.size(), false ); @@ -323,7 +322,6 @@ namespace Muon { continue; } - MuPatSegment* segInfo = m_candidateTool->createSegInfo( *newseg ); // check whether segment of good quality AND that its quality is equal or better than the input segments @@ -395,7 +393,7 @@ namespace Muon { } } - // loop over entries in second station as add unassociated entries to candidate entries + // loop over entries in second station and add unassociated entries to candidate entries for( unsigned int i=0;i& strategy) { diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.h index 81b348debded44a026671d5fea14e9579c07f50c..48e893de73e38f6dfe8481d2013c30acb87902d3 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.h @@ -101,11 +101,10 @@ namespace Muon { TrackCollection *selectTracks(std::vector & candidates, bool takeOwnership = true ) const; /** actual find method */ - TrackCollection* findTracks( ) const; - bool extractSegments( const MuonSegmentCollection& coll ) const; + TrackCollection* findTracks( SegColVec& chamberSegments, SegColVec& stationSegments ) const; + bool extractSegments( const MuonSegmentCollection& coll, SegColVec& chamberSegments, SegColVec& stationSegments, ChSet& chambersWithSegments, StSet& stationsWithSegments ) const; void cleanUp() const; - void init() const; StatusCode decodeStrategyVector(const std::vector& strategy); const MuonTrackSteeringStrategy* decodeStrategy(const std::string& strategy) const; @@ -128,7 +127,7 @@ namespace Muon { */ std::vector *solveAmbiguities( std::vector< MuPatTrack* >& tracks , const MuonTrackSteeringStrategy* strat = 0 ) const; - void combineOverlapSegments( std::vector< MuPatSegment*>& ch1, std::vector< MuPatSegment*>& ch2 ) const; + void combineOverlapSegments( std::vector< MuPatSegment*>& ch1, std::vector< MuPatSegment*>& ch2, SegColVec& stationSegments, StSet& stationsWithSegments ) const; private: @@ -147,14 +146,8 @@ namespace Muon { ToolHandle m_trackSelector; // m_muonHoleRecoverTool; - mutable SegColVec m_chamberSegments; // m_constsegmentsToDelete; std::vector m_strategies; @@ -168,8 +161,8 @@ namespace Muon { bool m_onlyMDTSeeding; int m_segThreshold; - mutable int m_findingDepth; - mutable int m_seedCombinatorics; + mutable std::atomic_uint m_findingDepth {0}; + mutable std::atomic_uint m_seedCombinatorics {0}; }; } diff --git a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py index f198ecebd7a7e702a487f352be7db265ea148e99..fc370fd1e7c2f063c8f84f6fb36a9229dcf92fe2 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py +++ b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py @@ -193,5 +193,5 @@ class MuonCombinedReconstruction(ConfiguredMuonRec): # runs over outputs and create xAODMuon collection topSequence += getAlgorithm("MuonCreatorAlg") - if muonCombinedRecFlags.doMuGirlLowBeta(): + if muonCombinedRecFlags.doMuGirl() and muonCombinedRecFlags.doMuGirlLowBeta(): topSequence += getAlgorithm("StauCreatorAlg")