7 reFedEntry = re.compile(
'\s*(MIN|MAX)(?P<name>.*)FEDID\s*=\s*(?P<id>[0-9]+).*')
10 with open(fedNumberingHeader)
as fedNumbering:
11 for line
in fedNumbering:
12 match = reFedEntry.match(line)
13 if match
and match.group(
'name'):
15 entries[match.group(
'name')].
append(int(match.group(
'id')))
17 entries[match.group(
'name')] = [int(match.group(
'id'))]
18 entries[match.group(
'name')].sort()
19 return sorted(entries.items(), key=
lambda e: e[1][0])
23 tableRow =
"<tr style='color:%s'><td><div align='center'>%s</div></td><td><div align='center'>%s</div></td><td><div align='center'>%s</div></td></tr>"
24 print(
"<table width='75%' border='1' align='center'>")
25 print(
"<tr style='color:#FF0000'><th>Detector</th><th>Min FED id (decimal)</th><th>Max FED id (decimal)</th></tr>")
26 for item
in fedEntries:
27 if lastId+1 < item[1][0]:
28 print(tableRow%(
'#FF0000',
'Free IDs',lastId+1,item[1][0]-1))
29 print(tableRow%(
'#000000',item[0],item[1][0],item[1][1]))
35 tableRow =
"|%(color)s !%(label)s|%(color)s %(minId)s|%(color)s %(maxId)s|"
36 print(
"|*Detector*|*Min FED id (decimal)*|*Max FED id (decimal)*|")
37 for item
in fedEntries:
38 if lastId+1 < item[1][0]:
39 print(tableRow%{
'color':
'%RED%',
'label':
'Free IDs',
'minId':lastId+1,
'maxId':item[1][0]-1})
40 print(tableRow%{
'color':
'%BLACK%',
'label':item[0],
'minId':item[1][0],
'maxId':item[1][1]})
43 if __name__ ==
"__main__":
44 fedEntries =
retrieveFedEntries(os.environ[
'CMSSW_BASE']+
'/src/DataFormats/FEDRawData/interface/FEDNumbering.h')
boost::dynamic_bitset append(const boost::dynamic_bitset<> &bs1, const boost::dynamic_bitset<> &bs2)
this method takes two bitsets bs1 and bs2 and returns result of bs2 appended to the end of bs1 ...
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)