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

#include <RayTiling.h>

Public Member Functions

void add (const Coordinates &coords, const Strip &strip)
 
const strips_tstrips () const
 
strips_tstrips ()
 
const crossings_tcorners () const
 
bool valid () const
 
std::string as_string () const
 

Private Attributes

strips_t m_strips
 
crossings_t m_corners
 

Detailed Description

Definition at line 107 of file RayTiling.h.

Member Function Documentation

void Blob::add ( const Coordinates coords,
const Strip strip 
)

Definition at line 146 of file RayTiling.cxx.

147 {
148  const size_t nstrips = m_strips.size();
149 
150  if (nstrips == 0) { // special case
151  m_strips.push_back(strip);
152  return;
153  }
154 
155  if (nstrips == 1) { // special case
156  m_strips.push_back(strip);
157  m_corners = find_corners(m_strips.front(), m_strips.back());
158  return;
159  }
160 
161  crossings_t surviving;
162 
163  // See what old corners are inside the new strip
164  for (const auto& c : m_corners) {
165  const double pitch = coords.pitch_location(c.first, c.second, strip.layer);
166  const int pind = coords.pitch_index(pitch, strip.layer);
167 
168 
169  if (strip.in(pind)) {
170  surviving.push_back(c);
171  }
172  }
173 
174  // see what new corners are inside all old strips;
175  for (size_t si1 = 0; si1 < nstrips; ++si1) {
176  auto corners = find_corners(m_strips[si1], strip);
177  for (const auto& c : corners) {
178 
179  // check each corner if inside all other strips
180  bool miss = false;
181  for (size_t si2 = 0; si2 < nstrips; ++si2) {
182  if (si1 == si2) { continue; }
183  const auto& s2 = m_strips[si2];
184  double pitch = coords.pitch_location(c.first, c.second, s2.layer);
185  const int pind = coords.pitch_index(pitch, s2.layer);
186  if (s2.in(pind)) {
187  continue;
188  }
189 
190  miss = true;
191  break;
192  }
193  if (!miss) {
194  surviving.push_back(c);
195  }
196  }
197  }
198  m_corners = surviving;
199  m_strips.push_back(strip);
200 }
layer_index_t layer
Definition: RayTiling.h:24
bool in(grid_index_t pitch_index) const
Definition: RayTiling.h:34
double pitch_location(const coordinate_t &one, const coordinate_t &two, layer_index_t other) const
Definition: RayGrid.cxx:133
crossings_t m_corners
Definition: RayTiling.h:129
int pitch_index(double pitch, layer_index_t layer) const
Definition: RayGrid.h:82
static crossings_t find_corners(const Strip &one, const Strip &two)
Definition: RayTiling.cxx:130
std::vector< crossing_t > crossings_t
Definition: RayGrid.h:62
const crossings_t & corners() const
Definition: RayTiling.cxx:202
std::string Blob::as_string ( ) const

Definition at line 274 of file RayTiling.cxx.

275 {
276  std::stringstream ss;
277  ss << *this << "\n";
278  const auto& strips = this->strips();
279  ss << "\tstrips (" << strips.size() << "):\n";
280  for (const auto& s : strips) {
281  ss << "\t\t" << s << "\n";
282  }
283  const auto corners = this->corners();
284  ss << "\tcorners (" << corners.size() << "):\n";
285  for (const auto& c : corners) {
286  ss << "\t\t" << c << "\n";
287  }
288  return ss.str();
289 }
const strips_t & strips() const
Definition: RayTiling.h:111
const crossings_t & corners() const
Definition: RayTiling.cxx:202
static QCString * s
Definition: config.cpp:1042
const crossings_t & Blob::corners ( ) const

Definition at line 202 of file RayTiling.cxx.

203 {
204  return m_corners;
205 }
crossings_t m_corners
Definition: RayTiling.h:129
const strips_t& WireCell::RayGrid::Blob::strips ( ) const
inline

Definition at line 111 of file RayTiling.h.

111 { return m_strips; }
strips_t& WireCell::RayGrid::Blob::strips ( )
inline

Definition at line 112 of file RayTiling.h.

112 { return m_strips; }
bool WireCell::RayGrid::Blob::valid ( ) const
inline

Definition at line 118 of file RayTiling.h.

118  {
119  size_t nstrips = m_strips.size();
120  if (nstrips == 0) { return false; } // empty
121  if (nstrips == 1) { return true; } // no corners expected
122  return corners().size() > 0;
123  }
const crossings_t & corners() const
Definition: RayTiling.cxx:202

Member Data Documentation

crossings_t WireCell::RayGrid::Blob::m_corners
private

Definition at line 129 of file RayTiling.h.

strips_t WireCell::RayGrid::Blob::m_strips
private

Definition at line 128 of file RayTiling.h.


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