Public Member Functions | Public Attributes | List of all members
blob_jsoner Struct Reference

Public Member Functions

 blob_jsoner (double ds)
 
Json::Value operator() (const cluster_node_t &n)
 

Public Attributes

double drift_speed
 

Detailed Description

Definition at line 96 of file JsonClusterTap.cxx.

Constructor & Destructor Documentation

blob_jsoner::blob_jsoner ( double  ds)
inline

Definition at line 100 of file JsonClusterTap.cxx.

Member Function Documentation

Json::Value blob_jsoner::operator() ( const cluster_node_t &  n)
inline

Definition at line 102 of file JsonClusterTap.cxx.

102  {
103  IBlob::pointer iblob = std::get<typename IBlob::pointer>(n.ptr);
104  IAnodeFace::pointer iface = iblob->face();
105  IWirePlane::vector iplanes = iface->planes();
106  IWire::pointer iwire = iplanes[2]->wires()[0];
107  const double xplane = iwire->center().x();
108 
109  // fixme: this is not a particularly portable way to go for all wire geometries.
110  const double xsign = iface->ident() == 0 ? 1.0 : -1.0;
111 
112  ISlice::pointer islice = iblob->slice();
113  // set X based on time with knowledge of local drift
114  // direction as given by the face.
115  double x0 = xplane + xsign * islice->start()*drift_speed;
116 
117  const auto& coords = iface->raygrid();
118 
119  Json::Value ret = Json::objectValue;
120  ret["span"] = islice->span()*drift_speed;
121  ret["ident"] = iblob->ident();
122  ret["value"] = iblob->value();
123  ret["error"] = iblob->uncertainty();
124  ret["faceid"] = iblob->face()->ident();
125  ret["sliceid"] = iblob->slice()->ident();
126  Json::Value jcorners = Json::arrayValue;
127  const auto& blob = iblob->shape();
128  for (const auto& c : blob.corners()) {
129  Json::Value j = jpoint(coords.ray_crossing(c.first, c.second));
130  j[0] = x0;
131  jcorners.append(j);
132  }
133  ret["corners"] = jcorners;
134 
135  //-- strip info is redunant with edges connected to wire vertices.
136  // Json::Value jstrips = Json::arrayValue;
137  // for (const auto& strip : blob.strips()) {
138  // int plane_ind = strip.layer - 2; // fixme
139  // if (plane_ind <0) { continue; }
140  // Json ::Value j = Json::objectValue;
141  // j["wpid"] = iplanes[plane_ind]->planeid().ident();
142  // j["planeind"] = plane_ind;
143  // j["wip1"] = strip.bounds.first;
144  // j["wip2"] = strip.bounds.second;
145  // Json::Value jwires = Json::arrayValue;
146  // const auto& wires = iplanes[plane_ind]->wires();
147  // for (auto wip = strip.bounds.first; wip < strip.bounds.second; ++wip) {
148  // jwires.append(wires[wip]->ident());
149  // }
150  // j["wids"] = jwires;
151  // jstrips.append(j);
152  // }
153  // ret["strips"] = jstrips;
154 
155  return ret;
156  }
struct vector vector
double drift_speed
static Json::Value jpoint(const Point &p)
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2106
const GenericPointer< typename T::ValueType > & pointer
Definition: pointer.h:1124
std::size_t n
Definition: format.h:3399

Member Data Documentation

double blob_jsoner::drift_speed

Definition at line 98 of file JsonClusterTap.cxx.


The documentation for this struct was generated from the following file: