ATLAS Offline Software
TileCalibBlobPython_writeBchM7.py
Go to the documentation of this file.
1 #!/bin/env python
2 
3 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
4 #
5 # TileCalibBlobPython_writeBchM7.py
6 # Lukas Pribyl <lukas.pribyl@cern.ch>, 2008-05-29
7 
8 from TileCalibBlobPython import TileCalibTools
9 from TileCalibBlobPython import TileBchTools
10 from TileCalibBlobObjs.Classes import TileCalibUtils, TileBchPrbs, \
11  TileBchDecoder
12 
13 from TileCalibBlobPython.TileCalibLogger import getLogger
14 log = getLogger("writeBch")
15 import logging
16 log.setLevel(logging.DEBUG)
17 
18 
19 #===================================================================
20 #====================== FILL DB BELOW ==============================
21 #===================================================================
22 db = TileCalibTools.openDb('SQLITE', 'COMP200', 'UPDATE')
23 
24 #=== ADC status folder
25 folder = TileCalibTools.getTilePrefix(True,True)+"STATUS/ADC"
26 
27 #=== specify folder and tag
28 folderTag = TileCalibUtils.getFullTag(folder, "COM-04")
29 
30 #=== create bad channel manager
31 mgr = TileBchTools.TileBchMgr()
32 mgr.setLogLvl(logging.DEBUG)
33 
34 #=== always initialize with no bad channels
35 log.info("Initializing with no bad channels at tag=%s and time=%s", folderTag,(0,0))
36 mgr.initialize(db, folder, folderTag, (0,0))
37 
38 #=== Define TileBchStatus.isBad()
39 #=== Currently all channels with any problem are considered as bad and masked
40 
41 #=== ADC problems
42 mgr.addAdcProblem(0, 1, 0, 0, TileBchPrbs.GeneralMaskAdc)
43 mgr.addAdcProblem(0, 1, 0, 0, TileBchPrbs.AdcDead)
44 mgr.addAdcProblem(0, 1, 0, 0, TileBchPrbs.StuckBit)
45 mgr.addAdcProblem(0, 1, 0, 0, TileBchPrbs.DataCorruption)
46 mgr.addAdcProblem(0, 1, 0, 0, TileBchPrbs.VeryLargeHfNoise)
47 mgr.addAdcProblem(0, 1, 0, 0, TileBchPrbs.NoData)
48 mgr.addAdcProblem(0, 1, 0, 0, TileBchPrbs.WrongDspConfig)
49 #--- impact on data quality
50 mgr.addAdcProblem(0, 1, 0, 0, TileBchPrbs.LargeHfNoise)
51 mgr.addAdcProblem(0, 1, 0, 0, TileBchPrbs.CorrelatedNoise)
52 mgr.addAdcProblem(0, 1, 0, 0, TileBchPrbs.LargeLfNoise)
53 mgr.addAdcProblem(0, 1, 0, 0, TileBchPrbs.NoCis)
54 mgr.addAdcProblem(0, 1, 0, 0, TileBchPrbs.BadCis)
55 
56 #=== Channel problems
57 #--- serious problems
58 mgr.addAdcProblem(0, 1, 0, 0, TileBchPrbs.GeneralMaskChannel)
59 mgr.addAdcProblem(0, 1, 0, 0, TileBchPrbs.NoPmt)
60 mgr.addAdcProblem(0, 1, 0, 0, TileBchPrbs.NoHV)
61 mgr.addAdcProblem(0, 1, 0, 0, TileBchPrbs.WrongHV)
62 #--- impact on data quality
63 mgr.addAdcProblem(0, 1, 0, 0, TileBchPrbs.NoLaser)
64 mgr.addAdcProblem(0, 1, 0, 0, TileBchPrbs.BadLaser)
65 mgr.addAdcProblem(0, 1, 0, 0, TileBchPrbs.NoCesium)
66 mgr.addAdcProblem(0, 1, 0, 0, TileBchPrbs.BadCesium)
67 
68 #=== Define TileBchStatus.isNoisy()
69 # mgr.addAdcProblem(0, 1, 1, 0, TileBchPrbs.LargeHfNoise)
70 # mgr.addAdcProblem(0, 1, 1, 0, TileBchPrbs.CorrelatedNoise)
71 # mgr.addAdcProblem(0, 1, 1, 0, TileBchPrbs.LargeLfNoise)
72 
73 #=== Tuples of empty channels
74 emptyChannelLongBarrel = (30, 31, 43)
75 emptyChannelExtendedBarrel = (18, 19, 24, 25, 26, 27, 28, 29, 33, 34, 42, 43, 44, 45, 46, 47)
76 
77 #=== Add problems with mgr.addAdcProblem(ros, drawer, channel, adc, problem)
78 # LBA
79 mgr.addAdcProblem(1, 1, 42, 1, TileBchPrbs.CorrelatedNoise)
80 mgr.addAdcProblem(1, 1, 47, 1, TileBchPrbs.CorrelatedNoise)
81 mgr.addAdcProblem(1, 1, 46, 1, TileBchPrbs.CorrelatedNoise)
82 mgr.addAdcProblem(1, 1, 45, 1, TileBchPrbs.CorrelatedNoise)
83 mgr.addAdcProblem(1, 6, 32, 0, TileBchPrbs.DataCorruption)
84 mgr.addAdcProblem(1, 6, 32, 1, TileBchPrbs.DataCorruption)
85 mgr.addAdcProblem(1, 6, 33, 0, TileBchPrbs.DataCorruption)
86 mgr.addAdcProblem(1, 6, 33, 1, TileBchPrbs.DataCorruption)
87 mgr.addAdcProblem(1, 6, 34, 0, TileBchPrbs.DataCorruption)
88 mgr.addAdcProblem(1, 6, 34, 1, TileBchPrbs.DataCorruption)
89 mgr.addAdcProblem(1, 6, 35, 0, TileBchPrbs.DataCorruption)
90 mgr.addAdcProblem(1, 6, 35, 1, TileBchPrbs.DataCorruption)
91 mgr.addAdcProblem(1, 13, 6, 1, TileBchPrbs.StuckBit)
92 mgr.addAdcProblem(1, 13, 6, 1, TileBchPrbs.VeryLargeHfNoise)
93 mgr.addAdcProblem(1, 18, 23, 0, TileBchPrbs.BadLaser)
94 mgr.addAdcProblem(1, 18, 23, 1, TileBchPrbs.BadLaser)
95 mgr.addAdcProblem(1, 22, 32, 0, TileBchPrbs.VeryLargeHfNoise)
96 mgr.addAdcProblem(1, 25, 0, 0, TileBchPrbs.NoData)
97 mgr.addAdcProblem(1, 25, 0, 1, TileBchPrbs.NoData)
98 mgr.addAdcProblem(1, 31, 20, 0, TileBchPrbs.BadCis)
99 mgr.addAdcProblem(1, 33, 28, 0, TileBchPrbs.LargeHfNoise)
100 mgr.addAdcProblem(1, 34, 47, 1, TileBchPrbs.LargeHfNoise)
101 mgr.addAdcProblem(1, 34, 45, 1, TileBchPrbs.LargeHfNoise)
102 mgr.addAdcProblem(1, 36, 36, 1, TileBchPrbs.VeryLargeHfNoise)
103 mgr.addAdcProblem(1, 41, 39, 1, TileBchPrbs.LargeHfNoise)
104 mgr.addAdcProblem(1, 41, 42, 1, TileBchPrbs.LargeHfNoise)
105 mgr.addAdcProblem(1, 41, 46, 1, TileBchPrbs.LargeHfNoise)
106 mgr.addAdcProblem(1, 41, 45, 1, TileBchPrbs.LargeHfNoise)
107 mgr.addAdcProblem(1, 44, 29, 0, TileBchPrbs.VeryLargeHfNoise)
108 mgr.addAdcProblem(1, 47, 45, 1, TileBchPrbs.LargeHfNoise)
109 mgr.addAdcProblem(1, 48, 45, 1, TileBchPrbs.LargeHfNoise)
110 mgr.addAdcProblem(1, 49, 45, 0, TileBchPrbs.VeryLargeHfNoise)
111 for i in range(0, 48):
112  if i not in emptyChannelLongBarrel:
113  mgr.addAdcProblem(1, 52, i, 0, TileBchPrbs.DataCorruption)
114  mgr.addAdcProblem(1, 52, i, 1, TileBchPrbs.DataCorruption)
115 mgr.addAdcProblem(1, 61, 28, 0, TileBchPrbs.LargeHfNoise)
116 
117 # LBC
118 mgr.addAdcProblem(2, 3, 45, 1, TileBchPrbs.LargeHfNoise)
119 mgr.addAdcProblem(2, 4, 24, 0, TileBchPrbs.LargeHfNoise)
120 mgr.addAdcProblem(2, 5, 45, 1, TileBchPrbs.LargeHfNoise)
121 mgr.addAdcProblem(2, 6, 45, 1, TileBchPrbs.VeryLargeHfNoise)
122 mgr.addAdcProblem(2, 10, 28, 0, TileBchPrbs.StuckBit)
123 mgr.addAdcProblem(2, 14, 19, 0, TileBchPrbs.BadCis)
124 mgr.addAdcProblem(2, 14, 19, 1, TileBchPrbs.BadCis)
125 mgr.addAdcProblem(2, 14, 45, 1, TileBchPrbs.VeryLargeHfNoise)
126 for i in range(0, 48):
127  if i not in emptyChannelLongBarrel:
128  mgr.addAdcProblem(2, 16, i, 0, TileBchPrbs.DataCorruption)
129  mgr.addAdcProblem(2, 16, i, 1, TileBchPrbs.DataCorruption)
130 mgr.addAdcProblem(2, 17, 45, 1, TileBchPrbs.LargeHfNoise)
131 mgr.addAdcProblem(2, 19, 44, 0, TileBchPrbs.NoData)
132 mgr.addAdcProblem(2, 19, 44, 1, TileBchPrbs.NoData)
133 mgr.addAdcProblem(2, 19, 42, 0, TileBchPrbs.NoData)
134 mgr.addAdcProblem(2, 19, 42, 1, TileBchPrbs.NoData)
135 mgr.addAdcProblem(2, 19, 47, 0, TileBchPrbs.NoData)
136 mgr.addAdcProblem(2, 19, 47, 1, TileBchPrbs.NoData)
137 mgr.addAdcProblem(2, 19, 46, 0, TileBchPrbs.NoData)
138 mgr.addAdcProblem(2, 19, 46, 1, TileBchPrbs.NoData)
139 mgr.addAdcProblem(2, 19, 45, 0, TileBchPrbs.NoData)
140 mgr.addAdcProblem(2, 19, 45, 1, TileBchPrbs.NoData)
141 mgr.addAdcProblem(2, 23, 42, 0, TileBchPrbs.NoData)
142 mgr.addAdcProblem(2, 23, 42, 1, TileBchPrbs.NoData)
143 mgr.addAdcProblem(2, 25, 22, 0, TileBchPrbs.CorrelatedNoise)
144 mgr.addAdcProblem(2, 25, 23, 0, TileBchPrbs.CorrelatedNoise)
145 mgr.addAdcProblem(2, 25, 27, 0, TileBchPrbs.CorrelatedNoise)
146 mgr.addAdcProblem(2, 25, 44, 0, TileBchPrbs.CorrelatedNoise)
147 mgr.addAdcProblem(2, 26, 47, 1, TileBchPrbs.CorrelatedNoise)
148 mgr.addAdcProblem(2, 26, 46, 1, TileBchPrbs.CorrelatedNoise)
149 mgr.addAdcProblem(2, 26, 45, 1, TileBchPrbs.CorrelatedNoise)
150 mgr.addAdcProblem(2, 33, 45, 1, TileBchPrbs.LargeHfNoise)
151 mgr.addAdcProblem(2, 34, 42, 1, TileBchPrbs.CorrelatedNoise)
152 mgr.addAdcProblem(2, 34, 47, 1, TileBchPrbs.CorrelatedNoise)
153 mgr.addAdcProblem(2, 34, 46, 1, TileBchPrbs.CorrelatedNoise)
154 mgr.addAdcProblem(2, 34, 45, 1, TileBchPrbs.CorrelatedNoise)
155 mgr.addAdcProblem(2, 35, 32, 0, TileBchPrbs.VeryLargeHfNoise)
156 mgr.addAdcProblem(2, 36, 45, 1, TileBchPrbs.StuckBit)
157 mgr.addAdcProblem(2, 37, 47, 1, TileBchPrbs.VeryLargeHfNoise)
158 mgr.addAdcProblem(2, 39, 25, 0, TileBchPrbs.CorrelatedNoise)
159 mgr.addAdcProblem(2, 39, 24, 0, TileBchPrbs.CorrelatedNoise)
160 mgr.addAdcProblem(2, 39, 29, 0, TileBchPrbs.CorrelatedNoise)
161 mgr.addAdcProblem(2, 39, 42, 1, TileBchPrbs.CorrelatedNoise)
162 mgr.addAdcProblem(2, 39, 47, 1, TileBchPrbs.CorrelatedNoise)
163 mgr.addAdcProblem(2, 39, 46, 1, TileBchPrbs.CorrelatedNoise)
164 mgr.addAdcProblem(2, 39, 45, 1, TileBchPrbs.CorrelatedNoise)
165 mgr.addAdcProblem(2, 40, 47, 1, TileBchPrbs.CorrelatedNoise)
166 mgr.addAdcProblem(2, 40, 45, 1, TileBchPrbs.CorrelatedNoise)
167 mgr.addAdcProblem(2, 44, 46, 1, TileBchPrbs.LargeHfNoise)
168 mgr.addAdcProblem(2, 44, 45, 1, TileBchPrbs.LargeHfNoise)
169 mgr.addAdcProblem(2, 45, 3, 0, TileBchPrbs.VeryLargeHfNoise)
170 mgr.addAdcProblem(2, 45, 45, 0, TileBchPrbs.LargeHfNoise)
171 mgr.addAdcProblem(2, 46, 44, 0, TileBchPrbs.StuckBit)
172 mgr.addAdcProblem(2, 52, 34, 1, TileBchPrbs.StuckBit)
173 mgr.addAdcProblem(2, 54, 17, 0, TileBchPrbs.StuckBit)
174 mgr.addAdcProblem(2, 54, 20, 0, TileBchPrbs.LargeHfNoise)
175 mgr.addAdcProblem(2, 58, 45, 1, TileBchPrbs.LargeHfNoise)
176 mgr.addAdcProblem(2, 63, 15, 0, TileBchPrbs.DataCorruption)
177 mgr.addAdcProblem(2, 63, 15, 1, TileBchPrbs.DataCorruption)
178 mgr.addAdcProblem(2, 63, 16, 0, TileBchPrbs.DataCorruption)
179 mgr.addAdcProblem(2, 63, 16, 1, TileBchPrbs.DataCorruption)
180 mgr.addAdcProblem(2, 63, 17, 0, TileBchPrbs.DataCorruption)
181 mgr.addAdcProblem(2, 63, 17, 1, TileBchPrbs.DataCorruption)
182 
183 # EBA
184 mgr.addAdcProblem(3, 6, 31, 0, TileBchPrbs.CorrelatedNoise)
185 mgr.addAdcProblem(3, 6, 32, 0, TileBchPrbs.CorrelatedNoise)
186 mgr.addAdcProblem(3, 6, 30, 0, TileBchPrbs.CorrelatedNoise)
187 mgr.addAdcProblem(3, 8, 32, 0, TileBchPrbs.CorrelatedNoise)
188 mgr.addAdcProblem(3, 8, 30, 0, TileBchPrbs.CorrelatedNoise)
189 mgr.addAdcProblem(3, 8, 35, 0, TileBchPrbs.CorrelatedNoise)
190 mgr.addAdcProblem(3, 11, 31, 1, TileBchPrbs.StuckBit)
191 mgr.addAdcProblem(3, 13, 31, 0, TileBchPrbs.LargeHfNoise)
192 mgr.addAdcProblem(3, 15, 31, 0, TileBchPrbs.VeryLargeHfNoise)
193 mgr.addAdcProblem(3, 17, 20, 1, TileBchPrbs.StuckBit)
194 mgr.addAdcProblem(3, 18, 3, 1, TileBchPrbs.BadCis)
195 mgr.addAdcProblem(3, 24, 15, 0, TileBchPrbs.NoData)
196 mgr.addAdcProblem(3, 24, 15, 1, TileBchPrbs.NoData)
197 mgr.addAdcProblem(3, 32, 36, 1, TileBchPrbs.VeryLargeHfNoise)
198 mgr.addAdcProblem(3, 38, 31, 1, TileBchPrbs.LargeLfNoise)
199 mgr.addAdcProblem(3, 43, 21, 0, TileBchPrbs.DataCorruption)
200 mgr.addAdcProblem(3, 43, 21, 1, TileBchPrbs.DataCorruption)
201 mgr.addAdcProblem(3, 43, 22, 0, TileBchPrbs.DataCorruption)
202 mgr.addAdcProblem(3, 43, 22, 1, TileBchPrbs.DataCorruption)
203 mgr.addAdcProblem(3, 43, 23, 0, TileBchPrbs.DataCorruption)
204 mgr.addAdcProblem(3, 43, 23, 1, TileBchPrbs.DataCorruption)
205 mgr.addAdcProblem(3, 45, 31, 0, TileBchPrbs.CorrelatedNoise)
206 mgr.addAdcProblem(3, 45, 32, 0, TileBchPrbs.CorrelatedNoise)
207 mgr.addAdcProblem(3, 45, 30, 0, TileBchPrbs.CorrelatedNoise)
208 mgr.addAdcProblem(3, 54, 14, 0, TileBchPrbs.NoData)
209 mgr.addAdcProblem(3, 54, 14, 1, TileBchPrbs.NoData)
210 
211 # EBC
212 mgr.addAdcProblem(4, 7, 32, 0, TileBchPrbs.LargeHfNoise)
213 mgr.addAdcProblem(4, 8, 0, 0, TileBchPrbs.NoCis)
214 mgr.addAdcProblem(4, 8, 0, 1, TileBchPrbs.NoCis)
215 mgr.addAdcProblem(4, 12, 6, 0, TileBchPrbs.NoCis)
216 mgr.addAdcProblem(4, 12, 6, 1, TileBchPrbs.NoCis)
217 mgr.addAdcProblem(4, 12, 7, 0, TileBchPrbs.NoCis)
218 mgr.addAdcProblem(4, 12, 7, 1, TileBchPrbs.NoCis)
219 mgr.addAdcProblem(4, 12, 8, 0, TileBchPrbs.NoCis)
220 mgr.addAdcProblem(4, 12, 8, 1, TileBchPrbs.NoCis)
221 mgr.addAdcProblem(4, 17, 4, 0, TileBchPrbs.LargeHfNoise)
222 mgr.addAdcProblem(4, 21, 35, 0, TileBchPrbs.NoCis)
223 mgr.addAdcProblem(4, 21, 35, 1, TileBchPrbs.NoCis)
224 mgr.addAdcProblem(4, 21, 38, 0, TileBchPrbs.NoCis)
225 mgr.addAdcProblem(4, 21, 38, 1, TileBchPrbs.NoCis)
226 mgr.addAdcProblem(4, 21, 37, 0, TileBchPrbs.NoCis)
227 mgr.addAdcProblem(4, 21, 37, 1, TileBchPrbs.NoCis)
228 mgr.addAdcProblem(4, 21, 41, 0, TileBchPrbs.NoCis)
229 mgr.addAdcProblem(4, 21, 41, 1, TileBchPrbs.NoCis)
230 mgr.addAdcProblem(4, 21, 40, 0, TileBchPrbs.NoCis)
231 mgr.addAdcProblem(4, 21, 40, 1, TileBchPrbs.NoCis)
232 mgr.addAdcProblem(4, 21, 39, 0, TileBchPrbs.NoCis)
233 mgr.addAdcProblem(4, 21, 39, 1, TileBchPrbs.NoCis)
234 mgr.addAdcProblem(4, 21, 36, 0, TileBchPrbs.NoCis)
235 mgr.addAdcProblem(4, 21, 36, 1, TileBchPrbs.NoCis)
236 mgr.addAdcProblem(4, 25, 41, 0, TileBchPrbs.LargeHfNoise)
237 mgr.addAdcProblem(4, 31, 32, 0, TileBchPrbs.CorrelatedNoise)
238 mgr.addAdcProblem(4, 31, 30, 0, TileBchPrbs.CorrelatedNoise)
239 mgr.addAdcProblem(4, 33, 0, 1, TileBchPrbs.NoCis)
240 mgr.addAdcProblem(4, 35, 36, 1, TileBchPrbs.BadCis)
241 mgr.addAdcProblem(4, 36, 40, 0, TileBchPrbs.NoCis)
242 mgr.addAdcProblem(4, 36, 40, 1, TileBchPrbs.NoCis)
243 mgr.addAdcProblem(4, 39, 36, 1, TileBchPrbs.BadCis)
244 for i in range(0, 48):
245  if i not in emptyChannelExtendedBarrel:
246  mgr.addAdcProblem(4, 41, i, 0, TileBchPrbs.DataCorruption)
247  mgr.addAdcProblem(4, 41, i, 1, TileBchPrbs.DataCorruption)
248 mgr.addAdcProblem(4, 45, 1, 0, TileBchPrbs.BadCis)
249 mgr.addAdcProblem(4, 47, 35, 0, TileBchPrbs.BadCis)
250 mgr.addAdcProblem(4, 47, 35, 1, TileBchPrbs.BadCis)
251 mgr.addAdcProblem(4, 54, 36, 1, TileBchPrbs.BadCis)
252 mgr.addAdcProblem(4, 62, 13, 1, TileBchPrbs.VeryLargeHfNoise)
253 mgr.addAdcProblem(4, 63, 32, 0, TileBchPrbs.CorrelatedNoise)
254 mgr.addAdcProblem(4, 63, 30, 0, TileBchPrbs.CorrelatedNoise)
255 mgr.addAdcProblem(4, 63, 35, 0, TileBchPrbs.CorrelatedNoise)
256 
257 
258 #=== print bad channels
259 log.info("bad channels after update")
260 mgr.listBadAdcs()
261 
262 #=== commit changes
263 mgr.commitToDb(db, folder, folderTag, TileBchDecoder.BitPat_ofl01, "lpribyl", "translated from Brian's badChM7.xls", (68340,0))
264 
265 #=== close DB
266 db.closeDatabase()
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
python.CaloCondLogger.getLogger
def getLogger(name="CaloCond")
Definition: CaloCondLogger.py:16
TileCalibUtils::getFullTag
static std::string getFullTag(const std::string &folder, const std::string &tag)
Returns the full tag string, composed of camelized folder name and tag part.
Definition: TileCalibUtils.cxx:33