ATLAS Offline Software
Loading...
Searching...
No Matches
MdtCablingTester.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2
4 from argparse import ArgumentParser
5 from AthenaConfiguration.TestDefaults import defaultGeometryTags
6 parser = ArgumentParser()
7 parser.add_argument("-t", "--threads", dest="threads", type=int, help="number of threads", default=1)
8 parser.add_argument("-o", "--output", dest="output", default='', help="Text file containing each cabling channel", metavar="FILE")
9 parser.add_argument("--inputFile", "-i", default=[],
10 help="Input file to run on ", nargs="+")
11 parser.add_argument("--geoTag", default=defaultGeometryTags.RUN2, help="Geometry tag to use", choices=[defaultGeometryTags.RUN2_BEST_KNOWLEDGE ,
12 defaultGeometryTags.RUN3])
13 parser.add_argument("--mezzMap", default="", help="External JSON file containing the internal mapping of the mezzanine cards")
14 parser.add_argument("--cablingMap", default="", help="External JSON file containing the cabling map of each channel")
15 return parser
16
18 name = "MdtCablingTestAlg",
19 mezzJSON = "",
20 cablingJSON = "",
21 dumpFile="",
22 ):
23
24 from MuonConfig.MuonCablingConfig import MDTCablingConfigCfg
25 from MuonConfig.MuonCondAlgConfig import MdtCondDbAlgCfg
26 from AthenaConfiguration.ComponentFactory import CompFactory
27 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
28 result = ComponentAccumulator()
29 result.merge(MdtCondDbAlgCfg(flags))
30 result.merge(MDTCablingConfigCfg(flags, MezzanineJSON=mezzJSON, CablingJSON=cablingJSON))
31 event_algo = CompFactory.MdtCablingTestAlg(name, DumpMap=dumpFile)
32 result.addEventAlgo(event_algo, primary = True)
33 return result
34
35if __name__ == "__main__":
36 from AthenaConfiguration.AllConfigFlags import initConfigFlags
37 from MuonConfig.MuonConfigUtils import executeTest, SetupMuonStandaloneCA, configureCondTag
38
39 args = SetupArgParser().parse_args()
40
41 flags = initConfigFlags()
42 flags.Concurrency.NumThreads = 1
43 flags.Exec.MaxEvents = 1
44 flags.Concurrency.NumConcurrentEvents = 1
45 flags.Output.ESDFileName = args.output
46
47 flags.Input.Files = args.inputFile
48 if not flags.GeoModel.AtlasVersion:
49 flags.GeoModel.AtlasVersion = args.geoTag
50
51 configureCondTag(flags)
52
53
54
55 flags.lock()
56 flags.dump()
57
58
59
60 cfg = SetupMuonStandaloneCA(flags)
61 cfg.merge(MdtCablingTestAlgCfg(flags,
62 mezzJSON=args.mezzMap,
63 cablingJSON=args.cablingMap,
64 dumpFile=args.output))
65 executeTest(cfg)
66
MdtCablingTestAlgCfg(flags, name="MdtCablingTestAlg", mezzJSON="", cablingJSON="", dumpFile="")