ATLAS Offline Software
ITkStripConditionsToolsConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
2 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
3 from AthenaConfiguration.ComponentFactory import CompFactory
4 from AtlasGeoModel.GeoModelConfig import GeoModelCfg
5 from IOVDbSvc.IOVDbSvcConfig import addFolders, addFoldersSplitOnline
6 from StripGeoModelXml.ITkStripGeoModelConfig import ITkStripReadoutGeometryCfg
7 
8 
9 def ITkStripByteStreamErrorsToolCfg(flags, name="ITkStripByteStreamErrorsTool", **kwargs):
11  kwargs.setdefault("ConfigTool", acc.popPrivateTools())
12  acc.setPrivateTools(CompFactory.SCT_ByteStreamErrorsTool(name, **kwargs))
13  return acc
14 
15 
16 def ITkStripConditionsSummaryToolCfg(flags, name="ITkStripConditionsSummaryTool", **kwargs):
17  acc = ComponentAccumulator()
18 
19  ConditionsTools = []
20  if flags.ITk.doStripModuleVeto:
21  ConditionsTools += [ acc.popToolsAndMerge(ITkStripModuleVetoCfg(flags)) ]
22 
23  kwargs.setdefault("ConditionsTools", ConditionsTools)
24  kwargs.setdefault("SCTDetEleCollKey", "ITkStripDetectorElementCollection")
25  acc.setPrivateTools(CompFactory.SCT_ConditionsSummaryTool(name, **kwargs))
26  return acc
27 
28 
29 def ITkStripConfigurationConditionsToolCfg(flags, name="ITkStripConfigurationConditionsTool", **kwargs):
30  # Load conditions configuration service and load folders and algorithm for it
31  # Load folders that have to exist for both MC and Data
32  from SCT_ConditionsAlgorithms.ITkStripConditionsAlgorithmsConfig import getITkStripDAQConfigFolder, ITkStripConfigurationCondAlgCfg
33  folder_path = getITkStripDAQConfigFolder(flags)
34 
35  cond_kwargs = {}
36  cond_kwargs["ChannelFolder"] = folder_path + ("Chip" if flags.IOVDb.DatabaseInstance == "COMP200" else "ChipSlim")
37  cond_kwargs["ModuleFolder"] = f"{folder_path}Module"
38  cond_kwargs["MurFolder"] = f"{folder_path}MUR"
39  cond_kwargs["dbInstance"] = "ITkStrip"
40  cond_kwargs["SCT_ConfigurationCondAlgName"] = "ITkStripConfigurationCondAlg"
41 
42  acc = ITkStripReadoutGeometryCfg(flags)
43 
44  if "ChannelFolderDB" not in cond_kwargs:
45  acc.merge(addFoldersSplitOnline(flags,
46  detDb=cond_kwargs["dbInstance"],
47  onlineFolders=cond_kwargs["ChannelFolder"],
48  offlineFolders=cond_kwargs["ChannelFolder"],
49  className="CondAttrListVec",
50  splitMC=True))
51  else:
52  acc.merge(addFolders(flags, [cond_kwargs["ChannelFolderDB"]], detDb=cond_kwargs["dbInstance"], className="CondAttrListVec"))
53  if "ModuleFolderDB" not in cond_kwargs:
54  acc.merge(addFoldersSplitOnline(flags,
55  detDb=cond_kwargs["dbInstance"],
56  onlineFolders=cond_kwargs["ModuleFolder"],
57  offlineFolders=cond_kwargs["ModuleFolder"],
58  className="CondAttrListVec",
59  splitMC=True))
60  else:
61  acc.merge(addFolders(flags, [cond_kwargs["ModuleFolderDB"]], detDb=cond_kwargs["dbInstance"], className="CondAttrListVec"))
62  if "MurFolderDB" not in cond_kwargs:
63  acc.merge(addFoldersSplitOnline(flags,
64  detDb=cond_kwargs["dbInstance"],
65  onlineFolders=cond_kwargs["MurFolder"],
66  offlineFolders=cond_kwargs["MurFolder"],
67  className="CondAttrListVec",
68  splitMC=True))
69  else:
70  acc.merge(addFolders(flags, [cond_kwargs["MurFolderDB"]], detDb=cond_kwargs["dbInstance"], className="CondAttrListVec"))
71 
72  ConfigCondAlg_kwargs = {}
73  ConfigCondAlg_kwargs["ReadKeyChannel"] = cond_kwargs["ChannelFolder"]
74  ConfigCondAlg_kwargs["ReadKeyModule"] = cond_kwargs["ModuleFolder"]
75  ConfigCondAlg_kwargs["ReadKeyMur"] = cond_kwargs["MurFolder"]
76  acc.merge(ITkStripConfigurationCondAlgCfg(flags, name="ITkStripConfigurationCondAlg", **ConfigCondAlg_kwargs))
77 
78  acc.setPrivateTools(CompFactory.SCT_ConfigurationConditionsTool(name, **kwargs))
79  return acc
80 
81 
82 def ITkStripDCSConditionsCfg(flags, name="ITkStripDCSConditions", **kwargs):
83  """Return a ComponentAccumulator configured for ITk Strip DCS Conditions"""
84  from SCT_ConditionsTools.SCT_ConditionsToolsConfig import SCT_DCSConditionsCfg
85  return SCT_DCSConditionsCfg(flags, name, ReturnHVTemp=False, #do not use DCS conditions until they're ready for ITk
86  **kwargs)
87 
88 
89 
90 def ITkStripFlaggedConditionToolCfg(flags, name="ITkStripFlaggedConditionTool", **kwargs):
91  acc = ITkStripReadoutGeometryCfg(flags)
92  acc.setPrivateTools(CompFactory.SCT_FlaggedConditionTool(name, **kwargs))
93  return acc
94 
95 
96 def ITkStripModuleVetoCfg(flags, name="ITkStripModuleVeto", **kwargs):
97  """Return a ComponentAccumulator configured for ITkStripModuleVetoTool
98  """
99  # For SCT_ID used in SCT_ModuleVetoTool
100  acc = GeoModelCfg(flags)
101 
102 
103  kwargs.setdefault("useDB", False)
104  kwargs.setdefault("BadModuleIdentifiers", [])
105 
106  if kwargs["useDB"]:
107  kwargs.setdefault("BadModuleIdentifiers", ["database"])
108  # Condition folder
109  acc.merge(addFolders(flags,
110  folderStrings="/ITk/Manual/BadModules",
111  detDb="OFLP200",
112  className="AthenaAttributeList",
113  tag=kwargs["folderTag"]))
114  # Condition algorithm
115  acc.addCondAlgo(CompFactory.SCT_ModuleVetoCondAlg())
116 
117  # Condition tool
118  toolArgs = {}
119  toolArgs["JsonPath"] = flags.ITk.JsonPathStripModuleVeto
120  toolArgs["BadModuleIdentifiers"] = kwargs["BadModuleIdentifiers"]
121  acc.setPrivateTools(CompFactory.SCT_ModuleVetoTool(name=f"{name}Tool", **toolArgs))
122 
123  return acc
124 
125 
126 def ITkStripMonitorConditionsToolCfg(flags, name="ITkStripMonitorConditionsTool", cond_kwargs={}, **kwargs):
127  cond_kwargs.setdefault("Folder", "/ITkStrip/Derived/Monitoring")
128  cond_kwargs.setdefault("dbInstance", "ITkStrip_OFL")
129  cond_kwargs.setdefault("MonitorCondAlgName", "ITkStripMonitorCondAlg")
130 
131  kwargs.setdefault("CondKey", "ITkStripMonitorCondData")
132 
133  acc = ITkStripReadoutGeometryCfg(flags)
134 
135  if "FolderDb" not in cond_kwargs:
136  cond_kwargs["FolderDb"] = cond_kwargs["Folder"]
137  acc.merge(addFolders(flags, cond_kwargs["FolderDb"], cond_kwargs["dbInstance"], className="CondAttrListCollection"))
138 
139  acc.addCondAlgo(CompFactory.SCT_MonitorCondAlg(name=cond_kwargs["MonitorCondAlgName"],
140  ReadKey=cond_kwargs["Folder"],
141  WriteKey=kwargs["CondKey"]))
142 
143  acc.setPrivateTools(CompFactory.SCT_MonitorConditionsTool(name, **kwargs))
144  return acc
145 
146 
147 def ITkStripReadCalibDataToolCfg(flags, name="ITkStripReadCalibDataTool", cond_kwargs={}, **kwargs):
148  acc = ITkStripReadoutGeometryCfg(flags)
149 
150  cond_kwargs.setdefault("NoiseFolder","/ITkStrip/DAQ/Calibration/NoiseOccupancyDefects")
151  cond_kwargs.setdefault("GainFolder","/ITkStrip/DAQ/Calibration/NPtGainDefects")
152  cond_kwargs.setdefault("ReadCalibDataCondAlgName","ITkStripReadCalibDataCondAlg")
153 
154  acc.merge(addFoldersSplitOnline(flags,
155  detDb="ITkStrip",
156  onlineFolders=cond_kwargs["NoiseFolder"],
157  offlineFolders=cond_kwargs["NoiseFolder"],
158  className="CondAttrListCollection",
159  splitMC=True))
160  acc.merge(addFoldersSplitOnline(flags,
161  detDb="ITkStrip",
162  onlineFolders=cond_kwargs["GainFolder"],
163  offlineFolders=cond_kwargs["GainFolder"],
164  className="CondAttrListCollection",
165  splitMC=True))
166 
167  acc.addCondAlgo(CompFactory.SCT_ReadCalibDataCondAlg(name=cond_kwargs["ReadCalibDataCondAlgName"],
168  ReadKeyGain=cond_kwargs["GainFolder"],
169  ReadKeyNoise=cond_kwargs["NoiseFolder"]))
170 
171  from SCT_Cabling.ITkStripCablingConfig import ITkStripCablingToolCfg
172  kwargs.setdefault("SCT_CablingTool", acc.popToolsAndMerge(ITkStripCablingToolCfg(flags)))
173 
174  acc.setPrivateTools(CompFactory.SCT_ReadCalibDataTool(name, **kwargs))
175  return acc
176 
177 
178 def ITkStripReadoutToolCfg(flags, name="ITkStripReadoutTool", **kwargs):
179  from SCT_Cabling.ITkStripCablingConfig import ITkStripCablingToolCfg
180  acc = ITkStripCablingToolCfg(flags)
181  kwargs.setdefault("SCT_CablingTool", acc.popPrivateTools())
182  acc.setPrivateTools(CompFactory.SCT_ReadoutTool(name, **kwargs))
183  return acc
184 
185 
186 def ITkStripSiliconConditionsCfg(flags, name="ITkStripSilicon", **kwargs):
187  """Return a ComponentAccumulator configured for ITk Strip SiliconConditions"""
188  acc = ComponentAccumulator()
189 
190  kwargs["DCSConditionsTool"] = acc.popToolsAndMerge(ITkStripDCSConditionsCfg(flags))
191 
192  from SCT_ConditionsTools.SCT_ConditionsToolsConfig import SCT_SiliconConditionsCfg
193  acc.setPrivateTools(acc.popToolsAndMerge(SCT_SiliconConditionsCfg(flags, name, useDCS = False, **kwargs)))
194  return acc
195 
196 
197 def ITkStripTdaqEnabledToolCfg(flags, name="ITkStripTdaqEnabledTool", **kwargs):
198  # For SCT_ID used in SCT_TdaqEnabledTool
199  acc = GeoModelCfg(flags)
200 
201  # Folder
202  # FIXME - is there a better way to do this?
203  folder = "/TDAQ/Resources/ATLAS/ITkStrip/Robins" if flags.IOVDb.DatabaseInstance == "CONDBR2" else "/TDAQ/EnabledResources/ATLAS/ITkStrip/Robins"
204  acc.merge(addFolders(flags, [folder], detDb="TDAQ", className="CondAttrListCollection"))
205 
206  # Algorithm
207  from SCT_Cabling.ITkStripCablingConfig import ITkStripCablingToolCfg
208  kwargs.setdefault("SCT_CablingTool", acc.popToolsAndMerge(ITkStripCablingToolCfg(flags)))
209  acc.addCondAlgo(CompFactory.SCT_TdaqEnabledCondAlg(**kwargs))
210 
211  # Tool
212  acc.setPrivateTools(CompFactory.SCT_TdaqEnabledTool(name))
213  return acc
python.ITkStripConditionsToolsConfig.ITkStripDCSConditionsCfg
def ITkStripDCSConditionsCfg(flags, name="ITkStripDCSConditions", **kwargs)
Definition: ITkStripConditionsToolsConfig.py:82
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.ITkStripConditionsToolsConfig.ITkStripFlaggedConditionToolCfg
def ITkStripFlaggedConditionToolCfg(flags, name="ITkStripFlaggedConditionTool", **kwargs)
Definition: ITkStripConditionsToolsConfig.py:90
python.ITkStripConditionsToolsConfig.ITkStripByteStreamErrorsToolCfg
def ITkStripByteStreamErrorsToolCfg(flags, name="ITkStripByteStreamErrorsTool", **kwargs)
Definition: ITkStripConditionsToolsConfig.py:9
ITkStripGeoModelConfig.ITkStripReadoutGeometryCfg
def ITkStripReadoutGeometryCfg(flags)
Definition: ITkStripGeoModelConfig.py:39
python.SCT_ConditionsToolsConfig.SCT_DCSConditionsCfg
def SCT_DCSConditionsCfg(flags, name="InDetSCT_DCSConditions", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:192
python.ITkStripConditionsToolsConfig.ITkStripReadoutToolCfg
def ITkStripReadoutToolCfg(flags, name="ITkStripReadoutTool", **kwargs)
Definition: ITkStripConditionsToolsConfig.py:178
python.ITkStripConditionsToolsConfig.ITkStripModuleVetoCfg
def ITkStripModuleVetoCfg(flags, name="ITkStripModuleVeto", **kwargs)
Definition: ITkStripConditionsToolsConfig.py:96
python.ITkStripCablingConfig.ITkStripCablingToolCfg
def ITkStripCablingToolCfg(flags, name="ITkStripCablingTool")
Definition: ITkStripCablingConfig.py:33
python.ITkStripConditionsToolsConfig.ITkStripConfigurationConditionsToolCfg
def ITkStripConfigurationConditionsToolCfg(flags, name="ITkStripConfigurationConditionsTool", **kwargs)
Definition: ITkStripConditionsToolsConfig.py:29
python.IOVDbSvcConfig.addFolders
def addFolders(flags, folderStrings, detDb=None, className=None, extensible=False, tag=None, db=None, modifiers='')
Definition: IOVDbSvcConfig.py:72
python.ITkStripConditionsToolsConfig.ITkStripSiliconConditionsCfg
def ITkStripSiliconConditionsCfg(flags, name="ITkStripSilicon", **kwargs)
Definition: ITkStripConditionsToolsConfig.py:186
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.ITkStripConditionsToolsConfig.ITkStripMonitorConditionsToolCfg
def ITkStripMonitorConditionsToolCfg(flags, name="ITkStripMonitorConditionsTool", cond_kwargs={}, **kwargs)
Definition: ITkStripConditionsToolsConfig.py:126
python.ITkStripConditionsAlgorithmsConfig.getITkStripDAQConfigFolder
def getITkStripDAQConfigFolder(flags)
Definition: ITkStripConditionsAlgorithmsConfig.py:27
python.ITkStripConditionsToolsConfig.ITkStripConditionsSummaryToolCfg
def ITkStripConditionsSummaryToolCfg(flags, name="ITkStripConditionsSummaryTool", **kwargs)
Definition: ITkStripConditionsToolsConfig.py:16
python.ITkStripConditionsToolsConfig.ITkStripTdaqEnabledToolCfg
def ITkStripTdaqEnabledToolCfg(flags, name="ITkStripTdaqEnabledTool", **kwargs)
Definition: ITkStripConditionsToolsConfig.py:197
python.SCT_ConditionsToolsConfig.SCT_SiliconConditionsCfg
def SCT_SiliconConditionsCfg(flags, name="SCT_Silicon", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:451
python.ITkStripConditionsAlgorithmsConfig.ITkStripConfigurationCondAlgCfg
def ITkStripConfigurationCondAlgCfg(flags, name="ITkStripConfigurationCondAlg", **kwargs)
Definition: ITkStripConditionsAlgorithmsConfig.py:31
python.ITkStripConditionsToolsConfig.ITkStripReadCalibDataToolCfg
def ITkStripReadCalibDataToolCfg(flags, name="ITkStripReadCalibDataTool", cond_kwargs={}, **kwargs)
Definition: ITkStripConditionsToolsConfig.py:147
python.GeoModelConfig.GeoModelCfg
def GeoModelCfg(flags)
Definition: GeoModelConfig.py:16