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 = []
20 "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/data25_13p6TeV/data25_13p6TeV.00508073.physics_Main.daq.RAW._lb0277._SFO-11._0001.data",
21 "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/data25_13p6TeV/data25_13p6TeV.00508073.physics_Main.daq.RAW._lb0277._SFO-12._0001.data",
22 "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/data25_13p6TeV/data25_13p6TeV.00508073.physics_Main.daq.RAW._lb0277._SFO-13._0001.data",
23 "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/data25_13p6TeV/data25_13p6TeV.00508073.physics_Main.daq.RAW._lb0277._SFO-14._0001.data",
24 "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/data25_13p6TeV/data25_13p6TeV.00508073.physics_Main.daq.RAW._lb0277._SFO-15._0001.data",
25 "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/data25_13p6TeV/data25_13p6TeV.00508073.physics_Main.daq.RAW._lb0277._SFO-16._0001.data",
26 "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/data25_13p6TeV/data25_13p6TeV.00508073.physics_Main.daq.RAW._lb0277._SFO-17._0001.data",
27 "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/data25_13p6TeV/data25_13p6TeV.00508073.physics_Main.daq.RAW._lb0277._SFO-18._0001.data",
28 "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/data25_13p6TeV/data25_13p6TeV.00508073.physics_Main.daq.RAW._lb0277._SFO-19._0001.data"]
30 RDO_R3 = [
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/myRDO.R3.pool.root"]
32 RDO_R4 = [
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/myRDO.R4.pool.root"]
38 GEODB_R3 =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-R3S-2021-03-02-00.db"
40 GEODB_R3MSOnly =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-R3S-2021-03-02-00_MSOnly.db"
42 GEODB_R4 =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-P2-RUN4-01-00-00.db"
44 GEODB_R4MSOnly =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-P2-RUN4-01-00-00_MSOnly.db"
46 GEODB_ITk_R3MS =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-P2-RUN4-01-00-00_R3MS.db"
48 GEODB_TOROID =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/MUON_TOROID.db"
51 from argparse
import ArgumentParser
53 parser = ArgumentParser()
54 parser.add_argument(
"--threads", type=int, help=
"number of threads", default=1)
55 parser.add_argument(
"--inputFile",
"-i", default= MuonPhaseIITestDefaults.EVGEN_PG,
56 help=
"Input file to run on ", nargs=
"+")
57 parser.add_argument(
"--geoModelFile", default = MuonPhaseIITestDefaults.GEODB_R3, help=
"GeoModel SqLite file containing the muon geometry.")
58 parser.add_argument(
"--defaultGeoFile", help=
"Use the predefined GeoModel files on cvmfs", choices=[
"NONE",
"RUN3",
"RUN4",
59 "RUN3MSOnly",
"RUN4MSOnly",
60 "ITkR3MS" ], default=
"NONE")
61 parser.add_argument(
"--chambers", default=[
"all"], nargs=
"+", help=
"Chambers to check. If string is all, all chambers will be checked")
62 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.")
63 parser.add_argument(
"--outRootFile", default=
"NewGeoModelDump.root", help=
"Output ROOT file to dump the geomerty")
64 parser.add_argument(
"--nEvents", help=
"Number of events to run", type = int ,default = 1)
65 parser.add_argument(
"--skipEvents", help=
"Number of events to skip", type = int, default = 0)
66 parser.add_argument(
"--noMdt", help=
"Disable the Mdts from the geometry", action=
'store_true', default =
False)
67 parser.add_argument(
"--noRpc", help=
"Disable the Rpcs from the geometry", action=
'store_true', default =
False)
68 parser.add_argument(
"--noTgc", help=
"Disable the Tgcs from the geometry", action=
'store_true', default =
False)
69 parser.add_argument(
"--noMM", help=
"Disable the MMs from the geometry", action=
'store_true', default =
False)
70 parser.add_argument(
"--noSTGC", help=
"Disable the sTgcs from the geometry", action=
'store_true', default =
False)
71 parser.add_argument(
"--eventPrintoutLevel", type=int, help=
"Interval of event heartbeat printouts from the loop manager", default = 1)
72 parser.add_argument(
"--localMdtMezzJSON", default=
"", help=
"")
73 parser.add_argument(
"--localMdtCablingJSON", default=
"", help=
"")
77 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
78 result = MainServicesCfg(flags)
80 from AthenaConfiguration.Enums
import Format
81 if flags.Input.Format
is Format.POOL:
82 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
83 result.merge(PoolReadCfg(flags))
84 elif flags.Input.Format == Format.BS:
85 from ByteStreamCnvSvc.ByteStreamConfig
import ByteStreamReadCfg
86 result.merge(ByteStreamReadCfg(flags))
88 from PerfMonComps.PerfMonCompsConfig
import PerfMonMTSvcCfg
89 result.merge(PerfMonMTSvcCfg(flags))
90 from MuonConfig.MuonGeometryConfig
import MuonIdHelperSvcCfg
91 result.merge(MuonIdHelperSvcCfg(flags))
94def GeoModelMdtTestCfg(flags, name = "GeoModelMdtTest", localMezzanineJSON="", localCablingJSON="",**kwargs):
95 result = ComponentAccumulator()
96 from MuonConfig.MuonCablingConfig
import MDTCablingConfigCfg
97 result.merge(MDTCablingConfigCfg(flags,MezzanineJSON=localMezzanineJSON, CablingJSON=localCablingJSON))
98 the_alg = CompFactory.MuonGMR4.GeoModelMdtTest(name, **kwargs)
99 result.addEventAlgo(the_alg, primary =
True)
103 result = ComponentAccumulator()
104 the_alg = CompFactory.MuonGMR4.GeoModelRpcTest(name, **kwargs)
105 result.addEventAlgo(the_alg, primary =
True)
109 result = ComponentAccumulator()
110 the_alg = CompFactory.MuonGMR4.GeoModelTgcTest(name, **kwargs)
111 result.addEventAlgo(the_alg, primary =
True)
115 result = ComponentAccumulator()
116 the_alg = CompFactory.MuonGMR4.GeoModelsTgcTest(name, **kwargs)
117 result.addEventAlgo(the_alg, primary =
True)
121 result = ComponentAccumulator()
122 the_alg = CompFactory.MuonGMR4.GeoModelMmTest(name, **kwargs)
123 result.addEventAlgo(the_alg, primary =
True)
127 result = ComponentAccumulator()
128 kwargs.setdefault(
"TestActsSurface",
True)
129 kwargs.setdefault(
"plotTgc", flags.Detector.GeometryTGC)
130 kwargs.setdefault(
"plotStgc", flags.Detector.GeometrysTGC)
131 kwargs.setdefault(
"plotMm", flags.Detector.GeometryMM)
133 the_alg = CompFactory.MuonGMR4.NswGeoPlottingAlg(name, **kwargs)
134 result.addEventAlgo(the_alg, primary =
True)
138 from AthenaCommon.Logging
import logging
139 log = logging.getLogger(
'GeometryConfiguration')
141 if not flags.GeoModel.SQLiteDB:
142 raise ValueError(
"Default tag configuration only works for SQLite")
144 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
145 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
146 from AthenaConfiguration.Enums
import LHCPeriod
147 if flags.GeoModel.Run == LHCPeriod.Run3:
148 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
149 elif flags.GeoModel.Run == LHCPeriod.Run4:
150 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN4
152 raise ValueError(f
"Invalid run period {flags.GeoModel.Run}")
153 from MuonConfig.MuonConfigUtils
import configureCondTag
154 configureCondTag(flags)
156 log.info(f
"Setup {flags.GeoModel.AtlasVersion} geometry loading {flags.GeoModel.SQLiteDBFullPath}")
157 log.info(f
"Use conditions tag {flags.IOVDb.GlobalTag}")
163 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
164 flags = initConfigFlags()
165 flags.Concurrency.NumThreads = args.threads
166 flags.Concurrency.NumConcurrentEvents = args.threads
167 flags.Exec.MaxEvents = args.nEvents
168 flags.Exec.SkipEvents = args.skipEvents
169 from os
import path, system, listdir
170 flags.Input.Files = []
173 for fileArg
in args.inputFile:
174 if path.isdir(fileArg):
175 flags.Input.Files += [
"{dir}/{file}".format(dir=fileArg, file=y)
for y
in listdir(fileArg) ]
177 if fileArg[fileArg.rfind(
".")+1 :]
not in [
"txt",
"conf"]:
178 flags.Input.Files+=[fileArg]
180 with open(fileArg)
as inStream:
181 flags.Input.Files+=[ line.strip()
for line
in inStream
if line[0]!=
'#']
184 flags.Exec.EventPrintoutInterval = 500
186 if args.defaultGeoFile ==
"RUN3":
187 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R3
188 elif args.defaultGeoFile ==
"RUN4":
189 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R4
190 elif args.defaultGeoFile ==
"RUN3MSOnly":
191 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R3MSOnly
192 elif args.defaultGeoFile ==
"RUN4MSOnly":
193 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R4MSOnly
194 elif args.defaultGeoFile ==
"ITkR3MS":
195 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_ITk_R3MS
196 elif args.geoModelFile.startswith(
"root://"):
197 if not path.exists(
"Geometry/{geoTag}.db".format(geoTag=args.geoTag)):
198 print (
"Copy geometry file from EOS {source}".format(source = args.geoModelFile))
199 system(
"mkdir Geometry/")
200 system(
"xrdcp {source} Geometry/{geoTag}.db".format(source = args.geoModelFile,
203 args.geoModelFile =
"Geometry/{geoTag}.db".format(geoTag=args.geoTag)
205 flags.GeoModel.SQLiteDBFullPath = args.geoModelFile
207 flags.GeoModel.SQLiteDB =
True
210 flags.Detector.GeometryBpipe =
False
212 flags.Detector.GeometryBCM =
False
213 flags.Detector.GeometryPixel =
False
214 flags.Detector.GeometrySCT =
False
215 flags.Detector.GeometryTRT =
False
217 flags.Detector.GeometryPLR =
False
218 flags.Detector.GeometryBCMPrime =
False
219 flags.Detector.GeometryITkPixel =
False
220 flags.Detector.GeometryITkStrip =
False
222 flags.Detector.GeometryHGTD =
False
224 flags.Detector.GeometryLAr =
False
225 flags.Detector.GeometryTile =
False
226 flags.Detector.GeometryMBTS =
False
227 flags.Detector.GeometryCalo =
False
229 flags.Detector.GeometryCSC =
False
231 flags.Detector.GeometrysTGC =
False
233 flags.Detector.GeometryMM =
False
235 flags.Detector.GeometryTGC =
False
237 flags.Detector.GeometryRPC =
False
239 flags.Detector.GeometryMDT =
False
241 flags.Acts.TrackingGeometry.UseBlueprint =
True
243 flags.Scheduler.CheckDependencies =
True
244 flags.Scheduler.ShowDataDeps =
True
245 flags.Scheduler.ShowDataFlow =
True
246 flags.Scheduler.ShowControlFlow =
True
247 flags.Scheduler.EnableVerboseViews =
True
248 flags.Scheduler.AutoLoadUnmetDependencies =
True
251 flags.dump(evaluate =
True)
254 from MuonConfig.MuonGeometryConfig
import MuonGeoModelCfg
255 cfg.merge(MuonGeoModelCfg(flags))
257 if not flags.Muon.usePhaseIIGeoSetup:
258 print (
"WARNING: New Muon plugin is not part of the Geometry file {geoDBFile}".format(geoDBFile=args.geoModelFile))
260 from ActsAlignmentAlgs.AlignmentAlgsConfig
import ActsGeometryContextAlgCfg
261 cfg.merge(ActsGeometryContextAlgCfg(flags))
263 cfg.getService(
"MessageSvc").verboseLimit = 10000000
264 cfg.getService(
"MessageSvc").debugLimit = 10000000
269 cfg.printConfig(withDetails=
True, summariseProps=
True)
270 if not cfg.run().isSuccess(): exit(1)
272if __name__==
"__main__":
275 from MuonConfig.MuonConfigUtils
import setupHistSvcCfg
276 cfg.merge(setupHistSvcCfg(flags, outFile = args.outRootFile, outStream=
"GEOMODELTESTER"))
277 chambToTest = args.chambers
if len([x
for x
in args.chambers
if x ==
"all"]) ==0
else []
278 chambToExclude = args.excludedChambers
281 if flags.Muon.usePhaseIIGeoSetup:
282 cfg.getCondAlgo(
"MuonDetectorCondAlg").checkGeo =
True
283 cfg.getCondAlgo(
"MuonDetectorCondAlg").dumpGeo =
True
284 from TrackingGeometryCondAlg.AtlasTrackingGeometryCondAlgConfig
import TrackingGeometryCondAlgCfg
285 cfg.merge(TrackingGeometryCondAlgCfg(flags))
288 cfg.getService(
"MessageSvc").setVerbose = []
290 if flags.Detector.GeometryMDT:
291 if not flags.Muon.usePhaseIIGeoSetup:
292 from MuonGeoModelTest.testGeoModel
import GeoModelMdtTestCfg
as LegacyTestCfg
293 cfg.merge(LegacyTestCfg(flags,
294 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B" or ch[0] ==
"E"],
295 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B" or ch[0] ==
"E"]))
298 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B" or ch[0] ==
"E"],
299 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B" or ch[0] ==
"E"],
300 localMezzanineJSON=args.localMdtMezzJSON,
301 localCablingJSON=args.localMdtCablingJSON,
302 ReadoutSideXML=
"ReadoutSides.xml",
303 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
305 if flags.Detector.GeometryRPC:
306 if not flags.Muon.usePhaseIIGeoSetup:
307 from MuonGeoModelTest.testGeoModel
import GeoModelRpcTestCfg
as LegacyTestCfg
308 cfg.merge(LegacyTestCfg(flags,
309 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B"],
310 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B"]))
313 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B"],
314 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B"],
315 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
317 if flags.Detector.GeometryTGC:
318 if not flags.Muon.usePhaseIIGeoSetup:
319 from MuonGeoModelTest.testGeoModel
import GeoModelTgcTestCfg
as LegacyTestCfg
320 cfg.merge(LegacyTestCfg(flags,
321 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"T"],
322 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"T"]))
325 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"T"],
326 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"T"],
327 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
329 if flags.Detector.GeometryMM:
330 if not flags.Muon.usePhaseIIGeoSetup:
331 from MuonGeoModelTest.testGeoModel
import GeoModelMmTestCfg
as LegacyTestCfg
332 cfg.merge(LegacyTestCfg(flags,
333 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"M"],
334 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"M"]))
337 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"M"],
338 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"M"],
339 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
341 if flags.Detector.GeometrysTGC:
342 if not flags.Muon.usePhaseIIGeoSetup:
343 from MuonGeoModelTest.testGeoModel
import GeoModelsTgcTestCfg
as LegacyTestCfg
344 cfg.merge(LegacyTestCfg(flags,
345 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"S"],
346 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"S"]))
349 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"S"],
350 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"S"],
351 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)