CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
csvLumibyLSParser.csvLumibyLSParser Class Reference
Inheritance diagram for csvLumibyLSParser.csvLumibyLSParser:

Public Member Functions

def __init__
 
def numls
 
def numruns
 
def runs
 
def runsandls
 

Private Attributes

 __filename
 
 __result
 
 __RunX
 
 __strresult
 

Detailed Description

Definition at line 13 of file csvLumibyLSParser.py.

Constructor & Destructor Documentation

def csvLumibyLSParser.csvLumibyLSParser.__init__ (   self,
  filename,
  RunX 
)

Definition at line 14 of file csvLumibyLSParser.py.

14 
15  def __init__(self,filename,RunX):
16  self.__result={}
17  self.__strresult={}
18  self.__filename=filename
19  self.__RunX=RunX
20  csvReader=csv.reader(open(filename),delimiter=',')
21  oldRun=0
22  runnumber=0
23  ldict = {}
24  llist = []
25  NonValidLumi = 0
26  lastLumi = 0
27  for row in csvReader:
28  field0=str(row[0]).strip()
29  fieldsplit=re.split(':',field0)
30  runstring = fieldsplit[0]
31  try:
32  field1=str(row[1]).strip()
33  fieldsplit=re.split(':',field1)
34  lsstring = fieldsplit[0]
35  except Exception as e:
36  lsstring='1' # for list with run number only, fake lsnum
37  if not is_intstr(runstring) or not is_intstr(lsstring):
38  continue
39  runnumber=int(runstring)
40  lsnumber=int(lsstring)
41 
42  if runnumber != oldRun:
43  if oldRun>0:
44  self.__result[oldRun]=ldict
45  ldict = {}
46  oldRun = runnumber
47  lastLumi = 0
48  NonValidLumi = 0
49  else:
50  oldRun = runnumber
51 
52  try:
53  if RunX=='Run2':
54  delivered, recorded = float( row[4] ), float( row[5] )
55  if RunX=='Run1':
56  delivered, recorded = float( row[5] ), float( row[6] )
57  except:
58  print('Record not parsed, Run = %d, LS = %d' % (runnumber, lsnumber))
59 
60 # Commented out... If there is no value, there is no interpolation now...
61 # if recorded>0 :
62 # lastLumi = recorded
63 # if NonValidLumi>0:
64 # # have to put real values in lumi list
65 # for lnum in llist:
66 # elems = [delivered, recorded]
67 # ldict[lnum] = elems
68 # NonValidLumi=0
69 # llist = []
70 # else:
71 # if lastLumi>0:
72 # recorded = lastLumi
73 # else:
74 # # have to save lumi sections to fill once we get a non-zero lumi value
75 # llist.append(lsnumber)
76 # NonValidLumi=1
77 
78  elems = [ delivered,recorded ]
79  ldict[lsnumber]=elems
80 
81  self.__result[runnumber]=ldict #catch the last one
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
#define str(s)

Member Function Documentation

def csvLumibyLSParser.csvLumibyLSParser.numls (   self,
  run 
)

Definition at line 94 of file csvLumibyLSParser.py.

References csvLumibyLSParser.csvLumibyLSParser.__result, EgammaHLTValidationUtils.EgammaDQMModuleMaker.__result, and SequenceTypes._CopyAndExcludeSequenceVisitorOld.__result.

94 
95  def numls(self,run):
96  return len(self.__result[run])
def csvLumibyLSParser.csvLumibyLSParser.numruns (   self)

Definition at line 92 of file csvLumibyLSParser.py.

References csvLumibyLSParser.csvLumibyLSParser.__result, EgammaHLTValidationUtils.EgammaDQMModuleMaker.__result, and SequenceTypes._CopyAndExcludeSequenceVisitorOld.__result.

92 
93  def numruns(self):
return len(self.__result)
def csvLumibyLSParser.csvLumibyLSParser.runs (   self)

Definition at line 82 of file csvLumibyLSParser.py.

82 
83  def runs(self):
return self.__result.keys()
def csvLumibyLSParser.csvLumibyLSParser.runsandls (   self)
return {run:lslist}

Definition at line 84 of file csvLumibyLSParser.py.

References csvLumibyLSParser.csvLumibyLSParser.__result, EgammaHLTValidationUtils.EgammaDQMModuleMaker.__result, and SequenceTypes._CopyAndExcludeSequenceVisitorOld.__result.

84 
85  def runsandls(self):
86  '''return {run:lslist}
87  '''
88  return self.__result
89 # def runsandlsStr(self):
90 # '''return {'run':lslist}
91 # '''
# return self.__strresult

Member Data Documentation

csvLumibyLSParser.csvLumibyLSParser.__filename
private

Definition at line 17 of file csvLumibyLSParser.py.

csvLumibyLSParser.csvLumibyLSParser.__result
private

Definition at line 15 of file csvLumibyLSParser.py.

Referenced by selectionParser.selectionParser.numls(), pileupParser.pileupParser.numls(), csvLumibyLSParser.csvLumibyLSParser.numls(), selectionParser.selectionParser.numruns(), pileupParser.pileupParser.numruns(), csvLumibyLSParser.csvLumibyLSParser.numruns(), selectionParser.selectionParser.runsandls(), pileupParser.pileupParser.runsandls(), and csvLumibyLSParser.csvLumibyLSParser.runsandls().

csvLumibyLSParser.csvLumibyLSParser.__RunX
private

Definition at line 18 of file csvLumibyLSParser.py.

csvLumibyLSParser.csvLumibyLSParser.__strresult
private

Definition at line 16 of file csvLumibyLSParser.py.

Referenced by selectionParser.selectionParser.runsandlsStr(), and pileupParser.pileupParser.runsandlsStr().