ATLAS Offline Software
MdtCablingTester.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
4  from argparse import ArgumentParser
5 
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=["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/data17_13TeV.00330470.physics_Main.daq.RAW._lb0310._SFO-1._0001.data"],
10  help="Input file to run on ", nargs="+")
11  parser.add_argument("--geometry", default="ATLAS-R2-2016-01-00-01", help="Geometry tag")
12  parser.add_argument("--conditionsTag", default="CONDBR2-BLKPA-RUN2-11", help="conditionsTag")
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 
17 def setupServicesCfg(flags):
18  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
19  result = MainServicesCfg(flags)
20 
21  from AthenaConfiguration.Enums import Format
22  if flags.Input.Format == Format.POOL:
23  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
24  result.merge(PoolReadCfg(flags))
25  elif flags.Input.Format == Format.BS:
26  from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg
27  result.merge(ByteStreamReadCfg(flags))
28 
29  from MuonConfig.MuonGeometryConfig import MuonGeoModelCfg
30  result.merge(MuonGeoModelCfg(flags))
31  from MuonConfig.MuonGeometryConfig import MuonIdHelperSvcCfg
32  result.merge(MuonIdHelperSvcCfg(flags))
33  return result
34 
36  name = "MdtCablingTestAlg",
37  mezzJSON = "",
38  cablingJSON = "",
39  dumpFile="",
40  ):
41  from AthenaConfiguration.ComponentFactory import CompFactory
42  result = setupServicesCfg(flags)
43  from MuonConfig.MuonCablingConfig import MDTCablingConfigCfg
44  from MuonConfig.MuonCondAlgConfig import MdtCondDbAlgCfg
45  result.merge(MdtCondDbAlgCfg(flags))
46  result.merge(MDTCablingConfigCfg(flags, MezzanineJSON=mezzJSON, CablingJSON=cablingJSON))
47  event_algo = CompFactory.MdtCablingTestAlg(name, DumpMap=dumpFile)
48  result.addEventAlgo(event_algo, primary = True)
49  return result
50 
51 if __name__ == "__main__":
52  from AthenaConfiguration.AllConfigFlags import initConfigFlags
54 
55  flags = initConfigFlags()
56  flags.Concurrency.NumThreads = args.threads
57  flags.Concurrency.NumConcurrentEvents = args.threads # Might change this later, but good enough for the moment.
58  flags.Output.ESDFileName = args.output
59  flags.Input.Files = args.inputFile
60  flags.GeoModel.AtlasVersion = args.geometry
61  if not flags.Input.isMC:
62  flags.IOVDb.GlobalTag = args.conditionsTag
63  flags.lock()
64 
65  cfg = MdtCablingTestAlgCfg(flags,
66  mezzJSON=args.mezzMap,
67  cablingJSON=args.cablingMap,
68  dumpFile=args.output)
69  cfg.printConfig(withDetails=True, summariseProps=True)
70  flags.dump()
71 
72  sc = cfg.run(1)
73  if not sc.isSuccess():
74  import sys
75  sys.exit("Execution failed")
76 
77 
python.MdtCablingTester.setupServicesCfg
def setupServicesCfg(flags)
Definition: MdtCablingTester.py:17
python.MdtCablingTester.MdtCablingTestAlgCfg
def MdtCablingTestAlgCfg(flags, name="MdtCablingTestAlg", mezzJSON="", cablingJSON="", dumpFile="")
Definition: MdtCablingTester.py:35
python.MdtCablingTester.SetupArgParser
def SetupArgParser()
Definition: MdtCablingTester.py:3
python.ByteStreamConfig.ByteStreamReadCfg
def ByteStreamReadCfg(flags, type_names=None)
Definition: Event/ByteStreamCnvSvc/python/ByteStreamConfig.py:25
python.MuonCondAlgConfig.MdtCondDbAlgCfg
def MdtCondDbAlgCfg(flags, **kwargs)
Definition: MuonCondAlgConfig.py:13
python.MuonCablingConfig.MDTCablingConfigCfg
def MDTCablingConfigCfg(flags, name="MuonMDT_CablingAlg", **kwargs)
Definition: MuonCablingConfig.py:91
python.MuonGeometryConfig.MuonIdHelperSvcCfg
def MuonIdHelperSvcCfg(flags)
Definition: MuonGeometryConfig.py:15
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:252
python.MuonGeometryConfig.MuonGeoModelCfg
def MuonGeoModelCfg(flags)
Definition: MuonGeometryConfig.py:28
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
confTool.parse_args
def parse_args()
Definition: confTool.py:35
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69