33 : data_word{std::move(_dw)}
36 : data_type{_type}, data_word{_dw}, data{_data}, bus_number{0}, channel{_chan}, ovflw{_ovflw}
39 : data_type{_type}, data_word{_dw}, data{_data}, bus_number{_bus}, channel{_chan}, ovflw{_ovflw}
51 void add_data_to_buffer(std::vector<uint32_t>& buf)
const
53 buf.push_back(data_word);
117 std::vector<channel_data> data;
118 uint32_t event_counter;
119 uint32_t header_word;
122 uint8_t module_id{UNKNOWN};
129 std::cout << std::hex << std::showbase << header_word << std::endl;
130 for (
auto& v : data) std::cout << v.get_data_word() << std::endl;
133 uint32_t get_header_word()
const
168 return data_words ? data_words - 1 : 0;
170 void set_header_word(uint32_t _header_word,
module& mod)
173 header_word = _header_word;
175 mod.set_infos_from_header_word();
177 data_words = mod.length_of_data();
178 if (data_words) data.reserve(data_words);
181 module_data() =
default;
182 ~module_data() =
default;
183 module_data(module_data&&) =
default;
184 module_data(
const module_data&) =
delete;
185 module_data& operator=(
const module_data&) =
delete;
186 module_data& operator=(module_data&&) =
default;
187 void add_data(
module::datatype_t type, uint8_t channel, uint16_t datum, uint32_t data_word,
bool ovflw=
false)
189 data.emplace_back(type, channel, datum, data_word, ovflw);
191 void add_data(
module::datatype_t type, uint8_t busnum, uint8_t channel, uint16_t datum, uint32_t data_word,
bool ovflw=
false)
193 data.emplace_back(type, busnum, channel, datum, data_word, ovflw);
195 void add_data(uint32_t data_word)
197 data.emplace_back(data_word);
202 if (mod.is_mesytec_module()) {
204 for (
auto& d : data) d.ls(cfg, module_id);
206 else if (mod.is_mvlc_scaler()) {
208 assert(data.size() == 4);
211 for (
auto& d : data) x += ((uint64_t)d.get_data_word()) << (16 * (i++));
212 std::cout <<
"mvlc_scaler::" << mod.
name <<
" = " << std::hex << std::showbase << x << std::endl;
215 std::cout << std::endl;
217 void add_data_to_buffer(std::vector<uint32_t>& buf)
const
226 buf.push_back(header_word);
227 for (
auto& v : data) v.add_data_to_buffer(buf);
230 size_t size_of_buffer()
const
236 return data.size() ? data.size() + 1 : 0;
238 bool has_data()
const
240 return data.size() > 0;
268 std::vector<module_data> modules;
269 uint32_t event_counter = 0;
271 bool with_tgv_timestamp =
false;
272 bool with_agava_timestamp =
false;
273 bool with_vtc_timestamp =
false;
274 uint16_t tgv_ts_lo{0}, tgv_ts_mid{0}, tgv_ts_hi{0};
275 uint32_t agava_ts_lo{0}, agava_ts_hi{0};
276 uint32_t vtc_ts_lo{0};
277 uint16_t vtc_ts_hi{0};
278 bool _is_scaler_event =
false;
288 return event_counter;
295 return event_counter;
306 with_agava_timestamp=with_tgv_timestamp=_is_scaler_event=
false;
307 tgv_ts_lo = tgv_ts_mid = tgv_ts_hi = 0;
308 agava_ts_hi = agava_ts_lo = 0;
309 vtc_ts_hi = vtc_ts_lo = 0;
321 modules.push_back(std::move(d));
323 bool is_full(
unsigned int number_of_modules)
const
325 return (modules.size() == number_of_modules);
329 std::cout <<
" Event# " << event_counter << std::endl;
330 for (
auto& m : modules) m.ls(cfg);
332 size_t size_of_buffer()
const
336 for (
auto& v : modules) s += v.size_of_buffer();
339 std::vector<uint32_t> get_output_buffer()
const
343 std::vector<uint32_t> buf;
344 buf.reserve(size_of_buffer());
345 for (
auto& m : modules) m.add_data_to_buffer(buf);
348 bool has_data()
const
350 return modules.size() > 0;
352 bool get_with_tgv_timestamp()
const
354 return with_tgv_timestamp;
356 void set_with_tgv_timestamp(
const bool& _with_tgv_timestamp)
358 with_tgv_timestamp = _with_tgv_timestamp;
360 bool get_with_vtc_timestamp()
const
362 return with_vtc_timestamp;
364 void set_with_vtc_timestamp(
const bool& _with_vtc_timestamp)
366 with_vtc_timestamp = _with_vtc_timestamp;
368 bool get_with_agava_timestamp()
const
370 return with_agava_timestamp;
372 void set_with_agava_timestamp(
const bool& _with_agava_timestamp)
374 with_agava_timestamp = _with_agava_timestamp;
376 uint16_t get_tgv_ts_lo()
const
380 void set_tgv_ts_lo(
const uint16_t& _tgv_ts_lo)
382 tgv_ts_lo = _tgv_ts_lo;
384 uint16_t get_tgv_ts_mid()
const
388 void set_tgv_ts_mid(
const uint16_t& _tgv_ts_mid)
390 tgv_ts_mid = _tgv_ts_mid;
392 uint16_t get_tgv_ts_hi()
const
396 void set_tgv_ts_hi(
const uint16_t& _tgv_ts_hi)
398 tgv_ts_hi = _tgv_ts_hi;
400 uint32_t get_agava_ts_lo()
const
404 void set_agava_ts_lo(
const uint32_t& _agava_ts_lo)
406 agava_ts_lo = _agava_ts_lo;
408 uint32_t get_agava_ts_hi()
const
412 void set_agava_ts_hi(
const uint32_t& _agava_ts_hi)
414 agava_ts_hi = _agava_ts_hi;
416 uint32_t get_vtc_ts_lo()
const
420 void set_vtc_ts_lo(
const uint32_t& _vtc_ts_lo)
422 vtc_ts_lo = _vtc_ts_lo;
424 uint16_t get_vtc_ts_hi()
const
428 void set_vtc_ts_hi(
const uint16_t& _vtc_ts_hi)
430 vtc_ts_hi = _vtc_ts_hi;
432 bool is_scaler_event()
const
435 return _is_scaler_event;
437 void set_is_scaler_event(
bool newIs_scaler_event =
true)
439 _is_scaler_event = newIs_scaler_event;