13os.environ[
'TERM'] =
'linux'
16 print (
"Usage: ",sys.argv[0],
" [OPTION] ... ")
17 print (
"Dumps the TileCal OFC values various schemas / folders / tags")
19 print (
"-h, --help shows this help")
20 print (
"-f, --folder= specify status folder to use CIS, LAS, PHY ")
21 print (
"-t, --tag= specify tag to use, f.i. UPD1 or UPD4 or full suffix like RUN2-HLT-UPD1-00")
22 print (
"-r, --run= specify run number, by default uses latest iov")
23 print (
"-l, --lumi= specify lumi block number, default is 0")
24 print (
"-p, --ros= specify partition (ros number), default is 1")
25 print (
"-d, --drawer= specify drawer number, default is 0")
26 print (
"-m, --module= specify module to use, default is LBA01")
27 print (
"-c, --chan= specify channel number, default is 0")
28 print (
"-g, -a, --adc= specify gain (adc number), default is 0")
29 print (
"-i, --field= specify field number, default is 0")
30 print (
"-s, --schema= specify name of input JSON file or CREST_SERVER_PATH")
32letters =
"hr:l:s:t:f:p:d:m:c:a:g:i:"
33keywords = [
"help",
"run=",
"lumi=",
"schema=",
"tag=",
"folder=",
"ros=",
"drawer=",
"module=",
"chan=",
"channel=",
"adc=",
"gain=",
"field="]
36 opts, extraparams = getopt.getopt(sys.argv[1:],letters,keywords)
37except getopt.GetoptError
as err:
46folderPath =
"/TILE/ONL01/FILTER/OF2/PHY"
56 if o
in (
"-f",
"--folder"):
57 if a.startswith(
"/TILE"):
59 elif a.startswith(
"OF"):
60 folderPath =
"/TILE/ONL01/FILTER/%s" % a
62 folderPath =
"/TILE/ONL01/FILTER/OF2/%s" % a
63 elif o
in (
"-t",
"--tag"):
65 elif o
in (
"-s",
"--schema"):
67 elif o
in (
"-m",
"--module"):
69 part_dict = {
'AUX':0,
'LBA':1,
'LBC':2,
'EBA':3,
'EBC':4}
70 if partname
in part_dict:
71 ros = part_dict[partname]
72 drawer =
max(int(a[3:])-1,0)
73 elif o
in (
"-p",
"--ros"):
75 elif o
in (
"-d",
"--drawer"):
77 elif o
in (
"-c",
"--chan",
"--channel"):
79 elif o
in (
"-a",
"--adc",
"-g",
"--gain"):
81 elif o
in (
"-i",
"--field"):
83 elif o
in (
"-r",
"--run"):
85 elif o
in (
"-l",
"--lumi"):
87 elif o
in (
"-h",
"--help"):
91 raise RuntimeError(
"unhandled option")
94from TileCalibBlobPython
import TileCalibCrest
95from TileCalibBlobObjs.Classes
import TileCalibUtils
97from TileCalibBlobPython.TileCalibLogger
import getLogger
98log = getLogger(
"ReadOfc")
100log.setLevel(logging.DEBUG)
103if tag.upper().endswith(
'HEAD'):
105if len(tag)==0
or tag.endswith(
'HEAD'):
106 folderPath=folderPath.replace(
'OFL02',
'ONL01')
107 log.info(
"tag is %s, using %s folder", tag
if tag
else 'empty', folderPath)
112if folderTag.upper().startswith(
"TILE") :
114log.info(
"Initializing folder %s with tag %s", folderPath, folderTag)
116blobReader = TileCalibCrest.TileBlobReaderCrest(schema,folderPath, folderTag, run, lumi)
120log.info(
"Initializing ros %d, drawer %d for run %d, lumiblock %d", ros,drawer,run,lumi)
121log.info(
"... %s", blobReader.getComment((run,lumi)))
122ofc = blobReader.getDrawer(ros, drawer,(run,lumi))
125nchann = ofc.getNChans()
126nfields = ofc.getNFields()
127nsamples = ofc.getNSamples()
128nphases = ofc.getNPhases()
130log.info(
"nchann = %d", nchann )
131log.info(
"nfields = %d", nfields )
132log.info(
"nphases = %d", nphases )
133log.info(
"nsamples = %d", nsamples)
138for iphase
in range(abs(nphases)):
139 phase = ofc.getPhase(channel, adc, iphase)
140 msg =
"phase %6.1f ns :" % phase
141 for smp
in range(0, nsamples):
142 msg +=
" %f" % ofc.getOfc(field, channel, adc, phase, smp)
static std::string getDrawerString(unsigned int ros, unsigned int drawer)
Return the drawer name, e.g.