8os.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")
22letters =
"hr:l:S:s:t:f:"
23keywords = [
"help",
"run=",
"lumi=",
"server=",
"schema=",
"tag=",
"folder="]
26 opts, extraparams = getopt.getopt(sys.argv[1:],letters,keywords)
27except getopt.GetoptError
as err:
36schema =
'COOLOFL_TILE/OFLP200'
37folderPath =
"/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")
62from TileCalibBlobPython
import TileCalibTools
63from TileCalibBlobObjs.Classes
import TileCalibUtils
65from TileCalibBlobPython.TileCalibLogger
import getLogger
66log = getLogger(
"ReadTripsProbs")
70log1 = getLogger(
"TileCalibTools")
71log1.setLevel(logLevel)
75db = TileCalibTools.openDbConn(schema, server)
76folderTag = TileCalibTools.getFolderTag(db, folderPath, tag)
77log.info(
"Initializing folder %s with tag %s", folderPath, folderTag)
79blobReader = TileCalibTools.TileBlobReader(db, folderPath, folderTag)
82util = cppyy.gbl.TileCalibUtils()
83tripsCalibDrawer = blobReader.getDrawer(util.trips_ros(), util.trips_drawer(), (run,lumi))
85if 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)
92print (
"Module\tTrip (probability)")
95for 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)))
static std::string getDrawerString(unsigned int ros, unsigned int drawer)
Return the drawer name, e.g.
static unsigned int getMaxDrawer(unsigned int ros)
Returns the maximal channel number for a given drawer.