ATLAS Offline Software
Functions | Variables
test_dcsc Namespace Reference

Functions

def sum_lbs (iovs)
 
def print_diff_lumi (diff)
 
def compare_iovs (a, b)
 
def main ()
 

Variables

 ipython_instance = IPShellEmbed(["-pdb"], rc_override=dict(quiet=True))
 

Function Documentation

◆ compare_iovs()

def test_dcsc.compare_iovs (   a,
  b 
)

Definition at line 40 of file test_dcsc.py.

40 def compare_iovs(a, b):
41 
42  a = a.by_channel
43  b = b.by_channel
44 
45  for output_channel in sorted(set(a.keys() + b.keys())):
46  A = a[output_channel]
47  B = b[output_channel]
48 
49  diff = emit_iov_differences(A, B)
50  print " [BAD] diff iovs =", len(diff), "lbs =", sum_lbs(zip(*diff)[0])
51  print " First ten diffs:"
52  for i in diff[:10]:
53  #print i
55  print
56 

◆ main()

def test_dcsc.main ( )

Definition at line 57 of file test_dcsc.py.

57 def main():
58  run = 144247 # Recent run where CSC gas state was bad.
59  run = 136379
60  run = 155112 # Recent long run (Sat May 15th, 11am -> Sun 16th 8am), 632 lbs
61  run = 156463
62  #run = 155669 # MDT NConfig goes below 600
63  from sys import argv
64  args = argv[1:]
65  if args:
66  run = int(args[0])
67  since, until = RunLumi(run, 0), RunLumi(run+1, 0)
68 
69  with timer("Read LBLB"):
70  lblb = fetch_iovs("LBLB", since, until, with_channel=False)
71  lbtime = inverse_lblb(lblb)
72 
73  #system = SCT() # Works, very slightly discrepant for the config.
74  #system = Pixels() # Works
75  #system = Tile() # Works
76  #system = TDQ() # Works, needs further testing
77  #system = RPC() # Works
78  #system = LAr() # Works, but produces slightly different result. Original gives:
79  # DCSOFL_VAL(since=(155112: 167), until=(155112: 176), channel=215, Code=2L)
80 
81  #system = TRT() # Unresolved discrepancies: Wrong NConfig, NWorking off by one in run 155112.
82 
83  system = MDT() # Seems to work
84  #system = Magnets() # Needs to be finished
85  #system = Lucid() # Needs to be written
86 
87  #print system.mapping.keys()
88 
89  with timer("Calculate result for %s" % system):
90  result = system.run(lbtime)
91 
92  print "Done."
93  print
94  #print result[0]
95 
96  print "Run range:", since, "to", until
97  print "DCSC2 intervals of validity:"
98  pprint_objects(result[:30])
99  print
100 
101  output_channels = system.mapping.keys()
102  iovs = fetch_iovs("DCSOFL", since, until, output_channels)
103 
104  #print hex(hash(tuple(iovs))), hex(hash(tuple(result)))
105 
106  print "Original DCSC intervals of validity:"
107  pprint_objects(iovs[:30])
108 
109  return
110 
111  compare_iovs(iovs, result)
112 
113  #for calc_iov, ref_iov in zip(result, iovs):
114  #print calc_iov.since, calc_iov.until, ref_iov.since, ref_iov.until
115  #pprint_objects(result)
116 

◆ print_diff_lumi()

def test_dcsc.print_diff_lumi (   diff)

Definition at line 20 of file test_dcsc.py.

20 def print_diff_lumi(diff):
21  before, after = diff
22  assert (before.since, before.until) == (after.since, after.until)
23  assert before._fields == after._fields
24 
25  if not hasattr(type(before), "_is_empty"): type(before)._is_empty = False
26  if not hasattr(type(after), "_is_empty"): type(after)._is_empty = False
27 
28  print " ", before.since, before.until,
29 
30  if before._is_empty:
31  print " Empty -> Filled"
32  elif after._is_empty:
33  print " Filled -> Empty"
34  else:
35  for field, val_before, val_after in zip(before._fields, before, after):
36  if val_before != val_after:
37  print field, val_before, "->", val_after,
38  print
39 

◆ sum_lbs()

def test_dcsc.sum_lbs (   iovs)
Sum the number of luminosity blocks spanned by a run

Definition at line 14 of file test_dcsc.py.

14 def sum_lbs(iovs):
15  """
16  Sum the number of luminosity blocks spanned by a run
17  """
18  return sum(iov.until - iov.since for iov in iovs)
19 

Variable Documentation

◆ ipython_instance

test_dcsc.ipython_instance = IPShellEmbed(["-pdb"], rc_override=dict(quiet=True))

Definition at line 120 of file test_dcsc.py.

DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename R::value_type > sorted(const R &r, PROJ proj={})
Helper function to create a sorted vector from an unsorted range.
python.iov_arrangement.inverse_lblb
def inverse_lblb(iovs)
Definition: iov_arrangement.py:34
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:65
test_dcsc.print_diff_lumi
def print_diff_lumi(diff)
Definition: test_dcsc.py:20
test_dcsc.sum_lbs
def sum_lbs(iovs)
Definition: test_dcsc.py:14
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
python.utils.AtlRunQueryTimer.timer
def timer(name, disabled=False)
Definition: AtlRunQueryTimer.py:85
test_dcsc.compare_iovs
def compare_iovs(a, b)
Definition: test_dcsc.py:40
python.sugar.runlumi.RunLumi
RunLumi
Definition: runlumi.py:130
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
python.utils.pprint_objects
def pprint_objects(objects, where=stdout)
Definition: DataQuality/DQUtils/python/utils.py:128
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
test_dcsc.main
def main()
Definition: test_dcsc.py:57