#ifndef SF_DAQ_BUFFER_DATA_HPP #define SF_DAQ_BUFFER_DATA_HPP #include #include #include "buffer_config.hpp" auto get_test_block_metadata( const uint64_t start_pulse_id, const uint64_t stop_pulse_id, const int pulse_id_step) { using namespace std; using namespace buffer_config; auto metadata = make_shared(); uint64_t block_id = start_pulse_id / BUFFER_BLOCK_SIZE; metadata->block_start_pulse_id = block_id * BUFFER_BLOCK_SIZE; metadata->block_stop_pulse_id = metadata->block_start_pulse_id + BUFFER_BLOCK_SIZE - 1; if (metadata->block_stop_pulse_id < stop_pulse_id) { throw runtime_error("stop_pulse_id in next block"); } auto offset = start_pulse_id - metadata->block_start_pulse_id; for (uint64_t pulse_id = start_pulse_id; pulse_id <= stop_pulse_id; pulse_id++, offset++) { if (pulse_id % pulse_id_step != 0) { metadata->is_good_image[offset] = 0; continue; } metadata->pulse_id[offset] = pulse_id; metadata->frame_index[offset] = pulse_id + 10; metadata->daq_rec[offset] = pulse_id + 100; metadata->is_good_image[offset] = 1; } return metadata; } auto get_test_block_data(const size_t n_modules) { using namespace std; using namespace buffer_config; auto image_buffer = make_unique( MODULE_N_PIXELS * n_modules * BUFFER_BLOCK_SIZE); for (int i_block=0; i_block<=BUFFER_BLOCK_SIZE; i_block++) { for (int i_module=0; i_module