9 os.environ[
'TERM'] =
'linux'
12 print (
"Usage: ",sys.argv[0],
" [OPTION] ... ")
13 print (
"Dumps the TileCal constants from various schemas / folders / tags")
15 print (
"-h, --help shows this help")
16 print (
"-f, --folder= specify status folder to use f.i. /TILE/OFL02/CALIB/CIS/LIN ")
17 print (
"-t, --tag= specify tag to use, f.i. UPD1 or UPD4 or full suffix like RUN2-HLT-UPD1-00")
18 print (
"-r, --run= specify run number, by default uses latest iov")
19 print (
"-l, --lumi= specify lumi block number, default is 0")
20 print (
"-p, --ros= specify partition (ros number), default is 1")
21 print (
"-d, --drawer= specify drawer number, default is 0")
22 print (
"-c, --channel= specify channel number, default is 0")
23 print (
"-g, -a, --adc= specify gain (adc number), default is 0")
24 print (
"-n, --nval= specify number of values to output, default is all")
25 print (
"-s, --schema= specify schema to use, like 'COOLOFL_TILE/CONDBR2' or 'sqlite://;schema=tileSqlite.db;dbname=CONDBR2'")
26 print (
"-S, --server= specify server - ORACLE or FRONTIER, default is FRONTIER")
28 letters =
"hr:l:S:s:t:f:p:d:c:a:g:n:"
29 keywords = [
"help",
"run=",
"lumi=",
"server=",
"schema=",
"tag=",
"folder=",
"ros=",
"drawer=",
"channel=",
"adc=",
"gain=",
"nval="]
32 opts, extraparams = getopt.getopt(sys.argv[1:],letters,keywords)
33 except getopt.GetoptError
as err:
42 schema =
'COOLOFL_TILE/CONDBR2'
43 folderPath =
"/TILE/OFL02/CALIB/CIS/LIN"
54 if o
in (
"-f",
"--folder"):
56 elif o
in (
"-t",
"--tag"):
58 elif o
in (
"-S",
"--server"):
60 elif o
in (
"-s",
"--schema"):
62 elif o
in (
"-p",
"--ros"):
64 elif o
in (
"-d",
"--drawer"):
66 elif o
in (
"-c",
"--channel"):
68 elif o
in (
"-a",
"--adc",
"-g",
"--gain"):
70 elif o
in (
"-n",
"--nval"):
72 elif o
in (
"-r",
"--run"):
74 elif o
in (
"-l",
"--lumi"):
76 elif o
in (
"-h",
"--help"):
80 raise RuntimeError(
"unhandled option")
83 if schema==
'COOLONL_TILE/COMP200':
84 if '/TILE/ONL01' not in folderPath
and '/TILE/OFL01' not in folderPath:
85 print (
"Folder %s doesn't exist in schema %s " % (folderPath,schema) )
88 if schema==
'COOLONL_TILE/CONDBR2':
89 if '/TILE/ONL01' not in folderPath:
90 print (
"Folder %s doesn't exist in schema %s " % (folderPath,schema) )
93 if schema==
'COOLOFL_TILE/COMP200' or schema==
'COOLOFL_TILE/CONDBR2':
94 if '/TILE/OFL02' not in folderPath:
95 print (
"Folder %s doesn't exist in schema %s " % (folderPath,schema) )
99 from TileCalibBlobPython
import TileCalibTools
100 from TileCalibBlobObjs.Classes
import TileCalibUtils
102 from TileCalibBlobPython.TileCalibLogger
import getLogger
105 log.setLevel(logging.DEBUG)
109 db = TileCalibTools.openDbConn(schema,server)
110 folderTag = TileCalibTools.getFolderTag(db, folderPath, tag)
111 log.info(
"Initializing folder %s with tag %s", folderPath, folderTag)
114 blobReader = TileCalibTools.TileBlobReader(db,folderPath, folderTag)
118 log.info(
"Initializing ros %d, drawer %d for run %d, lumiblock %d", ros,drawer,run,lumi)
119 log.info(
"... %s", blobReader.getComment((run,lumi)))
123 flt = blobReader.getDrawer(ros, drawer,(run,lumi))
125 msg =
"%s ch %i gn %i :" % ( modName, channel, adc )
127 nval = flt.getObjSizeUint32()
128 for val
in range(0,nval):
129 msg +=
" %f" % flt.getData(channel, adc, val)