controls scripts of eiger and debug msgs

This commit is contained in:
lhdamiani
2021-03-05 16:47:18 +01:00
parent edb9b94fa5
commit 22f73b0273
11 changed files with 268 additions and 34 deletions
+3 -5
View File
@@ -157,15 +157,13 @@ BufferUtils::DetectorConfig BufferUtils::read_json_config(
rapidjson::Document config_parameters;
config_parameters.ParseStream(isw);
BufferUtils::DetectorConfig det_config = {
return {
config_parameters["streamvis_stream"].GetString(),
config_parameters["streamvis_rate"].GetInt(),
config_parameters["live_stream"].GetString(),
config_parameters["live_rate"].GetInt(),
// config_parameters["pedestal_file"].GetString(),
"",
// config_parameters["gain_file"].GetString(),
"",
config_parameters["pedestal_file"].GetString(),
config_parameters["gain_file"].GetString(),
config_parameters["detector_name"].GetString(),
config_parameters["n_modules"].GetInt(),
config_parameters["start_udp_port"].GetInt(),
+23 -15
View File
@@ -44,19 +44,6 @@ RamBuffer::RamBuffer(
meta_buffer_ = (ModuleFrame *) buffer_;
// Image buffer start right after metadata buffer.
image_buffer_ = (char*)buffer_ + (meta_bytes_ * n_slots_);
#ifdef DEBUG_OUTPUT
using namespace date;
cout << " [" << std::chrono::system_clock::now();
cout << "] [RamBuffer::RamBuffer] :";
cout << " Details of rambuffer:";
cout << "n_modules: " << n_modules_;
cout << " || meta_bytes: " << meta_bytes_;
cout << " || image_bytes: " << image_bytes_;
cout << " || buffer_bytes: " << buffer_bytes_;
cout << " || n_slots: " << n_slots_;
cout << endl;
#endif
}
RamBuffer::~RamBuffer()
@@ -124,9 +111,22 @@ void RamBuffer::assemble_image(
auto is_pulse_init = false;
auto is_good_image = true;
// for each module it collects the metadata from each frame
for (int i_module=0; i_module < n_modules_; i_module++) {
ModuleFrame *frame_meta = src_meta + i_module;
#ifdef DEBUG_OUTPUT
using namespace date;
cout << " [" << std::chrono::system_clock::now();
cout << "] [RamBuffer::assemble_image] :";
cout << "module_id: " << i_module;
cout << " || frame index: " << frame_meta->frame_index;
cout << " || row: " << frame_meta->row;
cout << " || column: " << frame_meta->column;
cout << " || n_recv_packets: " << frame_meta->n_recv_packets;
cout << endl;
#endif
auto is_good_frame =
frame_meta->n_recv_packets == N_PACKETS_PER_FRAME;
@@ -142,6 +142,7 @@ void RamBuffer::assemble_image(
#endif
continue;
}
// in the first module will enter here and define image metadata
if (!is_pulse_init) {
if (frame_meta->frame_index != pulse_id) {
stringstream err_msg;
@@ -160,11 +161,18 @@ void RamBuffer::assemble_image(
throw runtime_error(err_msg.str());
}
image_meta.pulse_id = frame_meta->pulse_id;
image_meta.frame_index = frame_meta->frame_index;
image_meta.daq_rec = frame_meta->daq_rec;
#ifdef DEBUG_OUTPUT
using namespace date;
cout << " [" << std::chrono::system_clock::now();
cout << "] [RamBuffer::assemble_image] :";
cout << " Defining image_meta";
cout << " || image_meta.frame_index " << image_meta.frame_index;
cout << endl;
#endif
is_pulse_init = 1;
}