ATLAS Offline Software
Loading...
Searching...
No Matches
SegmentRefitTester.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory import CompFactory
5def SegmentRefitTestCfg(flags,name="SegmentRefitter",
6 drawEvent=False, smearSegPars=False, **kwargs):
7 result = ComponentAccumulator()
8 from MuonPatternRecognitionAlgs.MuonPatternRecognitionConfig import ActsMuonSegmentRefitAlgCfg
9
10 result.merge(ActsMuonSegmentRefitAlgCfg(flags, drawEvent=drawEvent, smearSegPars = smearSegPars))
11 the_alg = CompFactory.MuonValR4.SegmentRefitTest(name, **kwargs)
12 result.addEventAlgo(the_alg, primary = True)
13 return result
14
15def SegmentExtpTestCfg(falgs, name="SegmentExtrapolationTest", **kwargs):
16 result = ComponentAccumulator()
17 from ActsConfig.ActsGeometryConfig import ActsExtrapolationToolCfg
18 kwargs.setdefault("ExtrapolationTool",
19 result.popToolsAndMerge(ActsExtrapolationToolCfg(flags,
20 FieldMode="StraightLine")))
21 the_alg = CompFactory.MuonValR4.SegmentExtpTest(name, **kwargs)
22 result.addEventAlgo(the_alg, primary = True)
23 return result
24
25if __name__=="__main__":
26 from MuonGeoModelTestR4.testGeoModel import setupGeoR4TestCfg, SetupArgParser, MuonPhaseIITestDefaults
27 from MuonConfig.MuonConfigUtils import executeTest, setupHistSvcCfg
28 parser = SetupArgParser()
29 parser.add_argument("--noMonitorPlots", help="If set to true, there're no monitoring plots",
30 default = False, action='store_true')
31 parser.add_argument("--dumpObjFiles", help="If set to true, the spacepoints in the bucket are saved to disk",
32 default=False, action='store_true')
33 parser.add_argument("--noPerfMon", help="If set to true, disable performance monitoring.",
34 default=False, action='store_true')
35 parser.add_argument("--smearSegPars", help="If set to true the segment parameters are smeared",
36 default=False, action='store_true')
37 parser.set_defaults(nEvents = -1)
38
39 parser.set_defaults(outRootFile="MsTrkTester.root")
40 parser.set_defaults(inputFile=MuonPhaseIITestDefaults.HITS_PG_R3)
41
42 args = parser.parse_args()
43 from AthenaConfiguration.AllConfigFlags import initConfigFlags
44 flags = initConfigFlags()
45 flags.PerfMon.doFullMonMT = not args.noPerfMon
46
47 flags, cfg = setupGeoR4TestCfg(args,flags)
48 cfg.getService("MessageSvc").setVerbose = ["ActsMuonSegmentRefitAlg", "SegmentExtrapolationTest"]
49 cfg.getService("MessageSvc").setDebug = ["SegmentExtrapolationTest"]
50
51 cfg.getService("MessageSvc").setVerbose = []
52 cfg.getService("MessageSvc").setDebug = []
53
54 cfg.merge(setupHistSvcCfg(flags,outFile=args.outRootFile,
55 outStream="SegmentRefitTest"))
56
57
58 from MuonConfig.MuonDataPrepConfig import xAODUncalibMeasPrepCfg
59 cfg.merge(xAODUncalibMeasPrepCfg(flags))
60
61 from MuonSpacePointFormation.SpacePointFormationConfig import MuonSpacePointFormationCfg
62 cfg.merge(MuonSpacePointFormationCfg(flags))
63
64 from MuonPatternRecognitionAlgs.MuonPatternRecognitionConfig import MuonPatternRecognitionCfg
65 cfg.merge(MuonPatternRecognitionCfg(flags))
66 cfg.merge(SegmentRefitTestCfg(flags, drawEvent = args.dumpObjFiles,
67 smearSegPars = args.smearSegPars))
68 cfg.merge(SegmentExtpTestCfg(flags, drawEvent = args.dumpObjFiles))
69
70 from MuonPatternRecognitionTest.PatternTestConfig import PatternVisualizationToolCfg
71
72 cfg.getEventAlgo("MuonSegmentFittingAlg").VisualizationTool = cfg.popToolsAndMerge(PatternVisualizationToolCfg(flags,
73 CanvasPreFix="SegmentPlotValid", outSubDir="SegmentValidPlots",
74 displayTruthOnly = False, saveSinglePDFs = True, saveSummaryPDF= True))
75
76 cfg.getEventAlgo("MuonR4xAODSegmentCnvAlg").convertBeamSpot = True
77 executeTest(cfg)
SegmentExtpTestCfg(falgs, name="SegmentExtrapolationTest", **kwargs)
SegmentRefitTestCfg(flags, name="SegmentRefitter", drawEvent=False, smearSegPars=False, **kwargs)