ATLAS Offline Software
Loading...
Searching...
No Matches
python.TileBchCrest.TileBchMgr Class Reference
Inheritance diagram for python.TileBchCrest.TileBchMgr:
Collaboration diagram for python.TileBchCrest.TileBchMgr:

Public Member Functions

 __init__ (self)
 getComment (self)
 getBlobReader (self)
 updateFromDb (self, db, folderPath, tag, runLumi, fillTable=1, mode=None, ros=-1, module=-1)
 initialize (self, db, folderPath, tag="", runLumi=(MAXRUN, MAXLBK-1), mode=None, ros=-1, module=-1)
 getAdcStatus (self, ros, drawer, channel, adc)
 setAdcStatus (self, ros, drawer, channel, adc, status)
 getAdcProblems (self, ros, drawer, channel, adc)
 setAdcProblems (self, ros, drawer, channel, adc, problems)
 addAdcProblem (self, ros, drawer, channel, adc, problem)
 delAdcProblem (self, ros, drawer, channel, adc, problem)
 decodeModule (self, module)
 getADCStatus (self, module, channel, adc)
 setADCStatus (self, module, channel, adc, status)
 getADCProblems (self, module, channel, adc)
 setADCProblems (self, module, channel, adc, problems)
 addADCProblem (self, module, channel, adc, problem)
 delADCProblem (self, module, channel, adc, problem)
 listBadAdcs (self, rosBeg=0, modBeg=0, rosEnd=5, modEnd=64)
 checkModuleForChanges (self, ros, drawer)
 updateFromFile (self, fileName)
 commitToDb (self, db, folderPath, tag, bitPatVer, author, comment, since, moduleList=[])
 getBadDefinition (self)
 getBadTimingDefinition (self)

Private Member Functions

 __getAdcIdx (self, ros, drawer, channel, adc)
 __updateFromDb (self, db, folderPath, tag, runLumi, fillTable=1, ros=-1, module=-1)

Private Attributes

list __newStat = [ TileBchStatus() for _ in range(self.__getAdcIdx(4, 63, 47, 1) + 1) ]
list __oldStat = [ TileBchStatus() for _ in range(self.__getAdcIdx(4, 63, 47, 1) + 1) ]
str __comment = ""
int __mode = 2
tuple __runLumi = (MAXRUN,MAXLBK-1)
 __db = None
 __folder = None
 __tag = None
 __reader = None

Detailed Description

This class manages updates to the Tile Calorimeter bad channel database.
The usual mode of operation should start with initializing this manager
with a current set of bad channels from an existing database.
The status of individual ADCs can then be modified using the setAdcStatus,
updateFromFile or updateFromDb methods.
In a final step, the changes are commited to the database using the commit
method.

Definition at line 28 of file TileBchCrest.py.

Constructor & Destructor Documentation

◆ __init__()

python.TileBchCrest.TileBchMgr.__init__ ( self)

Definition at line 39 of file TileBchCrest.py.

39 def __init__(self):
40
41 #=== initialize base class
42 TileCalibLogger.__init__(self,"TileBchMgr")
43
44 #=== initialize all channel status to "good"
45 self.__newStat = [ TileBchStatus() for _ in range(self.__getAdcIdx(4, 63, 47, 1) + 1) ]
46 self.__oldStat = [ TileBchStatus() for _ in range(self.__getAdcIdx(4, 63, 47, 1) + 1) ]
47
48 self.__comment = ""
49 self.__mode = 2
50 self.__runLumi = (MAXRUN,MAXLBK-1)
51 self.__db = None
52 self.__folder = None
53 self.__tag = None
54 self.__reader = None
55
Class holding bad channel problems.

Member Function Documentation

◆ __getAdcIdx()

python.TileBchCrest.TileBchMgr.__getAdcIdx ( self,
ros,
drawer,
channel,
adc )
private
Private function, calculating the index of a given ADC
for the internal cache.

Definition at line 57 of file TileBchCrest.py.

57 def __getAdcIdx(self, ros, drawer, channel, adc):
58 """
59 Private function, calculating the index of a given ADC
60 for the internal cache.
61 """
62 return TileCalibUtils.getAdcIdx(ros,drawer,channel,adc)
63
static unsigned int getAdcIdx(unsigned int ros, unsigned int drawer, unsigned int channel, unsigned int adc)
Returns an ADC hash.

◆ __updateFromDb()

python.TileBchCrest.TileBchMgr.__updateFromDb ( self,
db,
folderPath,
tag,
runLumi,
fillTable = 1,
ros = -1,
module = -1 )
private
Updates the internal bad channel cache with the content
found in the database. Server connection string or file name (db) has to
be provided. Tag and runLumi are used to locate the set of
bad channels to be read from the database.

Definition at line 65 of file TileBchCrest.py.

65 def __updateFromDb(self, db, folderPath, tag, runLumi, fillTable=1, ros=-1, module=-1):
66 """
67 Updates the internal bad channel cache with the content
68 found in the database. Server connection string or file name (db) has to
69 be provided. Tag and runLumi are used to locate the set of
70 bad channels to be read from the database.
71 """
72
73 if db is None:
74 db = self.__db
75 if folderPath is None:
76 folderPath = self.__folderPath
77 if tag is None:
78 tag = self.__tag
79
80 if db is None:
81 self.log().critical( "Database is not defined" )
82 return
83
84 #=== print status information
85 if db != self.__db or tag != self.__tag or folderPath != self.__folder:
86 self.__reader = TileBlobReaderCrest(db,folderPath,tag,runLumi[0],runLumi[1])
87 self.__db = db
88 self.__tag = tag
89 self.__folder = folderPath
90 else:
91 self.__reader.getIovs(runLumi,(runLumi[0],runLumi[1]+1))
92 if ros==-2:
93 self.__comment = self.__reader.getComment(runLumi)
94 self.log().info("Comment: %s", self.__comment)
95
96 #=== loop over the whole detector
97 rosmin = ros if ros>=0 else 0
98 rosmax = ros+1 if ros>=0 else TileCalibUtils.max_ros()
99 for ros in range(rosmin,rosmax):
100 modmin = module if module>=0 else 0
101 modmax = module+1 if module>=0 else TileCalibUtils.getMaxDrawer(ros)
102 for mod in range(modmin,modmax):
103 bch = self.__reader.getDrawer(ros, mod, runLumi, False)
104 if bch is None:
105 if fillTable>=0:
106 self.log().warning("Missing IOV in condDB: ros=%i mod=%i runLumi=%s", ros,mod,runLumi)
107 continue
108 bchDecoder = TileBchDecoder(bch.getBitPatternVersion())
109 for chn in range(TileCalibUtils.max_chan()):
110 for adc in range(TileCalibUtils.max_gain()):
111 #=== adc bits
112 adcBits = bch.getData(chn,adc,0)
113 #=== channel bits (works always due to default policy)
114 chnBits = bch.getData(chn, 2,0)
115 #=== build status from both adc and channel bits
116 status = TileBchStatus( bchDecoder.decode(chnBits,adcBits) )
117 if fillTable==0:
118 self.__oldStat[self.__getAdcIdx(ros,mod,chn,adc)] = status
119 elif fillTable==1 or fillTable==-1:
120 self.__newStat[self.__getAdcIdx(ros,mod,chn,adc)] = status
121 elif fillTable==2 or fillTable==-2:
122 self.__oldStat[self.__getAdcIdx(ros,mod,chn,adc)] = status
123 self.__newStat[self.__getAdcIdx(ros,mod,chn,adc)] = status
124 else:
125 self.__newStat[self.__getAdcIdx(ros,mod,chn,adc)] = status
126 status1 = TileBchStatus( bchDecoder.decode(chnBits,adcBits) )
127 self.__oldStat[self.__getAdcIdx(ros,mod,chn,adc)] = status1
128
Class providing the association between TileCal problems and status word bits.
static unsigned int max_gain()
Python compatibility function.
static unsigned int max_chan()
Python compatibility function.
static unsigned int max_ros()
Python compatibility function.
static unsigned int getMaxDrawer(unsigned int ros)
Returns the maximal channel number for a given drawer.

◆ addADCProblem()

python.TileBchCrest.TileBchMgr.addADCProblem ( self,
module,
channel,
adc,
problem )
Sets a specific problem

Definition at line 303 of file TileBchCrest.py.

303 def addADCProblem(self, module, channel, adc, problem):
304 """
305 Sets a specific problem
306 """
307 (ros,drawer) = self.decodeModule(module)
308 status = self.getAdcStatus(ros,drawer,channel,adc)
309 status += problem
310 self.setAdcStatus(ros,drawer,channel,adc,status)
311

◆ addAdcProblem()

python.TileBchCrest.TileBchMgr.addAdcProblem ( self,
ros,
drawer,
channel,
adc,
problem )
Sets a specific problem

Definition at line 226 of file TileBchCrest.py.

226 def addAdcProblem(self, ros, drawer, channel, adc, problem):
227 """
228 Sets a specific problem
229 """
230 status = self.getAdcStatus(ros,drawer,channel,adc)
231 status += problem
232 self.setAdcStatus(ros,drawer,channel,adc,status)
233

◆ checkModuleForChanges()

python.TileBchCrest.TileBchMgr.checkModuleForChanges ( self,
ros,
drawer )
Returns:
- if nothing changed                                    :  0
- if something changed and complete drawer is now good  : -1
- if something changed but drawer is not completely good: >0

Definition at line 350 of file TileBchCrest.py.

350 def checkModuleForChanges(self, ros, drawer):
351 """
352 Returns:
353 - if nothing changed : 0
354 - if something changed and complete drawer is now good : -1
355 - if something changed but drawer is not completely good: >0
356 """
357 diffCnt = 0
358 allGood = True
359 for chn in range(TileCalibUtils.max_chan()):
360 for adc in range(TileCalibUtils.max_gain()):
361 idx = self.__getAdcIdx(ros,drawer,chn,adc)
362 newStatus = self.__newStat[idx]
363 #=== count differences between old and new
364 if newStatus!=self.__oldStat[idx]:
365 diffCnt+=1
366 #=== invalidate allGood if one ADC is not good
367 if not newStatus.isGood():
368 allGood = False
369 if diffCnt>0 and allGood:
370 return -1
371 return diffCnt
372

◆ commitToDb()

python.TileBchCrest.TileBchMgr.commitToDb ( self,
db,
folderPath,
tag,
bitPatVer,
author,
comment,
since,
moduleList = [] )
Commits the differences compared to the set of bad channels read in with the
initialze function to the provided database.
- author  : author name (string)
- comment : a comment (string)
- sinceRun, sinceLbk : start of IOV for which bad channels are valid

Definition at line 409 of file TileBchCrest.py.

410 since, moduleList=[]):
411 """
412 Commits the differences compared to the set of bad channels read in with the
413 initialze function to the provided database.
414 - author : author name (string)
415 - comment : a comment (string)
416 - sinceRun, sinceLbk : start of IOV for which bad channels are valid
417 """
418
419 writer = TileBlobWriterCrest(db,folderPath,'Bch')
420 if len(comment) or isinstance(author,tuple):
421 writer.setComment(author, comment)
422 nUpdates = 0
423 goodComment = True
424 #=== get latest state from db
425 if moduleList!=['CMT']:
426 if since != (MINRUN,MINLBK):
427 justBefore = list(since)
428 if justBefore[1]>MINLBK:
429 justBefore[1] = justBefore[1]-1
430 else:
431 justBefore[0] = justBefore[0]-1
432 justBefore[1] = MAXLBK
433 justBefore = tuple(justBefore)
434 if self.__mode!=2:
435 self.log().info("Reading db state just before %s, i.e. at %s", since,justBefore)
436 self.__updateFromDb(None, folderPath, tag, justBefore, 0)
437 else:
438 self.log().info("Using previous bad channel list from input DB")
439 self.log().info("And comparing it with new list of bad channels")
440 else:
441 self.log().info("Filling db from %s, resetting old status cache", list(since))
442 self.__oldStat = len(self.__oldStat) * [TileBchStatus()]
443
444 #=== print status information
445 self.log().info("Committing changes to DB \'%s\'", db)
446 self.log().info("... using tag \'%s\' and [run,lumi] [%i,%i]",
447 tag,since[0],since[1])
448 if isinstance(author,tuple) and len(author)==3:
449 self.log().info("... author : \'%s\'", author[0] )
450 self.log().info("... comment: \'%s\'", author[1] )
451 else:
452 self.log().info("... author : \'%s\'", author )
453 self.log().info("... comment: \'%s\'", comment )
454
455 #=== default for drawer initialization
456 loGainDefVec = cppyy.gbl.std.vector('unsigned int')()
457 loGainDefVec.push_back(0)
458 hiGainDefVec = cppyy.gbl.std.vector('unsigned int')()
459 hiGainDefVec.push_back(0)
460 comChnDefVec = cppyy.gbl.std.vector('unsigned int')()
461 comChnDefVec.push_back(0)
462 defVec = cppyy.gbl.std.vector('std::vector<unsigned int>')()
463 defVec.push_back(loGainDefVec)
464 defVec.push_back(hiGainDefVec)
465 defVec.push_back(comChnDefVec)
466
467 #=== loop over the whole detector
468 bchDecoder = TileBchDecoder(bitPatVer)
469 for ros in range(0,TileCalibUtils.max_ros()):
470 for mod in range(TileCalibUtils.getMaxDrawer(ros)):
471 modName = TileCalibUtils.getDrawerString(ros,mod)
472 nChange = self.checkModuleForChanges(ros,mod)
473 if nChange == 0:
474 if (modName in moduleList or 'ALL' in moduleList):
475 #=== write module if it was requested even if nothing changed
476 drawerR = self.__reader.getDrawer(ros, mod, None, False, False)
477 if drawerR:
478 writer.getDrawer(ros,mod,drawerR)
479 else:
480 writer.zeroBlob(ros,mod)
481 continue
482 if nChange==-1:
483 nUpdates += 1
484 self.log().info("Drawer %s reset to GOOD", modName)
485 if modName not in comment and ("ONL" not in folderPath or "syncALL" not in comment):
486 goodComment = False
487 self.log().error("Comment string - '%s' - doesn't contain drawer %s", comment,modName)
488 writer.zeroBlob(ros,mod)
489 else:
490 nUpdates += 1
491 self.log().info("Applying %2i changes to drawer %s", nChange,modName)
492 if modName not in comment and ("ONL" not in folderPath or "syncALL" not in comment):
493 goodComment = False
494 self.log().error("Comment string - '%s' - doesn't contain drawer %s", comment,modName)
495 drawer = writer.getDrawer(ros,mod)
496 drawer.init(defVec,TileCalibUtils.max_chan(),bitPatVer)
497 for chn in range(TileCalibUtils.max_chan()):
498 #=== get low gain bit words
499 wordsLo = bchDecoder.encode(self.getAdcStatus(ros,mod,chn,0))
500 chBits = wordsLo[0]
501 loBits = wordsLo[1]
502 #=== get high gain bit words
503 wordsHi = bchDecoder.encode(self.getAdcStatus(ros,mod,chn,1))
504 chBits = wordsHi[0] | chBits
505 hiBits = wordsHi[1]
506 #=== set low, high and common channel word in calibDrawer
507 drawer.setData(chn,0,0, loBits)
508 drawer.setData(chn,1,0, hiBits)
509 drawer.setData(chn,2,0, chBits)
510 #=== synchronizing channel status in low and high gain
511 if wordsLo[0] != chBits:
512 self.log().info("Drawer %s ch %2d - sync LG status with HG ", modName,chn)
513 status = TileBchStatus( bchDecoder.decode(chBits,loBits) )
514 self.setAdcStatus(ros,mod,chn,0,status)
515 if wordsHi[0] != chBits:
516 self.log().info("Drawer %s ch %2d - sync HG status with LG ", modName,chn)
517 status = TileBchStatus( bchDecoder.decode(chBits,hiBits) )
518 self.setAdcStatus(ros,mod,chn,1,status)
519
520 #=== register
521 if nUpdates>0 or moduleList==['CMT']:
522 if goodComment:
523 self.log().info("Attempting to register %i modified drawers..." , nUpdates)
524 writer.register(since,tag)
525 else:
526 self.log().error("Aborting update due to errors in comment string")
527 else:
528 self.log().warning("No drawer modifications detected, ignoring commit request")
529
530
static std::string getDrawerString(unsigned int ros, unsigned int drawer)
Return the drawer name, e.g.

◆ decodeModule()

python.TileBchCrest.TileBchMgr.decodeModule ( self,
module )
convert module name to ros,drawer

Definition at line 244 of file TileBchCrest.py.

244 def decodeModule(self, module):
245 """
246 convert module name to ros,drawer
247 """
248 try:
249 part_dict = {'LBA':1,'LBC':2,'EBA':3,'EBC':4}
250 partname = str(module[0:3])
251 ros = part_dict[partname]
252 drawer = int(module[3:])-1
253 except Exception:
254 drawer = -1
255 if drawer<0 or drawer>63:
256 self.log().critical( "Invalid module name %s" % module )
257 raise SystemExit
258
259 return (ros,drawer)
260

◆ delADCProblem()

python.TileBchCrest.TileBchMgr.delADCProblem ( self,
module,
channel,
adc,
problem )
Removes a specific problem

Definition at line 313 of file TileBchCrest.py.

313 def delADCProblem(self, module, channel, adc, problem):
314 """
315 Removes a specific problem
316 """
317 (ros,drawer) = self.decodeModule(module)
318 status = self.getAdcStatus(ros,drawer,channel,adc)
319 status -= problem
320 self.setAdcStatus(ros,drawer,channel,adc,status)
321

◆ delAdcProblem()

python.TileBchCrest.TileBchMgr.delAdcProblem ( self,
ros,
drawer,
channel,
adc,
problem )
Removes a specific problem

Definition at line 235 of file TileBchCrest.py.

235 def delAdcProblem(self, ros, drawer, channel, adc, problem):
236 """
237 Removes a specific problem
238 """
239 status = self.getAdcStatus(ros,drawer,channel,adc)
240 status -= problem
241 self.setAdcStatus(ros,drawer,channel,adc,status)
242

◆ getADCProblems()

python.TileBchCrest.TileBchMgr.getADCProblems ( self,
module,
channel,
adc )
Returns a dictionary with { problemEnum : 'Description'}

Definition at line 278 of file TileBchCrest.py.

278 def getADCProblems(self, module, channel, adc):
279 """
280 Returns a dictionary with { problemEnum : 'Description'}
281 """
282 (ros,drawer) = self.decodeModule(module)
283 prbDescDict = {}
284 status = self.getAdcStatus(ros,drawer,channel,adc)
285 if not status.isGood():
286 prbs = status.getPrbs()
287 for prb in prbs:
288 prbDescDict[prb] = TileBchPrbs.getDescription(prb)
289 return prbDescDict
290
static std::string getDescription(const Prb &prb)
Get description of problem.

◆ getAdcProblems()

python.TileBchCrest.TileBchMgr.getAdcProblems ( self,
ros,
drawer,
channel,
adc )
Returns a dictionary with { problemEnum : 'Description'}

Definition at line 203 of file TileBchCrest.py.

203 def getAdcProblems(self, ros, drawer, channel, adc):
204 """
205 Returns a dictionary with { problemEnum : 'Description'}
206 """
207 prbDescDict = {}
208 status = self.getAdcStatus(ros,drawer,channel,adc)
209 if not status.isGood():
210 prbs = status.getPrbs()
211 for prb in prbs:
212 prbDescDict[prb] = TileBchPrbs.getDescription(prb)
213 return prbDescDict
214

◆ getADCStatus()

python.TileBchCrest.TileBchMgr.getADCStatus ( self,
module,
channel,
adc )
Get TileBchStatus for a given ADC.

Definition at line 262 of file TileBchCrest.py.

262 def getADCStatus(self, module, channel, adc):
263 """
264 Get TileBchStatus for a given ADC.
265 """
266 (ros,drawer) = self.decodeModule(module)
267 return self.__newStat[self.__getAdcIdx(ros,drawer,channel,adc)]
268

◆ getAdcStatus()

python.TileBchCrest.TileBchMgr.getAdcStatus ( self,
ros,
drawer,
channel,
adc )
Get TileBchStatus for a given ADC.

Definition at line 189 of file TileBchCrest.py.

189 def getAdcStatus(self, ros, drawer, channel, adc):
190 """
191 Get TileBchStatus for a given ADC.
192 """
193 return self.__newStat[self.__getAdcIdx(ros,drawer,channel,adc)]
194

◆ getBadDefinition()

python.TileBchCrest.TileBchMgr.getBadDefinition ( self)
Returns bad status definition

Definition at line 532 of file TileBchCrest.py.

532 def getBadDefinition(self):
533 """
534 Returns bad status definition
535 """
537
static unsigned int definitions_draweridx()
Python compatibility function.
static unsigned int bad_definition_chan()
Python compatibility function.

◆ getBadTimingDefinition()

python.TileBchCrest.TileBchMgr.getBadTimingDefinition ( self)
Returns bad time status definition

Definition at line 538 of file TileBchCrest.py.

538 def getBadTimingDefinition(self):
539 """
540 Returns bad time status definition
541 """
static unsigned int badtiming_definition_chan()
Python compatibility function.

◆ getBlobReader()

python.TileBchCrest.TileBchMgr.getBlobReader ( self)

Definition at line 134 of file TileBchCrest.py.

134 def getBlobReader(self):
135 return self.__reader
136

◆ getComment()

python.TileBchCrest.TileBchMgr.getComment ( self)

Definition at line 130 of file TileBchCrest.py.

130 def getComment(self):
131 return self.__comment
132

◆ initialize()

python.TileBchCrest.TileBchMgr.initialize ( self,
db,
folderPath,
tag = "",
runLumi = (MAXRUN,MAXLBK-1),
mode = None,
ros = -1,
module = -1 )
Initializes the internal bad channel cache. Any changes applied to the
cache previous to calling this function are lost. Typically this function
is called once in the beginning to initialize the cache with a set of
current bad channels.

Definition at line 144 of file TileBchCrest.py.

144 def initialize(self, db, folderPath, tag="", runLumi=(MAXRUN,MAXLBK-1), mode=None, ros=-1, module=-1):
145 """
146 Initializes the internal bad channel cache. Any changes applied to the
147 cache previous to calling this function are lost. Typically this function
148 is called once in the beginning to initialize the cache with a set of
149 current bad channels.
150 """
151 self.log().info("Initializing from database, resetting all changes!")
152 #=== initialize reference to current status
153 self.__runLumi = runLumi
154 if mode:
155 self.__mode = mode
156 fT = -1
157 if self.__mode<0: # silent mode
158 self.__mode = -self.__mode
159 if self.__mode==2:
160 fT = -3
161 else:
162 fT = -2
163 else:
164 if self.__mode==2:
165 fT = 3
166 else:
167 fT = 2
168
169 if ros!=-2:
170 self.__updateFromDb(db,folderPath,tag,runLumi,fT,-2)
171 self.__updateFromDb(db,folderPath,tag,runLumi,fT,ros,module)
172 #=== update TileBchStatus::isBad() definition from DB
173 self.log().info("Updating TileBchStatus::isBad() definition from DB")
174 status = self.getBadDefinition()
175 if status.isGood():
176 self.log().info("No TileBchStatus::isBad() definition found in DB, using defaults")
177 else:
179
180 #=== update TileBchStatus::isBadTiming() definition from DB
181 self.log().info("Updating TileBchStatus::isBadTiming() definition from DB")
182 status = self.getBadTimingDefinition()
183 if status.isGood():
184 self.log().info("No TileBchStatus::isBadTiming() definition found in DB, using defaults")
185 else:
187
static void defineBadTiming(const TileBchStatus &status)
static void defineBad(const TileBchStatus &status)
void initialize()

◆ listBadAdcs()

python.TileBchCrest.TileBchMgr.listBadAdcs ( self,
rosBeg = 0,
modBeg = 0,
rosEnd = 5,
modEnd = 64 )
Print a formatted list of all ADCs with problems.

Definition at line 323 of file TileBchCrest.py.

323 def listBadAdcs(self, rosBeg=0, modBeg=0, rosEnd=5, modEnd=64):
324 """
325 Print a formatted list of all ADCs with problems.
326 """
327 self.log().info("==============================================================")
328 self.log().info(" Current list of affected ADCs " )
329 self.log().info("==============================================================")
330 for ros in range(rosBeg,rosEnd):
331 for mod in range(modBeg, min(modEnd,TileCalibUtils.getMaxDrawer(ros))):
332 modName = TileCalibUtils.getDrawerString(ros,mod)
333 for chn in range(TileCalibUtils.max_chan()):
334 chnName = "channel %2i" % chn
335 for adc in range(TileCalibUtils.max_gain()):
336 gainName = "LG:"
337 if adc:
338 gainName = "HG:"
339 prbs = self.getAdcProblems(ros,mod,chn,adc)
340 for prbCode in sorted(prbs.keys()):
341 prbDesc = prbs[prbCode]
342 msg = "%s %s %s %2i (%s)" % (modName,chnName,gainName,prbCode,prbDesc)
343 self.log().info( msg )
344 modName = " " * 5
345 chnName = " " * 10
346 gainName = " " * 3
347 self.log().info("==============================================================")
348
#define min(a, b)
Definition cfImp.cxx:40

◆ setADCProblems()

python.TileBchCrest.TileBchMgr.setADCProblems ( self,
module,
channel,
adc,
problems )
Expects a list of TileBchPrbs::PrbS as input

Definition at line 292 of file TileBchCrest.py.

292 def setADCProblems(self, module, channel, adc, problems):
293 """
294 Expects a list of TileBchPrbs::PrbS as input
295 """
296 (ros,drawer) = self.decodeModule(module)
297 status = TileBchStatus()
298 for prb in problems:
299 status += prb
300 self.setAdcStatus(ros,drawer,channel,adc,status)
301

◆ setAdcProblems()

python.TileBchCrest.TileBchMgr.setAdcProblems ( self,
ros,
drawer,
channel,
adc,
problems )
Expects a list of TileBchPrbs::PrbS as input

Definition at line 216 of file TileBchCrest.py.

216 def setAdcProblems(self, ros, drawer, channel, adc, problems):
217 """
218 Expects a list of TileBchPrbs::PrbS as input
219 """
220 status = TileBchStatus()
221 for prb in problems:
222 status += prb
223 self.setAdcStatus(ros,drawer,channel,adc,status)
224

◆ setADCStatus()

python.TileBchCrest.TileBchMgr.setADCStatus ( self,
module,
channel,
adc,
status )
Set TileBchStatus for a given ADC.

Definition at line 270 of file TileBchCrest.py.

270 def setADCStatus(self, module, channel, adc, status):
271 """
272 Set TileBchStatus for a given ADC.
273 """
274 (ros,drawer) = self.decodeModule(module)
275 self.__newStat[self.__getAdcIdx(ros,drawer,channel,adc)] = status
276

◆ setAdcStatus()

python.TileBchCrest.TileBchMgr.setAdcStatus ( self,
ros,
drawer,
channel,
adc,
status )
Set TileBchStatus for a given ADC.

Definition at line 196 of file TileBchCrest.py.

196 def setAdcStatus(self, ros, drawer, channel, adc, status):
197 """
198 Set TileBchStatus for a given ADC.
199 """
200 self.__newStat[self.__getAdcIdx(ros,drawer,channel,adc)] = status
201

◆ updateFromDb()

python.TileBchCrest.TileBchMgr.updateFromDb ( self,
db,
folderPath,
tag,
runLumi,
fillTable = 1,
mode = None,
ros = -1,
module = -1 )

Definition at line 138 of file TileBchCrest.py.

138 def updateFromDb(self, db, folderPath, tag, runLumi, fillTable=1, mode=None, ros=-1, module=-1):
139 if mode:
140 self.__mode = mode
141 self.__updateFromDb(db, folderPath, tag, runLumi, fillTable, ros, module)
142

◆ updateFromFile()

python.TileBchCrest.TileBchMgr.updateFromFile ( self,
fileName )
Updates the internal bad channel cache with the content
found in the file. The layout of the file has to follow the
TileConditions ASCII file layout.

NGO: change this at some point. In a file, not the status word (which
depends on the bit pattern version) should be encoded, but the individual problems (enums).
For this we need one line per ADC... this requires some modification in the reader.

Definition at line 374 of file TileBchCrest.py.

374 def updateFromFile(self, fileName):
375 """
376 Updates the internal bad channel cache with the content
377 found in the file. The layout of the file has to follow the
378 TileConditions ASCII file layout.
379
380 NGO: change this at some point. In a file, not the status word (which
381 depends on the bit pattern version) should be encoded, but the individual problems (enums).
382 For this we need one line per ADC... this requires some modification in the reader.
383 """
384 parser = TileASCIIParser(fileName,'Bch')
385 dict = parser.getDict()
386 self.log().info("Updating dictionary from file with %i entries", len(dict))
387 self.log().info("... filename: %s", fileName )
388 for key, stat in list(dict.items()):
389 ros = key[0]
390 mod = key[1]
391 chn = key[2]
392 for adc in range(2):
393 status = TileBchStatus()
394 status+=self.getAdcStatus(ros,mod,chn,adc)
395 if adc < len(stat):
396 statInt = int(stat[adc])
397 else:
398 statInt=0
399 #=== temporary convention
400 if statInt==0:
401 pass
402 elif statInt==1:
403 status += TileBchPrbs.IgnoredInHlt
404 else:
405 status += int(stat[adc])
406 self.setAdcStatus(ros,mod,chn,adc,status)
407

Member Data Documentation

◆ __comment

python.TileBchCrest.TileBchMgr.__comment = ""
private

Definition at line 48 of file TileBchCrest.py.

◆ __db

python.TileBchCrest.TileBchMgr.__db = None
private

Definition at line 51 of file TileBchCrest.py.

◆ __folder

python.TileBchCrest.TileBchMgr.__folder = None
private

Definition at line 52 of file TileBchCrest.py.

◆ __mode

int python.TileBchCrest.TileBchMgr.__mode = 2
private

Definition at line 49 of file TileBchCrest.py.

◆ __newStat

list python.TileBchCrest.TileBchMgr.__newStat = [ TileBchStatus() for _ in range(self.__getAdcIdx(4, 63, 47, 1) + 1) ]
private

Definition at line 45 of file TileBchCrest.py.

◆ __oldStat

list python.TileBchCrest.TileBchMgr.__oldStat = [ TileBchStatus() for _ in range(self.__getAdcIdx(4, 63, 47, 1) + 1) ]
private

Definition at line 46 of file TileBchCrest.py.

◆ __reader

python.TileBchCrest.TileBchMgr.__reader = None
private

Definition at line 54 of file TileBchCrest.py.

◆ __runLumi

tuple python.TileBchCrest.TileBchMgr.__runLumi = (MAXRUN,MAXLBK-1)
private

Definition at line 50 of file TileBchCrest.py.

◆ __tag

python.TileBchCrest.TileBchMgr.__tag = None
private

Definition at line 53 of file TileBchCrest.py.


The documentation for this class was generated from the following file: