ATLAS Offline Software
Loading...
Searching...
No Matches
MuonFastReconstructionConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory import CompFactory
5
6def MuonGlobalPatternFindingAlgCfg(flags, name = "MuonGlobalPatternFindingAlg", **kwargs):
7 result = ComponentAccumulator()
8 from ActsAlignmentAlgs.AlignmentAlgsConfig import ActsGeometryContextAlgCfg
9 result.merge(ActsGeometryContextAlgCfg(flags))
10
11 # Set defaults input space point containers
12 SpacePointContainers = ["MuonSpacePoints"]
13 if flags.Detector.GeometrysTGC or flags.Detector.GeometryMM:
14 SpacePointContainers += ["NswSpacePoints"]
15 kwargs.setdefault("InSpacePoints", SpacePointContainers)
16
17 # Set defaults for the minimum number of layers required to form a pattern
18 kwargs.setdefault("MinBendingTriggerLayers", 1)
19 kwargs.setdefault("MinBendingPrecisionLayers", 8)
20 kwargs.setdefault("MinPhiLayers", 1)
21
22 theAlg = CompFactory.MuonR4.MuonGlobalPatternFindingAlg(name, **kwargs)
23 result.addEventAlgo(theAlg, primary=True)
24 return result
25
26def MuonFastSegmentFittingAlgCfg(flags, name = "MuonFastSegmentFittingAlg", **kwargs):
27 result = ComponentAccumulator()
28 from ActsAlignmentAlgs.AlignmentAlgsConfig import ActsGeometryContextAlgCfg
29 result.merge(ActsGeometryContextAlgCfg(flags))
30
31 # Set SP calibrator tool
32 from MuonSpacePointCalibrator.CalibrationConfig import MuonSpacePointCalibratorCfg
33 kwargs.setdefault("Calibrator", result.popToolsAndMerge(MuonSpacePointCalibratorCfg(flags)))
34
35 # Set the segment converter tool
36 from MuonSegmentCnv.MuonSegmentCnvConfig import xAODSegmentCnvToolCfg
37 kwargs.setdefault("SegmentCnvTool", result.popToolsAndMerge(xAODSegmentCnvToolCfg(flags,
38 estimateHoles=False)))
39
40 theAlg = CompFactory.MuonR4.MuonFastSegmentFittingAlg(name, **kwargs)
41 result.addEventAlgo(theAlg, primary=True)
42 return result
43
44def MuonFastSABuilderAlgCfg(flags, name = "MuonFastSABuilderAlg", **kwargs):
45 result = ComponentAccumulator()
46
47 # Set the track seeding tool for momentum estimation
48 from MuonTrackFindingAlgs.TrackFindingConfig import MsTrackSeedingToolCfg, SegmentSelectorCfg
49 seedingTool_kwargs = {}
50 seedingTool_kwargs["SegmentSelectionTool"] = result.popToolsAndMerge(
51 SegmentSelectorCfg(flags, minRpcPhiSeedHitsBI=1,
52 minRpcPhiSeedHitsBM=1,
53 minRpcPhiSeedHitsBO=1,
54 minTgcPhiSeedHitsEI=1,
55 minTgcPhiSeedHitsEM=1))
56 seedingTool_kwargs["SegmentContainer"] = ""
57 kwargs.setdefault("SeedingTool", result.popToolsAndMerge(MsTrackSeedingToolCfg(flags, **seedingTool_kwargs)))
58
59 theAlg = CompFactory.MuonR4.MuonFastSABuilderAlg(name, **kwargs)
60 result.addEventAlgo(theAlg, primary=True)
61 return result
62
63def MuonFastSpacepointFilteringAlgCfg(flags, name = "MuonFastSpacepointFilteringAlg", **kwargs):
64 result = ComponentAccumulator()
65
66 # Disable NSW outputspace point if needed
67 if not flags.Detector.GeometrysTGC and not flags.Detector.GeometryMM:
68 kwargs.setdefault("OutNswSpacePoints", "")
69
70 theAlg = CompFactory.MuonR4.MuonFastSpacepointFilteringAlg(name, **kwargs)
71 result.addEventAlgo(theAlg, primary=True)
72 return result
73
74def PatternRecognitionFromFastRecoCfg(flags, suffix = ""):
75 result = ComponentAccumulator()
76 from ActsAlignmentAlgs.AlignmentAlgsConfig import ActsGeometryContextAlgCfg
77 result.merge(ActsGeometryContextAlgCfg(flags))
78
79 from MuonPatternRecognitionAlgs.MuonPatternRecognitionConfig import MuonEtaHoughTransformAlgCfg, MuonNSWSegmentFinderAlgCfg, MuonPhiHoughTransformAlgCfg, MuonSegmentFittingAlgCfg
80 segmentContainers = []
81 if flags.Detector.GeometrysTGC or flags.Detector.GeometryMM:
82 segmentContainers+=["MuonNswSegments"]
83 result.merge(MuonEtaHoughTransformAlgCfg(flags, name=f"MuonNswEtaHoughTransformAlg{suffix}",
84 EtaHoughMaxContainer = "MuonHoughNswMaxima",
85 SpacePointContainer = "MuonFastRecoNswSpacePoints"))
86 result.merge(MuonNSWSegmentFinderAlgCfg(flags, name=f"MuonNswSegmentFinderAlg{suffix}",
87 MuonNswSegmentWriteKey = segmentContainers[-1],
88 MuonNswSegmentSeedWriteKey = "MuonNswSegmentSeeds",
89 CombinatorialReadKey = "MuonHoughNswMaxima"))
90
91 if flags.Detector.GeometryMDT or flags.Detector.GeometryRPC or flags.Detector.GeometryTGC:
92 result.merge(MuonEtaHoughTransformAlgCfg(flags, name = f"MuonEtaHoughTransformAlg{suffix}",
93 SpacePointContainer = "MuonFastRecoSpacePoints"))
94 result.merge(MuonPhiHoughTransformAlgCfg(flags, name = f"MuonPhiHoughTransformAlg{suffix}"))
95 segmentContainers+=["R4MuonSegments"]
96
97 result.merge(MuonSegmentFittingAlgCfg(flags,
98 name = f"MuonSegmentFittingAlg{suffix}",
99 OutSegmentContainer=segmentContainers[-1]))
100
101 from MuonSegmentCnv.MuonSegmentCnvConfig import xAODSegmentCnvAlgCfg
102 result.merge(xAODSegmentCnvAlgCfg(flags, name = f"MuonR4xAODSegmentCnvAlg{suffix}", InSegmentKeys = segmentContainers))
103 if flags.Muon.setupTruthAlgorithms:
104 from MuonTruthAlgsR4.MuonTruthAlgsConfig import RecoSegmentTruthAssocCfg
105 result.merge(RecoSegmentTruthAssocCfg(flags,
106 name=f"MuonSegmentsFromR4TruthMatching{suffix}",
107 SegmentKey="MuonSegmentsFromR4"))
108 if flags.Muon.scheduleActsReco:
109 from MuonSegmentCnv.MuonSegmentCnvConfig import MuonR4SegmentCnvAlgCfg
110 result.merge(MuonR4SegmentCnvAlgCfg(flags,
111 name=f"MuonR4SegmentCnvAlg{suffix}",
112 ReadSegments = segmentContainers,
113 WriteKey="TrackMuonSegments"))
114 return result
MuonFastSegmentFittingAlgCfg(flags, name="MuonFastSegmentFittingAlg", **kwargs)
MuonFastSpacepointFilteringAlgCfg(flags, name="MuonFastSpacepointFilteringAlg", **kwargs)
MuonGlobalPatternFindingAlgCfg(flags, name="MuonGlobalPatternFindingAlg", **kwargs)
MuonFastSABuilderAlgCfg(flags, name="MuonFastSABuilderAlg", **kwargs)