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))
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)
23 if flags.Detector.GeometryMDT
or flags.Detector.GeometryRPC
or flags.Detector.GeometryTGC:
24 kwargs.setdefault(
"SpacePointKey",
"MuonSpacePoints")
26 kwargs.setdefault(
"SpacePointKey",
"")
27 if flags.Detector.GeometryMM
or flags.Detector.GeometrysTGC:
28 kwargs.setdefault(
"NswSpacePointKey",
"NswSpacePoints")
30 kwargs.setdefault(
"NswSpacePointKey",
"")
32 theAlg = CompFactory.MuonValR4.MuonFastRecoTester(name, **kwargs)
33 result.addEventAlgo(theAlg, primary=
True)
36if __name__==
"__main__":
37 from MuonGeoModelTestR4.testGeoModel
import setupGeoR4TestCfg, SetupArgParser
38 from MuonConfig.MuonConfigUtils
import executeTest,setupHistSvcCfg
39 parser = SetupArgParser()
40 parser.set_defaults(nEvents = -1)
41 parser.add_argument(
"--noPerfMon", help=
"If set to true, full perfmonMT is enabled",
42 default=
False, action=
'store_true')
43 parser.add_argument(
"--writeSpacePoints", help=
"If set to true, the spacepoints in the bucket are saved to disk",
44 default=
False, action=
'store_true')
45 parser.add_argument(
"--noMonitorPlots", help=
"If set to true, there're no monitoring plots", default =
False,
47 parser.add_argument(
"--runHoughTest", help=
"If set to true, the hough transform test is run on the output of the fast reco alg",
48 default=
False, action=
'store_true')
49 parser.add_argument(
"--runMSTrackTest", help=
"If set to true, the MS Track Finding test is run on the output of the fast reco alg",
50 default=
False, action=
'store_true')
51 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",
52 default=
False, action=
'store_true')
53 parser.add_argument(
"--vTune", help=
"If set to true, the code is profiled with VTune (With the proper command!)",
54 default=
False, action=
'store_true')
55 parser.set_defaults(outRootFile=
"FastRecoTester.root")
56 from MuonGeoModelTestR4.testGeoModel
import MuonPhaseIITestDefaults
57 parser.set_defaults(inputFile = MuonPhaseIITestDefaults.HITS_PG_R3)
58 parser.set_defaults(eventPrintoutLevel = 50)
60 args = parser.parse_args()
61 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
62 flags = initConfigFlags()
63 flags.PerfMon.doFullMonMT =
not args.noPerfMon
64 flags.PerfMon.OutputJSON=
"perfmonmt_MuonR4FastReco.json"
65 flags.PerfMon.VTune.ProfiledAlgs = [
"MuonFastReconstructionAlg"]
67 flags, cfg = setupGeoR4TestCfg(args,flags)
71 from PerfMonVTune.PerfMonVTuneConfig
import VTuneProfilerServiceCfg
72 cfg.merge(VTuneProfilerServiceCfg(flags))
75 from MuonConfig.MuonDataPrepConfig
import xAODUncalibMeasPrepCfg
76 cfg.merge(xAODUncalibMeasPrepCfg(flags))
77 from MuonSpacePointFormation.SpacePointFormationConfig
import MuonSpacePointFormationCfg
78 cfg.merge(MuonSpacePointFormationCfg(flags))
81 from MuonFastRecoAlgs.MuonFastReconstructionConfig
import MuonFastReconstructionAlgCfg, PatternRecognitionFromFastRecoCfg
82 cfg.merge(MuonFastReconstructionAlgCfg(flags))
83 cfg.merge(setupHistSvcCfg(flags,outFile=args.outRootFile,
84 outStream=
"FastRecoTester"))
86 name =
"MuonFastRecoTester",
87 writeSpacePoints = args.writeSpacePoints))
90 if args.useFastRecoSpacePoints:
91 cfg.merge(PatternRecognitionFromFastRecoCfg(flags))
93 from MuonPatternRecognitionAlgs.MuonPatternRecognitionConfig
import MuonPatternRecognitionCfg
94 cfg.merge(MuonPatternRecognitionCfg(flags))
98 cfg.merge(setupHistSvcCfg(flags,outFile=
"HoughTransformTester.root",
99 outStream=
"MuonEtaHoughTransformTest"))
100 from MuonPatternRecognitionTest.PatternTestConfig
import MuonHoughTransformTesterCfg, PatternVisualizationToolCfg
101 cfg.merge(MuonHoughTransformTesterCfg(flags,
102 name =
"MuonHoughTransformTester",
103 SpacePointKey =
"MuonSpacePointsFastReco" if args.useFastRecoSpacePoints
else "MuonSpacePoints",
104 writeSpacePoints =
False,
105 VisualizationTool = cfg.popToolsAndMerge(PatternVisualizationToolCfg(flags, CanvasLimits =0))))
108 if args.runMSTrackTest:
109 cfg.merge(setupHistSvcCfg(flags,outFile=
"MsTrackTester.root",
110 outStream=
"MuonTrackTester"))
111 from MuonTrackFindingAlgs.TrackFindingConfig
import MSTrackFinderAlgCfg
112 cfg.merge(MSTrackFinderAlgCfg(flags))
113 from MuonTrackFindingTest.MsTrackFindingTester
import MsTrackTesterCfg
114 cfg.merge(MsTrackTesterCfg(flags, LegacyTrackKey=
"", LegacyMuonKey=
"", LegacySegmentKey=
""))
121 from IOVDbSvc.IOVDbSvcConfig
import addOverride
122 cfg.merge(addOverride(flags,
"/MDT/TWINMAPPING",
"MDTTwinMapping_compactFormat_Run123"))
124 if not args.noMonitorPlots:
126 CanvasPreFix=
"FastRecoValid",
127 doPhiBucketViews =
False,
128 doEtaBucketViews =
False,
129 doRZBucketViews =
True,
130 paintTruthSegment =
False,
131 outSubDir=
"FastReconstructionValidPlots",
132 displayTruthOnly =
False,
133 saveSinglePDFs =
True))
MuonFastRecoTesterCfg(flags, name="MuonFastRecoTester", **kwargs)
FastRecoVisualizationToolCfg(flags, name="FastRecoVisualizationTool", **kwargs)