CMS 3D CMS Logo

Functions | Variables
hcal_runs Namespace Reference

Functions

def get_all (q, qs)
 
def get_single (q, qs)
 
def main (rf, rt)
 
def qstring (qstring)
 
def query (query)
 

Variables

 rf
 
 rt
 
 SQL
 
 TIME
 
 URL
 

Function Documentation

◆ get_all()

def hcal_runs.get_all (   q,
  qs 
)

Definition at line 39 of file hcal_runs.py.

References DeadROC_duringRun.dir, createfilelist.int, and qstring().

Referenced by main().

39 def get_all(q, qs):
40  qid = query(q)
41  ps = qstring(qs)
42  u = "%s/query/%s/count?%s" % (URL, qid, ps)
43  resp = urllib2.urlopen(u)
44  if "getcode" in dir(resp) and resp.getcode() == 200:
45  data = []
46  c = int(resp.read())
47  p = 1
48  while c > 0:
49  u = "%s/query/%s/page/1000/%d/data?%s" % (URL, qid, p, ps)
50  resp = urllib2.urlopen(u)
51  if "getcode" in dir(resp) and resp.getcode() == 200:
52  j = json.loads(resp.read())
53  data.extend(j["data"])
54  p += 1
55  c -= 1000
56  return data
57  return None
58 
def qstring(qstring)
Definition: hcal_runs.py:26
Definition: query.py:1
def get_all(q, qs)
Definition: hcal_runs.py:39

◆ get_single()

def hcal_runs.get_single (   q,
  qs 
)

Definition at line 33 of file hcal_runs.py.

References DeadROC_duringRun.dir, and qstring().

Referenced by main().

33 def get_single(q, qs):
34  resp = urllib2.urlopen("%s/query/%s/data?%s" % (URL, query(q), qstring(qs)))
35  if "getcode" in dir(resp) and resp.getcode() == 200:
36  return json.loads(resp.read())["data"][0][0]
37  return None
38 
def qstring(qstring)
Definition: hcal_runs.py:26
Definition: query.py:1
def get_single(q, qs)
Definition: hcal_runs.py:33

◆ main()

def hcal_runs.main (   rf,
  rt 
)

Definition at line 59 of file hcal_runs.py.

References get_all(), get_single(), and createfilelist.int.

59 def main(rf, rt):
60  ps = {}
61  if rf != None: ps["rf"] = rf
62  if rt != None: ps["rt"] = rt
63  data = get_all(SQL, ps)
64  for r in data:
65  if r[3] != None:
66  for t in ["pedestal","LED","laser"]:
67  if re.search(t, r[3], flags=re.IGNORECASE) != None:
68  d = get_single(TIME, { "p.run": int(r[0])})
69  print r[0], t, "\"" + d + "\"", r[2]
70  break
71 
72 
def get_all(q, qs)
Definition: hcal_runs.py:39
def get_single(q, qs)
Definition: hcal_runs.py:33
def main(rf, rt)
Definition: hcal_runs.py:59

◆ qstring()

def hcal_runs.qstring (   qstring)

Definition at line 26 of file hcal_runs.py.

Referenced by get_all(), and get_single().

26 def qstring(qstring):
27  ps = ""
28  for k in qstring.keys():
29  ps += "&" if ps != "" else ""
30  ps += "%s=%s" % (k, qstring[k])
31  return ps
32 
def qstring(qstring)
Definition: hcal_runs.py:26

◆ query()

def hcal_runs.query (   query)

Definition at line 21 of file hcal_runs.py.

References DeadROC_duringRun.dir.

21 def query(query):
22  resp = urllib2.urlopen(URL + "/query", query)
23  if "getcode" in dir(resp) and resp.getcode() == 200:
24  return resp.read()
25 
def query(query)
Definition: hcal_runs.py:21

Variable Documentation

◆ rf

hcal_runs.rf

◆ rt

hcal_runs.rt

◆ SQL

hcal_runs.SQL

Definition at line 5 of file hcal_runs.py.

◆ TIME

hcal_runs.TIME

Definition at line 19 of file hcal_runs.py.

Referenced by GlobalDigisHistogrammer.analyze().

◆ URL

hcal_runs.URL