ATLAS Offline Software
SCT_ConditionsToolsConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 from AthenaConfiguration.AccumulatorCache import AccumulatorCache
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 from AthenaConfiguration.Enums import Format
6 from AtlasGeoModel.GeoModelConfig import GeoModelCfg
7 from IOVDbSvc.IOVDbSvcConfig import addFolders, addFoldersSplitOnline
8 from SCT_GeoModel.SCT_GeoModelConfig import SCT_ReadoutGeometryCfg
9 
10 
11 
12 def SCT_ByteStreamErrorsToolCfg(flags, name="SCT_ByteStreamErrorsTool", **kwargs):
14  kwargs.setdefault("ConfigTool", acc.popPrivateTools())
15 
16  if flags.Input.Format is Format.BS and not flags.Trigger.doHLT:
17  # Missing dependency on SCT_ByteStreamErrs
18  from SCT_RawDataByteStreamCnv.SCT_RawDataByteStreamCnvConfig import (
19  SCTRawDataProviderCfg)
20  acc.merge(SCTRawDataProviderCfg(flags))
21 
22  acc.setPrivateTools(CompFactory.SCT_ByteStreamErrorsTool(name, **kwargs))
23  return acc
24 
25 
26 def SCT_ConditionsParameterCfg(flags, name="SCT_ConditionsParameter", **kwargs):
27  """Configure necessary condition folder, condition algorithm
28  for SCT_ConditionsParameterTool and return it.
29  """
30  acc = ComponentAccumulator()
31 
32  # For SCT_ID used in SCT_CablingTool
33  acc.merge(GeoModelCfg(flags))
34 
35  # Condition folder
36  folder = "/SCT/DAQ/Configuration/Chip"
37  dbInstance = "SCT"
38  acc.merge(addFolders(flags, folder, dbInstance, className="CondAttrListVec"))
39 
40  # Condition algorithm
41  from SCT_Cabling.SCT_CablingConfig import SCT_CablingToolCfg
42  acc.addCondAlgo(CompFactory.SCT_ConditionsParameterCondAlg(name=f"{name}CondAlg",
43  ReadKey=folder,
44  SCT_CablingTool=acc.popToolsAndMerge(SCT_CablingToolCfg(flags))))
45 
46  # Condition tool
47  acc.setPrivateTools(CompFactory.SCT_ConditionsParameterTool(name=f"{name}Tool"))
48 
49  return acc
50 
51 def SCT_ConditionsSummaryToolBaseCfg(flags, name="InDetSCT_ConditionsSummaryToolAddFlagged", **kwargs):
52  acc = ComponentAccumulator()
53 
54  # @TODO what shall be done if SCTDetEleCollKey is overridden ?
55  from SCT_ConditionsAlgorithms.SCT_ConditionsAlgorithmsConfig import SCT_DetectorElementCondAlgCfg
56  acc.merge(SCT_DetectorElementCondAlgCfg(flags))
57 
58  acc.setPrivateTools(CompFactory.SCT_ConditionsSummaryTool(name, **kwargs))
59  return acc
60 
61 def SCT_DetectorElementStatusAddFlaggedToolCfg(flags, name="InDetSCT_DetectorElementStatusAddFlaggedTool", **kwargs):
62  acc = ComponentAccumulator()
63  if "ConditionsTools" not in kwargs :
64  kwargs.setdefault("ConditionsTools", [ acc.popToolsAndMerge(SCT_FlaggedConditionToolCfg(flags)) ] )
65  kwargs.setdefault("SCTDetElStatusEventDataBaseKey", "SCTDetectorElementStatusWithoutFlagged")
66  acc.setPrivateTools( acc.popToolsAndMerge( SCT_ConditionsSummaryToolBaseCfg( flags, name, **kwargs) ) )
67  return acc
68 
69 def SCT_DetectorElementStatusAddByteStreamErrorsToolCfg(flags, name="InDetSCT_DetectorElementStatusAddByteStreamErrorsTool", **kwargs):
70  acc = ComponentAccumulator()
71  if not flags.Input.isMC and flags.Input.Format is Format.BS :
72  if "ConditionsTools" not in kwargs :
73  SCT_ConfigurationConditionsTool = acc.popToolsAndMerge(SCT_ConfigurationConditionsToolCfg(flags))
74  kwargs.setdefault("ConditionsTools", [ acc.popToolsAndMerge(SCT_ByteStreamErrorsToolCfg(flags, **{"ConfigTool" : SCT_ConfigurationConditionsTool})) ])
75  acc.setPrivateTools( acc.popToolsAndMerge( SCT_ConditionsSummaryToolBaseCfg( flags, name, **kwargs) ) )
76  return acc
77 
78 
79 @AccumulatorCache
80 def SCT_ConditionsSummaryToolCfg(flags, name="InDetSCT_ConditionsSummaryTool", **kwargs):
81  acc = ComponentAccumulator()
82 
83  # Load flagged condition tool
84  withFlaggedCondTool = kwargs.pop("withFlaggedCondTool", True)
85  withByteStreamErrorsTool = kwargs.pop("withByteStreamErrorsTool", True)
86  withTdaqTool = kwargs.pop("withTdaqTool", True)
87 
88  ConditionsTools = []
89  SCT_ConfigurationConditionsTool = acc.popToolsAndMerge(SCT_ConfigurationConditionsToolCfg(flags))
90  ConditionsTools += [ SCT_ConfigurationConditionsTool ]
91 
92  if withFlaggedCondTool:
93  ConditionsTools += [ acc.popToolsAndMerge(SCT_FlaggedConditionToolCfg(flags)) ]
94  else:
95  name += "WithoutFlagged"
96 
97  # Load bytestream errors tool (use default instance without "InDet")
98  if not flags.Input.isMC and withByteStreamErrorsTool :
99  ConditionsTools += [ acc.popToolsAndMerge(SCT_ByteStreamErrorsToolCfg(flags, **{"ConfigTool" : SCT_ConfigurationConditionsTool})) ]
100 
101  if flags.InDet.useSctDCS:
102  ConditionsTools += [ acc.popToolsAndMerge(SCT_DCSConditionsCfg(flags)) ]
103 
104  if withTdaqTool and not flags.Input.isMC :
105  ConditionsTools += [ acc.popToolsAndMerge(SCT_TdaqEnabledToolCfg(flags)) ]
106 
107  # Load calibration conditions tool
108  # @TODO or just for data?
109  ConditionsTools += [ acc.popToolsAndMerge(SCT_ReadCalibDataToolCfg(flags)) ]
110 
111  # Load conditions Monitoring tool
112  if not flags.Common.isOnline:
113  # @TODO really also for MC?
114  ConditionsTools += [ acc.popToolsAndMerge(SCT_MonitorConditionsToolCfg(flags)) ]
115 
116  if flags.InDet.doSCTModuleVeto:
117  ConditionsTools += [ acc.popToolsAndMerge(SCT_ModuleVetoCfg(flags)) ]
118 
119  kwargs.setdefault("ConditionsTools", ConditionsTools)
120 
121  acc.setPrivateTools( acc.popToolsAndMerge( SCT_ConditionsSummaryToolBaseCfg( flags, name, **kwargs) ) )
122  return acc
123 
124 
125 @AccumulatorCache
126 def SCT_ConfigurationConditionsToolCfg(flags, name="InDetSCT_ConfigurationConditionsTool", **kwargs):
127  # Load conditions configuration service and load folders and algorithm for it
128  # Load folders that have to exist for both MC and Data
129  folder_path = "/SCT/DAQ/Config/"
130  #if its COMP200, use old folders...
131  if flags.IOVDb.DatabaseInstance == "COMP200":
132  folder_path = "/SCT/DAQ/Configuration/"
133  #...but now check if we want to override that decision with explicit flag (if there is one)
134  if flags.InDet.ForceCoraCool:
135  folder_path = "/SCT/DAQ/Configuration/"
136  if flags.InDet.ForceCoolVectorPayload:
137  folder_path = "/SCT/DAQ/Config/"
138 
139  if flags.InDet.ForceCoolVectorPayload and flags.InDet.ForceCoraCool:
140  print ("*** SCT DB CONFIGURATION FLAG CONFLICT: Both CVP and CoraCool selected****")
141  folder_path = ""
142 
143  cond_kwargs = {}
144  cond_kwargs["ChannelFolder"] = folder_path + ("Chip" if flags.IOVDb.DatabaseInstance == "COMP200" else "ChipSlim")
145  cond_kwargs["ModuleFolder"] = f"{folder_path}Module"
146  cond_kwargs["MurFolder"] = f"{folder_path}MUR"
147  cond_kwargs["dbInstance"] = "SCT"
148  cond_kwargs["SCT_ConfigurationCondAlgName"] = "SCT_ConfigurationCondAlg"
149 
150  # For SCT_ID and SCT_DetectorElementCollection used in SCT_ConfigurationCondAlg and SCT_ConfigurationConditionsTool
151  acc = SCT_ReadoutGeometryCfg(flags)
152 
153  if "ChannelFolderDB" not in cond_kwargs:
154  acc.merge(addFoldersSplitOnline(flags,
155  detDb=cond_kwargs["dbInstance"],
156  onlineFolders=cond_kwargs["ChannelFolder"],
157  offlineFolders=cond_kwargs["ChannelFolder"],
158  className="CondAttrListVec",
159  splitMC=True))
160  else:
161  acc.merge(addFolders(flags, [cond_kwargs["ChannelFolderDB"]], detDb = cond_kwargs["dbInstance"], className="CondAttrListVec"))
162  if "ModuleFolderDB" not in cond_kwargs:
163  acc.merge(addFoldersSplitOnline(flags,
164  detDb=cond_kwargs["dbInstance"],
165  onlineFolders=cond_kwargs["ModuleFolder"],
166  offlineFolders=cond_kwargs["ModuleFolder"],
167  className="CondAttrListVec",
168  splitMC=True))
169  else:
170  acc.merge(addFolders(flags, [cond_kwargs["ModuleFolderDB"]], detDb = cond_kwargs["dbInstance"], className="CondAttrListVec"))
171  if "MurFolderDB" not in cond_kwargs:
172  acc.merge(addFoldersSplitOnline(flags,
173  detDb=cond_kwargs["dbInstance"],
174  onlineFolders=cond_kwargs["MurFolder"],
175  offlineFolders=cond_kwargs["MurFolder"],
176  className="CondAttrListVec",
177  splitMC=True))
178  else:
179  acc.merge(addFolders(flags, [cond_kwargs["MurFolderDB"]], detDb = cond_kwargs["dbInstance"], className="CondAttrListVec"))
180 
181  ConfigCondAlg_kwargs={}
182  ConfigCondAlg_kwargs["ReadKeyChannel"] = cond_kwargs["ChannelFolder"]
183  ConfigCondAlg_kwargs["ReadKeyModule"] = cond_kwargs["ModuleFolder"]
184  ConfigCondAlg_kwargs["ReadKeyMur"] = cond_kwargs["MurFolder"]
185  from SCT_ConditionsAlgorithms.SCT_ConditionsAlgorithmsConfig import SCT_ConfigurationCondAlgCfg
186  acc.merge(SCT_ConfigurationCondAlgCfg(flags, name="SCT_ConfigurationCondAlg", **ConfigCondAlg_kwargs))
187 
188  acc.setPrivateTools(CompFactory.SCT_ConfigurationConditionsTool(name, **kwargs))
189  return acc
190 
191 
192 def SCT_DCSConditionsCfg(flags, name="InDetSCT_DCSConditions", **kwargs):
193  """Configure necessary condition folders, condition algorithms
194  for SCT_DCSConditionsTool and return it.
195  """
196  acc = ComponentAccumulator()
197 
198  # Condition folders
199  isDataHLT = flags.Common.isOnline and not flags.Input.isMC
200  dcsFolder = "/SCT/HLT/DCS" if isDataHLT else "/SCT/DCS"
201  dbInstance = kwargs.get("dbInstance", "SCT" if isDataHLT else "DCS_OFL")
202  hvFolder = kwargs.get("hvFolder", dcsFolder + "/HV")
203  tempFolder = kwargs.get("tempFolder", dcsFolder + "/MODTEMP")
204  stateFolder = kwargs.get("stateFolder", dcsFolder + "/CHANSTAT")
205  ReadAllDBFolders = kwargs.get("ReadAllDBFolders", not flags.Common.isOnline)
206  ReturnHVTemp = kwargs.get("ReturnHVTemp", True)
207 
208  # Condition algorithms
209  if ReadAllDBFolders == ReturnHVTemp and not flags.Common.isOnline:
210  acc.merge(addFolders(flags, stateFolder, dbInstance, className="CondAttrListCollection"))
211  # algo
212  statArgs = {
213  "name": f"{name}StatCondAlg",
214  "ReturnHVTemp": ReturnHVTemp,
215  "ReadKeyHV": hvFolder,
216  "ReadKeyState": stateFolder,
217  }
218  acc.addCondAlgo(CompFactory.SCT_DCSConditionsStatCondAlg(**statArgs))
219  if ReturnHVTemp:
220  acc.merge(addFolders(flags, [hvFolder, tempFolder], dbInstance, className="CondAttrListCollection"))
221  acc.addCondAlgo(CompFactory.SCT_DCSConditionsHVCondAlg(name=f"{name}HVCondAlg", ReadKey=hvFolder))
222  acc.addCondAlgo(CompFactory.SCT_DCSConditionsTempCondAlg(name=f"{name}TempCondAlg", ReadKey=tempFolder))
223 
224  # Condition tool
225  acc.merge(GeoModelCfg(flags)) # For SCT_ID used in SCT_DCSConditionsTool
226  toolkwargs = {}
227  toolkwargs["ReadAllDBFolders"] = ReadAllDBFolders
228  toolkwargs["ReturnHVTemp"] = ReturnHVTemp
229  acc.setPrivateTools(CompFactory.SCT_DCSConditionsTool(name=f"{name}Tool", **toolkwargs))
230 
231  return acc
232 
233 
234 def SCT_FlaggedConditionToolCfg(flags, name="InDetSCT_FlaggedConditionTool", **kwargs):
235  # For SCT_ID and SCT_DetectorElementCollection used in SCT_FlaggedConditionTool
236  acc = SCT_ReadoutGeometryCfg(flags)
237 
238  # This tool needs SCT_FlaggedCondData which is produced by SCT_Clusterization
239 
240  acc.setPrivateTools(CompFactory.SCT_FlaggedConditionTool(name, **kwargs))
241  return acc
242 
243 
244 def SCT_LinkMaskingCfg(flags, name="SCT_LinkMasking", **kwargs):
245  """Configure necessary condition folder, condition algorithm
246  for SCT_LinkMaskingTool and return it.
247  """
248  # For SCT_ID used in SCT_LinkMaskingTool
249  acc = GeoModelCfg(flags)
250 
251  # Condition folders
252  folder = "/purple/pants"
253  # mycool.db is hard coded in Database/IOVDbSvc/python/IOVDbSvcConfig.py
254  dbConnection = "<dbConnection>sqlite://;schema=mycool.db;dbname=CONDBR2</dbConnection>"
255  acc.merge(addFolders(flags, folderStrings=folder, className="CondAttrListCollection", db=dbConnection))
256 
257  # Condition algorithm
258  kwargs.setdefault("ReadKey", folder)
259  acc.addCondAlgo(CompFactory.SCT_LinkMaskingCondAlg(name=f"{name}CondAlg", **kwargs))
260 
261  # Condition tool
262  acc.setPrivateTools(CompFactory.SCT_LinkMaskingTool(name=f"{name}Tool"))
263 
264  return acc
265 
266 
267 def SCT_MajorityConditionsCfg(flags, name="InDetSCT_MajorityConditions", **kwargs):
268  """Configure necessary condition folder, condition algorithm
269  for SCT_MajorityConditionsTool and return it.
270  """
271  acc = ComponentAccumulator()
272 
273  # Condition folder
274  folder = "/SCT/DCS/MAJ"
275  dbInstance = "DCS_OFL"
276 
277  # Condition algorithm
278  acc.merge(addFolders(flags, folder, dbInstance, className="CondAttrListCollection"))
279  acc.addCondAlgo(CompFactory.SCT_MajorityCondAlg())
280 
281  # Condition tool
282  acc.setPrivateTools(CompFactory.SCT_MajorityConditionsTool(name=f"{name}Tool"))
283 
284  return acc
285 
286 
287 def SCT_ModuleVetoCfg(flags, name="InDetSCT_ModuleVeto", **kwargs):
288  """Return a ComponentAccumulator configured for SCT_ModuleVetoTool
289  """
290  # For SCT_ID used in SCT_ModuleVetoTool
291  acc = GeoModelCfg(flags)
292 
293  if kwargs["useDB"]:
294  # Condition folder
295  acc.merge(addFolders(flags,
296  folderStrings="/SCT/Manual/BadModules",
297  detDb="SCT_OFL",
298  className="AthenaAttributeList",
299  tag=kwargs["folderTag"]))
300  # Condition algorithm
301  acc.addCondAlgo(CompFactory.SCT_ModuleVetoCondAlg())
302 
303  # Condition tool
304  toolArgs = {}
305  toolArgs["BadModuleIdentifiers"] = kwargs["BadModuleIdentifiers"]
306  acc.setPrivateTools(CompFactory.SCT_ModuleVetoTool(name=f"{name}Tool", **toolArgs))
307 
308  return acc
309 
310 
311 def SCT_MonitorConditionsToolCfg(flags, name="InDetSCT_MonitorConditionsTool", cond_kwargs={}, **kwargs):
312  cond_kwargs.setdefault("Folder", "/SCT/Derived/Monitoring")
313  cond_kwargs.setdefault("dbInstance", "SCT_OFL")
314  cond_kwargs.setdefault("MonitorCondAlgName", "SCT_MonitorCondAlg")
315 
316  # For SCT_ID used in SCT_MonitorConditionsTool
317  from AtlasGeoModel.GeoModelConfig import GeoModelCfg
318  acc = GeoModelCfg(flags)
319 
320  if "FolderDb" not in cond_kwargs:
321  cond_kwargs["FolderDb"] = cond_kwargs["Folder"]
322  if "Modifiers" not in cond_kwargs:
323  cond_kwargs["Modifiers"] = ""
324  if "FolderTag" not in cond_kwargs:
325  cond_kwargs["FolderTag"] = None
326  acc.merge(addFolders(flags, cond_kwargs["FolderDb"], cond_kwargs["dbInstance"], className="CondAttrListCollection", tag=cond_kwargs["FolderTag"], modifiers=cond_kwargs["Modifiers"]))
327 
328  acc.addCondAlgo(CompFactory.SCT_MonitorCondAlg(name=cond_kwargs["MonitorCondAlgName"],
329  ReadKey=cond_kwargs["Folder"]))
330 
331  acc.setPrivateTools(CompFactory.SCT_MonitorConditionsTool(name, **kwargs))
332 
333  return acc
334 
335 
336 def SCT_ReadCalibChipDataCfg(flags, name="SCT_ReadCalibChip", **kwargs):
337  """Return configured ComponentAccumulator with SCT_ReadCalibChipDataCfg tool
338 
339  Accepts optional noiseFolder and gainFolder keyword arguments
340  """
341  acc = GeoModelCfg(flags) # For SCT_ID used in SCT_ReadCalibChipNoiseCondAlg, SCT_ReadCalibChipGainCondAlg, SCT_ReadCalibChipDataTool
342 
343  # Folders
344  noiseFolder = kwargs.get("noiseFolder", "/SCT/DAQ/Calibration/ChipNoise")
345  gainFolder = kwargs.get("gainFolder", "/SCT/DAQ/Calibration/ChipGain")
346  acc.merge(addFoldersSplitOnline(flags, "SCT", noiseFolder, noiseFolder, "CondAttrListCollection"))
347  acc.merge(addFoldersSplitOnline(flags, "SCT", gainFolder, gainFolder, "CondAttrListCollection"))
348 
349  # Algorithms
350  acc.addCondAlgo(CompFactory.SCT_ReadCalibChipNoiseCondAlg(name=f"{name}NoiseCondAlg", ReadKey=noiseFolder))
351  acc.addCondAlgo(CompFactory.SCT_ReadCalibChipGainCondAlg(name=f"{name}GainCondAlg", ReadKey=gainFolder))
352 
353  # Tool
354  acc.setPrivateTools(CompFactory.SCT_ReadCalibChipDataTool(name="InDetSCT_ReadCalibChipDataTool"))
355 
356  return acc
357 
358 
359 def SCT_ReadCalibDataToolCfg(flags, name="InDetSCT_ReadCalibDataTool", cond_kwargs={}, **kwargs):
360  # For SCT_ID and SCT_DetectorElementCollection used in SCT_ReadCalibDataCondAlg and SCT_ReadCalibDataTool
361  acc = SCT_ReadoutGeometryCfg(flags)
362 
363  cond_kwargs.setdefault("NoiseFolder", "/SCT/DAQ/Calibration/NoiseOccupancyDefects")
364  cond_kwargs.setdefault("GainFolder", "/SCT/DAQ/Calibration/NPtGainDefects")
365  cond_kwargs.setdefault("ReadCalibDataCondAlgName", "SCT_ReadCalibDataCondAlg")
366 
367  acc.merge(addFoldersSplitOnline(flags,
368  detDb="SCT",
369  onlineFolders=cond_kwargs["NoiseFolder"],
370  offlineFolders=cond_kwargs["NoiseFolder"],
371  className="CondAttrListCollection",
372  splitMC=True))
373  acc.merge(addFoldersSplitOnline(flags,
374  detDb="SCT",
375  onlineFolders=cond_kwargs["GainFolder"],
376  offlineFolders=cond_kwargs["GainFolder"],
377  className="CondAttrListCollection",
378  splitMC=True))
379 
380  ignore_defects = ["NOISE_SLOPE","OFFSET_SLOPE","GAIN_SLOPE","BAD_OPE","NO_HI","HI_GAIN","LO_GAIN"]
381  from AthenaConfiguration.Enums import LHCPeriod
382  if flags.GeoModel.Run >= LHCPeriod.Run3:
383  ignore_defects_parameters = [-1000.,-1000.,-1000.,-1000.,-1000.,-1000.,-1000.]
384  else:
385  ignore_defects_parameters = [-1000.,-1000.,-1000.,-1000.,-1000.,-1000.,15.]
386 
387  acc.addCondAlgo(CompFactory.SCT_ReadCalibDataCondAlg(name=cond_kwargs["ReadCalibDataCondAlgName"],
388  ReadKeyGain=cond_kwargs["GainFolder"],
389  ReadKeyNoise=cond_kwargs["NoiseFolder"],
390  IgnoreDefects=ignore_defects,
391  IgnoreDefectsParameters=ignore_defects_parameters))
392  from SCT_Cabling.SCT_CablingConfig import SCT_CablingToolCfg
393  kwargs.setdefault("SCT_CablingTool", acc.popToolsAndMerge(SCT_CablingToolCfg(flags)))
394 
395  acc.setPrivateTools(CompFactory.SCT_ReadCalibDataTool(name, **kwargs))
396  return acc
397 
398 
399 def SCT_ReadoutToolCfg(flags, name="SCT_ReadoutTool", **kwargs):
400  from SCT_Cabling.SCT_CablingConfig import SCT_CablingToolCfg
401  acc = SCT_CablingToolCfg(flags)
402  kwargs.setdefault("SCT_CablingTool", acc.popPrivateTools())
403  acc.setPrivateTools(CompFactory.SCT_ReadoutTool(name, **kwargs))
404  return acc
405 
406 
407 def SCT_RODVetoCfg(flags, name="SCT_RODVeto", **kwargs):
408  """Configure necessary condition folders, condition algorithms
409  for SCT_DCSConditionsTool and return it.
410  """
411  # For SCT_ID used in SCT_RODVetoCondAlg and SCT_RODVetoTool
412  acc = GeoModelCfg(flags)
413 
414  # For SCT_CablingTool used in SCT_RODVetoCondAlg
415  from SCT_Cabling.SCT_CablingConfig import SCT_CablingToolCfg
416  kwargs.setdefault("SCT_CablingTool", acc.popToolsAndMerge(SCT_CablingToolCfg(flags)))
417 
418  # Condition algorithm (actually event algorithm)
419  acc.addEventAlgo(CompFactory.SCT_RODVetoCondAlg(name=f"{name}CondAlg", **kwargs))
420 
421  # Condition tool
422  acc.setPrivateTools(CompFactory.SCT_RODVetoTool(name=f"{name}Tool"))
423 
424  return acc
425 
426 
427 def SCT_SensorsCfg(flags, name="SCT_Sensors", **kwargs):
428  """Configure necessary condition folder, condition algorithm
429  for SCT_MajorityConditionsTool and return it.
430  """
431  acc = ComponentAccumulator()
432 
433  # Condition folder
434  folder = "/SCT/Sensors"
435  dbInstance = "SCT_OFL"
436 
437  if "folderTag" in kwargs:
438  acc.merge(addFolders(flags, folder, dbInstance, className="CondAttrListCollection", tag=kwargs["folderTag"]))
439  else:
440  acc.merge(addFolders(flags, folder, dbInstance, className="CondAttrListCollection"))
441 
442  # Condition algorithm
443  acc.addCondAlgo(CompFactory.SCT_SensorsCondAlg())
444 
445  # Condition tool
446  acc.setPrivateTools(CompFactory.SCT_SensorsTool(name=f"{name}Tool"))
447 
448  return acc
449 
450 
451 def SCT_SiliconConditionsCfg(flags, name="SCT_Silicon", **kwargs):
452  """Return a ComponentAccumulator configured for SiliconConditions DB
453 
454  DCSConditionsTool may be provided in kwargs
455  """
456  # For SCT_ID used in SCT_SiliconHVCondAlg, SCT_SiliconTempCondAlg and SCT_SiliconConditionsTool
457  acc = GeoModelCfg(flags)
458 
459  # Condition algorithms
460  algkwargs = {}
461 
462  useDCS = kwargs.get("useDCS", flags.InDet.useSctDCS or flags.Common.isOnline)
463  toolkwargs = {}
464  if useDCS:
465  DCSConditionsTool = kwargs.get("DCSConditionsTool")
466  if DCSConditionsTool:
467  algkwargs["DCSConditionsTool"] = DCSConditionsTool
468  else:
469  DCSConditionsTool = acc.popToolsAndMerge(SCT_DCSConditionsCfg(flags))
470  algkwargs["DCSConditionsTool"] = DCSConditionsTool
471 
472  algkwargs["UseState"] = DCSConditionsTool.ReadAllDBFolders
473 
474  acc.addCondAlgo(CompFactory.SCT_SiliconHVCondAlg(name=f"{name}HVCondAlg", **algkwargs))
475  acc.addCondAlgo(CompFactory.SCT_SiliconTempCondAlg(name=f"{name}TempCondAlg", **algkwargs))
476 
477  toolkwargs["UseDB"] = kwargs.get("UseDB", True)
478  toolkwargs["ForceUseGeoModel"] = kwargs.get("ForceUseGeoModel", False)
479  else:
480  toolkwargs["UseDB"] = kwargs.get("UseDB", False)
481  toolkwargs["ForceUseGeoModel"] = kwargs.get("ForceUseGeoModel", True)
482 
483  acc.setPrivateTools(CompFactory.SCT_SiliconConditionsTool(name=f"{name}ConditionsTool", **toolkwargs))
484 
485  return acc
486 
487 
488 def SCT_StripVetoCfg(flags, name="SCT_StripVeto", **kwargs):
489  """Return a ComponentAccumulator configured for SCT_StripVetoTool
490  """
491  # For SCT_ID used in SCT_StripVetoTool
492  acc = GeoModelCfg(flags)
493 
494  # Condition tool
495  # Identifiers should be given as strings and decimal.
496  # Identifier::compact() method returns unsigned long long.
497  kwargs.setdefault("BadStripIdentifiers", ["576522359582752768",
498  "576522475009998848",
499  "576522475278434304",
500  # "576522475546869760",
501  # "576522475815305216",
502  # "576522476083740672",
503  ])
504  acc.setPrivateTools(CompFactory.SCT_StripVetoTool(name=f"{name}Tool", **kwargs))
505 
506  return acc
507 
508 
509 def SCT_TdaqEnabledToolCfg(flags, name="InDetSCT_TdaqEnabledTool", **kwargs):
510  # For SCT_ID used in SCT_TdaqEnabledTool
511  acc = GeoModelCfg(flags)
512 
513  # Folder
514  folder = "/TDAQ/Resources/ATLAS/SCT/Robins" if (flags.IOVDb.DatabaseInstance != "COMP200") else "/TDAQ/EnabledResources/ATLAS/SCT/Robins"
515  acc.merge( addFolders(flags, [folder], detDb="TDAQ", className="CondAttrListCollection") )
516 
517  # Algorithm
518  from SCT_Cabling.SCT_CablingConfig import SCT_CablingToolCfg
519  kwargs.setdefault("SCT_CablingTool", acc.popToolsAndMerge(SCT_CablingToolCfg(flags)))
520  acc.addCondAlgo(CompFactory.SCT_TdaqEnabledCondAlg(ReadKey = folder, **kwargs))
521 
522  # Tool
523  acc.setPrivateTools(CompFactory.SCT_TdaqEnabledTool(name))
524 
525  return acc
python.SCT_RawDataByteStreamCnvConfig.SCTRawDataProviderCfg
def SCTRawDataProviderCfg(flags, prefix="InDet", suffix="", **kwargs)
Definition: SCT_RawDataByteStreamCnvConfig.py:30
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.SCT_ConditionsToolsConfig.SCT_MonitorConditionsToolCfg
def SCT_MonitorConditionsToolCfg(flags, name="InDetSCT_MonitorConditionsTool", cond_kwargs={}, **kwargs)
Definition: SCT_ConditionsToolsConfig.py:311
python.SCT_ConditionsToolsConfig.SCT_DCSConditionsCfg
def SCT_DCSConditionsCfg(flags, name="InDetSCT_DCSConditions", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:192
python.SCT_ConditionsToolsConfig.SCT_ReadCalibChipDataCfg
def SCT_ReadCalibChipDataCfg(flags, name="SCT_ReadCalibChip", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:336
python.SCT_ConditionsToolsConfig.SCT_MajorityConditionsCfg
def SCT_MajorityConditionsCfg(flags, name="InDetSCT_MajorityConditions", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:267
python.SCT_ConditionsToolsConfig.SCT_DetectorElementStatusAddFlaggedToolCfg
def SCT_DetectorElementStatusAddFlaggedToolCfg(flags, name="InDetSCT_DetectorElementStatusAddFlaggedTool", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:61
python.SCT_ConditionsToolsConfig.SCT_ConditionsSummaryToolBaseCfg
def SCT_ConditionsSummaryToolBaseCfg(flags, name="InDetSCT_ConditionsSummaryToolAddFlagged", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:51
python.SCT_ConditionsToolsConfig.SCT_RODVetoCfg
def SCT_RODVetoCfg(flags, name="SCT_RODVeto", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:407
python.SCT_ConditionsAlgorithmsConfig.SCT_ConfigurationCondAlgCfg
def SCT_ConfigurationCondAlgCfg(flags, name="SCT_ConfigurationCondAlg", **kwargs)
Definition: SCT_ConditionsAlgorithmsConfig.py:36
python.SCT_ConditionsToolsConfig.SCT_DetectorElementStatusAddByteStreamErrorsToolCfg
def SCT_DetectorElementStatusAddByteStreamErrorsToolCfg(flags, name="InDetSCT_DetectorElementStatusAddByteStreamErrorsTool", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:69
python.SCT_ConditionsToolsConfig.SCT_ConditionsSummaryToolCfg
def SCT_ConditionsSummaryToolCfg(flags, name="InDetSCT_ConditionsSummaryTool", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:80
SCT_GeoModelConfig.SCT_ReadoutGeometryCfg
def SCT_ReadoutGeometryCfg(flags)
Definition: SCT_GeoModelConfig.py:42
python.SCT_CablingConfig.SCT_CablingToolCfg
def SCT_CablingToolCfg(flags, name="SCT_CablingTool")
Definition: SCT_CablingConfig.py:35
python.SCT_ConditionsToolsConfig.SCT_ConfigurationConditionsToolCfg
def SCT_ConfigurationConditionsToolCfg(flags, name="InDetSCT_ConfigurationConditionsTool", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:126
python.SCT_ConditionsToolsConfig.SCT_ModuleVetoCfg
def SCT_ModuleVetoCfg(flags, name="InDetSCT_ModuleVeto", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:287
python.IOVDbSvcConfig.addFolders
def addFolders(flags, folderStrings, detDb=None, className=None, extensible=False, tag=None, db=None, modifiers='')
Definition: IOVDbSvcConfig.py:72
python.SCT_ConditionsToolsConfig.SCT_StripVetoCfg
def SCT_StripVetoCfg(flags, name="SCT_StripVeto", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:488
python.IOVDbSvcConfig.addFoldersSplitOnline
def addFoldersSplitOnline(flags, detDb, onlineFolders, offlineFolders, className=None, extensible=False, addMCString='_OFL', splitMC=False, tag=None, forceDb=None, modifiers='')
Definition: IOVDbSvcConfig.py:153
python.SCT_ConditionsToolsConfig.SCT_LinkMaskingCfg
def SCT_LinkMaskingCfg(flags, name="SCT_LinkMasking", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:244
python.SCT_ConditionsToolsConfig.SCT_SensorsCfg
def SCT_SensorsCfg(flags, name="SCT_Sensors", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:427
python.SCT_ConditionsToolsConfig.SCT_ReadCalibDataToolCfg
def SCT_ReadCalibDataToolCfg(flags, name="InDetSCT_ReadCalibDataTool", cond_kwargs={}, **kwargs)
Definition: SCT_ConditionsToolsConfig.py:359
python.SCT_ConditionsToolsConfig.SCT_TdaqEnabledToolCfg
def SCT_TdaqEnabledToolCfg(flags, name="InDetSCT_TdaqEnabledTool", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:509
python.SCT_ConditionsToolsConfig.SCT_SiliconConditionsCfg
def SCT_SiliconConditionsCfg(flags, name="SCT_Silicon", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:451
python.SCT_ConditionsAlgorithmsConfig.SCT_DetectorElementCondAlgCfg
def SCT_DetectorElementCondAlgCfg(flags, name="SCT_DetectorElementCondAlg", **kwargs)
Definition: SCT_ConditionsAlgorithmsConfig.py:66
python.SCT_ConditionsToolsConfig.SCT_ConditionsParameterCfg
def SCT_ConditionsParameterCfg(flags, name="SCT_ConditionsParameter", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:26
python.SCT_ConditionsToolsConfig.SCT_FlaggedConditionToolCfg
def SCT_FlaggedConditionToolCfg(flags, name="InDetSCT_FlaggedConditionTool", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:234
python.SCT_ConditionsToolsConfig.SCT_ReadoutToolCfg
def SCT_ReadoutToolCfg(flags, name="SCT_ReadoutTool", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:399
python.SCT_ConditionsToolsConfig.SCT_ByteStreamErrorsToolCfg
def SCT_ByteStreamErrorsToolCfg(flags, name="SCT_ByteStreamErrorsTool", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:12
python.GeoModelConfig.GeoModelCfg
def GeoModelCfg(flags)
Definition: GeoModelConfig.py:16