Classes | Functions
JsonClusterTap.cxx File Reference
#include "WireCellImg/JsonClusterTap.h"
#include "WireCellIface/IChannel.h"
#include "WireCellIface/IAnodeFace.h"
#include "WireCellIface/IWire.h"
#include "WireCellIface/IBlob.h"
#include "WireCellIface/ISlice.h"
#include "WireCellIface/IFrame.h"
#include "WireCellUtil/Units.h"
#include "WireCellUtil/String.h"
#include "WireCellUtil/NamedFactory.h"
#include <fstream>

Go to the source code of this file.

Classes

struct  blob_jsoner
 

Functions

 WIRECELL_FACTORY (JsonClusterTap, WireCell::Img::JsonClusterTap, WireCell::IClusterFilter, WireCell::IConfigurable) using namespace WireCell
 
static Json::Value size_stringer (const cluster_node_t &n)
 
static Json::Value jpoint (const Point &p)
 
static Json::Value channel_jsoner (const cluster_node_t &n)
 
static Json::Value wire_jsoner (const cluster_node_t &n)
 
Json::Value slice_jsoner (const cluster_node_t &n)
 
Json::Value measurement_jsoner (const cluster_node_t &n)
 

Function Documentation

static Json::Value channel_jsoner ( const cluster_node_t &  n)
static

Definition at line 68 of file JsonClusterTap.cxx.

69 {
70  IChannel::pointer ich = std::get<typename IChannel::pointer>(n.ptr);
71  Json::Value ret = Json::objectValue;
72  ret["ident"] = ich->ident();
73  ret["index"] = ich->index();
74  ret["wpid"] = ich->planeid().ident();
75  return ret;
76 }
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
static Json::Value jpoint ( const Point p)
static

Definition at line 58 of file JsonClusterTap.cxx.

59 {
60  Json::Value ret;
61  for (int ind=0; ind<3; ++ind) {
62  ret[ind] = p[ind];
63  }
64  return ret;
65 }
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2106
Json::Value measurement_jsoner ( const cluster_node_t &  n)

Definition at line 176 of file JsonClusterTap.cxx.

177 {
178  IChannel::shared_vector ichv = std::get<IChannel::shared_vector>(n.ptr);
179  Json::Value ret = Json::objectValue;
180  Json::Value j = Json::arrayValue;
181  for (auto ich : *ichv) {
182  j.append(ich->ident());
183  ret["wpid"] = ich->planeid().ident(); // last one wins, but they should all be the same
184  }
185  ret["chids"] = j;
186  return ret;
187 }
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2106
std::size_t n
Definition: format.h:3399
static Json::Value size_stringer ( const cluster_node_t &  n)
static

Definition at line 52 of file JsonClusterTap.cxx.

53 {
54  return Json::nullValue;
55 }
Json::Value slice_jsoner ( const cluster_node_t &  n)

Definition at line 159 of file JsonClusterTap.cxx.

160 {
161  ISlice::pointer islice = std::get<typename ISlice::pointer>(n.ptr);
162  Json::Value ret = Json::objectValue;
163 
164  ret["ident"] = islice->ident();
165  ret["frameid"] = islice->frame()->ident();
166  ret["start"] = islice->start();
167  ret["span"] = islice->span();
168  Json::Value jact = Json::objectValue;
169  for (const auto& it : islice->activity()) {
170  jact[String::format("%d", it.first->ident())] = it.second;
171  }
172  ret["activity"] = jact;
173  return ret;
174 }
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
static Json::Value wire_jsoner ( const cluster_node_t &  n)
static

Definition at line 79 of file JsonClusterTap.cxx.

80 {
81  IWire::pointer iwire = std::get<typename IWire::pointer>(n.ptr);
82  Json::Value ret = Json::objectValue;
83  ret["ident"] = iwire->ident();
84  ret["index"] = iwire->index();
85  ret["wpid"] = iwire->planeid().ident();
86  ret["chid"] = iwire->channel();
87  ret["seg"] = iwire->segment();
88  auto r = iwire->ray();
89  ret["tail"] = jpoint(r.first);
90  ret["head"] = jpoint(r.second);
91  return ret;
92 }
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
WIRECELL_FACTORY ( JsonClusterTap  ,
WireCell::Img::JsonClusterTap  ,
WireCell::IClusterFilter  ,
WireCell::IConfigurable   
)