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_ZMUMU_R3 = [
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/myRDO.R3.pool.root"]
36 GEODB_R3 =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-R3S-2021-03-02-00.db"
38 GEODB_R3MSOnly =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-R3S-2021-03-02-00_MSOnly.db"
40 GEODB_R4 =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-P2-RUN4-01-00-00.db"
42 GEODB_R4MSOnly =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-P2-RUN4-01-00-00_MSOnly.db"
44 GEODB_ITk_R3MS =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-P2-RUN4-01-00-00_R3MS.db"
46 GEODB_TOROID =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/MUON_TOROID.db"
49 from argparse
import ArgumentParser
51 parser = ArgumentParser()
52 parser.add_argument(
"--threads", type=int, help=
"number of threads", default=1)
53 parser.add_argument(
"--inputFile",
"-i", default= MuonPhaseIITestDefaults.EVGEN_PG,
54 help=
"Input file to run on ", nargs=
"+")
55 parser.add_argument(
"--geoModelFile", default = MuonPhaseIITestDefaults.GEODB_R3, help=
"GeoModel SqLite file containing the muon geometry.")
56 parser.add_argument(
"--defaultGeoFile", help=
"Use the predefined GeoModel files on cvmfs", choices=[
"NONE",
"RUN3",
"RUN4",
57 "RUN3MSOnly",
"RUN4MSOnly",
58 "ITkR3MS" ], default=
"NONE")
59 parser.add_argument(
"--chambers", default=[
"all"], nargs=
"+", help=
"Chambers to check. If string is all, all chambers will be checked")
60 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.")
61 parser.add_argument(
"--outRootFile", default=
"NewGeoModelDump.root", help=
"Output ROOT file to dump the geomerty")
62 parser.add_argument(
"--nEvents", help=
"Number of events to run", type = int ,default = 1)
63 parser.add_argument(
"--skipEvents", help=
"Number of events to skip", type = int, default = 0)
64 parser.add_argument(
"--noMdt", help=
"Disable the Mdts from the geometry", action=
'store_true', default =
False)
65 parser.add_argument(
"--noRpc", help=
"Disable the Rpcs from the geometry", action=
'store_true', default =
False)
66 parser.add_argument(
"--noTgc", help=
"Disable the Tgcs from the geometry", action=
'store_true', default =
False)
67 parser.add_argument(
"--noMM", help=
"Disable the MMs from the geometry", action=
'store_true', default =
False)
68 parser.add_argument(
"--noSTGC", help=
"Disable the sTgcs from the geometry", action=
'store_true', default =
False)
69 parser.add_argument(
"--eventPrintoutLevel", type=int, help=
"Interval of event heartbeat printouts from the loop manager", default = 1)
70 parser.add_argument(
"--localMdtMezzJSON", default=
"", help=
"")
71 parser.add_argument(
"--localMdtCablingJSON", default=
"", help=
"")
75 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
76 result = MainServicesCfg(flags)
78 from AthenaConfiguration.Enums
import Format
79 if flags.Input.Format
is Format.POOL:
80 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
81 result.merge(PoolReadCfg(flags))
82 elif flags.Input.Format == Format.BS:
83 from ByteStreamCnvSvc.ByteStreamConfig
import ByteStreamReadCfg
84 result.merge(ByteStreamReadCfg(flags))
86 from PerfMonComps.PerfMonCompsConfig
import PerfMonMTSvcCfg
87 result.merge(PerfMonMTSvcCfg(flags))
88 from MuonConfig.MuonGeometryConfig
import MuonIdHelperSvcCfg
89 result.merge(MuonIdHelperSvcCfg(flags))
92def GeoModelMdtTestCfg(flags, name = "GeoModelMdtTest", localMezzanineJSON="", localCablingJSON="",**kwargs):
93 result = ComponentAccumulator()
94 from MuonConfig.MuonCablingConfig
import MDTCablingConfigCfg
95 result.merge(MDTCablingConfigCfg(flags,MezzanineJSON=localMezzanineJSON, CablingJSON=localCablingJSON))
96 the_alg = CompFactory.MuonGMR4.GeoModelMdtTest(name, **kwargs)
97 result.addEventAlgo(the_alg, primary =
True)
101 result = ComponentAccumulator()
102 the_alg = CompFactory.MuonGMR4.GeoModelRpcTest(name, **kwargs)
103 result.addEventAlgo(the_alg, primary =
True)
107 result = ComponentAccumulator()
108 the_alg = CompFactory.MuonGMR4.GeoModelTgcTest(name, **kwargs)
109 result.addEventAlgo(the_alg, primary =
True)
113 result = ComponentAccumulator()
114 the_alg = CompFactory.MuonGMR4.GeoModelsTgcTest(name, **kwargs)
115 result.addEventAlgo(the_alg, primary =
True)
119 result = ComponentAccumulator()
120 the_alg = CompFactory.MuonGMR4.GeoModelMmTest(name, **kwargs)
121 result.addEventAlgo(the_alg, primary =
True)
125 result = ComponentAccumulator()
126 kwargs.setdefault(
"TestActsSurface",
True)
127 kwargs.setdefault(
"plotTgc", flags.Detector.GeometryTGC)
128 kwargs.setdefault(
"plotStgc", flags.Detector.GeometrysTGC)
129 kwargs.setdefault(
"plotMm", flags.Detector.GeometryMM)
131 the_alg = CompFactory.MuonGMR4.NswGeoPlottingAlg(name, **kwargs)
132 result.addEventAlgo(the_alg, primary =
True)
136 from AthenaCommon.Logging
import logging
137 log = logging.getLogger(
'GeometryConfiguration')
139 if not flags.GeoModel.SQLiteDB:
140 raise ValueError(
"Default tag configuration only works for SQLite")
142 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
143 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
144 from AthenaConfiguration.Enums
import LHCPeriod
145 if flags.GeoModel.Run == LHCPeriod.Run3:
146 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
147 elif flags.GeoModel.Run == LHCPeriod.Run4:
148 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN4
150 raise ValueError(f
"Invalid run period {flags.GeoModel.Run}")
151 from MuonConfig.MuonConfigUtils
import configureCondTag
152 configureCondTag(flags)
154 log.info(f
"Setup {flags.GeoModel.AtlasVersion} geometry loading {flags.GeoModel.SQLiteDBFullPath}")
155 log.info(f
"Use conditions tag {flags.IOVDb.GlobalTag}")
161 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
162 flags = initConfigFlags()
163 flags.Concurrency.NumThreads = args.threads
164 flags.Concurrency.NumConcurrentEvents = args.threads
165 flags.Exec.MaxEvents = args.nEvents
166 flags.Exec.SkipEvents = args.skipEvents
167 from os
import path, system, listdir
168 flags.Input.Files = []
171 for fileArg
in args.inputFile:
172 if path.isdir(fileArg):
173 flags.Input.Files += [
"{dir}/{file}".format(dir=fileArg, file=y)
for y
in listdir(fileArg) ]
175 if fileArg[fileArg.rfind(
".")+1 :]
not in [
"txt",
"conf"]:
176 flags.Input.Files+=[fileArg]
178 with open(fileArg)
as inStream:
179 flags.Input.Files+=[ line.strip()
for line
in inStream
if line[0]!=
'#']
182 flags.Exec.EventPrintoutInterval = 500
184 if args.defaultGeoFile ==
"RUN3":
185 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R3
186 elif args.defaultGeoFile ==
"RUN4":
187 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R4
188 elif args.defaultGeoFile ==
"RUN3MSOnly":
189 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R3MSOnly
190 elif args.defaultGeoFile ==
"RUN4MSOnly":
191 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R4MSOnly
192 elif args.defaultGeoFile ==
"ITkR3MS":
193 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_ITk_R3MS
194 elif args.geoModelFile.startswith(
"root://"):
195 if not path.exists(
"Geometry/{geoTag}.db".format(geoTag=args.geoTag)):
196 print (
"Copy geometry file from EOS {source}".format(source = args.geoModelFile))
197 system(
"mkdir Geometry/")
198 system(
"xrdcp {source} Geometry/{geoTag}.db".format(source = args.geoModelFile,
201 args.geoModelFile =
"Geometry/{geoTag}.db".format(geoTag=args.geoTag)
203 flags.GeoModel.SQLiteDBFullPath = args.geoModelFile
205 flags.GeoModel.SQLiteDB =
True
208 flags.Detector.GeometryBpipe =
False
210 flags.Detector.GeometryBCM =
False
211 flags.Detector.GeometryPixel =
False
212 flags.Detector.GeometrySCT =
False
213 flags.Detector.GeometryTRT =
False
215 flags.Detector.GeometryPLR =
False
216 flags.Detector.GeometryBCMPrime =
False
217 flags.Detector.GeometryITkPixel =
False
218 flags.Detector.GeometryITkStrip =
False
220 flags.Detector.GeometryHGTD =
False
222 flags.Detector.GeometryLAr =
False
223 flags.Detector.GeometryTile =
False
224 flags.Detector.GeometryMBTS =
False
225 flags.Detector.GeometryCalo =
False
227 flags.Detector.GeometryCSC =
False
229 flags.Detector.GeometrysTGC =
False
231 flags.Detector.GeometryMM =
False
233 flags.Detector.GeometryTGC =
False
235 flags.Detector.GeometryRPC =
False
237 flags.Detector.GeometryMDT =
False
239 flags.Acts.TrackingGeometry.UseBlueprint =
True
241 flags.Scheduler.CheckDependencies =
True
242 flags.Scheduler.ShowDataDeps =
True
243 flags.Scheduler.ShowDataFlow =
True
244 flags.Scheduler.ShowControlFlow =
True
245 flags.Scheduler.EnableVerboseViews =
True
246 flags.Scheduler.AutoLoadUnmetDependencies =
True
249 flags.dump(evaluate =
True)
252 from MuonConfig.MuonGeometryConfig
import MuonGeoModelCfg
253 cfg.merge(MuonGeoModelCfg(flags))
255 if not flags.Muon.usePhaseIIGeoSetup:
256 print (
"WARNING: New Muon plugin is not part of the Geometry file {geoDBFile}".format(geoDBFile=args.geoModelFile))
258 from ActsAlignmentAlgs.AlignmentAlgsConfig
import ActsGeometryContextAlgCfg
259 cfg.merge(ActsGeometryContextAlgCfg(flags))
261 cfg.getService(
"MessageSvc").verboseLimit = 10000000
262 cfg.getService(
"MessageSvc").debugLimit = 10000000
267 cfg.printConfig(withDetails=
True, summariseProps=
True)
268 if not cfg.run().isSuccess(): exit(1)
270if __name__==
"__main__":
273 from MuonConfig.MuonConfigUtils
import setupHistSvcCfg
274 cfg.merge(setupHistSvcCfg(flags, outFile = args.outRootFile, outStream=
"GEOMODELTESTER"))
275 chambToTest = args.chambers
if len([x
for x
in args.chambers
if x ==
"all"]) ==0
else []
276 chambToExclude = args.excludedChambers
279 if flags.Muon.usePhaseIIGeoSetup:
280 cfg.getCondAlgo(
"MuonDetectorCondAlg").checkGeo =
True
281 cfg.getCondAlgo(
"MuonDetectorCondAlg").dumpGeo =
True
282 from TrackingGeometryCondAlg.AtlasTrackingGeometryCondAlgConfig
import TrackingGeometryCondAlgCfg
283 cfg.merge(TrackingGeometryCondAlgCfg(flags))
286 cfg.getService(
"MessageSvc").setVerbose = []
288 if flags.Detector.GeometryMDT:
289 if not flags.Muon.usePhaseIIGeoSetup:
290 from MuonGeoModelTest.testGeoModel
import GeoModelMdtTestCfg
as LegacyTestCfg
291 cfg.merge(LegacyTestCfg(flags,
292 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B" or ch[0] ==
"E"],
293 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B" or ch[0] ==
"E"]))
296 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B" or ch[0] ==
"E"],
297 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B" or ch[0] ==
"E"],
298 localMezzanineJSON=args.localMdtMezzJSON,
299 localCablingJSON=args.localMdtCablingJSON,
300 ReadoutSideXML=
"ReadoutSides.xml",
301 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
303 if flags.Detector.GeometryRPC:
304 if not flags.Muon.usePhaseIIGeoSetup:
305 from MuonGeoModelTest.testGeoModel
import GeoModelRpcTestCfg
as LegacyTestCfg
306 cfg.merge(LegacyTestCfg(flags,
307 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B"],
308 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B"]))
311 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B"],
312 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B"],
313 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
315 if flags.Detector.GeometryTGC:
316 if not flags.Muon.usePhaseIIGeoSetup:
317 from MuonGeoModelTest.testGeoModel
import GeoModelTgcTestCfg
as LegacyTestCfg
318 cfg.merge(LegacyTestCfg(flags,
319 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"T"],
320 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"T"]))
323 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"T"],
324 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"T"],
325 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
327 if flags.Detector.GeometryMM:
328 if not flags.Muon.usePhaseIIGeoSetup:
329 from MuonGeoModelTest.testGeoModel
import GeoModelMmTestCfg
as LegacyTestCfg
330 cfg.merge(LegacyTestCfg(flags,
331 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"M"],
332 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"M"]))
335 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"M"],
336 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"M"],
337 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
339 if flags.Detector.GeometrysTGC:
340 if not flags.Muon.usePhaseIIGeoSetup:
341 from MuonGeoModelTest.testGeoModel
import GeoModelsTgcTestCfg
as LegacyTestCfg
342 cfg.merge(LegacyTestCfg(flags,
343 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"S"],
344 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"S"]))
347 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"S"],
348 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"S"],
349 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)