ATLAS Offline Software
Functions | Variables
dq_defect_translate_defects Namespace Reference

Functions

def copyfunc (indb, outdb, func_iov, func_output, runends)
 
def truncate_iovs_to_runs (iovs, runends)
 
def get_runends ()
 
def dq_code_filter (foldername, tag, channel, codes)
 
def defect_output (channel)
 
def atlas_notready_filter (indb)
 

Variables

list TRIPLES
 
def runends = get_runends()
 
 outdb = DefectsDB('defectstest.db/COMP200', read_only=False)
 

Function Documentation

◆ atlas_notready_filter()

def dq_defect_translate_defects.atlas_notready_filter (   indb)

Definition at line 57 of file dq_defect_translate_defects.py.

57 def atlas_notready_filter(indb):
58  from DQUtils.db import fetch_iovs
59  folder = indb.getFolder('/TDAQ/RunCtrl/DataTakingMode')
60  iovs = fetch_iovs(folder, channels=[0])
61 
62  return filter(None, [iov for iov in iovs if iov.ReadyForPhysics == 0])
63 

◆ copyfunc()

def dq_defect_translate_defects.copyfunc (   indb,
  outdb,
  func_iov,
  func_output,
  runends 
)
indb = input database
outdb = output database
func_iov = function that takes a DB connection and returns some IOVs
           (includes folder/channel selection and any filtering)
func_output = takes IOVs and writes them to the output DB connection

Definition at line 3 of file dq_defect_translate_defects.py.

3 def copyfunc(indb, outdb, func_iov, func_output, runends):
4  '''
5  indb = input database
6  outdb = output database
7  func_iov = function that takes a DB connection and returns some IOVs
8  (includes folder/channel selection and any filtering)
9  func_output = takes IOVs and writes them to the output DB connection
10  '''
11  iovs = func_iov(indb)
12  iovs = truncate_iovs_to_runs(iovs, runends)
13  iovs = filter(lambda x: not(x.until.lumi-x.since.lumi == 0), iovs)
14  print('There are %d IOVs to process' % len(iovs))
15 
17  for i, iov in enumerate(iovs):
18  func_output(outdb, iov)
19  if i % 100 == 1:
20  print('IOV', i)
21 

◆ defect_output()

def dq_defect_translate_defects.defect_output (   channel)

Definition at line 49 of file dq_defect_translate_defects.py.

49 def defect_output(channel):
50  def defect_output_internals(outdb, iov):
51  db = outdb
52  db.insert(channel, iov.since, iov.until,
53  (iov.Comment if 'Comment' in dir(iov) else 'Automatic'),
54  'sys:copy')
55  return defect_output_internals
56 

◆ dq_code_filter()

def dq_defect_translate_defects.dq_code_filter (   foldername,
  tag,
  channel,
  codes 
)

Definition at line 40 of file dq_defect_translate_defects.py.

40 def dq_code_filter(foldername, tag, channel, codes):
41  from DQUtils.db import fetch_iovs
42  def dq_code_filter_internals(indb):
43  folder = indb.getFolder(foldername)
44  iovs = fetch_iovs(folder, channels=[channel], tag=tag)
45  iovs = [iov for iov in iovs if iov.Code in codes]
46  return iovs
47  return dq_code_filter_internals
48 

◆ get_runends()

def dq_defect_translate_defects.get_runends ( )

Definition at line 31 of file dq_defect_translate_defects.py.

31 def get_runends():
32  from DQUtils.db import fetch_iovs
33  eor_params = fetch_iovs('EOR_Params',
34  with_channel=False, what=[])
35  runends = {}
36  for iov in eor_params:
37  runends[iov.since.run] = iov
38  return runends
39 

◆ truncate_iovs_to_runs()

def dq_defect_translate_defects.truncate_iovs_to_runs (   iovs,
  runends 
)

Definition at line 22 of file dq_defect_translate_defects.py.

22 def truncate_iovs_to_runs(iovs, runends):
23  for iov in iovs:
24  if iov.since.run not in runends:
25  print('Missing run', iov.since.run, 'from EOR_Params')
26 
27  return filter(None,
28  [iov.intersect(runends[iov.since.run])
29  for iov in iovs if iov.since.run in runends])
30 

Variable Documentation

◆ outdb

dq_defect_translate_defects.outdb = DefectsDB('defectstest.db/COMP200', read_only=False)

Definition at line 157 of file dq_defect_translate_defects.py.

◆ runends

def dq_defect_translate_defects.runends = get_runends()

Definition at line 156 of file dq_defect_translate_defects.py.

◆ TRIPLES

list dq_defect_translate_defects.TRIPLES

Definition at line 68 of file dq_defect_translate_defects.py.

dq_defect_translate_defects.dq_code_filter
def dq_code_filter(foldername, tag, channel, codes)
Definition: dq_defect_translate_defects.py:40
dq_defect_translate_defects.get_runends
def get_runends()
Definition: dq_defect_translate_defects.py:31
dq_defect_translate_defects.copyfunc
def copyfunc(indb, outdb, func_iov, func_output, runends)
Definition: dq_defect_translate_defects.py:3
python.db.fetch_iovs
def fetch_iovs(folder_name, since=None, until=None, channels=None, tag="", what="all", max_records=-1, with_channel=True, loud=False, database=None, convert_time=False, named_channels=False, selection=None, runs=None, with_time=False, unicode_strings=False)
Definition: DQUtils/python/db.py:67
covarianceTool.filter
filter
Definition: covarianceTool.py:514
dq_defect_translate_defects.defect_output
def defect_output(channel)
Definition: dq_defect_translate_defects.py:49
beamspotman.dir
string dir
Definition: beamspotman.py:623
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
dq_defect_translate_defects.atlas_notready_filter
def atlas_notready_filter(indb)
Definition: dq_defect_translate_defects.py:57
dq_defect_translate_defects.truncate_iovs_to_runs
def truncate_iovs_to_runs(iovs, runends)
Definition: dq_defect_translate_defects.py:22