Main Page
Namespaces
Classes
Package Documentation
RecoLuminosity
LumiDB
python
selectionParser.py
Go to the documentation of this file.
1
from
__future__
import
print_function
2
import
json
3
class
selectionParser
(
object
):
4
def
__init__
(self,selectStr):
5
self.
__result
={}
6
self.
__strresult
={}
7
strresult=json.loads(selectStr)
8
for
k,v
in
strresult.items():
9
expandedvalues=[]
10
for
w
in
v:
11
if
len(w)==0:
12
self.
__result
[
int
(k)]=expandedvalues
13
self.
__strresult
[k]=[]
14
continue
15
###weed out [10]-like stuff just in case they exist
16
elif
len(w)==1:
17
expandedvalues.append(w[0])
18
##weed out [10,10]-like stuff
19
elif
len(w)==2
and
w[0]==w[1]:
20
expandedvalues.append(w[0])
21
else
:
22
for
i
in
range(w[0],w[1]+1):
23
expandedvalues.append(i)
24
self.
__result
[
int
(k)]=expandedvalues
25
self.
__strresult
[k]=[
str
(x)
for
x
in
expandedvalues]
26
def
runs
(self):
27
return
self.__result.keys()
28
def
runsandls
(self):
29
'''return expanded {run:lslist}
30
'''
31
return
self.
__result
32
def
runsandlsStr
(self):
33
'''return expanded {'run':lslist}
34
'''
35
return
self.
__strresult
36
def
numruns
(self):
37
return
len(self.
__result
)
38
def
numls
(self,run):
39
return
len(self.
__result
[run])
40
if
__name__ ==
"__main__"
:
41
s=
selectionParser
(
'{"1":[[3,45]],"2":[[4,8],[10,10]],"3":[[]]}'
)
42
print
(
'runs : '
,s.runs())
43
print
(
'full result : '
,s.runsandls())
44
print
(
'str result : '
,s.runsandlsStr())
45
print
(
'num runs : '
,s.numruns())
46
print
(
'numls in run : '
,s.numls(1))
selectionParser.selectionParser.__strresult
__strresult
Definition:
selectionParser.py:6
edm::print
S & print(S &os, JobReport::InputFile const &f)
Definition:
JobReport.cc:66
selectionParser.selectionParser.runsandls
def runsandls(self)
Definition:
selectionParser.py:28
selectionParser.selectionParser.__result
__result
Definition:
selectionParser.py:5
createfilelist.int
int
Definition:
createfilelist.py:10
selectionParser.selectionParser.runs
def runs(self)
Definition:
selectionParser.py:26
selectionParser.selectionParser.runsandlsStr
def runsandlsStr(self)
Definition:
selectionParser.py:32
selectionParser.selectionParser.numruns
def numruns(self)
Definition:
selectionParser.py:36
selectionParser.selectionParser.numls
def numls(self, run)
Definition:
selectionParser.py:38
str
#define str(s)
Definition:
TestProcessor.cc:47
resolutioncreator_cfi.object
object
Definition:
resolutioncreator_cfi.py:4
selectionParser.selectionParser.__init__
def __init__(self, selectStr)
Definition:
selectionParser.py:4
selectionParser.selectionParser
Definition:
selectionParser.py:3
Generated for CMSSW Reference Manual by
1.8.11