47 using namespace std::string_literals;
51 , {
"TriggerWindows", 1U }
57 "TriggerType, S5, Triggers, TriggerWindows, 0C0B,"
58 " TPChits, 12, 130, 0, 0, TPChitTimes, 3, -1.1, -0.3, 0.1, PMThits, 8"s
62 std::vector<int>
const expectedTPChits { 12, 130, 0, 0 };
63 std::vector<float>
const expectedTPCtimes { -1.1, -0.3, 0.1 };
69 BOOST_TEST(data.hasItem(
"TriggerType"));
70 item = data.findItem(
"TriggerType");
72 BOOST_TEST(&(data.getItem(
"TriggerType")) == item);
73 BOOST_TEST(item->nValues() == 1);
74 BOOST_TEST(item->value() ==
"S5");
76 BOOST_TEST(data.hasItem(
"Triggers"));
77 item = data.findItem(
"Triggers");
79 BOOST_TEST(&(data.getItem(
"Triggers")) == item);
80 BOOST_TEST(item->values().empty());
81 BOOST_TEST(item->getVector<
int>().empty());
83 BOOST_TEST(data.hasItem(
"TriggerWindows"));
84 item = data.findItem(
"TriggerWindows");
86 BOOST_TEST(&(data.getItem(
"TriggerWindows")) == item);
87 BOOST_TEST(item->nValues() == 1);
88 BOOST_TEST(item->value(0) ==
"0C0B");
89 BOOST_TEST(item->getNumber<std::uint32_t>(0, 16) == 0x0C0B);
91 BOOST_TEST(data.hasItem(
"TPChits"));
92 item = data.findItem(
"TPChits");
94 BOOST_TEST(&(data.getItem(
"TPChits")) == item);
95 BOOST_TEST(item->nValues() == 4);
96 BOOST_TEST(item->value(0) ==
"12");
97 BOOST_TEST(item->value(1) ==
"130");
98 BOOST_TEST(item->value(2) ==
"0");
99 BOOST_TEST(item->value(3) ==
"0");
100 BOOST_TEST(item->getVector<
int>() == expectedTPChits);
102 BOOST_TEST(data.hasItem(
"TPChitTimes"));
103 item = data.findItem(
"TPChitTimes");
105 BOOST_TEST(&(data.getItem(
"TPChitTimes")) == item);
106 BOOST_TEST(item->nValues() == 4);
107 BOOST_TEST(item->value(0) ==
"3");
108 BOOST_TEST(item->value(1) ==
"-1.1");
109 BOOST_TEST(item->value(2) ==
"-0.3");
110 BOOST_TEST(item->value(3) ==
"0.1");
111 BOOST_TEST(item->getSizedVector<
float>() == expectedTPCtimes);
113 BOOST_TEST(!data.hasItem(
"CRThits"));
114 item = data.findItem(
"CRThits");
132 std::string
triggerType = data.getItem(
"TriggerType").value(0);
135 std::vector<int> triggers = data.getItem(
"Triggers").getVector<
int>();
136 BOOST_TEST(triggers.empty());
138 std::uint32_t triggerWindowBits
139 = data.getItem(
"TriggerWindows").getNumber<std::uint32_t>(0, 16);
140 BOOST_TEST(triggerWindowBits == 0x0C0B);
142 std::vector<int> TPChits = data.getItem(
"TPChits").getVector<
int>();
143 BOOST_TEST(TPChits == expectedTPChits);
145 std::vector<float> TPCtimes
146 = data.getItem(
"TPChitTimes").getSizedVector<
float>();
147 BOOST_TEST(TPCtimes == expectedTPCtimes);
149 std::vector<int> CRThits;
150 BOOST_TEST(!data.hasItem(
"CRThits"));
151 BOOST_TEST(!data.findItem(
"CRThits"));
152 if (
auto const* item = data.findItem(
"CRThits"))
153 CRThits = item->getVector<
int>();
154 BOOST_TEST(CRThits.empty());
static constexpr unsigned int FixedSize
Expected values are missing.
Parser to fill a KeyValuesData structure out of a character buffer.
Representation of a single item of data: a key and several values.
triggerType
Type representing the type(s) of this trigger.
Collection of items with key/values structure.
then echo File list $list not found else cat $list while read file do echo $file sed s
BEGIN_PROLOG could also be cout