Public Member Functions | Private Attributes | List of all members
WireCell::Pimpos Class Reference

Pitch-Impact-Position. More...

#include <Pimpos.h>

Public Member Functions

 Pimpos (int nwires, double minwirepitch, double maxwirepitch, const Vector &wire=Vector(0, 1, 0), const Vector &pitch=Vector(0, 0, 1), const Point &origin=Point(0, 0, 0), int nimpact_bins_per_wire_region=10)
 
int nimpbins_per_wire () const
 Trivial accessor. More...
 
const Pointorigin () const
 Return given 3-point origin for plane pitch. More...
 
const Vectoraxis (int i) const
 
Vector relative (const Point &pt) const
 Return the vector from the origin to the given point. More...
 
double distance (const Point &pt, int axis=2) const
 
Point transform (const Point &pt) const
 
const Binningregion_binning () const
 
const Binningimpact_binning () const
 
std::pair< int, int > closest (double pitch) const
 
int wire_impact (int wireind) const
 Return the impact position index coincident with the wire index. More...
 
std::pair< int, int > wire_impacts (int wireind) const
 
int reflect (int wireind, int impind) const
 

Private Attributes

int m_nimpbins_per_wire
 
Point m_origin
 
Vector m_axis [3]
 
Binning m_regionbins
 
Binning m_impactbins
 

Detailed Description

Pitch-Impact-Position.

A Pimpos object encapsulates information and methods related to geometry and binning of a plane of parallel and equidistant wires and a further uniform sub division along their pitch directions.

A wire region or wire bin is the locus centered on a wire and which extends +/- 1/2 pitch from the wire position.

An impact region or impact bin is the smaller locus of pitch formed by uniformly splitting a wire region. It is bound by two (not centered on one) impact positions.

Impact positions are "in phase" with wires" such that there is one impact position coincident with a wire position.

For 3D "lab" to "plane" coordinate transformations there is a plane coordinate system which has these three orthogonal axes:

axis0) anti nominal drift direction (normal to the wire plane) and axis1) along the wire direction such that, axis2) the pitch direction is the cross product of axis0 X axis1.

Definition at line 36 of file Pimpos.h.

Constructor & Destructor Documentation

Pimpos::Pimpos ( int  nwires,
double  minwirepitch,
double  maxwirepitch,
const Vector wire = Vector(0,1,0),
const Vector pitch = Vector(0,0,1),
const Point origin = Point(0,0,0),
int  nimpact_bins_per_wire_region = 10 
)

Create a Pimpos object for a particular plane.

Parameters
nwiresis the number of wires in the plane.
minwirepitchis the location in the pitch coordinate of the first (zero index) wire.
maxwirepitchis the location in the pitch coordinate of the last wire (ie, index=nwires-1).
wireis a Vector which sets the direction of the wires in the plane. If the underlying wires are not exactly parallel, this should be some representative average wire direction.
pitchis a Vector which sets the direction and of the pitch of the wires in the plane. The pitch should be such that the cross product, wire (x) pitch, points in the anti-drift direction for the region this plane services. If the underlying wires are not exactly parallel, this pitcvector should be some representative average pitch direction.
originis a Point which sets an origin for all transforms. In particular, the projection of this origin point along the drift direction to the plane of wires sets the origin for the pitch coordinate.
nbinsgives the number of of impact bins covering one wire region.

The pitch extents and the origin vector must be expressed in the WCT system of (length) units.

Definition at line 5 of file Pimpos.cxx.

11  , m_origin(origin)
12  , m_axis{Vector(0,0,0), wire.norm(), pitch.norm()}
13 {
14  // drift = X = wire (x) pitch = Y cross Z
15  m_axis[0] = m_axis[1].cross(m_axis[2]);
16 
17  // total number of impact bins:
18  const int nimpstot = nwires*nbins;
19 
20  // total pitch span from first to last wire
21  const double regionsize = (maxwirepitch-minwirepitch)/(nwires-1);
22 
23  // expand by 1/2 pitch on either end to get total sensitive span in pitch direction
24  const double pmin = minwirepitch - 0.5*regionsize;
25  const double pmax = maxwirepitch + 0.5*regionsize;
26 
27  // Wire binning. Wires are at bin center.
28  m_regionbins.set(nwires, pmin, pmax);
29 
30  // Impact binning. Impact *positions* are bin-edges.
31  m_impactbins.set(nimpstot, pmin, pmax);
32 }
Vector m_axis[3]
Definition: Pimpos.h:141
Point m_origin
Definition: Pimpos.h:140
const int nwires
const Point & origin() const
Return given 3-point origin for plane pitch.
Definition: Pimpos.h:85
Binning m_impactbins
Definition: Pimpos.h:142
int m_nimpbins_per_wire
Definition: Pimpos.h:139
void set(int nbins, double minval, double maxval)
Definition: Binning.h:34
D3Vector norm() const
Return a normalized vector in the direction of this vector.
Definition: D3Vector.h:91
Point Vector
An alias for Point.
Definition: Point.h:18
Binning m_regionbins
Definition: Pimpos.h:142
D3Vector cross(const D3Vector &rhs) const
Return the cross product of this vector and the other.
Definition: D3Vector.h:100

Member Function Documentation

const Vector& WireCell::Pimpos::axis ( int  i) const
inline

Return an axis of the plan. 0=normal to plane (aka anti-drift), 1=wire direction, 2=pitch direction.

Definition at line 89 of file Pimpos.h.

89 { return m_axis[i]; }
Vector m_axis[3]
Definition: Pimpos.h:141
std::pair< int, int > Pimpos::closest ( double  pitch) const

Return a pair of indices. The first is the index of the wire closest to the given pitch. The second is the relative index of the impact closest impact position (index=0 means the impact position coincident with the wire).

Definition at line 34 of file Pimpos.cxx.

35 {
36  const int iwire = m_regionbins.bin(pitch);
37  const double wire_pitch = m_regionbins.center(iwire);
38  const double remainder = pitch - wire_pitch;
39  const int irelimp = int(round(remainder/m_impactbins.binsize()));
40  return std::make_pair(iwire, irelimp);
41 }
double center(int ind) const
Definition: Binning.h:86
Binning m_impactbins
Definition: Pimpos.h:142
double binsize() const
Definition: Binning.h:73
int bin(double val) const
Definition: Binning.h:80
Binning m_regionbins
Definition: Pimpos.h:142
const double wire_pitch
double Pimpos::distance ( const Point pt,
int  axis = 2 
) const

Return the distance from origin to point along the given axis. Default is pitch distance.

Definition at line 71 of file Pimpos.cxx.

72 {
73  return m_axis[axis].dot(relative(pt));
74 }
Vector m_axis[3]
Definition: Pimpos.h:141
T dot(const D3Vector &rhs) const
Return the dot product of this vector and the other.
Definition: D3Vector.h:80
Vector relative(const Point &pt) const
Return the vector from the origin to the given point.
Definition: Pimpos.cxx:66
const Vector & axis(int i) const
Definition: Pimpos.h:89
const Binning& WireCell::Pimpos::impact_binning ( ) const
inline

Return impact position binning. Bin edges are at impact positions and are in-phase with wire centers.

Definition at line 113 of file Pimpos.h.

113 { return m_impactbins; }
Binning m_impactbins
Definition: Pimpos.h:142
int WireCell::Pimpos::nimpbins_per_wire ( ) const
inline

Trivial accessor.

Definition at line 79 of file Pimpos.h.

79 { return m_nimpbins_per_wire; }
int m_nimpbins_per_wire
Definition: Pimpos.h:139
const Point& WireCell::Pimpos::origin ( ) const
inline

Return given 3-point origin for plane pitch.

Definition at line 85 of file Pimpos.h.

85 { return m_origin; }
Point m_origin
Definition: Pimpos.h:140
int Pimpos::reflect ( int  wireind,
int  impind 
) const

Return the impact position index which is the reflection of the given impact position index through the given wire index.

Definition at line 56 of file Pimpos.cxx.

57 {
58  const int wireimpind = wire_impact(wireind);
59  const int delta = impind - wireimpind;
60  return wireimpind - delta;
61 }
int wire_impact(int wireind) const
Return the impact position index coincident with the wire index.
Definition: Pimpos.cxx:43
const Binning& WireCell::Pimpos::region_binning ( ) const
inline

Return wire region binning. Each bin is centered on the wire. Bin edges extend a distance of 1/2 pitch between neighboring wires.

Definition at line 109 of file Pimpos.h.

109 { return m_regionbins; }
Binning m_regionbins
Definition: Pimpos.h:142
Vector Pimpos::relative ( const Point pt) const

Return the vector from the origin to the given point.

Definition at line 66 of file Pimpos.cxx.

67 {
68  return pt - m_origin;
69 }
Point m_origin
Definition: Pimpos.h:140
Point Pimpos::transform ( const Point pt) const

Transform the given point into the Pimpos coordinate system.

Definition at line 76 of file Pimpos.cxx.

77 {
78  const Vector v = relative(pt);
79  Point ret;
80  for (int axis=0; axis<3; ++axis) {
81  ret[axis] = m_axis[axis].dot(v);
82  }
83  return ret;
84 }
Vector m_axis[3]
Definition: Pimpos.h:141
D3Vector< double > Point
A 3D Cartesian point in double precision.
Definition: Point.h:15
std::vector< float > Vector
T dot(const D3Vector &rhs) const
Return the dot product of this vector and the other.
Definition: D3Vector.h:80
Vector relative(const Point &pt) const
Return the vector from the origin to the given point.
Definition: Pimpos.cxx:66
const Vector & axis(int i) const
Definition: Pimpos.h:89
int Pimpos::wire_impact ( int  wireind) const

Return the impact position index coincident with the wire index.

Definition at line 43 of file Pimpos.cxx.

44 {
45  return (0.5 + wireind)*m_nimpbins_per_wire;
46 }
int m_nimpbins_per_wire
Definition: Pimpos.h:139
std::pair< int, int > Pimpos::wire_impacts ( int  wireind) const

Return the impact position indices (bin edges) at either extreme of the wire region. The smaller index for this wire is the larger index of wireind-1's values and vice versa.

Definition at line 48 of file Pimpos.cxx.

49 {
50  const int wi = wire_impact(wireind);
51  return std::make_pair(wi - m_nimpbins_per_wire/2,
52  wi + m_nimpbins_per_wire/2);
53 }
int m_nimpbins_per_wire
Definition: Pimpos.h:139
int wire_impact(int wireind) const
Return the impact position index coincident with the wire index.
Definition: Pimpos.cxx:43

Member Data Documentation

Vector WireCell::Pimpos::m_axis[3]
private

Definition at line 141 of file Pimpos.h.

Binning WireCell::Pimpos::m_impactbins
private

Definition at line 142 of file Pimpos.h.

int WireCell::Pimpos::m_nimpbins_per_wire
private

Definition at line 139 of file Pimpos.h.

Point WireCell::Pimpos::m_origin
private

Definition at line 140 of file Pimpos.h.

Binning WireCell::Pimpos::m_regionbins
private

Definition at line 142 of file Pimpos.h.


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