2from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
3from AthenaConfiguration.ComponentFactory
import CompFactory
7_baseFilePath =
"root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/data-art/large-input/MuonRecRTT/"
11 EVGEN_PG = [f
"{_baseFilePath}/EVNT/DiMuon_Pt2to2000.EVNT.pool.{i}.root" for i
in [1,2]]
13 EVGEN_GEANTINO = [f
"{_baseFilePath}/EVNT/ChargedGeantino_2p5_250_GeV.pool.root"]
15 HITS_PG_R3 = [ f
"{_baseFilePath}/HITS_PG_R3/{fileName}" for fileName
in [
16 "group.det-muon.53099807.EXT0._000005.HITS.pool.root",
17 "group.det-muon.53099807.EXT0._000014.HITS.pool.root",
18 "group.det-muon.53099807.EXT0._000006.HITS.pool.root",
19 "group.det-muon.53099807.EXT0._000020.HITS.pool.root"]]
21 HITS_PG_R4 = [f
"{_baseFilePath}/HITS_PG_R4/{fileName}" for fileName
in [
22 "group.det-muon.53099475.EXT0._000003.HITS.pool.root",
23 "group.det-muon.53099475.EXT0._000015.HITS.pool.root",
24 "group.det-muon.53099475.EXT0._000009.HITS.pool.root",
25 "group.det-muon.53099475.EXT0._000019.HITS.pool.root"]]
27 DATA_BS = [f
"{_baseFilePath}/DATA_BS/{fileName}" for fileName
in [
28 "data26_13p6TeV.00519268.physics_Main.daq.RAW._lb0178._SFO-11._0001.data",
29 "data26_13p6TeV.00519268.physics_Main.daq.RAW._lb0178._SFO-11._0002.data",
30 "data26_13p6TeV.00519268.physics_Main.daq.RAW._lb0178._SFO-12._0001.data",
31 "data26_13p6TeV.00519268.physics_Main.daq.RAW._lb0178._SFO-12._0002.data",
32 "data26_13p6TeV.00519268.physics_Main.daq.RAW._lb0178._SFO-20._0001.data",
33 "data26_13p6TeV.00519268.physics_Main.daq.RAW._lb0178._SFO-20._0002.data",
36 RDO_R3 = [
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/myRDO.R3.pool.root"]
39 "root://eosatlas.cern.ch:1094//eos/atlas/atlasgroupdisk/det-muon/dq2/rucio/group/det-muon/a0/d0/group.det-muon.52398372.EXT0._000001.RDO.pool.root",
40 "root://eosatlas.cern.ch:1094//eos/atlas/atlasgroupdisk/det-muon/dq2/rucio/group/det-muon/fd/73/group.det-muon.52398372.EXT0._000002.RDO.pool.root",
41 "root://eosatlas.cern.ch:1094//eos/atlas/atlasgroupdisk/det-muon/dq2/rucio/group/det-muon/2d/3d/group.det-muon.52398372.EXT0._000003.RDO.pool.root",
42 "root://eosatlas.cern.ch:1094//eos/atlas/atlasgroupdisk/det-muon/dq2/rucio/group/det-muon/ad/88/group.det-muon.52398372.EXT0._000004.RDO.pool.root",
43 "root://eosatlas.cern.ch:1094//eos/atlas/atlasgroupdisk/det-muon/dq2/rucio/group/det-muon/12/a4/group.det-muon.52398372.EXT0._000005.RDO.pool.root",
44 "root://eosatlas.cern.ch:1094//eos/atlas/atlasgroupdisk/det-muon/dq2/rucio/group/det-muon/ad/91/group.det-muon.52398372.EXT0._000006.RDO.pool.root",
45 "root://eosatlas.cern.ch:1094//eos/atlas/atlasgroupdisk/det-muon/dq2/rucio/group/det-muon/fc/b3/group.det-muon.52398372.EXT0._000007.RDO.pool.root",
46 "root://eosatlas.cern.ch:1094//eos/atlas/atlasgroupdisk/det-muon/dq2/rucio/group/det-muon/23/65/group.det-muon.52398372.EXT0._000008.RDO.pool.root",
47 "root://eosatlas.cern.ch:1094//eos/atlas/atlasgroupdisk/det-muon/dq2/rucio/group/det-muon/4f/9a/group.det-muon.52398372.EXT0._000009.RDO.pool.root",
48 "root://eosatlas.cern.ch:1094//eos/atlas/atlasgroupdisk/det-muon/dq2/rucio/group/det-muon/b1/73/group.det-muon.52398372.EXT0._000010.RDO.pool.root",
49 "root://eosatlas.cern.ch:1094//eos/atlas/atlasgroupdisk/det-muon/dq2/rucio/group/det-muon/52/91/group.det-muon.52398372.EXT0._000011.RDO.pool.root",
50 "root://eosatlas.cern.ch:1094//eos/atlas/atlasgroupdisk/det-muon/dq2/rucio/group/det-muon/3a/55/group.det-muon.52398372.EXT0._000012.RDO.pool.root"
54 "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",
55 "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",
56 "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",
57 "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",
58 "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",
59 "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"
66 GEODB_R3 =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeometryDB/ATLAS-R3S-2021-03-02-00.db"
68 GEODB_R3MSOnly =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeometryDB/ATLAS-R3S-2021-03-02-00_MSOnly.db"
71 GEODB_MTECH =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeometryDB/ATLAS-R3S-2021-03-02-00_MTech.db"
73 GEODB_R4 =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeometryDB/ATLAS-P2-RUN4-01-00-00.db"
75 GEODB_R4MSOnly =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeometryDB/ATLAS-P2-RUN4-01-00-00_MSOnly.db"
77 GEODB_ITk_R3MS =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeometryDB/ATLAS-P2-RUN4-01-00-00_R3MS.db"
79 GEODB_TOROID =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/GeometryDB/MUON_TOROID.db"
82 TRKGEO_MATERIALMAP =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonGeomRTT/material-maps.root"
85 from argparse
import ArgumentParser
87 parser = ArgumentParser()
88 parser.add_argument(
"--threads", type=int, help=
"number of threads", default=1)
89 parser.add_argument(
"--inputFile",
"-i", default= MuonPhaseIITestDefaults.EVGEN_PG,
90 help=
"Input file to run on ", nargs=
"+")
91 parser.add_argument(
"--geoModelFile", default = MuonPhaseIITestDefaults.GEODB_R3, help=
"GeoModel SqLite file containing the muon geometry.")
92 parser.add_argument(
"--defaultGeoFile", help=
"Use the predefined GeoModel files on cvmfs", choices=[
"NONE",
"RUN3",
"RUN4",
93 "RUN3MSOnly",
"RUN4MSOnly",
94 "ITkR3MS" ], default=
"NONE")
95 parser.add_argument(
"--chambers", default=[
"all"], nargs=
"+", help=
"Chambers to check. If string is all, all chambers will be checked")
96 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.")
97 parser.add_argument(
"--outRootFile", default=
"NewGeoModelDump.root", help=
"Output ROOT file to dump the geomerty")
98 parser.add_argument(
"--nEvents", help=
"Number of events to run", type = int ,default = 1)
99 parser.add_argument(
"--skipEvents", help=
"Number of events to skip", type = int, default = 0)
100 parser.add_argument(
"--noMdt", help=
"Disable the Mdts from the geometry", action=
'store_true', default =
False)
101 parser.add_argument(
"--noRpc", help=
"Disable the Rpcs from the geometry", action=
'store_true', default =
False)
102 parser.add_argument(
"--noTgc", help=
"Disable the Tgcs from the geometry", action=
'store_true', default =
False)
103 parser.add_argument(
"--noMM", help=
"Disable the MMs from the geometry", action=
'store_true', default =
False)
104 parser.add_argument(
"--noSTGC", help=
"Disable the sTgcs from the geometry", action=
'store_true', default =
False)
105 parser.add_argument(
"--eventPrintoutLevel", type=int, help=
"Interval of event heartbeat printouts from the loop manager", default = 1)
106 parser.add_argument(
"--localMdtMezzJSON", default=
"", help=
"")
107 parser.add_argument(
"--localMdtCablingJSON", default=
"", help=
"")
108 parser.add_argument(
"--passiveMaterialMaps", default =
"", help=
"Root file with the material maps on the surfaces")
109 parser.add_argument(
"--noPlots", help=
"Disable the pdf dumps of the geo tester", action=
'store_true', default =
False)
113 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
114 result = MainServicesCfg(flags)
116 from AthenaConfiguration.Enums
import Format
117 if flags.Input.Format
is Format.POOL:
118 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
119 result.merge(PoolReadCfg(flags))
120 elif flags.Input.Format == Format.BS:
121 from ByteStreamCnvSvc.ByteStreamConfig
import ByteStreamReadCfg
122 result.merge(ByteStreamReadCfg(flags))
124 from PerfMonComps.PerfMonCompsConfig
import PerfMonMTSvcCfg
125 result.merge(PerfMonMTSvcCfg(flags))
126 from MuonConfig.MuonGeometryConfig
import MuonIdHelperSvcCfg
127 result.merge(MuonIdHelperSvcCfg(flags))
130def GeoModelMdtTestCfg(flags, name = "GeoModelMdtTest", localMezzanineJSON="", localCablingJSON="", doPlots=True,**kwargs):
131 result = ComponentAccumulator()
132 from MuonConfig.MuonCablingConfig
import MDTCablingConfigCfg
133 result.merge(MDTCablingConfigCfg(flags,MezzanineJSON=localMezzanineJSON, CablingJSON=localCablingJSON))
135 kwargs[
"visualizeTubes"] =
False
136 kwargs[
"visualizeStaggering"] =
False
137 the_alg = CompFactory.MuonGMR4.GeoModelMdtTest(name, **kwargs)
138 result.addEventAlgo(the_alg, primary =
True)
142 result = ComponentAccumulator()
144 kwargs[
"visualizePlanes"] =
False
145 the_alg = CompFactory.MuonGMR4.GeoModelRpcTest(name, **kwargs)
146 result.addEventAlgo(the_alg, primary =
True)
150 result = ComponentAccumulator()
151 the_alg = CompFactory.MuonGMR4.GeoModelTgcTest(name, **kwargs)
152 result.addEventAlgo(the_alg, primary =
True)
156 result = ComponentAccumulator()
157 the_alg = CompFactory.MuonGMR4.GeoModelsTgcTest(name, **kwargs)
158 result.addEventAlgo(the_alg, primary =
True)
162 result = ComponentAccumulator()
163 the_alg = CompFactory.MuonGMR4.GeoModelMmTest(name, **kwargs)
164 result.addEventAlgo(the_alg, primary =
True)
168 result = ComponentAccumulator()
169 kwargs.setdefault(
"TestActsSurface",
True)
170 kwargs.setdefault(
"plotTgc", flags.Detector.GeometryTGC)
171 kwargs.setdefault(
"plotStgc", flags.Detector.GeometrysTGC)
172 kwargs.setdefault(
"plotMm", flags.Detector.GeometryMM)
174 the_alg = CompFactory.MuonGMR4.NswGeoPlottingAlg(name, **kwargs)
175 result.addEventAlgo(the_alg, primary =
True)
181 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
182 flags = initConfigFlags()
183 flags.Concurrency.NumThreads = args.threads
184 flags.Concurrency.NumConcurrentEvents = args.threads
185 flags.Exec.MaxEvents = args.nEvents
186 flags.Exec.SkipEvents = args.skipEvents
190 from MuonConfig.MuonConfigUtils
import prepareInput
194 flags.Exec.EventPrintoutInterval = 500
195 flags.Common.MsgSuppression=
False
197 if args.defaultGeoFile ==
"RUN3":
198 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R3
199 elif args.defaultGeoFile ==
"RUN4":
200 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R4
201 elif args.defaultGeoFile ==
"RUN3MSOnly":
202 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R3MSOnly
203 elif args.defaultGeoFile ==
"RUN4MSOnly":
204 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_R4MSOnly
205 elif args.defaultGeoFile ==
"ITkR3MS":
206 flags.GeoModel.SQLiteDBFullPath = MuonPhaseIITestDefaults.GEODB_ITk_R3MS
207 elif args.geoModelFile.startswith(
"root://"):
208 from os
import system, path
209 if not path.exists(
"Geometry/{geoTag}.db".format(geoTag=args.geoTag)):
210 print (
"Copy geometry file from EOS {source}".format(source = args.geoModelFile))
211 system(
"mkdir Geometry/")
212 system(
"xrdcp {source} Geometry/{geoTag}.db".format(source = args.geoModelFile,
215 args.geoModelFile =
"Geometry/{geoTag}.db".format(geoTag=args.geoTag)
217 flags.GeoModel.SQLiteDBFullPath = args.geoModelFile
219 flags.GeoModel.SQLiteDB =
True
220 from MuonConfig.MuonConfigUtils
import configureDefaultTags
221 configureDefaultTags(flags)
223 if args.passiveMaterialMaps:
224 flags.Muon.trackGeometryMaterialMap = args.passiveMaterialMaps
226 flags.Detector.GeometryBpipe =
False
228 flags.Detector.GeometryBCM =
False
229 flags.Detector.GeometryPixel =
False
230 flags.Detector.GeometrySCT =
False
231 flags.Detector.GeometryTRT =
False
233 flags.Detector.GeometryPLR =
False
234 flags.Detector.GeometryBCMPrime =
False
235 flags.Detector.GeometryITkPixel =
False
236 flags.Detector.GeometryITkStrip =
False
238 flags.Detector.GeometryHGTD =
False
240 flags.Detector.GeometryLAr =
False
241 flags.Detector.GeometryTile =
False
242 flags.Detector.GeometryMBTS =
False
243 flags.Detector.GeometryCalo =
False
245 flags.Detector.GeometryCSC =
False
247 flags.Detector.GeometrysTGC =
False
249 flags.Detector.GeometryMM =
False
251 flags.Detector.GeometryTGC =
False
253 flags.Detector.GeometryRPC =
False
255 flags.Detector.GeometryMDT =
False
258 flags.Acts.TrackingGeometry.UseBlueprint =
True
259 flags.Acts.TrackingGeometry.FrustumNav =
True
260 except AttributeError:
pass
261 flags.Scheduler.CheckDependencies =
True
262 flags.Scheduler.ShowDataDeps =
True
263 flags.Scheduler.ShowDataFlow =
True
264 flags.Scheduler.ShowControlFlow =
True
265 flags.Scheduler.EnableVerboseViews =
True
266 flags.Scheduler.AutoLoadUnmetDependencies =
True
269 flags.dump(evaluate =
True)
272 from MuonConfig.MuonGeometryConfig
import MuonGeoModelCfg
273 cfg.merge(MuonGeoModelCfg(flags))
275 if not flags.Muon.usePhaseIIGeoSetup:
276 print (
"WARNING: New Muon plugin is not part of the Geometry file {geoDBFile}".format(geoDBFile=args.geoModelFile))
278 from ActsAlignmentAlgs.AlignmentAlgsConfig
import ActsGeometryContextAlgCfg
279 cfg.merge(ActsGeometryContextAlgCfg(flags))
284if __name__==
"__main__":
287 from MuonConfig.MuonConfigUtils
import setupHistSvcCfg
288 cfg.merge(setupHistSvcCfg(flags, outFile = args.outRootFile, outStream=
"GEOMODELTESTER"))
289 chambToTest = args.chambers
if len([x
for x
in args.chambers
if x ==
"all"]) ==0
else []
290 chambToExclude = args.excludedChambers
293 if flags.Muon.usePhaseIIGeoSetup:
294 cfg.getCondAlgo(
"MuonDetectorCondAlg").checkGeo =
True
295 cfg.getCondAlgo(
"MuonDetectorCondAlg").dumpGeo =
True
296 from TrackingGeometryCondAlg.AtlasTrackingGeometryCondAlgConfig
import TrackingGeometryCondAlgCfg
297 cfg.merge(TrackingGeometryCondAlgCfg(flags))
300 cfg.getService(
"MessageSvc").setVerbose = []
302 if flags.Detector.GeometryMDT:
303 if not flags.Muon.usePhaseIIGeoSetup:
304 from MuonGeoModelTest.testGeoModel
import GeoModelMdtTestCfg
as LegacyTestCfg
305 cfg.merge(LegacyTestCfg(flags,
306 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B" or ch[0] ==
"E"],
307 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B" or ch[0] ==
"E"]))
310 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B" or ch[0] ==
"E"],
311 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B" or ch[0] ==
"E"],
312 localMezzanineJSON=args.localMdtMezzJSON,
313 localCablingJSON=args.localMdtCablingJSON,
314 ReadoutSideXML=
"ReadoutSides.xml",
315 doPlots=
not args.noPlots,
316 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
318 if flags.Detector.GeometryRPC:
319 if not flags.Muon.usePhaseIIGeoSetup:
320 from MuonGeoModelTest.testGeoModel
import GeoModelRpcTestCfg
as LegacyTestCfg
321 cfg.merge(LegacyTestCfg(flags,
322 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B"],
323 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B"]))
326 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"B"],
327 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"B"],
328 doPlots=
not args.noPlots,
329 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
331 if flags.Detector.GeometryTGC:
332 if not flags.Muon.usePhaseIIGeoSetup:
333 from MuonGeoModelTest.testGeoModel
import GeoModelTgcTestCfg
as LegacyTestCfg
334 cfg.merge(LegacyTestCfg(flags,
335 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"T"],
336 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"T"]))
339 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"T"],
340 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"T"],
341 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
343 if flags.Detector.GeometryMM:
344 if not flags.Muon.usePhaseIIGeoSetup:
345 from MuonGeoModelTest.testGeoModel
import GeoModelMmTestCfg
as LegacyTestCfg
346 cfg.merge(LegacyTestCfg(flags,
347 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"M"],
348 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"M"]))
351 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"M"],
352 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"M"],
353 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
355 if flags.Detector.GeometrysTGC:
356 if not flags.Muon.usePhaseIIGeoSetup:
357 from MuonGeoModelTest.testGeoModel
import GeoModelsTgcTestCfg
as LegacyTestCfg
358 cfg.merge(LegacyTestCfg(flags,
359 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"S"],
360 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"S"]))
363 TestStations = [ch
for ch
in chambToTest
if ch[0] ==
"S"],
364 ExcludeStations = [ch
for ch
in chambToExclude
if ch[0] ==
"S"],
365 ExtraInputs=[(
'MuonGM::MuonDetectorManager' ,
'ConditionStore+MuonDetectorManager' )]))
366 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)