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 = [
"MuonFastReconstructionAlg"]
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 MuonFastReconstructionAlgCfg, PatternRecognitionFromFastRecoCfg
91 cfg.merge(MuonFastReconstructionAlgCfg(flags))
93 writeSpacePoints = args.writeSpacePoints))
95 if args.runHoughTest
or args.runMSTrackTest:
97 if args.useFastRecoSpacePoints:
98 cfg.merge(PatternRecognitionFromFastRecoCfg(flags))
100 from MuonPatternRecognitionAlgs.MuonPatternRecognitionConfig
import MuonPatternRecognitionCfg
101 cfg.merge(MuonPatternRecognitionCfg(flags))
103 from MuonTruthAlgsR4.MuonTruthAlgsConfig
import MuonToTruthAssocAlgCfg, MuonTruthAlgsCfg
104 cfg.merge(MuonTruthAlgsCfg(flags))
107 if args.runHoughTest:
108 cfg.merge(setupHistSvcCfg(flags,outFile=
"HoughTransformTester.root",
109 outStream=
"MuonEtaHoughTransformTest"))
110 from MuonPatternRecognitionTest.PatternTestConfig
import MuonHoughTransformTesterCfg, PatternVisualizationToolCfg
111 cfg.merge(MuonHoughTransformTesterCfg(flags,
112 name =
"MuonHoughTransformTester",
113 writeSpacePoints =
False,
114 VisualizationTool = cfg.popToolsAndMerge(PatternVisualizationToolCfg(flags, CanvasLimits =0))))
117 if args.runMSTrackTest:
118 from MuonTrackFindingAlgs.TrackFindingConfig
import MSTrackFinderAlgCfg, MuonCreatorAlgCfg, StandaloneTrackPartCnvCfg, MuidSaTagMakerAlgCfg
119 cfg.merge(MSTrackFinderAlgCfg(flags))
120 cfg.merge(MuonCreatorAlgCfg(flags, name =
"MuonActsCreatorAlg",
121 TagKeys = [
"MuonTagsSA"]))
122 cfg.merge(StandaloneTrackPartCnvCfg(flags))
123 cfg.merge(MuidSaTagMakerAlgCfg(flags))
124 cfg.merge(MuonToTruthAssocAlgCfg(flags))
125 from MuonTrackFindingTest.MsTrackFindingTester
import MsTrackTesterCfg
126 cfg.merge(MsTrackTesterCfg(flags, scheduleLegacy=
False))
133 from IOVDbSvc.IOVDbSvcConfig
import addOverride
134 cfg.merge(addOverride(flags,
"/MDT/TWINMAPPING",
"MDTTwinMapping_compactFormat_Run123"))
136 if not args.noMonitorPlots:
138 CanvasPreFix=
"FastRecoValid",
139 doPhiBucketViews =
False,
140 doEtaBucketViews =
False,
141 doRZBucketViews =
True,
142 paintTruthSegment =
False,
143 outSubDir=
"FastReconstructionValidPlots",
144 displayTruthOnly =
False,
145 saveSinglePDFs =
True))
147 if args.evtNumber
is not None:
148 mainSeq =
"AthAllAlgSeq"
149 topSeq = cfg.getSequence(
"AthAlgEvtSeq")
150 algSeq = cfg.getSequence(mainSeq)
151 mainSeq =
"New" + mainSeq
153 topSeq.Members = [topSeq.Members[0],
154 CompFactory.AthSequencer(mainSeq, Sequential=
True, ModeOR=
False, StopOverride=
False),
156 cfg.addEventAlgo(CompFactory.EventNumberFilterAlgorithm(
"EvtNumberFilter",EventNumbers=args.evtNumber),sequenceName=mainSeq)
157 cfg.getSequence(mainSeq).Members += [algSeq]
159 cfg.getService(
"MessageSvc").setVerbose = [
"MuonFastReconstructionAlg",
"MuonFastRecoTester"]
MuonFastRecoTesterCfg(flags, name="MuonFastRecoTester", outFile="FastRecoTester.root", **kwargs)
FastRecoVisualizationToolCfg(flags, name="FastRecoVisualizationTool", **kwargs)