17 from TileCalibBlobPython 
import TileCalibTools
 
   18 from TileCalibBlobPython 
import TileBchTools
 
   19 from TileCalibBlobObjs.Classes 
import TileBchPrbs, TileBchDecoder, \
 
   22 from TileCalibBlobPython.TileCalibLogger 
import getLogger
 
   25 log.setLevel(logging.DEBUG)
 
   28 folder = 
"/TILE/OFL02/STATUS/ADC" 
   47     raise Exception(
"Invalid ros=%i" % ros)
 
   49     raise Exception(
"Invalid module=%i" % mod)
 
   51     raise Exception(
"Invalid validity range: %i < %i" % (run1,run))
 
   52 log.info(
"ros=%i mod=%i since=%s until=%s comment=%s", ros,mod,since,until,comment)
 
   57 db = TileCalibTools.openDb(
'SQLITE', 
'OFLP200', 
'UPDATE')
 
   63 mgr = TileBchTools.TileBchMgr()
 
   64 mgr.setLogLvl(logging.DEBUG)
 
   67 log.info(
"Initializing with conditions from tag=%s and time=%s", folderTag, since)
 
   68 mgr.initialize(db, folder, folderTag, since)
 
   71 emptyChannelLongBarrel =     (30, 31, 43)
 
   72 emptyChannelExtendedBarrel = (18, 19, 24, 25, 26, 27, 28, 29, 33, 34, 42, 43, 44, 45, 46, 47)
 
   75 log.info(
"bad channels before update")
 
   87 for ichan 
in range(0,48):
 
   88     if (ros<3 
and ichan 
not in emptyChannelLongBarrel) 
or (ros>2 
and ichan 
not in emptyChannelExtendedBarrel):
 
   89         log.info(
"Masking channel %i off", ichan)
 
   90         mgr.addAdcProblem( ros, mod, ichan, 0, TileBchPrbs.NoHV)
 
   91         mgr.addAdcProblem( ros, mod, ichan, 1, TileBchPrbs.NoHV)
 
   94 log.info(
"bad channels after update")
 
   98 mgr.commitToDb(db, folder, folderTag, TileBchDecoder.BitPat_ofl01, 
"Guilherme", comment, since, until)