12 from AthenaConfiguration.AccumulatorCache
import AccumulatorCache
13 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
14 from AthenaConfiguration.ComponentFactory
import CompFactory
15 from AthenaCommon.Logging
import logging
16 _log = logging.getLogger(__name__)
19 return "RegSelCondAlg_"+detector
23 Creates conditions alg that provides data to a RegSel Tool
26 condAlg = CondAlgConstructor( name =
_condAlgName( detector ),
28 RegSelLUT = (
"RegSelLUTCondData_"+detector) )
30 condAlg = CondAlgConstructor( name =
_condAlgName( detector ),
31 ManagerName = detector,
33 RegSelLUT = (
"RegSelLUTCondData_"+detector) )
35 if detector ==
"MDT" and isOnline:
36 condAlg.Conditions =
""
37 elif detector ==
"Pixel":
38 condAlg.DetEleCollKey =
"PixelDetectorElementCollection"
39 condAlg.PixelCablingCondData =
"PixelCablingCondData"
40 elif detector ==
"SCT":
41 condAlg.DetEleCollKey =
"SCT_DetectorElementCollection"
42 condAlg.SCT_CablingData =
"SCT_CablingData"
43 elif detector ==
"ITkPixel":
44 condAlg.DetEleCollKey =
"ITkPixelDetectorElementCollection"
46 condAlg.PixelCablingCondData =
""
47 elif detector ==
"ITkStrip":
48 condAlg.DetEleCollKey =
"ITkStripDetectorElementCollection"
50 condAlg.SCT_CablingData =
""
55 Creates RegSelTool and corresponding cond tool that is needed for its function
57 If the enable flag is set - the tool is properly configured, else it is configured NOT to provide the data.
62 tool = CompFactory.RegSelTool(name=
"RegSelTool_"+detector)
69 tool.Initialised =
False
74 tool.RegSelLUT =
"RegSelLUTCondData_"+detector
75 tool.Initialised =
True
79 def regSelToolCfg(flags, detector, algorithm, readout_geometry=None, conditions=None):
82 ca.merge(readout_geometry)
87 if detector ==
"MDT" and flags.Common.isOnline:
88 the_alg.Conditions =
""
89 ca.addCondAlgo(the_alg)
95 from PixelGeoModel.PixelGeoModelConfig
import PixelReadoutGeometryCfg
96 from PixelConditionsAlgorithms.PixelConditionsConfig
import PixelCablingCondAlgCfg
97 return regSelToolCfg(flags,
"Pixel", CompFactory.SiRegSelCondAlg,
102 from SCT_GeoModel.SCT_GeoModelConfig
import SCT_ReadoutGeometryCfg
103 from SCT_Cabling.SCT_CablingConfig
import SCT_CablingCondAlgCfg
104 return regSelToolCfg(flags,
"SCT", CompFactory.SiRegSelCondAlg,
109 from TRT_GeoModel.TRT_GeoModelConfig
import TRT_ReadoutGeometryCfg
110 return regSelToolCfg(flags,
"TRT", CompFactory.TRT_RegSelCondAlg,
116 from PixelGeoModelXml.ITkPixelGeoModelConfig
import ITkPixelReadoutGeometryCfg
117 return regSelToolCfg(flags,
"ITkPixel", CompFactory.SiRegSelCondAlg,
122 from StripGeoModelXml.ITkStripGeoModelConfig
import ITkStripReadoutGeometryCfg
123 return regSelToolCfg(flags,
"ITkStrip", CompFactory.SiRegSelCondAlg,
130 from MuonConfig.MuonCablingConfig
import MDTCablingConfigCfg
131 from MuonConfig.MuonCondAlgConfig
import MdtCondDbAlgCfg
132 from MuonConfig.MuonGeometryConfig
import MuonGeoModelCfg
137 if not flags.Common.isOnline:
140 return regSelToolCfg(flags,
"MDT", CompFactory.MDT_RegSelCondAlg,
141 conditions=conditions)
145 from MuonConfig.MuonCablingConfig
import RPCCablingConfigCfg
146 from MuonConfig.MuonGeometryConfig
import MuonGeoModelCfg
152 return regSelToolCfg(flags,
"RPC", CompFactory.RPC_RegSelCondAlg,
153 conditions=conditions)
157 from MuonConfig.MuonCablingConfig
import TGCCablingConfigCfg
158 from MuonConfig.MuonGeometryConfig
import MuonGeoModelCfg
164 return regSelToolCfg(flags,
"TGC", CompFactory.TGC_RegSelCondAlg,
165 conditions=conditions)
169 from MuonConfig.MuonGeometryConfig
import MuonGeoModelCfg
170 from MuonConfig.MuonCablingConfig
import CSCCablingConfigCfg
176 return regSelToolCfg(flags,
"CSC", CompFactory.CSC_RegSelCondAlg,
177 conditions=conditions)
181 from MuonConfig.MuonGeometryConfig
import MuonGeoModelCfg
182 return regSelToolCfg(flags,
"sTGC", CompFactory.sTGC_RegSelCondAlg,
187 from MuonConfig.MuonGeometryConfig
import MuonGeoModelCfg
188 return regSelToolCfg(flags,
"MM", CompFactory.MM_RegSelCondAlg,
195 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
196 from LArRecUtils.LArRecUtilsConfig
import LArRoIMapCondAlgCfg
202 return regSelToolCfg(flags,
"TTEM", CompFactory.RegSelCondAlg_LAr,
203 conditions=conditions)
207 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
208 from LArRecUtils.LArRecUtilsConfig
import LArRoIMapCondAlgCfg
214 return regSelToolCfg(flags,
"TTHEC", CompFactory.RegSelCondAlg_LAr,
215 conditions=conditions)
219 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
220 from LArRecUtils.LArRecUtilsConfig
import LArRoIMapCondAlgCfg
226 return regSelToolCfg(flags,
"FCALEM", CompFactory.RegSelCondAlg_LAr,
227 conditions=conditions)
231 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
232 from LArRecUtils.LArRecUtilsConfig
import LArRoIMapCondAlgCfg
238 return regSelToolCfg(flags,
"FCALHAD", CompFactory.RegSelCondAlg_LAr,
239 conditions=conditions)
243 from TileByteStream.TileHid2RESrcIDConfig
import TileHid2RESrcIDCondAlgCfg
244 return regSelToolCfg(flags,
"TILE", CompFactory.RegSelCondAlg_Tile,
250 Get a list of RegionSelector tools for given detector look-up tables if the corresponding Detector flags are enabled
256 if det
in [
'TTEM',
'TTHEC',
'FCALEM',
'FCALHAD']:
262 detFlag = f
'Enable{flagName}'
263 detEnabled = getattr(flags.Detector, detFlag)
265 _log.debug(
'regSelToolsCfg: skip adding detector "%s" because the flag Detector.%s is False', det, detFlag)
267 funcName = f
'regSelTool_{det}_Cfg'
268 func = globals().
get(funcName,
None)
270 raise RuntimeError(
'regSelToolsCfg: cannot add detector "' + det +
'", RegSelToolConfig does not have a function ' + funcName)
271 regSelTools += [acc.popToolsAndMerge(func(flags))]
272 acc.setPrivateTools(regSelTools)
277 if __name__==
'__main__':
278 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
279 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
280 from AthenaConfiguration
import DetectorConfigFlags, TestDefaults
281 from ByteStreamCnvSvc.ByteStreamConfig
import ByteStreamReadCfg
285 flags.Input.Files = TestDefaults.defaultTestFiles.RAW_RUN3
286 flags.GeoModel.AtlasVersion = TestDefaults.defaultGeometryTags.RUN3
287 flags.IOVDb.GlobalTag =
'CONDBR2-BLKPA-2023-02'
288 flags.Exec.MaxEvents = 1
289 flags.Concurrency.NumThreads = 1
292 flags.Input.FailOnUnknownCollections =
True
293 flags.Scheduler.AutoLoadUnmetDependencies =
False
295 detNames = sys.argv[1:]
298 DetectorConfigFlags.disableDetectors(flags, DetectorConfigFlags.allDetectors +
299 list(DetectorConfigFlags.allGroups.keys()), toggle_geometry=
False)
300 DetectorConfigFlags.enableDetectors(flags, detNames, toggle_geometry=
False)
306 if 'LAr' in detNames:
307 detNames.remove(
'LAr')
308 detNames += [
'TTEM',
'TTHEC',
'FCALEM',
'FCALHAD']
309 if 'Tile' in detNames:
310 detNames.remove(
'Tile')
311 detNames.append(
'TILE')
312 if 'sTGC' in detNames:
313 detNames.remove(
'sTGC')
314 detNames.append(
'STGC')
317 alg = CompFactory.RegSelToolTester(
318 RegionSelectorTools = acc.popToolsAndMerge(toolsCfg) )
319 acc.addEventAlgo(alg, sequenceName=
'AthAlgSeq')
321 sys.exit(acc.run().isFailure())