9 os.environ[
'TERM'] =
'linux'
12 print (
"Usage: ",sys.argv[0],
" [OPTION] ... ")
13 print (
"Dumps the TileCal OFC values various schemas / folders / tags")
15 print (
"-h, --help shows this help")
16 print (
"-f, --folder= specify status folder to use CIS, LAS, PHY ")
17 print (
"-r, --run= specify run number, by default uses latest iov")
18 print (
"-l, --lumi= specify lumi block number, default is 0")
19 print (
"-p, --ros= specify partition (ros number), default is 1")
20 print (
"-d, --drawer= specify drawer number, default is 0")
21 print (
"-c, --channel= specify channel number, default is 0")
22 print (
"-g, -a, --adc= specify gain (adc number), default is 0")
23 print (
"-i, --field= specify field number, default is 0")
24 print (
"-s, --schema= specify schema to use, like 'COOLONL_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:i:"
28 keywords = [
"help",
"run=",
"lumi=",
"server=",
"schema=",
"tag=",
"folder=",
"ros=",
"drawer=",
"channel=",
"adc=",
"gain=",
"field="]
31 opts, extraparams = getopt.getopt(sys.argv[1:],letters,keywords)
32 except getopt.GetoptError
as err:
41 schema =
'COOLONL_TILE/CONDBR2'
42 folderPath =
"/TILE/ONL01/FILTER/OF2/PHY"
52 if o
in (
"-f",
"--folder"):
53 if a.startswith(
"/TILE"):
55 elif a.startswith(
"OF"):
56 folderPath =
"/TILE/ONL01/FILTER/%s" % a
58 folderPath =
"/TILE/ONL01/FILTER/OF2/%s" % a
59 elif o
in (
"-t",
"--tag"):
61 elif o
in (
"-S",
"--server"):
63 elif o
in (
"-s",
"--schema"):
65 elif o
in (
"-p",
"--ros"):
67 elif o
in (
"-d",
"--drawer"):
69 elif o
in (
"-c",
"--channel"):
71 elif o
in (
"-a",
"--adc",
"-g",
"--gain"):
73 elif o
in (
"-i",
"--field"):
75 elif o
in (
"-r",
"--run"):
77 elif o
in (
"-l",
"--lumi"):
79 elif o
in (
"-h",
"--help"):
83 raise RuntimeError(
"unhandled option")
86 from TileCalibBlobPython
import TileCalibTools
87 from TileCalibBlobObjs.Classes
import TileCalibUtils
89 from TileCalibBlobPython.TileCalibLogger
import getLogger
92 log.setLevel(logging.DEBUG)
96 db = TileCalibTools.openDbConn(schema,server)
97 folderTag = TileCalibTools.getFolderTag(schema
if 'COMP200' in schema
or 'OFLP200' in schema
else db, folderPath, tag)
101 log.info(
"Initializing folder %s with tag %s", folderPath, folderTag)
103 log.info(
"Initializing folder %s", folderPath)
104 blobReader = TileCalibTools.TileBlobReader(db,folderPath, folderTag)
108 log.info(
"Initializing ros %d, drawer %d for run %d, lumiblock %d", ros,drawer,run,lumi)
109 log.info(
"... %s", blobReader.getComment((run,lumi)))
110 ofc = blobReader.getDrawer(ros, drawer,(run,lumi))
113 nchann = ofc.getNChans()
114 nfields = ofc.getNFields()
115 nsamples = ofc.getNSamples()
116 nphases = ofc.getNPhases()
118 log.info(
"nchann = %d", nchann )
119 log.info(
"nfields = %d", nfields )
120 log.info(
"nphases = %d", nphases )
121 log.info(
"nsamples = %d", nsamples)
126 for iphase
in range(abs(nphases)):
127 phase = ofc.getPhase(channel, adc, iphase)
128 msg =
"phase %6.1f ns :" % phase
129 for smp
in range(0, nsamples):
130 msg +=
" %f" % ofc.getOfc(field, channel, adc, phase, smp)