2 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
3 from AthenaConfiguration.ComponentFactory
import CompFactory
9 return "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-P2-RUN4-01-00-00.db"
10 return "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-R3S-2021-03-02-00.db"
13 from argparse
import ArgumentParser
15 parser = ArgumentParser()
16 parser.add_argument(
"--threads", type=int, help=
"number of threads", default=1)
17 parser.add_argument(
"--inputFile",
"-i", default=[
19 "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/EVGEN_ParticleGun_FourMuon_Pt10to500.root"
21 help=
"Input file to run on ", nargs=
"+")
22 parser.add_argument(
"--geoModelFile", default =
geoModelFileDefault(), help=
"GeoModel SqLite file containing the muon geometry.")
23 parser.add_argument(
"--defaultGeoFile", help=
"Use the predefined GeoModel files on cvmfs", choices=[
"NONE",
"RUN3",
"RUN4" ], default=
"NONE")
24 parser.add_argument(
"--chambers", default=[
"all"], nargs=
"+", help=
"Chambers to check. If string is all, all chambers will be checked")
25 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.")
26 parser.add_argument(
"--outRootFile", default=
"NewGeoModelDump.root", help=
"Output ROOT file to dump the geomerty")
27 parser.add_argument(
"--nEvents", help=
"Number of events to run", type = int ,default = 1)
28 parser.add_argument(
"--skipEvents", help=
"Number of events to skip", type = int, default = 0)
29 parser.add_argument(
"--noMdt", help=
"Disable the Mdts from the geometry", action=
'store_true', default =
False)
30 parser.add_argument(
"--noRpc", help=
"Disable the Rpcs from the geometry", action=
'store_true', default =
False)
31 parser.add_argument(
"--noTgc", help=
"Disable the Tgcs from the geometry", action=
'store_true', default =
False)
32 parser.add_argument(
"--noMM", help=
"Disable the MMs from the geometry", action=
'store_true', default =
False)
33 parser.add_argument(
"--noSTGC", help=
"Disable the sTgcs from the geometry", action=
'store_true', default =
False)
34 parser.add_argument(
"--eventPrintoutLevel", type=int, help=
"Interval of event heartbeat printouts from the loop manager", default = 1)
38 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
41 from AthenaConfiguration.Enums
import Format
42 if flags.Input.Format
is Format.POOL:
43 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
45 elif flags.Input.Format == Format.BS:
46 from ByteStreamCnvSvc.ByteStreamConfig
import ByteStreamReadCfg
49 from PerfMonComps.PerfMonCompsConfig
import PerfMonMTSvcCfg
51 from MuonConfig.MuonGeometryConfig
import MuonIdHelperSvcCfg
57 the_alg = CompFactory.MuonGMR4.GeoModelMdtTest(name, **kwargs)
58 result.addEventAlgo(the_alg, primary =
True)
63 the_alg = CompFactory.MuonGMR4.GeoModelRpcTest(name, **kwargs)
64 result.addEventAlgo(the_alg, primary =
True)
69 the_alg = CompFactory.MuonGMR4.GeoModelTgcTest(name, **kwargs)
70 result.addEventAlgo(the_alg, primary =
True)
75 the_alg = CompFactory.MuonGMR4.GeoModelsTgcTest(name, **kwargs)
76 result.addEventAlgo(the_alg, primary =
True)
81 the_alg = CompFactory.MuonGMR4.GeoModelMmTest(name, **kwargs)
82 result.addEventAlgo(the_alg, primary =
True)
87 kwargs.setdefault(
"TestActsSurface",
True)
88 kwargs.setdefault(
"plotTgc", flags.Detector.GeometryTGC)
89 kwargs.setdefault(
"plotStgc", flags.Detector.GeometrysTGC)
90 kwargs.setdefault(
"plotMm", flags.Detector.GeometryMM)
92 the_alg = CompFactory.MuonGMR4.NswGeoPlottingAlg(name, **kwargs)
93 result.addEventAlgo(the_alg, primary =
True)
97 from AthenaCommon.Logging
import logging
98 log = logging.getLogger(
'GeometryConfiguration')
100 if not flags.GeoModel.SQLiteDB:
101 raise ValueError(
"Default tag configuration only works for SQLite")
103 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
104 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
105 from AthenaConfiguration.Enums
import LHCPeriod
106 if flags.GeoModel.Run == LHCPeriod.Run3:
107 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
108 elif flags.GeoModel.Run == LHCPeriod.Run4:
109 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN4
111 raise ValueError(f
"Invalid run period {flags.GeoModel.Run}")
112 from MuonConfig.MuonConfigUtils
import configureCondTag
115 log.info(f
"Setup {flags.GeoModel.AtlasVersion} geometry loading {flags.GeoModel.SQLiteDBFullPath}")
116 log.info(f
"Use conditions tag {flags.IOVDb.GlobalTag}")
122 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
124 flags.Concurrency.NumThreads = args.threads
125 flags.Concurrency.NumConcurrentEvents = args.threads
126 flags.Exec.MaxEvents = args.nEvents
127 flags.Exec.SkipEvents = args.skipEvents
128 from os
import path, system, listdir
129 flags.Input.Files = []
132 for fileArg
in args.inputFile:
133 if path.isdir(fileArg):
134 flags.Input.Files += [
"{dir}/{file}".
format(dir=fileArg, file=y)
for y
in listdir(fileArg) ]
136 if fileArg[fileArg.rfind(
".")+1 :]
not in [
"txt",
"conf"]:
137 flags.Input.Files+=[fileArg]
139 with open(fileArg)
as inStream:
140 flags.Input.Files+=[ line.strip()
for line
in inStream
if line[0]!=
'#']
143 flags.Exec.EventPrintoutInterval = 500
145 if args.defaultGeoFile ==
"RUN3":
147 elif args.defaultGeoFile ==
"RUN4":
149 elif args.geoModelFile.startswith(
"root://"):
150 if not path.exists(
"Geometry/{geoTag}.db".
format(geoTag=args.geoTag)):
151 print (
"Copy geometry file from EOS {source}".
format(source = args.geoModelFile))
152 system(
"mkdir Geometry/")
153 system(
"xrdcp {source} Geometry/{geoTag}.db".
format(source = args.geoModelFile,
156 args.geoModelFile =
"Geometry/{geoTag}.db".
format(geoTag=args.geoTag)
158 flags.GeoModel.SQLiteDBFullPath = args.geoModelFile
160 flags.GeoModel.SQLiteDB =
True
163 flags.Detector.GeometryBpipe =
False
165 flags.Detector.GeometryBCM =
False
166 flags.Detector.GeometryPixel =
False
167 flags.Detector.GeometrySCT =
False
168 flags.Detector.GeometryTRT =
False
170 flags.Detector.GeometryPLR =
False
171 flags.Detector.GeometryBCMPrime =
False
172 flags.Detector.GeometryITkPixel =
False
173 flags.Detector.GeometryITkStrip =
False
175 flags.Detector.GeometryHGTD =
False
177 flags.Detector.GeometryLAr =
False
178 flags.Detector.GeometryTile =
False
179 flags.Detector.GeometryMBTS =
False
180 flags.Detector.GeometryCalo =
False
182 flags.Detector.GeometryCSC =
False
184 flags.Detector.GeometrysTGC =
False
186 flags.Detector.GeometryMM =
False
188 flags.Detector.GeometryTGC =
False
190 flags.Detector.GeometryRPC =
False
192 flags.Detector.GeometryMDT =
False
194 flags.Scheduler.CheckDependencies =
True
195 flags.Scheduler.ShowDataDeps =
True
196 flags.Scheduler.ShowDataFlow =
True
197 flags.Scheduler.ShowControlFlow =
True
198 flags.Scheduler.EnableVerboseViews =
True
199 flags.Scheduler.AutoLoadUnmetDependencies =
True
202 flags.dump(evaluate =
True)
205 from MuonConfig.MuonGeometryConfig
import MuonGeoModelCfg
209 if not flags.Muon.usePhaseIIGeoSetup:
210 print (
"WARNING: New Muon plugin is not part of the Geometry file {geoDBFile}".
format(geoDBFile=args.geoModelFile))
212 from ActsAlignmentAlgs.AlignmentAlgsConfig
import ActsGeometryContextAlgCfg
215 cfg.getService(
"MessageSvc").verboseLimit = 10000000
216 cfg.getService(
"MessageSvc").debugLimit = 10000000
221 cfg.printConfig(withDetails=
True, summariseProps=
True)
222 if not cfg.run().isSuccess():
exit(1)
224 if __name__==
"__main__":
227 from MuonConfig.MuonConfigUtils
import setupHistSvcCfg
228 cfg.merge(
setupHistSvcCfg(flags, outFile = args.outRootFile, outStream=
"GEOMODELTESTER"))
229 chambToTest = args.chambers
if len([x
for x
in args.chambers
if x ==
"all"]) ==0
else []
230 chambToExclude = args.excludedChambers
233 if flags.Muon.usePhaseIIGeoSetup:
234 cfg.getCondAlgo(
"MuonDetectorCondAlg").checkGeo =
True
235 from TrackingGeometryCondAlg.AtlasTrackingGeometryCondAlgConfig
import TrackingGeometryCondAlgCfg
239 cfg.getService(
"MessageSvc").setVerbose = []
241 if flags.Detector.GeometryMDT:
242 if not flags.Muon.usePhaseIIGeoSetup:
243 from MuonGeoModelTest.testGeoModel
import GeoModelMdtTestCfg
as LegacyTestCfg
244 cfg.merge(LegacyTestCfg(flags,
245 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B" or ch[0] ==
"E"],
246 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B" or ch[0] ==
"E"]))
249 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B" or ch[0] ==
"E"],
250 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B" or ch[0] ==
"E"],
251 ReadoutSideXML=
"ReadoutSides.xml",
252 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
254 if flags.Detector.GeometryRPC:
255 if not flags.Muon.usePhaseIIGeoSetup:
256 from MuonGeoModelTest.testGeoModel
import GeoModelRpcTestCfg
as LegacyTestCfg
257 cfg.merge(LegacyTestCfg(flags,
258 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B"],
259 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B"]))
262 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B"],
263 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B"],
264 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
266 if flags.Detector.GeometryTGC:
267 if not flags.Muon.usePhaseIIGeoSetup:
268 from MuonGeoModelTest.testGeoModel
import GeoModelTgcTestCfg
as LegacyTestCfg
269 cfg.merge(LegacyTestCfg(flags,
270 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"T"],
271 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"T"]))
274 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"T"],
275 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"T"],
276 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
278 if flags.Detector.GeometryMM:
279 if not flags.Muon.usePhaseIIGeoSetup:
280 from MuonGeoModelTest.testGeoModel
import GeoModelMmTestCfg
as LegacyTestCfg
281 cfg.merge(LegacyTestCfg(flags,
282 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"M"],
283 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"M"]))
286 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"M"],
287 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"M"],
288 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
290 if flags.Detector.GeometrysTGC:
291 if not flags.Muon.usePhaseIIGeoSetup:
292 from MuonGeoModelTest.testGeoModel
import GeoModelsTgcTestCfg
as LegacyTestCfg
293 cfg.merge(LegacyTestCfg(flags,
294 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"S"],
295 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"S"]))
298 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"S"],
299 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"S"],
300 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))