52 std::vector<uint16_t> pulse(13);
53 std::fill(pulse.begin(), pulse.end(), 0);
55 auto peak_signal =
static_cast<uint16_t
>(gRandom->Uniform(0, 1024));
56 pulse[4] = peak_signal;
57 auto last = peak_signal;
58 for (std::size_t sample = 5; sample < 13; sample++) {
62 auto current =
static_cast<uint16_t
>(gRandom->Uniform(0, last));
63 pulse[sample] = current;
67 for (std::size_t sample = 3; sample > 0; sample--) {
71 auto current =
static_cast<uint16_t
>(gRandom->Uniform(0, last));
72 pulse[sample] = current;
76 uint8_t starttime = 12;
77 for (std::size_t currenttime = 12; currenttime > 0; currenttime--) {
78 starttime = currenttime;
79 if (pulse[currenttime]) {
86 std::vector<uint16_t> zerosuppressed;
87 bool bunchstart =
false;
88 for (std::size_t sample = 0; sample < 13; sample++) {
89 if (reversed[sample] == 0) {
96 zerosuppressed.push_back(reversed[sample]);
98 return std::make_tuple(starttime, zerosuppressed, pulse);
113 std::vector<uint16_t> bunch(bunchlength);
114 auto peak_signal =
static_cast<uint16_t
>(gRandom->Uniform(0, 1024));
115 bunch[bunchlength - 2] = peak_signal;
116 bunch[bunchlength - 1] =
static_cast<uint16_t
>(gRandom->Uniform(0, peak_signal));
117 auto last = peak_signal;
118 for (
int sample = bunchlength - 3; sample >= 0; sample--) {
119 auto current =
static_cast<uint16_t
>(gRandom->Uniform(0, last));
120 bunch[sample] = current;
136 for (
int itest = 0; itest < 500; itest++) {
139 auto adcs = testcase.
getADCs();
140 BOOST_CHECK_EQUAL_COLLECTIONS(adcs.begin(), adcs.end(),
reference.begin(),
reference.end());
152 for (
int itest = 0; itest < 500; itest++) {
153 auto length_bunch1 =
static_cast<int>(gRandom->Uniform(3, 5)),
154 length_bunch2 =
static_cast<int>(gRandom->Uniform(3, 5));
155 auto sumbunchlength = length_bunch1 + length_bunch2;
156 auto offset_bunch1 =
static_cast<int>(gRandom->Uniform(0, 13 - sumbunchlength)),
157 offset_bunch2 =
static_cast<int>(gRandom->Uniform(0, 13 - sumbunchlength - offset_bunch1));
160 auto starttime_bunch1 = offset_bunch1 + length_bunch1,
161 starttime_bunch2 = starttime_bunch1 + offset_bunch2 + length_bunch2;
162 std::vector<uint16_t> buffer_reversed{13};
167 auto adcs_timeordered =
getReversed(buffer_reversed);
168 auto adcs_timeseries_reversed = testcase.
getADCs();
169 BOOST_CHECK_EQUAL_COLLECTIONS(adcs_timeseries_reversed.begin(), adcs_timeseries_reversed.end(), adcs_timeordered.begin(), adcs_timeordered.end());