9 os.environ[
'TERM'] =
'linux'
12 print (
"Usage: ",sys.argv[0],
" [OPTION] ... ")
13 print (
"Dumps the TileCal status bits from various schemas / folders")
15 print (
"-h, --help shows this help")
16 print (
"-f, --folder= specify status folder to use ONL01 or OFL02, don't need to specify full path")
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 (
"-s, --schema= specify schema to use, like 'COOLOFL_TILE/CONDBR2' or 'sqlite://;schema=tileSqlite.db;dbname=CONDBR2' or tileSqlite.db")
21 print (
"-D, --dbname= specify dbname part of schema if schema only contains file name, default is CONDBR2")
22 print (
"-S, --server= specify server - ORACLE or FRONTIER, default is FRONTIER")
23 print (
"-w, --warning suppress warning messages about missing drawers in DB")
25 letters =
"hr:l:s:t:f:D:S:w"
26 keywords = [
"help",
"run=",
"lumi=",
"schema=",
"tag=",
"folder=",
"dbname=",
"server=",
"warning"]
29 opts, extraparams = getopt.getopt(sys.argv[1:],letters,keywords)
30 except getopt.GetoptError
as err:
38 schema =
'COOLOFL_TILE/CONDBR2'
41 folderPath =
"/TILE/OFL02/STATUS/ADC"
47 if o
in (
"-f",
"--folder"):
48 folderPath =
"/TILE/%s/STATUS/ADC" % a
49 elif o
in (
"-t",
"--tag"):
51 elif o
in (
"-s",
"--schema"):
53 elif o
in (
"-D",
"--dbname"):
55 elif o
in (
"-S",
"--server"):
57 elif o
in (
"-r",
"--run"):
59 elif o
in (
"-l",
"--lumi"):
61 elif o
in (
"-w",
"--warning"):
63 elif o
in (
"-h",
"--help"):
67 raise RuntimeError(
"unhandeled option")
70 from TileCalibBlobPython
import TileCalibTools
71 from TileCalibBlobObjs.Classes
import TileCalibUtils
73 from TileCalibBlobPython.TileCalibLogger
import getLogger
76 logLevel=logging.DEBUG
77 log.setLevel(logLevel)
79 log1.setLevel(logLevel)
83 if len(dbname)<7
and run!=2147483647:
84 dbname =
'COMP200' if run<232000
else 'CONDBR2'
86 if 'COOLO' not in schema
and ':' not in schema
and ';' not in schema:
87 schema=
'sqlite://;schema='+schema+
';dbname='+(dbname
if len(dbname)
else 'CONDBR2')
89 if 'sqlite:' not in schema
and len(dbname):
90 schema=schema.replace(
'CONDBR2',dbname)
91 schema=schema.replace(
'COMP200',dbname)
94 folderPath=
'/TILE/ONL01/STATUS/ADC'
95 if 'COOLOFL' in schema:
96 if 'COMP200' in schema:
97 schema=
'COOLONL_TILE/COMP200'
98 if 'CONDBR2' in schema:
99 schema=
'COOLONL_TILE/CONDBR2'
100 log.warning(
"tag is empty, using %s folder and schema %s", folderPath,schema)
102 if schema==
'COOLONL_TILE/COMP200':
103 if folderPath!=
"/TILE/ONL01/STATUS/ADC" and folderPath!=
"/TILE/OFL01/STATUS/ADC":
104 log.warning(
"Folder %s doesn't exist in schema %s", folderPath,schema)
105 folderPath=
"/TILE/ONL01/STATUS/ADC"
106 log.warning(
"Changing folder to %s", folderPath)
108 if schema==
'COOLONL_TILE/CONDBR2':
109 if folderPath!=
"/TILE/ONL01/STATUS/ADC":
110 log.warning(
"Folder %s doesn't exist in schema %s ", folderPath,schema)
111 folderPath=
"/TILE/ONL01/STATUS/ADC"
112 log.warning(
"Changing folder to %s", folderPath)
114 if schema==
'COOLOFL_TILE/COMP200' or schema==
'COOLOFL_TILE/CONDBR2':
115 if folderPath!=
"/TILE/OFL02/STATUS/ADC":
116 log.warning(
"Folder %s doesn't exist in schema %s ", folderPath,schema)
117 folderPath=
"/TILE/OFL02/STATUS/ADC"
118 log.warning(
"Changing folder to %s", folderPath)
122 db = TileCalibTools.openDbConn(schema,server)
123 folderTag = TileCalibTools.getFolderTag(db, folderPath, tag)
124 log.info(
"Initializing folder %s with tag %s", folderPath, folderTag)
127 blobReader = TileCalibTools.TileBlobReader(db,folderPath, folderTag)
131 log.info(
"Initializing for run %d, lumiblock %d", run,lumi)
132 log.info(
"Comment: %s", blobReader.getComment((run,lumi)))
136 for ros
in range(0,5):
139 flt = blobReader.getDrawer(ros, mod,(run,lumi))
141 adcLG = flt.getData(chn, 0, 0)
142 adcHG = flt.getData(chn, 1, 0)
143 chanS = flt.getData(chn, 2, 0)
144 if adcLG
or adcHG
or chanS:
145 msg =
"%s %2i %5i %5i %5i " % ( modName, chn, adcLG, adcHG, chanS)