2 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
3 from 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" ]
26 GEODB_R3 =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-R3S-2021-03-02-00.db"
28 GEODB_R3MSOnly =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-R3S-2021-03-02-00_MSOnly.db"
30 GEODB_R4 =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-P2-RUN4-01-00-00.db"
32 GEODB_R4MSOnly =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-P2-RUN4-01-00-00_MSOnly.db"
34 GEODB_ITk_R3MS =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-P2-RUN4-01-00-00_R3MS.db"
38 from argparse
import ArgumentParser
40 parser = ArgumentParser()
41 parser.add_argument(
"--threads", type=int, help=
"number of threads", default=1)
42 parser.add_argument(
"--inputFile",
"-i", default= MuonPhaseIITestDefaults.EVGEN_PG,
43 help=
"Input file to run on ", nargs=
"+")
44 parser.add_argument(
"--geoModelFile", default = MuonPhaseIITestDefaults.GEODB_R3, help=
"GeoModel SqLite file containing the muon geometry.")
45 parser.add_argument(
"--defaultGeoFile", help=
"Use the predefined GeoModel files on cvmfs", choices=[
"NONE",
"RUN3",
"RUN4",
46 "RUN3MSOnly",
"RUN4MSOnly",
47 "ITkR3MS" ], default=
"NONE")
48 parser.add_argument(
"--chambers", default=[
"all"], nargs=
"+", help=
"Chambers to check. If string is all, all chambers will be checked")
49 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.")
50 parser.add_argument(
"--outRootFile", default=
"NewGeoModelDump.root", help=
"Output ROOT file to dump the geomerty")
51 parser.add_argument(
"--nEvents", help=
"Number of events to run", type = int ,default = 1)
52 parser.add_argument(
"--skipEvents", help=
"Number of events to skip", type = int, default = 0)
53 parser.add_argument(
"--noMdt", help=
"Disable the Mdts from the geometry", action=
'store_true', default =
False)
54 parser.add_argument(
"--noRpc", help=
"Disable the Rpcs from the geometry", action=
'store_true', default =
False)
55 parser.add_argument(
"--noTgc", help=
"Disable the Tgcs from the geometry", action=
'store_true', default =
False)
56 parser.add_argument(
"--noMM", help=
"Disable the MMs from the geometry", action=
'store_true', default =
False)
57 parser.add_argument(
"--noSTGC", help=
"Disable the sTgcs from the geometry", action=
'store_true', default =
False)
58 parser.add_argument(
"--eventPrintoutLevel", type=int, help=
"Interval of event heartbeat printouts from the loop manager", default = 1)
62 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
65 from AthenaConfiguration.Enums
import Format
66 if flags.Input.Format
is Format.POOL:
67 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
69 elif flags.Input.Format == Format.BS:
70 from ByteStreamCnvSvc.ByteStreamConfig
import ByteStreamReadCfg
73 from PerfMonComps.PerfMonCompsConfig
import PerfMonMTSvcCfg
75 from MuonConfig.MuonGeometryConfig
import MuonIdHelperSvcCfg
81 from MuonConfig.MuonCablingConfig
import MDTCablingConfigCfg
83 the_alg = CompFactory.MuonGMR4.GeoModelMdtTest(name, **kwargs)
84 result.addEventAlgo(the_alg, primary =
True)
89 the_alg = CompFactory.MuonGMR4.GeoModelRpcTest(name, **kwargs)
90 result.addEventAlgo(the_alg, primary =
True)
95 the_alg = CompFactory.MuonGMR4.GeoModelTgcTest(name, **kwargs)
96 result.addEventAlgo(the_alg, primary =
True)
101 the_alg = CompFactory.MuonGMR4.GeoModelsTgcTest(name, **kwargs)
102 result.addEventAlgo(the_alg, primary =
True)
107 the_alg = CompFactory.MuonGMR4.GeoModelMmTest(name, **kwargs)
108 result.addEventAlgo(the_alg, primary =
True)
113 kwargs.setdefault(
"TestActsSurface",
True)
114 kwargs.setdefault(
"plotTgc", flags.Detector.GeometryTGC)
115 kwargs.setdefault(
"plotStgc", flags.Detector.GeometrysTGC)
116 kwargs.setdefault(
"plotMm", flags.Detector.GeometryMM)
118 the_alg = CompFactory.MuonGMR4.NswGeoPlottingAlg(name, **kwargs)
119 result.addEventAlgo(the_alg, primary =
True)
123 from AthenaCommon.Logging
import logging
124 log = logging.getLogger(
'GeometryConfiguration')
126 if not flags.GeoModel.SQLiteDB:
127 raise ValueError(
"Default tag configuration only works for SQLite")
129 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
130 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
131 from AthenaConfiguration.Enums
import LHCPeriod
132 if flags.GeoModel.Run == LHCPeriod.Run3:
133 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
134 elif flags.GeoModel.Run == LHCPeriod.Run4:
135 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN4
137 raise ValueError(f
"Invalid run period {flags.GeoModel.Run}")
138 from MuonConfig.MuonConfigUtils
import configureCondTag
141 log.info(f
"Setup {flags.GeoModel.AtlasVersion} geometry loading {flags.GeoModel.SQLiteDBFullPath}")
142 log.info(f
"Use conditions tag {flags.IOVDb.GlobalTag}")
148 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
150 flags.Concurrency.NumThreads = args.threads
151 flags.Concurrency.NumConcurrentEvents = args.threads
152 flags.Exec.MaxEvents = args.nEvents
153 flags.Exec.SkipEvents = args.skipEvents
154 from os
import path, system, listdir
155 flags.Input.Files = []
158 for fileArg
in args.inputFile:
159 if path.isdir(fileArg):
160 flags.Input.Files += [
"{dir}/{file}".
format(dir=fileArg, file=y)
for y
in listdir(fileArg) ]
162 if fileArg[fileArg.rfind(
".")+1 :]
not in [
"txt",
"conf"]:
163 flags.Input.Files+=[fileArg]
165 with open(fileArg)
as inStream:
166 flags.Input.Files+=[ line.strip()
for line
in inStream
if line[0]!=
'#']
169 flags.Exec.EventPrintoutInterval = 500
171 if args.defaultGeoFile ==
"RUN3":
172 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R3
173 elif args.defaultGeoFile ==
"RUN4":
174 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R4
175 elif args.defaultGeoFile ==
"RUN3MSOnly":
176 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R3MSOnly
177 elif args.defaultGeoFile ==
"RUN4MSOnly":
178 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R4MSOnly
179 elif args.defaultGeoFile ==
"ITkR3MS":
180 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_ITk_R3MS
181 elif args.geoModelFile.startswith(
"root://"):
182 if not path.exists(
"Geometry/{geoTag}.db".
format(geoTag=args.geoTag)):
183 print (
"Copy geometry file from EOS {source}".
format(source = args.geoModelFile))
184 system(
"mkdir Geometry/")
185 system(
"xrdcp {source} Geometry/{geoTag}.db".
format(source = args.geoModelFile,
188 args.geoModelFile =
"Geometry/{geoTag}.db".
format(geoTag=args.geoTag)
190 flags.GeoModel.SQLiteDBFullPath = args.geoModelFile
192 flags.GeoModel.SQLiteDB =
True
195 flags.Detector.GeometryBpipe =
False
197 flags.Detector.GeometryBCM =
False
198 flags.Detector.GeometryPixel =
False
199 flags.Detector.GeometrySCT =
False
200 flags.Detector.GeometryTRT =
False
202 flags.Detector.GeometryPLR =
False
203 flags.Detector.GeometryBCMPrime =
False
204 flags.Detector.GeometryITkPixel =
False
205 flags.Detector.GeometryITkStrip =
False
207 flags.Detector.GeometryHGTD =
False
209 flags.Detector.GeometryLAr =
False
210 flags.Detector.GeometryTile =
False
211 flags.Detector.GeometryMBTS =
False
212 flags.Detector.GeometryCalo =
False
214 flags.Detector.GeometryCSC =
False
216 flags.Detector.GeometrysTGC =
False
218 flags.Detector.GeometryMM =
False
220 flags.Detector.GeometryTGC =
False
222 flags.Detector.GeometryRPC =
False
224 flags.Detector.GeometryMDT =
False
226 flags.Scheduler.CheckDependencies =
True
227 flags.Scheduler.ShowDataDeps =
True
228 flags.Scheduler.ShowDataFlow =
True
229 flags.Scheduler.ShowControlFlow =
True
230 flags.Scheduler.EnableVerboseViews =
True
231 flags.Scheduler.AutoLoadUnmetDependencies =
True
234 flags.dump(evaluate =
True)
237 from MuonConfig.MuonGeometryConfig
import MuonGeoModelCfg
241 if not flags.Muon.usePhaseIIGeoSetup:
242 print (
"WARNING: New Muon plugin is not part of the Geometry file {geoDBFile}".
format(geoDBFile=args.geoModelFile))
244 from ActsAlignmentAlgs.AlignmentAlgsConfig
import ActsGeometryContextAlgCfg
247 cfg.getService(
"MessageSvc").verboseLimit = 10000000
248 cfg.getService(
"MessageSvc").debugLimit = 10000000
253 cfg.printConfig(withDetails=
True, summariseProps=
True)
254 if not cfg.run().isSuccess():
exit(1)
256 if __name__==
"__main__":
259 from MuonConfig.MuonConfigUtils
import setupHistSvcCfg
260 cfg.merge(
setupHistSvcCfg(flags, outFile = args.outRootFile, outStream=
"GEOMODELTESTER"))
261 chambToTest = args.chambers
if len([x
for x
in args.chambers
if x ==
"all"]) ==0
else []
262 chambToExclude = args.excludedChambers
265 if flags.Muon.usePhaseIIGeoSetup:
266 cfg.getCondAlgo(
"MuonDetectorCondAlg").checkGeo =
True
267 cfg.getCondAlgo(
"MuonDetectorCondAlg").dumpGeo =
True
268 from TrackingGeometryCondAlg.AtlasTrackingGeometryCondAlgConfig
import TrackingGeometryCondAlgCfg
272 cfg.getService(
"MessageSvc").setVerbose = []
274 if flags.Detector.GeometryMDT:
275 if not flags.Muon.usePhaseIIGeoSetup:
276 from MuonGeoModelTest.testGeoModel
import GeoModelMdtTestCfg
as LegacyTestCfg
277 cfg.merge(LegacyTestCfg(flags,
278 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B" or ch[0] ==
"E"],
279 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B" or ch[0] ==
"E"]))
282 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B" or ch[0] ==
"E"],
283 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B" or ch[0] ==
"E"],
284 ReadoutSideXML=
"ReadoutSides.xml",
285 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
287 if flags.Detector.GeometryRPC:
288 if not flags.Muon.usePhaseIIGeoSetup:
289 from MuonGeoModelTest.testGeoModel
import GeoModelRpcTestCfg
as LegacyTestCfg
290 cfg.merge(LegacyTestCfg(flags,
291 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B"],
292 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B"]))
295 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B"],
296 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B"],
297 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
299 if flags.Detector.GeometryTGC:
300 if not flags.Muon.usePhaseIIGeoSetup:
301 from MuonGeoModelTest.testGeoModel
import GeoModelTgcTestCfg
as LegacyTestCfg
302 cfg.merge(LegacyTestCfg(flags,
303 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"T"],
304 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"T"]))
307 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"T"],
308 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"T"],
309 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
311 if flags.Detector.GeometryMM:
312 if not flags.Muon.usePhaseIIGeoSetup:
313 from MuonGeoModelTest.testGeoModel
import GeoModelMmTestCfg
as LegacyTestCfg
314 cfg.merge(LegacyTestCfg(flags,
315 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"M"],
316 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"M"]))
319 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"M"],
320 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"M"],
321 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
323 if flags.Detector.GeometrysTGC:
324 if not flags.Muon.usePhaseIIGeoSetup:
325 from MuonGeoModelTest.testGeoModel
import GeoModelsTgcTestCfg
as LegacyTestCfg
326 cfg.merge(LegacyTestCfg(flags,
327 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"S"],
328 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"S"]))
331 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"S"],
332 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"S"],
333 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))