2from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
3from AthenaConfiguration.ComponentFactory
import CompFactory
9 EVGEN_PG = [
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/EVGEN_ParticleGun_FourMuon_Pt10to500.root"]
11 HITS_PG_R3 = [
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/R3SimHits.pool.root"]
13 HITS_PG_R4 = [
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/R4SimHits.pool.root"]
15 HITS_PG_R3_MSOnly = []
17 HITS_PG_R4_MSOnly = []
19 DATA_BS = [
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/data25_13p6TeV.00508073.physics_Main.daq.RAW._lb0277._SFO-14._0001.data" ]
21 RDO_ZMUMU_R3 = [
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/myRDO.R3.pool.root"]
27 GEODB_R3 =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-R3S-2021-03-02-00.db"
29 GEODB_R3MSOnly =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-R3S-2021-03-02-00_MSOnly.db"
31 GEODB_R4 =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-P2-RUN4-01-00-00.db"
33 GEODB_R4MSOnly =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-P2-RUN4-01-00-00_MSOnly.db"
35 GEODB_ITk_R3MS =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-P2-RUN4-01-00-00_R3MS.db"
39 from argparse
import ArgumentParser
41 parser = ArgumentParser()
42 parser.add_argument(
"--threads", type=int, help=
"number of threads", default=1)
43 parser.add_argument(
"--inputFile",
"-i", default= MuonPhaseIITestDefaults.EVGEN_PG,
44 help=
"Input file to run on ", nargs=
"+")
45 parser.add_argument(
"--geoModelFile", default = MuonPhaseIITestDefaults.GEODB_R3, help=
"GeoModel SqLite file containing the muon geometry.")
46 parser.add_argument(
"--defaultGeoFile", help=
"Use the predefined GeoModel files on cvmfs", choices=[
"NONE",
"RUN3",
"RUN4",
47 "RUN3MSOnly",
"RUN4MSOnly",
48 "ITkR3MS" ], default=
"NONE")
49 parser.add_argument(
"--chambers", default=[
"all"], nargs=
"+", help=
"Chambers to check. If string is all, all chambers will be checked")
50 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.")
51 parser.add_argument(
"--outRootFile", default=
"NewGeoModelDump.root", help=
"Output ROOT file to dump the geomerty")
52 parser.add_argument(
"--nEvents", help=
"Number of events to run", type = int ,default = 1)
53 parser.add_argument(
"--skipEvents", help=
"Number of events to skip", type = int, default = 0)
54 parser.add_argument(
"--noMdt", help=
"Disable the Mdts from the geometry", action=
'store_true', default =
False)
55 parser.add_argument(
"--noRpc", help=
"Disable the Rpcs from the geometry", action=
'store_true', default =
False)
56 parser.add_argument(
"--noTgc", help=
"Disable the Tgcs from the geometry", action=
'store_true', default =
False)
57 parser.add_argument(
"--noMM", help=
"Disable the MMs from the geometry", action=
'store_true', default =
False)
58 parser.add_argument(
"--noSTGC", help=
"Disable the sTgcs from the geometry", action=
'store_true', default =
False)
59 parser.add_argument(
"--eventPrintoutLevel", type=int, help=
"Interval of event heartbeat printouts from the loop manager", default = 1)
63 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
64 result = MainServicesCfg(flags)
66 from AthenaConfiguration.Enums
import Format
67 if flags.Input.Format
is Format.POOL:
68 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
69 result.merge(PoolReadCfg(flags))
70 elif flags.Input.Format == Format.BS:
71 from ByteStreamCnvSvc.ByteStreamConfig
import ByteStreamReadCfg
72 result.merge(ByteStreamReadCfg(flags))
74 from PerfMonComps.PerfMonCompsConfig
import PerfMonMTSvcCfg
75 result.merge(PerfMonMTSvcCfg(flags))
76 from MuonConfig.MuonGeometryConfig
import MuonIdHelperSvcCfg
77 result.merge(MuonIdHelperSvcCfg(flags))
81 result = ComponentAccumulator()
82 from MuonConfig.MuonCablingConfig
import MDTCablingConfigCfg
83 result.merge(MDTCablingConfigCfg(flags))
84 the_alg = CompFactory.MuonGMR4.GeoModelMdtTest(name, **kwargs)
85 result.addEventAlgo(the_alg, primary =
True)
89 result = ComponentAccumulator()
90 the_alg = CompFactory.MuonGMR4.GeoModelRpcTest(name, **kwargs)
91 result.addEventAlgo(the_alg, primary =
True)
95 result = ComponentAccumulator()
96 the_alg = CompFactory.MuonGMR4.GeoModelTgcTest(name, **kwargs)
97 result.addEventAlgo(the_alg, primary =
True)
101 result = ComponentAccumulator()
102 the_alg = CompFactory.MuonGMR4.GeoModelsTgcTest(name, **kwargs)
103 result.addEventAlgo(the_alg, primary =
True)
107 result = ComponentAccumulator()
108 the_alg = CompFactory.MuonGMR4.GeoModelMmTest(name, **kwargs)
109 result.addEventAlgo(the_alg, primary =
True)
113 result = ComponentAccumulator()
114 kwargs.setdefault(
"TestActsSurface",
True)
115 kwargs.setdefault(
"plotTgc", flags.Detector.GeometryTGC)
116 kwargs.setdefault(
"plotStgc", flags.Detector.GeometrysTGC)
117 kwargs.setdefault(
"plotMm", flags.Detector.GeometryMM)
119 the_alg = CompFactory.MuonGMR4.NswGeoPlottingAlg(name, **kwargs)
120 result.addEventAlgo(the_alg, primary =
True)
124 from AthenaCommon.Logging
import logging
125 log = logging.getLogger(
'GeometryConfiguration')
127 if not flags.GeoModel.SQLiteDB:
128 raise ValueError(
"Default tag configuration only works for SQLite")
130 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
131 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
132 from AthenaConfiguration.Enums
import LHCPeriod
133 if flags.GeoModel.Run == LHCPeriod.Run3:
134 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
135 elif flags.GeoModel.Run == LHCPeriod.Run4:
136 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN4
138 raise ValueError(f
"Invalid run period {flags.GeoModel.Run}")
139 from MuonConfig.MuonConfigUtils
import configureCondTag
140 configureCondTag(flags)
142 log.info(f
"Setup {flags.GeoModel.AtlasVersion} geometry loading {flags.GeoModel.SQLiteDBFullPath}")
143 log.info(f
"Use conditions tag {flags.IOVDb.GlobalTag}")
149 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
150 flags = initConfigFlags()
151 flags.Concurrency.NumThreads = args.threads
152 flags.Concurrency.NumConcurrentEvents = args.threads
153 flags.Exec.MaxEvents = args.nEvents
154 flags.Exec.SkipEvents = args.skipEvents
155 from os
import path, system, listdir
156 flags.Input.Files = []
159 for fileArg
in args.inputFile:
160 if path.isdir(fileArg):
161 flags.Input.Files += [
"{dir}/{file}".format(dir=fileArg, file=y)
for y
in listdir(fileArg) ]
163 if fileArg[fileArg.rfind(
".")+1 :]
not in [
"txt",
"conf"]:
164 flags.Input.Files+=[fileArg]
166 with open(fileArg)
as inStream:
167 flags.Input.Files+=[ line.strip()
for line
in inStream
if line[0]!=
'#']
170 flags.Exec.EventPrintoutInterval = 500
172 if args.defaultGeoFile ==
"RUN3":
173 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R3
174 elif args.defaultGeoFile ==
"RUN4":
175 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R4
176 elif args.defaultGeoFile ==
"RUN3MSOnly":
177 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R3MSOnly
178 elif args.defaultGeoFile ==
"RUN4MSOnly":
179 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R4MSOnly
180 elif args.defaultGeoFile ==
"ITkR3MS":
181 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_ITk_R3MS
182 elif args.geoModelFile.startswith(
"root://"):
183 if not path.exists(
"Geometry/{geoTag}.db".format(geoTag=args.geoTag)):
184 print (
"Copy geometry file from EOS {source}".format(source = args.geoModelFile))
185 system(
"mkdir Geometry/")
186 system(
"xrdcp {source} Geometry/{geoTag}.db".format(source = args.geoModelFile,
189 args.geoModelFile =
"Geometry/{geoTag}.db".format(geoTag=args.geoTag)
191 flags.GeoModel.SQLiteDBFullPath = args.geoModelFile
193 flags.GeoModel.SQLiteDB =
True
196 flags.Detector.GeometryBpipe =
False
198 flags.Detector.GeometryBCM =
False
199 flags.Detector.GeometryPixel =
False
200 flags.Detector.GeometrySCT =
False
201 flags.Detector.GeometryTRT =
False
203 flags.Detector.GeometryPLR =
False
204 flags.Detector.GeometryBCMPrime =
False
205 flags.Detector.GeometryITkPixel =
False
206 flags.Detector.GeometryITkStrip =
False
208 flags.Detector.GeometryHGTD =
False
210 flags.Detector.GeometryLAr =
False
211 flags.Detector.GeometryTile =
False
212 flags.Detector.GeometryMBTS =
False
213 flags.Detector.GeometryCalo =
False
215 flags.Detector.GeometryCSC =
False
217 flags.Detector.GeometrysTGC =
False
219 flags.Detector.GeometryMM =
False
221 flags.Detector.GeometryTGC =
False
223 flags.Detector.GeometryRPC =
False
225 flags.Detector.GeometryMDT =
False
227 flags.Acts.TrackingGeometry.UseBlueprint =
True
229 flags.Scheduler.CheckDependencies =
True
230 flags.Scheduler.ShowDataDeps =
True
231 flags.Scheduler.ShowDataFlow =
True
232 flags.Scheduler.ShowControlFlow =
True
233 flags.Scheduler.EnableVerboseViews =
True
234 flags.Scheduler.AutoLoadUnmetDependencies =
True
237 flags.dump(evaluate =
True)
240 from MuonConfig.MuonGeometryConfig
import MuonGeoModelCfg
241 cfg.merge(MuonGeoModelCfg(flags))
244 if not flags.Muon.usePhaseIIGeoSetup:
245 print (
"WARNING: New Muon plugin is not part of the Geometry file {geoDBFile}".format(geoDBFile=args.geoModelFile))
247 from ActsAlignmentAlgs.AlignmentAlgsConfig
import ActsGeometryContextAlgCfg
248 cfg.merge(ActsGeometryContextAlgCfg(flags))
250 cfg.getService(
"MessageSvc").verboseLimit = 10000000
251 cfg.getService(
"MessageSvc").debugLimit = 10000000
256 cfg.printConfig(withDetails=
True, summariseProps=
True)
257 if not cfg.run().isSuccess(): exit(1)
259if __name__==
"__main__":
262 from MuonConfig.MuonConfigUtils
import setupHistSvcCfg
263 cfg.merge(setupHistSvcCfg(flags, outFile = args.outRootFile, outStream=
"GEOMODELTESTER"))
264 chambToTest = args.chambers
if len([x
for x
in args.chambers
if x ==
"all"]) ==0
else []
265 chambToExclude = args.excludedChambers
268 if flags.Muon.usePhaseIIGeoSetup:
269 cfg.getCondAlgo(
"MuonDetectorCondAlg").checkGeo =
True
270 cfg.getCondAlgo(
"MuonDetectorCondAlg").dumpGeo =
True
271 from TrackingGeometryCondAlg.AtlasTrackingGeometryCondAlgConfig
import TrackingGeometryCondAlgCfg
272 cfg.merge(TrackingGeometryCondAlgCfg(flags))
275 cfg.getService(
"MessageSvc").setVerbose = []
277 if flags.Detector.GeometryMDT:
278 if not flags.Muon.usePhaseIIGeoSetup:
279 from MuonGeoModelTest.testGeoModel
import GeoModelMdtTestCfg
as LegacyTestCfg
280 cfg.merge(LegacyTestCfg(flags,
281 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B" or ch[0] ==
"E"],
282 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B" or ch[0] ==
"E"]))
285 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B" or ch[0] ==
"E"],
286 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B" or ch[0] ==
"E"],
287 ReadoutSideXML=
"ReadoutSides.xml",
288 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
290 if flags.Detector.GeometryRPC:
291 if not flags.Muon.usePhaseIIGeoSetup:
292 from MuonGeoModelTest.testGeoModel
import GeoModelRpcTestCfg
as LegacyTestCfg
293 cfg.merge(LegacyTestCfg(flags,
294 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B"],
295 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B"]))
298 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B"],
299 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B"],
300 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
302 if flags.Detector.GeometryTGC:
303 if not flags.Muon.usePhaseIIGeoSetup:
304 from MuonGeoModelTest.testGeoModel
import GeoModelTgcTestCfg
as LegacyTestCfg
305 cfg.merge(LegacyTestCfg(flags,
306 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"T"],
307 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"T"]))
310 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"T"],
311 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"T"],
312 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
314 if flags.Detector.GeometryMM:
315 if not flags.Muon.usePhaseIIGeoSetup:
316 from MuonGeoModelTest.testGeoModel
import GeoModelMmTestCfg
as LegacyTestCfg
317 cfg.merge(LegacyTestCfg(flags,
318 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"M"],
319 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"M"]))
322 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"M"],
323 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"M"],
324 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
326 if flags.Detector.GeometrysTGC:
327 if not flags.Muon.usePhaseIIGeoSetup:
328 from MuonGeoModelTest.testGeoModel
import GeoModelsTgcTestCfg
as LegacyTestCfg
329 cfg.merge(LegacyTestCfg(flags,
330 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"S"],
331 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"S"]))
334 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"S"],
335 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"S"],
336 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
GeoModelTgcTestCfg(flags, name="GeoModelTgcTest", **kwargs)
configureDefaultTagsCfg(flags)
GeoModelMdtTestCfg(flags, name="GeoModelMdtTest", **kwargs)
GeoModelsTgcTestCfg(flags, name="GeoModelsTgcTest", **kwargs)
GeoModelMmTestCfg(flags, name="GeoModelMmTest", **kwargs)
GeoModelRpcTestCfg(flags, name="GeoModelRpcTest", **kwargs)
NswGeoPlottingAlgCfg(flags, name="NswGeoPlotting", **kwargs)
setupGeoR4TestCfg(args, flags=None)