ATLAS Offline Software
PixelConditionsConfig.py
Go to the documentation of this file.
1 """Define functions to configure Pixel conditions algorithms
2 
3 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
4 """
5 from AthenaConfiguration.AccumulatorCache import AccumulatorCache
6 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7 from AthenaConfiguration.ComponentFactory import CompFactory
8 from AthenaConfiguration.Enums import BeamType, LHCPeriod, Format
9 from IOVDbSvc.IOVDbSvcConfig import addFolders,addFoldersSplitOnline
10 
11 def PixelConfigCondAlgCfg(flags, name="PixelConfigCondAlg", **kwargs):
12  """Return a ComponentAccumulator with configured PixelConfigCondAlg"""
13  acc = ComponentAccumulator()
14 
15  # FIXME commented properties are not currently accepted by PixelConfigCondAlg
16  CondArgs = {}
17  if flags.Beam.Type is BeamType.Cosmics:
18  CondArgs.update(
19  BarrelTimeJitter=[25.0,25.0,25.0,25.0],
20  EndcapTimeJitter=[25.0,25.0,25.0],
21  DBMTimeJitter=[25.0,25.0,25.0],
22  BarrelNumberOfBCID=[8,8,8,8],
23  EndcapNumberOfBCID=[8,8,8],
24  DBMNumberOfBCID=[8,8,8],
25  BarrelTimeOffset=[100.0,100.0,100.0,100.0],
26  EndcapTimeOffset=[100.0,100.0,100.0],
27  DBMTimeOffset=[100.0,100.0,100.0]
28  )
29 
30  CondArgs.update(
31  PixelParameterConditionsFolder=flags.InDet.PixelConfig.version,
32  UsePrivateFileName=flags.InDet.PixelConfig.UserInputFileName
33  )
34 
35  # Cabling parameters
36  IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_2016.dat"
37  if flags.Input.isMC:
38  # ITk:
39  if flags.GeoModel.Run >= LHCPeriod.Run4: # RUN4 and beyond
40  IdMappingDat = "ITk_Atlas_IdMapping.dat"
41  elif flags.GeoModel.Run in [LHCPeriod.Run2, LHCPeriod.Run3]:
42  # Planar IBL
43  if flags.GeoModel.IBLLayout == "planar":
44  if flags.GeoModel.Run is LHCPeriod.Run2:
45  IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_inclIBL_DBM.dat"
46  else:
47  IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_inclIBL.dat"
48  # Hybrid IBL plus DBM
49  elif flags.GeoModel.IBLLayout == "3D":
50  IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_Run2.dat"
51  else:
52  IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping.dat"
53  elif not flags.Input.RunNumbers:
54  IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_344494.dat"
55  else:
56  runNum = flags.Input.RunNumbers[0]
57  if runNum < 222222:
58  IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_May08.dat"
59  else:
60  # Even though we are reading from COOL, set the correct fallback map.
61  if (runNum >= 344494):
62  IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_344494.dat"
63  elif (runNum >= 314940 and runNum < 344494):
64  IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_314940.dat"
65  elif (runNum >= 289350 and runNum < 314940): # 2016
66  IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_2016.dat"
67  elif (runNum >= 222222 and runNum < 289350): # 2015
68  IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_Run2.dat"
69  else:
70  IdMappingDat="PixelCabling/Pixels_Atlas_IdMapping_344494.dat"
71 
72  CondArgs.update(
73  CablingMapFileName=IdMappingDat
74  )
75 
76  # set default kwargs
77  CondArgs.update(kwargs)
78  acc.addCondAlgo(CompFactory.PixelConfigCondAlg(name, **CondArgs))
79  return acc
80 
81 @AccumulatorCache
82 def PixelAlignCondAlgCfg(flags, name="PixelAlignCondAlg", **kwargs):
83  """Return a ComponentAccumulator with configured PixelAlignCondAlg"""
84  from PixelGeoModel.PixelGeoModelConfig import PixelGeoModelCfg
85  acc = PixelGeoModelCfg(flags)
86 
87  if flags.GeoModel.Align.Dynamic:
88  acc.merge(addFoldersSplitOnline(flags,"INDET",
89  ["/Indet/Onl/AlignL1/ID","/Indet/Onl/AlignL2/PIX"],
90  ["/Indet/AlignL1/ID","/Indet/AlignL2/PIX"],
91  className="CondAttrListCollection"))
92  acc.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/AlignL3","/Indet/AlignL3",className="AlignableTransformContainer"))
93  else:
94  acc.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/Align","/Indet/Align",className="AlignableTransformContainer"))
95 
96  acc.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/IBLDist","/Indet/IBLDist",className="CondAttrListCollection"))
97 
98  kwargs.setdefault("UseDynamicAlignFolders", flags.GeoModel.Align.Dynamic)
99  kwargs.setdefault("ReadKeyStatic", "/Indet/Align")
100  kwargs.setdefault("ReadKeyDynamicL1", "/Indet/AlignL1/ID")
101  kwargs.setdefault("ReadKeyDynamicL2", "/Indet/AlignL2/PIX")
102  kwargs.setdefault("ReadKeyDynamicL3", "/Indet/AlignL3")
103  kwargs.setdefault("ReadKeyIBLDist", "/Indet/IBLDist")
104  kwargs.setdefault("WriteKey", "PixelAlignmentStore")
105 
106  acc.addCondAlgo(CompFactory.PixelAlignCondAlg(name, **kwargs))
107  return acc
108 
109 def PixelCablingCondAlgCfg(flags, name="PixelCablingCondAlg", **kwargs):
110  """Return a ComponentAccumulator with configured PixelCablingCondAlg"""
111  acc = ComponentAccumulator()
112  acc.merge(PixelConfigCondAlgCfg(flags))
113  acc.merge(PixelReadoutSpeedAlgCfg(flags))
114 
115  from AthenaConfiguration.Enums import LHCPeriod
116 
117  if not flags.Input.isMC and not flags.Overlay.DataOverlay and not flags.GeoModel.Run < LHCPeriod.Run2 :
118  acc.merge(addFoldersSplitOnline(flags, "PIXEL", "/PIXEL/Onl/CablingMap","/PIXEL/CablingMap", className="AthenaAttributeList"))
119  kwargs.setdefault("ReadKey", "/PIXEL/CablingMap")
120  if flags.Input.RunNumbers and flags.Input.RunNumbers[0]<222222:
121  kwargs.setdefault("ReadKey", "")
122  else:
123  kwargs.setdefault("ReadKey", "")
124  kwargs.setdefault("PixelModuleData", "PixelModuleData")
125  kwargs.setdefault("PixelReadoutSpeedData", "PixelReadoutSpeedData")
126  kwargs.setdefault("WriteKey", "PixelCablingCondData")
127  acc.addCondAlgo(CompFactory.PixelCablingCondAlg(name, **kwargs))
128  return acc
129 
130 def PixelChargeCalibCondAlgCfg(flags, name="PixelChargeCalibCondAlg", **kwargs):
131  """Return a ComponentAccumulator with configured PixelChargeCalibCondAlg"""
132  acc = ComponentAccumulator()
133  acc.merge(PixelConfigCondAlgCfg(flags))
134  PixCalibFolder = 'ChargeCalibration'
135  from PixelGeoModel.PixelGeoModelConfig import PixelReadoutGeometryCfg
136  acc.merge(PixelReadoutGeometryCfg(flags))
137  kwargs.setdefault("PixelDetEleCollKey", "PixelDetectorElementCollection")
138  kwargs.setdefault("PixelModuleData", "PixelModuleData")
139  if flags.GeoModel.Run is LHCPeriod.Run2:
140  acc.merge(addFoldersSplitOnline(flags, "PIXEL", "/PIXEL/Onl/"+PixCalibFolder, "/PIXEL/"+PixCalibFolder, className="CondAttrListCollection"))
141  kwargs.setdefault("ReadKey", "/PIXEL/"+PixCalibFolder)
142  else:
143  kwargs.setdefault("ReadKey", "") # FIXME: temporarily disabling DB access for Run 1 due to crashes
144  kwargs.setdefault("WriteKey", "PixelChargeCalibCondData")
145  acc.addCondAlgo(CompFactory.PixelChargeCalibCondAlg(name, **kwargs))
146  return acc
147 
148 def PixelChargeLUTCalibCondAlgCfg(flags, name="PixelChargeLUTCalibCondAlg", **kwargs):
149  """Return a ComponentAccumulator with configured PixelChargeLUTCalibCondAlg"""
150  acc = ComponentAccumulator()
151  acc.merge(PixelConfigCondAlgCfg(flags))
152  acc.merge(addFoldersSplitOnline(flags, "PIXEL", "/PIXEL/Onl/ChargeCalibration", "/PIXEL/ChargeCalibration", className="CondAttrListCollection"))
153  from PixelGeoModel.PixelGeoModelConfig import PixelReadoutGeometryCfg
154  acc.merge(PixelReadoutGeometryCfg(flags))
155  kwargs.setdefault("PixelDetEleCollKey", "PixelDetectorElementCollection")
156  kwargs.setdefault("PixelModuleData", "PixelModuleData")
157  kwargs.setdefault("ReadKey", "/PIXEL/ChargeCalibration")
158  kwargs.setdefault("WriteKey", "PixelChargeCalibCondData")
159  acc.addCondAlgo(CompFactory.PixelChargeLUTCalibCondAlg(name, **kwargs))
160  return acc
161 
162 def PixelDCSCondHVAlgCfg(flags, name="PixelDCSCondHVAlg", **kwargs):
163  """Return a ComponentAccumulator with configured PixelDCSCondHVAlg"""
164  acc = ComponentAccumulator()
165  acc.merge(PixelConfigCondAlgCfg(flags))
166  if flags.Common.isOnline:
167  kwargs.update( ReadKey="/PIXEL/HLT/DCS/HV")
168  acc.merge(addFolders(flags, kwargs["ReadKey"], "PIXEL_ONL", className="CondAttrListCollection"))
169  else:
170  kwargs.update( ReadKey="/PIXEL/DCS/HV")
171  acc.merge(addFolders(flags, kwargs["ReadKey"], "DCS_OFL", className="CondAttrListCollection"))
172 
173  kwargs.setdefault("WriteKey", "PixelDCSHVCondData")
174  acc.addCondAlgo(CompFactory.PixelDCSCondHVAlg(name, **kwargs))
175  return acc
176 
177 def PixelDCSCondStateAlgCfg(flags, name="PixelDCSCondStateAlg", **kwargs):
178  """Return a ComponentAccumulator with configured PixelDCSCondStateAlg"""
179  acc = ComponentAccumulator()
180  if not flags.Input.isMC and not flags.Overlay.DataOverlay and flags.InDet.usePixelDCS:
181  acc.merge(addFolders(flags, "/PIXEL/DCS/FSMSTATE", "DCS_OFL", className="CondAttrListCollection"))
182  kwargs.setdefault("ReadKeyState", "/PIXEL/DCS/FSMSTATE")
183  else:
184  kwargs.setdefault("ReadKeyState", "")
185  kwargs.setdefault("WriteKeyState", "PixelDCSStateCondData")
186  acc.addCondAlgo(CompFactory.PixelDCSCondStateAlg(name, **kwargs))
187  return acc
188 
189 def PixelDCSCondStatusAlgCfg(flags, name="PixelDCSCondStatusAlg", **kwargs):
190  """Return a ComponentAccumulator with configured PixelDCSCondStatusAlg"""
191  acc = ComponentAccumulator()
192  if not flags.Input.isMC and not flags.Overlay.DataOverlay and flags.InDet.usePixelDCS:
193  acc.merge(addFolders(flags, "/PIXEL/DCS/FSMSTATUS", "DCS_OFL", className="CondAttrListCollection"))
194  kwargs.setdefault("ReadKeyStatus", "/PIXEL/DCS/FSMSTATUS")
195  else:
196  kwargs.setdefault("ReadKeyStatus", "")
197  kwargs.setdefault("WriteKeyStatus", "PixelDCSStatusCondData")
198  acc.addCondAlgo(CompFactory.PixelDCSCondStatusAlg(name, **kwargs))
199  return acc
200 
201 def PixelDCSCondTempAlgCfg(flags, name="PixelDCSCondTempAlg", **kwargs):
202  """Return a ComponentAccumulator with configured PixelDCSCondTempAlg"""
203  acc = ComponentAccumulator()
204  acc.merge(PixelConfigCondAlgCfg(flags))
205  if flags.Common.isOnline:
206  kwargs.setdefault("ReadKey", "/PIXEL/HLT/DCS/TEMPERATURE")
207  acc.merge(addFolders(flags, kwargs["ReadKey"], "PIXEL_ONL", className="CondAttrListCollection"))
208  else:
209  kwargs.setdefault("ReadKey", "/PIXEL/DCS/TEMPERATURE")
210  acc.merge(addFolders(flags, kwargs["ReadKey"], "DCS_OFL", className="CondAttrListCollection"))
211  kwargs.setdefault("WriteKey", "PixelDCSTempCondData")
212  acc.addCondAlgo(CompFactory.PixelDCSCondTempAlg(name, **kwargs))
213  return acc
214 
215 def PixelDeadMapCondAlgCfg(flags, name="PixelDeadMapCondAlg", **kwargs):
216  """Return a ComponentAccumulator with configured PixelDeadMapCondAlg"""
217  acc = ComponentAccumulator()
218  acc.merge(PixelConfigCondAlgCfg(flags))
219  if flags.GeoModel.Run is LHCPeriod.Run1:
220  kwargs.setdefault("ReadKey", "")
221  else:
222  kwargs.setdefault("ReadKey", "/PIXEL/PixelModuleFeMask")
223  acc.merge(addFoldersSplitOnline(flags, "PIXEL", "/PIXEL/Onl/PixelModuleFeMask", "/PIXEL/PixelModuleFeMask", className="CondAttrListCollection"))
224  kwargs.setdefault("WriteKey", "PixelDeadMapCondData")
225  acc.addCondAlgo(CompFactory.PixelDeadMapCondAlg(name, **kwargs))
226  return acc
227 
228 def PixelDetectorElementCondAlgCfg(flags, name="PixelDetectorElementCondAlg", **kwargs):
229  """Return a ComponentAccumulator with configured PixelDetectorElementCondAlg"""
230  acc = ComponentAccumulator()
231  acc.merge(PixelAlignCondAlgCfg(flags))
232 
233  kwargs.setdefault("PixelAlignmentStore", "PixelAlignmentStore")
234  kwargs.setdefault("WriteKey", "PixelDetectorElementCollection")
235 
236  # FIXME
237  # add artifical dependencies to SCT, TRT and Muon
238  # conditions algs to ensure that the IOV
239  # is identical to the IOV of the tracking geometry
240  if flags.Detector.GeometryMuon and flags.Muon.enableAlignment:
241  from MuonConfig.MuonGeometryConfig import MuonGeoModelCfg
242  acc.merge(MuonGeoModelCfg(flags))
243  kwargs.setdefault("MuonManagerKey", "MuonDetectorManager")
244  if flags.Detector.GeometryTRT:
245  from TRT_GeoModel.TRT_GeoModelConfig import TRT_ReadoutGeometryCfg
246  acc.merge(TRT_ReadoutGeometryCfg(flags))
247  kwargs.setdefault("TRT_DetEltContKey", "TRT_DetElementContainer")
248  if not flags.GeoModel.Align.LegacyConditionsAccess and flags.Detector.GeometrySCT:
249  from SCT_GeoModel.SCT_GeoModelConfig import SCT_AlignmentCfg
250  acc.merge(SCT_AlignmentCfg(flags))
251  kwargs.setdefault("SCTAlignmentStore", "SCTAlignmentStore")
252  # end of hack
253 
254  acc.addCondAlgo(CompFactory.PixelDetectorElementCondAlg(name, **kwargs))
255  return acc
256 
257 def PixelDistortionAlgCfg(flags, name="PixelDistortionAlg", **kwargs):
258  """Return a ComponentAccumulator with configured PixelDistortionAlg"""
259  acc = ComponentAccumulator()
260  acc.merge(PixelConfigCondAlgCfg(flags))
261  acc.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/PixelDist","/Indet/PixelDist",className="DetCondCFloat"))
262  kwargs.setdefault("ReadKey", "/Indet/PixelDist")
263  kwargs.setdefault("WriteKey", "PixelDistortionData")
264  from RngComps.RngCompsConfig import AthRNGSvcCfg
265  kwargs.setdefault("RndmSvc", acc.getPrimaryAndMerge(AthRNGSvcCfg(flags)).name)
266  acc.addCondAlgo(CompFactory.PixelDistortionAlg(name, **kwargs))
267  return acc
268 
269 def PixelHitDiscCnfgAlgCfg(flags, name="PixelHitDiscCnfgAlg", **kwargs):
270  """Return a ComponentAccumulator with configured PixelHitDiscCnfgAlg"""
271  acc = ComponentAccumulator()
272  acc.merge(PixelConfigCondAlgCfg(flags))
273  # not for Run-1 data/MC
274  if flags.GeoModel.IBLLayout in ("noIBL", "UNDEFINED"):
275  return acc
276  if flags.IOVDb.DatabaseInstance == "CONDBR2":
277  acc.merge(addFolders(flags, "/PIXEL/HitDiscCnfg", "PIXEL", className="AthenaAttributeList"))
278  elif flags.Input.isMC and flags.GeoModel.Run in [LHCPeriod.Run2, LHCPeriod.Run3]:
279  acc.merge(addFoldersSplitOnline(flags,"PIXEL","/PIXEL/HitDiscCnfg","/PIXEL/HitDiscCnfg", className="AthenaAttributeList"))
280  kwargs.setdefault("ReadKey", "/PIXEL/HitDiscCnfg")
281  kwargs.setdefault("WriteKey", "PixelHitDiscCnfgData")
282  acc.addCondAlgo(CompFactory.PixelHitDiscCnfgAlg(name, **kwargs))
283  return acc
284 
285 def PixelOfflineCalibCondAlgCfg(flags, name="PixelOfflineCalibCondAlg", **kwargs):
286  """Return a ComponentAccumulator with configured PixelOfflineCalibCondAlg"""
287  acc = ComponentAccumulator()
288  acc.merge(addFoldersSplitOnline(flags, "PIXEL", "/PIXEL/Onl/PixReco", "/PIXEL/PixReco", className="DetCondCFloat"))
289  kwargs.setdefault("InputSource", 2)
290  kwargs.setdefault("PixelClusterErrorDataFile", "PixelClusterErrorData.txt")
291  kwargs.setdefault("PixelClusterOnTrackErrorDataFile", "PixelClusterOnTrackErrorData.txt")
292  kwargs.setdefault("PixelChargeInterpolationDataFile", "PixelChargeInterpolationData.txt")
293  kwargs.setdefault("DumpConstants", 0)
294  kwargs.setdefault("ReadKey", "/PIXEL/PixReco")
295  kwargs.setdefault("WriteKey", "PixelOfflineCalibData")
296  acc.addCondAlgo(CompFactory.PixelOfflineCalibCondAlg(name, **kwargs))
297  return acc
298 
299 def PixelReadoutSpeedAlgCfg(flags, name="PixelReadoutSpeedAlg", **kwargs):
300  """Return a ComponentAccumulator with configured PixelReadoutSpeedAlg"""
301  acc = ComponentAccumulator()
302  if not flags.Input.isMC:
303  acc.merge(addFolders(flags, "/PIXEL/ReadoutSpeed", "PIXEL", className="AthenaAttributeList"))
304  else:
305  acc.merge(addFoldersSplitOnline(flags, "PIXEL","/PIXEL/ReadoutSpeed","/PIXEL/ReadoutSpeed", className="AthenaAttributeList"))
306  kwargs.setdefault("ReadKey", "/PIXEL/ReadoutSpeed")
307  kwargs.setdefault("WriteKey", "PixelReadoutSpeedData")
308  acc.addCondAlgo(CompFactory.PixelReadoutSpeedAlg(name, **kwargs))
309  return acc
310 
311 def PixelRadSimFluenceMapAlgCfg(flags, name="PixelRadSimFluenceMapAlg", **kwargs):
312  """Return a ComponentAccumulator with configured PixelRadSimFluenceMapAlg"""
313  acc = ComponentAccumulator()
314  acc.merge(PixelConfigCondAlgCfg(flags))
315  kwargs.setdefault("PixelModuleData", "PixelModuleData")
316  kwargs.setdefault("WriteRadiationFluenceMapKey", "PixelRadiationDamageFluenceMapData")
317  acc.addCondAlgo(CompFactory.PixelRadSimFluenceMapAlg(name, **kwargs))
318  return acc
319 
320 def PixeldEdxAlgCfg(flags, name="PixeldEdxAlg", **kwargs):
321  """Return a ComponentAccumulator with configured PixeldEdxAlg"""
322  acc = ComponentAccumulator()
323  acc.merge(addFoldersSplitOnline(flags, "PIXEL", "/PIXEL/Onl/PixdEdx", "/PIXEL/PixdEdx", className='AthenaAttributeList'))
324  acc.addCondAlgo(CompFactory.PixeldEdxAlg(name, ReadFromCOOL = True, **kwargs))
325  return acc
326 
327 def PixelSiliconConditionsTestAlgCfg(flags, name="PixelSiliconConditionsTestAlg", **kwargs):
328  """Return a ComponentAccumulator with configured PixelSiliconConditionsTestAlg"""
329  acc = ComponentAccumulator()
330  acc.merge(PixelDCSCondTempAlgCfg(flags))
331  acc.merge(PixelDCSCondHVAlgCfg(flags))
332  acc.merge(PixelChargeCalibCondCfg(flags))
333  acc.merge(PixelDistortionAlgCfg(flags))
334  from SiLorentzAngleTool.PixelLorentzAngleConfig import PixelLorentzAngleToolCfg
335  kwargs.setdefault("LorentzAngleTool", acc.popToolsAndMerge(PixelLorentzAngleToolCfg(flags)))
336  acc.addEventAlgo(CompFactory.PixelSiliconConditionsTestAlg(name, **kwargs))
337  return acc
338 
339 def PixelDetectorElementStatusCondAlgActiveOnlyCfg(flags, name = "PixelDetectorElementStatusCondAlgNoByteStreamErrorActiveOnly", **kwargs) :
340  '''
341  Condition alg to precompute the pixel detector element status.
342  this algo does not consider the DCS status (and the byte stream errors which are event data)
343  '''
344  acc = ComponentAccumulator()
345  if 'ConditionsSummaryTool' not in kwargs :
346  from PixelConditionsTools.PixelConditionsSummaryConfig import PixelConditionsSummaryToolNoByteStreamErrorsActiveOnlyCfg
347  kwargs.setdefault("ConditionsSummaryTool", acc.popToolsAndMerge( PixelConditionsSummaryToolNoByteStreamErrorsActiveOnlyCfg(flags)))
348  kwargs.setdefault( "WriteKey", "PixelDetectorElementStatusNoByteStreamActiveOnly")
349  acc.addCondAlgo( CompFactory.InDet.SiDetectorElementStatusCondAlg(name, **kwargs) )
350  return acc
351 
352 def PixelDetectorElementStatusCondAlgCfg(flags, name = "PixelDetectorElementStatusCondAlgNoByteStreamError", **kwargs) :
353  '''
354  Condition alg to precompute the create pixel detector element status which includes the DCS status
355  this algo does not consider the byte stream errors which are event data
356  '''
357  acc = ComponentAccumulator()
358  if 'ConditionsSummaryTool' not in kwargs :
360  from PixelConditionsTools.PixelConditionsSummaryConfig import PixelActiveDetectorElementStatusToolCfg
361  kwargs.setdefault("ConditionsSummaryTool", acc.popToolsAndMerge( PixelActiveDetectorElementStatusToolCfg(flags,
362  PixelDetElStatusCondDataBaseKey="PixelDetectorElementStatusNoByteStreamActiveOnly")) )
363  kwargs.setdefault("WriteKey", "PixelDetectorElementStatusNoByteStream")
364  acc.addCondAlgo( CompFactory.InDet.SiDetectorElementStatusCondAlg(name, **kwargs) )
365  return acc
366 
367 def PixelDetectorElementStatusAlgCfg(flags, name = "PixelDetectorElementStatusAlg", **kwargs) :
368  '''
369  Event alg which extends the pixel detector element status conditions data which does not consider the DCS status by the bytestream errors.
370  This alg however does only consider errors concerning the module activity, not general errors.
371  '''
372  acc = ComponentAccumulator()
373  active_only = kwargs.pop("ActiveOnly", False)
374  if 'ConditionsSummaryTool' not in kwargs and not active_only :
375  element_status_input=None
376  if flags.InDet.usePixelDCS:
377  acc.merge( PixelDetectorElementStatusCondAlgCfg(flags) )
378  element_status_input="PixelDetectorElementStatusNoByteStream"
379  else :
380  # without DCS PixelDetectorElementStatusNoByteStream and PixelDetectorElementStatusNoByteStreamActiveOnly
381  # are identically
383  element_status_input="PixelDetectorElementStatusNoByteStreamActiveOnly"
384  from PixelConditionsTools.PixelConditionsSummaryConfig import PixelByteStreamErrorDetectorElementStatusToolCfg
385  kwargs.setdefault("ConditionsSummaryTool",
386  acc.popToolsAndMerge(PixelByteStreamErrorDetectorElementStatusToolCfg(flags, PixelDetElStatusCondDataBaseKey=element_status_input) ))
387 
388  elif 'ConditionsSummaryTool' not in kwargs and active_only :
390  from PixelConditionsTools.PixelConditionsSummaryConfig import PixelByteStreamErrorDetectorElementStatusToolActiveOnlyCfg
391  kwargs.setdefault("ConditionsSummaryTool",
392  acc.popToolsAndMerge(PixelByteStreamErrorDetectorElementStatusToolActiveOnlyCfg(flags, PixelDetElStatusCondDataBaseKey="PixelDetectorElementStatusNoByteStreamActiveOnly")))
393 
394  kwargs.setdefault("WriteKey","PixelDetectorElementStatus")
395 
396  # This requires PixelByteStreamErrs provided by PixelRawDataProviderAlg
397  if flags.Input.Format is Format.BS:
398  from PixelRawDataByteStreamCnv.PixelRawDataByteStreamCnvConfig import (
399  PixelRawDataProviderAlgCfg)
400  acc.merge(PixelRawDataProviderAlgCfg(flags))
401 
402  acc.addEventAlgo( CompFactory.InDet.SiDetectorElementStatusAlg(name, **kwargs) )
403  return acc
404 
405 def PixelDetectorElementStatusAlgActiveOnlyCfg(flags, name = "PixelDetectorElementStatusAlgActiveOnly", **kwargs) :
406  '''
407  Event alg which extends the pixel detector element status conditions data which does not consider the DCS status by the bytestream errors.
408  This alg however does only consider errors concerning the module activity, not general errors.
409  '''
410  return PixelDetectorElementStatusAlgCfg(flags, name,
411  WriteKey = "PixelDetectorElementStatusActiveOnly",
412  ActiveOnly = True)
413 
414 
415 def PixelChargeCalibCondCfg(flags, **kwargs):
416  if flags.GeoModel.Run >= LHCPeriod.Run4:
417  from PixelConditionsAlgorithms.ITkPixelConditionsConfig import (
418  ITkPixelChargeCalibCondAlgCfg)
419  return ITkPixelChargeCalibCondAlgCfg(flags, **kwargs)
420  elif flags.GeoModel.Run == LHCPeriod.Run3:
421  return PixelChargeLUTCalibCondAlgCfg(flags, **kwargs)
422  return PixelChargeCalibCondAlgCfg(flags, **kwargs)
423 
425  """Force the job to use the Pixel Module-level mask implemented via the
426  FE-level masking code. See https://gitlab.cern.ch/atlas/athena/-/merge_requests/45356"""
427  from IOVDbSvc.IOVDbSvcConfig import addOverride
428  if (not flags.Input.isMC and flags.IOVDb.DatabaseInstance == 'CONDBR2'): # for data overlay
429  cfg.merge(addOverride(flags, '/PIXEL/PixelModuleFeMask', 'PixelModuleFeMask-RUN2-DATA-UPD4-05'))
430  else:
431  cfg.merge(addOverride(flags, '/PIXEL/PixelModuleFeMask', 'PixelModuleFeMask-SIM-MC16-000-03'))
432  return cfg
433 
434 
435 if __name__ == '__main__':
436  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
437  from AthenaConfiguration.AllConfigFlags import initConfigFlags
438  flags = initConfigFlags()
439  flags.fillFromArgs()
440 
441  from AthenaConfiguration.TestDefaults import defaultTestFiles
442  flags.Input.Files = defaultTestFiles.RAW_RUN2 # need to update this depending on EDMversion
443  flags.Exec.MaxEvents=5
444 
445  flags.lock()
446 
447  acc = MainServicesCfg(flags)
448  acc.merge( PixelDetectorElementCondAlgCfg(flags) )
449  acc.printConfig(withDetails=True)
450  with open("PixelConditions.pkl", "wb") as file:
451  acc.store(file)
452  # TODO decide if we want to run actually
453  sc = acc.run()
454  # if sc.isFailure():
455  # import sys
456  # sys.exit(-1)
457 
458 
PixelConditionsSummaryConfig.PixelActiveDetectorElementStatusToolCfg
def PixelActiveDetectorElementStatusToolCfg(flags, name="PixelActiveDetectorElementStatusTool", **kwargs)
Definition: PixelConditionsSummaryConfig.py:48
PixelConditionsConfig.PixelAlignCondAlgCfg
def PixelAlignCondAlgCfg(flags, name="PixelAlignCondAlg", **kwargs)
Definition: PixelConditionsConfig.py:82
PixelConditionsConfig.PixelDCSCondStateAlgCfg
def PixelDCSCondStateAlgCfg(flags, name="PixelDCSCondStateAlg", **kwargs)
Definition: PixelConditionsConfig.py:177
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
PixelConditionsConfig.PixelDCSCondStatusAlgCfg
def PixelDCSCondStatusAlgCfg(flags, name="PixelDCSCondStatusAlg", **kwargs)
Definition: PixelConditionsConfig.py:189
PixelConditionsConfig.PixelDCSCondTempAlgCfg
def PixelDCSCondTempAlgCfg(flags, name="PixelDCSCondTempAlg", **kwargs)
Definition: PixelConditionsConfig.py:201
SCT_GeoModelConfig.SCT_AlignmentCfg
def SCT_AlignmentCfg(flags)
Definition: SCT_GeoModelConfig.py:24
PixelConditionsConfig.PixelDeadMapCondAlgCfg
def PixelDeadMapCondAlgCfg(flags, name="PixelDeadMapCondAlg", **kwargs)
Definition: PixelConditionsConfig.py:215
TRT_GeoModelConfig.TRT_ReadoutGeometryCfg
def TRT_ReadoutGeometryCfg(flags)
Definition: TRT_GeoModelConfig.py:59
PixelConditionsConfig.PixelDistortionAlgCfg
def PixelDistortionAlgCfg(flags, name="PixelDistortionAlg", **kwargs)
Definition: PixelConditionsConfig.py:257
PixelConditionsConfig.PixelCablingCondAlgCfg
def PixelCablingCondAlgCfg(flags, name="PixelCablingCondAlg", **kwargs)
Definition: PixelConditionsConfig.py:109
PixelRawDataByteStreamCnvConfig.PixelRawDataProviderAlgCfg
def PixelRawDataProviderAlgCfg(flags, **kwargs)
Definition: PixelRawDataByteStreamCnvConfig.py:17
PixelConditionsConfig.PixelDCSCondHVAlgCfg
def PixelDCSCondHVAlgCfg(flags, name="PixelDCSCondHVAlg", **kwargs)
Definition: PixelConditionsConfig.py:162
PixelConditionsConfig.PixelChargeCalibCondCfg
def PixelChargeCalibCondCfg(flags, **kwargs)
Definition: PixelConditionsConfig.py:415
PixelConditionsSummaryConfig.PixelByteStreamErrorDetectorElementStatusToolCfg
def PixelByteStreamErrorDetectorElementStatusToolCfg(flags, name="PixelByteStreamErrorDetectorElementStatusTool", **kwargs)
Definition: PixelConditionsSummaryConfig.py:54
python.PixelLorentzAngleConfig.PixelLorentzAngleToolCfg
def PixelLorentzAngleToolCfg(flags, name="PixelLorentzAngleTool", **kwargs)
Definition: PixelLorentzAngleConfig.py:13
PixelConditionsConfig.PixelChargeLUTCalibCondAlgCfg
def PixelChargeLUTCalibCondAlgCfg(flags, name="PixelChargeLUTCalibCondAlg", **kwargs)
Definition: PixelConditionsConfig.py:148
PixelConditionsConfig.PixelDetectorElementStatusAlgActiveOnlyCfg
def PixelDetectorElementStatusAlgActiveOnlyCfg(flags, name="PixelDetectorElementStatusAlgActiveOnly", **kwargs)
Definition: PixelConditionsConfig.py:405
PixelConditionsConfig.PixelConfigCondAlgCfg
def PixelConfigCondAlgCfg(flags, name="PixelConfigCondAlg", **kwargs)
Definition: PixelConditionsConfig.py:11
PixelConditionsConfig.PixeldEdxAlgCfg
def PixeldEdxAlgCfg(flags, name="PixeldEdxAlg", **kwargs)
Definition: PixelConditionsConfig.py:320
python.IOVDbSvcConfig.addOverride
def addOverride(flags, folder, tag, db=None)
Definition: IOVDbSvcConfig.py:224
PixelGeoModelConfig.PixelGeoModelCfg
def PixelGeoModelCfg(flags)
Definition: PixelGeoModelConfig.py:5
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
PixelConditionsConfig.PixelDetectorElementCondAlgCfg
def PixelDetectorElementCondAlgCfg(flags, name="PixelDetectorElementCondAlg", **kwargs)
Definition: PixelConditionsConfig.py:228
PixelConditionsConfig.PixelChargeCalibCondAlgCfg
def PixelChargeCalibCondAlgCfg(flags, name="PixelChargeCalibCondAlg", **kwargs)
Definition: PixelConditionsConfig.py:130
python.IOVDbSvcConfig.addFolders
def addFolders(flags, folderStrings, detDb=None, className=None, extensible=False, tag=None, db=None, modifiers='')
Definition: IOVDbSvcConfig.py:72
PixelConditionsConfig.PixelDetectorElementStatusCondAlgCfg
def PixelDetectorElementStatusCondAlgCfg(flags, name="PixelDetectorElementStatusCondAlgNoByteStreamError", **kwargs)
Definition: PixelConditionsConfig.py:352
PixelConditionsConfig.PixelOfflineCalibCondAlgCfg
def PixelOfflineCalibCondAlgCfg(flags, name="PixelOfflineCalibCondAlg", **kwargs)
Definition: PixelConditionsConfig.py:285
PixelGeoModelConfig.PixelReadoutGeometryCfg
def PixelReadoutGeometryCfg(flags)
Definition: PixelGeoModelConfig.py:52
PixelConditionsConfig.PixelReadoutSpeedAlgCfg
def PixelReadoutSpeedAlgCfg(flags, name="PixelReadoutSpeedAlg", **kwargs)
Definition: PixelConditionsConfig.py:299
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
PixelConditionsConfig.PostInclude_UsePixelModuleLevelMask
def PostInclude_UsePixelModuleLevelMask(flags, cfg)
Definition: PixelConditionsConfig.py:424
Trk::open
@ open
Definition: BinningType.h:40
PixelConditionsSummaryConfig.PixelByteStreamErrorDetectorElementStatusToolActiveOnlyCfg
def PixelByteStreamErrorDetectorElementStatusToolActiveOnlyCfg(flags, name="PixelByteStreamErrorDetectorElementStatusToolActiveOnly", **kwargs)
Definition: PixelConditionsSummaryConfig.py:67
PixelConditionsConfig.PixelDetectorElementStatusAlgCfg
def PixelDetectorElementStatusAlgCfg(flags, name="PixelDetectorElementStatusAlg", **kwargs)
Definition: PixelConditionsConfig.py:367
PixelConditionsConfig.PixelHitDiscCnfgAlgCfg
def PixelHitDiscCnfgAlgCfg(flags, name="PixelHitDiscCnfgAlg", **kwargs)
Definition: PixelConditionsConfig.py:269
python.MuonGeometryConfig.MuonGeoModelCfg
def MuonGeoModelCfg(flags)
Definition: MuonGeometryConfig.py:28
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
ITkPixelConditionsConfig.ITkPixelChargeCalibCondAlgCfg
def ITkPixelChargeCalibCondAlgCfg(flags, name="ITkPixelChargeCalibCondAlg", **kwargs)
Definition: ITkPixelConditionsConfig.py:74
PixelConditionsConfig.PixelDetectorElementStatusCondAlgActiveOnlyCfg
def PixelDetectorElementStatusCondAlgActiveOnlyCfg(flags, name="PixelDetectorElementStatusCondAlgNoByteStreamErrorActiveOnly", **kwargs)
Definition: PixelConditionsConfig.py:339
PixelConditionsConfig.PixelSiliconConditionsTestAlgCfg
def PixelSiliconConditionsTestAlgCfg(flags, name="PixelSiliconConditionsTestAlg", **kwargs)
Definition: PixelConditionsConfig.py:327
PixelConditionsConfig.PixelRadSimFluenceMapAlgCfg
def PixelRadSimFluenceMapAlgCfg(flags, name="PixelRadSimFluenceMapAlg", **kwargs)
Definition: PixelConditionsConfig.py:311
PixelConditionsSummaryConfig.PixelConditionsSummaryToolNoByteStreamErrorsActiveOnlyCfg
def PixelConditionsSummaryToolNoByteStreamErrorsActiveOnlyCfg(flags, name="PixelConditionsSummaryToolNoByteStreamErrorsAcriveOnly", **kwargs)
Definition: PixelConditionsSummaryConfig.py:41
RngCompsConfig.AthRNGSvcCfg
def AthRNGSvcCfg(flags, name="AthRNGSvc")
Definition: RngCompsConfig.py:51