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 
42  from MuonConfig.MuonCablingConfig import MDTCablingConfigCfg
43  from MuonConfig.MuonCondAlgConfig import MdtCondDbAlgCfg
44  from AthenaConfiguration.ComponentFactory import CompFactory
45  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
46  result = ComponentAccumulator()
47  result.merge(MdtCondDbAlgCfg(flags))
48  result.merge(MDTCablingConfigCfg(flags, MezzanineJSON=mezzJSON, CablingJSON=cablingJSON))
49  event_algo = CompFactory.MdtCablingTestAlg(name, DumpMap=dumpFile)
50  result.addEventAlgo(event_algo, primary = True)
51  return result
52 
53 if __name__ == "__main__":
54  from AthenaConfiguration.AllConfigFlags import initConfigFlags
56 
57  flags = initConfigFlags()
58  flags.Concurrency.NumThreads = args.threads
59  flags.Concurrency.NumConcurrentEvents = args.threads # Might change this later, but good enough for the moment.
60  flags.Output.ESDFileName = args.output
61  flags.Input.Files = args.inputFile
62  flags.GeoModel.AtlasVersion = args.geometry
63  if not flags.Input.isMC:
64  flags.IOVDb.GlobalTag = args.conditionsTag
65  flags.lock()
66 
67  cfg = setupServicesCfg(flags)
68  cfg.merge(MdtCablingTestAlgCfg(flags,
69  mezzJSON=args.mezzMap,
70  cablingJSON=args.cablingMap,
71  dumpFile=args.output))
72  cfg.printConfig(withDetails=True, summariseProps=True)
73  flags.dump()
74 
75  sc = cfg.run(1)
76  if not sc.isSuccess():
77  import sys
78  sys.exit("Execution failed")
79 
80 
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
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:100
python.MuonGeometryConfig.MuonIdHelperSvcCfg
def MuonIdHelperSvcCfg(flags)
Definition: MuonGeometryConfig.py:15
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
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