Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
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
###weed out [10]-like stuff just in case they exist
17
elif
len(w)==1:
18
expandedvalues.append(w[0])
19
##weed out [10,10]-like stuff
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.runsandlsStr
def runsandlsStr
Definition:
selectionParser.py:33
selectionParser.selectionParser.numls
def numls
Definition:
selectionParser.py:39
selectionParser.selectionParser.__init__
def __init__
Definition:
selectionParser.py:5
sistrip::SpyUtilities::range
const uint16_t range(const Frame &aFrame)
Definition:
SiStripSpyUtilities.cc:76
selectionParser.selectionParser.__result
__result
Definition:
selectionParser.py:6
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition:
Utilities.cc:47
selectionParser.selectionParser.runsandls
def runsandls
Definition:
selectionParser.py:29
selectionParser.selectionParser.numruns
def numruns
Definition:
selectionParser.py:37
str
#define str(s)
Definition:
TestProcessor.cc:53
selectionParser.selectionParser
Definition:
selectionParser.py:4
selectionParser.selectionParser.runs
def runs
Definition:
selectionParser.py:27
Generated for CMSSW Reference Manual by
1.8.5