WireSchema.h
Go to the documentation of this file.
1 /**
2  Code here helps read in data which follows the Wire Cell Toolkit
3  wire data schema. See python module wirecell.util.wires.schema and
4  sister submodules.
5 
6  */
7 #ifndef WIRECELLUTIL_WIREPLANES
8 #define WIRECELLUTIL_WIREPLANES
9 
10 #include "WireCellUtil/Point.h"
12 #include "WireCellUtil/String.h"
14 #include <memory>
15 
16 namespace WireCell {
17 
18  namespace WireSchema {
19 
20  // IWire
21  struct Wire {
22  int ident;
23  int channel;
24  int segment;
25  Point tail, head; // end points, direction of signal to channel
26 
27  };
28 
29  struct Plane {
30  int ident;
31  std::vector<int> wires;
32  };
33 
34  struct Face {
35  int ident;
36  std::vector<int> planes;
37  };
38 
39  struct Anode {
40  int ident;
41  std::vector<int> faces;
42  };
43 
44  struct Detector {
45  int ident;
46  std::vector<int> anodes;
47  };
48 
49  struct StoreDB {
50  std::vector<Detector> detectors;
51  std::vector<Anode> anodes;
52  std::vector<Face> faces;
53  std::vector<Plane> planes;
54  std::vector<Wire> wires;
55  };
56 
57 
58  // Access store via shared pointer to allow for caching of underlying data.
59  typedef std::shared_ptr<const StoreDB> StoreDBPtr;
60 
61  // Bolt on some const functions to the underlying and shared store.
62  class Store {
63  StoreDBPtr m_db;
64  public:
65  Store(); // underlying store will be null!
66  Store(StoreDBPtr db);
67  Store(const Store& other); // copy ctro
68  Store& operator=(const Store& other);
69 
70  // Access underlying data store as shared pointer.
71  StoreDBPtr db() const;
72 
73  const std::vector<Detector>& detectors() const;
74  const std::vector<Anode>& anodes() const;
75  const std::vector<Face>& faces() const;
76  const std::vector<Plane>& planes() const;
77  const std::vector<Wire>& wires() const;
78 
79  const Anode& anode(int ident) const;
80 
81  std::vector<Anode> anodes(const Detector& detector) const;
82  std::vector<Face> faces(const Anode& anode) const;
83  std::vector<Plane> planes(const Face& face) const;
84  std::vector<Wire> wires(const Plane& plane) const;
85 
86  BoundingBox bounding_box(const Anode& anode) const;
87  BoundingBox bounding_box(const Face& face) const;
88  BoundingBox bounding_box(const Plane& plane) const;
89 
90  Ray wire_pitch(const Plane& plane) const;
91 
92  std::vector<int> channels(const Plane& plane) const;
93 
94  };
95 
96 
97  Store load(const char* filename);
98  //void dump(const char* filename, const Store& store);
99 
100  }
101 
102 }
103 #endif
std::pair< Point, Point > Ray
A line segment running from a first (tail) to a second (head) point.
Definition: Point.h:21
std::shared_ptr< const StoreDB > StoreDBPtr
Definition: WireSchema.h:59
string filename
Definition: train.py:213
std::vector< Anode > anodes
Definition: WireSchema.h:51
std::vector< Face > faces
Definition: WireSchema.h:52
std::vector< int > planes
Definition: WireSchema.h:36
std::vector< int > wires
Definition: WireSchema.h:31
std::vector< int > faces
Definition: WireSchema.h:41
def bounding_box(wires)
Definition: common.py:15
Store load(const char *filename)
Definition: WireSchema.cxx:14
Definition: Main.h:22
std::vector< Wire > wires
Definition: WireSchema.h:54
std::vector< Plane > planes
Definition: WireSchema.h:53
std::vector< Detector > detectors
Definition: WireSchema.h:50
std::vector< int > anodes
Definition: WireSchema.h:46
const double wire_pitch