CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions | Variables
runregparse Namespace Reference

Functions

def invert_intervals
 
def merge_intervals
 
def remove_extra_spaces
 
def remove_html_tags
 
def searchrun
 

Variables

tuple ADDRESS = CONFIG.get('Common','RunReg')
 
tuple BFIELD = CONFIG.get('Common','BField_thr')
 
tuple BFIELD_float = float(BFIELD)
 
list blocks = selected_dcs[run]
 
tuple CFGLIST = CONFIG.items('Common')
 
list combined = []
 
dictionary compactList = {}
 
tuple CONFIG = ConfigParser.ConfigParser()
 
string CONFIGFILE = 'runreg.cfg'
 
tuple DATASET = CONFIG.get('Common','Dataset')
 
list DCS_ALL = ['Bpix','Fpix','Tibtid','TecM','TecP','Tob','Ebminus','Ebplus','EeMinus','EePlus','EsMinus','EsPlus','HbheA','HbheB','HbheC','H0','Hf','Dtminus','Dtplus','Dt0','CscMinus','CscPlus','Rpc','Castor',"NONE"]
 
tuple dcs_data = server.DataExporter.export('RUNLUMISECTION', 'GLOBAL', 'json', sel_dcstable)
 
tuple dcsbad_int = invert_intervals(jsonlist[element])
 
tuple DCSLIST = string.split(DCSSTAT,',')
 
tuple DCSSTAT = CONFIG.get('Common','DCS')
 
 EXCEPTION = False
 
int EXRUN = -1
 
string FULLADDRESS = ADDRESS+"/xmlrpc"
 
tuple GROUP = CONFIG.get('Common','Group')
 
tuple hlt = line.split(',')
 
tuple HLTNAMEFILTER = CONFIG.get('Common','HLTnameFilter')
 
tuple JSONFILE = CONFIG.get('Common','JSONFILE')
 
tuple jsonlist = json.loads(dcs_data)
 
list LISTOFRUN = []
 
tuple ls_temp_data = server.DataExporter.export('RUN', 'GLOBAL', 'csv_datasets', sel_dstable)
 
 LSCOMMENT = True
 
tuple LSPARSE = CONFIG.get('Common','LSCOMMENT')
 
tuple lumiSummary = open(JSONFILE, 'w')
 
tuple manualbad_int = searchrun(element)
 
tuple OUTPUTFILENAME = CONFIG.get('Common',"OutputFileName")
 
list prevblock = [-2,-2]
 
list QF_ALL_STAT = ["GOOD","BAD","EXCL","NONE"]
 
list QF_ALL_SYS = ["Hcal","Track","Strip","Egam","Es","Dt","Csc","Pix","Muon","Rpc","Castor","Jmet","Ecal","L1t","Hlt","NONE"]
 
tuple QFLAGS = CONFIG.get('Common','QFLAGS')
 
tuple QFlist = string.split(QFLAGS,',')
 
list ranges = []
 
tuple run = line.split(',')
 
tuple run_data = server.DataExporter.export('RUN', 'GLOBAL', 'csv_runs', sel_runtable)
 
tuple RUNMAX = CONFIG.get('Common','Runmax')
 
tuple RUNMIN = CONFIG.get('Common','Runmin')
 
tuple runs_to_print = selected_dcs.keys()
 
string sel_dcstable = "{groupName} ='"
 
string sel_dstable = "{groupName} ='"
 
string sel_runtable = "{groupName} ='"
 
dictionary selected_dcs = {}
 
tuple selectedRuns = open(OUTPUTFILENAME, 'w')
 
string selectlumi = "process.source.lumisToProcess = cms.untracked.VLuminosityBlockRange(\n"
 
tuple server = xmlrpclib.ServerProxy(FULLADDRESS)
 
tuple syst = string.split(QF,":")
 
int Tries = 0
 
tuple value = string.split(QF,":")
 

Function Documentation

def runregparse.invert_intervals (   intervals,
  min_val = 1,
  max_val = 9999 
)

Definition at line 24 of file runregparse.py.

References merge_intervals().

24 
25 def invert_intervals(intervals,min_val=1,max_val=9999):
26  # first order and merge in case
27  if not intervals:
28  return []
29  intervals=merge_intervals(intervals)
30  intervals = sorted(intervals, key = lambda x: x[0])
31  result = []
32  if min_val==-1:
33  # defin min and max
34  (a,b)=intervals[0]
35  min_val=a
36  if max_val==-1:
37  (a,b)=intervals[len(intervals)-1]
38  max_val=b
39 
40  curr_min=min_val
41  for (x,y) in intervals:
42  if x>curr_min:
43  result.append((curr_min,x-1))
44  curr_min=y+1
45  if curr_min<max_val:
46  result.append((curr_min,max_val))
47 
48 # print min_val,max_val
49  return result
def merge_intervals
Definition: runregparse.py:50
def invert_intervals
Definition: runregparse.py:24
def runregparse.merge_intervals (   intervals)

Definition at line 50 of file runregparse.py.

References bookConverter.max.

Referenced by invert_intervals(), and searchrun().

50 
51 def merge_intervals(intervals):
52  if not intervals:
53  return []
54  intervals = sorted(intervals, key = lambda x: x[0])
55  result = []
56  (a, b) = intervals[0]
57  for (x, y) in intervals[1:]:
58  if x <= b:
59  b = max(b, y)
60  else:
61  result.append((a, b))
62  (a, b) = (x, y)
63  result.append((a, b))
64  return result
def merge_intervals
Definition: runregparse.py:50
def runregparse.remove_extra_spaces (   data)

Definition at line 71 of file runregparse.py.

Referenced by searchrun().

71 
72 def remove_extra_spaces(data):
73  result= re.sub(r'\s', '', data)
74  return result
def remove_extra_spaces
Definition: runregparse.py:71
def runregparse.remove_html_tags (   data)

Definition at line 65 of file runregparse.py.

Referenced by searchrun().

65 
66 def remove_html_tags(data):
67  p = re.compile(r'<.*?>')
68  newdata=p.sub('', data)
69  newdata=newdata.replace("&nbsp;","")
70  return newdata
def remove_html_tags
Definition: runregparse.py:65
def runregparse.searchrun (   runno)

Definition at line 75 of file runregparse.py.

References merge_intervals(), remove_extra_spaces(), and remove_html_tags().

75 
76 def searchrun(runno):
77  global QF_Req,ls_temp_data,QF_ALL_SYS,EXCEPTION,EXRUN
78  intervallist=[]
79  selectls=""
80 
81  for line in ls_temp_data.split("\n"):
82  if runno in line:
83 # print line
84  try:
85  if "%%%BAD LS INFO BEGIN%%%" in line:
86  selectls=line.split("%%%BAD LS INFO BEGIN%%%")[1]
87  selectls=selectls.split("%%%BAD LS INFO END%%%")[0]
88  selectls=remove_html_tags(selectls)
89  selectls=remove_extra_spaces(selectls)
90  # print selectls
91  for tag in QF_ALL_SYS:
92  selectls=selectls.replace(tag+":","\n"+tag+":")
93  # print selectls
94 
95  for line in selectls.split("\n"):
96  try:
97  tag=line.split(":")[0]
98  intervals=line.split(":")[1]
99  except:
100  continue
101  if tag in QF_Req.keys():
102  if QF_Req[tag]=="GOOD":
103  for interval in intervals.split(","):
104  if "ALL" in interval:
105  lmin=1
106  lmax=9999
107  else:
108  strmin=interval.split('-')[0]
109  strmax=interval.split('-')[1]
110  lmin=int(strmin)
111  if "END" in strmax:
112  lmax=9999
113  else:
114  lmax=int(strmax)
115  intervallist.append((lmin,lmax))
116  except:
117  EXCEPTION=True
118  EXRUN=int(runno)
119  intervallist=merge_intervals(intervallist)
120  # print runno, intervallist
121  return intervallist
122 
123 
124 
125 #main starts here#
126 
127 QF_Req={}
GOODRUN={}
def merge_intervals
Definition: runregparse.py:50
def remove_html_tags
Definition: runregparse.py:65
def remove_extra_spaces
Definition: runregparse.py:71

Variable Documentation

tuple runregparse.ADDRESS = CONFIG.get('Common','RunReg')

Definition at line 143 of file runregparse.py.

tuple runregparse.BFIELD = CONFIG.get('Common','BField_thr')

Definition at line 147 of file runregparse.py.

tuple runregparse.BFIELD_float = float(BFIELD)

Definition at line 182 of file runregparse.py.

list runregparse.blocks = selected_dcs[run]

Definition at line 304 of file runregparse.py.

tuple runregparse.CFGLIST = CONFIG.items('Common')

Definition at line 178 of file runregparse.py.

tuple runregparse.combined = []

Definition at line 274 of file runregparse.py.

Referenced by PFMuonAlgo.printMuonProperties(), and SymmetryFit.symmetryChi2().

dictionary runregparse.compactList = {}

Definition at line 128 of file runregparse.py.

tuple runregparse.CONFIG = ConfigParser.ConfigParser()

Definition at line 136 of file runregparse.py.

string runregparse.CONFIGFILE = 'runreg.cfg'

Definition at line 135 of file runregparse.py.

tuple runregparse.DATASET = CONFIG.get('Common','Dataset')

Definition at line 140 of file runregparse.py.

list runregparse.DCS_ALL = ['Bpix','Fpix','Tibtid','TecM','TecP','Tob','Ebminus','Ebplus','EeMinus','EePlus','EsMinus','EsPlus','HbheA','HbheB','HbheC','H0','Hf','Dtminus','Dtplus','Dt0','CscMinus','CscPlus','Rpc','Castor',"NONE"]

Definition at line 132 of file runregparse.py.

tuple runregparse.dcs_data = server.DataExporter.export('RUNLUMISECTION', 'GLOBAL', 'json', sel_dcstable)

Definition at line 230 of file runregparse.py.

tuple runregparse.dcsbad_int = invert_intervals(jsonlist[element])

Definition at line 273 of file runregparse.py.

tuple runregparse.DCSLIST = string.split(DCSSTAT,',')

Definition at line 150 of file runregparse.py.

tuple runregparse.DCSSTAT = CONFIG.get('Common','DCS')

Definition at line 149 of file runregparse.py.

runregparse.EXCEPTION = False

Definition at line 21 of file runregparse.py.

int runregparse.EXRUN = -1

Definition at line 22 of file runregparse.py.

string runregparse.FULLADDRESS = ADDRESS+"/xmlrpc"

Definition at line 201 of file runregparse.py.

tuple runregparse.GROUP = CONFIG.get('Common','Group')

Definition at line 141 of file runregparse.py.

tuple runregparse.hlt = line.split(',')

Definition at line 255 of file runregparse.py.

Referenced by StudyHLT.analyze(), IsoTrig.analyze(), CSCValidation.analyze(), and LumiCalculator.beginRun().

tuple runregparse.HLTNAMEFILTER = CONFIG.get('Common','HLTnameFilter')

Definition at line 142 of file runregparse.py.

tuple runregparse.JSONFILE = CONFIG.get('Common','JSONFILE')

Definition at line 179 of file runregparse.py.

tuple runregparse.jsonlist = json.loads(dcs_data)

Definition at line 263 of file runregparse.py.

list runregparse.LISTOFRUN = []

Definition at line 249 of file runregparse.py.

tuple runregparse.ls_temp_data = server.DataExporter.export('RUN', 'GLOBAL', 'csv_datasets', sel_dstable)

Definition at line 232 of file runregparse.py.

runregparse.LSCOMMENT = True

Definition at line 154 of file runregparse.py.

tuple runregparse.LSPARSE = CONFIG.get('Common','LSCOMMENT')

Definition at line 148 of file runregparse.py.

tuple runregparse.lumiSummary = open(JSONFILE, 'w')

Definition at line 290 of file runregparse.py.

Referenced by EventHeader.analyze(), BPhysicsOniaDQM.endLuminosityBlock(), and LumiCalculator.endLuminosityBlock().

tuple runregparse.manualbad_int = searchrun(element)

Definition at line 271 of file runregparse.py.

tuple runregparse.OUTPUTFILENAME = CONFIG.get('Common',"OutputFileName")

Definition at line 152 of file runregparse.py.

runregparse.prevblock = [-2,-2]

Definition at line 306 of file runregparse.py.

list runregparse.QF_ALL_STAT = ["GOOD","BAD","EXCL","NONE"]

Definition at line 131 of file runregparse.py.

list runregparse.QF_ALL_SYS = ["Hcal","Track","Strip","Egam","Es","Dt","Csc","Pix","Muon","Rpc","Castor","Jmet","Ecal","L1t","Hlt","NONE"]

Definition at line 130 of file runregparse.py.

tuple runregparse.QFLAGS = CONFIG.get('Common','QFLAGS')

Definition at line 146 of file runregparse.py.

tuple runregparse.QFlist = string.split(QFLAGS,',')

Definition at line 163 of file runregparse.py.

list runregparse.ranges = []

Definition at line 300 of file runregparse.py.

tuple runregparse.run = line.split(',')

Definition at line 253 of file runregparse.py.

tuple runregparse.run_data = server.DataExporter.export('RUN', 'GLOBAL', 'csv_runs', sel_runtable)

Definition at line 231 of file runregparse.py.

tuple runregparse.RUNMAX = CONFIG.get('Common','Runmax')

Definition at line 145 of file runregparse.py.

tuple runregparse.RUNMIN = CONFIG.get('Common','Runmin')

Definition at line 144 of file runregparse.py.

tuple runregparse.runs_to_print = selected_dcs.keys()

Definition at line 301 of file runregparse.py.

string runregparse.sel_dcstable = "{groupName} ='"

Definition at line 218 of file runregparse.py.

string runregparse.sel_dstable = "{groupName} ='"

Definition at line 209 of file runregparse.py.

string runregparse.sel_runtable = "{groupName} ='"

Definition at line 206 of file runregparse.py.

dictionary runregparse.selected_dcs = {}

Definition at line 262 of file runregparse.py.

tuple runregparse.selectedRuns = open(OUTPUTFILENAME, 'w')

Definition at line 250 of file runregparse.py.

string runregparse.selectlumi = "process.source.lumisToProcess = cms.untracked.VLuminosityBlockRange(\n"

Definition at line 299 of file runregparse.py.

tuple runregparse.server = xmlrpclib.ServerProxy(FULLADDRESS)

Definition at line 203 of file runregparse.py.

tuple runregparse.syst = string.split(QF,":")

Definition at line 165 of file runregparse.py.

int runregparse.Tries = 0

Definition at line 225 of file runregparse.py.

tuple runregparse.value = string.split(QF,":")

Definition at line 166 of file runregparse.py.