3from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory
import CompFactory
7 result = ComponentAccumulator()
8 from MuonConfig.MuonDataPrepConfig
import PrimaryMeasContNamesCfg
9 kwargs.setdefault(
"PrdContainer", PrimaryMeasContNamesCfg(flags))
10 if flags.Muon.setupTruthAlgorithms:
11 from MuonObjectMarker.ObjectMarkerConfig
import TruthMeasMarkerAlgCfg
12 markerAlg = result.getPrimaryAndMerge(TruthMeasMarkerAlgCfg(flags))
13 kwargs.setdefault(
"TruthSegDecors", [markerAlg.SegmentLinkKey])
14 kwargs[
"TruthSegDecors"] += [markerAlg.SegmentLinkKey]
15 the_tool = CompFactory.MuonValR4.FastRecoVisualizationTool(name, **kwargs)
16 result.setPrivateTools(the_tool)
20 result = ComponentAccumulator()
21 kwargs.setdefault(
"isMC", flags.Input.isMC)
22 kwargs.setdefault(
"isSeededReco", flags.Trigger.doHLT)
24 if flags.Detector.GeometryMDT
or flags.Detector.GeometryRPC
or flags.Detector.GeometryTGC:
25 kwargs.setdefault(
"SpacePointKey",
"MuonSpacePoints")
27 kwargs.setdefault(
"SpacePointKey",
"")
28 if flags.Detector.GeometryMM
or flags.Detector.GeometrysTGC:
29 kwargs.setdefault(
"NswSpacePointKey",
"NswSpacePoints")
31 kwargs.setdefault(
"NswSpacePointKey",
"")
33 theAlg = CompFactory.MuonValR4.MuonFastRecoTester(name, **kwargs)
34 result.addEventAlgo(theAlg, primary=
True)
37if __name__==
"__main__":
38 from MuonGeoModelTestR4.testGeoModel
import setupGeoR4TestCfg, SetupArgParser
39 from MuonConfig.MuonConfigUtils
import executeTest,setupHistSvcCfg
40 parser = SetupArgParser()
41 parser.set_defaults(nEvents = -1)
42 parser.add_argument(
"--noPerfMon", help=
"If set to true, full perfmonMT is enabled",
43 default=
False, action=
'store_true')
44 parser.add_argument(
"--writeSpacePoints", help=
"If set to true, the spacepoints in the bucket are saved to disk",
45 default=
False, action=
'store_true')
46 parser.add_argument(
"--noMonitorPlots", help=
"If set to true, there're no monitoring plots", default =
False,
48 parser.add_argument(
"--runHoughTest", help=
"If set to true, the hough transform test is run on the output of the fast reco alg",
49 default=
False, action=
'store_true')
50 parser.add_argument(
"--runMSTrackTest", help=
"If set to true, the MS Track Finding test is run on the output of the fast reco alg",
51 default=
False, action=
'store_true')
52 parser.add_argument(
"--useFastRecoSpacePoints", help=
"If set to true, we run the pattern recognition chain on the space points from the fast reco instead of spacepointMaker",
53 default=
False, action=
'store_true')
54 parser.add_argument(
"--vTune", help=
"If set to true, the code is profiled with VTune (With the proper command!)",
55 default=
False, action=
'store_true')
57 parser.set_defaults(outRootFile=
"FastRecoTester.root")
58 from MuonGeoModelTestR4.testGeoModel
import MuonPhaseIITestDefaults
59 parser.set_defaults(inputFile = MuonPhaseIITestDefaults.HITS_PG_R3)
60 parser.set_defaults(eventPrintoutLevel = 50)
62 args = parser.parse_args()
63 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
64 flags = initConfigFlags()
65 flags.PerfMon.doFullMonMT =
not args.noPerfMon
66 flags.PerfMon.OutputJSON=
"perfmonmt_MuonR4FastReco.json"
67 flags.PerfMon.VTune.ProfiledAlgs = [
"MuonFastReconstructionAlg"]
69 flags, cfg = setupGeoR4TestCfg(args,flags)
73 from PerfMonVTune.PerfMonVTuneConfig
import VTuneProfilerServiceCfg
74 cfg.merge(VTuneProfilerServiceCfg(flags))
77 from MuonConfig.MuonDataPrepConfig
import xAODUncalibMeasPrepCfg
78 cfg.merge(xAODUncalibMeasPrepCfg(flags))
79 from MuonSpacePointFormation.SpacePointFormationConfig
import MuonSpacePointFormationCfg
80 cfg.merge(MuonSpacePointFormationCfg(flags))
83 from MuonFastRecoAlgs.MuonFastReconstructionConfig
import MuonFastReconstructionAlgCfg, PatternRecognitionFromFastRecoCfg
84 cfg.merge(MuonFastReconstructionAlgCfg(flags))
85 cfg.merge(setupHistSvcCfg(flags,outFile=args.outRootFile,
86 outStream=
"FastRecoTester"))
88 name =
"MuonFastRecoTester",
89 writeSpacePoints = args.writeSpacePoints))
92 if args.useFastRecoSpacePoints:
93 cfg.merge(PatternRecognitionFromFastRecoCfg(flags))
95 from MuonPatternRecognitionAlgs.MuonPatternRecognitionConfig
import MuonPatternRecognitionCfg
96 cfg.merge(MuonPatternRecognitionCfg(flags))
100 cfg.merge(setupHistSvcCfg(flags,outFile=
"HoughTransformTester.root",
101 outStream=
"MuonEtaHoughTransformTest"))
102 from MuonPatternRecognitionTest.PatternTestConfig
import MuonHoughTransformTesterCfg, PatternVisualizationToolCfg
103 cfg.merge(MuonHoughTransformTesterCfg(flags,
104 name =
"MuonHoughTransformTester",
105 writeSpacePoints =
False,
106 VisualizationTool = cfg.popToolsAndMerge(PatternVisualizationToolCfg(flags, CanvasLimits =0))))
109 if args.runMSTrackTest:
110 cfg.merge(setupHistSvcCfg(flags,outFile=
"MsTrackTester.root",
111 outStream=
"MuonTrackTester"))
112 from MuonTrackFindingAlgs.TrackFindingConfig
import MSTrackFinderAlgCfg
113 cfg.merge(MSTrackFinderAlgCfg(flags))
114 from MuonTrackFindingTest.MsTrackFindingTester
import MsTrackTesterCfg
115 cfg.merge(MsTrackTesterCfg(flags, LegacyTrackKey=
"", LegacyMuonKey=
"", LegacySegmentKey=
""))
122 from IOVDbSvc.IOVDbSvcConfig
import addOverride
123 cfg.merge(addOverride(flags,
"/MDT/TWINMAPPING",
"MDTTwinMapping_compactFormat_Run123"))
125 if not args.noMonitorPlots:
127 CanvasPreFix=
"FastRecoValid",
128 doPhiBucketViews =
False,
129 doEtaBucketViews =
False,
130 doRZBucketViews =
True,
131 paintTruthSegment =
False,
132 outSubDir=
"FastReconstructionValidPlots",
133 displayTruthOnly =
False,
134 saveSinglePDFs =
True))
MuonFastRecoTesterCfg(flags, name="MuonFastRecoTester", **kwargs)
FastRecoVisualizationToolCfg(flags, name="FastRecoVisualizationTool", **kwargs)