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"
48 from argparse
import ArgumentParser
50 parser = ArgumentParser()
51 parser.add_argument(
"--threads", type=int, help=
"number of threads", default=1)
52 parser.add_argument(
"--inputFile",
"-i", default= MuonPhaseIITestDefaults.EVGEN_PG,
53 help=
"Input file to run on ", nargs=
"+")
54 parser.add_argument(
"--geoModelFile", default = MuonPhaseIITestDefaults.GEODB_R3, help=
"GeoModel SqLite file containing the muon geometry.")
55 parser.add_argument(
"--defaultGeoFile", help=
"Use the predefined GeoModel files on cvmfs", choices=[
"NONE",
"RUN3",
"RUN4",
56 "RUN3MSOnly",
"RUN4MSOnly",
57 "ITkR3MS" ], default=
"NONE")
58 parser.add_argument(
"--chambers", default=[
"all"], nargs=
"+", help=
"Chambers to check. If string is all, all chambers will be checked")
59 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.")
60 parser.add_argument(
"--outRootFile", default=
"NewGeoModelDump.root", help=
"Output ROOT file to dump the geomerty")
61 parser.add_argument(
"--nEvents", help=
"Number of events to run", type = int ,default = 1)
62 parser.add_argument(
"--skipEvents", help=
"Number of events to skip", type = int, default = 0)
63 parser.add_argument(
"--noMdt", help=
"Disable the Mdts from the geometry", action=
'store_true', default =
False)
64 parser.add_argument(
"--noRpc", help=
"Disable the Rpcs from the geometry", action=
'store_true', default =
False)
65 parser.add_argument(
"--noTgc", help=
"Disable the Tgcs from the geometry", action=
'store_true', default =
False)
66 parser.add_argument(
"--noMM", help=
"Disable the MMs from the geometry", action=
'store_true', default =
False)
67 parser.add_argument(
"--noSTGC", help=
"Disable the sTgcs from the geometry", action=
'store_true', default =
False)
68 parser.add_argument(
"--eventPrintoutLevel", type=int, help=
"Interval of event heartbeat printouts from the loop manager", default = 1)
69 parser.add_argument(
"--localMdtMezzJSON", default=
"", help=
"")
70 parser.add_argument(
"--localMdtCablingJSON", default=
"", help=
"")
74 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
75 result = MainServicesCfg(flags)
77 from AthenaConfiguration.Enums
import Format
78 if flags.Input.Format
is Format.POOL:
79 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
80 result.merge(PoolReadCfg(flags))
81 elif flags.Input.Format == Format.BS:
82 from ByteStreamCnvSvc.ByteStreamConfig
import ByteStreamReadCfg
83 result.merge(ByteStreamReadCfg(flags))
85 from PerfMonComps.PerfMonCompsConfig
import PerfMonMTSvcCfg
86 result.merge(PerfMonMTSvcCfg(flags))
87 from MuonConfig.MuonGeometryConfig
import MuonIdHelperSvcCfg
88 result.merge(MuonIdHelperSvcCfg(flags))
91def GeoModelMdtTestCfg(flags, name = "GeoModelMdtTest", localMezzanineJSON="", localCablingJSON="",**kwargs):
92 result = ComponentAccumulator()
93 from MuonConfig.MuonCablingConfig
import MDTCablingConfigCfg
94 result.merge(MDTCablingConfigCfg(flags,MezzanineJSON=localMezzanineJSON, CablingJSON=localCablingJSON))
95 the_alg = CompFactory.MuonGMR4.GeoModelMdtTest(name, **kwargs)
96 result.addEventAlgo(the_alg, primary =
True)
100 result = ComponentAccumulator()
101 the_alg = CompFactory.MuonGMR4.GeoModelRpcTest(name, **kwargs)
102 result.addEventAlgo(the_alg, primary =
True)
106 result = ComponentAccumulator()
107 the_alg = CompFactory.MuonGMR4.GeoModelTgcTest(name, **kwargs)
108 result.addEventAlgo(the_alg, primary =
True)
112 result = ComponentAccumulator()
113 the_alg = CompFactory.MuonGMR4.GeoModelsTgcTest(name, **kwargs)
114 result.addEventAlgo(the_alg, primary =
True)
118 result = ComponentAccumulator()
119 the_alg = CompFactory.MuonGMR4.GeoModelMmTest(name, **kwargs)
120 result.addEventAlgo(the_alg, primary =
True)
124 result = ComponentAccumulator()
125 kwargs.setdefault(
"TestActsSurface",
True)
126 kwargs.setdefault(
"plotTgc", flags.Detector.GeometryTGC)
127 kwargs.setdefault(
"plotStgc", flags.Detector.GeometrysTGC)
128 kwargs.setdefault(
"plotMm", flags.Detector.GeometryMM)
130 the_alg = CompFactory.MuonGMR4.NswGeoPlottingAlg(name, **kwargs)
131 result.addEventAlgo(the_alg, primary =
True)
135 from AthenaCommon.Logging
import logging
136 log = logging.getLogger(
'GeometryConfiguration')
138 if not flags.GeoModel.SQLiteDB:
139 raise ValueError(
"Default tag configuration only works for SQLite")
141 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
142 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
143 from AthenaConfiguration.Enums
import LHCPeriod
144 if flags.GeoModel.Run == LHCPeriod.Run3:
145 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
146 elif flags.GeoModel.Run == LHCPeriod.Run4:
147 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN4
149 raise ValueError(f
"Invalid run period {flags.GeoModel.Run}")
150 from MuonConfig.MuonConfigUtils
import configureCondTag
151 configureCondTag(flags)
153 log.info(f
"Setup {flags.GeoModel.AtlasVersion} geometry loading {flags.GeoModel.SQLiteDBFullPath}")
154 log.info(f
"Use conditions tag {flags.IOVDb.GlobalTag}")
160 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
161 flags = initConfigFlags()
162 flags.Concurrency.NumThreads = args.threads
163 flags.Concurrency.NumConcurrentEvents = args.threads
164 flags.Exec.MaxEvents = args.nEvents
165 flags.Exec.SkipEvents = args.skipEvents
166 from os
import path, system, listdir
167 flags.Input.Files = []
170 for fileArg
in args.inputFile:
171 if path.isdir(fileArg):
172 flags.Input.Files += [
"{dir}/{file}".format(dir=fileArg, file=y)
for y
in listdir(fileArg) ]
174 if fileArg[fileArg.rfind(
".")+1 :]
not in [
"txt",
"conf"]:
175 flags.Input.Files+=[fileArg]
177 with open(fileArg)
as inStream:
178 flags.Input.Files+=[ line.strip()
for line
in inStream
if line[0]!=
'#']
181 flags.Exec.EventPrintoutInterval = 500
183 if args.defaultGeoFile ==
"RUN3":
184 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R3
185 elif args.defaultGeoFile ==
"RUN4":
186 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R4
187 elif args.defaultGeoFile ==
"RUN3MSOnly":
188 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R3MSOnly
189 elif args.defaultGeoFile ==
"RUN4MSOnly":
190 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R4MSOnly
191 elif args.defaultGeoFile ==
"ITkR3MS":
192 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_ITk_R3MS
193 elif args.geoModelFile.startswith(
"root://"):
194 if not path.exists(
"Geometry/{geoTag}.db".format(geoTag=args.geoTag)):
195 print (
"Copy geometry file from EOS {source}".format(source = args.geoModelFile))
196 system(
"mkdir Geometry/")
197 system(
"xrdcp {source} Geometry/{geoTag}.db".format(source = args.geoModelFile,
200 args.geoModelFile =
"Geometry/{geoTag}.db".format(geoTag=args.geoTag)
202 flags.GeoModel.SQLiteDBFullPath = args.geoModelFile
204 flags.GeoModel.SQLiteDB =
True
207 flags.Detector.GeometryBpipe =
False
209 flags.Detector.GeometryBCM =
False
210 flags.Detector.GeometryPixel =
False
211 flags.Detector.GeometrySCT =
False
212 flags.Detector.GeometryTRT =
False
214 flags.Detector.GeometryPLR =
False
215 flags.Detector.GeometryBCMPrime =
False
216 flags.Detector.GeometryITkPixel =
False
217 flags.Detector.GeometryITkStrip =
False
219 flags.Detector.GeometryHGTD =
False
221 flags.Detector.GeometryLAr =
False
222 flags.Detector.GeometryTile =
False
223 flags.Detector.GeometryMBTS =
False
224 flags.Detector.GeometryCalo =
False
226 flags.Detector.GeometryCSC =
False
228 flags.Detector.GeometrysTGC =
False
230 flags.Detector.GeometryMM =
False
232 flags.Detector.GeometryTGC =
False
234 flags.Detector.GeometryRPC =
False
236 flags.Detector.GeometryMDT =
False
238 flags.Acts.TrackingGeometry.UseBlueprint =
True
240 flags.Scheduler.CheckDependencies =
True
241 flags.Scheduler.ShowDataDeps =
True
242 flags.Scheduler.ShowDataFlow =
True
243 flags.Scheduler.ShowControlFlow =
True
244 flags.Scheduler.EnableVerboseViews =
True
245 flags.Scheduler.AutoLoadUnmetDependencies =
True
248 flags.dump(evaluate =
True)
251 from MuonConfig.MuonGeometryConfig
import MuonGeoModelCfg
252 cfg.merge(MuonGeoModelCfg(flags))
254 if not flags.Muon.usePhaseIIGeoSetup:
255 print (
"WARNING: New Muon plugin is not part of the Geometry file {geoDBFile}".format(geoDBFile=args.geoModelFile))
257 from ActsAlignmentAlgs.AlignmentAlgsConfig
import ActsGeometryContextAlgCfg
258 cfg.merge(ActsGeometryContextAlgCfg(flags))
260 cfg.getService(
"MessageSvc").verboseLimit = 10000000
261 cfg.getService(
"MessageSvc").debugLimit = 10000000
266 cfg.printConfig(withDetails=
True, summariseProps=
True)
267 if not cfg.run().isSuccess(): exit(1)
269if __name__==
"__main__":
272 from MuonConfig.MuonConfigUtils
import setupHistSvcCfg
273 cfg.merge(setupHistSvcCfg(flags, outFile = args.outRootFile, outStream=
"GEOMODELTESTER"))
274 chambToTest = args.chambers
if len([x
for x
in args.chambers
if x ==
"all"]) ==0
else []
275 chambToExclude = args.excludedChambers
278 if flags.Muon.usePhaseIIGeoSetup:
279 cfg.getCondAlgo(
"MuonDetectorCondAlg").checkGeo =
True
280 cfg.getCondAlgo(
"MuonDetectorCondAlg").dumpGeo =
True
281 from TrackingGeometryCondAlg.AtlasTrackingGeometryCondAlgConfig
import TrackingGeometryCondAlgCfg
282 cfg.merge(TrackingGeometryCondAlgCfg(flags))
285 cfg.getService(
"MessageSvc").setVerbose = []
287 if flags.Detector.GeometryMDT:
288 if not flags.Muon.usePhaseIIGeoSetup:
289 from MuonGeoModelTest.testGeoModel
import GeoModelMdtTestCfg
as LegacyTestCfg
290 cfg.merge(LegacyTestCfg(flags,
291 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B" or ch[0] ==
"E"],
292 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B" or ch[0] ==
"E"]))
295 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B" or ch[0] ==
"E"],
296 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B" or ch[0] ==
"E"],
297 localMezzanineJSON=args.localMdtMezzJSON,
298 localCablingJSON=args.localMdtCablingJSON,
299 ReadoutSideXML=
"ReadoutSides.xml",
300 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
302 if flags.Detector.GeometryRPC:
303 if not flags.Muon.usePhaseIIGeoSetup:
304 from MuonGeoModelTest.testGeoModel
import GeoModelRpcTestCfg
as LegacyTestCfg
305 cfg.merge(LegacyTestCfg(flags,
306 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B"],
307 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B"]))
310 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B"],
311 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B"],
312 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
314 if flags.Detector.GeometryTGC:
315 if not flags.Muon.usePhaseIIGeoSetup:
316 from MuonGeoModelTest.testGeoModel
import GeoModelTgcTestCfg
as LegacyTestCfg
317 cfg.merge(LegacyTestCfg(flags,
318 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"T"],
319 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"T"]))
322 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"T"],
323 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"T"],
324 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
326 if flags.Detector.GeometryMM:
327 if not flags.Muon.usePhaseIIGeoSetup:
328 from MuonGeoModelTest.testGeoModel
import GeoModelMmTestCfg
as LegacyTestCfg
329 cfg.merge(LegacyTestCfg(flags,
330 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"M"],
331 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"M"]))
334 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"M"],
335 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"M"],
336 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
338 if flags.Detector.GeometrysTGC:
339 if not flags.Muon.usePhaseIIGeoSetup:
340 from MuonGeoModelTest.testGeoModel
import GeoModelsTgcTestCfg
as LegacyTestCfg
341 cfg.merge(LegacyTestCfg(flags,
342 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"S"],
343 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"S"]))
346 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"S"],
347 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"S"],
348 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)