8 os.environ[
'TERM'] =
'linux'
11 print (
"Usage: ",sys.argv[0],
" [OPTION] ... ")
12 print (
"Dumps the TileCal drawer trips probabilities from various schemas / folders")
14 print (
"-h, --help shows this help")
15 print (
"-f, --folder= specify status folder, by default OFL02 ")
16 print (
"-t, --tag= specify tag to use, f.i. UPD1 or UPD4")
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 (
"-s, --schema= specify schema to use, like 'COOLOFL_TILE/OFLP200' or 'sqlite://;schema=tileSqlite.db;dbname=OFLP200'")
20 print (
"-S, --server= specify server - ORACLE or FRONTIER, default is FRONTIER")
22 letters =
"hr:l:S:s:t:f:"
23 keywords = [
"help",
"run=",
"lumi=",
"server=",
"schema=",
"tag=",
"folder="]
26 opts, extraparams = getopt.getopt(sys.argv[1:],letters,keywords)
27 except getopt.GetoptError
as err:
36 schema =
'COOLOFL_TILE/OFLP200'
37 folderPath =
"/TILE/OFL02/STATUS/ADC"
42 if o
in (
"-f",
"--folder"):
43 folderPath =
"/TILE/%s/STATUS/ADC" % a
44 elif o
in (
"-t",
"--tag"):
46 elif o
in (
"-S",
"--server"):
48 elif o
in (
"-s",
"--schema"):
50 elif o
in (
"-r",
"--run"):
52 elif o
in (
"-l",
"--lumi"):
54 elif o
in (
"-h",
"--help"):
58 raise RuntimeError(
"unhandled option")
62 from TileCalibBlobPython
import TileCalibTools
63 from TileCalibBlobObjs.Classes
import TileCalibUtils
65 from TileCalibBlobPython.TileCalibLogger
import getLogger
68 logLevel=logging.DEBUG
69 log.setLevel(logLevel)
71 log1.setLevel(logLevel)
75 db = TileCalibTools.openDbConn(schema, server)
76 folderTag = TileCalibTools.getFolderTag(db, folderPath, tag)
77 log.info(
"Initializing folder %s with tag %s", folderPath, folderTag)
79 blobReader = TileCalibTools.TileBlobReader(db, folderPath, folderTag)
82 util = cppyy.gbl.TileCalibUtils()
83 tripsCalibDrawer = blobReader.getDrawer(util.trips_ros(), util.trips_drawer(), (run,lumi))
85 if tripsCalibDrawer.getNChans() != util.max_ros() \
86 or tripsCalibDrawer.getObjSizeUint32() != (util.max_drawer() + 1):
87 log.info(
"There no drawer trips probabilities in tag %s", folderTag)
92 print (
"Module\tTrip (probability)")
95 for ros
in range(1, util.max_ros()):
96 denominator = tripsCalibDrawer.getData(ros, 0, util.max_drawer())
99 trip = tripsCalibDrawer.getData(ros, 0, mod)
101 print (
"%s\t%s" % (modName,
str(
float(trip)/ denominator)))