ATLAS Offline Software
SCTErrMonAlg.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 #
4 
5 '''@file SCTErrMonAlg_jobOptions.py
6 @author Susumu Oda
7 @date 2020-10-08
8 @brief New style configuration of SCTErrMonAlg
9 '''
10 
11 
12 def SCTErrMonAlgConfig(flags):
13  import logging
14  local_logger = logging.getLogger('AthenaMonitoringCfg')
15  info = local_logger.info
16  info('SCTErrMonAlgConfig')
17 
18  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
19  result = ComponentAccumulator()
20 
21  from IOVDbSvc.IOVDbSvcConfig import addFolders
22  if flags.Common.isOnline:
23  result.merge(addFolders(flags,'/TDAQ/RunCtrl/DataTakingMode','TDAQ',className='AthenaAttributeList'))
24  info('SCTErrMonAlgConfig: added DATA COOL folders')
25 
26  from AthenaMonitoring import AthMonitorCfgHelper
27  helper = AthMonitorCfgHelper(flags, 'SCTErrMonCfg')
28 
29  from AthenaConfiguration.ComponentFactory import CompFactory
30  myMonAlg = helper.addAlgorithm(CompFactory.SCTErrMonAlg, 'SCTErrMonAlg')
31  myMonAlg.TriggerChain = ""
32 
33  from SCT_ConditionsTools.SCT_ConditionsToolsConfig import SCT_ConditionsSummaryToolCfg
34  myMonAlg.SCT_ConditionsSummaryTool = result.popToolsAndMerge(
36 
37  # Pass the InDet.useDCS flag to the algorithm
38  myMonAlg.UseDCS = flags.InDet.useDCS
39 
40  myMonAlg.doOnlineMon = flags.Common.isOnline
41 
42  from LumiBlockComps.BunchCrossingCondAlgConfig import BunchCrossingCondAlgCfg
43  result.merge(BunchCrossingCondAlgCfg(flags))
44 
45  myMonGroup = helper.addGroup(myMonAlg, "SCTErrMonitor", "SCT/")
46 
47  # Configure histograms
48 
49  from ROOT import SCT_Monitoring as sctMon # import SCT_MonitoringNumbers.h
50 
51  # Filled in fillHistograms
52  myMonGroup.defineHistogram(varname="lumiBlock;NumberOfEventsVsLB",
53  cutmask="is1D",
54  type="TH1F",
55  title="Num of events per LB ;LumiBlock",
56  path="GENERAL/Conf",
57  xbins=sctMon.NBINS_LBs,
58  xmin=0.5,
59  xmax=sctMon.NBINS_LBs+0.5,
60  opt='kAlwaysCreate')
61 
62  # Filled in fillHistograms
63  myMonGroup.defineHistogram(varname="lumiBlock;NumberOfSCTFlagErrorsVsLB",
64  cutmask="sctFlag",
65  type="TH1F",
66  title="Num of SCT Flag errors per LB ;LumiBlock",
67  path="GENERAL/Conf",
68  xbins=sctMon.NBINS_LBs,
69  xmin=0.5,
70  xmax=sctMon.NBINS_LBs+0.5,
71  opt='kAlwaysCreate')
72 
73  # Filled in fillHistograms
74  myMonGroup.defineHistogram(varname="lumiBlock, sctFlag;FractionOfSCTFlagErrorsPerLB",
75  type="TProfile",
76  title="Frac of SCT Flag errors per LB ;LumiBlock",
77  path="GENERAL/Conf",
78  xbins=sctMon.NBINS_LBs,
79  xmin=0.5,
80  xmax=sctMon.NBINS_LBs+0.5,
81  opt='kAlwaysCreate')
82 
83  # Filled in fillConfigurationDetails
84  myMonGroup.defineHistogram(varname="detailedConfBin, nBad;SCTConfDetails",
85  type="TProfile",
86  title="Exclusion from the Configuration",
87  path="GENERAL/Conf",
88  xbins=sctMon.ConfbinsDetailed,
89  xmin=-0.5,
90  xmax=sctMon.ConfbinsDetailed-0.5,
91  xlabels=["Modules", "Link 0", "Link 1",
92  "Chips", "Strips (10^{2})"],
93  opt='kAlwaysCreate')
94 
95  # Filled in fillHistograms
96  myMonGroup.defineHistogram(varname="moduleOutBin, moduleOut;SCTConfOutM",
97  type="TProfile",
98  title="Num of Out Modules in All Region",
99  path="GENERAL/Conf",
100  xbins=1,
101  xmin=-0.5,
102  xmax=0.5,
103  xlabels=["Mod Out"],
104  opt='kAlwaysCreate')
105 
106  # Fiiled in fillByteStreamErrors
107  from ROOT import SCT_ByteStreamErrors
108  for i in range(SCT_ByteStreamErrors.ErrorType.NUM_ERROR_TYPES):
109  myMonGroup.defineHistogram(
110  varname="lumiBlock, n_" +
111  SCT_ByteStreamErrors.ErrorTypeDescription[i] +
112  ";SCT_" +
113  SCT_ByteStreamErrors.ErrorTypeDescription[i] +
114  "VsLbs",
115  type="TProfile",
116  title="Ave. " +
117  SCT_ByteStreamErrors.ErrorTypeDescription[i] +
118  " per LB in All Region;LumiBlock;Num of " +
119  SCT_ByteStreamErrors.ErrorTypeDescription[i],
120  path="GENERAL/Conf",
121  xbins=sctMon.NBINS_LBs,
122  xmin=0.5,
123  xmax=sctMon.NBINS_LBs+0.5,
124  opt='kAlwaysCreate')
125 
126  # Fiiled in fillByteStreamErrors
127  for i in range(sctMon.N_ERRCATEGORY):
128  myMonGroup.defineHistogram(
129  varname="lumiBlock, n_" +
130  sctMon.CategoryErrorsNames[i]+";SCT_LinksWith" +
131  sctMon.CategoryErrorsNames[i]+"VsLbs",
132  type="TProfile",
133  title="Ave. Num of Links with " +
134  sctMon.CategoryErrorsNames[i] +
135  " per LB in All Region;LumiBlock;Num of Links with " +
136  sctMon.CategoryErrorsNames[i],
137  path="GENERAL/Conf",
138  xbins=sctMon.NBINS_LBs,
139  xmin=0.5,
140  xmax=sctMon.NBINS_LBs+0.5,
141  opt='kAlwaysCreate')
142 
143  # Filled in fillByteStreamErrors
144  for errCate in range(sctMon.N_ERRCATEGORY):
145  for region in range(sctMon.N_REGIONS):
146  for layer in range(sctMon.N_ENDCAPSx2):
147  myMonGroup.defineHistogram(
148  varname="eta, phi, hasError_" +
149  sctMon.CategoryErrorsNames[errCate]+"_" +
150  sctMon.subDetNameShort[region].Data()+"_" +
151  str(layer//2)+"_"+str(layer % 2) +
152  ";SCT_NumberOf"+sctMon.CategoryErrorsNames[errCate] +
153  sctMon.subDetNameShort[region].Data()+"_" +
154  str(layer//2)+"_"+str(layer % 2),
155  type="TProfile2D",
156  title="Num of " +
157  sctMon.CategoryErrorsNames[errCate]+" per "+sctMon.layerName[region].Data()+str(
158  layer//2)+"_"+str(layer % 2),
159  path="SCT" +
160  sctMon.subDetNameShort[region].Data() +
161  "/errors/"+sctMon.CategoryErrorsNames[errCate],
162  xbins=sctMon.N_ETA_BINS if region == sctMon.BARREL_INDEX else sctMon.N_ETA_BINS_EC,
163  xmin=(
164  sctMon.FIRST_ETA_BIN if region == sctMon.BARREL_INDEX else sctMon.FIRST_ETA_BIN_EC)-0.5,
165  xmax=(
166  sctMon.LAST_ETA_BIN if region == sctMon.BARREL_INDEX else sctMon.LAST_ETA_BIN_EC)+0.5,
167  ybins=sctMon.N_PHI_BINS if region == sctMon.BARREL_INDEX else sctMon.N_PHI_BINS_EC,
168  ymin=(
169  sctMon.FIRST_PHI_BIN if region == sctMon.BARREL_INDEX else sctMon.FIRST_PHI_BIN_EC)-0.5,
170  ymax=(
171  sctMon.LAST_PHI_BIN if region == sctMon.BARREL_INDEX else sctMon.LAST_PHI_BIN_EC)+0.5,
172  duration="lb",
173  opt='kAlwaysCreate')
174 
175  if myMonAlg.doOnlineMon and sctMon.CategoryErrorsNames[errCate] == "Errors":
176  myMonGroup.defineHistogram(
177  varname="eta, phi, hasError_" +
178  sctMon.CategoryErrorsNames[errCate]+"_recent_" +
179  sctMon.subDetNameShort[region].Data()+"_" +
180  str(layer//2)+"_"+str(layer % 2)+";SummaryErrsRecent_" +
181  sctMon.subDetNameShort[region].Data()+"_" +
182  str(layer//2)+"_"+str(layer % 2),
183  type="TProfile2D",
184  title="Num of " +
185  sctMon.CategoryErrorsNames[errCate] +
186  " per "+sctMon.layerName[region].Data()
187  + str(layer//2)+"_"+str(layer % 2)+" - recent",
188  path="SCT" +
189  sctMon.subDetNameShort[region].Data() +
190  "/errors",
191  xbins=sctMon.N_ETA_BINS if region == sctMon.BARREL_INDEX else sctMon.N_ETA_BINS_EC,
192  xmin=(
193  sctMon.FIRST_ETA_BIN if region == sctMon.BARREL_INDEX else sctMon.FIRST_ETA_BIN_EC)-0.5,
194  xmax=(
195  sctMon.LAST_ETA_BIN if region == sctMon.BARREL_INDEX else sctMon.LAST_ETA_BIN_EC)+0.5,
196  ybins=sctMon.N_PHI_BINS if region == sctMon.BARREL_INDEX else sctMon.N_PHI_BINS_EC,
197  ymin=(
198  sctMon.FIRST_PHI_BIN if region == sctMon.BARREL_INDEX else sctMon.FIRST_PHI_BIN_EC)-0.5,
199  ymax=(
200  sctMon.LAST_PHI_BIN if region == sctMon.BARREL_INDEX else sctMon.LAST_PHI_BIN_EC)+0.5,
201  duration="lowStat",
202  opt='kLBNHistoryDepth=30,kAlwaysCreate')
203 
204  # Filled in fillByteStreamErrorsHelper
205  myMonGroup.defineHistogram(varname="maskedLinksBin;Masked Links",
206  weight="maskedLinks",
207  type="TProfile",
208  title="Number of Masked Links for SCT,ECA,B,ECC",
209  path="GENERAL/errors",
210  xbins=sctMon.N_REGIONS_INC_GENERAL,
211  xmin=-0.5,
212  xmax=sctMon.N_REGIONS_INC_GENERAL-0.5,
213  xlabels=["EndCapC", "Barrel", "EndCapA", "All"],
214  opt='kAlwaysCreate')
215 
216  # Filled in fillHistograms
217  myMonGroup.defineHistogram(varname="flaggedWafersIndices, nFlaggedWafers;FlaggedWafers",
218  type="TProfile",
219  title="Number of flagged wafers for SCT,ECA,B,ECC",
220  path="GENERAL/errors",
221  xbins=sctMon.N_REGIONS_INC_GENERAL,
222  xmin=-0.5,
223  xmax=sctMon.N_REGIONS_INC_GENERAL-0.5,
224  xlabels=["EndCapC", "Barrel", "EndCapA", "All"],
225  opt='kAlwaysCreate')
226 
227  # Filled in fillByteStreamErrors
228  coverageTitles = [
229  "", # All (not used)
230  "Ave. Coverage of Enabled Links per LB", # All - Disabled
231  "Ave. Coverage of Links with No Bad LinkLevelError per LB", # All - BadLinkLevelError
232  "Ave. Coverage of Links with No Bad RODLevelError per LB", # All - BadRODLevelError
233  "Ave. Coverage of Links with No Bad Error per LB", # All - BadError
234  "Ave. Coverage of links Not Affected by PS Trip", # All - PSTrip (DCS)
235  "Ave. Coverage of Links With No Bad Problem per LB" # All - Summary
236  ]
237  for iProblem in range(1, sctMon.numberOfProblemForCoverage):
238  myMonGroup.defineHistogram(
239  varname="lumiBlock, detectorCoverage" +
240  sctMon.coverageVarNames[iProblem]+";SCT_Coverage" +
241  sctMon.coverageVarNames[iProblem]+"VsLbs",
242  type="TProfile",
243  title=coverageTitles[iProblem] +
244  ";LumiBlock;Detector Coverage [%]",
245  path="DetectorCoverage",
246  xbins=sctMon.NBINS_LBs,
247  xmin=0.5,
248  xmax=sctMon.NBINS_LBs+0.5,
249  opt='kAlwaysCreate')
250 
251  if iProblem == sctMon.summary:
252  myMonGroup.defineHistogram(
253  varname="lumiBlock, detectorCoverage" +
254  sctMon.coverageVarNames[iProblem]+"InR4P;SCT_Coverage" +
255  sctMon.coverageVarNames[iProblem]+"InR4PVsLbs",
256  type="TProfile",
257  title=coverageTitles[iProblem] + " in Ready for Physics" +
258  ";LumiBlock;Detector Coverage [%]",
259  path="DetectorCoverage",
260  xbins=sctMon.NBINS_LBs,
261  xmin=0.5,
262  xmax=sctMon.NBINS_LBs+0.5,
263  opt='kAlwaysCreate')
264 
265  # Fiiled in fillByteStreamErrors
266  myMonGroup.defineHistogram(varname="lumiBlock, psTripModules;SCT_ModulesWithPSTripVsLbs",
267  type="TProfile",
268  title="Ave. Num of Modules Affected by PS Trip per LB in All Region;LumiBlock;Num. of Modules Affected by PS Trip",
269  path="DetectorCoverage",
270  xbins=sctMon.NBINS_LBs,
271  xmin=0.5,
272  xmax=sctMon.NBINS_LBs+0.5,
273  opt='kAlwaysCreate')
274 
275  # Module maps
276  for region in range(sctMon.N_REGIONS):
277  for layer in range(sctMon.n_layers[region]*2):
278  myMonGroup.defineHistogram(
279  varname="eta_out, phi_out, modulemap" +
280  sctMon.subDetNameShort[region].Data()+str(layer//2)+"_" +
281  str(layer % 2)+";modulemap" +
282  sctMon.subDetNameShort[region].Data()+str(layer//2)+"_" +
283  str(layer % 2),
284  type="TProfile2D",
285  title="Module out of configuration: "+sctMon.layerName[region].Data()+str(layer//2)+" side "+str(
286  layer % 2) + ";Index in the direction of #eta;Index in the direction of #phi",
287  path="SCT" +
288  sctMon.subDetNameShort[region].Data()+"/Conf/",
289  xbins=sctMon.N_ETA_BINS if region == sctMon.BARREL_INDEX else sctMon.N_ETA_BINS_EC,
290  xmin=(sctMon.FIRST_ETA_BIN if region ==
291  sctMon.BARREL_INDEX else sctMon.FIRST_ETA_BIN_EC)-0.5,
292  xmax=(
293  sctMon.LAST_ETA_BIN if region == sctMon.BARREL_INDEX else sctMon.LAST_ETA_BIN_EC)+0.5,
294  ybins=sctMon.N_PHI_BINS if region == sctMon.BARREL_INDEX else sctMon.N_PHI_BINS_EC,
295  ymin=(sctMon.FIRST_PHI_BIN if region ==
296  sctMon.BARREL_INDEX else sctMon.FIRST_PHI_BIN_EC)-0.5,
297  ymax=(
298  sctMon.LAST_PHI_BIN if region == sctMon.BARREL_INDEX else sctMon.LAST_PHI_BIN_EC)+0.5,
299  duration="lb",
300  opt='kAlwaysCreate')
301 
302  # Filled in fillByteStreamErrorsHelper
303  xlabels = [SCT_ByteStreamErrors.ErrorTypeDescription[i]
304  for i in range(SCT_ByteStreamErrors.ErrorType.NUM_ERROR_TYPES)]
305  for reg in range(sctMon.N_REGIONS):
306  nLayers = sctMon.n_layers[reg]*2
307  ylabels = [str(i//2)+"_"+str(i % 2) for i in range(nLayers)]
308  myMonGroup.defineHistogram(varname="errorType, layerSide, errorFraction;RateErrorsPerLumi",
309  cutmask="is" +
310  sctMon.subDetNameShort[reg].Data(),
311  type="TProfile2D",
312  title="Rate of Error Types for " +
313  sctMon.layerName[reg].Data() +
314  " per Lumi-Block",
315  path="SCT" +
316  sctMon.subDetNameShort[reg].Data(
317  )+"/errors",
318  xbins=SCT_ByteStreamErrors.ErrorType.NUM_ERROR_TYPES,
319  xmin=-0.5,
320  xmax=SCT_ByteStreamErrors.ErrorType.NUM_ERROR_TYPES-0.5,
321  xlabels=xlabels,
322  ybins=nLayers,
323  ymin=-0.5,
324  ymax=nLayers-0.5,
325  ylabels=ylabels,
326  duration="lb",
327  opt='kAlwaysCreate')
328 
329  result.merge(helper.result())
330  return result
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
SCTErrMonAlg.SCTErrMonAlgConfig
def SCTErrMonAlgConfig(flags)
Definition: SCTErrMonAlg.py:12
python.BunchCrossingCondAlgConfig.BunchCrossingCondAlgCfg
def BunchCrossingCondAlgCfg(flags)
Definition: BunchCrossingCondAlgConfig.py:8
python.SCT_ConditionsToolsConfig.SCT_ConditionsSummaryToolCfg
def SCT_ConditionsSummaryToolCfg(flags, name="InDetSCT_ConditionsSummaryTool", **kwargs)
Definition: SCT_ConditionsToolsConfig.py:80
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:194
python.IOVDbSvcConfig.addFolders
def addFolders(flags, folderStrings, detDb=None, className=None, extensible=False, tag=None, db=None, modifiers='')
Definition: IOVDbSvcConfig.py:86
str
Definition: BTagTrackIpAccessor.cxx:11
python.ParticleTypeUtil.info
def info
Definition: ParticleTypeUtil.py:87