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