ATLAS Offline Software
Loading...
Searching...
No Matches
PixelAthMonitoringBase.py
Go to the documentation of this file.
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'''
9runtext = ''
10
11NumLayersDisk = 3
12NumStavesIBL = 14
13NumStavesL0 = 22
14NumStavesL1 = 38
15NumStavesL2 = 52
16
17NumModulesBarrel= 13
18NumModulesDisk = 48
19NumPP0sEC = 24
20
21btxt = ";eta index of module"
22sbtxt = ";shifted eta index of module"
23ditxt = ";disk number"
24layers = ["ECA","ECC","BLayer","Layer1","Layer2","IBL2D","IBL3D"]
25baselayers=["ECA","ECC","BLayer","Layer1","Layer2","IBL"]
26xbinsl = [ 3, 3, 13, 13, 13, 32]
27xminsl = [ -0.5, -0.5,-6.5,-6.5,-6.5,-16.5]
28ybinsl = [ 48, 48, 22, 38, 52, 14]
29etatxt = [ditxt,ditxt,btxt,btxt,btxt,sbtxt]
30phitext = ";phi index of module"
31xbinsfel = [ 24, 24, 104, 104, 104, 32]
32xminsfel = [ -0.5, -0.5, -52, -52, -52,-16.5]
33ybinsfel = [ 96, 96, 44, 76, 104, 14]
34
35totcuts = [ 15, 15, 15, 15, 15, 4, 4]
36xbinsem = [ 3, 3, 13, 13, 13, 20]
37xminsem = [ 0.5, 0.5,-6.5,-6.5,-6.5, -10]
38xbinstotz= [ 3, 3, 13, 13, 13, 20]
39xminstotz= [ -0.5, -0.5,-0.5,-0.5,-0.5, -0.5]
40ztotbinsy= [ 20, 20, 20, 20, 20, 20, 20]
41ztotminsy= [ 19.5, 19.5, 7.5,19.5,19.5, -0.5, -0.5]
42errbbinsy= [ 17, 17, 17, 17, 17, 27, 27]
43errbminsy= [ 0, 0, 0, 0, 0, 0, 0]
44errbbsizy= [ 1, 1, 1, 1, 1, 1, 1]
45errtbinsy= [ 7, 7, 7, 7, 7, 7, 7]
46
47pp0layers= ["ECA","ECC","BLayer","Layer1","Layer2","IBLA","IBLC"]
48pp0xbins = [ 24, 24, 22, 38, 52, 14, 14]
49
50fei3layers= ["ECA","ECC","BLayer","Layer1","Layer2"]
51fei4layers= ["IBL2D","IBL3D"]
52
53lumitext = ";lumi block"
54lumibinsx = 3000
55
56bcidbinsx = 3600
57
58#labels
59LayersDisk = ["Disk 1", "Disk 2", "Disk 3"] #x EC
60#xBarrel
61ModulesBarrel = [
62 "M6C", "M5C", "M4C", "M3C", "M2C", "M1C", "M0","M1A", "M2A", "M3A", "M4A",
63 "M5A", "M6A"]
64#xIBL
65ModulesIBL = [
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
70LabelX = [LayersDisk, LayersDisk, ModulesBarrel, ModulesBarrel, ModulesBarrel, ModulesIBL]
71
72#same for FE
73LayersDiskFE = ["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
77ModulesBarrelFE = [
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
92LabelFEX = [LayersDiskFE, LayersDiskFE, ModulesBarrelFE, ModulesBarrelFE, ModulesBarrelFE, ModulesIBL]
93
94ModulesECA = [
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"]
105ModulesECC = [
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
119StavesL00 = [
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
125StavesL0 = [
126 "B11_S2(-0.29)", "B01_S1(0.0)", "B01_S2(0.29)", "B02_S1(0.57)", "B02_S2(0.87)", "B03_S1(1.14)", "B03_S2(1.43)",
127 "B04_S1(1.71)", "B04_S2(2.0)", "B05_S1(2.28)", "B05_S2(2.57)", "B06_S1(2.86)", "B06_S2(3.14)", "B07_S1(-2.86)",
128 "B07_S2(-2.57)", "B08_S1(2.28)", "B08_S2(-2.0)", "B09_S1(-1.71)", "B09_S2(-1.43)", "B10_S1(-1.14)",
129 "B10_S2(-0.86)", "B11_S1(-0.57)"]
130
131StavesL1 = [
132 "B01_S1", "B01_S2", "B02_S1", "B02_S2", "B03_S1", "B03_S2", "B04_S1",
133 "B04_S2", "B05_S1", "B05_S2", "B06_S1", "B06_S2", "B07_S1", "B07_S2",
134 "B08_S1", "B08_S2", "B09_S1", "B09_S2", "B10_S1", "B10_S2", "B11_S1",
135 "B11_S2", "B12_S1", "B12_S2", "B13_S1", "B13_S2", "B14_S1", "B14_S2",
136 "B15_S1", "B15_S2", "B16_S1", "B16_S2", "B17_S1", "B17_S2", "B18_S1",
137 "B18_S2", "B19_S1", "B19_S2"]
138
139StavesL2 = [
140 "B01_S2", "B02_S1", "B02_S2", "B03_S1", "B03_S2", "B04_S1", "B04_S2",
141 "B05_S1", "B05_S2", "B06_S1", "B06_S2", "B07_S1", "B07_S2", "B08_S1",
142 "B08_S2", "B09_S1", "B09_S2", "B10_S1", "B10_S2", "B11_S1", "B11_S2",
143 "B12_S1", "B12_S2", "B13_S1", "B13_S2", "B14_S1", "B14_S2", "B15_S1",
144 "B15_S2", "B16_S1", "B16_S2", "B17_S1", "B17_S2", "B18_S1", "B18_S2",
145 "B19_S1", "B19_S2", "B20_S1", "B20_S2", "B21_S1", "B21_S2", "B22_S1",
146 "B22_S2", "B23_S1", "B23_S2", "B24_S1", "B24_S2", "B25_S1", "B25_S2",
147 "B26_S1", "B26_S2", "B01_S1"]
148#yIBL
149StavesIBL = [
150 "S01(0.33)", "S02(0.78)", "S03(1.23)", "S04(1.68)", "S05(2.12)", "S06(2.57)", "S07(3.02)",
151 "S08(-2.81)", "S09(-2.36)", "S10(-1.91)", "S11(-1.47)", "S12(-1.02)", "S13(-0.57)","S14(-0.12)"]
152
153LabelY = [ModulesECA, ModulesECC, StavesL0, StavesL1, StavesL2, StavesIBL]
154
155#same for per-FE
156ModulesFEECA = []
157for i in ModulesECA:
158 ModulesFEECA.extend([i+'_FE#1', i+'_FE#2'])
159ModulesFEECC = []
160for i in ModulesECC:
161 ModulesFEECC.extend([i+'_FE#1', i+'_FE#2'])
162StavesFEL0 = []
163for i in StavesL00:
164 StavesFEL0.extend([i+'_FE#1', i+'_FE#2'])
165StavesFEL1 = []
166for i in StavesL1:
167 StavesFEL1.extend([i+'_FE#1', i+'_FE#2'])
168StavesFEL2 = []
169for i in StavesL2:
170 StavesFEL2.extend([i+'_FE#1', i+'_FE#2'])
171LabelFEY = [ModulesFEECA, ModulesFEECC, StavesFEL0, StavesFEL1, StavesFEL2, StavesIBL]
172
173#PP0
174PP0sEC = [
175 "D1_B01_S2", "D1_B02_S1", "D1_B02_S2", "D1_B03_S1", "D1_B03_S2", "D1_B04_S1", "D1_B04_S2", "D1_B01_S1",
176 "D2_B01_S2", "D2_B02_S1", "D2_B02_S2", "D2_B03_S1", "D2_B03_S2", "D2_B04_S1", "D2_B04_S2", "D2_B01_S1",
177 "D3_B01_S2", "D3_B02_S1", "D3_B02_S2", "D3_B03_S1", "D3_B03_S2", "D3_B04_S1", "D3_B04_S2", "D3_B01_S1"]
178
179PP0LabelX = [PP0sEC, PP0sEC, StavesL0, StavesL1, StavesL2, StavesIBL, StavesIBL]
180
181#Head of modules' name
182ModulesHead = ["D", "D", "L0", "L1", "L2", "LI"]
183#Errors
184ErrStateLabelsFEI3 = [
185 ("RODTimeout", "ROD Formatter Timeout"),
186 ("RODSyncBCIDErrors", "ROD BCID Sync"),
187 ("RODSyncLVL1IDErrors", "ROD LVL1ID Sync"),
188 ("OpticalErrors", "Preamble/Header"),
189 ("ModSyncLVL1IDErrors", "FE/MCC LVL1ID Sync"),
190 ("ModSyncBCID2Errors", "FE/MCC BCID2 Sync"),
191 ("ModSyncBCID1Errors", "FE/MCC BCID1 Sync"),
192 ("ModTruncEoEOverflowErrors", "FE/MCC EoE Overflow Trunc"),
193 ("ModTruncHitOverflowErrors", "FE/MCC Hit Overflow Trunc"),
194 ("FEWarning", "FE Warning"),
195 ("SEUHitParity", "SEU Hit Parity"),
196 ("SEURegisterParity", "SEU Register Parity"),
197 ("SEUHamming", "SEU Hamming Code"),
198 ("ModTruncEOCErrors", "FE/MCC EoC Trunc"),
199 ("RODTrailerBitErrors", "ROD Trailer Bit"),
200 ("RODTruncHTLimitErrors", "ROD H/T Limit Trunc"),
201 ("RODTruncRODOFErrors", "ROD Overflow Trunc")
202]
203ErrStateLabelsFEI4 = [
204 ("RODTimeoutErrors", "ROD Timeout"),
205 ("RODBCIDErrors", "ROD BCID synchronization"),
206 ("RODLVL1IDErrors", "ROD LVL1ID synchronization"),
207 ("RODPreambleErrors", "ROD Preamble"),
208 ("RODTrailerErrors", "ROD Trailer"),
209 ("RODRowColumnErrors", "ROD row-column"),
210 ("RODMaskedLink", "ROD Masked link"),
211 ("RODLimitErrors", "ROD Header Trailer limit"),
212 ("SR0BCIDCounterErrors", "SR0 BCID counter"),
213 ("SR1HammingCode0Errors", "SR1 Hamming code in word 0"),
214 ("SR2HammingCode1Errors", "SR2 Hamming code in word 1"),
215 ("SR3HammingCode2Errors", "SR3 Hamming code in word 2"),
216 ("SR4L1InCounterErrors", "SR4 L1 in counter"),
217 ("SR5L1RequestCounterErrors", "SR5 L1 request counter"),
218 ("SR6L1RegisterErrors", "SR6 L1 register"),
219 ("SR7L1TriggerIDErrors", "SR7 L1 trigger ID"),
220 ("SR8FEReadoutProcessErrors", "SR8 FE readout process"),
221 ("SR15SkipppedTrigCountErrors", "SR15 Skipped trigger counter"),
222 ("SR16TruncatedEventFlagErrors", "SR16 Truncated event"),
223 ("SR24TripleRedundantErrorsCNFGMEM", "SR24 Triple redundant CNFGMEM"),
224 ("SR25WriteRegDataErrors", "SR25 Write register data"),
225 ("SR26AddressErrors", "SR26 Address"),
226 ("SR27OtherCMDDecoderErrors", "SR27 CMD decoder"),
227 ("SR28CMDDecoderBitflipErrors", "SR28 CMD decoder bit flip"),
228 ("SR29TripleRedundantErrorsCMD", "SR29 Triple redundant CMD"),
229 ("SR30DataBusAddressErrors", "SR30 Data bus address"),
230 ("SR31TripleRedundantErrorsEFUSE", "SR31 Triple redundant EFUSE")
231]
232
233ErrCatRODModLabels = [
234 ("SyncErrorsMod", "FE/MCC Sync Errors"),
235 ("SyncErrorsROD", "ROD Sync Errors"),
236 ("TruncErrorsMod", "FE/MCC Trunc Errors"),
237 ("TruncErrorsROD", "ROD Trunc Errors"),
238 ("OpticalErrorsRODMod", "Preamble/Header Errors"),
239 ("SEUErrorsRODMod", "SEU Errors"),
240 ("TimeoutErrorsRODMod", "Timeout Errors")
241]
242
243ErrCatRODModLabelsNorm = [
244 "SyncErrorsModFracPerEvent",
245 "SyncErrorsRODFracPerEvent",
246 "TruncErrorsModFracPerEvent",
247 "TruncErrorsRODFracPerEvent"
248]
249
250ErrCatLabels = [
251 ("SyncErrors", "Sync Errors (FE/MCC & ROD)"),
252 ("TruncErrors", "Trunc Errors (FE/MCC & ROD)"),
253 ("OpticalErrors", "Preamble/Header Errors"),
254 ("SEUErrors", "SEU Errors"),
255 ("TimeoutErrors", "Timeout Errors")
256]
257
258ErrCatLabelsNorm = [
259 "SyncErrorsFracPerEvent",
260 "TruncationErrorsFracPerEvent",
261 "OpticalErrorsFracPerEvent",
262 "SEUErrorsFracPerEvent",
263 "TimeoutErrorsFracPerEvent"
264]
265
266ReadingDataErrLabels = [
267 "Invalid container",
268 "Invalid collection",
269 "Container empty"
270]
271
272layergroups = {}
273def getLayerGroup(helper, alg, layer):
274 if alg not in layergroups:
275 layergroups[alg] = {}
276 if layer not in layergroups[alg]:
277 layergroups[alg][layer] = helper.addGroup(alg, layer)
278 return layergroups[alg][layer]
279
280
281def define2DProfHist(helper, alg, name, title, path, type='TProfile2D', doWeight=False, lifecycle='run', zmin=None, zmax=None, opt='', histname=None, onlylayers=baselayers):
282 '''
283 This function configures 2D (Profile) histograms (or maps) for Pixel base (i.e. w/o split in 2D/3D in IBL) layers.
284
285 Arguments:
286 helper -- AthMonitorCfgHelper(Old) instance
287 alg -- algorithm - Configurable object returned from addAlgorithm
288 name -- Name of histogram (Name = name_layer)
289 title -- Title of histogram (Title = title +' '+layer)
290 path -- Path in output file for histogram
291 type -- Type of histogram (TH2D, TProfile2D)
292 lifecycle -- global life duration of histograms (run, lowStat [i.e. 20 LB], lumiblock) - APPLIES to MonGroup only
293 zmin(zmax) -- fix the displayed range - simply chopping the range!!!
294 opt -- history depth of a histogram e.g. 'kLBNHistoryDepth=10'
295 histname -- another way of naming the histogram(s), useful when multiple histograms are filled from exactly the same variables, but in a different way
296 onlylayers -- sublist of Pixel layers
297 '''
298 assert(set(onlylayers).issubset(baselayers))
299 if histname is None:
300 histname = name
301 for i, layer in enumerate(baselayers):
302 if layer not in onlylayers:
303 continue
304 fulltitle = title + ', {0}'.format(layer) + runtext + etatxt[i] + phitext
305 layerGroup = getLayerGroup(helper, alg, layer)
306
307 fullvarstring = '{0}_{1},{0}_{2}'.format(name, 'em', 'pm')
308 weightvar = ''
309 if 'Profile' in type:
310 fullvarstring += ',{0}_{1}'.format(name, 'val')
311 elif doWeight:
312 weightvar = '{0}_{1}'.format(name, 'val') # re-use the same variable for TH2 for now.
313
314 fullvarstring += ';' + histname + '_{0}'.format(layer)
315 layerGroup.defineHistogram(fullvarstring,
316 type=type, path=path, title=fulltitle, weight=weightvar,
317 xbins=xbinsl[i], xmin=xminsl[i], xmax=xminsl[i]+xbinsl[i],
318 ybins=ybinsl[i], ymin=-0.5, ymax=-0.5+ybinsl[i],
319 zmin=zmin, zmax=zmax,
320 duration=lifecycle,
321 opt=opt, xlabels=LabelX[i], ylabels=LabelY[i])
322
323def define2DProfPerFEHist(helper, alg, name, title, path, type='TProfile2D', doWeight=False, lifecycle='run', zmin=None, zmax=None, opt='', histname=None, onlylayers=baselayers):
324 '''
325 This function configures 2D (Profile) histograms (or maps) for Pixel base (i.e. w/o split in 2D/3D in IBL) layers per FE.
326
327 Arguments:
328 helper -- AthMonitorCfgHelper(Old) instance
329 alg -- algorithm - Configurable object returned from addAlgorithm
330 name -- Name of histogram (Name = name_layer)
331 title -- Title of histogram (Title = title +' '+layer)
332 path -- Path in output file for histogram
333 type -- Type of histogram (TH2D, TProfile2D)
334 lifecycle -- global life duration of histograms (run, lowStat [i.e. 20 LB], lumiblock) - APPLIES to MonGroup only
335 zmin(zmax) -- fix the displayed range - simply chopping the range!!!
336 opt -- history depth of a histogram e.g. 'kLBNHistoryDepth=10'
337 histname -- another way of naming the histogram(s), useful when multiple histograms are filled from exactly the same variables, but in a different way
338 onlylayers -- sublist of Pixel layers
339 '''
340 assert(set(onlylayers).issubset(baselayers))
341 if histname is None:
342 histname = name
343 for i, layer in enumerate(baselayers):
344 if layer not in onlylayers:
345 continue
346 fulltitle = title + ', {0}'.format(layer) + runtext + etatxt[i] + phitext
347 layerGroup = getLayerGroup(helper, alg, layer)
348
349 fullvarstring = '{0}_{1},{0}_{2}'.format(name, 'em', 'pm')
350 weightvar = ''
351 if 'Profile' in type:
352 fullvarstring += ',{0}_{1}'.format(name, 'val')
353 elif doWeight:
354 weightvar = '{0}_{1}'.format(name, 'val') # re-use the same variable for TH2 for now.
355
356 fullvarstring += ';' + histname + '_{0}'.format(layer)
357 layerGroup.defineHistogram(fullvarstring,
358 type=type, path=path, title=fulltitle, weight=weightvar,
359 xbins=xbinsfel[i], xmin=xminsfel[i], xmax=xminsfel[i]+xbinsfel[i],
360 ybins=ybinsfel[i], ymin=-0.5, ymax=-0.5+ybinsfel[i],
361 zmin=zmin, zmax=zmax,
362 duration=lifecycle,
363 opt=opt, xlabels=LabelFEX[i], ylabels=LabelFEY[i])
364
365
366def definePP0Histos(helper, alg, name, title, path, opt=''):
367 '''
368 This function configures TProfile histograms for Pixel layers per pp0 or ROD.
369
370 Arguments:
371 helper -- AthMonitorCfgHelper(Old) instance
372 alg -- algorithm Configurable object returned from addAlgorithm
373 name -- Name of histogram (Name = name_layer)
374 title -- Title of histogram (Title = title +' '+layer)
375 path -- Path in ouput file for histogram
376 opt -- history depth of a histogram e.g. 'kLBNHistoryDepth=10'
377 '''
378
379 for i, layer in enumerate(pp0layers):
380 if i<2:
381 xatxt = ';sector'
382 else :
383 xatxt = ';stave'
384 yatxt = ';average # clusters per event per '
385 if i>4:
386 yatxt += 'FE'
387 else :
388 yatxt += 'module'
389 fulltitle = title + ', {0}'.format(layer) + runtext + xatxt + yatxt
390 groupname = name + '_{0}'.format(layer)
391 layerGroup = getLayerGroup(helper, alg, layer)
392 fullvarstring = '{0}_{1},{0}_{2}'.format(name, 'pospp0x', 'val')
393 fullvarstring += ';' + groupname
394 layerGroup.defineHistogram(fullvarstring,
395 type='TProfile', path=path, title=fulltitle,
396 xbins=pp0xbins[i], xmin=-0.5, xmax=-0.5+pp0xbins[i],
397 opt=opt, xlabels=PP0LabelX[i])
398
399
400
401def define1DProfLumiLayers(helper, alg, name, title, path, yaxistext, type='TProfile', opt='', histname=None, onlylayers=layers):
402 '''
403 This function configures 1D (Profile) vs lumi histograms for Pixel layers.
404
405 Arguments:
406 helper -- AthMonitorCfgHelper(Old) instance
407 alg -- algorithm Configurable object returned from addAlgorithm
408 name -- Name of histogram (Name = name_layer)
409 title -- Title of histogram (Title = title +' '+layer)
410 path -- Path in ouput file for histogram
411 yaxistext -- Text on the y-axis
412 type -- Type of histogram (TH1D, TProfile)
413 opt -- history depth of a histogram e.g. 'kLBNHistoryDepth=10' or 'kLive=100'
414 histname -- another way of naming the histogram(s), useful when multiple histograms are filled from exactly the same variables, but in a different way
415 onlylayers -- sublist of layers
416 '''
417 assert(set(onlylayers).issubset(layers))
418 if histname is None:
419 histname = name
420 if "kLive" in opt:
421 xbins = int(opt.split('=')[1])
422 else:
423 xbins = lumibinsx
424 for layer in layers:
425 if layer not in onlylayers:
426 continue
427 fulltitle = title + ', {0}'.format(layer) + runtext + lumitext + yaxistext
428 fullvarstring = '{0}_{1}'.format(name,'lb')
429 if 'Profile' in type: fullvarstring += ',{0}_{1}'.format(name, 'val')
430 fullvarstring += ';' + histname + '_{0}'.format(layer)
431 layerGroup = getLayerGroup(helper, alg, layer)
432 layerGroup.defineHistogram(fullvarstring,
433 type=type, path=path, title=fulltitle,
434 xbins=xbins, xmin=-0.5, xmax=-0.5+xbins, opt=opt)
435
436def defineMapVsLumiLayers(helper, alg, name, title, path, xaxistext, yaxistext, ybins, ymins, binsizes=[1.0], ylabels=None, opt='', type='TH2F', histname=None, onlylayers=layers):
437 '''
438 This function configures 2D histograms vs lumi for Pixel base (i.e. w/o split in 2D/3D in IBL) layers.
439
440 Arguments:
441 helper -- AthMonitorCfgHelper(Old) instance
442 alg -- algorithm Configurable object returned from addAlgorithm
443 name -- Name of histogram (Name = name_layer)
444 title -- Title of histogram (Title = title +' '+layer)
445 path -- Path in ouput file for histogram
446 ybins, ymin, ymax, yaxistext
447 -- Configure Y-axis
448 opt -- history depth of a histogram e.g. 'kLBNHistoryDepth=10' or 'kLive=100'
449 type -- Type of histogram (TH2I, TH2F, TProfile2D)
450 histname-- alternative root name of the histogram (to be filled with the same variables defined by 'name' above)
451 onlylayers -- sublist of Pixel layers
452 '''
453 assert(set(onlylayers).issubset(layers))
454 if histname is None:
455 histname = name
456 if "kLive" in opt:
457 xbins = int(opt.split('=')[1])
458 else:
459 xbins = lumibinsx
460 for idx,layer in enumerate(layers):
461 if layer not in onlylayers:
462 continue
463 fulltitle = title + ', {0}'.format(layer) + runtext + lumitext + yaxistext
464 layerGroup = getLayerGroup(helper, alg, layer)
465 fullvarstring = '{0}_{1}'.format(name,'lb')
466 if 'Profile' in type: fullvarstring += ',{0}_{1}'.format(name, 'cat')
467 fullvarstring += ',{0}_{1}'.format(name, 'val')
468 fullvarstring += ';' + histname + '_{0}'.format(layer)
469 if ( len(ybins)==1 and len(ymins)==1 and len(binsizes)==1):
470 layerGroup.defineHistogram(fullvarstring,
471 type=type, path=path, title=fulltitle,
472 xbins=xbins, xmin=-0.5, xmax=-0.5+xbins,
473 ybins=ybins[0], ymin=ymins[0], ymax=ymins[0]+binsizes[0]*ybins[0], opt=opt)
474 elif (len(ybins)==len(layers) and len(ymins)==len(layers) and len(binsizes)==len(layers) and len(ylabels)==len(layers)):
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]+binsizes[idx]*ybins[idx], ylabels=ylabels[idx], opt=opt)
479 elif (len(ybins)==len(layers) and len(ymins)==len(layers) and len(binsizes)==1 and ylabels is None):
480 layerGroup.defineHistogram(fullvarstring,
481 type=type, path=path, title=fulltitle,
482 xbins=xbins, xmin=-0.5, xmax=-0.5+xbins,
483 ybins=ybins[idx], ymin=ymins[idx], ymax=ymins[idx]+ybins[idx], opt=opt)
484
485
486def define1DLayers(helper, alg, name, title, path, xaxistext, yaxistext, xbins, xmins, binsizes=[1.0], type='TH1F', histname=None, onlylayers=layers):
487 '''
488 This function configures 1D (Profile) histograms for Pixel layers.
489
490 Arguments:
491 helper -- AthMonitorCfgHelper(Old) instance
492 alg -- algorithm Configurable object returned from addAlgorithm
493 name -- Root name of variables and histogram (Name = name+'_'+layer)
494 title -- Title of histogram (Title = title +' '+layer)
495 path -- Path in ouput file for histogram
496 xaxistext -- X-axis title
497 yaxistext -- Y-axis title
498 type -- Type of histogram
499 histname -- alternative root name of the histogram (to be filled with the same variables defined by 'name' above)
500 onlylayers -- sublist of layers
501 '''
502 assert(set(onlylayers).issubset(layers))
503 if histname is None:
504 histname = name
505 for idx,layer in enumerate(layers):
506 if layer not in onlylayers:
507 continue
508 fulltitle = title + ', {0}'.format(layer) + runtext + xaxistext + yaxistext
509 layerGroup = getLayerGroup(helper, alg, layer)
510 fullvarstring = '{0}_{1}'.format(name,'val')
511 fullvarstring += ';' + histname + '_{0}'.format(layer)
512 if ( len(xbins)==1 and len(xmins)==1 and len(binsizes)==1):
513 layerGroup.defineHistogram(fullvarstring,
514 type=type, path=path, title=fulltitle,
515 xbins=xbins[0], xmin=xmins[0], xmax=xmins[0]+binsizes[0]*xbins[0])
516 elif (len(xbins)==len(layers) and len(xmins)==len(layers) and len(binsizes)==len(layers)):
517 layerGroup.defineHistogram(fullvarstring,
518 type=type, path=path, title=fulltitle,
519 xbins=xbins[idx], xmin=xmins[idx], xmax=xmins[idx]+binsizes[idx]*xbins[idx])
520
521def addOnTrackTxt(name, ontrack, wSpace=False):
522 if ontrack:
523 if wSpace:
524 name += ' OnTrack'
525 else:
526 name += 'OnTrack'
527 return name
528
529def addOnTrackToPath(name, ontrack):
530 if ontrack:
531 name += 'OnTrack/'
532 else:
533 name += '/'
534 return name
535
536def fullDressTitle(name, ontrack, xaxistext, yaxistext):
537 if ontrack:
538 name += ' OnTrack'
539 name += runtext + xaxistext + yaxistext
540 return name
STL class.
getLayerGroup(helper, alg, layer)
define1DLayers(helper, alg, name, title, path, xaxistext, yaxistext, xbins, xmins, binsizes=[1.0], type='TH1F', histname=None, onlylayers=layers)
define1DProfLumiLayers(helper, alg, name, title, path, yaxistext, type='TProfile', opt='', histname=None, onlylayers=layers)
defineMapVsLumiLayers(helper, alg, name, title, path, xaxistext, yaxistext, ybins, ymins, binsizes=[1.0], ylabels=None, opt='', type='TH2F', histname=None, onlylayers=layers)
addOnTrackTxt(name, ontrack, wSpace=False)
definePP0Histos(helper, alg, name, title, path, opt='')
define2DProfHist(helper, alg, name, title, path, type='TProfile2D', doWeight=False, lifecycle='run', zmin=None, zmax=None, opt='', histname=None, onlylayers=baselayers)
fullDressTitle(name, ontrack, xaxistext, yaxistext)
define2DProfPerFEHist(helper, alg, name, title, path, type='TProfile2D', doWeight=False, lifecycle='run', zmin=None, zmax=None, opt='', histname=None, onlylayers=baselayers)