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 DATA_BS = [f
"root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/data-art/large-input/MuonRecRTT/{fileName}" for fileName
in [
21 "data26_13p6TeV.00519268.physics_Main.daq.RAW._lb0178._SFO-11._0001.data",
22 "data26_13p6TeV.00519268.physics_Main.daq.RAW._lb0178._SFO-11._0002.data",
23 "data26_13p6TeV.00519268.physics_Main.daq.RAW._lb0178._SFO-12._0001.data",
24 "data26_13p6TeV.00519268.physics_Main.daq.RAW._lb0178._SFO-12._0002.data",
25 "data26_13p6TeV.00519268.physics_Main.daq.RAW._lb0178._SFO-20._0001.data",
26 "data26_13p6TeV.00519268.physics_Main.daq.RAW._lb0178._SFO-20._0002.data",
29 RDO_R3 = [
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/myRDO.R3.pool.root"]
32 "root://eosatlas.cern.ch:1094//eos/atlas/atlaslocalgroupdisk/dq2/rucio/group/det-muon/8b/de/group.det-muon.48959425.EXT0._000002.RDO.pool.root",
33 "root://eosatlas.cern.ch:1094//eos/atlas/atlaslocalgroupdisk/dq2/rucio/group/det-muon/4f/ed/group.det-muon.48959425.EXT0._000007.RDO.pool.root",
34 "root://eosatlas.cern.ch:1094//eos/atlas/atlaslocalgroupdisk/dq2/rucio/group/det-muon/3d/10/group.det-muon.48959425.EXT0._000009.RDO.pool.root",
35 "root://eosatlas.cern.ch:1094//eos/atlas/atlaslocalgroupdisk/dq2/rucio/group/det-muon/28/62/group.det-muon.48959425.EXT0._000010.RDO.pool.root",
36 "root://eosatlas.cern.ch:1094//eos/atlas/atlaslocalgroupdisk/dq2/rucio/group/det-muon/5e/26/group.det-muon.48959425.EXT0._000011.RDO.pool.root",
37 "root://eosatlas.cern.ch:1094//eos/atlas/atlaslocalgroupdisk/dq2/rucio/group/det-muon/af/cd/group.det-muon.48959425.EXT0._000012.RDO.pool.root",
38 "root://eosatlas.cern.ch:1094//eos/atlas/atlaslocalgroupdisk/dq2/rucio/group/det-muon/88/76/group.det-muon.48959425.EXT0._000015.RDO.pool.root",
39 "root://eosatlas.cern.ch:1094//eos/atlas/atlaslocalgroupdisk/dq2/rucio/group/det-muon/54/fe/group.det-muon.48959425.EXT0._000016.RDO.pool.root",
40 "root://eosatlas.cern.ch:1094//eos/atlas/atlaslocalgroupdisk/dq2/rucio/group/det-muon/4e/b4/group.det-muon.48959425.EXT0._000017.RDO.pool.root",
41 "root://eosatlas.cern.ch:1094//eos/atlas/atlaslocalgroupdisk/dq2/rucio/group/det-muon/e3/d4/group.det-muon.48959425.EXT0._000022.RDO.pool.root",
42 "root://eosatlas.cern.ch:1094//eos/atlas/atlaslocalgroupdisk/dq2/rucio/group/det-muon/ee/b4/group.det-muon.48959425.EXT0._000023.RDO.pool.root",
43 "root://eosatlas.cern.ch:1094//eos/atlas/atlaslocalgroupdisk/dq2/rucio/group/det-muon/75/c9/group.det-muon.48959425.EXT0._000027.RDO.pool.root",
47 "root://eosatlas.cern.ch:1094//eos/atlas/atlasgroupdisk/det-muon/dq2/rucio/group/det-muon/d7/62/group.det-muon.49358671.EXT0._000001.RDO.pool.root",
48 "root://eosatlas.cern.ch:1094//eos/atlas/atlasgroupdisk/det-muon/dq2/rucio/group/det-muon/e7/ea/group.det-muon.49358671.EXT0._000002.RDO.pool.root",
49 "root://eosatlas.cern.ch:1094//eos/atlas/atlasgroupdisk/det-muon/dq2/rucio/group/det-muon/5a/98/group.det-muon.49358671.EXT0._000003.RDO.pool.root",
50 "root://eosatlas.cern.ch:1094//eos/atlas/atlasgroupdisk/det-muon/dq2/rucio/group/det-muon/95/f7/group.det-muon.49358671.EXT0._000004.RDO.pool.root",
51 "root://eosatlas.cern.ch:1094//eos/atlas/atlasgroupdisk/det-muon/dq2/rucio/group/det-muon/44/f3/group.det-muon.49358671.EXT0._000005.RDO.pool.root",
52 "root://eosatlas.cern.ch:1094//eos/atlas/atlasgroupdisk/det-muon/dq2/rucio/group/det-muon/56/a6/group.det-muon.49358671.EXT0._000006.RDO.pool.root"
59 GEODB_R3 =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-R3S-2021-03-02-00.db"
61 GEODB_R3MSOnly =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-R3S-2021-03-02-00_MSOnly.db"
64 GEODB_MTECH =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-R3S-2021-03-02-00_MTech.db"
66 GEODB_R4 =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-P2-RUN4-01-00-00.db"
68 GEODB_R4MSOnly =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-P2-RUN4-01-00-00_MSOnly.db"
70 GEODB_ITk_R3MS =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/ATLAS-P2-RUN4-01-00-00_R3MS.db"
72 GEODB_TOROID =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeoDB/MUON_TOROID.db"
75 TRKGEO_MATERIALMAP =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/material-maps.root"
78 from argparse
import ArgumentParser
80 parser = ArgumentParser()
81 parser.add_argument(
"--threads", type=int, help=
"number of threads", default=1)
82 parser.add_argument(
"--inputFile",
"-i", default= MuonPhaseIITestDefaults.EVGEN_PG,
83 help=
"Input file to run on ", nargs=
"+")
84 parser.add_argument(
"--geoModelFile", default = MuonPhaseIITestDefaults.GEODB_R3, help=
"GeoModel SqLite file containing the muon geometry.")
85 parser.add_argument(
"--defaultGeoFile", help=
"Use the predefined GeoModel files on cvmfs", choices=[
"NONE",
"RUN3",
"RUN4",
86 "RUN3MSOnly",
"RUN4MSOnly",
87 "ITkR3MS" ], default=
"NONE")
88 parser.add_argument(
"--chambers", default=[
"all"], nargs=
"+", help=
"Chambers to check. If string is all, all chambers will be checked")
89 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.")
90 parser.add_argument(
"--outRootFile", default=
"NewGeoModelDump.root", help=
"Output ROOT file to dump the geomerty")
91 parser.add_argument(
"--nEvents", help=
"Number of events to run", type = int ,default = 1)
92 parser.add_argument(
"--skipEvents", help=
"Number of events to skip", type = int, default = 0)
93 parser.add_argument(
"--noMdt", help=
"Disable the Mdts from the geometry", action=
'store_true', default =
False)
94 parser.add_argument(
"--noRpc", help=
"Disable the Rpcs from the geometry", action=
'store_true', default =
False)
95 parser.add_argument(
"--noTgc", help=
"Disable the Tgcs from the geometry", action=
'store_true', default =
False)
96 parser.add_argument(
"--noMM", help=
"Disable the MMs from the geometry", action=
'store_true', default =
False)
97 parser.add_argument(
"--noSTGC", help=
"Disable the sTgcs from the geometry", action=
'store_true', default =
False)
98 parser.add_argument(
"--eventPrintoutLevel", type=int, help=
"Interval of event heartbeat printouts from the loop manager", default = 1)
99 parser.add_argument(
"--localMdtMezzJSON", default=
"", help=
"")
100 parser.add_argument(
"--localMdtCablingJSON", default=
"", help=
"")
101 parser.add_argument(
"--passiveMaterialMaps", default =
"", help=
"Root file with the material maps on the surfaces")
102 parser.add_argument(
"--noPlots", help=
"Disable the pdf dumps of the geo tester", action=
'store_true', default =
False)
106 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
107 result = MainServicesCfg(flags)
109 from AthenaConfiguration.Enums
import Format
110 if flags.Input.Format
is Format.POOL:
111 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
112 result.merge(PoolReadCfg(flags))
113 elif flags.Input.Format == Format.BS:
114 from ByteStreamCnvSvc.ByteStreamConfig
import ByteStreamReadCfg
115 result.merge(ByteStreamReadCfg(flags))
117 from PerfMonComps.PerfMonCompsConfig
import PerfMonMTSvcCfg
118 result.merge(PerfMonMTSvcCfg(flags))
119 from MuonConfig.MuonGeometryConfig
import MuonIdHelperSvcCfg
120 result.merge(MuonIdHelperSvcCfg(flags))
123def GeoModelMdtTestCfg(flags, name = "GeoModelMdtTest", localMezzanineJSON="", localCablingJSON="", doPlots=True,**kwargs):
124 result = ComponentAccumulator()
125 from MuonConfig.MuonCablingConfig
import MDTCablingConfigCfg
126 result.merge(MDTCablingConfigCfg(flags,MezzanineJSON=localMezzanineJSON, CablingJSON=localCablingJSON))
128 kwargs[
"visualizeTubes"] =
False
129 kwargs[
"visualizeStaggering"] =
False
130 the_alg = CompFactory.MuonGMR4.GeoModelMdtTest(name, **kwargs)
131 result.addEventAlgo(the_alg, primary =
True)
135 result = ComponentAccumulator()
137 kwargs[
"visualizePlanes"] =
False
138 the_alg = CompFactory.MuonGMR4.GeoModelRpcTest(name, **kwargs)
139 result.addEventAlgo(the_alg, primary =
True)
143 result = ComponentAccumulator()
144 the_alg = CompFactory.MuonGMR4.GeoModelTgcTest(name, **kwargs)
145 result.addEventAlgo(the_alg, primary =
True)
149 result = ComponentAccumulator()
150 the_alg = CompFactory.MuonGMR4.GeoModelsTgcTest(name, **kwargs)
151 result.addEventAlgo(the_alg, primary =
True)
155 result = ComponentAccumulator()
156 the_alg = CompFactory.MuonGMR4.GeoModelMmTest(name, **kwargs)
157 result.addEventAlgo(the_alg, primary =
True)
161 result = ComponentAccumulator()
162 kwargs.setdefault(
"TestActsSurface",
True)
163 kwargs.setdefault(
"plotTgc", flags.Detector.GeometryTGC)
164 kwargs.setdefault(
"plotStgc", flags.Detector.GeometrysTGC)
165 kwargs.setdefault(
"plotMm", flags.Detector.GeometryMM)
167 the_alg = CompFactory.MuonGMR4.NswGeoPlottingAlg(name, **kwargs)
168 result.addEventAlgo(the_alg, primary =
True)
177 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
178 flags = initConfigFlags()
179 flags.Concurrency.NumThreads = args.threads
180 flags.Concurrency.NumConcurrentEvents = args.threads
181 flags.Exec.MaxEvents = args.nEvents
182 flags.Exec.SkipEvents = args.skipEvents
186 from MuonConfig.MuonConfigUtils
import prepareInput
190 flags.Exec.EventPrintoutInterval = 500
192 if args.defaultGeoFile ==
"RUN3":
193 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R3
194 elif args.defaultGeoFile ==
"RUN4":
195 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R4
196 elif args.defaultGeoFile ==
"RUN3MSOnly":
197 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R3MSOnly
198 elif args.defaultGeoFile ==
"RUN4MSOnly":
199 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R4MSOnly
200 elif args.defaultGeoFile ==
"ITkR3MS":
201 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_ITk_R3MS
202 elif args.geoModelFile.startswith(
"root://"):
203 from os
import system, path
204 if not path.exists(
"Geometry/{geoTag}.db".format(geoTag=args.geoTag)):
205 print (
"Copy geometry file from EOS {source}".format(source = args.geoModelFile))
206 system(
"mkdir Geometry/")
207 system(
"xrdcp {source} Geometry/{geoTag}.db".format(source = args.geoModelFile,
210 args.geoModelFile =
"Geometry/{geoTag}.db".format(geoTag=args.geoTag)
212 flags.GeoModel.SQLiteDBFullPath = args.geoModelFile
214 flags.GeoModel.SQLiteDB =
True
215 from MuonConfig.MuonConfigUtils
import configureDefaultTags
216 configureDefaultTags(flags)
218 if args.passiveMaterialMaps:
219 flags.Muon.trackGeometryMaterialMap = args.passiveMaterialMaps
221 flags.Detector.GeometryBpipe =
False
223 flags.Detector.GeometryBCM =
False
224 flags.Detector.GeometryPixel =
False
225 flags.Detector.GeometrySCT =
False
226 flags.Detector.GeometryTRT =
False
228 flags.Detector.GeometryPLR =
False
229 flags.Detector.GeometryBCMPrime =
False
230 flags.Detector.GeometryITkPixel =
False
231 flags.Detector.GeometryITkStrip =
False
233 flags.Detector.GeometryHGTD =
False
235 flags.Detector.GeometryLAr =
False
236 flags.Detector.GeometryTile =
False
237 flags.Detector.GeometryMBTS =
False
238 flags.Detector.GeometryCalo =
False
240 flags.Detector.GeometryCSC =
False
242 flags.Detector.GeometrysTGC =
False
244 flags.Detector.GeometryMM =
False
246 flags.Detector.GeometryTGC =
False
248 flags.Detector.GeometryRPC =
False
250 flags.Detector.GeometryMDT =
False
253 flags.Acts.TrackingGeometry.UseBlueprint =
True
254 except AttributeError:
pass
255 flags.Scheduler.CheckDependencies =
True
256 flags.Scheduler.ShowDataDeps =
True
257 flags.Scheduler.ShowDataFlow =
True
258 flags.Scheduler.ShowControlFlow =
True
259 flags.Scheduler.EnableVerboseViews =
True
260 flags.Scheduler.AutoLoadUnmetDependencies =
True
263 flags.dump(evaluate =
True)
266 from MuonConfig.MuonGeometryConfig
import MuonGeoModelCfg
267 cfg.merge(MuonGeoModelCfg(flags))
269 if not flags.Muon.usePhaseIIGeoSetup:
270 print (
"WARNING: New Muon plugin is not part of the Geometry file {geoDBFile}".format(geoDBFile=args.geoModelFile))
272 from ActsAlignmentAlgs.AlignmentAlgsConfig
import ActsGeometryContextAlgCfg
273 cfg.merge(ActsGeometryContextAlgCfg(flags))
275 cfg.getService(
"MessageSvc").verboseLimit = 10000000
276 cfg.getService(
"MessageSvc").debugLimit = 10000000
277 cfg.getService(
"MessageSvc").errorLimit = 10000000
282if __name__==
"__main__":
285 from MuonConfig.MuonConfigUtils
import setupHistSvcCfg
286 cfg.merge(setupHistSvcCfg(flags, outFile = args.outRootFile, outStream=
"GEOMODELTESTER"))
287 chambToTest = args.chambers
if len([x
for x
in args.chambers
if x ==
"all"]) ==0
else []
288 chambToExclude = args.excludedChambers
291 if flags.Muon.usePhaseIIGeoSetup:
292 cfg.getCondAlgo(
"MuonDetectorCondAlg").checkGeo =
True
293 cfg.getCondAlgo(
"MuonDetectorCondAlg").dumpGeo =
True
294 from TrackingGeometryCondAlg.AtlasTrackingGeometryCondAlgConfig
import TrackingGeometryCondAlgCfg
295 cfg.merge(TrackingGeometryCondAlgCfg(flags))
298 cfg.getService(
"MessageSvc").setVerbose = []
300 if flags.Detector.GeometryMDT:
301 if not flags.Muon.usePhaseIIGeoSetup:
302 from MuonGeoModelTest.testGeoModel
import GeoModelMdtTestCfg
as LegacyTestCfg
303 cfg.merge(LegacyTestCfg(flags,
304 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B" or ch[0] ==
"E"],
305 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B" or ch[0] ==
"E"]))
308 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B" or ch[0] ==
"E"],
309 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B" or ch[0] ==
"E"],
310 localMezzanineJSON=args.localMdtMezzJSON,
311 localCablingJSON=args.localMdtCablingJSON,
312 ReadoutSideXML=
"ReadoutSides.xml",
313 doPlots=
not args.noPlots,
314 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
316 if flags.Detector.GeometryRPC:
317 if not flags.Muon.usePhaseIIGeoSetup:
318 from MuonGeoModelTest.testGeoModel
import GeoModelRpcTestCfg
as LegacyTestCfg
319 cfg.merge(LegacyTestCfg(flags,
320 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B"],
321 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B"]))
324 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B"],
325 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B"],
326 doPlots=
not args.noPlots,
327 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
329 if flags.Detector.GeometryTGC:
330 if not flags.Muon.usePhaseIIGeoSetup:
331 from MuonGeoModelTest.testGeoModel
import GeoModelTgcTestCfg
as LegacyTestCfg
332 cfg.merge(LegacyTestCfg(flags,
333 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"T"],
334 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"T"]))
337 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"T"],
338 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"T"],
339 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
341 if flags.Detector.GeometryMM:
342 if not flags.Muon.usePhaseIIGeoSetup:
343 from MuonGeoModelTest.testGeoModel
import GeoModelMmTestCfg
as LegacyTestCfg
344 cfg.merge(LegacyTestCfg(flags,
345 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"M"],
346 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"M"]))
349 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"M"],
350 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"M"],
351 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
353 if flags.Detector.GeometrysTGC:
354 if not flags.Muon.usePhaseIIGeoSetup:
355 from MuonGeoModelTest.testGeoModel
import GeoModelsTgcTestCfg
as LegacyTestCfg
356 cfg.merge(LegacyTestCfg(flags,
357 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"S"],
358 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"S"]))
361 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"S"],
362 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"S"],
363 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
364 from MuonConfig.MuonConfigUtils
import executeTest
bool prepareInput(const std::string &name, const std::vector< int64_t > &shape, const std::vector< T > &data, std::vector< std::shared_ptr< tc::InferInput > > &inputs)
NswGeoPlottingAlgCfg(flags, name="NswGeoPlotting", **kwargs)
setupGeoR4TestCfg(args, flags=None)
GeoModelTgcTestCfg(flags, name="GeoModelTgcTest", **kwargs)
GeoModelRpcTestCfg(flags, name="GeoModelRpcTest", **kwargs)
GeoModelsTgcTestCfg(flags, name="GeoModelsTgcTest", **kwargs)
GeoModelMmTestCfg(flags, name="GeoModelMmTest", **kwargs)
GeoModelMdtTestCfg(flags, name="GeoModelMdtTest", **kwargs)