cleanup eiger assembler

This commit is contained in:
lhdamiani
2021-07-20 17:35:59 +02:00
parent 52c8a94077
commit 034fd906a4
3 changed files with 48 additions and 38 deletions
-13
View File
@@ -12,14 +12,6 @@ const std::string DETECTOR_TYPE = "eiger";
#define BYTES_PER_PACKET 4144
#define DATA_BYTES_PER_PACKET 4096
// EIGER 1M
// Each packet line is made of 2 chip lines -> [CHIP1]<gap>[CHIP2]
// gaps between chips
// For a 1M:
// 0 gap 1
// gap gap
// 2 gap 3
#define MODULE_X_SIZE 256
#define MODULE_Y_SIZE 512
#define MODULE_N_PIXELS 131072
@@ -29,11 +21,6 @@ const std::string DETECTOR_TYPE = "eiger";
#define GAP_X_EIGERMOD_PIXELS 8
#define GAP_Y_EIGERMOD_PIXELS 36
#define N_BYTES_PER_MODULE_LINE(bit_depth) ((MODULE_X_SIZE * bit_depth) / 8)
#define N_BYTES_PER_MODULE_FRAME(bit_depth) ((MODULE_N_PIXELS * bit_depth) / 8)
// #define N_BYTES_PER_IMAGE_LINE(bit_depth, n_submodules) ((n_submodules / 2 * MODULE_X_SIZE * bit_depth) / 8)
// DR 16
+17 -22
View File
@@ -95,13 +95,8 @@ echo "Starting the ${UDP_SYNC}..."
COUNTER=0
if [ -f "${BUILD_PATH}${UDP_SYNC}" ]; then
if [ -f "${CONFIG_FILE}" ]; then
if [ ${BIT_DEPTH} -ne 0 ]; then
${BUILD_PATH}${UDP_SYNC} ${CONFIG_FILE} ${BIT_DEPTH} &
sleep 0.5
else
echo "Error: ${BIT_DEPTH} can't be zero..."
exit
fi
${BUILD_PATH}${UDP_SYNC} ${CONFIG_FILE} &
sleep 0.5
else
echo "Something went wrong while starting the ${UDP_SYNC}..."
exit
@@ -133,19 +128,19 @@ else
fi
# Start the eiger writer
echo "Starting the ${STD_DET_WRITER}..."
export PATH="/usr/lib64/mpich/bin:${PATH}";
export LD_LIBRARY_PATH="/usr/lib64/mpich/lib:${LD_LIBRARY_PATH}";
# echo "Starting the ${STD_DET_WRITER}..."
# export PATH="/usr/lib64/mpich/bin:${PATH}";
# export LD_LIBRARY_PATH="/usr/lib64/mpich/lib:${LD_LIBRARY_PATH}";
if [ -f "${BUILD_PATH}${STD_DET_WRITER}" ]; then
if [ -f "${CONFIG_FILE}" ]; then
mpiexec -n ${N_MPI_EXEC} ${BUILD_PATH}${STD_DET_WRITER} ${CONFIG_FILE} ${BIT_DEPTH} &
sleep 0.5
else
echo "Something went wrong while starting the ${STD_DET_WRITER}..."
exit
fi
else
echo "Error: ${STD_DET_WRITER} wasn't found..."
exit
fi
# if [ -f "${BUILD_PATH}${STD_DET_WRITER}" ]; then
# if [ -f "${CONFIG_FILE}" ]; then
# mpiexec -n ${N_MPI_EXEC} ${BUILD_PATH}${STD_DET_WRITER} ${CONFIG_FILE} ${BIT_DEPTH} &
# sleep 0.5
# else
# echo "Something went wrong while starting the ${STD_DET_WRITER}..."
# exit
# fi
# else
# echo "Error: ${STD_DET_WRITER} wasn't found..."
# exit
# fi
+31 -3
View File
@@ -17,7 +17,7 @@ EigerAssembler::EigerAssembler(const int n_modules, const int bit_depth):
n_eiger_modules_(n_modules/4),
bit_depth_(bit_depth),
n_bytes_per_frame_(MODULE_N_PIXELS * bit_depth / 8),
n_bytes_per_frame_line_(N_BYTES_PER_MODULE_LINE(bit_depth)),
n_bytes_per_frame_line_(MODULE_X_SIZE * bit_depth) / 8),
n_packets_per_frame_(n_bytes_per_frame_ / DATA_BYTES_PER_PACKET),
n_bytes_per_x_gap_(GAP_X_MODULE_PIXELS * bit_depth / 8),
n_bytes_per_y_gap_(GAP_Y_MODULE_PIXELS * bit_depth / 8),
@@ -127,13 +127,41 @@ void EigerAssembler::assemble_image(const char* src_meta,
(char*)(src_data + source_offset),
n_bytes_per_frame_line_
);
#ifdef DEBUG_OUTPUT
using namespace date;
// verifies the addresses for
// beginning and end of each frame
if (counter < 5 || counter > 508){
cout << " [" << std::chrono::system_clock::now();
cout << "] [MODULE " << i_module;
cout << "] (row " << i_module_row;
cout << ",column " << i_module_column;
cout << ") source_offset" << source_offset;
cout << " || dest_offset " << dest_offset;
cout << " || frame_line " << frame_line;
cout << " || COUNTER " << counter;
cout << endl;
}
#endif
counter += 1;
source_offset += reverse * n_bytes_per_module_line_;
source_offset += reverse * n_bytes_per_frame_line_;
dest_offset += reverse * n_bytes_per_image_line_;
}
line_number += n_lines_per_frame_;
dest_module_line = line_number + n_lines_per_frame_ - 1;
#ifdef DEBUG_OUTPUT
using namespace date;
// if (i_module == 0){
cout << " [" << std::chrono::system_clock::now();
cout << "] [MODULE " << i_module;
cout << "] (row " << i_module_row;
cout << " , column" << i_module_column;
cout << ") || reverse_factor" << reverse_factor;
cout << " || line_number" << line_number;
cout << " || N_RECV_PACKETS" << frame_meta->n_recv_packets;
cout << endl;
// }
#endif
// last module sets the last_image_status_
if (i_module == n_modules_ - 1){