AnodeFace.cxx
Go to the documentation of this file.
2 
3 using namespace WireCell;
4 using namespace WireCell::Gen;
5 
6 
7 static
9 {
10  ray_pair_vector_t raypairs;
11 
12  const Ray& bbray = bb.bounds();
13 
14  // We don't care which end point is which, but conceptually assume
15  // point a is "lower" than "b" in Y and Z. X gets zeroed.
16  const Point& a = bbray.first;
17  const Point& b = bbray.second;
18 
19  // Corners of a box in X=0 plane
20  Point ll(0.0, a.y(), a.z());
21  Point lr(0.0, a.y(), b.z());
22  Point ul(0.0, b.y(), a.z());
23  Point ur(0.0, b.y(), b.z());
24 
25  // boundary in the horizontal direction (rays point at Y+)
26  Ray h1(ll, ul);
27  Ray h2(lr, ur);
28  raypairs.push_back(ray_pair_t(h1, h2));
29 
30  // boundary in the vertical direction (rays point at Z+)
31  Ray v1(ll, lr);
32  Ray v2(ul, ur);
33  raypairs.push_back(ray_pair_t(v1, v2));
34 
35 
36  // Now the wire planes.
37  for (const auto& plane : planes) {
38  const auto& wires = plane->wires();
39  const auto wray0 = wires[0]->ray();
40  const auto wray1 = wires[1]->ray();
41  const auto pitray = ray_pitch(wray0, wray1);
42  const auto pitvec = ray_vector(pitray);
43  Ray r1(wray0.first - 0.5*pitvec, wray0.second - 0.5*pitvec);
44  Ray r2(wray0.first + 0.5*pitvec, wray0.second + 0.5*pitvec);
45 
46  raypairs.push_back(ray_pair_t(r1,r2));
47 
48  }
49 
50  // for (size_t layer =0; layer<raypairs.size(); ++layer) {
51  // const auto& rp = raypairs[layer];
52  // std::cerr << "L" << layer << " " << planes[0]->planeid() << "\n"
53  // << "\twray0=" << rp.first << "\n"
54  // << "\twray1=" << rp.second << "\n";
55  // }
56 
57  return raypairs;
58 }
59 
60 
62  : m_ident(ident)
63  , m_planes(planes)
64  , m_bb(bb)
65  , m_coords(get_raypairs(bb, planes))
66 {
67 }
68 
70 {
71  for (auto ptr : m_planes) {
72  if (ptr->ident() == ident) {
73  return ptr;
74  }
75  }
76  return nullptr;
77 }
78 
std::pair< Point, Point > Ray
A line segment running from a first (tail) to a second (head) point.
Definition: Point.h:21
D3Vector< double > Point
A 3D Cartesian point in double precision.
Definition: Point.h:15
static ray_pair_vector_t get_raypairs(const BoundingBox &bb, const IWirePlane::vector &planes)
Definition: AnodeFace.cxx:8
std::vector< pointer > vector
Vector of shared pointers.
Definition: IComponent.h:36
AnodeFace(int ident, IWirePlane::vector planes, const BoundingBox &sensvol)
Definition: AnodeFace.cxx:61
std::shared_ptr< Interface > pointer
Definition: Interface.h:16
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1124
std::vector< ray_pair_t > ray_pair_vector_t
Definition: Point.h:27
Definition: Main.h:22
Ray ray_pitch(const Ray &ray1, const Ray &ray2)
Definition: Point.cxx:76
const void * ptr(const T *p)
Definition: format.h:3138
virtual int ident() const
Return the ident number of this face.
Definition: AnodeFace.h:16
static bool * b
Definition: config.cpp:1043
Vector ray_vector(const Ray &ray)
Definition: Point.cxx:67
std::pair< Ray, Ray > ray_pair_t
Definition: Point.h:24
IWirePlane::vector m_planes
Definition: AnodeFace.h:33
const Ray & bounds() const
Return the ray representing the bounds.
Definition: BoundingBox.h:36
virtual IWirePlane::pointer plane(int ident) const
Return the wire plane with the given ident or nullptr if unknown.
Definition: AnodeFace.cxx:69