schema.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 '''
3 This module defines an object schema which strives to be generic
4 enough to describe various sets of field responses including:
5 
6  - 0D :: responses which do not extend to inter-pitch regions and
7  have no intra-pitch variation. Responses come from averaged 2D
8  field calculations, eg with Garfield. This is the type
9  originally used for LArSoft simulation and deconvoultion for
10  some time.
11 
12  - 1D :: responses defined on drift paths starting from
13  fine-grained points on a line perpendicular to drift and wire
14  directions and which spans multiple wire regions. Responses
15  come from 2D field calculations, eg with Garfield. This is the
16  type used in the Wire Cell simulation as developed by Xiaoyue Li
17  and Wire Cell deconvolution as developed by Xin Qian.
18 
19  - 2D :: responses defined on drift paths starting from
20  fine-grained points on a plane perpendicular to nominal drift
21  direction and spanning multiple wire regions. Responses come
22  from 3D field calculations, eg with LARF. Simulation and
23  deconvolution using these type of responses are not yet
24  developed.
25 
26 The schema is defined through a number of `namedtuple` collections.
27 
28 Units Notice: any attributes of these classes which are quantities
29 with units must be in Wire Cell system of units.
30 
31 Coordinate System Notice: X-axis is along the direction counter to the
32 nominal electron drift, Y-axis is upward, against gravity, Z-axis
33 follows from the right-handed cross product of X and Y. The X-origin
34 is arbitrary. In Wire Cell it will be taken from the "location" of
35 the last (collection) plane. A global, transverse origin is not
36 specified but each path response is at a transverse location given in
37 terms of wire and pitch distances (positions). In Wire Cell an origin
38 is set from which these are to be measured.
39 '''
40 
41 from collections import namedtuple
42 
43 class FieldResponse(namedtuple("FieldResponse","planes axis origin tstart period speed")):
44  '''
45  :param list planes: List of PlaneResponse objects.
46  :param list axis: A normalized 3-vector giving direction of axis
47  (anti)parallel to nominal drift direction.
48  :param float origin: location along the X-axis where drift paths
49  begin (see PlaneResponse.location).
50  :param float tstart: the time at which drift paths are considered
51  to begin.
52  :param float period: the sampling period of the field response.
53  :param float speed: the nominal drift speed used in the
54  calculation.
55  '''
56  __slots__ = ()
57 
58 
59 
60 
61 class PlaneResponse(namedtuple("PlaneResponse","paths planeid location pitch")):
62  '''
63  :param list paths: List of PathResponse objects.
64  :param int planeid: A numerical identifier for the plane,
65  typically [0,1,2].
66  :param float location: Location in drift direction of this plane
67  (see FieldResponse.origin).
68  :param float pitch: The uniform wire pitch used for the path
69  responses of this plane.
70  '''
71  __slots__ = ()
72 
73 
74 class PathResponse(namedtuple("PathResponse", "current pitchpos wirepos")):
75  '''
76  :param array current: A numpy array holding the induced current
77  for the path on the wire-of-interest.
78  :param float pitchpos: The position in the pitch direction to the
79  starting point of the path.
80  :param float wirepos: The position along the wire direction to the
81  starting point of the path.
82 
83  Note: the path is in wire region:
84 
85  region = int(round(pitchpos/pitch)).
86 
87  Note: the path is at the impact position relative to closest
88  wire:
89 
90  impact = pitchpos-region*pitch.
91  '''
92  __slots__ = ()
93 
94