12os.environ[
'TERM'] =
'linux'
15 print (
"Usage: ",sys.argv[0],
" [OPTION] ... ")
16 print (
"Dumps the TileCal noise from SAMPLE and OFNI folders")
18 print (
"-h, --help shows this help")
19 print (
"-t, --tag= specify tag to use, f.i. RUN2-HLT-UPD1-01 or COM-01")
20 print (
"-r, --run= specify run number, by default uses latest iov")
21 print (
"-l, --lumi= specify lumi block number, default is 0")
22 print (
"-p, --ros= specify partition (ros number), default is 1")
23 print (
"-d, --drawer= specify drawer number, default is 0")
24 print (
"-m, --module= specify module to use, default is LBA01")
25 print (
"-c, --chan= specify channel number, default is 0")
26 print (
"-g, -a, --adc= specify gain (adc number), default is 0")
27 print (
"-s, --schema= specify name of input JSON file or CREST_SERVER_PATH")
29letters =
"hr:l:s:t:p:d:m:c:a:g:"
30keywords = [
"help",
"run=",
"lumi=",
"schema=",
"tag=",
"ros=",
"drawer=",
"module",
"chan=",
"channel=",
"adc=",
"gain="]
33 opts, extraparams = getopt.getopt(sys.argv[1:],letters,keywords)
34except getopt.GetoptError
as err:
51 if o
in (
"-t",
"--tag"):
53 elif o
in (
"-s",
"--schema"):
55 elif o
in (
"-r",
"--run"):
57 elif o
in (
"-l",
"--lumi"):
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 (
"-h",
"--help"):
77 raise RuntimeError(
"unhandled option")
81from TileCalibBlobPython
import TileCalibCrest
82from TileCalibBlobObjs.Classes
import TileCalibUtils
84from TileCalibBlobPython.TileCalibLogger
import getLogger
85log = getLogger(
"readNoise")
87log.setLevel(logging.DEBUG)
90folder1=
"/TILE/ONL01/NOISE/SAMPLE"
91folder2=
"/TILE/ONL01/NOISE/OFNI"
92log.info(
"Initializing ros %d, drawer %d for run %d, lumiblock %d", ros,drawer,run,lumi)
93for folderPath
in [folder1, folder2]:
95 log.info(
"Initializing folder %s with tag %s", folderPath, tag)
96 blobReader = TileCalibCrest.TileBlobReaderCrest(schema, folderPath, tag, run, lumi)
97 log.info(
"... %s", blobReader.getComment((run,lumi)))
98 blob = blobReader.getDrawer(ros, drawer,(run,lumi))
100 if folderPath.find(
"SAMPLE")!=-1:
101 ped = blob.getData(channel, adc, 0)
102 hfn = blob.getData(channel, adc, 1)
103 lfn = blob.getData(channel, adc, 2)
105 rms = blob.getData(channel, adc, 0)
106 plp = blob.getData(channel, adc, 1)
109print (
"%s ch %i gn %i : PED = %f HFN = %f LFN = %f OF_RMS = %f PILEUP = %f" %
111 ped, hfn, lfn, rms, plp) )
static std::string getDrawerString(unsigned int ros, unsigned int drawer)
Return the drawer name, e.g.