2 from __future__
import print_function
3 from __future__
import absolute_import
4 from sys
import stderr, exit
7 from optparse
import OptionParser
8 parser = OptionParser(usage=
"usage: %prog [options] Trigger_Path")
9 parser.add_option(
"--firstRun", dest=
"firstRun", help=
"first run", type=
"int", metavar=
"RUN", default=
"1")
10 parser.add_option(
"--lastRun", dest=
"lastRun", help=
"last run", type=
"int", metavar=
"RUN", default=
"9999999")
11 parser.add_option(
"--groupName", dest=
"groupName", help=
"select runs of name like NAME", metavar=
"NAME", default=
"Collisions%")
12 parser.add_option(
"--jsonOut", dest=
"jsonOut", help=
"dump prescales in JSON format on FILE", metavar=
"FILE")
13 (options, args) = parser.parse_args()
20 edmCfgFromDB =
"edmConfigFromDB --orcoff --format summary.ascii --paths " + path;
24 cmd = ( edmCfgFromDB +
" --configName "+key +
" | grep -i "+ path +
" | tail -1 | awk ' $2 ==\"%s\" {print $NL}' " ) % path
25 res = subprocess.getoutput(cmd)
26 res_split = res.split()
29 for uu
in range(3,len(res_split)-1):
31 psCols.append(res_split[uu])
34 from .queryRR
import queryRR
37 asciiFile=open(
"columns.txt",
"read")
41 fl=asciiFile.readline()
46 mapIndex[runnumber]=pindex
52 runKeys =
queryRR(options.firstRun,options.lastRun,options.groupName)
55 runs = runKeys.keys(); runs.sort()
56 stderr.write(
"Querying ConfDB for prescales for path %s...\n" % (path));
60 if key
not in prescaleTable:
64 if len(prescaleTable[key]) == 0:
68 index = int(MapIndex[run])
69 psfactor = prescaleTable[key][index]
73 psfactor = prescaleTable[key][index]
77 psfactor = prescaleTable[key][index]
81 print(
"%s\t%s" % (run, psfactor))
83 print(
"%s\t%s\t (*)" % (run, psfactor))
88 print(
"(*) The following runs were not found in columns.txt (the run may be too recent, or the prescale index is not in OMDS).")
89 print(
"For these runs, the prescale_index was assumed to be zero. You need to check independently.")
95 stderr.write(
"Exporting to JSON file %s...\n" % (options.jsonOut))
97 jsonFile = open(options.jsonOut,
"w")
98 jsonFile.write(json.dumps(jsout))
const uint16_t range(const Frame &aFrame)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def getPrescalesFromKey
my $pyPrintTable = "echo 'for X in process.PrescaleService.prescaleTable: print \"%s %s" % (X...