RecoLuminosity
LumiDB
python
pileupParser.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
from
__future__
import
print_function
3
import
json
4
class
pileupParser
(
object
):
5
def
__init__
(self,selectStr):
6
self.
__result
={}
7
self.
__strresult
={}
8
strresult=json.loads(selectStr)
9
for
k,v
in
strresult.items():
10
# expandedvalues=[]
11
# print v
12
ldict={}
13
for
elems
in
v:
14
llist = [ elems[1],elems[2],elems[3] ]
15
ldict[
int
(elems[0])] = llist
16
17
18
# for w in v:
19
# if len(w)==0:
20
# self.__result[int(k)]=expandedvalues
21
# self.__strresult[k]=[]
22
# continue
23
32
self.
__result
[
int
(k)]=ldict
33
# self.__strresult[k]=[str(x) for x in expandedvalues]
34
def
runs
(self):
35
return
self.
__result
.
keys
()
36
def
runsandls
(self):
37
'''return expanded {run:lslist}
38
'''
39
return
self.
__result
40
def
runsandlsStr
(self):
41
'''return expanded {'run':lslist}
42
'''
43
return
self.
__strresult
44
def
numruns
(self):
45
return
len(self.
__result
)
46
def
numls
(self,run):
47
return
len(self.
__result
[run])
48
if
__name__ ==
"__main__"
:
49
# s=pileupParser('{"1":[[3,45]],"2":[[4,8],[10,10]],"3":[[]]}')
50
s=
pileupParser
(
'{"179434": [[21,38.140,7.2,2.220e-04],[22,49.032,7.2,2.218e-04]],"179435": [[21,38.140,7.2,2.220e-04],[22,49.032,7.2,2.218e-04]]}'
)
51
52
print
(
'runs : '
,s.runs())
53
print
(
'full result : '
,s.runsandls())
54
# print 'str result : ',s.runsandlsStr()
55
# print 'num runs : ',s.numruns()
56
# print 'numls in run : ',s.numls(1)
resolutioncreator_cfi.object
object
Definition:
resolutioncreator_cfi.py:4
pileupParser.pileupParser
Definition:
pileupParser.py:4
relativeConstraints.keys
keys
Definition:
relativeConstraints.py:89
pileupParser.pileupParser.__result
__result
Definition:
pileupParser.py:6
pileupParser.pileupParser.numls
def numls(self, run)
Definition:
pileupParser.py:46
pileupParser.pileupParser.__strresult
__strresult
Definition:
pileupParser.py:7
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition:
Utilities.cc:46
createfilelist.int
int
Definition:
createfilelist.py:10
pileupParser.pileupParser.runs
def runs(self)
Definition:
pileupParser.py:34
pileupParser.pileupParser.runsandls
def runsandls(self)
Definition:
pileupParser.py:36
pileupParser.pileupParser.runsandlsStr
def runsandlsStr(self)
Definition:
pileupParser.py:40
pileupParser.pileupParser.__init__
def __init__(self, selectStr)
Definition:
pileupParser.py:5
pileupParser.pileupParser.numruns
def numruns(self)
Definition:
pileupParser.py:44
Generated for CMSSW Reference Manual by
1.8.16