Public Member Functions | Private Attributes | List of all members
WireCell::WireSchema::Store Class Reference

#include <WireSchema.h>

Public Member Functions

 Store ()
 
 Store (StoreDBPtr db)
 
 Store (const Store &other)
 
Storeoperator= (const Store &other)
 
StoreDBPtr db () const
 
const std::vector< Detector > & detectors () const
 
const std::vector< Anode > & anodes () const
 
const std::vector< Face > & faces () const
 
const std::vector< Plane > & planes () const
 
const std::vector< Wire > & wires () const
 
const Anodeanode (int ident) const
 
std::vector< Anodeanodes (const Detector &detector) const
 
std::vector< Facefaces (const Anode &anode) const
 
std::vector< Planeplanes (const Face &face) const
 
std::vector< Wirewires (const Plane &plane) const
 
BoundingBox bounding_box (const Anode &anode) const
 
BoundingBox bounding_box (const Face &face) const
 
BoundingBox bounding_box (const Plane &plane) const
 
Ray wire_pitch (const Plane &plane) const
 
std::vector< int > channels (const Plane &plane) const
 

Private Attributes

StoreDBPtr m_db
 

Detailed Description

Definition at line 62 of file WireSchema.h.

Constructor & Destructor Documentation

Store::Store ( )

Definition at line 144 of file WireSchema.cxx.

144 : m_db(nullptr) {}
Store::Store ( StoreDBPtr  db)

Definition at line 146 of file WireSchema.cxx.

146 : m_db(db) { }
StoreDBPtr db() const
Definition: WireSchema.cxx:159
Store::Store ( const Store other)

Definition at line 148 of file WireSchema.cxx.

149  : m_db(other.db())
150 {
151 }
StoreDBPtr db() const
Definition: WireSchema.cxx:159

Member Function Documentation

const Anode & Store::anode ( int  ident) const

Definition at line 167 of file WireSchema.cxx.

167  {
168  for (auto& a : m_db->anodes) {
169  if (a.ident == ident) {
170  return a;
171  }
172  }
173  THROW(KeyError() << errmsg{String::format("Unknown anode: %d", ident)});
174 }
boost::error_info< struct tag_errmsg, std::string > errmsg
Definition: Exceptions.h:54
#define THROW(e)
Definition: Exceptions.h:25
std::string format(const std::string &form, TYPES...objs)
Definition: String.h:45
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1124
Thrown when a wrong key or has been encountered.
Definition: Exceptions.h:43
const std::vector< Anode > & Store::anodes ( ) const

Definition at line 162 of file WireSchema.cxx.

162 { return m_db->anodes; }
std::vector< Anode > Store::anodes ( const Detector detector) const

Definition at line 176 of file WireSchema.cxx.

176  {
177  std::vector<Anode> ret;
178  for (auto ind : detector.anodes) {
179  ret.push_back(m_db->anodes[ind]);
180  }
181  return ret;
182 }
std::vector< int > anodes
Definition: WireSchema.h:46
BoundingBox Store::bounding_box ( const Anode anode) const

Definition at line 212 of file WireSchema.cxx.

213 {
214  BoundingBox bb;
215  for (const auto& face : faces(anode)) {
216  bb(bounding_box(face).bounds());
217  }
218  return bb;
219 }
BoundingBox bounding_box(const Anode &anode) const
Definition: WireSchema.cxx:212
BoundingBox bounds(int x, int y, int w, int h)
Definition: main.cpp:37
const std::vector< Face > & faces() const
Definition: WireSchema.cxx:163
BoundingBox Store::bounding_box ( const Face face) const

Definition at line 220 of file WireSchema.cxx.

221 {
222  BoundingBox bb;
223  for (const auto& plane : planes(face)) {
224  bb(bounding_box(plane).bounds());
225  }
226  return bb;
227 }
BoundingBox bounding_box(const Anode &anode) const
Definition: WireSchema.cxx:212
BoundingBox bounds(int x, int y, int w, int h)
Definition: main.cpp:37
const std::vector< Plane > & planes() const
Definition: WireSchema.cxx:164
BoundingBox Store::bounding_box ( const Plane plane) const

Definition at line 228 of file WireSchema.cxx.

229 {
230  BoundingBox bb;
231  for (const auto& wire : wires(plane)) {
232  Ray ray(wire.tail, wire.head);
233  bb(ray);
234  }
235  return bb;
236 
237 }
std::pair< Point, Point > Ray
A line segment running from a first (tail) to a second (head) point.
Definition: Point.h:21
const std::vector< Wire > & wires() const
Definition: WireSchema.cxx:165
std::vector< int > Store::channels ( const Plane plane) const

Definition at line 262 of file WireSchema.cxx.

263 {
264  std::vector<int> ret;
265  for (const auto& wire : wires(plane)) {
266  ret.push_back(wire.channel);
267  }
268  return ret;
269 }
const std::vector< Wire > & wires() const
Definition: WireSchema.cxx:165
StoreDBPtr Store::db ( ) const

Definition at line 159 of file WireSchema.cxx.

159 { return m_db; }
const std::vector< Detector > & Store::detectors ( ) const

Definition at line 161 of file WireSchema.cxx.

161 { return m_db->detectors; }
const std::vector< Face > & Store::faces ( ) const

Definition at line 163 of file WireSchema.cxx.

163 { return m_db->faces; }
std::vector< Face > Store::faces ( const Anode anode) const

Definition at line 185 of file WireSchema.cxx.

185  {
186  std::vector<Face> ret;
187  for (auto ind : anode.faces) {
188  ret.push_back(m_db->faces[ind]);
189  }
190  return ret;
191 }
std::vector< int > faces
Definition: WireSchema.h:41
Store & Store::operator= ( const Store other)

Definition at line 152 of file WireSchema.cxx.

153 {
154  m_db = other.db();
155  return *this;
156 }
StoreDBPtr db() const
Definition: WireSchema.cxx:159
const std::vector< Plane > & Store::planes ( ) const

Definition at line 164 of file WireSchema.cxx.

164 { return m_db->planes; }
std::vector< Plane > Store::planes ( const Face face) const

Definition at line 194 of file WireSchema.cxx.

195 {
196  std::vector<Plane> ret;
197  for (auto ind : face.planes) {
198  ret.push_back(m_db->planes[ind]);
199  }
200  return ret;
201 }
std::vector< int > planes
Definition: WireSchema.h:36
Ray Store::wire_pitch ( const Plane plane) const

Definition at line 239 of file WireSchema.cxx.

240 {
241  Vector wtot;
242  for (const auto& wire : wires(plane)) {
243  Ray ray(wire.tail, wire.head);
244  wtot += ray_vector(ray);
245  }
246  wtot = wtot.norm();
247 
248  const Wire& w1 = m_db->wires[plane.wires.front()];
249  const Wire& w2 = m_db->wires[plane.wires.back()];
250 
251  const Vector c1 = 0.5*(w1.tail + w1.head);
252  const Vector c2 = 0.5*(w2.tail + w2.head);
253 
254  // approximate pitch, in the plane
255  Vector pit = ray_vector(Ray(c1,c2));
256  Vector ecks = wtot.cross(pit); // X-axis
257  pit = ecks.cross(wtot);
258  return Ray(wtot, pit.norm());
259 }
std::pair< Point, Point > Ray
A line segment running from a first (tail) to a second (head) point.
Definition: Point.h:21
std::vector< int > wires
Definition: WireSchema.h:31
const std::vector< Wire > & wires() const
Definition: WireSchema.cxx:165
std::vector< float > Vector
Vector ray_vector(const Ray &ray)
Definition: Point.cxx:67
const std::vector< Wire > & Store::wires ( ) const

Definition at line 165 of file WireSchema.cxx.

165 { return m_db->wires; }
std::vector< Wire > Store::wires ( const Plane plane) const

Definition at line 203 of file WireSchema.cxx.

204 {
205  std::vector<Wire> ret;
206  for (auto ind : plane.wires) {
207  ret.push_back(m_db->wires[ind]);
208  }
209  return ret;
210 }
std::vector< int > wires
Definition: WireSchema.h:31

Member Data Documentation

StoreDBPtr WireCell::WireSchema::Store::m_db
private

Definition at line 63 of file WireSchema.h.


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