ATLAS Offline Software
PixelAthMonitoringBase.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 #
4 
5 '''
6 @file PixelAthMonitoringBase.py
7 @brief Helper functions for Run 3 Pixel monitoring algorithm configuration
8 '''
9 runtext = ''
10 
11 NumLayersDisk = 3
12 NumStavesIBL = 14
13 NumStavesL0 = 22
14 NumStavesL1 = 38
15 NumStavesL2 = 52
16 
17 NumModulesBarrel= 13
18 NumModulesDisk = 48
19 NumPP0sEC = 24
20 
21 btxt = ";eta index of module"
22 sbtxt = ";shifted eta index of module"
23 ditxt = ";disk number"
24 layers = ["ECA","ECC","BLayer","Layer1","Layer2","IBL2D","IBL3D"]
25 baselayers=["ECA","ECC","BLayer","Layer1","Layer2","IBL"]
26 xbinsl = [ 3, 3, 13, 13, 13, 32]
27 xminsl = [ -0.5, -0.5,-6.5,-6.5,-6.5,-16.5]
28 ybinsl = [ 48, 48, 22, 38, 52, 14]
29 etatxt = [ditxt,ditxt,btxt,btxt,btxt,sbtxt]
30 phitext = ";phi index of module"
31 xbinsfel = [ 24, 24, 104, 104, 104, 32]
32 xminsfel = [ -0.5, -0.5, -52, -52, -52,-16.5]
33 ybinsfel = [ 96, 96, 44, 76, 104, 14]
34 
35 totcuts = [ 15, 15, 15, 15, 15, 4, 4]
36 xbinsem = [ 3, 3, 13, 13, 13, 20]
37 xminsem = [ 0.5, 0.5,-6.5,-6.5,-6.5, -10]
38 xbinstotz= [ 3, 3, 13, 13, 13, 20]
39 xminstotz= [ -0.5, -0.5,-0.5,-0.5,-0.5, -0.5]
40 ztotbinsy= [ 20, 20, 20, 20, 20, 20, 20]
41 ztotminsy= [ 19.5, 19.5, 7.5,19.5,19.5, -0.5, -0.5]
42 errbbinsy= [ 17, 17, 17, 17, 17, 27, 27]
43 errbminsy= [ 0, 0, 0, 0, 0, 0, 0]
44 errbbsizy= [ 1, 1, 1, 1, 1, 1, 1]
45 errtbinsy= [ 7, 7, 7, 7, 7, 7, 7]
46 
47 pp0layers= ["ECA","ECC","BLayer","Layer1","Layer2","IBLA","IBLC"]
48 pp0xbins = [ 24, 24, 22, 38, 52, 14, 14]
49 
50 fei3layers= ["ECA","ECC","BLayer","Layer1","Layer2"]
51 fei4layers= ["IBL2D","IBL3D"]
52 
53 lumitext = ";lumi block"
54 lumibinsx = 3000
55 
56 bcidbinsx = 3600
57 
58 #labels
59 LayersDisk = ["Disk 1", "Disk 2", "Disk 3"] #x EC
60 #xBarrel
61 ModulesBarrel = [
62  "M6C", "M5C", "M4C", "M3C", "M2C", "M1C", "M0","M1A", "M2A", "M3A", "M4A",
63  "M5A", "M6A"]
64 #xIBL
65 ModulesIBL = [
66  "C8_0", "C8_1", "C7_0", "C7_1", "C6_0", "C6_1", "C5_0", "C5_1", "C4_0", "C4_1", "C3_0", "C3_1", "C2_0", "C2_1",
67  "C1_0", "C1_1", "A1_0", "A1_1", "A2_0", "A2_1", "A3_0", "A3_1", "A4_0", "A4_1", "A5_0", "A5_1", "A6_0", "A6_1",
68  "A7_0", "A7_1", "A8_0", "A8_1"]
69 
70 LabelX = [LayersDisk, LayersDisk, ModulesBarrel, ModulesBarrel, ModulesBarrel, ModulesIBL]
71 
72 #same for FE
73 LayersDiskFE = ["Disk1_FE_8_7","Disk1_FE_9_6","Disk1_FE_10_5","Disk1_FE_11_4","Disk1_FE_12_3","Disk1_FE_13_2","Disk1_FE_14_1","Disk1_FE_15_0",
74  "Disk2_FE_7_8","Disk2_FE_6_9","Disk2_FE_5_10","Disk2_FE_4_11","Disk2_FE_3_12","Disk2_FE_2_13","Disk2_FE_1_14","Disk2_FE_0_15",
75  "Disk3_FE_8_7","Disk3_FE_9_6","Disk3_FE_10_5","Disk3_FE_11_4","Disk3_FE_12_3","Disk3_FE_13_2","Disk3_FE_14_1","Disk3_FE_15_0"]
76 
77 ModulesBarrelFE = [
78  "M6C_FE_8_7","M6C_FE_9_6","M6C_FE_10_5","M6C_FE_11_4","M6C_FE_12_3","M6C_FE_13_2","M6C_FE_14_1","M6C_FE_15_0",
79  "M5C_FE_8_7","M5C_FE_9_6","M5C_FE_10_5","M5C_FE_11_4","M5C_FE_12_3","M5C_FE_13_2","M5C_FE_14_1","M5C_FE_15_0",
80  "M4C_FE_8_7","M4C_FE_9_6","M4C_FE_10_5","M4C_FE_11_4","M4C_FE_12_3","M4C_FE_13_2","M4C_FE_14_1","M4C_FE_15_0",
81  "M3C_FE_8_7","M3C_FE_9_6","M3C_FE_10_5","M3C_FE_11_4","M3C_FE_12_3","M3C_FE_13_2","M3C_FE_14_1","M3C_FE_15_0",
82  "M2C_FE_8_7","M2C_FE_9_6","M2C_FE_10_5","M2C_FE_11_4","M2C_FE_12_3","M2C_FE_13_2","M2C_FE_14_1","M2C_FE_15_0",
83  "M1C_FE_8_7","M1C_FE_9_6","M1C_FE_10_5","M1C_FE_11_4","M1C_FE_12_3","M1C_FE_13_2","M1C_FE_14_1","M1C_FE_15_0",
84  "M0_FE_8_7","M0_FE_9_6","M0_FE_10_5","M0_FE_11_4","M0_FE_12_3","M0_FE_13_2","M0_FE_14_1","M0_FE_15_0",
85  "M1A_FE_8_7","M1A_FE_9_6","M1A_FE_10_5","M1A_FE_11_4","M1A_FE_12_3","M1A_FE_13_2","M1A_FE_14_1","M1A_FE_15_0",
86  "M2A_FE_8_7","M2A_FE_9_6","M2A_FE_10_5","M2A_FE_11_4","M2A_FE_12_3","M2A_FE_13_2","M2A_FE_14_1","M2A_FE_15_0",
87  "M3A_FE_8_7","M3A_FE_9_6","M3A_FE_10_5","M3A_FE_11_4","M3A_FE_12_3","M3A_FE_13_2","M3A_FE_14_1","M3A_FE_15_0",
88  "M4A_FE_8_7","M4A_FE_9_6","M4A_FE_10_5","M4A_FE_11_4","M4A_FE_12_3","M4A_FE_13_2","M4A_FE_14_1","M4A_FE_15_0",
89  "M5A_FE_8_7","M5A_FE_9_6","M5A_FE_10_5","M5A_FE_11_4","M5A_FE_12_3","M5A_FE_13_2","M5A_FE_14_1","M5A_FE_15_0",
90  "M6A_FE_8_7","M6A_FE_9_6","M6A_FE_10_5","M6A_FE_11_4","M6A_FE_12_3","M6A_FE_13_2","M6A_FE_14_1","M6A_FE_15_0"]
91 
92 LabelFEX = [LayersDiskFE, LayersDiskFE, ModulesBarrelFE, ModulesBarrelFE, ModulesBarrelFE, ModulesIBL]
93 
94 ModulesECA = [
95  "B01_S2_M1", "B01_S2_M6", "B01_S2_M2", "B01_S2_M5", "B01_S2_M3",
96  "B01_S2_M4", "B02_S1_M1", "B02_S1_M6", "B02_S1_M2", "B02_S1_M5",
97  "B02_S1_M3", "B02_S1_M4", "B02_S2_M1", "B02_S2_M6", "B02_S2_M2",
98  "B02_S2_M5", "B02_S2_M3", "B02_S2_M4", "B03_S1_M1", "B03_S1_M6",
99  "B03_S1_M2", "B03_S1_M5", "B03_S1_M3", "B03_S1_M4", "B03_S2_M1",
100  "B03_S2_M6", "B03_S2_M2", "B03_S2_M5", "B03_S2_M3", "B03_S2_M4",
101  "B04_S1_M1", "B04_S1_M6", "B04_S1_M2", "B04_S1_M5", "B04_S1_M3",
102  "B04_S1_M4", "B04_S2_M1", "B04_S2_M6", "B04_S2_M2", "B04_S2_M5",
103  "B04_S2_M3", "B04_S2_M4", "B01_S1_M1", "B01_S1_M6", "B01_S1_M2",
104  "B01_S1_M5", "B01_S1_M3", "B01_S1_M4"]
105 ModulesECC = [
106  "B01_S2_M4", "B01_S2_M3", "B01_S2_M5", "B01_S2_M2", "B01_S2_M6",
107  "B01_S2_M1", "B02_S1_M4", "B02_S1_M3", "B02_S1_M5", "B02_S1_M2",
108  "B02_S1_M6", "B02_S1_M1", "B02_S2_M4", "B02_S2_M3", "B02_S2_M5",
109  "B02_S2_M2", "B02_S2_M6", "B02_S2_M1", "B03_S1_M4", "B03_S1_M3",
110  "B03_S1_M5", "B03_S1_M2", "B03_S1_M6", "B03_S1_M1", "B03_S2_M4",
111  "B03_S2_M3", "B03_S2_M5", "B03_S2_M2", "B03_S2_M6", "B03_S2_M1",
112  "B04_S1_M4", "B04_S1_M3", "B04_S1_M5", "B04_S1_M2", "B04_S1_M6",
113  "B04_S1_M1", "B04_S2_M4", "B04_S2_M3", "B04_S2_M5", "B04_S2_M2",
114  "B04_S2_M6", "B04_S2_M1", "B01_S1_M4", "B01_S1_M3", "B01_S1_M5",
115  "B01_S1_M2", "B01_S1_M6", "B01_S1_M1"]
116 
117 
118 #yBarrel
119 StavesL0 = [
120  "B11_S2", "B01_S1", "B01_S2", "B02_S1", "B02_S2", "B03_S1", "B03_S2",
121  "B04_S1", "B04_S2", "B05_S1", "B05_S2", "B06_S1", "B06_S2", "B07_S1",
122  "B07_S2", "B08_S1", "B08_S2", "B09_S1", "B09_S2", "B10_S1", "B10_S2",
123  "B11_S1"]
124 
125 
126 StavesL1 = [
127  "B01_S1", "B01_S2", "B02_S1", "B02_S2", "B03_S1", "B03_S2", "B04_S1",
128  "B04_S2", "B05_S1", "B05_S2", "B06_S1", "B06_S2", "B07_S1", "B07_S2",
129  "B08_S1", "B08_S2", "B09_S1", "B09_S2", "B10_S1", "B10_S2", "B11_S1",
130  "B11_S2", "B12_S1", "B12_S2", "B13_S1", "B13_S2", "B14_S1", "B14_S2",
131  "B15_S1", "B15_S2", "B16_S1", "B16_S2", "B17_S1", "B17_S2", "B18_S1",
132  "B18_S2", "B19_S1", "B19_S2"]
133 
134 StavesL2 = [
135  "B01_S2", "B02_S1", "B02_S2", "B03_S1", "B03_S2", "B04_S1", "B04_S2",
136  "B05_S1", "B05_S2", "B06_S1", "B06_S2", "B07_S1", "B07_S2", "B08_S1",
137  "B08_S2", "B09_S1", "B09_S2", "B10_S1", "B10_S2", "B11_S1", "B11_S2",
138  "B12_S1", "B12_S2", "B13_S1", "B13_S2", "B14_S1", "B14_S2", "B15_S1",
139  "B15_S2", "B16_S1", "B16_S2", "B17_S1", "B17_S2", "B18_S1", "B18_S2",
140  "B19_S1", "B19_S2", "B20_S1", "B20_S2", "B21_S1", "B21_S2", "B22_S1",
141  "B22_S2", "B23_S1", "B23_S2", "B24_S1", "B24_S2", "B25_S1", "B25_S2",
142  "B26_S1", "B26_S2", "B01_S1"]
143 #yIBL
144 StavesIBL = [
145  "S01", "S02", "S03", "S04", "S05", "S06", "S07", "S08", "S09", "S10", "S11",
146  "S12", "S13","S14"]
147 
148 LabelY = [ModulesECA, ModulesECC, StavesL0, StavesL1, StavesL2, StavesIBL]
149 
150 #same for per-FE
151 ModulesFEECA = []
152 for i in ModulesECA:
153  ModulesFEECA.extend([i+'_FE#1', i+'_FE#2'])
154 ModulesFEECC = []
155 for i in ModulesECC:
156  ModulesFEECC.extend([i+'_FE#1', i+'_FE#2'])
157 StavesFEL0 = []
158 for i in StavesL0:
159  StavesFEL0.extend([i+'_FE#1', i+'_FE#2'])
160 StavesFEL1 = []
161 for i in StavesL1:
162  StavesFEL1.extend([i+'_FE#1', i+'_FE#2'])
163 StavesFEL2 = []
164 for i in StavesL2:
165  StavesFEL2.extend([i+'_FE#1', i+'_FE#2'])
166 LabelFEY = [ModulesFEECA, ModulesFEECC, StavesFEL0, StavesFEL1, StavesFEL2, StavesIBL]
167 
168 #PP0
169 PP0sEC = [
170  "D1_B01_S2", "D1_B02_S1", "D1_B02_S2", "D1_B03_S1", "D1_B03_S2", "D1_B04_S1", "D1_B04_S2", "D1_B01_S1",
171  "D2_B01_S2", "D2_B02_S1", "D2_B02_S2", "D2_B03_S1", "D2_B03_S2", "D2_B04_S1", "D2_B04_S2", "D2_B01_S1",
172  "D3_B01_S2", "D3_B02_S1", "D3_B02_S2", "D3_B03_S1", "D3_B03_S2", "D3_B04_S1", "D3_B04_S2", "D3_B01_S1"]
173 
174 PP0LabelX = [PP0sEC, PP0sEC, StavesL0, StavesL1, StavesL2, StavesIBL, StavesIBL]
175 
176 #Head of modules' name
177 ModulesHead = ["D", "D", "L0", "L1", "L2", "LI"]
178 #Errors
179 ErrStateLabelsFEI3 = [
180  ("RODTimeout", "ROD Formatter Timeout"),
181  ("RODSyncBCIDErrors", "ROD BCID Sync"),
182  ("RODSyncLVL1IDErrors", "ROD LVL1ID Sync"),
183  ("OpticalErrors", "Preamble/Header"),
184  ("ModSyncLVL1IDErrors", "FE/MCC LVL1ID Sync"),
185  ("ModSyncBCID2Errors", "FE/MCC BCID2 Sync"),
186  ("ModSyncBCID1Errors", "FE/MCC BCID1 Sync"),
187  ("ModTruncEoEOverflowErrors", "FE/MCC EoE Overflow Trunc"),
188  ("ModTruncHitOverflowErrors", "FE/MCC Hit Overflow Trunc"),
189  ("FEWarning", "FE Warning"),
190  ("SEUHitParity", "SEU Hit Parity"),
191  ("SEURegisterParity", "SEU Register Parity"),
192  ("SEUHamming", "SEU Hamming Code"),
193  ("ModTruncEOCErrors", "FE/MCC EoC Trunc"),
194  ("RODTrailerBitErrors", "ROD Trailer Bit"),
195  ("RODTruncHTLimitErrors", "ROD H/T Limit Trunc"),
196  ("RODTruncRODOFErrors", "ROD Overflow Trunc")
197 ]
198 ErrStateLabelsFEI4 = [
199  ("RODTimeoutErrors", "ROD Timeout"),
200  ("RODBCIDErrors", "ROD BCID synchronization"),
201  ("RODLVL1IDErrors", "ROD LVL1ID synchronization"),
202  ("RODPreambleErrors", "ROD Preamble"),
203  ("RODTrailerErrors", "ROD Trailer"),
204  ("RODRowColumnErrors", "ROD row-column"),
205  ("RODMaskedLink", "ROD Masked link"),
206  ("RODLimitErrors", "ROD Header Trailer limit"),
207  ("SR0BCIDCounterErrors", "SR0 BCID counter"),
208  ("SR1HammingCode0Errors", "SR1 Hamming code in word 0"),
209  ("SR2HammingCode1Errors", "SR2 Hamming code in word 1"),
210  ("SR3HammingCode2Errors", "SR3 Hamming code in word 2"),
211  ("SR4L1InCounterErrors", "SR4 L1 in counter"),
212  ("SR5L1RequestCounterErrors", "SR5 L1 request counter"),
213  ("SR6L1RegisterErrors", "SR6 L1 register"),
214  ("SR7L1TriggerIDErrors", "SR7 L1 trigger ID"),
215  ("SR8FEReadoutProcessErrors", "SR8 FE readout process"),
216  ("SR15SkipppedTrigCountErrors", "SR15 Skipped trigger counter"),
217  ("SR16TruncatedEventFlagErrors", "SR16 Truncated event"),
218  ("SR24TripleRedundantErrorsCNFGMEM", "SR24 Triple redundant CNFGMEM"),
219  ("SR25WriteRegDataErrors", "SR25 Write register data"),
220  ("SR26AddressErrors", "SR26 Address"),
221  ("SR27OtherCMDDecoderErrors", "SR27 CMD decoder"),
222  ("SR28CMDDecoderBitflipErrors", "SR28 CMD decoder bit flip"),
223  ("SR29TripleRedundantErrorsCMD", "SR29 Triple redundant CMD"),
224  ("SR30DataBusAddressErrors", "SR30 Data bus address"),
225  ("SR31TripleRedundantErrorsEFUSE", "SR31 Triple redundant EFUSE")
226 ]
227 
228 ErrCatRODModLabels = [
229  ("SyncErrorsMod", "FE/MCC Sync Errors"),
230  ("SyncErrorsROD", "ROD Sync Errors"),
231  ("TruncErrorsMod", "FE/MCC Trunc Errors"),
232  ("TruncErrorsROD", "ROD Trunc Errors"),
233  ("OpticalErrorsRODMod", "Preamble/Header Errors"),
234  ("SEUErrorsRODMod", "SEU Errors"),
235  ("TimeoutErrorsRODMod", "Timeout Errors")
236 ]
237 
238 ErrCatRODModLabelsNorm = [
239  "SyncErrorsModFracPerEvent",
240  "SyncErrorsRODFracPerEvent",
241  "TruncErrorsModFracPerEvent",
242  "TruncErrorsRODFracPerEvent"
243 ]
244 
245 ErrCatLabels = [
246  ("SyncErrors", "Sync Errors (FE/MCC & ROD)"),
247  ("TruncErrors", "Trunc Errors (FE/MCC & ROD)"),
248  ("OpticalErrors", "Preamble/Header Errors"),
249  ("SEUErrors", "SEU Errors"),
250  ("TimeoutErrors", "Timeout Errors")
251 ]
252 
253 ErrCatLabelsNorm = [
254  "SyncErrorsFracPerEvent",
255  "TruncationErrorsFracPerEvent",
256  "OpticalErrorsFracPerEvent",
257  "SEUErrorsFracPerEvent",
258  "TimeoutErrorsFracPerEvent"
259 ]
260 
261 ReadingDataErrLabels = [
262  "Invalid container",
263  "Invalid collection",
264  "Container empty"
265 ]
266 
267 layergroups = {}
268 def getLayerGroup(helper, alg, layer):
269  if alg not in layergroups:
270  layergroups[alg] = {}
271  if layer not in layergroups[alg]:
272  layergroups[alg][layer] = helper.addGroup(alg, layer)
273  return layergroups[alg][layer]
274 
275 
276 def define2DProfHist(helper, alg, name, title, path, type='TProfile2D', doWeight=False, lifecycle='run', zmin=None, zmax=None, opt='', histname=None, onlylayers=baselayers):
277  '''
278  This function configures 2D (Profile) histograms (or maps) for Pixel base (i.e. w/o split in 2D/3D in IBL) layers.
279 
280  Arguments:
281  helper -- AthMonitorCfgHelper(Old) instance
282  alg -- algorithm - Configurable object returned from addAlgorithm
283  name -- Name of histogram (Name = name_layer)
284  title -- Title of histogram (Title = title +' '+layer)
285  path -- Path in output file for histogram
286  type -- Type of histogram (TH2D, TProfile2D)
287  lifecycle -- global life duration of histograms (run, lowStat [i.e. 20 LB], lumiblock) - APPLIES to MonGroup only
288  zmin(zmax) -- fix the displayed range - simply chopping the range!!!
289  opt -- history depth of a histogram e.g. 'kLBNHistoryDepth=10'
290  histname -- another way of naming the histogram(s), useful when multiple histograms are filled from exactly the same variables, but in a different way
291  onlylayers -- sublist of Pixel layers
292  '''
293  assert(set(onlylayers).issubset(baselayers))
294  if histname is None:
295  histname = name
296  for i, layer in enumerate(baselayers):
297  if layer not in onlylayers:
298  continue
299  fulltitle = title + ', {0}'.format(layer) + runtext + etatxt[i] + phitext
300  layerGroup = getLayerGroup(helper, alg, layer)
301 
302  fullvarstring = '{0}_{1},{0}_{2}'.format(name, 'em', 'pm')
303  weightvar = ''
304  if 'Profile' in type:
305  fullvarstring += ',{0}_{1}'.format(name, 'val')
306  elif doWeight:
307  weightvar = '{0}_{1}'.format(name, 'val') # re-use the same variable for TH2 for now.
308 
309  fullvarstring += ';' + histname + '_{0}'.format(layer)
310  layerGroup.defineHistogram(fullvarstring,
311  type=type, path=path, title=fulltitle, weight=weightvar,
312  xbins=xbinsl[i], xmin=xminsl[i], xmax=xminsl[i]+xbinsl[i],
313  ybins=ybinsl[i], ymin=-0.5, ymax=-0.5+ybinsl[i],
314  zmin=zmin, zmax=zmax,
315  duration=lifecycle,
316  opt=opt, xlabels=LabelX[i], ylabels=LabelY[i])
317 
318 def define2DProfPerFEHist(helper, alg, name, title, path, type='TProfile2D', doWeight=False, lifecycle='run', zmin=None, zmax=None, opt='', histname=None, onlylayers=baselayers):
319  '''
320  This function configures 2D (Profile) histograms (or maps) for Pixel base (i.e. w/o split in 2D/3D in IBL) layers per FE.
321 
322  Arguments:
323  helper -- AthMonitorCfgHelper(Old) instance
324  alg -- algorithm - Configurable object returned from addAlgorithm
325  name -- Name of histogram (Name = name_layer)
326  title -- Title of histogram (Title = title +' '+layer)
327  path -- Path in output file for histogram
328  type -- Type of histogram (TH2D, TProfile2D)
329  lifecycle -- global life duration of histograms (run, lowStat [i.e. 20 LB], lumiblock) - APPLIES to MonGroup only
330  zmin(zmax) -- fix the displayed range - simply chopping the range!!!
331  opt -- history depth of a histogram e.g. 'kLBNHistoryDepth=10'
332  histname -- another way of naming the histogram(s), useful when multiple histograms are filled from exactly the same variables, but in a different way
333  onlylayers -- sublist of Pixel layers
334  '''
335  assert(set(onlylayers).issubset(baselayers))
336  if histname is None:
337  histname = name
338  for i, layer in enumerate(baselayers):
339  if layer not in onlylayers:
340  continue
341  fulltitle = title + ', {0}'.format(layer) + runtext + etatxt[i] + phitext
342  layerGroup = getLayerGroup(helper, alg, layer)
343 
344  fullvarstring = '{0}_{1},{0}_{2}'.format(name, 'em', 'pm')
345  weightvar = ''
346  if 'Profile' in type:
347  fullvarstring += ',{0}_{1}'.format(name, 'val')
348  elif doWeight:
349  weightvar = '{0}_{1}'.format(name, 'val') # re-use the same variable for TH2 for now.
350 
351  fullvarstring += ';' + histname + '_{0}'.format(layer)
352  layerGroup.defineHistogram(fullvarstring,
353  type=type, path=path, title=fulltitle, weight=weightvar,
354  xbins=xbinsfel[i], xmin=xminsfel[i], xmax=xminsfel[i]+xbinsfel[i],
355  ybins=ybinsfel[i], ymin=-0.5, ymax=-0.5+ybinsfel[i],
356  zmin=zmin, zmax=zmax,
357  duration=lifecycle,
358  opt=opt, xlabels=LabelFEX[i], ylabels=LabelFEY[i])
359 
360 
361 def definePP0Histos(helper, alg, name, title, path, opt=''):
362  '''
363  This function configures TProfile histograms for Pixel layers per pp0 or ROD.
364 
365  Arguments:
366  helper -- AthMonitorCfgHelper(Old) instance
367  alg -- algorithm Configurable object returned from addAlgorithm
368  name -- Name of histogram (Name = name_layer)
369  title -- Title of histogram (Title = title +' '+layer)
370  path -- Path in ouput file for histogram
371  opt -- history depth of a histogram e.g. 'kLBNHistoryDepth=10'
372  '''
373 
374  for i, layer in enumerate(pp0layers):
375  if i<2:
376  xatxt = ';sector'
377  else :
378  xatxt = ';stave'
379  yatxt = ';average # clusters per event per '
380  if i>4:
381  yatxt += 'FE'
382  else :
383  yatxt += 'module'
384  fulltitle = title + ', {0}'.format(layer) + runtext + xatxt + yatxt
385  groupname = name + '_{0}'.format(layer)
386  layerGroup = getLayerGroup(helper, alg, layer)
387  fullvarstring = '{0}_{1},{0}_{2}'.format(name, 'pospp0x', 'val')
388  fullvarstring += ';' + groupname
389  layerGroup.defineHistogram(fullvarstring,
390  type='TProfile', path=path, title=fulltitle,
391  xbins=pp0xbins[i], xmin=-0.5, xmax=-0.5+pp0xbins[i],
392  opt=opt, xlabels=PP0LabelX[i])
393 
394 
395 
396 def define1DProfLumiLayers(helper, alg, name, title, path, yaxistext, type='TProfile', opt='', histname=None, onlylayers=layers):
397  '''
398  This function configures 1D (Profile) vs lumi histograms for Pixel layers.
399 
400  Arguments:
401  helper -- AthMonitorCfgHelper(Old) instance
402  alg -- algorithm Configurable object returned from addAlgorithm
403  name -- Name of histogram (Name = name_layer)
404  title -- Title of histogram (Title = title +' '+layer)
405  path -- Path in ouput file for histogram
406  yaxistext -- Text on the y-axis
407  type -- Type of histogram (TH1D, TProfile)
408  opt -- history depth of a histogram e.g. 'kLBNHistoryDepth=10' or 'kLive=100'
409  histname -- another way of naming the histogram(s), useful when multiple histograms are filled from exactly the same variables, but in a different way
410  onlylayers -- sublist of layers
411  '''
412  assert(set(onlylayers).issubset(layers))
413  if histname is None:
414  histname = name
415  if "kLive" in opt:
416  xbins = int(opt.split('=')[1])
417  else:
418  xbins = lumibinsx
419  for layer in layers:
420  if layer not in onlylayers:
421  continue
422  fulltitle = title + ', {0}'.format(layer) + runtext + lumitext + yaxistext
423  fullvarstring = '{0}_{1}'.format(name,'lb')
424  if 'Profile' in type: fullvarstring += ',{0}_{1}'.format(name, 'val')
425  fullvarstring += ';' + histname + '_{0}'.format(layer)
426  layerGroup = getLayerGroup(helper, alg, layer)
427  layerGroup.defineHistogram(fullvarstring,
428  type=type, path=path, title=fulltitle,
429  xbins=xbins, xmin=-0.5, xmax=-0.5+xbins, opt=opt)
430 
431 def defineMapVsLumiLayers(helper, alg, name, title, path, xaxistext, yaxistext, ybins, ymins, binsizes=[1.0], ylabels=None, opt='', type='TH2F', histname=None, onlylayers=layers):
432  '''
433  This function configures 2D histograms vs lumi for Pixel base (i.e. w/o split in 2D/3D in IBL) layers.
434 
435  Arguments:
436  helper -- AthMonitorCfgHelper(Old) instance
437  alg -- algorithm Configurable object returned from addAlgorithm
438  name -- Name of histogram (Name = name_layer)
439  title -- Title of histogram (Title = title +' '+layer)
440  path -- Path in ouput file for histogram
441  ybins, ymin, ymax, yaxistext
442  -- Configure Y-axis
443  opt -- history depth of a histogram e.g. 'kLBNHistoryDepth=10' or 'kLive=100'
444  type -- Type of histogram (TH2I, TH2F, TProfile2D)
445  histname-- alternative root name of the histogram (to be filled with the same variables defined by 'name' above)
446  onlylayers -- sublist of Pixel layers
447  '''
448  assert(set(onlylayers).issubset(layers))
449  if histname is None:
450  histname = name
451  if "kLive" in opt:
452  xbins = int(opt.split('=')[1])
453  else:
454  xbins = lumibinsx
455  for idx,layer in enumerate(layers):
456  if layer not in onlylayers:
457  continue
458  fulltitle = title + ', {0}'.format(layer) + runtext + lumitext + yaxistext
459  layerGroup = getLayerGroup(helper, alg, layer)
460  fullvarstring = '{0}_{1}'.format(name,'lb')
461  if 'Profile' in type: fullvarstring += ',{0}_{1}'.format(name, 'cat')
462  fullvarstring += ',{0}_{1}'.format(name, 'val')
463  fullvarstring += ';' + histname + '_{0}'.format(layer)
464  if ( len(ybins)==1 and len(ymins)==1 and len(binsizes)==1):
465  layerGroup.defineHistogram(fullvarstring,
466  type=type, path=path, title=fulltitle,
467  xbins=xbins, xmin=-0.5, xmax=-0.5+xbins,
468  ybins=ybins[0], ymin=ymins[0], ymax=ymins[0]+binsizes[0]*ybins[0], opt=opt)
469  elif (len(ybins)==len(layers) and len(ymins)==len(layers) and len(binsizes)==len(layers) and len(ylabels)==len(layers)):
470  layerGroup.defineHistogram(fullvarstring,
471  type=type, path=path, title=fulltitle,
472  xbins=xbins, xmin=-0.5, xmax=-0.5+xbins,
473  ybins=ybins[idx], ymin=ymins[idx], ymax=ymins[idx]+binsizes[idx]*ybins[idx], ylabels=ylabels[idx], opt=opt)
474  elif (len(ybins)==len(layers) and len(ymins)==len(layers) and len(binsizes)==1 and ylabels is None):
475  layerGroup.defineHistogram(fullvarstring,
476  type=type, path=path, title=fulltitle,
477  xbins=xbins, xmin=-0.5, xmax=-0.5+xbins,
478  ybins=ybins[idx], ymin=ymins[idx], ymax=ymins[idx]+ybins[idx], opt=opt)
479 
480 
481 def define1DLayers(helper, alg, name, title, path, xaxistext, yaxistext, xbins, xmins, binsizes=[1.0], type='TH1F', histname=None, onlylayers=layers):
482  '''
483  This function configures 1D (Profile) histograms for Pixel layers.
484 
485  Arguments:
486  helper -- AthMonitorCfgHelper(Old) instance
487  alg -- algorithm Configurable object returned from addAlgorithm
488  name -- Root name of variables and histogram (Name = name+'_'+layer)
489  title -- Title of histogram (Title = title +' '+layer)
490  path -- Path in ouput file for histogram
491  xaxistext -- X-axis title
492  yaxistext -- Y-axis title
493  type -- Type of histogram
494  histname -- alternative root name of the histogram (to be filled with the same variables defined by 'name' above)
495  onlylayers -- sublist of layers
496  '''
497  assert(set(onlylayers).issubset(layers))
498  if histname is None:
499  histname = name
500  for idx,layer in enumerate(layers):
501  if layer not in onlylayers:
502  continue
503  fulltitle = title + ', {0}'.format(layer) + runtext + xaxistext + yaxistext
504  layerGroup = getLayerGroup(helper, alg, layer)
505  fullvarstring = '{0}_{1}'.format(name,'val')
506  fullvarstring += ';' + histname + '_{0}'.format(layer)
507  if ( len(xbins)==1 and len(xmins)==1 and len(binsizes)==1):
508  layerGroup.defineHistogram(fullvarstring,
509  type=type, path=path, title=fulltitle,
510  xbins=xbins[0], xmin=xmins[0], xmax=xmins[0]+binsizes[0]*xbins[0])
511  elif (len(xbins)==len(layers) and len(xmins)==len(layers) and len(binsizes)==len(layers)):
512  layerGroup.defineHistogram(fullvarstring,
513  type=type, path=path, title=fulltitle,
514  xbins=xbins[idx], xmin=xmins[idx], xmax=xmins[idx]+binsizes[idx]*xbins[idx])
515 
516 def addOnTrackTxt(name, ontrack, wSpace=False):
517  if ontrack:
518  if wSpace:
519  name += ' OnTrack'
520  else:
521  name += 'OnTrack'
522  return name
523 
524 def addOnTrackToPath(name, ontrack):
525  if ontrack:
526  name += 'OnTrack/'
527  else:
528  name += '/'
529  return name
530 
531 def fullDressTitle(name, ontrack, xaxistext, yaxistext):
532  if ontrack:
533  name += ' OnTrack'
534  name += runtext + xaxistext + yaxistext
535  return name
vtune_athena.format
format
Definition: vtune_athena.py:14
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
PixelAthMonitoringBase.definePP0Histos
def definePP0Histos(helper, alg, name, title, path, opt='')
Definition: PixelAthMonitoringBase.py:361
PixelAthMonitoringBase.addOnTrackToPath
def addOnTrackToPath(name, ontrack)
Definition: PixelAthMonitoringBase.py:524
PixelAthMonitoringBase.define1DProfLumiLayers
def define1DProfLumiLayers(helper, alg, name, title, path, yaxistext, type='TProfile', opt='', histname=None, onlylayers=layers)
Definition: PixelAthMonitoringBase.py:396
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:224
PixelAthMonitoringBase.getLayerGroup
def getLayerGroup(helper, alg, layer)
Definition: PixelAthMonitoringBase.py:268
PixelAthMonitoringBase.define1DLayers
def define1DLayers(helper, alg, name, title, path, xaxistext, yaxistext, xbins, xmins, binsizes=[1.0], type='TH1F', histname=None, onlylayers=layers)
Definition: PixelAthMonitoringBase.py:481
PixelAthMonitoringBase.defineMapVsLumiLayers
def defineMapVsLumiLayers(helper, alg, name, title, path, xaxistext, yaxistext, ybins, ymins, binsizes=[1.0], ylabels=None, opt='', type='TH2F', histname=None, onlylayers=layers)
Definition: PixelAthMonitoringBase.py:431
PixelAthMonitoringBase.define2DProfHist
def define2DProfHist(helper, alg, name, title, path, type='TProfile2D', doWeight=False, lifecycle='run', zmin=None, zmax=None, opt='', histname=None, onlylayers=baselayers)
Definition: PixelAthMonitoringBase.py:276
PixelAthMonitoringBase.addOnTrackTxt
def addOnTrackTxt(name, ontrack, wSpace=False)
Definition: PixelAthMonitoringBase.py:516
PixelAthMonitoringBase.define2DProfPerFEHist
def define2DProfPerFEHist(helper, alg, name, title, path, type='TProfile2D', doWeight=False, lifecycle='run', zmin=None, zmax=None, opt='', histname=None, onlylayers=baselayers)
Definition: PixelAthMonitoringBase.py:318
PixelAthMonitoringBase.fullDressTitle
def fullDressTitle(name, ontrack, xaxistext, yaxistext)
Definition: PixelAthMonitoringBase.py:531