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 ==
"PLR":
46 condAlg.DetEleCollKey =
"PLR_DetectorElementCollection"
48 condAlg.PixelCablingCondData =
""
49 elif detector ==
"ITkStrip":
50 condAlg.DetEleCollKey =
"ITkStripDetectorElementCollection"
52 condAlg.SCT_CablingData =
""
57 Creates RegSelTool and corresponding cond tool that is needed for its function
59 If the enable flag is set - the tool is properly configured, else it is configured NOT to provide the data.
64 tool = CompFactory.RegSelTool(name=
"RegSelTool_"+detector)
71 tool.Initialised =
False
76 tool.RegSelLUT =
"RegSelLUTCondData_"+detector
77 tool.Initialised =
True
81def regSelToolCfg(flags, detector, algorithm, readout_geometry=None, conditions=None):
82 ca = ComponentAccumulator()
84 ca.merge(readout_geometry)
91 if flags.hasFlag(
"PrintLUT"):
92 printLUT = flags.PrintLUT
95 ca.addCondAlgo(the_alg)
102 from PixelGeoModel.PixelGeoModelConfig
import PixelReadoutGeometryCfg
103 from PixelConditionsAlgorithms.PixelConditionsConfig
import PixelCablingCondAlgCfg
104 return regSelToolCfg(flags,
"Pixel", CompFactory.SiRegSelCondAlg,
105 readout_geometry=PixelReadoutGeometryCfg(flags), conditions=PixelCablingCondAlgCfg(flags))
109 from SCT_GeoModel.SCT_GeoModelConfig
import SCT_ReadoutGeometryCfg
110 from SCT_Cabling.SCT_CablingConfig
import SCT_CablingCondAlgCfg
111 return regSelToolCfg(flags,
"SCT", CompFactory.SiRegSelCondAlg,
112 readout_geometry=SCT_ReadoutGeometryCfg(flags), conditions=SCT_CablingCondAlgCfg(flags))
116 from TRT_GeoModel.TRT_GeoModelConfig
import TRT_ReadoutGeometryCfg
117 return regSelToolCfg(flags,
"TRT", CompFactory.TRT_RegSelCondAlg,
118 readout_geometry=TRT_ReadoutGeometryCfg(flags))
123 from PixelGeoModelXml.ITkPixelGeoModelConfig
import ITkPixelReadoutGeometryCfg
124 return regSelToolCfg(flags,
"ITkPixel", CompFactory.SiRegSelCondAlg,
125 readout_geometry=ITkPixelReadoutGeometryCfg(flags))
129 from PLRGeoModelXml.PLR_GeoModelConfig
import PLR_ReadoutGeometryCfg
130 return regSelToolCfg(flags,
"PLR", CompFactory.SiRegSelCondAlg,
131 readout_geometry=PLR_ReadoutGeometryCfg(flags))
135 from StripGeoModelXml.ITkStripGeoModelConfig
import ITkStripReadoutGeometryCfg
136 return regSelToolCfg(flags,
"ITkStrip", CompFactory.SiRegSelCondAlg,
137 readout_geometry=ITkStripReadoutGeometryCfg(flags))
143 from MuonConfig.MuonGeometryConfig
import RegionSelCondAlgCfg
144 result = ComponentAccumulator()
145 result.merge(RegionSelCondAlgCfg(flags, detector =
"MDT"))
151 from MuonConfig.MuonGeometryConfig
import RegionSelCondAlgCfg
152 result = ComponentAccumulator()
153 result.merge(RegionSelCondAlgCfg(flags, detector =
"RPC"))
159 from MuonConfig.MuonGeometryConfig
import RegionSelCondAlgCfg
160 result = ComponentAccumulator()
161 result.merge(RegionSelCondAlgCfg(flags, detector =
"TGC"))
167 from MuonConfig.MuonGeometryConfig
import MuonGeoModelCfg
168 from MuonConfig.MuonCablingConfig
import CSCCablingConfigCfg
170 conditions = ComponentAccumulator()
171 conditions.merge(MuonGeoModelCfg(flags))
172 conditions.merge(CSCCablingConfigCfg(flags))
174 return regSelToolCfg(flags,
"CSC", CompFactory.CSC_RegSelCondAlg,
175 conditions=conditions)
179 from MuonConfig.MuonGeometryConfig
import RegionSelCondAlgCfg
180 result = ComponentAccumulator()
181 result.merge(RegionSelCondAlgCfg(flags, detector =
"sTGC"))
187 from MuonConfig.MuonGeometryConfig
import RegionSelCondAlgCfg
188 result = ComponentAccumulator()
189 result.merge(RegionSelCondAlgCfg(flags, detector =
"MM"))
198 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
199 from LArRecUtils.LArRecUtilsConfig
import LArRoIMapCondAlgCfg
201 conditions = ComponentAccumulator()
202 conditions.merge(LArGMCfg(flags))
203 conditions.merge(LArRoIMapCondAlgCfg(flags))
205 return regSelToolCfg(flags,
"TTEM", CompFactory.RegSelCondAlg_LAr,
206 conditions=conditions)
210 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
211 from LArRecUtils.LArRecUtilsConfig
import LArRoIMapCondAlgCfg
213 conditions = ComponentAccumulator()
214 conditions.merge(LArGMCfg(flags))
215 conditions.merge(LArRoIMapCondAlgCfg(flags))
217 return regSelToolCfg(flags,
"TTHEC", CompFactory.RegSelCondAlg_LAr,
218 conditions=conditions)
222 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
223 from LArRecUtils.LArRecUtilsConfig
import LArRoIMapCondAlgCfg
225 conditions = ComponentAccumulator()
226 conditions.merge(LArGMCfg(flags))
227 conditions.merge(LArRoIMapCondAlgCfg(flags))
229 return regSelToolCfg(flags,
"FCALEM", CompFactory.RegSelCondAlg_LAr,
230 conditions=conditions)
234 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
235 from LArRecUtils.LArRecUtilsConfig
import LArRoIMapCondAlgCfg
237 conditions = ComponentAccumulator()
238 conditions.merge(LArGMCfg(flags))
239 conditions.merge(LArRoIMapCondAlgCfg(flags))
241 return regSelToolCfg(flags,
"FCALHAD", CompFactory.RegSelCondAlg_LAr,
242 conditions=conditions)
246 from TileByteStream.TileHid2RESrcIDConfig
import TileHid2RESrcIDCondAlgCfg
247 return regSelToolCfg(flags,
"TILE", CompFactory.RegSelCondAlg_Tile,
248 conditions=TileHid2RESrcIDCondAlgCfg(flags, ForHLT=
True))
253 Get a list of RegionSelector tools for given detector look-up tables if the corresponding Detector flags are enabled
255 acc = ComponentAccumulator()
259 if det
in [
'TTEM',
'TTHEC',
'FCALEM',
'FCALHAD']:
265 detFlag = f
'Enable{flagName}'
266 detEnabled = getattr(flags.Detector, detFlag)
268 _log.debug(
'regSelToolsCfg: skip adding detector "%s" because the flag Detector.%s is False', det, detFlag)
270 funcName = f
'regSelTool_{det}_Cfg'
271 func = globals().
get(funcName,
None)
273 raise RuntimeError(
'regSelToolsCfg: cannot add detector "' + det +
'", RegSelToolConfig does not have a function ' + funcName)
274 regSelTools += [acc.popToolsAndMerge(func(flags))]
275 acc.setPrivateTools(regSelTools)
280if __name__==
'__main__':
281 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
282 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
283 from AthenaConfiguration
import DetectorConfigFlags, TestDefaults
284 from ByteStreamCnvSvc.ByteStreamConfig
import ByteStreamReadCfg
287 flags = initConfigFlags()
288 flags.Input.Files = TestDefaults.defaultTestFiles.RAW_RUN3
289 flags.GeoModel.AtlasVersion = TestDefaults.defaultGeometryTags.RUN3
290 flags.IOVDb.GlobalTag = TestDefaults.defaultConditionsTags.RUN3_DATA23
291 flags.Exec.MaxEvents = 1
292 flags.Concurrency.NumThreads = 1
295 flags.Input.FailOnUnknownCollections =
True
296 flags.Scheduler.AutoLoadUnmetDependencies =
False
301 flags.addFlag(
"PrintLUT",
True )
303 detNames = sys.argv[1:]
308 DetectorConfigFlags.disableDetectors(flags, DetectorConfigFlags.allDetectors +
309 list(DetectorConfigFlags.allGroups.keys()), toggle_geometry=
False)
311 DetectorConfigFlags.enableDetectors(flags, detNames, toggle_geometry=
False)
315 acc = MainServicesCfg(flags)
316 acc.merge(ByteStreamReadCfg(flags))
318 if 'LAr' in detNames:
319 detNames.remove(
'LAr')
320 detNames += [
'TTEM',
'TTHEC',
'FCALEM',
'FCALHAD']
321 if 'Tile' in detNames:
322 detNames.remove(
'Tile')
323 detNames.append(
'TILE')
324 if 'sTGC' in detNames:
325 detNames.remove(
'sTGC')
326 detNames.append(
'STGC')
330 alg = CompFactory.RegSelToolTester(
331 RegionSelectorTools = acc.popToolsAndMerge(toolsCfg) )
333 acc.addEventAlgo(alg, sequenceName=
'AthAlgSeq')
335 sys.exit(acc.run().isFailure())
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)