This module defines an schema of object which describe the
wire-related geometry for the Wire Cell Toolkit.
It covers a hierarchy of object types:
- Detector
- Anode (eg, one APA)
- Face
- Plane
- Wire
- Point
Except for Point, all objects are organizational and describe
parentage. Points are used to describe the end points of wire
segments (wires) and are MUST be expressed in GLOBAL coordinates.
In the following cases the children are referenced by their parent in
a strictly ordered list:
- A face orders its child planes following how charge drifts.
That is, in U/V/W order.
- A plane orders its child wires in increasing pitch direction
such that the cross product of the wire direction (see next) and
this pitch direction gives a direction which is normal to the
wire plane and anti-parallel to the nominal drift direction for
that plane.
- Wire places its head end-point closer to the input of the
detector electronics. The wire direction is taken from tail to
head end-points. For top DUNE APAs and all other current
detectors this direction points generally upward and for bottom
DUNE APAs it points generally downward.
Ordering of all other lists is not defined.
Most objects in the schema have an "ident" attribute. This number is
made available to user C++ code but is treated as OPAQUE but UNIQUE by
the toolkit. If an object is referenced in multiple contexts their
ident MUST match. For example, a wire plane and a field reponse plane
must be correlated by their ident.
Schema objects are held in flat, per type store and a reference to an
object of a particular type is made via its index into the store for
that type.
All values MUST be in the WCT system of units. Code that generates
these objects may use the Python module wirecell.units to assure this.
Although not specified here, there are places where "front" and "back"
qualifiers are applied to "face". A "front" face is one for which the
cross product of wire and pitch directions (as described above) is
parallel to the global X-axis.
def wirecell.util.wires.schema.maker |
( |
| ) |
|
Return a schema instance maker.
>>> m = maker()
>>> hid = m.make('Point', x=..., y=..., z=...)
>>> tid = m.make('Point', x=..., y=..., z=...)
>>> wid = m.make('Wire', ident=0, channel=0, segment=0 tail=tid, head=hid)
>>> wire = m.get('Wire', wid)
>>> store = m.schema()
Definition at line 179 of file schema.py.
181 Return a schema instance maker. 184 >>> hid = m.make('Point', x=..., y=..., z=...) 185 >>> tid = m.make('Point', x=..., y=..., z=...) 186 >>> wid = m.make('Wire', ident=0, channel=0, segment=0 tail=tid, head=hid) 188 >>> wire = m.get('Wire', wid) 190 >>> store = m.schema() 193 class SchemaMaker(object):
196 self._makers = dict()
198 lname = klass.__name__.lower()
199 self.__dict__[lname+
's'] = list()
200 self._makers[lname] = klass
202 def make(self, what, *args):
203 klass = self._makers[what]
204 collection = self.__dict__[what+
's']
205 nthings = len(collection)
207 collection.append(thing)
210 def get(self, what, ind):
211 collection = self.__dict__[what+
's']
212 return collection[ind]
214 def wire_ypos(self, ind):
215 wire = self.get(
"wire", ind)
216 p1 = self.get(
"point", wire.tail)
217 p2 = self.get(
"point", wire.head)
218 return 0.5*(p1.y + p2.y)
219 def wire_zpos(self, ind):
220 wire = self.get(
"wire", ind)
221 p1 = self.get(
"point", wire.tail)
222 p2 = self.get(
"point", wire.head)
223 return 0.5*(p1.z + p2.z)
226 'Return self as a schema.Store' 227 return Store(self.anodes, self.faces, self.planes, self.wires, self.points)
auto const & get(AssnsNode< L, R, D > const &r)