ATLAS Offline Software
ITkPixelConditionsConfig.py
Go to the documentation of this file.
1 """Define functions to configure Pixel conditions algorithms
2 
3 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4 """
5 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory import CompFactory
7 from IOVDbSvc.IOVDbSvcConfig import addFolders, addFoldersSplitOnline
8 
9 def ITkPixelModuleConfigCondAlgCfg(flags, name="ITkPixelModuleConfigCondAlg", **kwargs):
10  """Return a ComponentAccumulator with configured PixelConfigCondAlg for ITk"""
11  acc = ComponentAccumulator()
12  kwargs.setdefault("WriteKey", "ITkPixelModuleData")
13  #These settings should be replaced with values taken from conditions
14  CondArgs = {}
15  CondArgs.update(
16  BarrelToTThreshold = [-1,-1,-1,-1,-1],
17  BarrelCrossTalk = [ 0.06, 0.06, 0.06, 0.06, 0.06],
18  BarrelNoiseOccupancy = [ 5e-8, 5e-8, 5e-8, 5e-8, 5e-8],
19  BarrelDisableProbability = [ 9e-3, 9e-3, 9e-3, 9e-3, 9e-3],
20  BarrelLorentzAngleCorr = [ 1.0, 1.0, 1.0, 1.0, 1.0],
21  DefaultBarrelBiasVoltage = [ 150.0, 150.0, 150.0, 150.0, 150.0],
22  BarrelFluence = [0.0e14,0.0e14,0.0e14,0.0e14,0.0e14],
23  BarrelFluenceMap = ["PixelDigitization/maps_IBL_PL_80V_fl0e14.root",
24  "PixelDigitization/maps_IBL_PL_80V_fl0e14.root",
25  "PixelDigitization/maps_IBL_PL_80V_fl0e14.root",
26  "PixelDigitization/maps_IBL_PL_80V_fl0e14.root",
27  "PixelDigitization/maps_IBL_PL_80V_fl0e14.root"],
28  EndcapToTThreshold = [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],
29  EndcapCrossTalk = [ 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06],
30  EndcapNoiseOccupancy = [ 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8],
31  EndcapDisableProbability = [ 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3],
32  EndcapLorentzAngleCorr = [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
33  InnermostNoiseShape = [0.0, 1.0],
34  NextInnermostNoiseShape = [0.0, 1.0],
35  PixelNoiseShape = [0.0, 1.0],
36  # charge calib
37  DefaultBarrelAnalogThreshold = [900, 600, 600, 600, 600],
38  DefaultEndcapAnalogThreshold = [600, 600, 600, 600, 600, 600, 600, 600, 600],
39  DefaultBarrelAnalogThresholdSigma = [36, 24, 24, 24, 24],
40  DefaultEndcapAnalogThresholdSigma = [24, 24, 24, 24, 24, 24, 24, 24, 24],
41  DefaultBarrelAnalogThresholdNoise = [110, 75, 75, 75, 75],
42  DefaultEndcapAnalogThresholdNoise = [75, 75, 75, 75, 75, 75, 75, 75, 75],
43  DefaultBarrelInTimeThreshold = [1000, 1000, 1000, 1000, 1000],
44  DefaultEndcapInTimeThreshold = [1500, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000],
45  DefaultCalibrationParameterA = 14.0,
46  DefaultCalibrationParameterE = -1000.0,
47  DefaultCalibrationParameterC = 8000.0,
48  )
49  CondArgs.update(kwargs)
50  acc.addCondAlgo(CompFactory.PixelModuleConfigCondAlg(name, **CondArgs))
51  return acc
52 
53 def ITkPixelAlignCondAlgCfg(flags,name="ITkPixelAlignCondAlg", **kwargs):
54  """Return a ComponentAccumulator with configured PixelAlignCondAlg for ITk"""
55  acc = ComponentAccumulator()
56 
57  if flags.GeoModel.Align.Dynamic:
58  raise RuntimeError("Dynamic alignment not supported for ITk yet")
59  else:
60  acc.merge(addFoldersSplitOnline(flags, "INDET", "/Indet/Onl/Align", flags.ITk.Geometry.alignmentFolder , className="AlignableTransformContainer"))
61 
62  kwargs.setdefault("DetManagerName", "ITkPixel")
63  kwargs.setdefault("UseDynamicAlignFolders", flags.GeoModel.Align.Dynamic)
64  kwargs.setdefault("ReadKeyStatic", flags.ITk.Geometry.alignmentFolder)
65  # kwargs.setdefault("ReadKeyDynamicL1", "/Indet/AlignL1/ID")
66  # kwargs.setdefault("ReadKeyDynamicL2", "/Indet/AlignL2/PIX")
67  # kwargs.setdefault("ReadKeyDynamicL3", "/Indet/AlignL3")
68  kwargs.setdefault("ReadKeyIBLDist", "")
69  kwargs.setdefault("WriteKey", "ITkPixelAlignmentStore")
70 
71  acc.addCondAlgo(CompFactory.PixelAlignCondAlg(name, **kwargs))
72  return acc
73 
74 def ITkPixelChargeCalibCondAlgCfg(flags, name="ITkPixelChargeCalibCondAlg", **kwargs):
75  """Return a ComponentAccumulator with configured PixelChargeCalibCondAlg for ITk"""
76  acc = ComponentAccumulator()
77  acc.merge(ITkPixelModuleConfigCondAlgCfg(flags))
78  folderName = ""
79  if flags.ITk.Conditions.PixelChargeCalibTag:
80  folderName = "/ITk/PixelChargeCalib"
81  if flags.ITk.Conditions.PixelChargeCalibFile:
82  acc.merge(addFolders(flags, folderName, flags.ITk.Conditions.PixelChargeCalibFile, tag=flags.ITk.Conditions.PixelChargeCalibTag, db="OFLP200", className="CondAttrListCollection"))
83  else:
84  acc.merge(addFolders(flags, folderName, "INDET_OFL", tag=flags.ITk.Conditions.PixelChargeCalibTag, db="OFLP200", className="CondAttrListCollection"))
85  from PixelGeoModelXml.ITkPixelGeoModelConfig import ITkPixelReadoutGeometryCfg
86  acc.merge(ITkPixelReadoutGeometryCfg(flags))
87  kwargs.setdefault("PixelDetEleCollKey", "ITkPixelDetectorElementCollection")
88  kwargs.setdefault("PixelModuleData", "ITkPixelModuleData")
89  kwargs.setdefault("ReadKey", folderName)
90  kwargs.setdefault("WriteKey", "ITkPixelChargeCalibCondData")
91  acc.addCondAlgo(CompFactory.PixelChargeLUTCalibCondAlg(name, **kwargs))
92  return acc
93 
94 def ITkPixelDCSCondHVAlgCfg(flags, name="ITkPixelDCSCondHVAlg", **kwargs):
95  """Return a ComponentAccumulator with configured PixelDCSCondHVAlg for ITk"""
96  acc = ComponentAccumulator()
97  acc.merge(ITkPixelModuleConfigCondAlgCfg(flags))
98  kwargs.setdefault("ReadKey", "") # disable for ITk for now
99  kwargs.setdefault("PixelModuleData", "ITkPixelModuleData")
100  kwargs.setdefault("WriteKey", "ITkPixelDCSHVCondData")
101  acc.addCondAlgo(CompFactory.PixelDCSCondHVAlg(name, **kwargs))
102  return acc
103 
104 def ITkPixelDCSCondStateAlgCfg(flags, name="ITkPixelDCSCondStateAlg", **kwargs):
105  """Return a ComponentAccumulator with configured PixelDCSCondStateAlg for ITk"""
106  acc = ComponentAccumulator()
107  kwargs.setdefault("ReadKeyState", "") #To be configured when final DCS implementation for ITk becomes available
108  kwargs.setdefault("WriteKeyState", "ITkPixelDCSStateCondData")
109  acc.addCondAlgo(CompFactory.PixelDCSCondStateAlg(name, **kwargs))
110  return acc
111 
112 def ITkPixelDCSCondStatusAlgCfg(flags, name="ITkPixelDCSCondStatusAlg", **kwargs):
113  """Return a ComponentAccumulator with configured PixelDCSCondStatusAlg for ITk"""
114  acc = ComponentAccumulator()
115  kwargs.setdefault("ReadKeyStatus", "") #To be configured when final DCS implementation for ITk becomes available
116  kwargs.setdefault("WriteKeyStatus", "ITkPixelDCSStatusCondData")
117  acc.addCondAlgo(CompFactory.PixelDCSCondStatusAlg(name, **kwargs))
118  return acc
119 
120 def ITkPixelDCSCondTempAlgCfg(flags, name="ITkPixelDCSCondTempAlg", **kwargs):
121  """Return a ComponentAccumulator with configured PixelDCSCondTempAlg for ITk"""
122  acc = ComponentAccumulator()
123  acc.merge(ITkPixelModuleConfigCondAlgCfg(flags))
124  kwargs.setdefault("ReadKey", "") # disable for ITk for now
125  kwargs.setdefault("WriteKey", "ITkPixelDCSTempCondData")
126  acc.addCondAlgo(CompFactory.PixelDCSCondTempAlg(name, **kwargs))
127  return acc
128 
129 def ITkPixelDeadMapCondAlgCfg(flags, name="ITkPixelDeadMapCondAlg", **kwargs):
130  """Return a ComponentAccumulator with configured PixelDeadMapCondAlg for ITk"""
131  acc = ComponentAccumulator()
132  acc.merge(ITkPixelModuleConfigCondAlgCfg(flags))
133 
134  # TODO: not enabled for ITk for now
135  kwargs.setdefault("ReadKey", "")
136  # Use a json file to disable modules. If readKey!="" this option is ignored
137  kwargs.setdefault("JsonPath",flags.ITk.JsonPathPixelModuleVeto)
138  kwargs.setdefault("WriteKey", "ITkPixelDeadMapCondData")
139  acc.addCondAlgo(CompFactory.PixelDeadMapCondAlg(name, **kwargs))
140  return acc
141 
142 def ITkPixelDetectorElementCondAlgCfg(flags, name="ITkPixelDetectorElementCondAlg", **kwargs):
143  """Return a ComponentAccumulator with configured PixelDetectorElementCondAlg for ITk"""
144  acc = ComponentAccumulator()
145  acc.merge(ITkPixelAlignCondAlgCfg(flags))
146  kwargs.setdefault("DetManagerName", "ITkPixel")
147  kwargs.setdefault("PixelAlignmentStore", "ITkPixelAlignmentStore")
148  kwargs.setdefault("WriteKey", "ITkPixelDetectorElementCollection")
149  acc.addCondAlgo(CompFactory.PixelDetectorElementCondAlg(name, **kwargs))
150  return acc
151 
152 def ITkPixelDistortionAlgCfg(flags, name="ITkPixelDistortionAlg", **kwargs):
153  """Return a ComponentAccumulator with configured PixelDistortionAlg for ITk"""
154  acc = ComponentAccumulator()
155  acc.merge(ITkPixelModuleConfigCondAlgCfg(flags))
156  acc.merge(addFoldersSplitOnline(flags,"INDET", "/Indet/Onl/PixelDist", "/Indet/PixelDist", className="DetCondCFloat"))
157  kwargs.setdefault("ReadKey", "/Indet/PixelDist")
158  kwargs.setdefault("WriteKey", "ITkPixelDistortionData")
159  from RngComps.RngCompsConfig import AthRNGSvcCfg
160  kwargs.setdefault("RndmSvc", acc.getPrimaryAndMerge(AthRNGSvcCfg(flags)).name)
161  acc.addCondAlgo(CompFactory.PixelDistortionAlg(name, **kwargs))
162  return acc
163 
164 def ITkPixelOfflineCalibCondAlgCfg(flags, name="ITkPixelOfflineCalibCondAlg", **kwargs):
165  """Return a ComponentAccumulator with configured ITkPixelOfflineCalibCondAlg"""
166  acc = ComponentAccumulator()
167 
168  folderName = ""
169  if flags.ITk.Conditions.PixelOfflineCalibTag:
170  folderName = '/PIXEL/ITkClusterError'
171  CalibTag = flags.ITk.Conditions.PixelOfflineCalibTag
172  if flags.ITk.Conditions.PixelOfflineCalibFile:
173  acc.merge(addFolders(flags, folderName, flags.ITk.Conditions.PixelOfflineCalibFile, tag=CalibTag, db="OFLP200", className="CondAttrListCollection"))
174  else:
175  acc.merge(addFolders(flags, folderName, "PIXEL_OFL", tag=CalibTag, db="OFLP200", className="CondAttrListCollection"))
176 
177 
178  # TODO: enable once in the DB
179  # else:
180  # acc.merge(addFolders(flags, "/PIXEL/ITkClusterError", "PIXEL_OFL", db="OFLP200", className="CondAttrListCollection"))
181 
182  kwargs.setdefault("ReadKey", "/PIXEL/ITkClusterError")
183  kwargs.setdefault("WriteKey", "ITkPixelOfflineCalibData")
184  kwargs.setdefault("InputSource", 2)
185  acc.addCondAlgo(CompFactory.ITk.PixelOfflineCalibCondAlg(name, **kwargs))
186  return acc
187 
188 def ITkPixelDetectorElementStatusCondAlgNoByteStreamErrorsCfg(flags, name = "ITkPixelDetectorElementStatusCondAlgNoByteStreamErrors", **kwargs) :
189  '''
190  Condition alg to precompute the pixel detector element status.
191  This algorithm does not consider the byte stream errors which are event data.
192  '''
193  acc = ComponentAccumulator()
194  if 'ConditionsSummaryTool' not in kwargs :
195  from PixelConditionsTools.ITkPixelConditionsSummaryConfig import ITkPixelConditionsSummaryCfg
196  kwargs.setdefault("ConditionsSummaryTool", acc.popToolsAndMerge( ITkPixelConditionsSummaryCfg(flags)))
197  kwargs.setdefault( "WriteKey", "ITkPixelDetectorElementStatusNoByteStream")
198  acc.addCondAlgo( CompFactory.InDet.SiDetectorElementStatusCondAlg(name, **kwargs) )
199  return acc
200 
201 def ITkPixelDetectorElementStatusAlgCfg(flags, name = "ITkPixelDetectorElementStatusAlg", **kwargs) :
202  '''
203  Event alg which could extend the pixel detector element status conditions data with bytestream errors.
204  '''
205  acc = ComponentAccumulator()
206  if 'ConditionsSummaryTool' not in kwargs:
207  element_status_input=None
209  element_status_input="ITkPixelDetectorElementStatusNoByteStream"
210  from PixelConditionsTools.ITkPixelConditionsSummaryConfig import ITkByteStreamErrorDetectorElementStatusToolCfg
211  kwargs.setdefault("ConditionsSummaryTool",
212  acc.popToolsAndMerge(ITkByteStreamErrorDetectorElementStatusToolCfg(flags, PixelDetElStatusCondDataBaseKey=element_status_input) ))
213 
214  kwargs.setdefault("WriteKey","ITkPixelDetectorElementStatus")
215 
216  # @TODO merge pixel raw data provider for bytestream input
217 
218  acc.addEventAlgo( CompFactory.InDet.SiDetectorElementStatusAlg(name, **kwargs) )
219  return acc
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
ITkPixelConditionsConfig.ITkPixelDetectorElementStatusAlgCfg
def ITkPixelDetectorElementStatusAlgCfg(flags, name="ITkPixelDetectorElementStatusAlg", **kwargs)
Definition: ITkPixelConditionsConfig.py:201
ITkPixelConditionsConfig.ITkPixelDetectorElementCondAlgCfg
def ITkPixelDetectorElementCondAlgCfg(flags, name="ITkPixelDetectorElementCondAlg", **kwargs)
Definition: ITkPixelConditionsConfig.py:142
ITkPixelGeoModelConfig.ITkPixelReadoutGeometryCfg
def ITkPixelReadoutGeometryCfg(flags)
Definition: ITkPixelGeoModelConfig.py:39
ITkPixelConditionsSummaryConfig.ITkPixelConditionsSummaryCfg
def ITkPixelConditionsSummaryCfg(flags, name="ITkPixelConditionsSummary", **kwargs)
Definition: ITkPixelConditionsSummaryConfig.py:13
ITkPixelConditionsConfig.ITkPixelDCSCondStateAlgCfg
def ITkPixelDCSCondStateAlgCfg(flags, name="ITkPixelDCSCondStateAlg", **kwargs)
Definition: ITkPixelConditionsConfig.py:104
ITkPixelConditionsSummaryConfig.ITkByteStreamErrorDetectorElementStatusToolCfg
def ITkByteStreamErrorDetectorElementStatusToolCfg(flags, name="ITkByteStreamErrorDetectorElementStatusTool", **kwargs)
Definition: ITkPixelConditionsSummaryConfig.py:33
python.IOVDbSvcConfig.addFolders
def addFolders(flags, folderStrings, detDb=None, className=None, extensible=False, tag=None, db=None, modifiers='')
Definition: IOVDbSvcConfig.py:81
ITkPixelConditionsConfig.ITkPixelDistortionAlgCfg
def ITkPixelDistortionAlgCfg(flags, name="ITkPixelDistortionAlg", **kwargs)
Definition: ITkPixelConditionsConfig.py:152
ITkPixelConditionsConfig.ITkPixelDeadMapCondAlgCfg
def ITkPixelDeadMapCondAlgCfg(flags, name="ITkPixelDeadMapCondAlg", **kwargs)
Definition: ITkPixelConditionsConfig.py:129
ITkPixelConditionsConfig.ITkPixelDCSCondHVAlgCfg
def ITkPixelDCSCondHVAlgCfg(flags, name="ITkPixelDCSCondHVAlg", **kwargs)
Definition: ITkPixelConditionsConfig.py:94
ITkPixelConditionsConfig.ITkPixelAlignCondAlgCfg
def ITkPixelAlignCondAlgCfg(flags, name="ITkPixelAlignCondAlg", **kwargs)
Definition: ITkPixelConditionsConfig.py:53
ITkPixelConditionsConfig.ITkPixelModuleConfigCondAlgCfg
def ITkPixelModuleConfigCondAlgCfg(flags, name="ITkPixelModuleConfigCondAlg", **kwargs)
Definition: ITkPixelConditionsConfig.py:9
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:162
ITkPixelConditionsConfig.ITkPixelDCSCondStatusAlgCfg
def ITkPixelDCSCondStatusAlgCfg(flags, name="ITkPixelDCSCondStatusAlg", **kwargs)
Definition: ITkPixelConditionsConfig.py:112
ITkPixelConditionsConfig.ITkPixelDetectorElementStatusCondAlgNoByteStreamErrorsCfg
def ITkPixelDetectorElementStatusCondAlgNoByteStreamErrorsCfg(flags, name="ITkPixelDetectorElementStatusCondAlgNoByteStreamErrors", **kwargs)
Definition: ITkPixelConditionsConfig.py:188
ITkPixelConditionsConfig.ITkPixelChargeCalibCondAlgCfg
def ITkPixelChargeCalibCondAlgCfg(flags, name="ITkPixelChargeCalibCondAlg", **kwargs)
Definition: ITkPixelConditionsConfig.py:74
ITkPixelConditionsConfig.ITkPixelOfflineCalibCondAlgCfg
def ITkPixelOfflineCalibCondAlgCfg(flags, name="ITkPixelOfflineCalibCondAlg", **kwargs)
Definition: ITkPixelConditionsConfig.py:164
ITkPixelConditionsConfig.ITkPixelDCSCondTempAlgCfg
def ITkPixelDCSCondTempAlgCfg(flags, name="ITkPixelDCSCondTempAlg", **kwargs)
Definition: ITkPixelConditionsConfig.py:120
RngCompsConfig.AthRNGSvcCfg
def AthRNGSvcCfg(flags, name="AthRNGSvc")
Definition: RngCompsConfig.py:51