ATLAS Offline Software
Loading...
Searching...
No Matches
test_dcsc Namespace Reference

Functions

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

Variables

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

Function Documentation

◆ compare_iovs()

test_dcsc.compare_iovs ( a,
b )

Definition at line 40 of file test_dcsc.py.

40def 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
54 print_diff_lumi(i)
55 print
56
STL class.

◆ main()

test_dcsc.main ( )

Definition at line 57 of file test_dcsc.py.

57def 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
@ MDT
Definition RegSelEnums.h:31
int main()
Definition hello.cxx:18

◆ print_diff_lumi()

test_dcsc.print_diff_lumi ( diff)

Definition at line 20 of file test_dcsc.py.

20def 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()

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

Definition at line 14 of file test_dcsc.py.

14def 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.