Public Member Functions | Public Attributes | Private Attributes | List of all members
wirecell.sigproc.response.PlaneImpactBlocks Class Reference
Inheritance diagram for wirecell.sigproc.response.PlaneImpactBlocks:

Public Member Functions

def __init__ (self, rflist, xstart=0.0 *units.cm)
 
def region_block (self, plane, impact)
 
def response (self, plane, impact, region)
 

Public Attributes

 ntbins
 
 tmin
 
 tbin
 
 trange
 
 tmax
 
 xstart
 
 plane_keys
 
 region_keys
 
 impact_keys
 

Private Attributes

 _tree
 
 _by_plane_impact
 

Detailed Description

Organize responses into per (plane,impact) and make available as
array blocks of shape (Nregion,Ntbins).

There are two symmetries for response Resp(w,r,i) on wire w for
path near wire region r on impact i.

    - Due to reciprocity: Resp(w=0,r=N,i) = R(w=N,r=0,i)

    - Due to geometry: R(w=0,r=N,i=M) = R(w=0,r=-N,i=-M)

See the functions `plots.plane_impact_blocks_full()` and
`plots.plane_impact_blocks()` for visualizing this data.  In
particular check for continuous patterns of responses across
different impact positions in the first and check that U-plane,
high-positive impact position puts most response on wires 0 and 1
and high-negative impact positions puts most response on wires 0
and -1.

Definition at line 372 of file __init__.py.

Constructor & Destructor Documentation

def wirecell.sigproc.response.PlaneImpactBlocks.__init__ (   self,
  rflist,
  xstart = 0.0*units.cm 
)

Definition at line 392 of file __init__.py.

392  def __init__(self, rflist, xstart = 0.0*units.cm):
393 
394  onerf = rflist[0]
395  self.ntbins = len(onerf.response)
396  self.tmin = onerf.times[0]
397  self.tbin = onerf.times[1]-onerf.times[0]
398  self.trange = self.tbin*self.ntbins
399  self.tmax = self.trange + self.tmin
400 
401  self.xstart = xstart # x position at start of field response drift
402 
403 
404  self.plane_keys = sorted(set([rf.plane for rf in rflist]))
405  self.region_keys = sorted(set([rf.region for rf in rflist]))
406  self.impact_keys = sorted(set([rf.impact for rf in rflist] + [-rf.impact for rf in rflist]))
407 
408  # Organize flat rflist into tree [plane][impact][region]
409  tree = dict()
410  byplane = group_by(rflist, 'plane') # uvw
411  for inplane in byplane:
412  plane_letter = inplane[0].plane
413  tree[plane_letter] = tree_plane = dict()
414  byimpact = group_by(inplane, 'impact')
415  for inimpact in byimpact:
416  # WARNING: Garfield seems to measure either wire
417  # region number xor impact position in a different
418  # direction than is assumed here. Garfield impact
419  # positions are always positive.
420  impact = -1*inimpact[0].impact
421  assert impact <= 0.0
422 
423  tree_plane[-impact] = tree_impact_pos = dict()
424  tree_plane[impact] = tree_impact_neg = dict()
425 
426  byregion = group_by(inimpact, 'region')
427  for inregion in byregion:
428  assert len(inregion) == 1
429  rf = inregion[0]
430  region = rf.region
431  tree_impact_pos[region] = rf
432  tree_impact_neg[-region] = rf
433  self._tree = tree
434  self._by_plane_impact = dict()
435 
def group_by(rflist, field)
Definition: __init__.py:162
def __init__(self, rflist, xstart=0.0 *units.cm)
Definition: __init__.py:392

Member Function Documentation

def wirecell.sigproc.response.PlaneImpactBlocks.region_block (   self,
  plane,
  impact 
)
Return an array shaped (Nregions, Ntbins) for the given plane
and impact.  Row=0 corresponds to the highest region (wire 10).

Definition at line 436 of file __init__.py.

436  def region_block(self, plane, impact):
437  '''
438  Return an array shaped (Nregions, Ntbins) for the given plane
439  and impact. Row=0 corresponds to the highest region (wire 10).
440  '''
441  key = (plane,impact) # cache the built array
442  try:
443  return self._by_plane_impact[key]
444  except KeyError:
445  pass
446  ppi = self._tree[plane][impact]
447  rfs = [ppi[r] for r in self.region_keys]
448  mat = numpy.zeros((len(self.region_keys), len(rfs[0].response)))
449  for row,rf in enumerate(rfs):
450  mat[row] = rf.response
451  self._by_plane_impact[key] = mat
452  return mat
453 
def region_block(self, plane, impact)
Definition: __init__.py:436
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Definition: enumerate.h:69
def wirecell.sigproc.response.PlaneImpactBlocks.response (   self,
  plane,
  impact,
  region 
)

Definition at line 454 of file __init__.py.

454  def response(self, plane, impact, region):
455  return self._tree[plane][impact][region].response
456 
def response(self, plane, impact, region)
Definition: __init__.py:454

Member Data Documentation

wirecell.sigproc.response.PlaneImpactBlocks._by_plane_impact
private

Definition at line 434 of file __init__.py.

wirecell.sigproc.response.PlaneImpactBlocks._tree
private

Definition at line 433 of file __init__.py.

wirecell.sigproc.response.PlaneImpactBlocks.impact_keys

Definition at line 406 of file __init__.py.

wirecell.sigproc.response.PlaneImpactBlocks.ntbins

Definition at line 395 of file __init__.py.

wirecell.sigproc.response.PlaneImpactBlocks.plane_keys

Definition at line 404 of file __init__.py.

wirecell.sigproc.response.PlaneImpactBlocks.region_keys

Definition at line 405 of file __init__.py.

wirecell.sigproc.response.PlaneImpactBlocks.tbin

Definition at line 397 of file __init__.py.

wirecell.sigproc.response.PlaneImpactBlocks.tmax

Definition at line 399 of file __init__.py.

wirecell.sigproc.response.PlaneImpactBlocks.tmin

Definition at line 396 of file __init__.py.

wirecell.sigproc.response.PlaneImpactBlocks.trange

Definition at line 398 of file __init__.py.

wirecell.sigproc.response.PlaneImpactBlocks.xstart

Definition at line 401 of file __init__.py.


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