From 034fd906a4b6b4be9e6bc1d75ab4bdc94f2ede7b Mon Sep 17 00:00:00 2001 From: lhdamiani Date: Tue, 20 Jul 2021 17:35:59 +0200 Subject: [PATCH] cleanup eiger assembler --- core-buffer/include/eiger.hpp | 13 ---------- eiger/sf-daq-4/control/start_daq.sh | 39 +++++++++++++---------------- jf-assembler/src/EigerAssembler.cpp | 34 ++++++++++++++++++++++--- 3 files changed, 48 insertions(+), 38 deletions(-) diff --git a/core-buffer/include/eiger.hpp b/core-buffer/include/eiger.hpp index 6283cdc..c890732 100644 --- a/core-buffer/include/eiger.hpp +++ b/core-buffer/include/eiger.hpp @@ -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][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 diff --git a/eiger/sf-daq-4/control/start_daq.sh b/eiger/sf-daq-4/control/start_daq.sh index 82c6b6f..8538d55 100755 --- a/eiger/sf-daq-4/control/start_daq.sh +++ b/eiger/sf-daq-4/control/start_daq.sh @@ -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 \ No newline at end of file +# 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 \ No newline at end of file diff --git a/jf-assembler/src/EigerAssembler.cpp b/jf-assembler/src/EigerAssembler.cpp index 934f667..98a046b 100644 --- a/jf-assembler/src/EigerAssembler.cpp +++ b/jf-assembler/src/EigerAssembler.cpp @@ -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){