ATLAS Offline Software
Loading...
Searching...
No Matches
MuonDetDescr/MuonGeoModelTest/python/testGeoModel.py
Go to the documentation of this file.
2# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory import CompFactory
5
7 from AthenaConfiguration.TestDefaults import defaultConditionsTags, defaultGeometryTags, defaultTestFiles
8
9 from argparse import ArgumentParser
10
11 parser = ArgumentParser()
12 parser.add_argument("--threads", type=int, help="number of threads", default=1)
13 parser.add_argument("--inputFile", "-i", default=defaultTestFiles.EVNT,
14 help="Input file to run on ", nargs="+")
15 parser.add_argument("--geoTag", default=defaultGeometryTags.RUN3, help="Geometry tag to use", choices=[defaultGeometryTags.RUN2_BEST_KNOWLEDGE ,
16 defaultGeometryTags.RUN3])
17 parser.add_argument("--condTag", default=defaultConditionsTags.RUN3_MC, help="Conditions tag to use",
18 choices=[defaultConditionsTags.RUN3_MC,
19 defaultConditionsTags.RUN3_DATA,
20 defaultConditionsTags.RUN2_DATA,
21 defaultConditionsTags.RUN2_MC])
22 parser.add_argument("--chambers", default=["all"
23 ], nargs="+", help="Chambers to check. If string is all, all chambers will be checked")
24 parser.add_argument("--excludedChambers", default=[], nargs="+", help="Chambers to exclude. If string contains 'none', all chambers will be checked. Note: adding a chamber to --excludedChambers will overwrite it being in --chambers.")
25 parser.add_argument("--outRootFile", default="LegacyGeoModelDump.root", help="Output ROOT file to dump the geomerty")
26 parser.add_argument("--noMdt", help="Disable the Mdts from the geometry", action='store_true', default = False)
27 parser.add_argument("--noRpc", help="Disable the Rpcs from the geometry", action='store_true', default = False)
28 parser.add_argument("--noTgc", help="Disable the Tgcs from the geometry", action='store_true', default = False)
29 parser.add_argument("--noMM", help="Disable the MMs from the geometry", action='store_true', default = False)
30 parser.add_argument("--noSTGC", help="Disable the sTgcs from the geometry", action='store_true', default = False)
31
32 return parser
33
34
35def GeoModelMdtTestCfg(flags, name = "GeoModelMdtTest", **kwargs):
36 result = ComponentAccumulator()
37 if not flags.Detector.GeometryMDT: return result
38 from MuonConfig.MuonCablingConfig import MDTCablingConfigCfg
39 result.merge(MDTCablingConfigCfg(flags))
40 the_alg = CompFactory.MuonGM.GeoModelMdtTest(name, **kwargs)
41 result.addEventAlgo(the_alg)
42 return result
43
44def GeoModelRpcTestCfg(flags,name = "GeoModelRpcTest", **kwargs):
45 result = ComponentAccumulator()
46 if not flags.Detector.GeometryRPC: return result
47 the_alg = CompFactory.MuonGM.GeoModelRpcTest(name, **kwargs)
48 result.addEventAlgo(the_alg)
49 return result
50
51def GeoModelTgcTestCfg(flags,name = "GeoModelTgcTest", **kwargs):
52 result = ComponentAccumulator()
53 if not flags.Detector.GeometryTGC: return result
54 the_alg = CompFactory.MuonGM.GeoModelTgcTest(name, **kwargs)
55 result.addEventAlgo(the_alg)
56 return result
57def GeoModelMmTestCfg(flags,name = "GeoModelMmTest", **kwargs):
58 result = ComponentAccumulator()
59 if not flags.Detector.GeometryMM: return result
60 the_alg = CompFactory.MuonGM.GeoModelMmTest(name, **kwargs)
61 result.addEventAlgo(the_alg)
62 return result
63
64def GeoModelsTgcTestCfg(flags, name = "GeoModelsTgcTest", **kwargs):
65 result = ComponentAccumulator()
66 if not flags.Detector.GeometrysTGC: return result
67 the_alg = CompFactory.MuonGM.GeoModelsTgcTest(name, **kwargs)
68 result.addEventAlgo(the_alg)
69 return result
70
71def GeoModelCscTestCfg(flags, name = "GeoModelCscTest", **kwargs):
72 result = ComponentAccumulator()
73 if not flags.Detector.GeometryCSC: return result
74 the_alg = CompFactory.MuonGM.GeoModelCscTest(name, **kwargs)
75 result.addEventAlgo(the_alg)
76 return result
77
78if __name__=="__main__":
79 from AthenaConfiguration.AllConfigFlags import initConfigFlags
80 args = SetupArgParser().parse_args()
81
82 flags = initConfigFlags()
83 flags.Concurrency.NumThreads = args.threads
84 flags.Concurrency.NumConcurrentEvents = args.threads # Might change this later, but good enough for the moment.
85 flags.Input.Files = args.inputFile
86 flags.GeoModel.AtlasVersion = args.geoTag
87 flags.IOVDb.GlobalTag = args.condTag
88 flags.Scheduler.ShowDataDeps = True
89 flags.Scheduler.ShowDataFlow = True
90 flags.Exec.MaxEvents = 1
91 flags.lock()
92 flags.dump(evaluate = True)
93
94 from MuonConfig.MuonConfigUtils import executeTest, setupHistSvcCfg, SetupMuonStandaloneCA
95 cfg = SetupMuonStandaloneCA(flags)
96 cfg.merge(setupHistSvcCfg(flags, outFile = args.outRootFile, outStream="GEOMODELTESTER"))
97
98 chambToTest = args.chambers if len([x for x in args.chambers if x =="all"]) ==0 else []
99 chambToExclude = args.excludedChambers
100 if not args.noMdt:
101 cfg.merge(GeoModelMdtTestCfg(flags, TestStations = [ch for ch in chambToTest if ch[0] == "B" or ch[0] == "E"],
102 ExcludeStations = [ch for ch in chambToExclude if ch[0] == "B" or ch[0] == "E"]))
103 if not args.noRpc:
104 cfg.merge(GeoModelRpcTestCfg(flags, TestStations = [ch for ch in chambToTest if ch[0] == "B"],
105 ExcludeStations = [ch for ch in chambToExclude if ch[0] == "B"]))
106 if not args.noTgc:
107 cfg.merge(GeoModelTgcTestCfg(flags, TestStations = [ch for ch in chambToTest if ch[0] == "T"],
108 ExcludeStations = [ch for ch in chambToExclude if ch[0] == "T"],
109 ReadoutXML="TgcStripStructure.xml"))
110
111 if not args.noMM:
112 cfg.merge(GeoModelMmTestCfg(flags, TestStations = [ch for ch in chambToTest if ch[0] == "M"],
113 ExcludeStations = [ch for ch in chambToExclude if ch[0] == "M"]))
114
115 if not args.noSTGC:
116 cfg.merge(GeoModelsTgcTestCfg(flags, TestStations = [ch for ch in chambToTest if ch[0] == "S"],
117 ExcludeStations = [ch for ch in chambToExclude if ch[0] == "S"]))
118
119 cfg.merge(GeoModelCscTestCfg(flags))
120
121 executeTest(cfg)
GeoModelCscTestCfg(flags, name="GeoModelCscTest", **kwargs)
GeoModelTgcTestCfg(flags, name="GeoModelTgcTest", **kwargs)
GeoModelMdtTestCfg(flags, name="GeoModelMdtTest", **kwargs)
GeoModelsTgcTestCfg(flags, name="GeoModelsTgcTest", **kwargs)
GeoModelMmTestCfg(flags, name="GeoModelMmTest", **kwargs)
GeoModelRpcTestCfg(flags, name="GeoModelRpcTest", **kwargs)