Functions
test_configuration2.cxx File Reference
#include "WireCellUtil/Configuration.h"
#include "WireCellUtil/Persist.h"
#include "WireCellUtil/Testing.h"
#include "WireCellUtil/Point.h"
#include <iostream>

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

int main ( void  )

Definition at line 11 of file test_configuration2.cxx.

12 {
13  string json = R"(
14 [
15  {
16  "data": {
17  "step_size": 1,
18  "tracks": [
19  {
20  "charge": -1,
21  "ray": {
22  "head": {
23  "x": 100,
24  "y": 10,
25  "z": 10
26  },
27  "tail": {
28  "x": 10,
29  "y": 0,
30  "z": 0
31  }
32  },
33  "time": 10
34  },
35  {
36  "charge": -2,
37  "ray": {
38  "head": {
39  "x": 2,
40  "y": -100,
41  "z": 0
42  },
43  "tail": {
44  "x": 1,
45  "y": 0,
46  "z": 0
47  }
48  },
49  "time": 120
50  },
51  {
52  "charge": -3,
53  "ray": {
54  "head": {
55  "x": 11,
56  "y": -50,
57  "z": -30
58  },
59  "tail": {
60  "x": 130,
61  "y": 50,
62  "z": 50
63  }
64  },
65  "time": 99
66  }
67  ]
68  },
69  "type": "TrackDepos"
70  }
71 ]
72 )";
73 
74 
76 
77  for (auto comp: cfg) {
78  Assert(get<string>(comp,"type") == "TrackDepos");
79  Configuration data = comp["data"];
80  Assert(get<double>(data,"step_size") == 1.0);
81  Configuration tracks = data["tracks"];
82  for (auto track : tracks) {
83  Assert(get<double>(track,"charge") < 0);
84  Ray ray = get<Ray>(track,"ray");
85  cerr << ray << endl;
86  }
87  }
88  return 0;
89 }
std::pair< Point, Point > Ray
A line segment running from a first (tail) to a second (head) point.
Definition: Point.h:21
comp
Definition: dbjson.py:31
cfg
Definition: dbjson.py:29
basic_data data
Definition: format.h:764
#define Assert
Definition: Testing.h:7
Json::Value Configuration
Definition: Configuration.h:50
QTextStream & endl(QTextStream &s)