Public Member Functions | Private Attributes | List of all members
JsonEvent Class Reference

#include <raygrid_dump.h>

Public Member Functions

 JsonEvent (const WireCell::RayGrid::Coordinates &coords)
 
void operator() (const Point &pt, double charge=1.0)
 
Json::Value convert (const WireCell::RayGrid::crossing_t &corner, double x)
 
Json::Value convert (const WireCell::RayGrid::crossings_t &corners, double x)
 
void operator() (const WireCell::RayGrid::Blob &blob, double x, double charge=1.0, int slice=1, int number=0)
 
void dump (const std::string &filename)
 

Private Attributes

const WireCell::RayGrid::Coordinatescoords
 
Json::Value blobs
 
Json::Value points
 

Detailed Description

Definition at line 4 of file raygrid_dump.h.

Constructor & Destructor Documentation

JsonEvent::JsonEvent ( const WireCell::RayGrid::Coordinates coords)
inline

Definition at line 9 of file raygrid_dump.h.

9 : coords(coords) {}
const WireCell::RayGrid::Coordinates & coords
Definition: raygrid_dump.h:5

Member Function Documentation

Json::Value JsonEvent::convert ( const WireCell::RayGrid::crossing_t corner,
double  x 
)
inline

Definition at line 23 of file raygrid_dump.h.

24  {
25  Json::Value jcorner = Json::arrayValue;
26  auto pt = coords.ray_crossing(corner.first, corner.second);
27  jcorner.append(x);
28  jcorner.append(pt.y());
29  jcorner.append(pt.z());
30  return jcorner;
31  }
const WireCell::RayGrid::Coordinates & coords
Definition: raygrid_dump.h:5
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2106
Vector ray_crossing(const coordinate_t &one, const coordinate_t &two) const
Definition: RayGrid.cxx:122
list x
Definition: train.py:276
Json::Value JsonEvent::convert ( const WireCell::RayGrid::crossings_t corners,
double  x 
)
inline

Definition at line 33 of file raygrid_dump.h.

34  {
35  Json::Value jcorners = Json::arrayValue;
36  for (const auto& corner : corners) {
37  jcorners.append(convert(corner, x));
38  }
39  return jcorners;
40  }
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2106
Json::Value convert(const WireCell::RayGrid::crossing_t &corner, double x)
Definition: raygrid_dump.h:23
list x
Definition: train.py:276
void JsonEvent::dump ( const std::string filename)
inline

Definition at line 52 of file raygrid_dump.h.

52  {
54  top["points"] = points;
55  top["blobs"] = blobs;
56  ofstream fstr(filename);
57  fstr << top;
58  }
Json::Value blobs
Definition: raygrid_dump.h:6
string filename
Definition: train.py:213
Json::Value points
Definition: raygrid_dump.h:6
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2106
void JsonEvent::operator() ( const Point pt,
double  charge = 1.0 
)
inline

Definition at line 11 of file raygrid_dump.h.

11  {
12  Json::Value jpt;
13  jpt[0] = pt.x();
14  jpt[1] = pt.y();
15  jpt[2] = pt.z();
16  Json::Value jpv;
17  jpv["point"] = jpt;
18  jpv["values"]["charge"] = charge;
19  points.append(jpv);
20  }
Json::Value points
Definition: raygrid_dump.h:6
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2106
void JsonEvent::operator() ( const WireCell::RayGrid::Blob blob,
double  x,
double  charge = 1.0,
int  slice = 1,
int  number = 0 
)
inline

Definition at line 42 of file raygrid_dump.h.

43  {
44  Json::Value jblob;
45  jblob["points"] = convert(blob.corners(), x);
46  jblob["values"]["charge"] = charge;
47  jblob["values"]["slice"] = slice;
48  jblob["values"]["number"] = number;
49  blobs.append(jblob);
50  }
Json::Value blobs
Definition: raygrid_dump.h:6
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2106
Json::Value convert(const WireCell::RayGrid::crossing_t &corner, double x)
Definition: raygrid_dump.h:23
list x
Definition: train.py:276
const crossings_t & corners() const
Definition: RayTiling.cxx:202

Member Data Documentation

Json::Value JsonEvent::blobs
private

Definition at line 6 of file raygrid_dump.h.

const WireCell::RayGrid::Coordinates& JsonEvent::coords
private

Definition at line 5 of file raygrid_dump.h.

Json::Value JsonEvent::points
private

Definition at line 6 of file raygrid_dump.h.


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