9 os.environ[
'TERM'] =
'linux'
12 print (
"Usage: ",sys.argv[0],
" [OPTION] ... ")
13 print (
"Dumps the TileCal noise from SAMPLE and OFNI folders")
15 print (
"-h, --help shows this help")
16 print (
"-t, --tag= specify tag to use, f.i. RUN2-HLT-UPD1-01 or COM-01")
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 (
"-s, --schema= specify schema to use, like 'COOLONL_TILE/CONDBR2' or 'sqlite://;schema=tileSqlite.db;dbname=CONDBR2'")
24 print (
"-S, --server= specify server - ORACLE or FRONTIER, default is FRONTIER")
26 letters =
"hr:l:S:s:t:p:d:c:a:g:"
27 keywords = [
"help",
"run=",
"lumi=",
"server=",
"schema=",
"tag=",
"ros=",
"drawer=",
"channel=",
"adc=",
"gain="]
30 opts, extraparams = getopt.getopt(sys.argv[1:],letters,keywords)
31 except getopt.GetoptError
as err:
40 schema =
'COOLONL_TILE/CONDBR2'
49 if o
in (
"-t",
"--tag"):
51 elif o
in (
"-S",
"--server"):
53 elif o
in (
"-s",
"--schema"):
55 elif o
in (
"-r",
"--run"):
57 elif o
in (
"-l",
"--lumi"):
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 (
"-h",
"--help"):
71 raise RuntimeError(
"unhandled option")
74 if 'COOLONL_TILE' not in schema
and 'sqlite' not in schema:
75 print (
"This script works on the 'COOLONL_TILE/COMP200' or 'COOLONL_TILE/CONDBR2' schema" )
79 from TileCalibBlobPython
import TileCalibTools
80 from TileCalibBlobObjs.Classes
import TileCalibUtils
82 from TileCalibBlobPython.TileCalibLogger
import getLogger
85 log.setLevel(logging.DEBUG)
89 db = TileCalibTools.openDbConn(schema,server)
91 folder1=
"/TILE/ONL01/NOISE/SAMPLE"
92 folder2=
"/TILE/ONL01/NOISE/OFNI"
93 if 'COMP200' in schema:
94 folder1=
"/TILE/OFL01/NOISE/SAMPLE"
95 log.info(
"Initializing ros %d, drawer %d for run %d, lumiblock %d", ros,drawer,run,lumi)
96 for folderPath
in [folder1, folder2]:
98 folderTag = TileCalibTools.getFolderTag(db, folderPath, tag)
99 log.info(
"Initializing folder %s with tag %s", folderPath, folderTag)
100 blobReader = TileCalibTools.TileBlobReader(db,folderPath, folderTag)
101 log.info(
"... %s", blobReader.getComment((run,lumi)))
102 blob = blobReader.getDrawer(ros, drawer,(run,lumi))
104 if folderPath.find(
"SAMPLE")!=-1:
105 ped = blob.getData(channel, adc, 0)
106 hfn = blob.getData(channel, adc, 1)
107 lfn = blob.getData(channel, adc, 2)
109 rms = blob.getData(channel, adc, 0)
110 plp = blob.getData(channel, adc, 1)
113 print (
"%s ch %i gn %i : PED = %f HFN = %f LFN = %f OF_RMS = %f PILEUP = %f" %
115 ped, hfn, lfn, rms, plp) )