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()
22 cfg.merge(setupHistSvcCfg(flags,outFile=outFile,
23 outStream=
"FastRecoTester"))
25 kwargs.setdefault(
"isMC", flags.Input.isMC)
26 kwargs.setdefault(
"isSeededReco", flags.Trigger.doHLT)
28 if not flags.Input.isMC:
29 kwargs.setdefault(
"TruthSegmentKey",
"")
31 if flags.Detector.GeometryMDT
or flags.Detector.GeometryRPC
or flags.Detector.GeometryTGC:
32 kwargs.setdefault(
"SpacePointKey",
"MuonSpacePoints")
34 kwargs.setdefault(
"SpacePointKey",
"")
35 if flags.Detector.GeometryMM
or flags.Detector.GeometrysTGC:
36 kwargs.setdefault(
"NswSpacePointKey",
"NswSpacePoints")
38 kwargs.setdefault(
"NswSpacePointKey",
"")
40 theAlg = CompFactory.MuonValR4.MuonFastRecoTester(name, **kwargs)
41 result.addEventAlgo(theAlg, primary=
True)
44if __name__==
"__main__":
45 from MuonGeoModelTestR4.testGeoModel
import setupGeoR4TestCfg, SetupArgParser
46 from MuonConfig.MuonConfigUtils
import executeTest,setupHistSvcCfg
47 parser = SetupArgParser()
48 parser.set_defaults(nEvents = -1)
49 parser.add_argument(
"--noPerfMon", help=
"If set to true, full perfmonMT is enabled",
50 default=
False, action=
'store_true')
51 parser.add_argument(
"--writeSpacePoints", help=
"If set to true, the spacepoints in the bucket are saved to disk",
52 default=
False, action=
'store_true')
53 parser.add_argument(
"--noMonitorPlots", help=
"If set to true, there're no monitoring plots", default =
False,
55 parser.add_argument(
"--runHoughTest", help=
"If set to true, the hough transform test is run on the output of the fast reco alg",
56 default=
False, action=
'store_true')
57 parser.add_argument(
"--runMSTrackTest", help=
"If set to true, the MS Track Finding test is run on the output of the fast reco alg",
58 default=
False, action=
'store_true')
59 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",
60 default=
False, action=
'store_true')
61 parser.add_argument(
"--vTune", help=
"If set to true, the code is profiled with VTune (With the proper command!)",
62 default=
False, action=
'store_true')
63 parser.add_argument(
'--evtNumber',default=
None,nargs=
"+",type=int,help=
"specify to select an evtNumber")
65 parser.set_defaults(outRootFile=
"FastRecoTester.root")
66 from MuonGeoModelTestR4.testGeoModel
import MuonPhaseIITestDefaults
67 parser.set_defaults(inputFile = MuonPhaseIITestDefaults.RDO_R3)
68 parser.set_defaults(eventPrintoutLevel = 50)
70 args = parser.parse_args()
71 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
72 flags = initConfigFlags()
73 flags.PerfMon.doFullMonMT =
not args.noPerfMon
74 flags.PerfMon.OutputJSON=
"perfmonmt_MuonR4FastReco.json"
75 flags.PerfMon.VTune.ProfiledAlgs = [
"MuonGlobalPatternFindingAlg"]
77 flags, cfg = setupGeoR4TestCfg(args,flags)
80 from PerfMonVTune.PerfMonVTuneConfig
import VTuneProfilerServiceCfg
81 cfg.merge(VTuneProfilerServiceCfg(flags))
84 from MuonConfig.MuonDataPrepConfig
import xAODUncalibMeasPrepCfg
85 cfg.merge(xAODUncalibMeasPrepCfg(flags))
86 from MuonSpacePointFormation.SpacePointFormationConfig
import MuonSpacePointFormationCfg
87 cfg.merge(MuonSpacePointFormationCfg(flags))
90 from MuonFastRecoAlgs.MuonFastReconstructionConfig
import MuonGlobalPatternFindingAlgCfg, MuonFastSegmentFittingAlgCfg, MuonFastSABuilderAlgCfg
91 cfg.merge(MuonGlobalPatternFindingAlgCfg(flags))
92 cfg.merge(MuonFastSegmentFittingAlgCfg(flags))
93 cfg.merge(MuonFastSABuilderAlgCfg(flags))
95 writeSpacePoints = args.writeSpacePoints))
97 if args.runHoughTest
or args.runMSTrackTest:
99 if args.useFastRecoSpacePoints:
100 from MuonFastRecoAlgs.MuonFastReconstructionConfig
import MuonFastSpacepointFilteringAlgCfg, PatternRecognitionFromFastRecoCfg
101 cfg.merge(MuonFastSpacepointFilteringAlgCfg(flags))
102 cfg.merge(PatternRecognitionFromFastRecoCfg(flags))
104 from MuonPatternRecognitionAlgs.MuonPatternRecognitionConfig
import MuonPatternRecognitionCfg
105 cfg.merge(MuonPatternRecognitionCfg(flags))
107 from MuonTruthAlgsR4.MuonTruthAlgsConfig
import MuonToTruthAssocAlgCfg, MuonTruthAlgsCfg
108 cfg.merge(MuonTruthAlgsCfg(flags))
111 if args.runHoughTest:
112 cfg.merge(setupHistSvcCfg(flags,outFile=
"HoughTransformTester.root",
113 outStream=
"MuonEtaHoughTransformTest"))
114 from MuonPatternRecognitionTest.PatternTestConfig
import MuonHoughTransformTesterCfg, PatternVisualizationToolCfg
115 cfg.merge(MuonHoughTransformTesterCfg(flags,
116 name =
"MuonHoughTransformTester",
117 writeSpacePoints =
False,
118 VisualizationTool = cfg.popToolsAndMerge(PatternVisualizationToolCfg(flags, CanvasLimits =0))))
121 if args.runMSTrackTest:
122 from MuonTrackFindingAlgs.TrackFindingConfig
import MSTrackFinderAlgCfg, MuonCreatorAlgCfg, StandaloneTrackPartCnvCfg, MuidSaTagMakerAlgCfg
123 cfg.merge(MSTrackFinderAlgCfg(flags))
124 cfg.merge(MuonCreatorAlgCfg(flags, name =
"MuonActsCreatorAlg",
125 TagKeys = [
"MuonTagsSA"]))
126 cfg.merge(StandaloneTrackPartCnvCfg(flags))
127 cfg.merge(MuidSaTagMakerAlgCfg(flags))
128 cfg.merge(MuonToTruthAssocAlgCfg(flags))
129 from MuonTrackFindingTest.MsTrackFindingTester
import MsTrackTesterCfg
130 cfg.merge(MsTrackTesterCfg(flags, scheduleLegacy=
False))
137 from IOVDbSvc.IOVDbSvcConfig
import addOverride
138 cfg.merge(addOverride(flags,
"/MDT/TWINMAPPING",
"MDTTwinMapping_compactFormat_Run123"))
140 if not args.noMonitorPlots:
142 CanvasPreFix=
"GlobPatFinderValid",
143 doPhiBucketViews =
False,
144 doEtaBucketViews =
False,
145 doRZBucketViews =
True,
146 paintTruthSegment =
False,
147 outSubDir=
"GlobPatFinderValidPlots",
148 displayTruthOnly =
False,
149 saveSinglePDFs =
True))
150 from MuonPatternRecognitionTest.PatternTestConfig
import PatternVisualizationToolCfg
151 cfg.getEventAlgo(
"MuonFastSegmentFittingAlg").VisualizationTool = cfg.popToolsAndMerge(PatternVisualizationToolCfg(flags,
152 CanvasPreFix=
"FastSegmentValid",
153 outSubDir=
"FastSegmentValidPlots",
154 displayTruthOnly =
True,
155 saveSinglePDFs =
True,
156 saveSummaryPDF=
True))
158 if args.evtNumber
is not None:
159 mainSeq =
"AthAllAlgSeq"
160 topSeq = cfg.getSequence(
"AthAlgEvtSeq")
161 algSeq = cfg.getSequence(mainSeq)
162 mainSeq =
"New" + mainSeq
164 topSeq.Members = [topSeq.Members[0],
165 CompFactory.AthSequencer(mainSeq, Sequential=
True, ModeOR=
False, StopOverride=
False),
167 cfg.addEventAlgo(CompFactory.EventNumberFilterAlgorithm(
"EvtNumberFilter",EventNumbers=args.evtNumber),sequenceName=mainSeq)
168 cfg.getSequence(mainSeq).Members += [algSeq]
170 cfg.getService(
"MessageSvc").setVerbose = [
"MuonGlobalPatternFindingAlg",
"MuonFastSegmentFittingAlg",
"MuonFastSABuilderAlg",
"MuonFastRecoTester"]
FastRecoVisualizationToolCfg(flags, name="FastRecoVisualizationTool", **kwargs)
MuonFastRecoTesterCfg(flags, name="MuonFastRecoTester", outFile="FastRecoTester.root", **kwargs)