5 from AthenaConfiguration.ComponentFactory
import CompFactory
6 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
7 from libpyeformat_helper
import SourceIdentifier, SubDetector
8 from RegionSelector
import RegSelToolConfig
10 from AthenaCommon.Logging
import logging
11 _log = logging.getLogger(__name__)
16 Get a list of RegionSelector tools for given detector look-up tables to build list of ROBs
17 in these detectors that intersect with the RoI. Special value 'All' can be also given
18 in the detNames list to include all detectors available in RegionSelector.
21 _regSelToDetFlagMap = {
30 _regSelToDetFlagMap |= dict([(d,d)
for d
in [
'Pixel',
'SCT',
'TRT']])
32 _regSelToDetFlagMap |= dict([(d,d)
for d
in [
'MDT',
'RPC',
'TGC',
'CSC',
'MM']])
33 _regSelToDetFlagMap[
'STGC'] =
'sTGC'
35 detNames = _regSelToDetFlagMap.keys()
42 if det
not in _regSelToDetFlagMap:
43 raise RuntimeError(
'Cannot add detector "' + det +
'" because it is not in _regSelToDetFlagMap')
44 detFlag =
'Enable'+_regSelToDetFlagMap[det]
45 detEnabled = getattr(flags.Detector, detFlag)
47 _log.debug(
'addRegSelDets: skip adding detector "%s" because the flag Detector.%s is False', det, detFlag)
49 funcName = f
'regSelTool_{det}_Cfg'
50 if not hasattr(RegSelToolConfig, funcName):
51 raise RuntimeError(
'Cannot add detector "' + det +
'", RegSelToolConfig does not have a function ' + funcName)
52 func = getattr(RegSelToolConfig, funcName)
53 if not callable(func):
54 raise RuntimeError(
'Cannot add detector "' + det +
'", RegSelToolConfig.' + funcName +
' is not callable')
55 regSelTools += [acc.popToolsAndMerge(func(flags))]
57 acc.setPrivateTools(regSelTools)
62 regSelDets : list[str] = [],
63 ROBs: list[SourceIdentifier] = [],
64 subDets: list[SubDetector] = [],
66 """Configure the RoIPEBInfoWriterTool"""
71 kwargs.setdefault(
"MatchTriggerType", [])
73 tool = CompFactory.RoIPEBInfoWriterTool(
75 RegionSelectorTools = acc_regsel.popPrivateTools(),
76 ExtraROBs = [
int(robid)
for robid
in ROBs],
77 ExtraSubDets = [
int(detid)
for detid
in subDets],
81 acc.setPrivateTools(tool)
86 ROBs: list[SourceIdentifier] = [],
87 subDets : list[SubDetector] = [],
89 """Configure the StaticPEBInfoWriterTool"""
93 kwargs.setdefault(
"MatchTriggerType", [])
95 tool = CompFactory.StaticPEBInfoWriterTool(
97 ROBList = [
int(robid)
for robid
in ROBs],
98 SubDetList = [
int(detid)
for detid
in subDets],
101 acc.setPrivateTools(tool)
105 if __name__ ==
'__main__':
106 from AthenaConfiguration.TestDefaults
import defaultTestFiles, defaultGeometryTags
107 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
109 flags.Input.Files = defaultTestFiles.RAW_RUN3
110 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
115 regSelDets = [
'Pixel',
'SCT',
'TRT'],
116 subDets = [SubDetector.TDAQ_CTP] )
117 acc.popPrivateTools()
121 subDets = [SubDetector.TDAQ_HLT],
122 ROBs = [SourceIdentifier(SubDetector.TDAQ_CTP, 0)])
123 acc.popPrivateTools()