12from AthenaConfiguration.AccumulatorCache
import AccumulatorCache
13from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
14from AthenaConfiguration.ComponentFactory
import CompFactory
15from 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 ),
27 PrintTable = printTable,
28 RegSelLUT = (
"RegSelLUTCondData_"+detector) )
30 condAlg = CondAlgConstructor( name =
_condAlgName( detector ),
31 ManagerName = detector,
32 PrintTable = printTable,
33 RegSelLUT = (
"RegSelLUTCondData_"+detector) )
35 if detector ==
"Pixel":
36 condAlg.DetEleCollKey =
"PixelDetectorElementCollection"
37 condAlg.PixelCablingCondData =
"PixelCablingCondData"
38 elif detector ==
"SCT":
39 condAlg.DetEleCollKey =
"SCT_DetectorElementCollection"
40 condAlg.SCT_CablingData =
"SCT_CablingData"
41 elif detector ==
"ITkPixel":
42 condAlg.DetEleCollKey =
"ITkPixelDetectorElementCollection"
44 condAlg.PixelCablingCondData =
""
45 elif detector ==
"ITkStrip":
46 condAlg.DetEleCollKey =
"ITkStripDetectorElementCollection"
48 condAlg.SCT_CablingData =
""
53 Creates RegSelTool and corresponding cond tool that is needed for its function
55 If the enable flag is set - the tool is properly configured, else it is configured NOT to provide the data.
60 tool = CompFactory.RegSelTool(name=
"RegSelTool_"+detector)
67 tool.Initialised =
False
72 tool.RegSelLUT =
"RegSelLUTCondData_"+detector
73 tool.Initialised =
True
77def regSelToolCfg(flags, detector, algorithm, readout_geometry=None, conditions=None):
78 ca = ComponentAccumulator()
80 ca.merge(readout_geometry)
87 if flags.hasFlag(
"PrintLUT"):
88 printLUT = flags.PrintLUT
91 ca.addCondAlgo(the_alg)
98 from PixelGeoModel.PixelGeoModelConfig
import PixelReadoutGeometryCfg
99 from PixelConditionsAlgorithms.PixelConditionsConfig
import PixelCablingCondAlgCfg
100 return regSelToolCfg(flags,
"Pixel", CompFactory.SiRegSelCondAlg,
101 readout_geometry=PixelReadoutGeometryCfg(flags), conditions=PixelCablingCondAlgCfg(flags))
105 from SCT_GeoModel.SCT_GeoModelConfig
import SCT_ReadoutGeometryCfg
106 from SCT_Cabling.SCT_CablingConfig
import SCT_CablingCondAlgCfg
107 return regSelToolCfg(flags,
"SCT", CompFactory.SiRegSelCondAlg,
108 readout_geometry=SCT_ReadoutGeometryCfg(flags), conditions=SCT_CablingCondAlgCfg(flags))
112 from TRT_GeoModel.TRT_GeoModelConfig
import TRT_ReadoutGeometryCfg
113 return regSelToolCfg(flags,
"TRT", CompFactory.TRT_RegSelCondAlg,
114 readout_geometry=TRT_ReadoutGeometryCfg(flags))
119 from PixelGeoModelXml.ITkPixelGeoModelConfig
import ITkPixelReadoutGeometryCfg
120 return regSelToolCfg(flags,
"ITkPixel", CompFactory.SiRegSelCondAlg,
121 readout_geometry=ITkPixelReadoutGeometryCfg(flags))
125 from StripGeoModelXml.ITkStripGeoModelConfig
import ITkStripReadoutGeometryCfg
126 return regSelToolCfg(flags,
"ITkStrip", CompFactory.SiRegSelCondAlg,
127 readout_geometry=ITkStripReadoutGeometryCfg(flags))
133 from MuonConfig.MuonGeometryConfig
import RegionSelCondAlgCfg
134 result = ComponentAccumulator()
135 result.merge(RegionSelCondAlgCfg(flags, detector =
"MDT"))
141 from MuonConfig.MuonGeometryConfig
import RegionSelCondAlgCfg
142 result = ComponentAccumulator()
143 result.merge(RegionSelCondAlgCfg(flags, detector =
"RPC"))
149 from MuonConfig.MuonGeometryConfig
import RegionSelCondAlgCfg
150 result = ComponentAccumulator()
151 result.merge(RegionSelCondAlgCfg(flags, detector =
"TGC"))
157 from MuonConfig.MuonGeometryConfig
import MuonGeoModelCfg
158 from MuonConfig.MuonCablingConfig
import CSCCablingConfigCfg
160 conditions = ComponentAccumulator()
161 conditions.merge(MuonGeoModelCfg(flags))
162 conditions.merge(CSCCablingConfigCfg(flags))
164 return regSelToolCfg(flags,
"CSC", CompFactory.CSC_RegSelCondAlg,
165 conditions=conditions)
169 from MuonConfig.MuonGeometryConfig
import RegionSelCondAlgCfg
170 result = ComponentAccumulator()
171 result.merge(RegionSelCondAlgCfg(flags, detector =
"sTGC"))
177 from MuonConfig.MuonGeometryConfig
import RegionSelCondAlgCfg
178 result = ComponentAccumulator()
179 result.merge(RegionSelCondAlgCfg(flags, detector =
"MM"))
188 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
189 from LArRecUtils.LArRecUtilsConfig
import LArRoIMapCondAlgCfg
191 conditions = ComponentAccumulator()
192 conditions.merge(LArGMCfg(flags))
193 conditions.merge(LArRoIMapCondAlgCfg(flags))
195 return regSelToolCfg(flags,
"TTEM", CompFactory.RegSelCondAlg_LAr,
196 conditions=conditions)
200 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
201 from LArRecUtils.LArRecUtilsConfig
import LArRoIMapCondAlgCfg
203 conditions = ComponentAccumulator()
204 conditions.merge(LArGMCfg(flags))
205 conditions.merge(LArRoIMapCondAlgCfg(flags))
207 return regSelToolCfg(flags,
"TTHEC", CompFactory.RegSelCondAlg_LAr,
208 conditions=conditions)
212 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
213 from LArRecUtils.LArRecUtilsConfig
import LArRoIMapCondAlgCfg
215 conditions = ComponentAccumulator()
216 conditions.merge(LArGMCfg(flags))
217 conditions.merge(LArRoIMapCondAlgCfg(flags))
219 return regSelToolCfg(flags,
"FCALEM", CompFactory.RegSelCondAlg_LAr,
220 conditions=conditions)
224 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
225 from LArRecUtils.LArRecUtilsConfig
import LArRoIMapCondAlgCfg
227 conditions = ComponentAccumulator()
228 conditions.merge(LArGMCfg(flags))
229 conditions.merge(LArRoIMapCondAlgCfg(flags))
231 return regSelToolCfg(flags,
"FCALHAD", CompFactory.RegSelCondAlg_LAr,
232 conditions=conditions)
236 from TileByteStream.TileHid2RESrcIDConfig
import TileHid2RESrcIDCondAlgCfg
237 return regSelToolCfg(flags,
"TILE", CompFactory.RegSelCondAlg_Tile,
238 conditions=TileHid2RESrcIDCondAlgCfg(flags, ForHLT=
True))
243 Get a list of RegionSelector tools for given detector look-up tables if the corresponding Detector flags are enabled
245 acc = ComponentAccumulator()
249 if det
in [
'TTEM',
'TTHEC',
'FCALEM',
'FCALHAD']:
255 detFlag = f
'Enable{flagName}'
256 detEnabled = getattr(flags.Detector, detFlag)
258 _log.debug(
'regSelToolsCfg: skip adding detector "%s" because the flag Detector.%s is False', det, detFlag)
260 funcName = f
'regSelTool_{det}_Cfg'
261 func = globals().
get(funcName,
None)
263 raise RuntimeError(
'regSelToolsCfg: cannot add detector "' + det +
'", RegSelToolConfig does not have a function ' + funcName)
264 regSelTools += [acc.popToolsAndMerge(func(flags))]
265 acc.setPrivateTools(regSelTools)
270if __name__==
'__main__':
271 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
272 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
273 from AthenaConfiguration
import DetectorConfigFlags, TestDefaults
274 from ByteStreamCnvSvc.ByteStreamConfig
import ByteStreamReadCfg
277 flags = initConfigFlags()
278 flags.Input.Files = TestDefaults.defaultTestFiles.RAW_RUN3
279 flags.GeoModel.AtlasVersion = TestDefaults.defaultGeometryTags.RUN3
280 flags.IOVDb.GlobalTag = TestDefaults.defaultConditionsTags.RUN3_DATA23
281 flags.Exec.MaxEvents = 1
282 flags.Concurrency.NumThreads = 1
285 flags.Input.FailOnUnknownCollections =
True
286 flags.Scheduler.AutoLoadUnmetDependencies =
False
291 flags.addFlag(
"PrintLUT",
True )
293 detNames = sys.argv[1:]
298 DetectorConfigFlags.disableDetectors(flags, DetectorConfigFlags.allDetectors +
299 list(DetectorConfigFlags.allGroups.keys()), toggle_geometry=
False)
301 DetectorConfigFlags.enableDetectors(flags, detNames, toggle_geometry=
False)
305 acc = MainServicesCfg(flags)
306 acc.merge(ByteStreamReadCfg(flags))
308 if 'LAr' in detNames:
309 detNames.remove(
'LAr')
310 detNames += [
'TTEM',
'TTHEC',
'FCALEM',
'FCALHAD']
311 if 'Tile' in detNames:
312 detNames.remove(
'Tile')
313 detNames.append(
'TILE')
314 if 'sTGC' in detNames:
315 detNames.remove(
'sTGC')
316 detNames.append(
'STGC')
320 alg = CompFactory.RegSelToolTester(
321 RegionSelectorTools = acc.popToolsAndMerge(toolsCfg) )
323 acc.addEventAlgo(alg, sequenceName=
'AthAlgSeq')
325 sys.exit(acc.run().isFailure())
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)