12os.environ[
'TERM'] =
'linux'
15 print (
"Usage: ",sys.argv[0],
" [OPTION] ... ")
16 print (
"Dumps the TileCal CIS/NLN from various schemas / folders / tags")
18 print (
"-h, --help shows this help")
19 print (
"-f, --folder= specify status folder to use f.i. /TILE/OFL02/CALIB/CIS/NLN ")
20 print (
"-t, --tag= specify tag to use, f.i. UPD1 or UPD4 or full suffix like RUN2-HLT-UPD1-00")
21 print (
"-r, --run= specify run number, by default uses latest iov")
22 print (
"-l, --lumi= specify lumi block number, default is 0")
23 print (
"-p, --ros= specify partition (ros number), default is 1")
24 print (
"-d, --drawer= specify drawer number, default is 0")
25 print (
"-m, --module= specify module to use, default is LBA01")
26 print (
"-c, --chan= specify channel number, default is 0")
27 print (
"-g, -a, --adc= specify gain (adc number), default is 0")
28 print (
"-s, --schema= specify name of input JSON file or CREST_SERVER_PATH")
30letters =
"hr:l:s:t:f:p:d:m:c:a:g:"
31keywords = [
"help",
"run=",
"lumi=",
"schema=",
"tag=",
"folder=",
"ros=",
"drawer=",
"module=",
"chan=",
"channel=",
"adc=",
"gain="]
34 opts, extraparams = getopt.getopt(sys.argv[1:],letters,keywords)
35except getopt.GetoptError
as err:
44folderPath =
"/TILE/OFL02/CALIB/CIS/NLN"
53 if o
in (
"-f",
"--folder"):
55 elif o
in (
"-t",
"--tag"):
57 elif o
in (
"-s",
"--schema"):
59 elif o
in (
"-m",
"--module"):
61 part_dict = {
'AUX':0,
'LBA':1,
'LBC':2,
'EBA':3,
'EBC':4}
62 if partname
in part_dict:
63 ros = part_dict[partname]
64 drawer =
max(int(a[3:])-1,0)
65 elif o
in (
"-p",
"--ros"):
67 elif o
in (
"-d",
"--drawer"):
69 elif o
in (
"-c",
"--chan",
"--channel"):
71 elif o
in (
"-a",
"--adc",
"-g",
"--gain"):
73 elif o
in (
"-r",
"--run"):
75 elif o
in (
"-l",
"--lumi"):
77 elif o
in (
"-h",
"--help"):
81 raise RuntimeError(
"unhandled option")
84from TileCalibBlobPython
import TileCalibCrest
85from TileCalibBlobObjs.Classes
import TileCalibUtils
87from TileCalibBlobPython.TileCalibLogger
import getLogger
88log = getLogger(
"ReadLUT")
90log.setLevel(logging.DEBUG)
93if tag.upper().endswith(
'HEAD'):
95if len(tag)==0
or tag.endswith(
'HEAD'):
96 folderPath=folderPath.replace(
'OFL02',
'ONL01')
97 log.info(
"tag is %s, using %s folder", tag
if tag
else 'empty', folderPath)
102if folderTag.upper().startswith(
"TILE") :
104log.info(
"Initializing folder %s with tag %s", folderPath, folderTag)
106blobReader = TileCalibCrest.TileBlobReaderCrest(schema,folderPath, folderTag, run, lumi)
110log.info(
"Initializing ros %d, drawer %d for run %d, lumiblock %d", ros,drawer,run,lumi)
111log.info(
"... %s", blobReader.getComment((run,lumi)))
112flt = blobReader.getDrawer(ros, drawer,(run,lumi))
113maxidx = flt.getObjSizeUint32()
114log.info(
"Maxidx = %d", maxidx )
119print (
"%s ch %i gn %i :" % ( modName, channel, adc ) )
120for idx
in range(0,maxidx):
121 print (
" %2d %f" % (idx, flt.getData(channel, adc, idx) ) )
static std::string getDrawerString(unsigned int ros, unsigned int drawer)
Return the drawer name, e.g.