Classes | Namespaces | Functions
WireGenerator.cxx File Reference
#include "WireCellGen/WireGenerator.h"
#include "WireCellUtil/Intersection.h"
#include "WireCellUtil/NamedFactory.h"
#include <cmath>
#include <iostream>
#include <vector>

Go to the source code of this file.

Classes

class  WireCell::GenWire
 
struct  SortByIndex
 

Namespaces

 WireCell
 

Functions

 WIRECELL_FACTORY (WireGenerator, WireCell::WireGenerator, WireCell::IWireGenerator) using namespace WireCell
 
static GenWire * make_wire (int index, const Point &point, const Point &proto, const Ray &bounds)
 
static void make_one_plane (IWire::vector &returned_wires, WirePlaneId wpid, const Ray &bounds, const Ray &step)
 

Function Documentation

static void make_one_plane ( IWire::vector returned_wires,
WirePlaneId  wpid,
const Ray &  bounds,
const Ray &  step 
)
static

Definition at line 83 of file WireGenerator.cxx.

85 {
86  const Vector xaxis(1,0,0);
87  const Point starting_point = step.first;
88  const Vector pitch = step.second - starting_point;
89  const Vector proto = pitch.cross(xaxis).norm();
90 
91  std::vector<GenWire*> these_wires;
92 
93  int pos_index = 0;
94  Point offset = starting_point;
95  while (true) { // go in positive pitch direction
96  GenWire* wire = make_wire(pos_index, offset, proto, bounds);
97  if (! wire) { break; }
98  these_wires.push_back(wire);
99  offset = wire->center() + pitch;
100  pos_index += 1;
101  }
102 
103  int neg_index = -1; // now go in negative pitch direction
104  const Vector neg_pitch = -1.0 * pitch;
105  offset = these_wires[0]->center() + neg_pitch; // start one below first upward going one
106  while (true) { // go in negative pitch direction
107  GenWire* wire = make_wire(neg_index, offset, proto, bounds);
108  if (! wire) { break; }
109  these_wires.push_back(wire);
110  offset = wire->center() + neg_pitch;
111  neg_index -= 1;
112  }
113 
114  // order by index
115  std::sort(these_wires.begin(), these_wires.end(), SortByIndex());
116 
117  // load in to store and fix up index and plane
118  for (size_t ind=0; ind<these_wires.size(); ++ind) {
119  GenWire* pwire = these_wires[ind];
120  pwire->set_index(ind);
121  pwire->set_planeid(wpid);
122  returned_wires.push_back(IWire::pointer(pwire));
123  }
124 
125  //std::cerr << "Made "<<store.size()<<" wires for plane " << plane << std::endl;
126  //std::cerr << "step = " << step << std::endl;
127  //std::cerr << "bounds = " << bounds << std::endl;
128 }
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
Definition: DCEL.h:34
General LArSoft Utilities.
BoundingBox bounds(int x, int y, int w, int h)
Definition: main.cpp:37
std::vector< float > Vector
static GenWire * make_wire(int index, const Point &point, const Point &proto, const Ray &bounds)
const GenericPointer< typename T::ValueType > & pointer
Definition: pointer.h:1124
static GenWire* make_wire ( int  index,
const Point point,
const Point proto,
const Ray &  bounds 
)
static

Definition at line 57 of file WireGenerator.cxx.

59 {
60  const Point pt1 = point;
61  const Point pt2 = pt1 + proto;
62  const Ray wireray(pt1, pt2);
63 
64  Ray hits;
65  int hitmask = box_intersection(bounds, wireray, hits);
66  if (3 != hitmask) {
67  return 0;
68  }
69  // ray should point generally towards +Y
70  if (hits.first.y() > hits.second.y()) {
71  hits = Ray(hits.second, hits.first);
72  }
73  return new GenWire(WirePlaneId(kUnknownLayer), index, hits);
74 }
std::pair< Point, Point > Ray
A line segment running from a first (tail) to a second (head) point.
Definition: Point.h:21
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
Definition: DCEL.h:34
General LArSoft Utilities.
BoundingBox bounds(int x, int y, int w, int h)
Definition: main.cpp:37
int box_intersection(const Ray &bounds, const Ray &ray, Ray &hits)
WIRECELL_FACTORY ( WireGenerator  ,
WireCell::WireGenerator  ,
WireCell::IWireGenerator   
)