ATLAS Offline Software
SCTCalibAlgConfig.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 #
4 
5 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6 
7 
8 def SCT_CalibBsErrorToolCfg(flags, name = 'SCT_CalibBsErrorTool', **kwargs):
10 
11  from SCT_ConditionsTools.SCT_ConditionsToolsConfig import SCT_ByteStreamErrorsToolCfg
12  kwargs.setdefault('SCT_ByteStreamErrorsTool',
13  acc.popToolsAndMerge(SCT_ByteStreamErrorsToolCfg(flags)))
14 
15  from AthenaConfiguration.ComponentFactory import CompFactory
16  acc.setPrivateTools(CompFactory.SCT_CalibBsErrorTool(name, **kwargs))
17 
18  return acc
19 
20 
21 def SCT_CalibEventInfoCfg(flags, name = 'SCT_CalibEventInfo', **kwargs):
22  acc = ComponentAccumulator()
23 
24  from AthenaConfiguration.ComponentFactory import CompFactory
25  acc.setPrivateTools(CompFactory.SCT_CalibEventInfo(name, **kwargs))
26 
27  return acc
28 
29 
30 def SCT_CalibHitmapToolCfg(flags, name = 'SCT_CalibHitmapTool', **kwargs):
31  acc = ComponentAccumulator()
32 
33  from AthenaConfiguration.ComponentFactory import CompFactory
34  acc.setPrivateTools(CompFactory.SCT_CalibHitmapTool(name, **kwargs))
35 
36  return acc
37 
38 
39 def SCT_CalibLbToolCfg(flags, name = 'SCT_CalibLbTool', **kwargs):
40  acc = ComponentAccumulator()
41 
42  kwargs.setdefault('RDOContainer', 'SCT_RDOs')
43 
44  kwargs.setdefault('SCT_CalibEventInfo',
45  acc.popToolsAndMerge(SCT_CalibEventInfoCfg(flags)))
46 
47  from AthenaConfiguration.ComponentFactory import CompFactory
48  acc.setPrivateTools(CompFactory.SCT_CalibLbTool(name, **kwargs))
49 
50  return acc
51 
52 
53 def SCT_CalibModuleListToolCfg(flags, name = 'SCT_CalibModuleListTool', **kwargs):
54  acc = ComponentAccumulator()
55 
56  from SCT_ConditionsTools.SCT_ConditionsToolsConfig import SCT_MonitorConditionsToolCfg
57  cond_kwargs = {}
58  cond_kwargs.setdefault('FolderDb', '/SCT/Derived/Monitoring')
59  cond_kwargs.setdefault('FolderTag', 'SctDerivedMonitoring-RUN2-UPD4-005')
60  # In case of reprocessing an older run, the reference run has to be set manually, since it's not the last one uploaded to COOL
61  if flags.SCTCalib.ForceRefRunNumber:
62  cond_kwargs.setdefault('Modifiers', f'<forceRunNumber>{flags.SCTCalib.RunNumber}</forceRunNumber>')
63  cond_kwargs.setdefault('dbInstance', 'SCT_OFL')
64  kwargs.setdefault('SCT_MonitorConditionsTool',
65  acc.popToolsAndMerge(SCT_MonitorConditionsToolCfg(flags, cond_kwargs = cond_kwargs)))
66 
67  from AthenaConfiguration.ComponentFactory import CompFactory
68  acc.setPrivateTools(CompFactory.SCT_CalibModuleListTool(name, **kwargs))
69 
70  return acc
71 
72 
73 def SCTCalibWriteToolCfg(flags, name = 'SCTCalibWriteTool', **kwargs):
74  acc = ComponentAccumulator()
75 
76  kwargs.setdefault('BeginRun', int( flags.SCTCalib.RunNumber ))
77  if flags.SCTCalib.DoNoisyStrip and flags.SCTCalib.NoisyUpdate:
78  kwargs.setdefault('EndRun', -1) # Open IOV used for UPD4
79  else:
80  kwargs.setdefault('EndRun', int( flags.SCTCalib.RunNumber ))
81 
82  kwargs.setdefault('StreamName', 'SCTCalibStream')
83 
84  kwargs.setdefault('TagID4NoisyStrips', flags.SCTCalib.TagID4NoisyStrips)
85  kwargs.setdefault('TagID4DeadStrips', flags.SCTCalib.TagID4DeadStrips)
86  kwargs.setdefault('TagID4DeadChips', flags.SCTCalib.TagID4DeadChips)
87  kwargs.setdefault('TagID4NoiseOccupancy', flags.SCTCalib.TagID4NoiseOccupancy)
88  kwargs.setdefault('TagID4RawOccupancy', flags.SCTCalib.TagID4RawOccupancy)
89  kwargs.setdefault('TagID4Efficiency', flags.SCTCalib.TagID4Efficiency)
90  kwargs.setdefault('TagID4BSErrors', flags.SCTCalib.TagID4BSErrors)
91  kwargs.setdefault('TagID4LorentzAngle', flags.SCTCalib.TagID4LorentzAngle)
92 
93  from AthenaCommon.Constants import DEBUG
94  kwargs.setdefault('OutputLevel', DEBUG)
95 
96  # Setup for writing local COOL DB
97  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
98  acc.merge(OutputStreamCfg(flags, streamName = 'SCTCalibStream', disableEventTag = True))
99 
100  from AthenaConfiguration.ComponentFactory import CompFactory
101  acc.setPrivateTools(CompFactory.SCTCalibWriteTool(name, **kwargs))
102 
103  return acc
104 
105 
106 def SCTCalibAlgCfg(flags, SORTime, EORTime, nLB, prefix, name = 'SCTCalibAlg', **kwargs):
107  acc = ComponentAccumulator()
108 
109  #--- Run number
110  kwargs.setdefault('RunNumber', flags.SCTCalib.RunNumber)
111  kwargs.setdefault('EventNumber', flags.SCTCalib.EventNumber)
112  #--- Run start/end time read from runInfo.txt
113  kwargs.setdefault('RunStartTime', SORTime)
114  kwargs.setdefault('RunEndTime', EORTime)
115  kwargs.setdefault('LBMax', nLB)
116  #--- Flag for ConditionsSvc, sorting, hitmaps, BSErros
117  kwargs.setdefault('UseConfiguration', flags.SCTCalib.UseConfiguration) # True in alg default
118  kwargs.setdefault('UseCalibration', flags.SCTCalib.UseCalibration) # True in alg default
119  kwargs.setdefault('UseMajority', flags.SCTCalib.UseMajority) # True in alg default
120  kwargs.setdefault('UseBSError', flags.SCTCalib.UseBSError) # False in alg default
121  kwargs.setdefault('DoHitMaps', flags.SCTCalib.DoHitMaps) # True in alg default
122  kwargs.setdefault('DoHitMapsLB', flags.SCTCalib.DoHitMapsLB) # True in alg default
123  kwargs.setdefault('ReadHitMaps', flags.SCTCalib.ReadHitMaps) # False in alg default
124  kwargs.setdefault('DoBSErrors', flags.SCTCalib.DoBSErrors) # False in alg default
125 
126  #--- Flags for input files
127  kwargs.setdefault('ReadBS', flags.SCTCalib.ReadBS)
128  #--- Input files
129  if flags.SCTCalib.InputType == 'NTUP_TRKVALID':
130  kwargs.setdefault('InputTrkVal', flags.Input.Files)
131  elif flags.SCTCalib.InputType == 'HIST':
132  kwargs.setdefault('InputHist', flags.SCTCalib.InputHist)
133 
134  #--- Methods to run
135  kwargs.setdefault('DoNoisyStrip', flags.SCTCalib.DoNoisyStrip) # True in alg default
136  kwargs.setdefault('DoHV', flags.SCTCalib.DoHV) # False in alg default
137  if flags.SCTCalib.DoDeadStrip or flags.SCTCalib.DoQuietStrip:
138  kwargs.setdefault('DoDeadStrip', True)
139  else:
140  kwargs.setdefault('DoDeadStrip', False)
141  if flags.SCTCalib.DoDeadChip or flags.SCTCalib.DoQuietChip:
142  kwargs.setdefault('DoDeadChip', True)
143  else:
144  kwargs.setdefault('DoDeadChip', False)
145  kwargs.setdefault('DoNoiseOccupancy', flags.SCTCalib.DoNoiseOccupancy) # False in alg default
146  kwargs.setdefault('DoRawOccupancy', flags.SCTCalib.DoRawOccupancy) # False in alg default
147  kwargs.setdefault('DoEfficiency', flags.SCTCalib.DoEfficiency) # False in alg default
148  kwargs.setdefault('DoBSErrorDB', flags.SCTCalib.DoBSErrorDB) # False in alg default
149  kwargs.setdefault('DoLorentzAngle', flags.SCTCalib.DoLorentzAngle) # False in alg default
150 
151  #--- Local DB
152  kwargs.setdefault('WriteToCool', flags.SCTCalib.WriteToCool) # True in alg default
153 
154  #--- Properties for noisy strips
155  kwargs.setdefault('LbsPerWindow', flags.SCTCalib.LbsPerWindow)
156  kwargs.setdefault('NoisyUpdate', flags.SCTCalib.NoisyUpdate)
157  kwargs.setdefault('NoisyWriteAllModules', flags.SCTCalib.NoisyWriteAllModules)
158  kwargs.setdefault('NoisyMinStat', flags.SCTCalib.NoisyMinStat)
159  kwargs.setdefault('NoisyStripAll', flags.SCTCalib.NoisyStripAll)
160  kwargs.setdefault('NoisyStripThrDef', flags.SCTCalib.NoisyStripThrDef)
161  kwargs.setdefault('NoisyStripThrOffline', flags.SCTCalib.NoisyStripThrOffline)
162  kwargs.setdefault('NoisyStripThrOnline', flags.SCTCalib.NoisyStripThrOnline)
163  kwargs.setdefault('NoisyWaferFinder', flags.SCTCalib.NoisyWaferFinder)
164  kwargs.setdefault('NoisyWaferWrite', flags.SCTCalib.NoisyWaferWrite)
165  kwargs.setdefault('NoisyWaferAllStrips', flags.SCTCalib.NoisyWaferAllStrips)
166  kwargs.setdefault('NoisyWaferThrBarrel', flags.SCTCalib.NoisyWaferThrBarrel)
167  kwargs.setdefault('NoisyWaferThrECA', flags.SCTCalib.NoisyWaferThrECA)
168  kwargs.setdefault('NoisyWaferThrECC', flags.SCTCalib.NoisyWaferThrECC)
169  kwargs.setdefault('NoisyWaferFraction', flags.SCTCalib.NoisyWaferFraction)
170  kwargs.setdefault('NoisyChipFraction', flags.SCTCalib.NoisyChipFraction)
171  kwargs.setdefault('NoisyUploadTest', flags.SCTCalib.NoisyUploadTest)
172  kwargs.setdefault('NoisyStripAverageInDB', flags.SCTCalib.NoisyStripAverageInDB)
173  kwargs.setdefault('NoisyModuleAverageInDB', flags.SCTCalib.NoisyModuleAverageInDB)
174  kwargs.setdefault('NoisyStripLastRunInDB', flags.SCTCalib.NoisyStripLastRunInDB)
175  kwargs.setdefault('NoisyModuleList', flags.SCTCalib.NoisyModuleList)
176  kwargs.setdefault('NoisyModuleDiff', flags.SCTCalib.NoisyModuleDiff)
177  kwargs.setdefault('NoisyStripDiff', flags.SCTCalib.NoisyStripDiff)
178 
179  #--- Properties for dead strips/chips
180  kwargs.setdefault('DeadStripMinStat', flags.SCTCalib.DeadStripMinStat)
181  kwargs.setdefault('DeadStripMinStatBusy', flags.SCTCalib.DeadStripMinStatBusy)
182  kwargs.setdefault('DeadChipMinStat', flags.SCTCalib.DeadChipMinStat)
183  kwargs.setdefault('DeadStripSignificance', flags.SCTCalib.DeadStripSignificance)
184  kwargs.setdefault('DeadChipSignificance', flags.SCTCalib.DeadChipSignificance)
185  kwargs.setdefault('BusyThr4DeadFinding', flags.SCTCalib.BusyThr4DeadFinding)
186  kwargs.setdefault('NoisyThr4DeadFinding', flags.SCTCalib.NoisyThr4DeadFinding)
187  kwargs.setdefault('DeadChipUploadTest', flags.SCTCalib.DeadChipUploadTest)
188  kwargs.setdefault('DeadStripUploadTest', flags.SCTCalib.DeadStripUploadTest)
189  if flags.SCTCalib.DoDeadStrip or flags.SCTCalib.DoDeadChip:
190  kwargs.setdefault('DeadNotQuiet', True)
191  else:
192  kwargs.setdefault('DeadNotQuiet', False)
193  kwargs.setdefault('QuietThresholdChip', flags.SCTCalib.QuietThresholdChip)
194  kwargs.setdefault('QuietThresholdStrip', flags.SCTCalib.QuietThresholdStrip)
195 
196  #--- Properties for HIST
197  kwargs.setdefault('NoiseOccupancyTriggerAware', flags.SCTCalib.NoiseOccupancyTriggerAware)
198  kwargs.setdefault('NoiseOccupancyMinStat', flags.SCTCalib.NoiseOccupancyMinStat)
199  kwargs.setdefault('RawOccupancyMinStat', flags.SCTCalib.RawOccupancyMinStat)
200  kwargs.setdefault('EfficiencyMinStat', flags.SCTCalib.EfficiencyMinStat)
201  kwargs.setdefault('EfficiencyDoChips', flags.SCTCalib.EfficiencyDoChips)
202  kwargs.setdefault('BSErrorDBMinStat', flags.SCTCalib.BSErrorDBMinStat)
203  kwargs.setdefault('LorentzAngleMinStat', flags.SCTCalib.LorentzAngleMinStat)
204  kwargs.setdefault('LorentzAngleDebugMode', flags.SCTCalib.LorentzAngleDebugMode)
205 
206  #--- Tags for XMLs : have to be consistent with SCTCalibWriteTool
207  kwargs.setdefault('TagID4NoisyStrips', flags.SCTCalib.TagID4NoisyStrips)
208  kwargs.setdefault('TagID4DeadStrips', flags.SCTCalib.TagID4DeadStrips)
209  kwargs.setdefault('TagID4DeadChips', flags.SCTCalib.TagID4DeadChips)
210  kwargs.setdefault('TagID4NoiseOccupancy', flags.SCTCalib.TagID4NoiseOccupancy)
211 
212  #--- Output XMLs
213  kwargs.setdefault('BadStripsAllFile', prefix + 'BadStripsAllFile.xml') # All NoisyStrips
214  kwargs.setdefault('BadStripsNewFile', prefix + 'BadStripsNewFile.xml') # Newly found NoisyStrips
215  kwargs.setdefault('BadStripsSummaryFile', prefix + 'BadStripsSummaryFile.xml') # Summary of NoisyStrips
216  kwargs.setdefault('BadModulesFile', prefix + 'BadModulesFile.xml') # HVTrip
217  if ( flags.SCTCalib.DoDeadChip or flags.SCTCalib.DoDeadStrip):
218  kwargs.setdefault('DeadStripsFile', prefix + 'DeadStripsFile.xml') # DeadStrip
219  kwargs.setdefault('DeadChipsFile', prefix + 'DeadChipsFile.xml') # DeadChip
220  kwargs.setdefault('DeadSummaryFile', prefix + 'DeadSummaryFile.xml') # Summary of Dead Search
221  if ( flags.SCTCalib.DoQuietChip or flags.SCTCalib.DoQuietStrip ):
222  kwargs.setdefault('DeadStripsFile', prefix + 'QuietStripsFile.xml') # QuietStrip
223  kwargs.setdefault('DeadChipsFile', prefix + 'QuietChipsFile.xml') # QuietChip
224  kwargs.setdefault('DeadSummaryFile', prefix + 'QuietSummaryFile.xml') # Summary of Quiet Search
225  kwargs.setdefault('NoiseOccupancyFile', prefix + 'NoiseOccupancyFile.xml') # NoiseOccupancy
226  kwargs.setdefault('NoiseOccupancySummaryFile', prefix + 'NoiseOccupancySummaryFile.xml') # Summary of NoiseOccupancy
227  kwargs.setdefault('LorentzAngleFile', prefix + 'LorentzAngleFile.xml') # LorentzAngle
228  kwargs.setdefault('LorentzAngleSummaryFile', prefix + 'LorentzAngleSummaryFile.xml') # Summary of LorentzAngle
229 
230  kwargs.setdefault('RawOccupancySummaryFile', prefix + 'RawOccupancySummaryFile.xml') # Summary of RawOccupancy
231  kwargs.setdefault('EfficiencyModuleFile', prefix + 'EfficiencyModuleSummary.xml') # Module Efficiency
232  kwargs.setdefault('EfficiencyChipFile', prefix + 'EfficiencyChipSummary.xml') # Chip Efficiency
233  kwargs.setdefault('EfficiencySummaryFile', prefix + 'EfficiencySummaryFile.xml') # Summary of Efficiency
234  kwargs.setdefault('BSErrorSummaryFile', prefix + 'BSErrorSummaryFile.xml') # Summary of BS Errors
235  kwargs.setdefault('BSErrorModuleFile', prefix + 'BSErrorModuleSummary.xml') # BS Errors for each module
236 
237  from AthenaCommon.Constants import WARNING
238  kwargs.setdefault('OutputLevel', WARNING) # DEBUG / INFO / WARNING / ERROR / FATAL
239  kwargs.setdefault('AuditAlgorithms', True)
240 
241 
242  # Configuring SCTCalibWriteTool
243  kwargs.setdefault('SCTCalibWriteTool',
244  acc.popToolsAndMerge(SCTCalibWriteToolCfg(flags)))
245 
246  # Configuring SCT_ConfigurationConditionsTool
247  from SCT_ConditionsTools.SCT_ConditionsToolsConfig import SCT_ConfigurationConditionsToolCfg
248  kwargs.setdefault('SCT_ConfigurationConditionsTool',
249  acc.popToolsAndMerge(SCT_ConfigurationConditionsToolCfg(flags)))
250 
251  # Configuring SCT_ReadCalibDataTool
252  if flags.SCTCalib.UseCalibration:
253  from SCT_ConditionsTools.SCT_ConditionsToolsConfig import SCT_ReadCalibDataToolCfg
254  kwargs.setdefault('SCT_ReadCalibDataTool',
255  acc.popToolsAndMerge(SCT_ReadCalibDataToolCfg(flags)))
256 
257  # Configuring SCT_MajorityConditionsTool
258  if flags.SCTCalib.UseMajority:
259  from SCT_ConditionsTools.SCT_ConditionsToolsConfig import SCT_MajorityConditionsCfg
260  kwargs.setdefault('SCT_MajorityConditionsTool',
261  acc.popToolsAndMerge(SCT_MajorityConditionsCfg(flags)))
262 
263  # Configuring SCTCablingTool
264  from SCT_Cabling.SCT_CablingConfig import SCT_CablingToolCfg
265  kwargs.setdefault('SCT_CablingTool',
266  acc.popToolsAndMerge(SCT_CablingToolCfg(flags)))
267 
268  # Configuring SCT_CalibHitmapTool
269  kwargs.setdefault('SCT_CalibHitmapTool',
270  acc.popToolsAndMerge(SCT_CalibHitmapToolCfg(flags)))
271 
272  # Configuring SCT_CalibLbTool
273  kwargs.setdefault('SCT_CalibLbTool',
274  acc.popToolsAndMerge(SCT_CalibLbToolCfg(flags)))
275 
276  # Configuring SCT_CalibBsErrorTool
277  if flags.SCTCalib.UseBSError:
278  kwargs.setdefault('SCT_CalibBsErrorTool',
279  acc.popToolsAndMerge(SCT_CalibBsErrorToolCfg(flags)))
280 
281  # Configuring SCT_CalibModuleListTool
282  kwargs.setdefault('SCT_CalibModuleListTool',
283  acc.popToolsAndMerge(SCT_CalibModuleListToolCfg(flags)))
284 
285  # Configuring SCT_CalibEventInfo
286  kwargs.setdefault('SCT_CalibEventInfo',
287  acc.popToolsAndMerge(SCT_CalibEventInfoCfg(flags)))
288 
289  from AthenaConfiguration.ComponentFactory import CompFactory
290  acc.addEventAlgo(CompFactory.SCTCalib(name, **kwargs))
291 
292  return acc
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.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:12
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
SCTCalibAlgConfig.SCT_CalibBsErrorToolCfg
def SCT_CalibBsErrorToolCfg(flags, name='SCT_CalibBsErrorTool', **kwargs)
Definition: SCTCalibAlgConfig.py:8
SCTCalibAlgConfig.SCT_CalibModuleListToolCfg
def SCT_CalibModuleListToolCfg(flags, name='SCT_CalibModuleListTool', **kwargs)
Definition: SCTCalibAlgConfig.py:53
python.SCT_ConditionsToolsConfig.SCT_MajorityConditionsCfg
def SCT_MajorityConditionsCfg(flags, name="InDetSCT_MajorityConditions", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:267
SCTCalibAlgConfig.SCT_CalibHitmapToolCfg
def SCT_CalibHitmapToolCfg(flags, name='SCT_CalibHitmapTool', **kwargs)
Definition: SCTCalibAlgConfig.py:30
SCTCalibAlgConfig.SCTCalibWriteToolCfg
def SCTCalibWriteToolCfg(flags, name='SCTCalibWriteTool', **kwargs)
Definition: SCTCalibAlgConfig.py:73
python.SCT_CablingConfig.SCT_CablingToolCfg
def SCT_CablingToolCfg(flags, name="SCT_CablingTool")
Definition: SCT_CablingConfig.py:35
SCTCalibAlgConfig.SCT_CalibLbToolCfg
def SCT_CalibLbToolCfg(flags, name='SCT_CalibLbTool', **kwargs)
Definition: SCTCalibAlgConfig.py:39
python.SCT_ConditionsToolsConfig.SCT_ConfigurationConditionsToolCfg
def SCT_ConfigurationConditionsToolCfg(flags, name="InDetSCT_ConfigurationConditionsTool", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:126
Constants
some useful constants -------------------------------------------------—
python.SCT_ConditionsToolsConfig.SCT_ReadCalibDataToolCfg
def SCT_ReadCalibDataToolCfg(flags, name="InDetSCT_ReadCalibDataTool", cond_kwargs={}, **kwargs)
Definition: SCT_ConditionsToolsConfig.py:359
SCTCalibAlgConfig.SCTCalibAlgCfg
def SCTCalibAlgCfg(flags, SORTime, EORTime, nLB, prefix, name='SCTCalibAlg', **kwargs)
Definition: SCTCalibAlgConfig.py:106
python.SCT_ConditionsToolsConfig.SCT_ByteStreamErrorsToolCfg
def SCT_ByteStreamErrorsToolCfg(flags, name="SCT_ByteStreamErrorsTool", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:12
SCTCalibAlgConfig.SCT_CalibEventInfoCfg
def SCT_CalibEventInfoCfg(flags, name='SCT_CalibEventInfo', **kwargs)
Definition: SCTCalibAlgConfig.py:21