12os.environ[
'TERM'] =
'linux'
15 print (
"Usage: ",sys.argv[0],
" [OPTION] ... ")
16 print (
"Dump Lumi values from online or offline CALO DB or from sqlite file")
18 print (
"-h, --help shows this help")
19 print (
"-s, --schema= specify name of input JSON file or CREST_SERVER_PATH")
20 print (
"-f, --folder= specify folder to use e.g. /CALO/Ofl/Noise/PileUpNoiseLumi")
21 print (
"-t, --tag= specify tag to use, f.i. UPD1 or UPD4 or tag suffix like RUN2-UPD4-04")
22 print (
"-c, --channel= specify COOL channel, by default COOL channels 0 and 1 are used")
23 print (
"-r, --run= specify run number, by default uses latest iov")
24 print (
"-l, --lumi= specify lumi block number, default is 0")
25 print (
"-b, --begin= specify run number of first iov in multi-iov mode, by default uses very first iov")
26 print (
"-e, --end= specify run number of last iov in multi-iov mode, by default uses latest iov")
28letters =
"hs:t:f:c:r:l:b:e:"
29keywords = [
"help",
"schema=",
"tag=",
"folder=",
"channel=",
"run=",
"lumi=",
"begin=",
"end="]
32 opts, extraparams = getopt.getopt(sys.argv[1:],letters,keywords)
33except getopt.GetoptError
as err:
43folderPath =
'/CALO/Ofl/Noise/PileUpNoiseLumi'
53 if o
in (
"-s",
"--schema"):
55 elif o
in (
"-f",
"--folder"):
57 elif o
in (
"-t",
"--tag"):
59 elif o
in (
"-c",
"--channel"):
61 elif o
in (
"-r",
"--run"):
63 elif o
in (
"-l",
"--lumi"):
65 elif o
in (
"-b",
"--begin"):
68 elif o
in (
"-e",
"--end"):
71 elif o
in (
"-h",
"--help"):
78from TileCalibBlobPython
import TileCalibCrest
79from TileCalibBlobPython.TileCalibLogger
import getLogger
82log = getLogger(
"ReadLumi")
84log.setLevel(logging.DEBUG)
89folderTAG = tag.upper()
90if folderTAG.startswith(
"CALO") :
92if not os.path.isfile(schema):
93 log.info(
"Initializing folder %s with tag %s", folderPath, tag)
94blobReader = TileCalibCrest.TileBlobReaderCrest(schema, folderPath, tag, run, lumi, channels[0], channels[-1],
True)
99 iovList = blobReader.getIovs((begin,0),(end,0))
103 if begin != be
or end != en:
106 log.info(
"Changing begin run from %d to %d (start of IOV)", begin,be)
110 log.info(
"Changing end run from %d to %d (start of next IOV)", end,en)
112 log.info(
"Changing end run from %d to %d (start of last IOV)", end,en)
114 log.info(
"%d IOVs in total", len(iovList) )
116 iovList.append((run,lumi))
127 pref =
"(%i,%i) " % (iovs[0],iovs[1])
131 obj = blobReader.getPayload(iovs,
False)
132 for chan
in channels:
133 values += [obj[str(chan)]]
137 log.warning(
"Warning: can not read data from input DB" )
138 if not iov
and obj
is not None:
139 io = blobReader.getIov()
140 (sinceRun,sinceLum) = (io[0][0],io[0][1])
141 (untilRun,untilLum) = (io[1][0],io[1][1])
142 suff =
" iov since [%d,%d] until (%d,%d)" % (sinceRun,sinceLum,untilRun,untilLum)
144 print(pref1,values[0],suff)
146 print(pref1,values,suff)
void print(char *figname, TCanvas *c1)