more debug info. bunch/pulseid adjusts.

This commit is contained in:
2021-02-12 16:58:02 +01:00
parent 64a92eb3cd
commit 1de8f66bdc
9 changed files with 114 additions and 41 deletions
+15
View File
@@ -3,6 +3,7 @@
#include <string>
#include <vector>
#include <ostream>
namespace BufferUtils
{
@@ -19,6 +20,20 @@ namespace BufferUtils
const int n_modules;
const int start_udp_port;
const std::string buffer_folder;
friend std::ostream& operator <<(std::ostream& os, DetectorConfig const& det_config)
{
return os << det_config.streamvis_address << ' '
<< det_config.reduction_factor_streamvis << ' '
<< det_config.live_analysis_address << ' '
<< det_config.reduction_factor_live_analysis << ' '
<< det_config.PEDE_FILENAME << ' '
<< det_config.GAIN_FILENAME << ' '
<< det_config.detector_name << ' '
<< det_config.n_modules << ' '
<< det_config.start_udp_port << ' '
<< det_config.buffer_folder << ' ';
}
};
+6 -2
View File
@@ -6,8 +6,12 @@
#define N_MODULES 1
#define BYTES_PER_PACKET 1072
#define DATA_BYTES_PER_PACKET 1024
#define N_PACKETS_PER_FRAME 128
#define DATA_BYTES_PER_FRAME 131072
// DR 16
#define N_PACKETS_PER_FRAME 256
#define DATA_BYTES_PER_FRAME 262144
// DR 32
// #define N_PACKETS_PER_FRAME 512
// #define DATA_BYTES_PER_FRAME 524288
#pragma pack(push)
#pragma pack(2)
+1 -1
View File
@@ -10,7 +10,7 @@
#endif
#ifdef DEBUG_OUTPUT
#define EIGER_DATA_BYTES_PER_PACKET_VALIDATION 131072
#define EIGER_DATA_BYTES_PER_PACKET_VALIDATION 262144
#define JUNGFRAU_DATA_BYTES_PER_PACKET_VALIDATION 1048576
#endif
+28 -9
View File
@@ -4,7 +4,10 @@
#include <buffer_config.hpp>
#include <zmq.h>
#include <fstream>
#include <iostream>
#include <stdexcept>
#include <chrono>
#include "date.h"
#include <rapidjson/istreamwrapper.h>
#include <rapidjson/document.h>
#include <rapidjson/stringbuffer.h>
@@ -136,16 +139,32 @@ BufferUtils::DetectorConfig BufferUtils::read_json_config(
rapidjson::Document config_parameters;
config_parameters.ParseStream(isw);
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(),
BufferUtils::DetectorConfig det_config = {
// config_parameters["streamvis_stream"].GetString(),
"",
// config_parameters["streamvis_rate"].GetInt(),
-1,
// config_parameters["live_stream"].GetString(),
"",
// config_parameters["live_rate"].GetInt(),
-1,
// 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(),
config_parameters["buffer_folder"].GetString()
};
// config_parameters["buffer_folder"].GetString()
""
};
#ifdef DEBUG_OUTPUT
using namespace date;
cout << " [" << std::chrono::system_clock::now();
cout << "] [BufferUtils::read_json_config] Config:";
cout << det_config;
cout << endl;
#endif
return det_config;
}
+30 -1
View File
@@ -5,6 +5,9 @@
#include <unistd.h>
#include "RamBuffer.hpp"
#include "buffer_config.hpp"
#include "date.h"
#include <chrono>
#include <iostream>
using namespace std;
@@ -40,6 +43,19 @@ 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()
@@ -53,7 +69,8 @@ void RamBuffer::write_frame(
const ModuleFrame& src_meta,
const char *src_data) const
{
const int slot_n = src_meta.pulse_id % n_slots_;
const int slot_n = src_meta.frame_index % n_slots_;
ModuleFrame *dst_meta = meta_buffer_ +
(n_modules_ * slot_n) +
@@ -63,6 +80,18 @@ void RamBuffer::write_frame(
(image_bytes_ * slot_n) +
(MODULE_N_BYTES * src_meta.module_id);
#ifdef DEBUG_OUTPUT
using namespace date;
cout << " [" << std::chrono::system_clock::now();
cout << "] [RamBuffer::write_frame] :";
cout << " || src_meta.frame_index " << src_meta.frame_index;
cout << " || src_meta.n_recv_packets " << src_meta.n_recv_packets;
cout << " || src_meta.daq_rec " << src_meta.daq_rec;
cout << " || src_meta.module_id " << src_meta.module_id;
cout << " || dst_data " << dst_data;
cout << endl;
#endif
memcpy(dst_meta, &src_meta, sizeof(ModuleFrame));
memcpy(dst_data, src_data, MODULE_N_BYTES);
}