Public Member Functions | Public Attributes | List of all members
wirecell.util.wires.apa.Description Class Reference
Inheritance diagram for wirecell.util.wires.apa.Description:

Public Member Functions

def __init__ (self, params=default_params)
 
def wire_index_by_wip (self, face, plane, wip)
 
def iconductor_by_face_plane_spot (self, face, plane_in_face, spot_in_plane)
 
def iconductor_chip_chan (self, face, board_in_face, layer_in_face, wire_spot_in_layer)
 
def iface_board (self, iboard)
 
def iplane (self, iface, plane_in_face)
 

Public Attributes

 p
 
 nfaces
 
 nplanes
 
 nwibs
 
 nboards
 
 nchips
 
 nchannels
 
 nconductors
 
 iboard_by_face_board
 
 iboard_by_conn_slot
 
 ichip_by_face_board_chip
 
 iconductor_by_face_board_chip_chan
 
 ccls
 
 nch_in_board_by_layer
 
 points
 
 wires_by_face_plane
 wires ### More...
 
 nwires_by_plane
 
 nwires_per_face
 
 nwires
 
 npoints
 

Detailed Description

Provide data methods to describe an APA and enumerate its connectivity.

Definition at line 120 of file apa.py.

Constructor & Destructor Documentation

def wirecell.util.wires.apa.Description.__init__ (   self,
  params = default_params 
)

Definition at line 124 of file apa.py.

124  def __init__(self, params = default_params):
125  self.p = params
126 
127  # Total numbers of things in one APA.
128  # Some of this is just a copy in order to present a flat namespace
129  self.nfaces = self.p.nfaces
130  self.nplanes = self.nfaces * self.p.face.nlayers
131  self.nwibs = self.p.daq.nwibs
132  self.nboards = self.p.face.nboards*self.nfaces
133  self.nchips = self.nboards * self.p.board.nchips
134  self.nchannels = self.nchips*self.p.board.nchanperchip
135  self.nconductors = self.nchannels
136  #self.nwires, see below
137 
138  # List of indicies to boards in two ways: [face,board] and WIB
139  # [conn,slot]. A very smart layout convention adopted by the
140  # engineers let us do this so cleanly!
141  bi = numpy.array(range(self.nboards))
142  self.iboard_by_face_board = bi.reshape(self.p.nfaces, self.p.face.nboards)
143  self.iboard_by_conn_slot = bi.reshape(self.p.daq.nconnperwib, self.p.daq.nwibs)
144 
145  # List of indices to chips, accessed by [face,board_in_face,chip_on_board]
146  ci = numpy.array(range(self.nchips))
147  self.ichip_by_face_board_chip = ci.reshape(self.p.nfaces, self.p.face.nboards, self.p.board.nchips)
148 
149 
150  # List of indices to all conductors (or all channels) in an APA
151  # accessed by [face, board_in_face, chip_in_board, chan_in_chip]
152  # nominal: 2x10x8x16
153  ci = numpy.array(range(self.nchannels))
154  self.iconductor_by_face_board_chip_chan = ci.reshape(self.p.nfaces, self.p.face.nboards,
155  self.p.board.nchips, self.p.board.nchanperchip)
156 
157  # Flattened (layer-conductor)->(chip,channel) dictionary
159  counter = Counter()
160  for k,v in self.ccls:
161  counter[k[0]] += 1
162  # nominal: (40,40,48)
163  self.nch_in_board_by_layer = tuple([kv[1] for kv in sorted(counter.items())])
164 
165 
166  self.points = list()
167 
168  ### wires ###
169  #
170  # Caution: wires are a bit tricky. While each wire is
171  # physically unique, each also shares a conceptual twin on the
172  # other side of the APA, given rotational symmetry about the Y
173  # axis. These twins share the same points but these points
174  # are expressed in two different coordinate systems, one for
175  # each face! When drawing a 2D representation of wires using
176  # these points a rotation must be taken into account.
177  self.wires_by_face_plane = [list(), list()]
178  for iplane, geom in enumerate(self.p.geom):
179  rect = generator.Rectangle(geom.width, geom.height)
180  # (ap, side, spot, seg, p1, p2)
181  raw_wires = generator.wrapped_from_top_oneside(geom.offset, geom.angle, geom.pitch, rect)
182  raw_wires.sort()
183  gwires_front = list()
184  gwires_back = list()
185  for wip, raw_wire in enumerate(raw_wires):
186  ap, side, spot, seg, zy1, zy2 = raw_wire
187  ip1 = len(self.points)
188  p1 = GeomPoint(geom.planex, zy1[1], zy1[0])
189  self.points.append(p1)
190  ip2 = len(self.points)
191  p2 = GeomPoint(geom.planex, zy2[1], zy2[0])
192  self.points.append(p2)
193  wf = GeomWire(ap, wip, spot, seg, ip1, ip2)
194  wb = GeomWire(ap, wip, spot, seg, ip1, ip2)
195  gwires_front.append(wf)
196  gwires_back.append(wb)
197  self.wires_by_face_plane[0].append(gwires_front)
198  self.wires_by_face_plane[1].append(gwires_back)
199 
200  self.nwires_by_plane = [len(l) for l in self.wires_by_face_plane[0]]
202  self.nwires = self.nfaces * self.nwires_per_face
203  self.npoints = len(self.points)
204 
int Counter[nCounterTag]
Definition: makeDST.cxx:47
def flatten_cclsm(mat=chip_channel_layer_spot_matrix)
Definition: apa.py:60
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Definition: enumerate.h:69
def __init__(self, params=default_params)
Definition: apa.py:124

Member Function Documentation

def wirecell.util.wires.apa.Description.iconductor_by_face_plane_spot (   self,
  face,
  plane_in_face,
  spot_in_plane 
)
Return the global conductor index based on the face, plane and spot.

Definition at line 213 of file apa.py.

213  def iconductor_by_face_plane_spot(self, face, plane_in_face, spot_in_plane):
214  '''
215  Return the global conductor index based on the face, plane and spot.
216  '''
217  nch = self.nch_in_board_by_layer[plane_in_face] # 40,40,48
218  board_in_face = spot_in_plane//nch
219  spot_in_layer = spot_in_plane%nch
220  return self.iconductor_chip_chan(face, board_in_face, plane_in_face, spot_in_layer)[0]
221 
222 
def iconductor_by_face_plane_spot(self, face, plane_in_face, spot_in_plane)
Definition: apa.py:213
def iconductor_chip_chan(self, face, board_in_face, layer_in_face, wire_spot_in_layer)
Definition: apa.py:223
def wirecell.util.wires.apa.Description.iconductor_chip_chan (   self,
  face,
  board_in_face,
  layer_in_face,
  wire_spot_in_layer 
)
Given the paramers return information about the associated
conductor as a triple:

    - iconductor :: the apa-global index for the conductor

    - chip :: the board-local index for the chip

    - chan :: the chip-local index for the channel

Definition at line 223 of file apa.py.

223  def iconductor_chip_chan(self, face, board_in_face, layer_in_face, wire_spot_in_layer):
224  '''
225  Given the paramers return information about the associated
226  conductor as a triple:
227 
228  - iconductor :: the apa-global index for the conductor
229 
230  - chip :: the board-local index for the chip
231 
232  - chan :: the chip-local index for the channel
233  '''
234  # must +1 the spot to match the matrix assumption
235  nchip,nch = self.ccls[("uvw"[layer_in_face], wire_spot_in_layer+1)]
236  # must -1 the returns to match our assumption
237  ichip,ich = nchip-1, nch-1
238  icond = self.iconductor_by_face_board_chip_chan[face, board_in_face, ichip, ich]
239  return (icond, ichip, ich)
240 
def iconductor_chip_chan(self, face, board_in_face, layer_in_face, wire_spot_in_layer)
Definition: apa.py:223
def wirecell.util.wires.apa.Description.iface_board (   self,
  iboard 
)
Given a global board index, return tuple of:

- iface :: the apa-global face index
- board : the face-local board index

Definition at line 241 of file apa.py.

241  def iface_board(self, iboard):
242  '''
243  Given a global board index, return tuple of:
244 
245  - iface :: the apa-global face index
246  - board : the face-local board index
247  '''
248  if not iboard in range(self.nboards):
249  raise ValueError("iboard is out of range: %d" % iboard)
250  iface = iboard//self.p.face.nboards
251  board = iboard%self.p.face.nboards
252  return (iface,board)
253 
def iface_board(self, iboard)
Definition: apa.py:241
def wirecell.util.wires.apa.Description.iplane (   self,
  iface,
  plane_in_face 
)

Definition at line 254 of file apa.py.

254  def iplane(self, iface, plane_in_face):
255  'Return global plane index given global face and plane in face'
256  # trivial...
257  return iface*self.p.face.nlayers + plane_in_face
258 
259 
260 
def iplane(self, iface, plane_in_face)
Definition: apa.py:254
def wirecell.util.wires.apa.Description.wire_index_by_wip (   self,
  face,
  plane,
  wip 
)
Return a tuple of a global wire index and the gwire

Definition at line 205 of file apa.py.

205  def wire_index_by_wip(self, face, plane, wip):
206  '''
207  Return a tuple of a global wire index and the gwire
208  '''
209  index = face*self.nwires_per_face + sum(self.nwires_by_plane[:plane]) + wip
210  wire = self.wires_by_face_plane[face][plane][wip]
211  return (index,wire)
212 
def wire_index_by_wip(self, face, plane, wip)
Definition: apa.py:205

Member Data Documentation

wirecell.util.wires.apa.Description.ccls

Definition at line 158 of file apa.py.

wirecell.util.wires.apa.Description.iboard_by_conn_slot

Definition at line 143 of file apa.py.

wirecell.util.wires.apa.Description.iboard_by_face_board

Definition at line 142 of file apa.py.

wirecell.util.wires.apa.Description.ichip_by_face_board_chip

Definition at line 147 of file apa.py.

wirecell.util.wires.apa.Description.iconductor_by_face_board_chip_chan

Definition at line 154 of file apa.py.

wirecell.util.wires.apa.Description.nboards

Definition at line 132 of file apa.py.

wirecell.util.wires.apa.Description.nch_in_board_by_layer

Definition at line 163 of file apa.py.

wirecell.util.wires.apa.Description.nchannels

Definition at line 134 of file apa.py.

wirecell.util.wires.apa.Description.nchips

Definition at line 133 of file apa.py.

wirecell.util.wires.apa.Description.nconductors

Definition at line 135 of file apa.py.

wirecell.util.wires.apa.Description.nfaces

Definition at line 129 of file apa.py.

wirecell.util.wires.apa.Description.nplanes

Definition at line 130 of file apa.py.

wirecell.util.wires.apa.Description.npoints

Definition at line 203 of file apa.py.

wirecell.util.wires.apa.Description.nwibs

Definition at line 131 of file apa.py.

wirecell.util.wires.apa.Description.nwires

Definition at line 202 of file apa.py.

wirecell.util.wires.apa.Description.nwires_by_plane

Definition at line 200 of file apa.py.

wirecell.util.wires.apa.Description.nwires_per_face

Definition at line 201 of file apa.py.

wirecell.util.wires.apa.Description.p

Definition at line 125 of file apa.py.

wirecell.util.wires.apa.Description.points

Definition at line 166 of file apa.py.

wirecell.util.wires.apa.Description.wires_by_face_plane

wires ###

Caution: wires are a bit tricky. While each wire is physically unique, each also shares a conceptual twin on the other side of the APA, given rotational symmetry about the Y axis. These twins share the same points but these points are expressed in two different coordinate systems, one for each face! When drawing a 2D representation of wires using these points a rotation must be taken into account.

Definition at line 177 of file apa.py.


The documentation for this class was generated from the following file: