9 os.environ[
'TERM'] =
'linux'
12 print (
"Usage: ",sys.argv[0],
" [OPTION] ... ")
13 print (
"Dumps the TileCal CIS/NLN from various schemas / folders / tags")
15 print (
"-h, --help shows this help")
16 print (
"-f, --folder= specify status folder to use ONL01 or OFL02 ")
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 (
"-s, --schema= specify schema to use, like 'COOLOFL_TILE/CONDBR2' or 'sqlite://;schema=tileSqlite.db;dbname=CONDBR2'")
25 print (
"-S, --server= specify server - ORACLE or FRONTIER, default is FRONTIER")
27 letters =
"hr:l:S:s:t:f:p:d:c:a:g:"
28 keywords = [
"help",
"run=",
"lumi=",
"server=",
"schema=",
"tag=",
"folder=",
"ros=",
"drawer=",
"channel=",
"adc=",
"gain="]
31 opts, extraparams = getopt.getopt(sys.argv[1:],letters,keywords)
32 except getopt.GetoptError
as err:
41 schema =
'COOLOFL_TILE/CONDBR2'
42 folderPath =
"/TILE/OFL02/CALIB/CIS/NLN"
51 if o
in (
"-f",
"--folder"):
52 folderPath =
"/TILE/%s/CALIB/CIS/NLN" % a
53 elif o
in (
"-t",
"--tag"):
55 elif o
in (
"-S",
"--server"):
57 elif o
in (
"-s",
"--schema"):
59 elif o
in (
"-p",
"--ros"):
61 elif o
in (
"-d",
"--drawer"):
63 elif o
in (
"-c",
"--channel"):
65 elif o
in (
"-a",
"--adc",
"-g",
"--gain"):
67 elif o
in (
"-r",
"--run"):
69 elif o
in (
"-l",
"--lumi"):
71 elif o
in (
"-h",
"--help"):
75 raise RuntimeError(
"unhandled option")
78 if schema==
'COOLONL_TILE/COMP200':
79 if '/TILE/ONL01' not in folderPath
and '/TILE/OFL01' not in folderPath:
80 print (
"Folder %s doesn't exist in schema %s " % (folderPath,schema) )
83 if schema==
'COOLONL_TILE/CONDBR2':
84 if '/TILE/ONL01' not in folderPath:
85 print (
"Folder %s doesn't exist in schema %s " % (folderPath,schema) )
88 if schema==
'COOLOFL_TILE/COMP200' or schema==
'COOLOFL_TILE/CONDBR2':
89 if '/TILE/OFL02' not in folderPath:
90 print (
"Folder %s doesn't exist in schema %s " % (folderPath,schema) )
94 from TileCalibBlobPython
import TileCalibTools
95 from TileCalibBlobObjs.Classes
import TileCalibUtils
97 from TileCalibBlobPython.TileCalibLogger
import getLogger
100 log.setLevel(logging.DEBUG)
104 db = TileCalibTools.openDbConn(schema,server)
105 folderTag = TileCalibTools.getFolderTag(db, folderPath, tag)
106 log.info(
"Initializing folder %s with tag %s", folderPath, folderTag)
109 blobReader = TileCalibTools.TileBlobReader(db,folderPath, folderTag)
113 log.info(
"Initializing ros %d, drawer %d for run %d, lumiblock %d", ros,drawer,run,lumi)
114 log.info(
"... %s", blobReader.getComment((run,lumi)))
115 flt = blobReader.getDrawer(ros, drawer,(run,lumi))
116 maxidx = flt.getObjSizeUint32()
117 log.info(
"Maxidx = %d", maxidx )
122 print (
"%s ch %i gn %i :" % ( modName, channel, adc ) )
123 for idx
in range(0,maxidx):
124 print (
" %2d %f" % (idx, flt.getData(channel, adc, idx) ) )