RecoLuminosity
LumiDB
python
selectionParser.py
Go to the documentation of this file.
1
from
__future__
import
print_function
2
from
builtins
import
range
3
import
json
4
class
selectionParser
(
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
for
w
in
v:
12
if
len(w)==0:
13
self.
__result
[
int
(k)]=expandedvalues
14
self.
__strresult
[k]=[]
15
continue
16
17
elif
len(w)==1:
18
expandedvalues.append(w[0])
19
20
elif
len(w)==2
and
w[0]==w[1]:
21
expandedvalues.append(w[0])
22
else
:
23
for
i
in
range
(w[0],w[1]+1):
24
expandedvalues.append(i)
25
self.
__result
[
int
(k)]=expandedvalues
26
self.
__strresult
[k]=[
str
(x)
for
x
in
expandedvalues]
27
def
runs
(self):
28
return
self.
__result
.
keys
()
29
def
runsandls
(self):
30
'''return expanded {run:lslist}
31
'''
32
return
self.
__result
33
def
runsandlsStr
(self):
34
'''return expanded {'run':lslist}
35
'''
36
return
self.
__strresult
37
def
numruns
(self):
38
return
len(self.
__result
)
39
def
numls
(self,run):
40
return
len(self.
__result
[run])
41
if
__name__ ==
"__main__"
:
42
s=
selectionParser
(
'{"1":[[3,45]],"2":[[4,8],[10,10]],"3":[[]]}'
)
43
print
(
'runs : '
,s.runs())
44
print
(
'full result : '
,s.runsandls())
45
print
(
'str result : '
,s.runsandlsStr())
46
print
(
'num runs : '
,s.numruns())
47
print
(
'numls in run : '
,s.numls(1))
selectionParser.selectionParser.__strresult
__strresult
Definition:
selectionParser.py:7
selectionParser.selectionParser.runsandls
def runsandls(self)
Definition:
selectionParser.py:29
relativeConstraints.keys
keys
Definition:
relativeConstraints.py:89
selectionParser.selectionParser.__result
__result
Definition:
selectionParser.py:6
createfilelist.int
int
Definition:
createfilelist.py:10
selectionParser.selectionParser.runs
def runs(self)
Definition:
selectionParser.py:27
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition:
Utilities.cc:47
selectionParser.selectionParser.runsandlsStr
def runsandlsStr(self)
Definition:
selectionParser.py:33
selectionParser.selectionParser.numruns
def numruns(self)
Definition:
selectionParser.py:37
FastTimerService_cff.range
range
Definition:
FastTimerService_cff.py:34
selectionParser.selectionParser.numls
def numls(self, run)
Definition:
selectionParser.py:39
str
#define str(s)
Definition:
TestProcessor.cc:56
resolutioncreator_cfi.object
object
Definition:
resolutioncreator_cfi.py:4
selectionParser.selectionParser.__init__
def __init__(self, selectStr)
Definition:
selectionParser.py:5
selectionParser.selectionParser
Definition:
selectionParser.py:4
Generated for CMSSW Reference Manual by
1.8.14