common.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 '''
3 Objects for describing wires
4 '''
5 
6 from ..geo.shapes import Ray, Point3D
7 
8 from collections import namedtuple
9 
10 # The general wire object. beg/end are tail/head of a vector pointing in
11 # direction signal travels to electronics. They must be in Wire Cell Toolkit
12 # system of units (aka mm). See wirecell.units.
13 Wire = namedtuple("Wire","plane ch wip seg beg end")
14 
15 def bounding_box(wires):
16  '''
17  Return a bounding box exactly containing the given collection of
18  Wire objects.
19  '''
20  mins = list()
21  maxs = list()
22 
23  for axis in range(3):
24  pts = list()
25  pts += [w.beg[axis] for w in wires]
26  pts += [w.end[axis] for w in wires]
27  mins.append(min(pts))
28  maxs.append(max(pts))
29  return Ray(Point3D(*mins), Point3D(*maxs))
::fhicl::TupleAs< Point(::geo::Length_t,::geo::Length_t,::geo::Length_t)> Point3D
Atom object for reading a 3D point or vector (centimeters).
static int max(int a, int b)
def bounding_box(wires)
Definition: common.py:15
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55