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

#include <WireSummary.h>

Inheritance diagram for WireCell::WireSummary:
WireCell::IWireSummary WireCell::IData< IWireSummary >

Classes

struct  WireSummaryCache
 

Public Member Functions

 WireSummary (const IWire::vector &wires)
 
virtual ~WireSummary ()
 
virtual const BoundingBoxbox () const
 Return the bounding box of the wire planes. More...
 
virtual IWire::pointer closest (const Point &point, WirePlaneId wpid) const
 
virtual IWirePair bounding_wires (const Point &point, WirePlaneId wpid) const
 
virtual double pitch_distance (const Point &point, WirePlaneId wpid) const
 
virtual const Vectorpitch_direction (WirePlaneId wpid) const
 Return a unit vector along the direction of the pitch. More...
 
virtual IWire::vector by_channel (int channel) const
 Return all wires, in order of segment number, attached to the channel. More...
 
- Public Member Functions inherited from WireCell::IWireSummary
virtual ~IWireSummary ()
 
- Public Member Functions inherited from WireCell::IData< IWireSummary >
virtual ~IData ()
 

Private Attributes

WireSummaryCachem_cache
 

Additional Inherited Members

- Public Types inherited from WireCell::IData< IWireSummary >
typedef IWireSummary value_type
 
typedef std::shared_ptr< const IWireSummarypointer
 
typedef std::vector< pointervector
 
typedef std::shared_ptr< const vectorshared_vector
 

Detailed Description

Default WireSummary which is also a wire sink and a wire sequence.

Definition at line 10 of file WireSummary.h.

Constructor & Destructor Documentation

WireSummary::WireSummary ( const IWire::vector wires)

Definition at line 189 of file WireSummary.cxx.

190  : m_cache(0)
191 {
192  m_cache = new WireSummaryCache(wires);
193 }
WireSummaryCache * m_cache
Definition: WireSummary.h:42
WireSummary::~WireSummary ( )
virtual

Definition at line 194 of file WireSummary.cxx.

195 {
196 }

Member Function Documentation

IWirePair WireSummary::bounding_wires ( const Point point,
WirePlaneId  wpid 
) const
virtual

Return a pair of adjacent wires from the given plane which bound the given point along the pitch direction. The pair is ordered by increasing wire index number. If one or both sides of the point are unbound by wire (segments) the associated pointer will be zero. It is assumed the point is in the (Y-Z) bounding box of the wire plane.

Implements WireCell::IWireSummary.

Definition at line 126 of file WireSummary.cxx.

127 {
128  if (!m_cache) {
129  return IWirePair();
130  }
131  WirePlaneCache* wpc = m_cache->plane(wpid);
132  if (!wpc) {
133  return IWirePair();
134  }
135 
136  IWire::pointer wire = closest(point, wpid);
137  if (!wire) return IWirePair();
138 
139  int index = wire->index();
140 
141  Vector topoint = point - wire->ray().first;
142  double dot = wpc->pitch_unit.dot(topoint);
143  int other_index = index - 1;
144  if (dot > 0) {
145  other_index = index + 1;
146  }
147 
148  IWire::pointer other_wire = wpc->wire_by_index(other_index);
149 
150  if (index < other_index) {
151  return IWirePair(IWire::pointer(wire), IWire::pointer(other_wire));
152  }
153  return IWirePair(IWire::pointer(other_wire), IWire::pointer(wire));
154 }
virtual IWire::pointer closest(const Point &point, WirePlaneId wpid) const
std::shared_ptr< const IWire > pointer
Definition: IData.h:19
std::pair< IWire::pointer, IWire::pointer > IWirePair
Some common collections.
Definition: IWire.h:55
WireSummaryCache * m_cache
Definition: WireSummary.h:42
WirePlaneCache * plane(WirePlaneId wpid)
Definition: WireSummary.cxx:86
std::vector< float > Vector
IWire::pointer wire_by_index(int index)
Definition: WireSummary.cxx:46
const BoundingBox & WireSummary::box ( ) const
virtual

Return the bounding box of the wire planes.

Implements WireCell::IWireSummary.

Definition at line 103 of file WireSummary.cxx.

104 {
105  if (!m_cache) {
106  static BoundingBox bbdummy;
107  return bbdummy;
108  }
109  return m_cache->bb;
110 }
WireSummaryCache * m_cache
Definition: WireSummary.h:42
IWire::vector WireSummary::by_channel ( int  channel) const
virtual

Return all wires, in order of segment number, attached to the channel.

Implements WireCell::IWireSummary.

Definition at line 181 of file WireSummary.cxx.

182 {
183  if (!m_cache) {
184  return IWire::vector();
185  }
186  return m_cache->by_chan(channel);
187 }
std::vector< pointer > vector
Definition: IData.h:21
WireSummaryCache * m_cache
Definition: WireSummary.h:42
IWire::pointer WireSummary::closest ( const Point point,
WirePlaneId  wpid 
) const
virtual

Return the closest wire along the pitch direction to the given point in the given wire plane. It is assumed the point is in the (Y-Z) bounding box of the wire plane.

Implements WireCell::IWireSummary.

Definition at line 112 of file WireSummary.cxx.

113 {
114  if (!m_cache) {
115  return 0;
116  }
117  WirePlaneCache* wpc = m_cache->plane(wpid);
118  if (!wpc) {
119  return 0;
120  }
121 
122  double dist = wpc->pitch_distance(point);
123  return wpc->wire_by_index(dist/wpc->pitch_mag);
124 }
double pitch_distance(const Point &point)
Definition: WireSummary.cxx:53
WireSummaryCache * m_cache
Definition: WireSummary.h:42
WirePlaneCache * plane(WirePlaneId wpid)
Definition: WireSummary.cxx:86
IWire::pointer wire_by_index(int index)
Definition: WireSummary.cxx:46
const Vector & WireSummary::pitch_direction ( WirePlaneId  wpid) const
virtual

Return a unit vector along the direction of the pitch.

Implements WireCell::IWireSummary.

Definition at line 168 of file WireSummary.cxx.

169 {
170  static Vector dummy;
171  if (!m_cache) {
172  return dummy;
173  }
174  WirePlaneCache* wpc = m_cache->plane(wpid);
175  if (!wpc) {
176  return dummy;
177  }
178  return wpc->pitch_unit;
179 }
WireSummaryCache * m_cache
Definition: WireSummary.h:42
WirePlaneCache * plane(WirePlaneId wpid)
Definition: WireSummary.cxx:86
std::vector< float > Vector
cet::LibraryManager dummy("noplugin")
double WireSummary::pitch_distance ( const Point point,
WirePlaneId  wpid 
) const
virtual

Return the distance along the pitch of the given wire plane to the given point as measured from the zeroth wire.

Implements WireCell::IWireSummary.

Definition at line 156 of file WireSummary.cxx.

157 {
158  if (!m_cache) {
159  return 0;
160  }
161  WirePlaneCache* wpc = m_cache->plane(wpid);
162  if (!wpc) {
163  return 0;
164  }
165  return wpc->pitch_distance(point);
166 }
double pitch_distance(const Point &point)
Definition: WireSummary.cxx:53
WireSummaryCache * m_cache
Definition: WireSummary.h:42
WirePlaneCache * plane(WirePlaneId wpid)
Definition: WireSummary.cxx:86

Member Data Documentation

WireSummaryCache* WireCell::WireSummary::m_cache
private

Definition at line 42 of file WireSummary.h.


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