Classes | Functions
WireCell::Response::Schema Namespace Reference

Classes

struct  FieldResponse
 Hold info about multiple plane responses in the detector. More...
 
struct  PathResponse
 
struct  PlaneResponse
 

Functions

FieldResponse load (const char *filename)
 
void dump (const char *filename, const FieldResponse &fr)
 

Function Documentation

void WireCell::Response::Schema::dump ( const char *  filename,
const FieldResponse fr 
)

Definition at line 90 of file Response.cxx.

92 {
93 }
WireCell::Response::Schema::FieldResponse WireCell::Response::Schema::load ( const char *  filename)

frdict['FieldResponse'].keys() ['origin', 'axis', 'period', 'tstart', 'planes']

frdict['FieldResponse']['planes'][0]['PlaneResponse'].keys() ['paths', 'planeid', 'pitch']

frdict['FieldResponse']['planes'][0]['PlaneResponse']['paths'][0]['PathResponse'].keys() ['current', 'wirepos', 'pitchpos']

frdict['FieldResponse']['planes'][0]['PlaneResponse']['paths'][0]['PathResponse']['current']['array'].keys() ['shape', 'elements']

Definition at line 39 of file Response.cxx.

40 {
41  if (!filename) {
42  error("Response::Schema::load(): empty field response file name");
43  return FieldResponse();
44  }
46  if (top.isNull()) {
47  error("Response::Schema::load(): failed to load {}", filename);
48  return FieldResponse();
49  }
50  Json::Value fr = top["FieldResponse"];
51 
52  using namespace WireCell::Response::Schema;
53 
54  std::vector<PlaneResponse> planes;
55  for (auto plane : fr["planes"]) {
56 
57  auto plr = plane["PlaneResponse"];
58 
59  std::vector<PathResponse> paths;
60  for (auto path : plr["paths"]) {
61  auto par = path["PathResponse"];
63  for (auto c : par["current"]["array"]["elements"]) {
64  current.push_back(c.asDouble());
65  }
66  auto wcpath = PathResponse(current, par["pitchpos"].asDouble(), par["wirepos"].asDouble());
67  paths.push_back(wcpath);
68  }
69 
70  PlaneResponse wcplr(paths,
71  plr["planeid"].asInt(),
72  plr["location"].asDouble(),
73  plr["pitch"].asDouble());
74 
75  planes.push_back(wcplr);
76  }
77 
78  auto adir = fr["axis"];
79  auto axis = WireCell::Vector(adir[0].asDouble(),adir[1].asDouble(),adir[2].asDouble());
80  auto ret = FieldResponse(planes, axis,
81  fr["origin"].asDouble(),
82  fr["tstart"].asDouble(),
83  fr["period"].asDouble(),
84  fr["speed"].asDouble());
85  return ret;
86 }
Sequence< real_t > realseq_t
Definition: Waveform.h:31
error
Definition: include.cc:26
string filename
Definition: train.py:213
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2106
Json::Value load(const std::string &filename, const externalvars_t &extvar=externalvars_t(), const externalvars_t &extcode=externalvars_t())
Definition: Persist.cxx:121
static Entry * current
Point Vector
An alias for Point.
Definition: Point.h:18
Hold info about multiple plane responses in the detector.
Definition: Response.h:75