3 Functions to process descriptions of wire regions 6 from wirecell
import units
7 from collections
import namedtuple, defaultdict
9 Point = namedtuple(
"Point",
"x y z")
10 Border = namedtuple(
"Border",
"plane wire ch tail head")
11 Region = namedtuple(
"Region",
"beg end")
12 WCLS = namedtuple(
"WCLS",
"wc ls")
17 Plane,Channel,Start X,Start Y,Start Z,End X,End Y,End Z, 20 nums = [
int(v)
for v
in vals[:2]]
21 coords = [round(1000*
float(v)*units.cm)/1000.0
for v
in vals[2:]]
23 return Border(nums[0], nums[1], nums[1],
28 # Channel,Plane,Wire,Start X,Start Y,Start Z,End X,End Y,End Z, 31 nums = [
int(v)
for v
in vals[:3]]
32 coords = [round(1000*
float(v)*units.cm)/1000.0
for v
in vals[3:]]
34 return Border(nums[1], nums[2], nums[0],
40 Load in the CSV file holding description of shorted wires in 41 microboone. Confirm data is consistent with given 42 wires.schema.Store object. 44 Example file is the CSV saved from MicroBooNE_ShortedWireList.xlsx. 46 Return data structure describing the shorted wires. 60 ret = defaultdict(list)
68 vals = line.split(
',')
72 maybe = vals[0].lower();
73 if "shorted region" in maybe:
74 letter = maybe[maybe.find(
"shorted region")-2]
76 shorted_plane =
"uvy".
index(letter)
79 if vals[0].lower() ==
"plane":
89 chw1 = [w.ident
for w
in store.wires
if w.channel == ch1]
90 chw2 = [w.ident
for w
in store.wires
if w.channel == ch2]
91 assert w1
in chw1,
"w1 %s %s"%(w1,chw1)
92 assert w2
in chw2,
"w2 %s %s"%(w2,chw2)
93 one = dict(plane=plane,ch1=ch1,wire1=w1,ch2=ch2,wire2=w2)
94 if plane == shorted_plane:
95 print "[ {plane:%d, min:%d, max:%d} ]," % (plane,w1,w2)
96 last_triple.append(one)
100 ret[shorted_plane].append(last_triple)
int open(const char *, int)
Opens a file descriptor.
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
def uboone_shorted(store, filename)