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

#include <RayTiling.h>

Public Member Functions

 Tiling (const Coordinates &coords)
 
Activity projection (const Blob &blob, const Activity &activity)
 
blobs_t operator() (const Activity &activity)
 
blobs_t operator() (const blobs_t &prior, const Activity &activity)
 

Private Attributes

const Coordinatesm_coords
 

Detailed Description

Definition at line 136 of file RayTiling.h.

Constructor & Destructor Documentation

Tiling::Tiling ( const Coordinates coords)

Definition at line 209 of file RayTiling.cxx.

210  : m_coords(coords)
211 {
212 }
const Coordinates & m_coords
Definition: RayTiling.h:152

Member Function Documentation

blobs_t Tiling::operator() ( const Activity activity)

Definition at line 216 of file RayTiling.cxx.

217 {
218  auto strips = activity.make_strips();
219  const size_t nstrips = strips.size();
220  blobs_t ret(nstrips);
221  for (size_t ind=0; ind<nstrips; ++ind) {
222  ret[ind].add(m_coords, strips[ind]);
223  }
224  return ret;
225 }
strips_t make_strips() const
Definition: RayTiling.cxx:92
const Coordinates & m_coords
Definition: RayTiling.h:152
std::vector< Blob > blobs_t
Definition: RayTiling.h:134
blobs_t Tiling::operator() ( const blobs_t prior,
const Activity activity 
)

Definition at line 301 of file RayTiling.cxx.

303 {
304  blobs_t ret;
305 
306  for (const auto& blob : prior_blobs) {
307  Activity proj = projection(blob, activity);
308  if (proj.empty()) {
309  continue;
310  }
311  auto strips = proj.make_strips();
312  for (auto strip : strips) {
313  Blob newblob = blob; // copy
314  newblob.add(m_coords, strip);
315  if (newblob.corners().empty()) {
316  continue;
317  }
318  ret.push_back(newblob);
319  }
320  }
321 
322  return ret;
323 }
strips_t make_strips() const
Definition: RayTiling.cxx:92
Activity projection(const Blob &blob, const Activity &activity)
Definition: RayTiling.cxx:227
const Coordinates & m_coords
Definition: RayTiling.h:152
std::vector< Blob > blobs_t
Definition: RayTiling.h:134
void add(const Coordinates &coords, const Strip &strip)
Definition: RayTiling.cxx:146
const crossings_t & corners() const
Definition: RayTiling.cxx:202
Activity Tiling::projection ( const Blob blob,
const Activity activity 
)

Definition at line 227 of file RayTiling.cxx.

228 {
229  // special case. A single layer blob effectively extends to
230  // infinity along the ray direction so any possible activity
231  // projects.
232  if (blob.strips().size() == 1) {
233  return activity;
234  }
235 
236  const double pitch_mag = m_coords.pitch_mags()[activity.layer()];
237 
238  // find extreme pitches
239  std::vector<double> pitches;
240  const auto corners = blob.corners();
241  if (corners.empty()) {
242  return Activity(activity.layer());
243  }
244  for (const auto& c : blob.corners()) {
245  const double p = m_coords.pitch_location(c.first, c.second, activity.layer());
246  pitches.push_back(p);
247  }
248  if (pitches.empty()) {
249  return Activity(activity.layer());
250  }
251 
252  auto pbeg = pitches.begin();
253  auto pend = pitches.end();
254 
255  const auto mm = std::minmax_element(pbeg, pend);
256  int pind1 = std::floor((*mm.first)/pitch_mag);
257  int pind2 = std::ceil((*mm.second)/pitch_mag);
258 
259  const int apind1 = activity.pitch_index(activity.begin());
260  const int apind2 = activity.pitch_index(activity.end());
261 
262  if (pind2 <= apind1 or pind1 >= apind2) {
263  return Activity(activity.layer());
264  }
265 
266  pind1 = std::max(pind1, activity.pitch_index(activity.begin()));
267  pind2 = std::min(pind2, activity.pitch_index(activity.end()));
268 
269  Activity ret = activity.subspan(pind1, pind2);
270  return ret;
271 }
iterator_t begin() const
Definition: RayTiling.cxx:50
double pitch_location(const coordinate_t &one, const coordinate_t &two, layer_index_t other) const
Definition: RayGrid.cxx:133
def activity(output, slices, slice_line, cluster_tap_file)
Definition: main.py:144
Activity subspan(int pi_begin, int pi_end) const
Definition: RayTiling.cxx:70
int pitch_index(const iterator_t &it) const
Definition: RayTiling.cxx:65
const std::vector< double > & pitch_mags() const
Definition: RayGrid.h:87
layer_index_t layer() const
Definition: RayTiling.h:75
static int max(int a, int b)
const strips_t & strips() const
Definition: RayTiling.h:111
const Coordinates & m_coords
Definition: RayTiling.h:152
static const double mm
Definition: Units.h:73
p
Definition: test.py:223
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
const crossings_t & corners() const
Definition: RayTiling.cxx:202
iterator_t end() const
Definition: RayTiling.cxx:55

Member Data Documentation

const Coordinates& WireCell::RayGrid::Tiling::m_coords
private

Definition at line 152 of file RayTiling.h.


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