mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-14 05:47:14 +02:00
Compare commits
3 Commits
2022.05.12
...
externalpy
Author | SHA1 | Date | |
---|---|---|---|
12c5844bc9 | |||
3db8f9957c | |||
6bad9e9f31 |
152
CMakeLists.txt
152
CMakeLists.txt
@ -8,8 +8,13 @@ set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
|
||||
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
include(cmake/project_version.cmake)
|
||||
|
||||
#functions to add compiler flags
|
||||
include(cmake/SlsAddFlag.cmake)
|
||||
|
||||
include(cmake/SlsFindZeroMQ.cmake)
|
||||
|
||||
# Include additional modules that are used unconditionally
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# If conda build, always set lib dir to 'lib'
|
||||
@ -23,7 +28,7 @@ string(TOLOWER "${PROJECT_NAME}" PROJECT_NAME_LOWER)
|
||||
|
||||
# Set targets export name (used by slsDetectorPackage and dependencies)
|
||||
set(TARGETS_EXPORT_NAME "${PROJECT_NAME_LOWER}-targets")
|
||||
set(namespace "sls::")
|
||||
#set(namespace "${PROJECT_NAME}::")
|
||||
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
||||
|
||||
@ -34,8 +39,6 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
||||
set(SLS_MASTER_PROJECT ON)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
option(SLS_USE_HDF5 "HDF5 File format" OFF)
|
||||
option(SLS_BUILD_SHARED_LIBRARIES "Build shared libaries" ON)
|
||||
option(SLS_USE_TEXTCLIENT "Text Client" ON)
|
||||
@ -68,19 +71,6 @@ if(SLS_BUILD_ONLY_MOENCH)
|
||||
endif()
|
||||
|
||||
|
||||
option(SLS_EXT_BUILD "external build of part of the project" OFF)
|
||||
if(SLS_EXT_BUILD)
|
||||
message(STATUS "External build using already installed libraries")
|
||||
set(SLS_BUILD_SHARED_LIBRARIES OFF CACHE BOOL "Should already exist" FORCE)
|
||||
set(SLS_USE_TEXTCLIENT OFF CACHE BOOL "Should already exist" FORCE)
|
||||
set(SLS_USE_DETECTOR OFF CACHE BOOL "Should already exist" FORCE)
|
||||
set(SLS_USE_RECEIVER OFF CACHE BOOL "Should already exist" FORCE)
|
||||
set(SLS_USE_RECEIVER_BINARIES OFF CACHE BOOL "Should already exist" FORCE)
|
||||
set(SLS_MASTER_PROJECT OFF CACHE BOOL "No master proj in case of extbuild" FORCE)
|
||||
endif()
|
||||
|
||||
#Maybe have an option guarding this?
|
||||
set(SLS_INTERNAL_RAPIDJSON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libs/rapidjson)
|
||||
|
||||
set(ClangFormat_EXCLUDE_PATTERNS "build/"
|
||||
"libs/"
|
||||
@ -92,6 +82,9 @@ set(ClangFormat_EXCLUDE_PATTERNS "build/"
|
||||
${CMAKE_BINARY_DIR})
|
||||
find_package(ClangFormat)
|
||||
|
||||
|
||||
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
@ -110,68 +103,63 @@ else()
|
||||
endif()
|
||||
|
||||
|
||||
if(SLS_EXT_BUILD)
|
||||
# Find ourself in case of external build
|
||||
find_package(slsDetectorPackage ${PROJECT_VERSION} REQUIRED)
|
||||
endif()
|
||||
|
||||
#Add two fake libraries to manage options
|
||||
add_library(slsProjectOptions INTERFACE)
|
||||
add_library(slsProjectWarnings INTERFACE)
|
||||
target_compile_features(slsProjectOptions INTERFACE cxx_std_11)
|
||||
target_compile_options(slsProjectWarnings INTERFACE
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wno-unused-parameter
|
||||
# -Wold-style-cast
|
||||
-Wnon-virtual-dtor
|
||||
-Woverloaded-virtual
|
||||
-Wdouble-promotion
|
||||
-Wformat=2
|
||||
-Wredundant-decls
|
||||
# -Wconversion
|
||||
-Wvla
|
||||
-Wdouble-promotion
|
||||
-Werror=return-type
|
||||
)
|
||||
|
||||
#Settings for C code
|
||||
add_library(slsProjectCSettings INTERFACE)
|
||||
target_compile_options(slsProjectCSettings INTERFACE
|
||||
-std=gnu99 #fixed
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wno-unused-parameter
|
||||
-Wdouble-promotion
|
||||
-Wformat=2
|
||||
-Wredundant-decls
|
||||
-Wdouble-promotion
|
||||
-Werror=return-type
|
||||
)
|
||||
|
||||
|
||||
|
||||
# slsProjectOptions and slsProjectWarnings are used
|
||||
# to control options for the libraries
|
||||
if(NOT TARGET slsProjectOptions)
|
||||
add_library(slsProjectOptions INTERFACE)
|
||||
target_compile_features(slsProjectOptions INTERFACE cxx_std_11)
|
||||
endif()
|
||||
|
||||
if (NOT TARGET slsProjectWarnings)
|
||||
add_library(slsProjectWarnings INTERFACE)
|
||||
target_compile_options(slsProjectWarnings INTERFACE
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wno-unused-parameter
|
||||
# -Wold-style-cast
|
||||
-Wnon-virtual-dtor
|
||||
-Woverloaded-virtual
|
||||
-Wdouble-promotion
|
||||
-Wformat=2
|
||||
-Wredundant-decls
|
||||
# -Wconversion
|
||||
-Wvla
|
||||
-Wdouble-promotion
|
||||
-Werror=return-type
|
||||
)
|
||||
# Add or disable warnings depending on if the compiler supports them
|
||||
# The function checks internally and sets HAS_warning-name
|
||||
sls_enable_cxx_warning("-Wnull-dereference")
|
||||
sls_enable_cxx_warning("-Wduplicated-cond")
|
||||
sls_disable_cxx_warning("-Wclass-memaccess")
|
||||
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
target_compile_options(slsProjectWarnings INTERFACE
|
||||
-Wno-missing-field-initializers)
|
||||
#Testing for minimum version for compilers
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.2)
|
||||
message(FATAL_ERROR "Clang version must be at least 3.2!")
|
||||
endif()
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
|
||||
message(FATAL_ERROR "GCC version must be at least 4.8!")
|
||||
endif()
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5)
|
||||
target_compile_options(slsProjectWarnings INTERFACE
|
||||
-Wno-missing-field-initializers)
|
||||
endif()
|
||||
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
if (NOT TARGET slsProjectCSettings)
|
||||
#Settings for C code
|
||||
add_library(slsProjectCSettings INTERFACE)
|
||||
target_compile_options(slsProjectCSettings INTERFACE
|
||||
-std=gnu99 #fixed
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wno-unused-parameter
|
||||
-Wdouble-promotion
|
||||
-Wformat=2
|
||||
-Wredundant-decls
|
||||
-Wdouble-promotion
|
||||
-Werror=return-type
|
||||
)
|
||||
sls_disable_c_warning("-Wstringop-truncation")
|
||||
endif()
|
||||
# Add or disable warnings depending on if the compiler supports them
|
||||
# The function checks internally and sets HAS_warning-name
|
||||
sls_enable_cxx_warning("-Wnull-dereference")
|
||||
sls_enable_cxx_warning("-Wduplicated-cond")
|
||||
sls_disable_cxx_warning("-Wclass-memaccess")
|
||||
sls_disable_c_warning("-Wstringop-truncation")
|
||||
|
||||
|
||||
if(SLS_USE_SANITIZER)
|
||||
@ -186,14 +174,19 @@ if(SLS_TUNE_LOCAL)
|
||||
endif()
|
||||
|
||||
|
||||
if(SLS_MASTER_PROJECT)
|
||||
install(TARGETS slsProjectOptions slsProjectWarnings
|
||||
#rapidjson
|
||||
add_library(rapidjson INTERFACE)
|
||||
target_include_directories(rapidjson INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/libs/rapidjson>
|
||||
)
|
||||
|
||||
# Install fake the libraries
|
||||
install(TARGETS slsProjectOptions slsProjectWarnings rapidjson
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
set(CMAKE_INSTALL_RPATH $ORIGIN)
|
||||
@ -209,9 +202,8 @@ if (SLS_USE_TESTS)
|
||||
endif(SLS_USE_TESTS)
|
||||
|
||||
|
||||
if(NOT SLS_EXT_BUILD)
|
||||
add_subdirectory(slsSupportLib)
|
||||
endif()
|
||||
# Common functionallity to detector and receiver
|
||||
add_subdirectory(slsSupportLib)
|
||||
|
||||
if (SLS_USE_DETECTOR OR SLS_USE_TEXTCLIENT)
|
||||
add_subdirectory(slsDetectorSoftware)
|
||||
@ -234,8 +226,6 @@ if (SLS_USE_INTEGRATION_TESTS)
|
||||
endif (SLS_USE_INTEGRATION_TESTS)
|
||||
|
||||
if (SLS_USE_PYTHON)
|
||||
find_package (Python 3.6 COMPONENTS Interpreter Development)
|
||||
add_subdirectory(libs/pybind11 ${CMAKE_BINARY_DIR}/bin/)
|
||||
add_subdirectory(python)
|
||||
endif(SLS_USE_PYTHON)
|
||||
|
||||
|
@ -62,13 +62,12 @@ This document describes the differences between v7.0.0 and v6.x.x
|
||||
- m3 polarity, interpolation (enables all counters when enabled), pump probe, analog pulsing, digital pulsing
|
||||
- updatedetectorserver - removes old server current binary pointing to for blackfin
|
||||
- removing copydetectorserver using tftp
|
||||
>>>>>>> developer
|
||||
- registerCallBackRawDataReady and registerCallBackRawDataModifyReady now gives a sls_receiver_header* instead of a char*, and uint32_t to size_t
|
||||
- registerCallBackStartAcquisition gave incorrect imagesize (+120 bytes). corrected.
|
||||
- registerCallBackStartAcquisition parameter is a const string reference
|
||||
- m3 (runnig config second time with tengiga 0, dr !=32, counters !=0x7) calculated incorrect image size expected
|
||||
- fixed row column indexing (mainly for multi module Jungfrau 2 interfaces )
|
||||
- eiger gui row indices not flipped anymore (fix in config)
|
||||
- m3 (settings dac check disabled temporarily?)
|
||||
|
||||
|
||||
2. Resolved Issues
|
||||
==================
|
||||
|
Submodule libs/pybind11 updated: 914c06fb25...8de7772cc7
@ -1,6 +1,17 @@
|
||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
|
||||
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
||||
#if we are only building the python extension
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
project(slsdet)
|
||||
find_package(slsDetectorPackage 6 REQUIRED)
|
||||
endif()
|
||||
|
||||
|
||||
find_package (Python 3.6 COMPONENTS Interpreter Development)
|
||||
add_subdirectory(../libs/pybind11 ${CMAKE_BINARY_DIR}/bin/)
|
||||
|
||||
pybind11_add_module(_slsdet
|
||||
src/main.cpp
|
||||
src/enums.cpp
|
||||
|
@ -56,8 +56,7 @@ foreach(exe ${MOENCH_EXECUTABLES})
|
||||
../dataStructures
|
||||
../interpolations
|
||||
../../slsReceiverSoftware/include/
|
||||
../../slsSupportLib/include/
|
||||
${SLS_INTERNAL_RAPIDJSON_DIR}
|
||||
../../slsSupportLib/include/
|
||||
)
|
||||
|
||||
target_link_libraries(${exe}
|
||||
|
Binary file not shown.
@ -2060,8 +2060,8 @@ void *start_timer(void *arg) {
|
||||
header->frameNumber = frameNr + iframes;
|
||||
header->packetNumber = i;
|
||||
header->modId = 0;
|
||||
header->row = detPos[Y];
|
||||
header->column = detPos[X];
|
||||
header->row = detPos[X];
|
||||
header->column = detPos[Y];
|
||||
|
||||
// fill data
|
||||
memcpy(packetData + sizeof(sls_detector_header),
|
||||
|
@ -1095,19 +1095,19 @@ int *Beb_GetDetectorPosition() { return Beb_positions; }
|
||||
int Beb_SetDetectorPosition(int pos[]) {
|
||||
if (!Beb_activated)
|
||||
return OK;
|
||||
LOG(logINFO, ("Setting Position: (%d, %d)\n", pos[X], pos[Y]));
|
||||
LOG(logINFO, ("Got Position values %d %d...\n", pos[0], pos[1]));
|
||||
|
||||
// save positions
|
||||
Beb_positions[Y] = pos[Y];
|
||||
Beb_positions[X] = pos[X];
|
||||
Beb_positions[0] = pos[0];
|
||||
Beb_positions[1] = pos[1];
|
||||
|
||||
// get left and right
|
||||
int posLeft[2] = {Beb_top ? pos[X] : pos[X] + 1, pos[Y]};
|
||||
int posRight[2] = {Beb_top ? pos[X] + 1 : pos[X], pos[Y]};
|
||||
int posLeft[2] = {pos[0], Beb_top ? pos[1] : pos[1] + 1};
|
||||
int posRight[2] = {pos[0], Beb_top ? pos[1] + 1 : pos[1]};
|
||||
|
||||
if (Beb_quadEnable) {
|
||||
posRight[Y] = 1; // right is next row
|
||||
posRight[X] = 0; // right same first column
|
||||
posRight[0] = 1; // right is next row
|
||||
posRight[1] = 0; // right same first column
|
||||
}
|
||||
|
||||
int ret = FAIL;
|
||||
@ -1122,7 +1122,7 @@ int Beb_SetDetectorPosition(int pos[]) {
|
||||
uint32_t value = 0;
|
||||
ret = OK;
|
||||
// x left
|
||||
int posval = Beb_swap_uint16(posLeft[Y]);
|
||||
int posval = Beb_swap_uint16(posLeft[0]);
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_A_LEFT_OFST);
|
||||
value &= UDP_HEADER_ID_MSK; // to keep previous id value
|
||||
Beb_Write32(csp0base, UDP_HEADER_A_LEFT_OFST,
|
||||
@ -1134,7 +1134,7 @@ int Beb_SetDetectorPosition(int pos[]) {
|
||||
ret = FAIL;
|
||||
}
|
||||
// x right
|
||||
posval = Beb_swap_uint16(posRight[Y]);
|
||||
posval = Beb_swap_uint16(posRight[0]);
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_A_RIGHT_OFST);
|
||||
value &= UDP_HEADER_ID_MSK; // to keep previous id value
|
||||
Beb_Write32(csp0base, UDP_HEADER_A_RIGHT_OFST,
|
||||
@ -1147,7 +1147,7 @@ int Beb_SetDetectorPosition(int pos[]) {
|
||||
}
|
||||
|
||||
// y left (column)
|
||||
posval = Beb_swap_uint16(posLeft[X]);
|
||||
posval = Beb_swap_uint16(posLeft[1]);
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_B_LEFT_OFST);
|
||||
value &= UDP_HEADER_Z_MSK; // to keep previous z value
|
||||
Beb_Write32(csp0base, UDP_HEADER_B_LEFT_OFST,
|
||||
@ -1160,7 +1160,7 @@ int Beb_SetDetectorPosition(int pos[]) {
|
||||
}
|
||||
|
||||
// y right
|
||||
posval = Beb_swap_uint16(posRight[X]);
|
||||
posval = Beb_swap_uint16(posRight[1]);
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_B_RIGHT_OFST);
|
||||
value &= UDP_HEADER_Z_MSK; // to keep previous z value
|
||||
Beb_Write32(csp0base, UDP_HEADER_B_RIGHT_OFST,
|
||||
@ -1176,10 +1176,10 @@ int Beb_SetDetectorPosition(int pos[]) {
|
||||
Beb_close(fd, csp0base);
|
||||
}
|
||||
if (ret == OK) {
|
||||
LOG(logINFO, ("Position set to (col, row):\n"
|
||||
LOG(logINFO, ("Position set to...\n"
|
||||
"\tLeft: [%d, %d]\n"
|
||||
"\tRight:[%d, %d]\n",
|
||||
posLeft[X], posLeft[Y], posRight[X], posRight[Y]));
|
||||
posLeft[0], posLeft[1], posRight[0], posRight[1]));
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
Binary file not shown.
@ -19,7 +19,7 @@
|
||||
#include <pthread.h>
|
||||
#include <time.h>
|
||||
#endif
|
||||
extern int portno;
|
||||
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
extern int updateFlag;
|
||||
@ -2473,9 +2473,9 @@ void *start_timer(void *arg) {
|
||||
int maxPacketsPerFrame = (tgEnable ? 4 : 16) * dr;
|
||||
int npixelsx = 256 * 2 * bytesPerPixel;
|
||||
int databytes = 256 * 256 * 2 * bytesPerPixel;
|
||||
int row = eiger_virtual_detPos[Y];
|
||||
int colLeft = top ? eiger_virtual_detPos[X] : eiger_virtual_detPos[X] + 1;
|
||||
int colRight = top ? eiger_virtual_detPos[X] + 1 : eiger_virtual_detPos[X];
|
||||
int row = eiger_virtual_detPos[0];
|
||||
int colLeft = top ? eiger_virtual_detPos[1] : eiger_virtual_detPos[1] + 1;
|
||||
int colRight = top ? eiger_virtual_detPos[1] + 1 : eiger_virtual_detPos[1];
|
||||
|
||||
int readNRows = getReadNRows();
|
||||
if (readNRows == -1) {
|
||||
@ -2548,20 +2548,8 @@ void *start_timer(void *arg) {
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
// to debug multi module geometry (row, column) in virtual servers (all pixels
|
||||
// in a module set to particular value)
|
||||
#ifdef TEST_MOD_GEOMETRY
|
||||
if ((i % 1024) < 512) {
|
||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
||||
top ? (portno % 1900) : ((portno % 1900) + 1);
|
||||
} else {
|
||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
||||
top ? ((portno % 1900) + 1) : (portno % 1900);
|
||||
}
|
||||
#else
|
||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
||||
eiger_virtual_test_mode ? 0xFFE : (uint16_t)pixelVal;
|
||||
#endif
|
||||
break;
|
||||
case 32:
|
||||
*((uint32_t *)(imageData + i * sizeof(uint32_t))) =
|
||||
|
Binary file not shown.
@ -1917,7 +1917,7 @@ int setDetectorPosition(int pos[]) {
|
||||
int ret = OK;
|
||||
|
||||
// row
|
||||
value = detPos[Y];
|
||||
value = detPos[X];
|
||||
bus_w(addr, (bus_r(addr) & ~COORD_ROW_MSK) |
|
||||
((value << COORD_ROW_OFST) & COORD_ROW_MSK));
|
||||
valueRead = ((bus_r(addr) & COORD_ROW_MSK) >> COORD_ROW_OFST);
|
||||
@ -1928,7 +1928,7 @@ int setDetectorPosition(int pos[]) {
|
||||
}
|
||||
|
||||
// col
|
||||
value = detPos[X];
|
||||
value = detPos[Y];
|
||||
bus_w(addr, (bus_r(addr) & ~COORD_COL_MSK) |
|
||||
((value << COORD_COL_OFST) & COORD_COL_MSK));
|
||||
valueRead = ((bus_r(addr) & COORD_COL_MSK) >> COORD_COL_OFST);
|
||||
@ -1939,8 +1939,7 @@ int setDetectorPosition(int pos[]) {
|
||||
}
|
||||
|
||||
if (ret == OK) {
|
||||
LOG(logINFO,
|
||||
("\tPosition set to [%d, %d] #(col, row)\n", detPos[X], detPos[Y]));
|
||||
LOG(logINFO, ("\tPosition set to [%d, %d]\n", detPos[X], detPos[Y]));
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -3096,8 +3095,8 @@ void *start_timer(void *arg) {
|
||||
header->frameNumber = virtual_currentFrameNumber;
|
||||
header->packetNumber = 0;
|
||||
header->modId = virtual_moduleid;
|
||||
header->row = detPos[Y];
|
||||
header->column = detPos[X];
|
||||
header->row = detPos[X];
|
||||
header->column = detPos[Y];
|
||||
// fill data
|
||||
memcpy(packetData + sizeof(sls_detector_header), imageData,
|
||||
datasize);
|
||||
|
Binary file not shown.
Binary file not shown.
@ -21,7 +21,7 @@
|
||||
#include <pthread.h>
|
||||
#include <time.h>
|
||||
#endif
|
||||
extern int portno;
|
||||
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
extern int updateFlag;
|
||||
@ -1621,7 +1621,6 @@ int configureMAC() {
|
||||
|
||||
int setDetectorPosition(int pos[]) {
|
||||
int ret = OK;
|
||||
// row, col
|
||||
uint32_t innerPos[2] = {pos[X], pos[Y]};
|
||||
uint32_t outerPos[2] = {pos[X], pos[Y]};
|
||||
int selInterface = getPrimaryInterface();
|
||||
@ -1631,16 +1630,15 @@ int setDetectorPosition(int pos[]) {
|
||||
("Setting detector position: 1 Interface %s \n(%d, %d)\n",
|
||||
(selInterface ? "Inner" : "Outer"), innerPos[X], innerPos[Y]));
|
||||
} else {
|
||||
// top has row incremented by 1
|
||||
++innerPos[Y];
|
||||
++outerPos[X];
|
||||
LOG(logDEBUG, ("Setting detector position: 2 Interfaces \n"
|
||||
" inner top(%d, %d), outer bottom(%d, %d)\n",
|
||||
innerPos[X], innerPos[Y], outerPos[X], outerPos[Y]));
|
||||
}
|
||||
detPos[0] = innerPos[X];
|
||||
detPos[1] = innerPos[Y];
|
||||
detPos[2] = outerPos[X];
|
||||
detPos[3] = outerPos[Y];
|
||||
detPos[0] = innerPos[0];
|
||||
detPos[1] = innerPos[1];
|
||||
detPos[2] = outerPos[0];
|
||||
detPos[3] = outerPos[1];
|
||||
|
||||
// row
|
||||
// outer
|
||||
@ -1678,8 +1676,8 @@ int setDetectorPosition(int pos[]) {
|
||||
|
||||
if (ret == OK) {
|
||||
if (getNumberofUDPInterfaces() == 1) {
|
||||
LOG(logINFOBLUE, ("Position set to [%d, %d] #(col, row)\n",
|
||||
innerPos[X], innerPos[Y]));
|
||||
LOG(logINFOBLUE,
|
||||
("Position set to [%d, %d]\n", innerPos[X], innerPos[Y]));
|
||||
} else {
|
||||
LOG(logINFOBLUE, (" Inner (top) position set to [%d, %d]\n",
|
||||
innerPos[X], innerPos[Y]));
|
||||
@ -2533,16 +2531,8 @@ void *start_timer(void *arg) {
|
||||
if (i > 0 && i % pixelsPerPacket == 0) {
|
||||
++pixelVal;
|
||||
}
|
||||
// to debug multi module geometry (row, column) in virtual servers (all pixels
|
||||
// in a module set to particular value)
|
||||
#ifdef TEST_MOD_GEOMETRY
|
||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
||||
portno % 1900 + (i >= npixels / 2 ? 1 : 0);
|
||||
#else
|
||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
||||
virtual_image_test_mode ? 0x0FFE : (uint16_t)pixelVal;
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -2567,10 +2557,6 @@ void *start_timer(void *arg) {
|
||||
|
||||
int srcOffset = 0;
|
||||
int srcOffset2 = DATA_BYTES / 2;
|
||||
int row0 = (numInterfaces == 1 ? detPos[1] : detPos[3]);
|
||||
int col0 = (numInterfaces == 1 ? detPos[0] : detPos[2]);
|
||||
int row1 = detPos[1];
|
||||
int col1 = detPos[0];
|
||||
// loop packet (128 packets)
|
||||
for (int i = 0; i != maxPacketsPerFrame; ++i) {
|
||||
|
||||
@ -2590,8 +2576,8 @@ void *start_timer(void *arg) {
|
||||
header->frameNumber = frameNr + iframes;
|
||||
header->packetNumber = pnum;
|
||||
header->modId = 0;
|
||||
header->row = row0;
|
||||
header->column = col0;
|
||||
header->row = detPos[0];
|
||||
header->column = detPos[1];
|
||||
|
||||
// fill data
|
||||
memcpy(packetData + sizeof(sls_detector_header),
|
||||
@ -2617,8 +2603,8 @@ void *start_timer(void *arg) {
|
||||
header->frameNumber = frameNr + iframes;
|
||||
header->packetNumber = pnum;
|
||||
header->modId = 0;
|
||||
header->row = row1;
|
||||
header->column = col1;
|
||||
header->row = detPos[2];
|
||||
header->column = detPos[3];
|
||||
|
||||
// fill data
|
||||
memcpy(packetData2 + sizeof(sls_detector_header),
|
||||
|
Binary file not shown.
@ -1731,8 +1731,8 @@ void *start_timer(void *arg) {
|
||||
header->frameNumber = frameNr + iframes;
|
||||
header->packetNumber = i;
|
||||
header->modId = 0;
|
||||
header->row = detPos[Y];
|
||||
header->column = detPos[X];
|
||||
header->row = detPos[X];
|
||||
header->column = detPos[Y];
|
||||
|
||||
// fill data
|
||||
memcpy(packetData + sizeof(sls_detector_header),
|
||||
|
Binary file not shown.
@ -1411,9 +1411,6 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
|
||||
}
|
||||
|
||||
void validateSettings() {
|
||||
LOG(logWARNING, ("Not validating dac settings temporarily"));
|
||||
return;
|
||||
|
||||
// if any special dac value is changed individually => undefined
|
||||
const int specialDacs[NSPECIALDACS] = SPECIALDACINDEX;
|
||||
int *specialDacValues[] = {defaultDacValue_standard, defaultDacValue_fast,
|
||||
@ -1944,7 +1941,7 @@ int setDetectorPosition(int pos[]) {
|
||||
int ret = OK;
|
||||
|
||||
// row
|
||||
value = detPos[Y];
|
||||
value = detPos[X];
|
||||
bus_w(addr, (bus_r(addr) & ~COORD_ROW_MSK) |
|
||||
((value << COORD_ROW_OFST) & COORD_ROW_MSK));
|
||||
valueRead = ((bus_r(addr) & COORD_ROW_MSK) >> COORD_ROW_OFST);
|
||||
@ -1955,7 +1952,7 @@ int setDetectorPosition(int pos[]) {
|
||||
}
|
||||
|
||||
// col
|
||||
value = detPos[X];
|
||||
value = detPos[Y];
|
||||
bus_w(addr, (bus_r(addr) & ~COORD_COL_MSK) |
|
||||
((value << COORD_COL_OFST) & COORD_COL_MSK));
|
||||
valueRead = ((bus_r(addr) & COORD_COL_MSK) >> COORD_COL_OFST);
|
||||
@ -1966,8 +1963,7 @@ int setDetectorPosition(int pos[]) {
|
||||
}
|
||||
|
||||
if (ret == OK) {
|
||||
LOG(logINFO,
|
||||
("\tPosition set to [%d, %d] #(col, row)\n", detPos[X], detPos[Y]));
|
||||
LOG(logINFO, ("\tPosition set to [%d, %d]\n", detPos[X], detPos[Y]));
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -2389,8 +2385,8 @@ void *start_timer(void *arg) {
|
||||
header->frameNumber = virtual_currentFrameNumber;
|
||||
header->packetNumber = i;
|
||||
header->modId = virtual_moduleid;
|
||||
header->row = detPos[Y];
|
||||
header->column = detPos[X];
|
||||
header->row = detPos[X];
|
||||
header->column = detPos[Y];
|
||||
|
||||
// fill data
|
||||
memcpy(packetData + sizeof(sls_detector_header),
|
||||
|
@ -39,7 +39,6 @@ extern int masterCommandLine;
|
||||
#ifdef EIGERD
|
||||
extern int topCommandLine;
|
||||
#endif
|
||||
int portno = DEFAULT_PORTNO;
|
||||
|
||||
void error(char *msg) { perror(msg); }
|
||||
|
||||
@ -51,6 +50,7 @@ void sigInterruptHandler(int p) {
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
// options
|
||||
int portno = DEFAULT_PORTNO;
|
||||
isControlServer = 1;
|
||||
debugflag = 0;
|
||||
updateFlag = 0;
|
||||
|
@ -62,8 +62,8 @@ int firstUDPDestination = 0;
|
||||
|
||||
int configured = FAIL;
|
||||
char configureMessage[MAX_STR_LENGTH] = "udp parameters not configured yet";
|
||||
int maxYMods = -1;
|
||||
int moduleIndex = -1;
|
||||
int maxydet = -1;
|
||||
int detectorId = -1;
|
||||
|
||||
// Local variables
|
||||
int (*flist[NUM_DET_FUNCTIONS])(int);
|
||||
@ -81,14 +81,27 @@ char scanErrMessage[MAX_STR_LENGTH] = "";
|
||||
/* initialization functions */
|
||||
|
||||
int updateModeAllowedFunction(int file_des) {
|
||||
enum detFuncs allowedFuncs[] = {
|
||||
F_EXEC_COMMAND, F_GET_DETECTOR_TYPE, F_GET_FIRMWARE_VERSION,
|
||||
F_GET_SERVER_VERSION, F_GET_SERIAL_NUMBER, F_WRITE_REGISTER,
|
||||
F_READ_REGISTER, F_LOCK_SERVER, F_GET_LAST_CLIENT_IP,
|
||||
F_PROGRAM_FPGA, F_RESET_FPGA, F_CHECK_VERSION,
|
||||
F_REBOOT_CONTROLLER, F_GET_KERNEL_VERSION, F_UPDATE_KERNEL,
|
||||
F_UPDATE_DETECTOR_SERVER, F_GET_UPDATE_MODE, F_SET_UPDATE_MODE,
|
||||
F_GET_NUM_CHANNELS, F_GET_NUM_INTERFACES, F_ACTIVATE};
|
||||
enum detFuncs allowedFuncs[] = {F_EXEC_COMMAND,
|
||||
F_GET_DETECTOR_TYPE,
|
||||
F_GET_FIRMWARE_VERSION,
|
||||
F_GET_SERVER_VERSION,
|
||||
F_GET_SERIAL_NUMBER,
|
||||
F_WRITE_REGISTER,
|
||||
F_READ_REGISTER,
|
||||
F_LOCK_SERVER,
|
||||
F_GET_LAST_CLIENT_IP,
|
||||
F_PROGRAM_FPGA,
|
||||
F_RESET_FPGA,
|
||||
F_CHECK_VERSION,
|
||||
F_REBOOT_CONTROLLER,
|
||||
F_GET_KERNEL_VERSION,
|
||||
F_UPDATE_KERNEL,
|
||||
F_UPDATE_DETECTOR_SERVER,
|
||||
F_GET_UPDATE_MODE,
|
||||
F_SET_UPDATE_MODE,
|
||||
F_GET_NUM_CHANNELS,
|
||||
F_GET_NUM_INTERFACES,
|
||||
F_ACTIVATE};
|
||||
size_t allowedFuncsSize = sizeof(allowedFuncs) / sizeof(enum detFuncs);
|
||||
|
||||
for (unsigned int i = 0; i < allowedFuncsSize; ++i) {
|
||||
@ -116,7 +129,6 @@ void init_detector() {
|
||||
#ifdef VIRTUAL
|
||||
LOG(logINFO, ("This is a VIRTUAL detector\n"));
|
||||
udpDetails[0].srcip = LOCALHOSTIP_INT;
|
||||
udpDetails[0].srcip2 = LOCALHOSTIP_INT;
|
||||
#endif
|
||||
udpDetails[0].srcport = DEFAULT_UDP_SRC_PORTNO;
|
||||
udpDetails[0].dstport = DEFAULT_UDP_DST_PORTNO;
|
||||
@ -4688,7 +4700,7 @@ int get_read_n_rows(int file_des) {
|
||||
}
|
||||
|
||||
void calculate_and_set_position() {
|
||||
if (maxYMods == -1 || moduleIndex == -1) {
|
||||
if (maxydet == -1 || detectorId == -1) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,
|
||||
"Could not set detector position (did not get multi size).\n");
|
||||
@ -4697,20 +4709,21 @@ void calculate_and_set_position() {
|
||||
}
|
||||
|
||||
// calculating new position
|
||||
int pos[2] = {0, 0};
|
||||
|
||||
int portGeometry[2] = {1, 1};
|
||||
int modulePorts[2] = {1, 1};
|
||||
// position does change for eiger and jungfrau (2 interfaces)
|
||||
#if defined(EIGERD)
|
||||
portGeometry[X] = getNumberofUDPInterfaces(); // horz
|
||||
modulePorts[1] = getNumberofUDPInterfaces(); // horz
|
||||
#elif defined(JUNGFRAUD)
|
||||
portGeometry[Y] = getNumberofUDPInterfaces(); // vert
|
||||
modulePorts[0] = getNumberofUDPInterfaces(); // vert
|
||||
#endif
|
||||
LOG(logDEBUG1, ("moduleIndex:%d maxymods:%d portGeo.x:%d portgeo.y:%d\n",
|
||||
moduleIndex, maxYMods, portGeometry[X], portGeometry[Y]));
|
||||
pos[Y] = (moduleIndex % maxYMods) * portGeometry[Y];
|
||||
pos[X] = (moduleIndex / maxYMods) * portGeometry[X];
|
||||
LOG(logINFO, ("Setting Positions (%d,%d) #(col, row)\n", pos[X], pos[Y]));
|
||||
int maxy = maxydet * modulePorts[0];
|
||||
int pos[2] = {0, 0};
|
||||
// row
|
||||
pos[0] = (detectorId % maxy);
|
||||
// col for horiz. udp ports
|
||||
pos[1] = (detectorId / maxy) * modulePorts[1];
|
||||
|
||||
LOG(logDEBUG, ("Setting Positions (%d,%d)\n", pos[0], pos[1]));
|
||||
if (setDetectorPosition(pos) == FAIL) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Could not set detector position.\n");
|
||||
@ -4722,8 +4735,8 @@ void calculate_and_set_position() {
|
||||
if (udpDetails[0].srcmac == 0) {
|
||||
char dmac[MAC_ADDRESS_SIZE];
|
||||
memset(dmac, 0, MAC_ADDRESS_SIZE);
|
||||
sprintf(dmac, "aa:bb:cc:dd:%02x:%02x", pos[X] & 0xFF,
|
||||
pos[Y] & 0xFF);
|
||||
sprintf(dmac, "aa:bb:cc:dd:%02x:%02x", pos[0] & 0xFF,
|
||||
pos[1] & 0xFF);
|
||||
LOG(logINFO, ("Udp source mac address created: %s\n", dmac));
|
||||
unsigned char a[6];
|
||||
sscanf(dmac, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &a[0], &a[1], &a[2],
|
||||
@ -4742,8 +4755,8 @@ void calculate_and_set_position() {
|
||||
if (udpDetails[0].srcmac2 == 0) {
|
||||
char dmac2[MAC_ADDRESS_SIZE];
|
||||
memset(dmac2, 0, MAC_ADDRESS_SIZE);
|
||||
sprintf(dmac2, "aa:bb:cc:dd:%02x:%02x", (pos[X] + 1) & 0xFF,
|
||||
pos[Y] & 0xFF);
|
||||
sprintf(dmac2, "aa:bb:cc:dd:%02x:%02x", (pos[0] + 1) & 0xFF,
|
||||
pos[1] & 0xFF);
|
||||
LOG(logINFO, ("Udp source mac address2 created: %s\n", dmac2));
|
||||
unsigned char a[6];
|
||||
sscanf(dmac2, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &a[0], &a[1],
|
||||
@ -4771,16 +4784,15 @@ int set_detector_position(int file_des) {
|
||||
|
||||
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
LOG(logDEBUG, ("Setting detector positions: [maxy:%u, modIndex:%u]\n",
|
||||
args[0], args[1]));
|
||||
LOG(logINFO, ("Setting detector positions: [%u, %u]\n", args[0], args[1]));
|
||||
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
// if in update mode, there is no need to do this (also detector not set
|
||||
// up)
|
||||
if (!updateFlag && check_detector_idle("configure mac") == OK) {
|
||||
maxYMods = args[0];
|
||||
moduleIndex = args[1];
|
||||
maxydet = args[0];
|
||||
detectorId = args[1];
|
||||
calculate_and_set_position();
|
||||
}
|
||||
}
|
||||
|
@ -17,8 +17,6 @@ add_library(slsDetectorObject OBJECT
|
||||
target_include_directories(slsDetectorObject PUBLIC
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
|
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
||||
PRIVATE
|
||||
${SLS_INTERNAL_RAPIDJSON_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(slsDetectorObject
|
||||
|
@ -781,7 +781,24 @@ void Detector::startReceiver() { pimpl->Parallel(&Module::startReceiver, {}); }
|
||||
void Detector::stopReceiver() { pimpl->Parallel(&Module::stopReceiver, {}); }
|
||||
|
||||
void Detector::startDetector(Positions pos) {
|
||||
pimpl->startAcquisition(false, pos);
|
||||
auto detector_type = getDetectorType(pos).squash();
|
||||
if (detector_type == defs::MYTHEN3 && size() > 1) {
|
||||
std::vector<int> slaves(pos);
|
||||
auto is_master = getMaster(pos);
|
||||
int masterPosition = -1;
|
||||
for (unsigned int i = 0; i < is_master.size(); ++i) {
|
||||
if (is_master[i]) {
|
||||
masterPosition = i;
|
||||
slaves.erase(slaves.begin() + i);
|
||||
}
|
||||
}
|
||||
pimpl->Parallel(&Module::startAcquisition, pos);
|
||||
if (masterPosition != -1) {
|
||||
pimpl->Parallel(&Module::startAcquisition, {masterPosition});
|
||||
}
|
||||
} else {
|
||||
pimpl->Parallel(&Module::startAcquisition, pos);
|
||||
}
|
||||
}
|
||||
|
||||
void Detector::startDetectorReadout() {
|
||||
|
@ -602,12 +602,14 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
currentSubFrameIndex = zHeader.expLength;
|
||||
coordY = zHeader.row;
|
||||
coordX = zHeader.column;
|
||||
if (eiger) {
|
||||
coordY = (nY - 1) - coordY;
|
||||
}
|
||||
flipRows = zHeader.flipRows;
|
||||
if (zHeader.completeImage == 0) {
|
||||
completeImage = false;
|
||||
}
|
||||
LOG(logDEBUG1)
|
||||
<< zmqSocket[isocket]->GetPortNumber() << " "
|
||||
<< "Header Info:"
|
||||
"\n\tcurrentFileName: "
|
||||
<< currentFileName << "\n\tcurrentAcquisitionIndex: "
|
||||
@ -1124,7 +1126,25 @@ int DetectorImpl::acquire() {
|
||||
|
||||
// start and read all
|
||||
try {
|
||||
startAcquisition(true, {});
|
||||
if (detector_type == defs::MYTHEN3 && modules.size() > 1) {
|
||||
// Multi module mythen
|
||||
std::vector<int> master;
|
||||
std::vector<int> slaves;
|
||||
auto is_master = Parallel(&Module::isMaster, {});
|
||||
slaves.reserve(modules.size() - 1); // check this one!!
|
||||
for (size_t i = 0; i < modules.size(); ++i) {
|
||||
if (is_master[i])
|
||||
master.push_back(i);
|
||||
else
|
||||
slaves.push_back(i);
|
||||
}
|
||||
Parallel(&Module::startAcquisition, slaves);
|
||||
Parallel(&Module::startAndReadAll, master);
|
||||
} else {
|
||||
// Normal acquire
|
||||
Parallel(&Module::startAndReadAll, {});
|
||||
}
|
||||
|
||||
} catch (...) {
|
||||
if (receiver)
|
||||
Parallel(&Module::stopReceiver, {});
|
||||
@ -1173,44 +1193,6 @@ int DetectorImpl::acquire() {
|
||||
return OK;
|
||||
}
|
||||
|
||||
void DetectorImpl::startAcquisition(bool blocking, std::vector<int> positions) {
|
||||
if (shm()->detType == defs::MYTHEN3 && size() > 1) {
|
||||
std::vector<int> master;
|
||||
std::vector<int> slaves;
|
||||
if (positions.empty() ||
|
||||
(positions.size() == 1 && positions[0] == -1)) {
|
||||
positions.resize(modules.size());
|
||||
std::iota(begin(positions), end(positions), 0);
|
||||
}
|
||||
// could be all slaves in positions
|
||||
slaves.reserve(positions.size());
|
||||
auto is_master = Parallel(&Module::isMaster, positions);
|
||||
for (size_t i : positions) {
|
||||
if (is_master[i])
|
||||
master.push_back(i);
|
||||
else
|
||||
slaves.push_back(i);
|
||||
}
|
||||
|
||||
if (!slaves.empty()) {
|
||||
Parallel(&Module::startAcquisition, slaves);
|
||||
}
|
||||
if (!master.empty()) {
|
||||
if (blocking) {
|
||||
Parallel(&Module::startAndReadAll, master);
|
||||
} else {
|
||||
Parallel(&Module::startAcquisition, master);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (blocking) {
|
||||
Parallel(&Module::startAndReadAll, positions);
|
||||
} else {
|
||||
Parallel(&Module::startAcquisition, positions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DetectorImpl::printProgress(double progress) {
|
||||
// spaces for python printout
|
||||
std::cout << " " << std::fixed << std::setprecision(2) << std::setw(6)
|
||||
|
@ -278,9 +278,6 @@ class DetectorImpl : public virtual slsDetectorDefs {
|
||||
*/
|
||||
int acquire();
|
||||
|
||||
/** also takes care of master and slave for multi module mythen */
|
||||
void startAcquisition(bool blocking, std::vector<int> positions);
|
||||
|
||||
/**
|
||||
* Combines data from all readouts and gives it to the gui
|
||||
* or just gives progress of acquisition by polling receivers
|
||||
|
@ -407,18 +407,12 @@ void Module::setAllThresholdEnergy(std::array<int, 3> e_eV,
|
||||
|
||||
// check dacs
|
||||
out_of_range = false;
|
||||
for (int i = 0; i != myMod.ndac; ++i) {
|
||||
int dacMin = 0;
|
||||
int dacMax = 2800;
|
||||
if (i == M_VTH1 || i == M_VTH2 || i == M_VTH3) {
|
||||
dacMin = 200;
|
||||
dacMax = 2400;
|
||||
}
|
||||
if (myMod.dacs[i] < dacMin) {
|
||||
myMod.dacs[i] = dacMin;
|
||||
for (auto dac : {M_VTRIM, M_VTH1, M_VTH2, M_VTH3}) {
|
||||
if (myMod.dacs[dac] < 600) {
|
||||
myMod.dacs[dac] = 600;
|
||||
out_of_range = true;
|
||||
} else if (myMod.dacs[i] > dacMax) {
|
||||
myMod.dacs[i] = dacMax;
|
||||
} else if (myMod.dacs[dac] > 2400) {
|
||||
myMod.dacs[dac] = 2400;
|
||||
out_of_range = true;
|
||||
}
|
||||
}
|
||||
|
@ -40,8 +40,6 @@ add_library(slsReceiverObject OBJECT
|
||||
target_include_directories(slsReceiverObject PUBLIC
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
|
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
||||
PRIVATE
|
||||
${SLS_INTERNAL_RAPIDJSON_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(slsReceiverObject
|
||||
|
@ -17,11 +17,12 @@
|
||||
const std::string DataStreamer::TypeName = "DataStreamer";
|
||||
|
||||
DataStreamer::DataStreamer(int ind, Fifo *f, uint32_t *dr, ROI *r, uint64_t *fi,
|
||||
bool fr, slsDetectorDefs::xy np, bool *qe,
|
||||
bool fr, slsDetectorDefs::xy nm, bool *qe,
|
||||
uint64_t *tot)
|
||||
: ThreadObject(ind, TypeName), fifo(f), dynamicRange(dr), roi(r),
|
||||
fileIndex(fi), flipRows(fr), numPorts(np), quadEnable(qe),
|
||||
totalNumFrames(tot) {
|
||||
fileIndex(fi), flipRows(fr), quadEnable(qe), totalNumFrames(tot) {
|
||||
numMods.x = nm.x;
|
||||
numMods.y = nm.y;
|
||||
|
||||
LOG(logDEBUG) << "DataStreamer " << ind << " created";
|
||||
}
|
||||
@ -62,7 +63,10 @@ void DataStreamer::RecordFirstIndex(uint64_t fnum, char *buf) {
|
||||
|
||||
void DataStreamer::SetGeneralData(GeneralData *g) { generalData = g; }
|
||||
|
||||
void DataStreamer::SetNumberofPorts(xy np) { numPorts = np; }
|
||||
void DataStreamer::SetNumberofModules(xy nm) {
|
||||
numMods.x = nm.x;
|
||||
numMods.y = nm.y;
|
||||
}
|
||||
|
||||
void DataStreamer::SetFlipRows(bool fd) { flipRows = fd; }
|
||||
|
||||
@ -216,8 +220,8 @@ int DataStreamer::SendHeader(sls_receiver_header *rheader, uint32_t size,
|
||||
|
||||
zHeader.dynamicRange = *dynamicRange;
|
||||
zHeader.fileIndex = *fileIndex;
|
||||
zHeader.ndetx = numPorts.x;
|
||||
zHeader.ndety = numPorts.y;
|
||||
zHeader.ndetx = numMods.x;
|
||||
zHeader.ndety = numMods.y;
|
||||
zHeader.npixelsx = nx;
|
||||
zHeader.npixelsy = ny;
|
||||
zHeader.imageSize = size;
|
||||
|
@ -33,12 +33,12 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
||||
* @param r roi
|
||||
* @param fi pointer to file index
|
||||
* @param fr flip rows
|
||||
* @param nm number of ports in each dimension
|
||||
* @param nm number of modules in each dimension
|
||||
* @param qe pointer to quad Enable
|
||||
* @param tot pointer to total number of frames
|
||||
*/
|
||||
DataStreamer(int ind, Fifo *f, uint32_t *dr, ROI *r, uint64_t *fi, bool fr,
|
||||
xy np, bool *qe, uint64_t *tot);
|
||||
xy nm, bool *qe, uint64_t *tot);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
@ -46,11 +46,39 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
||||
*/
|
||||
~DataStreamer();
|
||||
|
||||
/**
|
||||
* Set Fifo pointer to the one given
|
||||
* @param f address of Fifo pointer
|
||||
*/
|
||||
void SetFifo(Fifo *f);
|
||||
|
||||
/**
|
||||
* Reset parameters for new acquisition
|
||||
*/
|
||||
void ResetParametersforNewAcquisition(const std::string &fname);
|
||||
|
||||
/**
|
||||
* Set GeneralData pointer to the one given
|
||||
* @param g address of GeneralData (Detector Data) pointer
|
||||
*/
|
||||
void SetGeneralData(GeneralData *g);
|
||||
void SetNumberofPorts(xy np);
|
||||
|
||||
/**
|
||||
* Set number of detectors
|
||||
* @param nm number of modules/ports in both dimensions
|
||||
*/
|
||||
void SetNumberofModules(xy nm);
|
||||
|
||||
/**
|
||||
* Set Flipped rows
|
||||
* @param fd flip rows enable
|
||||
*/
|
||||
void SetFlipRows(bool fd);
|
||||
|
||||
/**
|
||||
* Set additional json header
|
||||
* @param json additional json header
|
||||
*/
|
||||
void
|
||||
SetAdditionalJsonHeader(const std::map<std::string, std::string> &json);
|
||||
|
||||
@ -115,16 +143,34 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
||||
int SendHeader(sls_receiver_header *rheader, uint32_t size = 0,
|
||||
uint32_t nx = 0, uint32_t ny = 0, bool dummy = true);
|
||||
|
||||
/** type of thread */
|
||||
static const std::string TypeName;
|
||||
|
||||
/** GeneralData (Detector Data) object */
|
||||
const GeneralData *generalData{nullptr};
|
||||
|
||||
/** Fifo structure */
|
||||
Fifo *fifo;
|
||||
|
||||
/** ZMQ Socket - Receiver to Client */
|
||||
ZmqSocket *zmqSocket{nullptr};
|
||||
|
||||
/** Pointer to dynamic range */
|
||||
uint32_t *dynamicRange;
|
||||
|
||||
/** ROI */
|
||||
ROI *roi;
|
||||
|
||||
/** adc Configured */
|
||||
int adcConfigured{-1};
|
||||
|
||||
/** Pointer to file index */
|
||||
uint64_t *fileIndex;
|
||||
|
||||
/** flip rows */
|
||||
bool flipRows;
|
||||
|
||||
/** additional json header */
|
||||
std::map<std::string, std::string> additionalJsonHeader;
|
||||
|
||||
/** Used by streamer thread to update local copy (reduce number of locks
|
||||
@ -143,12 +189,18 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
||||
/** Frame Number of First Frame */
|
||||
uint64_t firstIndex{0};
|
||||
|
||||
/* File name to stream */
|
||||
std::string fileNametoStream;
|
||||
|
||||
/** Complete buffer used for roi, eg. shortGotthard */
|
||||
char *completeBuffer{nullptr};
|
||||
|
||||
xy numPorts{1, 1};
|
||||
/** Number of Modules in X and Y dimension */
|
||||
xy numMods{1, 1};
|
||||
|
||||
/** Quad Enable */
|
||||
bool *quadEnable;
|
||||
|
||||
/** Total number of frames */
|
||||
uint64_t *totalNumFrames;
|
||||
};
|
||||
|
@ -217,7 +217,7 @@ slsDetectorDefs::xy Implementation::GetPortGeometry() {
|
||||
xy portGeometry{1, 1};
|
||||
if (detType == EIGER)
|
||||
portGeometry.x = numUDPInterfaces;
|
||||
else if (detType == JUNGFRAU)
|
||||
else // (jungfrau and gotthard2)
|
||||
portGeometry.y = numUDPInterfaces;
|
||||
return portGeometry;
|
||||
}
|
||||
@ -226,18 +226,18 @@ void Implementation::setDetectorSize(const slsDetectorDefs::xy size) {
|
||||
xy portGeometry = GetPortGeometry();
|
||||
|
||||
std::string log_message = "Detector Size (ports): (";
|
||||
numModules = size;
|
||||
numPorts.x = portGeometry.x * size.x;
|
||||
numPorts.y = portGeometry.y * size.y;
|
||||
numModules.x = portGeometry.x * size.x;
|
||||
numModules.y = portGeometry.y * size.y;
|
||||
xy nm{numModules.x, numModules.y};
|
||||
if (quadEnable) {
|
||||
numPorts.x = 1;
|
||||
numPorts.y = 2;
|
||||
nm.x = 1;
|
||||
nm.y = 2;
|
||||
}
|
||||
for (const auto &it : dataStreamer) {
|
||||
it->SetNumberofPorts(numPorts);
|
||||
it->SetNumberofModules(nm);
|
||||
}
|
||||
|
||||
LOG(logINFO) << "Detector Size (ports): " << sls::ToString(numPorts);
|
||||
LOG(logINFO) << "Detector Size (ports): " << sls::ToString(numModules);
|
||||
}
|
||||
|
||||
int Implementation::getModulePositionId() const { return modulePos; }
|
||||
@ -254,16 +254,8 @@ void Implementation::setModulePositionId(const int id) {
|
||||
for (unsigned int i = 0; i < listener.size(); ++i) {
|
||||
uint16_t row = 0, col = 0;
|
||||
row = (modulePos % numModules.y) * portGeometry.y;
|
||||
col = (modulePos / numModules.y) * portGeometry.x;
|
||||
if (portGeometry.y == 2) {
|
||||
row += i;
|
||||
}
|
||||
if (portGeometry.x == 2) {
|
||||
col += i;
|
||||
}
|
||||
LOG(logDEBUG1) << i << ":numModules:" << numModules.x << ","
|
||||
<< numModules.y << " portGeometry:" << portGeometry.x
|
||||
<< "," << portGeometry.y;
|
||||
col = (modulePos / numModules.y) * portGeometry.x + i;
|
||||
|
||||
listener[i]->SetHardCodedPosition(row, col);
|
||||
}
|
||||
}
|
||||
@ -766,7 +758,12 @@ void Implementation::StartMasterWriter() {
|
||||
MasterAttributes masterAttributes;
|
||||
masterAttributes.detType = detType;
|
||||
masterAttributes.timingMode = timingMode;
|
||||
masterAttributes.geometry = numPorts;
|
||||
xy nm{numModules.x, numModules.y};
|
||||
if (quadEnable) {
|
||||
nm.x = 1;
|
||||
nm.y = 2;
|
||||
}
|
||||
masterAttributes.geometry = xy(nm.x, nm.y);
|
||||
masterAttributes.imageSize = generalData->imageSize;
|
||||
masterAttributes.nPixels =
|
||||
xy(generalData->nPixelsX, generalData->nPixelsY);
|
||||
@ -826,12 +823,12 @@ void Implementation::StartMasterWriter() {
|
||||
std::array<std::string, 2> virtualFileAndDatasetNames;
|
||||
// create virtual hdf5 file (if multiple files)
|
||||
if (dataProcessor[0]->GetFilesInAcquisition() > 1 ||
|
||||
(numPorts.x * numPorts.y) > 1) {
|
||||
(numModules.x * numModules.y) > 1) {
|
||||
virtualFileAndDatasetNames =
|
||||
dataProcessor[0]->CreateVirtualFile(
|
||||
filePath, fileName, fileIndex, overwriteEnable,
|
||||
silentMode, modulePos, numUDPInterfaces, framesPerFile,
|
||||
numberOfTotalFrames, numPorts.x, numPorts.y,
|
||||
numberOfTotalFrames, numModules.x, numModules.y,
|
||||
dynamicRange, &hdf5LibMutex);
|
||||
}
|
||||
// link file in master
|
||||
@ -882,6 +879,12 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
||||
}
|
||||
|
||||
if (numUDPInterfaces != n) {
|
||||
|
||||
// reduce number of detectors to size with 1 interface
|
||||
xy portGeometry = GetPortGeometry();
|
||||
numModules.x /= portGeometry.x;
|
||||
numModules.y /= portGeometry.y;
|
||||
|
||||
// clear all threads and fifos
|
||||
listener.clear();
|
||||
dataProcessor.clear();
|
||||
@ -930,12 +933,15 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
||||
if (dataStreamEnable) {
|
||||
try {
|
||||
bool flip = flipRows;
|
||||
xy nm{numModules.x, numModules.y};
|
||||
if (quadEnable) {
|
||||
flip = (i == 1 ? true : false);
|
||||
nm.x = 1;
|
||||
nm.y = 2;
|
||||
}
|
||||
dataStreamer.push_back(sls::make_unique<DataStreamer>(
|
||||
i, fifo[i].get(), &dynamicRange, &roi, &fileIndex, flip,
|
||||
numPorts, &quadEnable, &numberOfTotalFrames));
|
||||
nm, &quadEnable, &numberOfTotalFrames));
|
||||
dataStreamer[i]->SetGeneralData(generalData);
|
||||
dataStreamer[i]->CreateZmqSockets(
|
||||
&numUDPInterfaces, streamingPort, streamingSrcIP,
|
||||
@ -1057,12 +1063,15 @@ void Implementation::setDataStreamEnable(const bool enable) {
|
||||
for (int i = 0; i < numUDPInterfaces; ++i) {
|
||||
try {
|
||||
bool flip = flipRows;
|
||||
xy nm{numModules.x, numModules.y};
|
||||
if (quadEnable) {
|
||||
flip = (i == 1 ? true : false);
|
||||
nm.x = 1;
|
||||
nm.y = 2;
|
||||
}
|
||||
dataStreamer.push_back(sls::make_unique<DataStreamer>(
|
||||
i, fifo[i].get(), &dynamicRange, &roi, &fileIndex, flip,
|
||||
numPorts, &quadEnable, &numberOfTotalFrames));
|
||||
nm, &quadEnable, &numberOfTotalFrames));
|
||||
dataStreamer[i]->SetGeneralData(generalData);
|
||||
dataStreamer[i]->CreateZmqSockets(
|
||||
&numUDPInterfaces, streamingPort, streamingSrcIP,
|
||||
@ -1490,12 +1499,18 @@ bool Implementation::getQuad() const { return quadEnable; }
|
||||
void Implementation::setQuad(const bool b) {
|
||||
if (quadEnable != b) {
|
||||
quadEnable = b;
|
||||
setDetectorSize(numModules);
|
||||
|
||||
if (!quadEnable) {
|
||||
xy nm{numModules.x, numModules.y};
|
||||
for (const auto &it : dataStreamer) {
|
||||
it->SetNumberofModules(nm);
|
||||
it->SetFlipRows(flipRows);
|
||||
}
|
||||
} else {
|
||||
xy nm{1, 2};
|
||||
for (const auto &it : dataStreamer) {
|
||||
it->SetNumberofModules(nm);
|
||||
}
|
||||
if (dataStreamer.size() == 2) {
|
||||
dataStreamer[0]->SetFlipRows(false);
|
||||
dataStreamer[1]->SetFlipRows(true);
|
||||
|
@ -290,7 +290,6 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
// config parameters
|
||||
detectorType detType{GENERIC};
|
||||
xy numModules{1, 1};
|
||||
xy numPorts{1, 1};
|
||||
int modulePos{0};
|
||||
std::string detHostname;
|
||||
bool silentMode{false};
|
||||
|
@ -210,8 +210,6 @@ void Listener::CreateDummySocketForUDPSocketBufferSize(int s) {
|
||||
void Listener::SetHardCodedPosition(uint16_t r, uint16_t c) {
|
||||
row = r;
|
||||
column = c;
|
||||
LOG(logDEBUG1) << "Setting hardcoded position [" << index
|
||||
<< "] (row: " << row << ", col: " << column << ")";
|
||||
}
|
||||
|
||||
void Listener::ThreadExecution() {
|
||||
|
@ -47,12 +47,12 @@ void printHelp() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Start Acquisition Call back (slsMultiReceiver writes data if file write
|
||||
* enabled) if registerCallBackRawDataReady or
|
||||
* registerCallBackRawDataModifyReady registered, users get data
|
||||
* Start Acquisition Call back (slsMultiReceiver writes data if file write enabled)
|
||||
* if registerCallBackRawDataReady or registerCallBackRawDataModifyReady registered,
|
||||
* users get data
|
||||
*/
|
||||
int StartAcq(const std::string &filePath, const std::string &fileName,
|
||||
uint64_t fileIndex, size_t imageSize, void *objectPointer) {
|
||||
int StartAcq(const std::string & filePath, const std::string & fileName, uint64_t fileIndex,
|
||||
size_t imageSize, void *objectPointer) {
|
||||
LOG(logINFOBLUE) << "#### StartAcq: filePath:" << filePath
|
||||
<< " fileName:" << fileName << " fileIndex:" << fileIndex
|
||||
<< " imageSize:" << imageSize << " ####";
|
||||
@ -61,8 +61,8 @@ int StartAcq(const std::string &filePath, const std::string &fileName,
|
||||
|
||||
/** Acquisition Finished Call back */
|
||||
void AcquisitionFinished(uint64_t framesCaught, void *objectPointer) {
|
||||
LOG(logINFOBLUE) << "#### AcquisitionFinished: framesCaught:"
|
||||
<< framesCaught << " ####";
|
||||
LOG(logINFOBLUE) << "#### AcquisitionFinished: framesCaught:" << framesCaught
|
||||
<< " ####";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,16 +76,16 @@ void GetData(slsDetectorDefs::sls_receiver_header *header, char *dataPointer,
|
||||
|
||||
PRINT_IN_COLOR(
|
||||
detectorHeader.modId ? detectorHeader.modId : detectorHeader.row,
|
||||
"#### %d %d GetData: ####\n"
|
||||
"#### %d GetData: ####\n"
|
||||
"frameNumber: %lu\t\texpLength: %u\t\tpacketNumber: %u\t\tbunchId: %lu"
|
||||
"\t\ttimestamp: %lu\t\tmodId: %u\t\t"
|
||||
"row: %u\t\tcolumn: %u\t\treserved: %u\t\tdebug: %u"
|
||||
"\t\troundRNumber: %u\t\tdetType: %u\t\tversion: %u"
|
||||
//"\t\tpacketsMask:%s"
|
||||
"\t\tfirstbytedata: 0x%x\t\tdatsize: %zu\n\n",
|
||||
detectorHeader.column, detectorHeader.row,
|
||||
(long unsigned int)detectorHeader.frameNumber, detectorHeader.expLength,
|
||||
detectorHeader.packetNumber, (long unsigned int)detectorHeader.bunchId,
|
||||
detectorHeader.row, (long unsigned int)detectorHeader.frameNumber,
|
||||
detectorHeader.expLength, detectorHeader.packetNumber,
|
||||
(long unsigned int)detectorHeader.bunchId,
|
||||
(long unsigned int)detectorHeader.timestamp, detectorHeader.modId,
|
||||
detectorHeader.row, detectorHeader.column, detectorHeader.reserved,
|
||||
detectorHeader.debug, detectorHeader.roundRNumber,
|
||||
|
@ -34,8 +34,6 @@ set(PUBLICHEADERS
|
||||
if(SLS_DEVEL_HEADERS)
|
||||
set(PUBLICHEADERS
|
||||
${PUBLICHEADERS}
|
||||
include/sls/ansi.h
|
||||
include/sls/logger.h
|
||||
include/sls/file_utils.h
|
||||
include/sls/sls_detector_funcs.h
|
||||
include/sls/ClientSocket.h
|
||||
@ -48,7 +46,7 @@ if(SLS_DEVEL_HEADERS)
|
||||
include/sls/versionAPI.h
|
||||
include/sls/ZmqSocket.h
|
||||
include/sls/bit_utils.h
|
||||
include/sls/md5.h
|
||||
include/sls/mdf5.h
|
||||
include/sls/md5_helper.h
|
||||
)
|
||||
endif()
|
||||
@ -77,16 +75,13 @@ target_include_directories(slsSupportObject
|
||||
PUBLIC
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
|
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
||||
PRIVATE
|
||||
${SLS_INTERNAL_RAPIDJSON_DIR}
|
||||
)
|
||||
|
||||
message(STATUS "RAPID: ${SLS_INTERNAL_RAPIDJSON_DIR}")
|
||||
|
||||
target_link_libraries(slsSupportObject
|
||||
PUBLIC
|
||||
slsProjectOptions
|
||||
libzmq
|
||||
rapidjson
|
||||
PRIVATE
|
||||
slsProjectWarnings
|
||||
md5sls
|
||||
|
@ -28,9 +28,9 @@ struct zmqHeader {
|
||||
uint32_t jsonversion{0};
|
||||
uint32_t dynamicRange{0};
|
||||
uint64_t fileIndex{0};
|
||||
/** number of detectors/port in x axis */
|
||||
/** number of detectors in x axis */
|
||||
uint32_t ndetx{0};
|
||||
/** number of detectors/port in y axis */
|
||||
/** number of detectors in y axis */
|
||||
uint32_t ndety{0};
|
||||
/** number of pixels/channels in x axis for this zmq socket */
|
||||
uint32_t npixelsx{0};
|
||||
|
@ -6,10 +6,10 @@
|
||||
#define APIRECEIVER 0x220408
|
||||
#define APIGUI 0x220328
|
||||
|
||||
#define APICTB 0x220428
|
||||
#define APIGOTTHARD 0x220428
|
||||
#define APIGOTTHARD2 0x220428
|
||||
#define APIJUNGFRAU 0x220428
|
||||
#define APIMOENCH 0x220427
|
||||
#define APIEIGER 0x220428
|
||||
#define APIMYTHEN3 0x220510
|
||||
#define APICTB 0x220408
|
||||
#define APIGOTTHARD 0x220408
|
||||
#define APIGOTTHARD2 0x220408
|
||||
#define APIJUNGFRAU 0x220408
|
||||
#define APIMYTHEN3 0x220408
|
||||
#define APIMOENCH 0x220408
|
||||
#define APIEIGER 0x220408
|
||||
|
Reference in New Issue
Block a user