18 auto maybe = gStoreCache.find(realpath);
19 if (maybe != gStoreCache.end()) {
20 return Store(maybe->second);
34 const int npoints = jpoints.size();
35 points.resize(npoints);
36 for (
int ipoint=0; ipoint<npoints; ++ipoint) {
38 points[ipoint].set(get<double>(jp,
"x"), get<double>(jp,
"y"), get<double>(jp,
"z"));
44 const int nwires = jwires.size();
45 std::vector<Wire>& wires = store->
wires;
47 for (
int iwire=0; iwire<
nwires; ++iwire) {
49 Wire& wire = wires[iwire];
50 wire.
ident = get<int>(jwire,
"ident");
51 wire.
channel = get<int>(jwire,
"channel");
52 wire.
segment = get<int>(jwire,
"segment");
54 int itail = get<int>(jwire,
"tail");
55 int ihead = get<int>(jwire,
"head");
56 wire.
tail = points[itail];
57 wire.
head = points[ihead];
64 const int nplanes = jplanes.size();
65 std::vector<Plane>& planes = store->
planes;
66 planes.resize(nplanes);
67 for (
int iplane=0; iplane<nplanes; ++iplane) {
69 Plane& plane = planes[iplane];
70 plane.
ident = get<int>(jplane,
"ident");
72 const int nwires = jwires.size();
73 plane.
wires.resize(nwires);
74 for (
int iwire=0; iwire<
nwires; ++iwire) {
82 const int nfaces = jfaces.size();
83 std::vector<Face>& faces = store->
faces;
85 for (
int iface=0; iface<nfaces; ++iface) {
87 Face& face = faces[iface];
88 face.
ident = get<int>(jface,
"ident");
90 const int nplanes = jplanes.size();
91 face.
planes.resize(nplanes);
92 for (
int iplane=0; iplane<nplanes; ++iplane) {
100 const int nanodes = janodes.size();
101 std::vector<Anode>& anodes = store->
anodes;
102 anodes.resize(nanodes);
103 for (
int ianode=0; ianode<nanodes; ++ianode) {
105 Anode& anode = anodes[ianode];
106 anode.
ident = get<int>(janode,
"ident");
108 const int nfaces = jfaces.size();
109 anode.
faces.resize(nfaces);
110 for (
int iface=0; iface<nfaces; ++iface) {
118 const int ndets = jdets.size();
119 std::vector<Detector>& dets = store->
detectors;
121 for (
int idet=0; idet<ndets; ++idet) {
124 det.
ident = get<int>(jdet,
"ident");
126 const int nanodes = janodes.size();
127 det.
anodes.resize(nanodes);
128 for (
int ianode=0; ianode<nanodes; ++ianode) {
134 return Store(gStoreCache[realpath]);
168 for (
auto&
a :
m_db->anodes) {
169 if (
a.ident == ident) {
177 std::vector<Anode> ret;
178 for (
auto ind : detector.
anodes) {
179 ret.push_back(
m_db->anodes[ind]);
186 std::vector<Face> ret;
187 for (
auto ind : anode.
faces) {
188 ret.push_back(
m_db->faces[ind]);
196 std::vector<Plane> ret;
197 for (
auto ind : face.
planes) {
198 ret.push_back(
m_db->planes[ind]);
205 std::vector<Wire> ret;
206 for (
auto ind : plane.
wires) {
207 ret.push_back(
m_db->wires[ind]);
215 for (
const auto& face :
faces(anode)) {
223 for (
const auto& plane :
planes(face)) {
231 for (
const auto& wire :
wires(plane)) {
232 Ray ray(wire.tail, wire.head);
242 for (
const auto& wire :
wires(plane)) {
243 Ray ray(wire.tail, wire.head);
257 pit = ecks.
cross(wtot);
264 std::vector<int> ret;
265 for (
const auto& wire :
wires(plane)) {
266 ret.push_back(wire.channel);
std::pair< Point, Point > Ray
A line segment running from a first (tail) to a second (head) point.
std::shared_ptr< const StoreDB > StoreDBPtr
Ray wire_pitch(const Plane &plane) const
const std::vector< Detector > & detectors() const
boost::error_info< struct tag_errmsg, std::string > errmsg
BoundingBox bounding_box(const Anode &anode) const
static std::map< std::string, StoreDBPtr > gStoreCache
const std::vector< Anode > & anodes() const
std::vector< Anode > anodes
std::vector< Face > faces
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
std::vector< int > planes
D3Vector norm() const
Return a normalized vector in the direction of this vector.
Json::Value load(const std::string &filename, const externalvars_t &extvar=externalvars_t(), const externalvars_t &extcode=externalvars_t())
BoundingBox bounds(int x, int y, int w, int h)
std::string format(const std::string &form, TYPES...objs)
Store load(const char *filename)
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
const std::vector< Wire > & wires() const
const std::vector< Plane > & planes() const
const std::vector< Face > & faces() const
std::vector< Wire > wires
int convert< int >(const Configuration &cfg, const int &def)
std::vector< int > channels(const Plane &plane) const
std::vector< Plane > planes
std::vector< Detector > detectors
std::vector< int > anodes
D3Vector cross(const D3Vector &rhs) const
Return the cross product of this vector and the other.
Vector ray_vector(const Ray &ray)
Store & operator=(const Store &other)
const Anode & anode(int ident) const
std::string resolve(const std::string &filename)
Thrown when a wrong key or has been encountered.