mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-24 10:31:09 +02:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
d5a712ab42 | |||
fa931b8fca | |||
37bf3600ad | |||
96f6561080 | |||
9ca831d954 |
@ -19,7 +19,6 @@ Checks: '*,
|
|||||||
-google-readability-braces-around-statements,
|
-google-readability-braces-around-statements,
|
||||||
-modernize-use-trailing-return-type,
|
-modernize-use-trailing-return-type,
|
||||||
-readability-isolate-declaration,
|
-readability-isolate-declaration,
|
||||||
-readability-implicit-bool-conversion,
|
|
||||||
-llvmlibc-*'
|
-llvmlibc-*'
|
||||||
|
|
||||||
HeaderFilterRegex: \.h
|
HeaderFilterRegex: \.h
|
||||||
|
159
CMakeLists.txt
159
CMakeLists.txt
@ -1,15 +1,18 @@
|
|||||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
cmake_minimum_required(VERSION 3.12)
|
cmake_minimum_required(VERSION 3.9)
|
||||||
project(slsDetectorPackage)
|
project(slsDetectorPackage)
|
||||||
set(PROJECT_VERSION 6.1.1)
|
set(PROJECT_VERSION 6.0.0)
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
|
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
|
||||||
|
|
||||||
cmake_policy(SET CMP0074 NEW)
|
# cmake_policy(SET CMP0074 NEW)
|
||||||
include(cmake/project_version.cmake)
|
include(cmake/project_version.cmake)
|
||||||
|
|
||||||
|
#functions to add compiler flags
|
||||||
include(cmake/SlsAddFlag.cmake)
|
include(cmake/SlsAddFlag.cmake)
|
||||||
include(cmake/SlsFindZeroMQ.cmake)
|
|
||||||
|
# Include additional modules that are used unconditionally
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
# If conda build, always set lib dir to 'lib'
|
# If conda build, always set lib dir to 'lib'
|
||||||
@ -23,7 +26,7 @@ string(TOLOWER "${PROJECT_NAME}" PROJECT_NAME_LOWER)
|
|||||||
|
|
||||||
# Set targets export name (used by slsDetectorPackage and dependencies)
|
# Set targets export name (used by slsDetectorPackage and dependencies)
|
||||||
set(TARGETS_EXPORT_NAME "${PROJECT_NAME_LOWER}-targets")
|
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})
|
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
||||||
|
|
||||||
@ -34,8 +37,6 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
|||||||
set(SLS_MASTER_PROJECT ON)
|
set(SLS_MASTER_PROJECT ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
option(SLS_USE_HDF5 "HDF5 File format" OFF)
|
option(SLS_USE_HDF5 "HDF5 File format" OFF)
|
||||||
option(SLS_BUILD_SHARED_LIBRARIES "Build shared libaries" ON)
|
option(SLS_BUILD_SHARED_LIBRARIES "Build shared libaries" ON)
|
||||||
option(SLS_USE_TEXTCLIENT "Text Client" ON)
|
option(SLS_USE_TEXTCLIENT "Text Client" ON)
|
||||||
@ -55,32 +56,6 @@ option(SLS_TUNE_LOCAL "tune to local machine" OFF)
|
|||||||
option(SLS_DEVEL_HEADERS "install headers for devel" OFF)
|
option(SLS_DEVEL_HEADERS "install headers for devel" OFF)
|
||||||
option(SLS_USE_MOENCH "compile zmq and post processing for Moench" OFF)
|
option(SLS_USE_MOENCH "compile zmq and post processing for Moench" OFF)
|
||||||
|
|
||||||
#Convenience option to switch off defaults when building Moench binaries only
|
|
||||||
option(SLS_BUILD_ONLY_MOENCH "compile only Moench" OFF)
|
|
||||||
if(SLS_BUILD_ONLY_MOENCH)
|
|
||||||
message(STATUS "Build MOENCH binaries only!")
|
|
||||||
set(SLS_BUILD_SHARED_LIBRARIES OFF CACHE BOOL "Disabled for MOENCH_ONLY" FORCE)
|
|
||||||
set(SLS_USE_TEXTCLIENT OFF CACHE BOOL "Disabled for MOENCH_ONLY" FORCE)
|
|
||||||
set(SLS_USE_DETECTOR OFF CACHE BOOL "Disabled for MOENCH_ONLY" FORCE)
|
|
||||||
set(SLS_USE_RECEIVER OFF CACHE BOOL "Disabled for MOENCH_ONLY" FORCE)
|
|
||||||
set(SLS_USE_RECEIVER_BINARIES OFF CACHE BOOL "Disabled for MOENCH_ONLY" FORCE)
|
|
||||||
set(SLS_USE_MOENCH ON CACHE BOOL "Enable" FORCE)
|
|
||||||
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/"
|
set(ClangFormat_EXCLUDE_PATTERNS "build/"
|
||||||
"libs/"
|
"libs/"
|
||||||
@ -92,6 +67,12 @@ set(ClangFormat_EXCLUDE_PATTERNS "build/"
|
|||||||
${CMAKE_BINARY_DIR})
|
${CMAKE_BINARY_DIR})
|
||||||
find_package(ClangFormat)
|
find_package(ClangFormat)
|
||||||
|
|
||||||
|
#Enable LTO if available
|
||||||
|
include(CheckIPOSupported)
|
||||||
|
check_ipo_supported(RESULT SLS_LTO_AVAILABLE)
|
||||||
|
message(STATUS "SLS_LTO_AVAILABLE:" ${SLS_LTO_AVAILABLE})
|
||||||
|
|
||||||
|
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
@ -100,32 +81,10 @@ if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
#Enable LTO if available
|
#Add two fake libraries to manage options
|
||||||
include(CheckIPOSupported)
|
|
||||||
check_ipo_supported(RESULT SLS_LTO_AVAILABLE)
|
|
||||||
if((CMAKE_BUILD_TYPE STREQUAL "Release") AND SLS_LTO_AVAILABLE)
|
|
||||||
message(STATUS "Building with link time optimization")
|
|
||||||
else()
|
|
||||||
message(STATUS "Building without link time optimization")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
if(SLS_EXT_BUILD)
|
|
||||||
# Find ourself in case of external build
|
|
||||||
find_package(slsDetectorPackage ${PROJECT_VERSION} REQUIRED)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# slsProjectOptions and slsProjectWarnings are used
|
|
||||||
# to control options for the libraries
|
|
||||||
if(NOT TARGET slsProjectOptions)
|
|
||||||
add_library(slsProjectOptions INTERFACE)
|
add_library(slsProjectOptions INTERFACE)
|
||||||
target_compile_features(slsProjectOptions INTERFACE cxx_std_11)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT TARGET slsProjectWarnings)
|
|
||||||
add_library(slsProjectWarnings INTERFACE)
|
add_library(slsProjectWarnings INTERFACE)
|
||||||
|
target_compile_features(slsProjectOptions INTERFACE cxx_std_11)
|
||||||
target_compile_options(slsProjectWarnings INTERFACE
|
target_compile_options(slsProjectWarnings INTERFACE
|
||||||
-Wall
|
-Wall
|
||||||
-Wextra
|
-Wextra
|
||||||
@ -141,22 +100,7 @@ if (NOT TARGET slsProjectWarnings)
|
|||||||
-Wdouble-promotion
|
-Wdouble-promotion
|
||||||
-Werror=return-type
|
-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)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
if (NOT TARGET slsProjectCSettings)
|
|
||||||
#Settings for C code
|
#Settings for C code
|
||||||
add_library(slsProjectCSettings INTERFACE)
|
add_library(slsProjectCSettings INTERFACE)
|
||||||
target_compile_options(slsProjectCSettings INTERFACE
|
target_compile_options(slsProjectCSettings INTERFACE
|
||||||
@ -170,8 +114,30 @@ if (NOT TARGET slsProjectCSettings)
|
|||||||
-Wdouble-promotion
|
-Wdouble-promotion
|
||||||
-Werror=return-type
|
-Werror=return-type
|
||||||
)
|
)
|
||||||
sls_disable_c_warning("-Wstringop-truncation")
|
|
||||||
|
|
||||||
|
#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()
|
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()
|
||||||
|
|
||||||
|
# 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")
|
||||||
|
# sls_disable_c_warning("-Wformat-nonliteral")
|
||||||
|
|
||||||
|
|
||||||
if(SLS_USE_SANITIZER)
|
if(SLS_USE_SANITIZER)
|
||||||
@ -186,22 +152,55 @@ if(SLS_TUNE_LOCAL)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(SLS_MASTER_PROJECT)
|
#rapidjson
|
||||||
install(TARGETS slsProjectOptions slsProjectWarnings
|
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}"
|
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
)
|
)
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
set(CMAKE_INSTALL_RPATH $ORIGIN)
|
set(CMAKE_INSTALL_RPATH $ORIGIN)
|
||||||
|
# set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
||||||
|
|
||||||
|
|
||||||
custom_find_zmq()
|
# set(ZeroMQ_HINT "" CACHE STRING "Hint where ZeroMQ could be found")
|
||||||
|
# #Adapted from: https://github.com/zeromq/cppzmq/
|
||||||
|
# if (NOT TARGET libzmq)
|
||||||
|
# if(ZeroMQ_HINT)
|
||||||
|
# message(STATUS "Looking for ZeroMQ in: ${ZeroMQ_HINT}")
|
||||||
|
# find_package(ZeroMQ 4
|
||||||
|
# NO_DEFAULT_PATH
|
||||||
|
# HINTS ${ZeroMQ_DIR}
|
||||||
|
# )
|
||||||
|
# else()
|
||||||
|
# find_package(ZeroMQ 4 QUIET)
|
||||||
|
# endif()
|
||||||
|
|
||||||
|
# # libzmq autotools install: fallback to pkg-config
|
||||||
|
# if(NOT ZeroMQ_FOUND)
|
||||||
|
# message(STATUS "CMake libzmq package not found, trying again with pkg-config (normal install of zeromq)")
|
||||||
|
# list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/libzmq-pkg-config)
|
||||||
|
# find_package(ZeroMQ 4 REQUIRED)
|
||||||
|
# endif()
|
||||||
|
|
||||||
|
# # TODO "REQUIRED" above should already cause a fatal failure if not found, but this doesn't seem to work
|
||||||
|
# if(NOT ZeroMQ_FOUND)
|
||||||
|
# message(FATAL_ERROR "ZeroMQ was not found, neither as a CMake package nor via pkg-config")
|
||||||
|
# endif()
|
||||||
|
|
||||||
|
# if (ZeroMQ_FOUND AND NOT TARGET libzmq)
|
||||||
|
# message(FATAL_ERROR "ZeroMQ version not supported!")
|
||||||
|
# endif()
|
||||||
|
# endif()
|
||||||
|
|
||||||
if (SLS_USE_TESTS)
|
if (SLS_USE_TESTS)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
@ -209,9 +208,8 @@ if (SLS_USE_TESTS)
|
|||||||
endif(SLS_USE_TESTS)
|
endif(SLS_USE_TESTS)
|
||||||
|
|
||||||
|
|
||||||
if(NOT SLS_EXT_BUILD)
|
# Common functionallity to detector and receiver
|
||||||
add_subdirectory(slsSupportLib)
|
add_subdirectory(slsSupportLib)
|
||||||
endif()
|
|
||||||
|
|
||||||
if (SLS_USE_DETECTOR OR SLS_USE_TEXTCLIENT)
|
if (SLS_USE_DETECTOR OR SLS_USE_TEXTCLIENT)
|
||||||
add_subdirectory(slsDetectorSoftware)
|
add_subdirectory(slsDetectorSoftware)
|
||||||
@ -235,7 +233,7 @@ endif (SLS_USE_INTEGRATION_TESTS)
|
|||||||
|
|
||||||
if (SLS_USE_PYTHON)
|
if (SLS_USE_PYTHON)
|
||||||
find_package (Python 3.6 COMPONENTS Interpreter Development)
|
find_package (Python 3.6 COMPONENTS Interpreter Development)
|
||||||
add_subdirectory(libs/pybind11 ${CMAKE_BINARY_DIR}/bin/)
|
add_subdirectory(libs/pybind11)
|
||||||
add_subdirectory(python)
|
add_subdirectory(python)
|
||||||
endif(SLS_USE_PYTHON)
|
endif(SLS_USE_PYTHON)
|
||||||
|
|
||||||
@ -256,7 +254,6 @@ if(SLS_BUILD_DOCS)
|
|||||||
endif(SLS_BUILD_DOCS)
|
endif(SLS_BUILD_DOCS)
|
||||||
|
|
||||||
if(SLS_USE_MOENCH)
|
if(SLS_USE_MOENCH)
|
||||||
add_subdirectory(slsDetectorCalibration/tiffio)
|
|
||||||
add_subdirectory(slsDetectorCalibration/moenchExecutables)
|
add_subdirectory(slsDetectorCalibration/moenchExecutables)
|
||||||
endif(SLS_USE_MOENCH)
|
endif(SLS_USE_MOENCH)
|
||||||
|
|
||||||
|
359
RELEASE.txt
359
RELEASE.txt
@ -1,7 +1,7 @@
|
|||||||
SLS Detector Package Minor Release 7.0.0 released on 25.11.2021
|
SLS Detector Package 6.0.0 released on 21.10.2021
|
||||||
===============================================================
|
==================================================
|
||||||
|
|
||||||
This document describes the differences between v7.0.0 and v6.x.x
|
This document describes the differences between v6.0.0 and v5.1.0.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -9,9 +9,10 @@ This document describes the differences between v7.0.0 and v6.x.x
|
|||||||
--------
|
--------
|
||||||
1. New or Changed Features
|
1. New or Changed Features
|
||||||
2. Resolved Issues
|
2. Resolved Issues
|
||||||
3. Firmware Requirements
|
3. Known Issues
|
||||||
4. Kernel Requirements
|
4. Changes in Next Major Release
|
||||||
5. Download, Documentation & Support
|
5. Firmware Requirements
|
||||||
|
6. Download, Documentation & Support
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -19,62 +20,277 @@ This document describes the differences between v7.0.0 and v6.x.x
|
|||||||
1. New or Changed Features
|
1. New or Changed Features
|
||||||
==========================
|
==========================
|
||||||
|
|
||||||
- Fixed minor warnings (will fix commandline print of excess packets for missing packets)
|
Added License. Read COPYING for more details.
|
||||||
- ctb slow adcs and any other adcs (other than temp) goes to the control Server
|
|
||||||
- number of udp interfaces is 2 for Eiger (CHANGE IN API??)
|
Client
|
||||||
- added module id for virtual servers into the udp header
|
------
|
||||||
- refactoring (rxr)
|
1. Shared libraries
|
||||||
- fixed patsetbit and patsetmask for moench
|
They are versioned from this release on (6.0.0).
|
||||||
- changed default vref of adc9257 to 2V for moench (from 1.33V)
|
|
||||||
- moench and ctb - can set the starting frame number of next acquisition
|
2. [Jungfrau] Chip version
|
||||||
- mythen server kernel check incompatible (cet timezone)
|
Features for chipv1.1 incorporated
|
||||||
- rx_arping
|
Command line: chipversion, API: getchipVersion
|
||||||
- rx_threadsids max is now 9 (breaking api)
|
gets chip version (1.0 or 1.1)
|
||||||
- fixed datastream disabling for eiger. Its only available in 10g mode.
|
chipv1.1 requires config_jungfrau.txt on detector server and HW 2.0.
|
||||||
- m3 server crash (vthrehsold dac names were not provided)
|
|
||||||
- allow vtrim to be interpolated for Eiger settings
|
3. [Jungfrau] Chip configuration (only chipv1.1)
|
||||||
- m3 setThresholdEnergy and setAllThresholdEnergy was overwriting gaincaps with settings enum
|
powering on the chip and changing settings will configure the chip.
|
||||||
- can set localhost with virtual server with minimum configuration: (hostname localhost, rx_hostname localhost, udp_dstip auto)
|
Hence, required before acquisition.
|
||||||
- increases the progress according to listened index. (not processed index)
|
|
||||||
- current frame index points to listened frame index (not processed index)
|
4. [Jungfrau] Settings and Gain mode
|
||||||
- when in discard partial frames or empty mode, the frame number doesnt increase by 1, it increases to that number (so its faster)
|
Settings can be gain0 and highgain0. Gain mode can be dynamicgain,
|
||||||
- file write disabled by default
|
forceswitchg1, forceswitchg2, fixg1, fixg2, fixg0. fixg0 must be
|
||||||
- eiger 12 bit mode
|
used with EXTRA caution as you can damage the detector.
|
||||||
- start non blocking acquisition at modular level
|
Changing settings also changes dac values of 3 dacs
|
||||||
- connect master commands to api (allow set master for eiger)
|
(vref_prech, vref_ds and vref_comp) and reconfigures chip (only v1.1)
|
||||||
--ignore-config command line
|
|
||||||
- command line argument 'master' mainly for virtual servers (also master/top for real eiger), only one virtual server for eiger, use command lines for master/top
|
5. [Jungfrau] Storage cells (only chipv1.1)
|
||||||
- stop servers also check for errors at startup( in case it was running with an older version)
|
Additional number of storage cells not applicable for chipv1.1.
|
||||||
- hostname cmd failed when connecting to servers in update mode (ctb, moench, jungfrau, eiger)
|
Storage cell start is only allowed from 0 - 3 for chipv1.1
|
||||||
- missingpackets signed (negative => extra packets)
|
(0 - 15 for chipv1.0).
|
||||||
- framescaught and frameindex now returns a vector for each port
|
Command line: extrastoragecells, Previous Command line: storagecells
|
||||||
- progress looks at activated or enabled ports, so progress does not stagnate
|
API: remains the same.
|
||||||
- (eiger) disable datastreaming also for virtual servers only for 10g
|
|
||||||
- missing packets also takes care of disabled ports
|
6. [Gotthard2][Jungfrau] Filter Resistor
|
||||||
- added geometry to metadata
|
Command line: filterresistor, API: getFilterResistor/ setFilterResistor
|
||||||
- 10g eiger nextframenumber get fixed.
|
Previous Command: filter, setFilter/ getFilter
|
||||||
- stop, able to set nextframenumber to a consistent (max + 1) for all modules if different (eiger/ctb/jungfrau/moench)
|
Set Filter resistor. Increasing values for increasing resistance.
|
||||||
- ctb: can set names for all the dacs
|
[Jungfrau] only for chipv1.1. Options: [0|1]. Default is 1.
|
||||||
- fpga/kernel programming, checks if drive is a special file and not a normal file
|
[Gotthard2] Options: [0|1|2|3]. Default is 0.
|
||||||
- gotthard 25 um image reconstructed in gui and virtual hdf5 (firmware updated for slave to reverse channels)
|
|
||||||
- master binary file in json format now
|
7. [Jungfrau] Filter cell (only chipv1.1)
|
||||||
- fixed bug introduced in 6.0.0: hdf5 files created 1 file per frame after the initial file which had maxframesperfile
|
Command line: filtercells, API: getNumberOfFilterCells/ setNumberOfFilterCells
|
||||||
- m3 polarity, interpolation (enables all counters when enabled), pump probe, analog pulsing, digital pulsing
|
Set filter cell. Options: [0-12]. Advanced user command.
|
||||||
- updatedetectorserver - removes old server current binary pointing to for blackfin
|
|
||||||
- removing copydetectorserver using tftp
|
8. [Jungfrau] Comparator disable time (only chipv1.1)
|
||||||
>>>>>>> developer
|
Command line: compdisabletime, API: getComparatorDisableTime/
|
||||||
- registerCallBackRawDataReady and registerCallBackRawDataModifyReady now gives a sls_receiver_header* instead of a char*, and uint32_t to size_t
|
setComparatorDisableTime
|
||||||
- registerCallBackStartAcquisition gave incorrect imagesize (+120 bytes). corrected.
|
One can customize the period to disable comparator.
|
||||||
- registerCallBackStartAcquisition parameter is a const string reference
|
|
||||||
- m3 (runnig config second time with tengiga 0, dr !=32, counters !=0x7) calculated incorrect image size expected
|
9. [Eiger][Jungfrau] Read n rows
|
||||||
- fixed row column indexing (mainly for multi module Jungfrau 2 interfaces )
|
Command line: readnrows, API: getReadNRows/ setReadNRows
|
||||||
- eiger gui row indices not flipped anymore (fix in config)
|
Previous Command: readnlines, getPartialReadout/ setPartialReadout
|
||||||
|
[Eiger] same as before
|
||||||
|
[Jungfrau] Options: 8 - 512, multiples of 8. Default is 512.
|
||||||
|
|
||||||
|
10. [Gotthard2][Jungfrau] Current source
|
||||||
|
Command line: currentsource, API: getCurrentSource, setCurrentSource
|
||||||
|
Enable or disable current source. Default is disabled.
|
||||||
|
[Gotthard2] Can only enable or disable.
|
||||||
|
[Jungfrau] Can choose to fix, select source and choose normal or low
|
||||||
|
current. Normal/ low only for chipv1.1.
|
||||||
|
Select source is 0-63 for chipv1.0 and a 64 bit mask for chipv1.1.
|
||||||
|
|
||||||
|
11. Default dac
|
||||||
|
Command line: defaultdac, API: getDefaultDac/ setDefaultDac
|
||||||
|
change default value of a dac
|
||||||
|
[Jungfrau][Mythen3] Also change default value of dac for particular
|
||||||
|
setting.
|
||||||
|
|
||||||
|
12. Reset dacs
|
||||||
|
Command line: resetdacs, API: resetToDefaultDacs
|
||||||
|
Previous command: defaultdacs
|
||||||
|
Resets dacs to their default values or hard coded values.
|
||||||
|
|
||||||
|
13. [Mythen3] Gain Capacitance
|
||||||
|
Command line: gaincaps, API: getGainCaps/ setGainCaps
|
||||||
|
Set various gain capacitances.
|
||||||
|
|
||||||
|
14. [Gotthard2] Veto Streaming from chip
|
||||||
|
Command line: veto, API: getVeto/ setVeto
|
||||||
|
This command used to mean veto streaming from detector. Now, it means
|
||||||
|
veto streaming from chip (New feature). Default is disabled.
|
||||||
|
|
||||||
|
15. [Gotthard2] Veto streaming from detector
|
||||||
|
Command line: vetostream, API: getVetoStream, setVetoStream
|
||||||
|
Options: None, local link interface, 10 10GbE, Both
|
||||||
|
Default: None
|
||||||
|
10GbE (as before) will enable 2 udp interfaces in receiver.
|
||||||
|
|
||||||
|
16. [Gotthard2] Veto algorithm
|
||||||
|
Command line: vetoalg, API: getVetoAlgorithm/ setVetoAlgorithm
|
||||||
|
Set veto algorithm for each interface.
|
||||||
|
Options: hits, raw
|
||||||
|
|
||||||
|
17. [Eiger][Gotthard2][Mythen3] Module ID
|
||||||
|
Command line: moduleid, API: getModuleId
|
||||||
|
Previous command (Eiger only): serialnumber, getSerialNumber
|
||||||
|
Unique id read from txt file on detector and streamed out in udp header.
|
||||||
|
|
||||||
|
18. [Gotthard2]
|
||||||
|
Command line: dbitpipeline, API: getDBITPipeline/ setDBITPipeline
|
||||||
|
Set pipeline to latch digital bits. Options: 0-7
|
||||||
|
|
||||||
|
19. [Eiger][Jungfrau] Round Robin commands
|
||||||
|
Command line, udp_dstlist, API: getDestinationUDPList/
|
||||||
|
setDestinationUDPList
|
||||||
|
Round robin commands at the moment does not configure the receiver.
|
||||||
|
Set multiple udp destinations in the detector to stream udp data packets
|
||||||
|
to. Upto 32 destinations. Refer documentation for details.
|
||||||
|
|
||||||
|
Command line, udp_numdst, API: getNumberofUDPDestinations
|
||||||
|
|
||||||
|
[Jungfrau] Command line, udp_firstdst, API: getFirstUDPDestination/
|
||||||
|
setFirstUDPDestination
|
||||||
|
|
||||||
|
20. Command Line Parsing
|
||||||
|
Parsing of detector index and module index has been modified to
|
||||||
|
integrate round robin index.
|
||||||
|
[detector index]-[module index]:[round robin index] [command]
|
||||||
|
|
||||||
|
It is backwards compatible.
|
||||||
|
For ease, one can also execute
|
||||||
|
sls_detector_put [module index] [command]
|
||||||
|
|
||||||
|
21. Clear Udp Destination
|
||||||
|
Command line, udp_cleardst, API: clearUDPDestinations
|
||||||
|
This is useful when changing receivers for a detector or for round robin
|
||||||
|
system.
|
||||||
|
|
||||||
|
22. Shared Memory Naming
|
||||||
|
Shared memory name has been changed to reflect a more appropriate naming
|
||||||
|
scheme.
|
||||||
|
|
||||||
|
23. [Eiger][Mythen3] Blocking trigger
|
||||||
|
Command line: blockingtrigger, API: sendSoftwareTrigger
|
||||||
|
Sends software trigger signal to detector and blocks till frames are
|
||||||
|
sent out for that trigger.
|
||||||
|
|
||||||
|
24. [Eiger] Data stream enable for ports
|
||||||
|
Command line: datastream, API: getDataStream/ setDataStream
|
||||||
|
Enable or disable each port. Default: enabled
|
||||||
|
|
||||||
|
25. Changing TCP ports
|
||||||
|
This will only affect shared memory and will not try to change the
|
||||||
|
current tcp port of the control/stop server in detector.
|
||||||
|
|
||||||
|
26. [Eiger][Jungfrau][Gotthard2] Speed
|
||||||
|
Command line: readoutspeed, readoutspeedlist API: getReadoutSpeed/ setReadoutSpeed /
|
||||||
|
getReadoutSpeedList
|
||||||
|
Previous command: speed, setSpeed/ getSpeed
|
||||||
|
[Eiger][Jungfrau] same as before.
|
||||||
|
[Gotthard2] New command to set readout speed. Options: 108, 144 (in MHz)
|
||||||
|
|
||||||
|
27. [Eiger][Jungfrau] Flip rows
|
||||||
|
Command line: fliprows, API: getFlipRows/ setFlipRows
|
||||||
|
Previous command: flippeddatax, setBottom/ getBottom
|
||||||
|
[Jungfrau] Flips rows in detector only for HW v2.0.
|
||||||
|
slsReceiver and slsDetectorGui will not flip them again.
|
||||||
|
[Eiger] same as before.
|
||||||
|
|
||||||
|
28. [Jungfrau]
|
||||||
|
Command line changes: autocompdisable, Previous command line: auto_comp_disable
|
||||||
|
|
||||||
|
|
||||||
|
Detector servers
|
||||||
|
----------------
|
||||||
|
|
||||||
|
1. [Gotthard2] Bad Channels moved to a new register, default settings
|
||||||
|
including clock frequency changed
|
||||||
|
|
||||||
|
2. [Gotthard2] Updated config file in detector server
|
||||||
|
|
||||||
|
|
||||||
|
Virtual servers
|
||||||
|
----------------
|
||||||
|
|
||||||
|
1. Artifical pixel values increasing by every packet, instead of every pixel.
|
||||||
|
|
||||||
|
2. All possible features updated.
|
||||||
|
|
||||||
|
|
||||||
|
Receiver
|
||||||
|
--------
|
||||||
|
|
||||||
|
1. Frames caught in metadata
|
||||||
|
Frames caught by the master receiver is added to master file metadata.
|
||||||
|
Hdf5 and Binary version numbers changed to 6.3
|
||||||
|
|
||||||
|
2. Removed Padding option for Deactivated half modules.
|
||||||
|
|
||||||
|
3. Changing Receiver TCP ports
|
||||||
|
This will only affect shared memory and will not try to change the
|
||||||
|
current tcp port of the receiver.
|
||||||
|
|
||||||
|
Gui
|
||||||
|
----
|
||||||
|
|
||||||
|
1. [Mythen3] counters added in settings tab
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
2. Resolved Issues
|
2. Resolved Issues
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
Detector Servers
|
||||||
|
----------------
|
||||||
|
|
||||||
3. Firmware Requirements
|
1. [Gotthard2] Tolerance in time parameters.
|
||||||
|
Eg. 220 ns was being set to 215 ns, instead of 222ns.
|
||||||
|
|
||||||
|
2. [Jungfrau] Stopping in trigger mode and then switching to auto timing mode
|
||||||
|
blocks data streaming from detector. Workaround fix made in
|
||||||
|
detector server to reset core until next firmware release.
|
||||||
|
|
||||||
|
3. [Jungfrau][CTB][Moench][Gotthard][Gotthard2][Mythen3] Firmware Programming
|
||||||
|
Firmware programming incorporates more validations such as checksum of
|
||||||
|
program. Always ensure client and server are of same release before
|
||||||
|
programming firmware.
|
||||||
|
|
||||||
|
4. [Eiger] Stop sends last frame
|
||||||
|
Stop acquisition will now also send out all complete frames in fifo.
|
||||||
|
|
||||||
|
5. [Eiger] Bottom not rotated in quad mode. Fixed.
|
||||||
|
|
||||||
|
6. [Mythen3] counter mask effect on vthreshold
|
||||||
|
Setting counter mask changes vth daac values (ie. disabling sets to 2800),
|
||||||
|
vthreshold only changes for enabled counters, setting vth overwrites
|
||||||
|
dac even if counter disabled and when counters enabled, remembers set
|
||||||
|
values.
|
||||||
|
|
||||||
|
7. [Eiger] fast quad fix for loading trimbits
|
||||||
|
|
||||||
|
8. [Eiger] Can also use copydetectorserver command.
|
||||||
|
[All] copydetectorserver command also creates a link to the binary copied
|
||||||
|
with a shorter name ([detector]DetectorServer only)
|
||||||
|
|
||||||
|
Receiver
|
||||||
|
--------
|
||||||
|
|
||||||
|
1. Disabled port or deactivated (half) modules will not create files.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
3. Known Issues
|
||||||
|
===============
|
||||||
|
|
||||||
|
Receiver
|
||||||
|
--------
|
||||||
|
1. It does not handle readnrows or partial readout. Only the summary
|
||||||
|
is adjusted to print in red. However, it will still write complete
|
||||||
|
images with missing data padded. Roi will be implemented in future
|
||||||
|
that can be complemented with this feature to remove the additional
|
||||||
|
data in files.
|
||||||
|
|
||||||
|
2. Round robin is not implemented in receiver side, ie. one cannot configure
|
||||||
|
more than 1 receiver at a time. This will/might be done in the future.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
4. Changes in Next Major Release
|
||||||
|
================================
|
||||||
|
|
||||||
|
1. Naming of Package
|
||||||
|
The package might be renamed and so might the binaries, libraries,
|
||||||
|
namespace,include paths in the next major release (which is breaking API).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
5. Firmware Requirements
|
||||||
========================
|
========================
|
||||||
|
|
||||||
Eiger
|
Eiger
|
||||||
@ -109,6 +325,7 @@ This document describes the differences between v7.0.0 and v6.x.x
|
|||||||
|
|
||||||
Detector Upgrade
|
Detector Upgrade
|
||||||
================
|
================
|
||||||
|
|
||||||
The following can be upgraded remotely:
|
The following can be upgraded remotely:
|
||||||
Eiger via bit files
|
Eiger via bit files
|
||||||
Jungfrau via command <.pof>
|
Jungfrau via command <.pof>
|
||||||
@ -127,34 +344,8 @@ This document describes the differences between v7.0.0 and v6.x.x
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
4. Kernel Requirements
|
|
||||||
======================
|
|
||||||
|
|
||||||
Blackfin
|
6. Download, Documentation & Support
|
||||||
========
|
|
||||||
Latest version: Fri Oct 29 00:00:00 2021
|
|
||||||
|
|
||||||
Older ones will work, but might have issues with programming firmware via
|
|
||||||
the package.
|
|
||||||
|
|
||||||
Nios
|
|
||||||
====
|
|
||||||
Compatible version: Mon May 10 18:00:21 CEST 2021
|
|
||||||
|
|
||||||
Kernel Upgrade
|
|
||||||
==============
|
|
||||||
Eiger via bit files
|
|
||||||
Others via command
|
|
||||||
|
|
||||||
Commands: udpatekernel, kernelversion
|
|
||||||
Instructions available at
|
|
||||||
https://slsdetectorgroup.github.io/devdoc/commandline.html
|
|
||||||
https://slsdetectorgroup.github.io/devdoc/detector.html
|
|
||||||
https://slsdetectorgroup.github.io/devdoc/pydetector.html
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
5. Download, Documentation & Support
|
|
||||||
====================================
|
====================================
|
||||||
|
|
||||||
Download
|
Download
|
||||||
|
@ -7,9 +7,9 @@ function(enable_cxx_warning flag target)
|
|||||||
check_cxx_compiler_flag(${flag} ${flag_name})
|
check_cxx_compiler_flag(${flag} ${flag_name})
|
||||||
if(${flag_name})
|
if(${flag_name})
|
||||||
target_compile_options(${target} INTERFACE ${flag})
|
target_compile_options(${target} INTERFACE ${flag})
|
||||||
message(STATUS "Adding: ${flag} to ${target}")
|
message("Adding: ${flag} to ${target}")
|
||||||
else()
|
else()
|
||||||
message(STATUS "Flag: ${flag} not supported")
|
message("Flag: ${flag} not supported")
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
@ -18,9 +18,9 @@ function(enable_c_warning flag target)
|
|||||||
check_c_compiler_flag(${flag} ${flag_name})
|
check_c_compiler_flag(${flag} ${flag_name})
|
||||||
if(${flag_name})
|
if(${flag_name})
|
||||||
target_compile_options(${target} INTERFACE ${flag})
|
target_compile_options(${target} INTERFACE ${flag})
|
||||||
message(STATUS "Adding: ${flag} to ${target}")
|
message("Adding: ${flag} to ${target}")
|
||||||
else()
|
else()
|
||||||
message(STATUS "Flag: ${flag} not supported")
|
message("Flag: ${flag} not supported")
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
@ -31,10 +31,10 @@ function(disable_cxx_warning flag target)
|
|||||||
|
|
||||||
if(${flag_name})
|
if(${flag_name})
|
||||||
string(REPLACE "-W" "-Wno-" neg_flag ${flag})
|
string(REPLACE "-W" "-Wno-" neg_flag ${flag})
|
||||||
message(STATUS "Adding: ${neg_flag} to ${target}")
|
message("Adding: ${neg_flag} to ${target}")
|
||||||
target_compile_options(${target} INTERFACE ${neg_flag})
|
target_compile_options(${target} INTERFACE ${neg_flag})
|
||||||
else()
|
else()
|
||||||
message(STATUS "Warning: ${flag} not supported no need to disable")
|
message("Warning: ${flag} not supported no need to disable")
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
@ -43,10 +43,10 @@ function(disable_c_warning flag target)
|
|||||||
check_c_compiler_flag(${flag} ${flag_name})
|
check_c_compiler_flag(${flag} ${flag_name})
|
||||||
if(${flag_name})
|
if(${flag_name})
|
||||||
string(REPLACE "-W" "-Wno-" neg_flag ${flag})
|
string(REPLACE "-W" "-Wno-" neg_flag ${flag})
|
||||||
message(STATUS "Adding: ${neg_flag} to ${target}")
|
message("Adding: ${neg_flag} to ${target}")
|
||||||
target_compile_options(${target} INTERFACE ${neg_flag})
|
target_compile_options(${target} INTERFACE ${neg_flag})
|
||||||
else()
|
else()
|
||||||
message(STATUS "Warning: ${flag} not supported no need to disable")
|
message("Warning: ${flag} not supported no need to disable")
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
function(custom_find_zmq)
|
|
||||||
set(ZeroMQ_HINT "" CACHE STRING "Hint where ZeroMQ could be found")
|
|
||||||
#Adapted from: https://github.com/zeromq/cppzmq/
|
|
||||||
if (NOT TARGET libzmq)
|
|
||||||
if(ZeroMQ_HINT)
|
|
||||||
message(STATUS "Looking for ZeroMQ in: ${ZeroMQ_HINT}")
|
|
||||||
find_package(ZeroMQ 4
|
|
||||||
NO_DEFAULT_PATH
|
|
||||||
HINTS ${ZeroMQ_HINT}
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
find_package(ZeroMQ 4 QUIET)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# libzmq autotools install: fallback to pkg-config
|
|
||||||
if(ZeroMQ_FOUND)
|
|
||||||
message(STATUS "Found libzmq using find_package")
|
|
||||||
else()
|
|
||||||
message(STATUS "CMake libzmq package not found, trying again with pkg-config (normal install of zeromq)")
|
|
||||||
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake/libzmq-pkg-config)
|
|
||||||
find_package(ZeroMQ 4 REQUIRED)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# TODO "REQUIRED" above should already cause a fatal failure if not found, but this doesn't seem to work
|
|
||||||
if(NOT ZeroMQ_FOUND)
|
|
||||||
message(FATAL_ERROR "ZeroMQ was not found, neither as a CMake package nor via pkg-config")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (ZeroMQ_FOUND AND NOT TARGET libzmq)
|
|
||||||
message(FATAL_ERROR "ZeroMQ version not supported!")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
get_target_property(VAR libzmq IMPORTED_LOCATION)
|
|
||||||
message(STATUS "Using libzmq: ${VAR}")
|
|
||||||
|
|
||||||
|
|
||||||
endfunction()
|
|
@ -1,36 +0,0 @@
|
|||||||
#From: https://github.com/zeromq/cppzmq/
|
|
||||||
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)
|
|
||||||
find_package(PkgConfig)
|
|
||||||
pkg_check_modules(PC_LIBZMQ QUIET libzmq)
|
|
||||||
|
|
||||||
set(ZeroMQ_VERSION ${PC_LIBZMQ_VERSION})
|
|
||||||
|
|
||||||
find_path(ZeroMQ_INCLUDE_DIR zmq.h
|
|
||||||
PATHS ${ZeroMQ_DIR}/include
|
|
||||||
${PC_LIBZMQ_INCLUDE_DIRS}
|
|
||||||
)
|
|
||||||
|
|
||||||
find_library(ZeroMQ_LIBRARY
|
|
||||||
NAMES zmq
|
|
||||||
PATHS ${ZeroMQ_DIR}/lib
|
|
||||||
${PC_LIBZMQ_LIBDIR}
|
|
||||||
${PC_LIBZMQ_LIBRARY_DIRS}
|
|
||||||
)
|
|
||||||
|
|
||||||
if(ZeroMQ_LIBRARY OR ZeroMQ_STATIC_LIBRARY)
|
|
||||||
set(ZeroMQ_FOUND ON)
|
|
||||||
message(STATUS "Found libzmq using PkgConfig")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set ( ZeroMQ_LIBRARIES ${ZeroMQ_LIBRARY} )
|
|
||||||
set ( ZeroMQ_INCLUDE_DIRS ${ZeroMQ_INCLUDE_DIR} )
|
|
||||||
|
|
||||||
if (NOT TARGET libzmq)
|
|
||||||
add_library(libzmq UNKNOWN IMPORTED)
|
|
||||||
set_target_properties(libzmq PROPERTIES
|
|
||||||
IMPORTED_LOCATION ${ZeroMQ_LIBRARIES}
|
|
||||||
INTERFACE_INCLUDE_DIRECTORIES ${ZeroMQ_INCLUDE_DIRS})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include ( FindPackageHandleStandardArgs )
|
|
||||||
find_package_handle_standard_args ( ZeroMQ DEFAULT_MSG ZeroMQ_LIBRARIES ZeroMQ_INCLUDE_DIRS )
|
|
@ -26,7 +26,7 @@ install(FILES
|
|||||||
)
|
)
|
||||||
|
|
||||||
install(FILES
|
install(FILES
|
||||||
"${CMAKE_SOURCE_DIR}/cmake/libzmq-pkg-config/FindZeroMQ.cmake"
|
"${CMAKE_SOURCE_DIR}/libzmq-pkg-config/FindZeroMQ.cmake"
|
||||||
COMPONENT devel
|
COMPONENT devel
|
||||||
DESTINATION ${CMAKE_INSTALL_DIR}/libzmq-pkg-config
|
DESTINATION ${CMAKE_INSTALL_DIR}/libzmq-pkg-config
|
||||||
)
|
)
|
||||||
|
2
cmk.sh
2
cmk.sh
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
|
||||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
|
#!/bin/bash
|
||||||
CMAKE="cmake3"
|
CMAKE="cmake3"
|
||||||
BUILDDIR="build"
|
BUILDDIR="build"
|
||||||
INSTALLDIR=""
|
INSTALLDIR=""
|
||||||
|
@ -2,18 +2,17 @@
|
|||||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
|
|
||||||
mkdir build
|
mkdir build
|
||||||
|
mkdir install
|
||||||
cd build
|
cd build
|
||||||
cmake .. \
|
cmake .. \
|
||||||
-DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
|
-DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
|
||||||
-DCMAKE_INSTALL_PREFIX=$PREFIX \
|
-DCMAKE_INSTALL_PREFIX=install \
|
||||||
-DSLS_USE_TEXTCLIENT=ON \
|
-DSLS_USE_TEXTCLIENT=ON \
|
||||||
-DSLS_USE_RECEIVER=ON \
|
-DSLS_USE_RECEIVER=ON \
|
||||||
-DSLS_USE_GUI=OFF \
|
-DSLS_USE_GUI=ON \
|
||||||
-DSLS_USE_MOENCH=OFF\
|
-DSLS_USE_MOENCH=ON\
|
||||||
-DSLS_USE_TESTS=ON \
|
-DSLS_USE_TESTS=ON \
|
||||||
-DSLS_USE_PYTHON=OFF \
|
-DSLS_USE_PYTHON=OFF \
|
||||||
-DSLS_DEVEL_HEADERS=ON \
|
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
-DSLS_USE_HDF5=OFF\
|
-DSLS_USE_HDF5=OFF\
|
||||||
|
|
||||||
@ -23,7 +22,3 @@ cmake --build . -- -j${NCORES}
|
|||||||
cmake --build . --target install
|
cmake --build . --target install
|
||||||
|
|
||||||
CTEST_OUTPUT_ON_FAILURE=1 ctest -j 2
|
CTEST_OUTPUT_ON_FAILURE=1 ctest -j 2
|
||||||
|
|
||||||
#Clean up for the next build
|
|
||||||
# cd ..
|
|
||||||
# rm -rf build
|
|
2
conda-recipes/slsdet/build.sh → conda-recepie/build_pylib.sh
Normal file → Executable file
2
conda-recipes/slsdet/build.sh → conda-recepie/build_pylib.sh
Normal file → Executable file
@ -2,7 +2,5 @@
|
|||||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
|
|
||||||
echo "|<-------- starting python build"
|
echo "|<-------- starting python build"
|
||||||
echo $PWD
|
|
||||||
cd python
|
cd python
|
||||||
echo "folder: $PWD"
|
|
||||||
${PYTHON} setup.py install
|
${PYTHON} setup.py install
|
8
conda-recepie/conda_build_config.yaml
Normal file
8
conda-recepie/conda_build_config.yaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
python:
|
||||||
|
- 3.6
|
||||||
|
- 3.7
|
||||||
|
- 3.8
|
||||||
|
- 3.9
|
||||||
|
|
||||||
|
numpy:
|
||||||
|
- 1.17
|
11
conda-recepie/copy_ctbgui.sh
Normal file
11
conda-recepie/copy_ctbgui.sh
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
|
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
|
mkdir $PREFIX/lib
|
||||||
|
mkdir $PREFIX/bin
|
||||||
|
mkdir $PREFIX/include
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
cp build/bin/ctbGui $PREFIX/bin/.
|
||||||
|
cp build/bin/libctbRootLib.so $PREFIX/lib/.
|
||||||
|
|
6
slsDetectorCalibration/tiffio/tests/CMakeLists.txt → conda-recepie/copy_gui.sh
Normal file → Executable file
6
slsDetectorCalibration/tiffio/tests/CMakeLists.txt → conda-recepie/copy_gui.sh
Normal file → Executable file
@ -1,5 +1,5 @@
|
|||||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
target_sources(tests PRIVATE
|
#Copy the GUI
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-tiffio.cpp
|
mkdir -p $PREFIX/bin
|
||||||
)
|
cp build/install/bin/slsDetectorGui $PREFIX/bin/.
|
22
conda-recepie/copy_lib.sh
Executable file
22
conda-recepie/copy_lib.sh
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
|
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
|
|
||||||
|
mkdir -p $PREFIX/lib
|
||||||
|
mkdir -p $PREFIX/bin
|
||||||
|
mkdir -p $PREFIX/include/sls
|
||||||
|
# mkdir $PREFIX/include/slsDetectorPackage
|
||||||
|
|
||||||
|
#Shared and static libraries
|
||||||
|
cp build/install/lib/* $PREFIX/lib/
|
||||||
|
|
||||||
|
#Binaries
|
||||||
|
cp build/install/bin/sls_detector_acquire $PREFIX/bin/.
|
||||||
|
cp build/install/bin/sls_detector_get $PREFIX/bin/.
|
||||||
|
cp build/install/bin/sls_detector_put $PREFIX/bin/.
|
||||||
|
cp build/install/bin/sls_detector_help $PREFIX/bin/.
|
||||||
|
cp build/install/bin/slsReceiver $PREFIX/bin/.
|
||||||
|
cp build/install/bin/slsMultiReceiver $PREFIX/bin/.
|
||||||
|
|
||||||
|
|
||||||
|
cp build/install/include/sls/* $PREFIX/include/sls
|
||||||
|
cp -r build/install/share/ $PREFIX/share
|
6
conda-recepie/copy_moench.sh
Normal file
6
conda-recepie/copy_moench.sh
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
|
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
|
#Copy the Moench executables
|
||||||
|
mkdir -p $PREFIX/bin
|
||||||
|
cp build/install/bin/moench04ZmqProcess $PREFIX/bin/.
|
||||||
|
cp build/install/bin/moenchZmqProcess $PREFIX/bin/.
|
134
conda-recepie/meta.yaml
Executable file
134
conda-recepie/meta.yaml
Executable file
@ -0,0 +1,134 @@
|
|||||||
|
|
||||||
|
package:
|
||||||
|
name: sls_detector_software
|
||||||
|
version: {{ environ.get('GIT_DESCRIBE_TAG', '') }}
|
||||||
|
|
||||||
|
source:
|
||||||
|
- path: ..
|
||||||
|
|
||||||
|
build:
|
||||||
|
number: 0
|
||||||
|
binary_relocation: True
|
||||||
|
rpaths:
|
||||||
|
- lib/
|
||||||
|
|
||||||
|
requirements:
|
||||||
|
build:
|
||||||
|
- {{ compiler('c') }}
|
||||||
|
- {{compiler('cxx')}}
|
||||||
|
- cmake
|
||||||
|
- qwt 6.*
|
||||||
|
- qt 4.8.*
|
||||||
|
- zeromq
|
||||||
|
- xorg-libx11
|
||||||
|
- xorg-libice
|
||||||
|
- xorg-libxext
|
||||||
|
- xorg-libsm
|
||||||
|
- xorg-libxau
|
||||||
|
- xorg-libxrender
|
||||||
|
- xorg-libxfixes
|
||||||
|
- {{ cdt('mesa-libgl-devel') }} # [linux]
|
||||||
|
- {{ cdt('mesa-libegl-devel') }} # [linux]
|
||||||
|
- {{ cdt('mesa-dri-drivers') }} # [linux]
|
||||||
|
- {{ cdt('libselinux') }} # [linux]
|
||||||
|
- {{ cdt('libxdamage') }} # [linux]
|
||||||
|
- {{ cdt('libxxf86vm') }} # [linux]
|
||||||
|
- expat
|
||||||
|
|
||||||
|
host:
|
||||||
|
- libstdcxx-ng
|
||||||
|
- libgcc-ng
|
||||||
|
- zeromq
|
||||||
|
- xorg-libx11
|
||||||
|
- xorg-libice
|
||||||
|
- xorg-libxext
|
||||||
|
- xorg-libsm
|
||||||
|
- xorg-libxau
|
||||||
|
- xorg-libxrender
|
||||||
|
- xorg-libxfixes
|
||||||
|
- expat
|
||||||
|
|
||||||
|
run:
|
||||||
|
- zeromq
|
||||||
|
- libstdcxx-ng
|
||||||
|
- libgcc-ng
|
||||||
|
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
- name: slsdetlib
|
||||||
|
script: copy_lib.sh
|
||||||
|
|
||||||
|
requirements:
|
||||||
|
build:
|
||||||
|
- {{ compiler('c') }}
|
||||||
|
- {{compiler('cxx')}}
|
||||||
|
- libstdcxx-ng
|
||||||
|
- libgcc-ng
|
||||||
|
- zeromq
|
||||||
|
|
||||||
|
host:
|
||||||
|
- zeromq
|
||||||
|
|
||||||
|
run:
|
||||||
|
- libstdcxx-ng
|
||||||
|
- libgcc-ng
|
||||||
|
- zeromq
|
||||||
|
|
||||||
|
- name: slsdet
|
||||||
|
|
||||||
|
script: build_pylib.sh
|
||||||
|
|
||||||
|
requirements:
|
||||||
|
build:
|
||||||
|
- python
|
||||||
|
- {{ compiler('c') }}
|
||||||
|
- {{compiler('cxx')}}
|
||||||
|
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||||
|
- setuptools
|
||||||
|
|
||||||
|
host:
|
||||||
|
- python
|
||||||
|
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||||
|
|
||||||
|
|
||||||
|
run:
|
||||||
|
- libstdcxx-ng
|
||||||
|
- libgcc-ng
|
||||||
|
- python
|
||||||
|
- numpy
|
||||||
|
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||||
|
|
||||||
|
|
||||||
|
test:
|
||||||
|
imports:
|
||||||
|
- slsdet
|
||||||
|
|
||||||
|
- name: slsdetgui
|
||||||
|
script: copy_gui.sh
|
||||||
|
requirements:
|
||||||
|
|
||||||
|
build:
|
||||||
|
- {{ compiler('c') }}
|
||||||
|
- {{compiler('cxx')}}
|
||||||
|
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||||
|
- qwt 6.*
|
||||||
|
|
||||||
|
run:
|
||||||
|
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||||
|
- qwt 6.*
|
||||||
|
- qt 4.8.*
|
||||||
|
- expat
|
||||||
|
|
||||||
|
- name: moenchzmq
|
||||||
|
script: copy_moench.sh
|
||||||
|
requirements:
|
||||||
|
|
||||||
|
build:
|
||||||
|
- {{ compiler('c') }}
|
||||||
|
- {{compiler('cxx')}}
|
||||||
|
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||||
|
|
||||||
|
|
||||||
|
run:
|
||||||
|
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||||
|
- expat
|
3
conda-recepie/run_test.sh
Executable file
3
conda-recepie/run_test.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
|
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
|
ctest -j2
|
@ -1,24 +0,0 @@
|
|||||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
|
||||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
|
||||||
|
|
||||||
mkdir build
|
|
||||||
|
|
||||||
cd build
|
|
||||||
cmake .. \
|
|
||||||
-DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
|
|
||||||
-DCMAKE_INSTALL_PREFIX=$PREFIX \
|
|
||||||
-DSLS_USE_CTBGUI=ON \
|
|
||||||
-DSLS_EXT_BUILD=ON\
|
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
|
||||||
-DSLS_USE_HDF5=OFF\
|
|
||||||
|
|
||||||
NCORES=$(getconf _NPROCESSORS_ONLN)
|
|
||||||
echo "Building using: ${NCORES} cores"
|
|
||||||
cmake --build . -- -j${NCORES}
|
|
||||||
cmake --build . --target install
|
|
||||||
|
|
||||||
CTEST_OUTPUT_ON_FAILURE=1 ctest -j 2
|
|
||||||
|
|
||||||
#Clean up for the next build
|
|
||||||
# cd ..
|
|
||||||
# rm -rf build
|
|
@ -1,94 +0,0 @@
|
|||||||
package:
|
|
||||||
name: ctbgui
|
|
||||||
version: {{ environ.get('GIT_DESCRIBE_TAG', '') }}
|
|
||||||
|
|
||||||
source:
|
|
||||||
- path: ../..
|
|
||||||
|
|
||||||
build:
|
|
||||||
number: 0
|
|
||||||
binary_relocation: True
|
|
||||||
rpaths:
|
|
||||||
- lib/
|
|
||||||
|
|
||||||
requirements:
|
|
||||||
build:
|
|
||||||
- {{ compiler('c') }}
|
|
||||||
- {{compiler('cxx')}}
|
|
||||||
- slsdetlib {{ environ.get('GIT_DESCRIBE_TAG', '') }}
|
|
||||||
- cmake
|
|
||||||
- root
|
|
||||||
# - qwt 6.*
|
|
||||||
# - qt 4.8.*
|
|
||||||
# - zeromq
|
|
||||||
# - xorg-libx11
|
|
||||||
# - xorg-libice
|
|
||||||
# - xorg-libxext
|
|
||||||
# - xorg-libsm
|
|
||||||
# - xorg-libxau
|
|
||||||
# - xorg-libxrender
|
|
||||||
# - xorg-libxfixes
|
|
||||||
# - {{ cdt('mesa-libgl-devel') }} # [linux]
|
|
||||||
# - {{ cdt('mesa-libegl-devel') }} # [linux]
|
|
||||||
# - {{ cdt('mesa-dri-drivers') }} # [linux]
|
|
||||||
# - {{ cdt('libselinux') }} # [linux]
|
|
||||||
# - {{ cdt('libxdamage') }} # [linux]
|
|
||||||
# - {{ cdt('libxxf86vm') }} # [linux]
|
|
||||||
# - expat
|
|
||||||
|
|
||||||
host:
|
|
||||||
- libstdcxx-ng
|
|
||||||
- libgcc-ng
|
|
||||||
- root
|
|
||||||
- slsdetlib {{ environ.get('GIT_DESCRIBE_TAG', '') }}
|
|
||||||
# - zeromq
|
|
||||||
# - xorg-libx11
|
|
||||||
# - xorg-libice
|
|
||||||
# - xorg-libxext
|
|
||||||
# - xorg-libsm
|
|
||||||
# - xorg-libxau
|
|
||||||
# - xorg-libxrender
|
|
||||||
# - xorg-libxfixes
|
|
||||||
# - expat
|
|
||||||
|
|
||||||
run:
|
|
||||||
# - zeromq
|
|
||||||
- libstdcxx-ng
|
|
||||||
- libgcc-ng
|
|
||||||
- root
|
|
||||||
# - slsdetlib {{ environ.get('GIT_DESCRIBE_TAG', '') }}
|
|
||||||
# - qwt 6.*
|
|
||||||
# - qt 4.8.*
|
|
||||||
# - expat
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# - name: slsdetgui
|
|
||||||
# script: copy_gui.sh
|
|
||||||
# requirements:
|
|
||||||
|
|
||||||
# build:
|
|
||||||
# - {{ compiler('c') }}
|
|
||||||
# - {{compiler('cxx')}}
|
|
||||||
# - {{ pin_subpackage('slsdetlib', exact=True) }}
|
|
||||||
# - qwt 6.*
|
|
||||||
|
|
||||||
# run:
|
|
||||||
# - {{ pin_subpackage('slsdetlib', exact=True) }}
|
|
||||||
# - qwt 6.*
|
|
||||||
# - qt 4.8.*
|
|
||||||
# - expat
|
|
||||||
|
|
||||||
# - name: moenchzmq
|
|
||||||
# script: copy_moench.sh
|
|
||||||
# requirements:
|
|
||||||
|
|
||||||
# build:
|
|
||||||
# - {{ compiler('c') }}
|
|
||||||
# - {{compiler('cxx')}}
|
|
||||||
# - {{ pin_subpackage('slsdetlib', exact=True) }}
|
|
||||||
|
|
||||||
|
|
||||||
# run:
|
|
||||||
# - {{ pin_subpackage('slsdetlib', exact=True) }}
|
|
||||||
# - expat
|
|
@ -1,25 +0,0 @@
|
|||||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
|
||||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
|
||||||
|
|
||||||
mkdir build
|
|
||||||
|
|
||||||
cd build
|
|
||||||
cmake .. \
|
|
||||||
-DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
|
|
||||||
-DCMAKE_INSTALL_PREFIX=$PREFIX \
|
|
||||||
-DSLS_USE_MOENCH=ON\
|
|
||||||
-DSLS_USE_TESTS=ON \
|
|
||||||
-DSLS_EXT_BUILD=ON \
|
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
|
||||||
-DSLS_USE_HDF5=OFF\
|
|
||||||
|
|
||||||
NCORES=$(getconf _NPROCESSORS_ONLN)
|
|
||||||
echo "Building using: ${NCORES} cores"
|
|
||||||
cmake --build . -- -j${NCORES}
|
|
||||||
cmake --build . --target install
|
|
||||||
|
|
||||||
CTEST_OUTPUT_ON_FAILURE=1 ctest -j 2
|
|
||||||
|
|
||||||
#Clean up for the next build
|
|
||||||
# cd ..
|
|
||||||
# rm -rf build
|
|
@ -1,36 +0,0 @@
|
|||||||
|
|
||||||
package:
|
|
||||||
name: moenchzmq
|
|
||||||
version: {{ environ.get('GIT_DESCRIBE_TAG', '') }}
|
|
||||||
|
|
||||||
source:
|
|
||||||
- path: ../..
|
|
||||||
|
|
||||||
build:
|
|
||||||
number: 0
|
|
||||||
binary_relocation: True
|
|
||||||
rpaths:
|
|
||||||
- lib/
|
|
||||||
|
|
||||||
requirements:
|
|
||||||
build:
|
|
||||||
- {{ compiler('c') }}
|
|
||||||
- {{compiler('cxx')}}
|
|
||||||
- cmake
|
|
||||||
- libstdcxx-ng
|
|
||||||
- libgcc-ng
|
|
||||||
- zeromq
|
|
||||||
- libtiff
|
|
||||||
- slsdetlib {{ environ.get('GIT_DESCRIBE_TAG', '') }}
|
|
||||||
|
|
||||||
host:
|
|
||||||
- zeromq
|
|
||||||
- libtiff
|
|
||||||
- slsdetlib {{ environ.get('GIT_DESCRIBE_TAG', '') }}
|
|
||||||
|
|
||||||
run:
|
|
||||||
- libstdcxx-ng
|
|
||||||
- libgcc-ng
|
|
||||||
- zeromq
|
|
||||||
- libtiff
|
|
||||||
- slsdetlib {{ environ.get('GIT_DESCRIBE_TAG', '') }}
|
|
@ -1,2 +0,0 @@
|
|||||||
python:
|
|
||||||
- 3.9
|
|
@ -1,34 +0,0 @@
|
|||||||
|
|
||||||
package:
|
|
||||||
name: slsdet
|
|
||||||
version: {{ environ.get('GIT_DESCRIBE_TAG', '') }}
|
|
||||||
|
|
||||||
source:
|
|
||||||
- path: ../..
|
|
||||||
|
|
||||||
build:
|
|
||||||
number: 0
|
|
||||||
binary_relocation: True
|
|
||||||
rpaths:
|
|
||||||
- lib/
|
|
||||||
|
|
||||||
requirements:
|
|
||||||
build:
|
|
||||||
- python
|
|
||||||
- {{ compiler('c') }}
|
|
||||||
- {{compiler('cxx')}}
|
|
||||||
- cmake
|
|
||||||
- slsdetlib {{ environ.get('GIT_DESCRIBE_TAG', '') }}
|
|
||||||
- setuptools
|
|
||||||
|
|
||||||
host:
|
|
||||||
- python
|
|
||||||
- slsdetlib {{ environ.get('GIT_DESCRIBE_TAG', '') }}
|
|
||||||
|
|
||||||
|
|
||||||
run:
|
|
||||||
- libstdcxx-ng
|
|
||||||
- libgcc-ng
|
|
||||||
- python
|
|
||||||
- numpy
|
|
||||||
- slsdetlib {{ environ.get('GIT_DESCRIBE_TAG', '') }}
|
|
@ -1,24 +0,0 @@
|
|||||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
|
||||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
|
||||||
|
|
||||||
mkdir build
|
|
||||||
|
|
||||||
cd build
|
|
||||||
cmake .. \
|
|
||||||
-DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
|
|
||||||
-DCMAKE_INSTALL_PREFIX=$PREFIX \
|
|
||||||
-DSLS_USE_GUI=ON \
|
|
||||||
-DSLS_EXT_BUILD=ON\
|
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
|
||||||
-DSLS_USE_HDF5=OFF\
|
|
||||||
|
|
||||||
NCORES=$(getconf _NPROCESSORS_ONLN)
|
|
||||||
echo "Building using: ${NCORES} cores"
|
|
||||||
cmake --build . -- -j${NCORES}
|
|
||||||
cmake --build . --target install
|
|
||||||
|
|
||||||
CTEST_OUTPUT_ON_FAILURE=1 ctest -j 2
|
|
||||||
|
|
||||||
#Clean up for the next build
|
|
||||||
# cd ..
|
|
||||||
# rm -rf build
|
|
@ -1,91 +0,0 @@
|
|||||||
package:
|
|
||||||
name: slsdetgui
|
|
||||||
version: {{ environ.get('GIT_DESCRIBE_TAG', '') }}
|
|
||||||
|
|
||||||
source:
|
|
||||||
- path: ../..
|
|
||||||
|
|
||||||
build:
|
|
||||||
number: 0
|
|
||||||
binary_relocation: True
|
|
||||||
rpaths:
|
|
||||||
- lib/
|
|
||||||
|
|
||||||
requirements:
|
|
||||||
build:
|
|
||||||
- {{ compiler('c') }}
|
|
||||||
- {{compiler('cxx')}}
|
|
||||||
- slsdetlib {{ environ.get('GIT_DESCRIBE_TAG', '') }}
|
|
||||||
- cmake
|
|
||||||
- qwt 6.*
|
|
||||||
- qt 4.8.*
|
|
||||||
- zeromq
|
|
||||||
- xorg-libx11
|
|
||||||
- xorg-libice
|
|
||||||
- xorg-libxext
|
|
||||||
- xorg-libsm
|
|
||||||
- xorg-libxau
|
|
||||||
- xorg-libxrender
|
|
||||||
- xorg-libxfixes
|
|
||||||
- {{ cdt('mesa-libgl-devel') }} # [linux]
|
|
||||||
- {{ cdt('mesa-libegl-devel') }} # [linux]
|
|
||||||
- {{ cdt('mesa-dri-drivers') }} # [linux]
|
|
||||||
- {{ cdt('libselinux') }} # [linux]
|
|
||||||
- {{ cdt('libxdamage') }} # [linux]
|
|
||||||
- {{ cdt('libxxf86vm') }} # [linux]
|
|
||||||
- expat
|
|
||||||
|
|
||||||
host:
|
|
||||||
- libstdcxx-ng
|
|
||||||
- libgcc-ng
|
|
||||||
- slsdetlib {{ environ.get('GIT_DESCRIBE_TAG', '') }}
|
|
||||||
- zeromq
|
|
||||||
- xorg-libx11
|
|
||||||
- xorg-libice
|
|
||||||
- xorg-libxext
|
|
||||||
- xorg-libsm
|
|
||||||
- xorg-libxau
|
|
||||||
- xorg-libxrender
|
|
||||||
- xorg-libxfixes
|
|
||||||
- expat
|
|
||||||
|
|
||||||
run:
|
|
||||||
- zeromq
|
|
||||||
- libstdcxx-ng
|
|
||||||
- libgcc-ng
|
|
||||||
- slsdetlib {{ environ.get('GIT_DESCRIBE_TAG', '') }}
|
|
||||||
- qwt 6.*
|
|
||||||
- qt 4.8.*
|
|
||||||
- expat
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# - name: slsdetgui
|
|
||||||
# script: copy_gui.sh
|
|
||||||
# requirements:
|
|
||||||
|
|
||||||
# build:
|
|
||||||
# - {{ compiler('c') }}
|
|
||||||
# - {{compiler('cxx')}}
|
|
||||||
# - {{ pin_subpackage('slsdetlib', exact=True) }}
|
|
||||||
# - qwt 6.*
|
|
||||||
|
|
||||||
# run:
|
|
||||||
# - {{ pin_subpackage('slsdetlib', exact=True) }}
|
|
||||||
# - qwt 6.*
|
|
||||||
# - qt 4.8.*
|
|
||||||
# - expat
|
|
||||||
|
|
||||||
# - name: moenchzmq
|
|
||||||
# script: copy_moench.sh
|
|
||||||
# requirements:
|
|
||||||
|
|
||||||
# build:
|
|
||||||
# - {{ compiler('c') }}
|
|
||||||
# - {{compiler('cxx')}}
|
|
||||||
# - {{ pin_subpackage('slsdetlib', exact=True) }}
|
|
||||||
|
|
||||||
|
|
||||||
# run:
|
|
||||||
# - {{ pin_subpackage('slsdetlib', exact=True) }}
|
|
||||||
# - expat
|
|
@ -1,90 +0,0 @@
|
|||||||
|
|
||||||
package:
|
|
||||||
name: slsdetlib
|
|
||||||
version: {{ environ.get('GIT_DESCRIBE_TAG', '') }}
|
|
||||||
|
|
||||||
source:
|
|
||||||
- path: ../..
|
|
||||||
|
|
||||||
build:
|
|
||||||
number: 0
|
|
||||||
binary_relocation: True
|
|
||||||
rpaths:
|
|
||||||
- lib/
|
|
||||||
|
|
||||||
requirements:
|
|
||||||
build:
|
|
||||||
- {{ compiler('c') }}
|
|
||||||
- {{compiler('cxx')}}
|
|
||||||
- cmake
|
|
||||||
- libstdcxx-ng
|
|
||||||
- libgcc-ng
|
|
||||||
- zeromq
|
|
||||||
|
|
||||||
host:
|
|
||||||
- zeromq
|
|
||||||
|
|
||||||
run:
|
|
||||||
- libstdcxx-ng
|
|
||||||
- libgcc-ng
|
|
||||||
- zeromq
|
|
||||||
|
|
||||||
|
|
||||||
# outputs:
|
|
||||||
# - name: slsdetlib
|
|
||||||
# script: build_lib.sh
|
|
||||||
|
|
||||||
# requirements:
|
|
||||||
# build:
|
|
||||||
# - {{ compiler('c') }}
|
|
||||||
# - {{compiler('cxx')}}
|
|
||||||
# - libstdcxx-ng
|
|
||||||
# - libgcc-ng
|
|
||||||
# - zeromq
|
|
||||||
|
|
||||||
# host:
|
|
||||||
# - zeromq
|
|
||||||
|
|
||||||
# run:
|
|
||||||
# - libstdcxx-ng
|
|
||||||
# - libgcc-ng
|
|
||||||
# - zeromq
|
|
||||||
|
|
||||||
# - name: slsdet
|
|
||||||
# script: build_py.sh
|
|
||||||
|
|
||||||
# requirements:
|
|
||||||
# build:
|
|
||||||
# - python
|
|
||||||
# - {{ compiler('c') }}
|
|
||||||
# - {{compiler('cxx')}}
|
|
||||||
# - {{ pin_subpackage('slsdetlib', exact=True) }}
|
|
||||||
# - setuptools
|
|
||||||
|
|
||||||
# host:
|
|
||||||
# - python
|
|
||||||
# - {{ pin_subpackage('slsdetlib', exact=True) }}
|
|
||||||
|
|
||||||
|
|
||||||
# run:
|
|
||||||
# - libstdcxx-ng
|
|
||||||
# - libgcc-ng
|
|
||||||
# - python
|
|
||||||
# - numpy
|
|
||||||
# - {{ pin_subpackage('slsdetlib', exact=True) }}
|
|
||||||
|
|
||||||
# - name: slsdetgui
|
|
||||||
# script: build_gui.sh
|
|
||||||
# requirements:
|
|
||||||
|
|
||||||
# build:
|
|
||||||
# - {{ compiler('c') }}
|
|
||||||
# - {{compiler('cxx')}}
|
|
||||||
# - {{ pin_subpackage('slsdetlib', exact=True) }}
|
|
||||||
# - qwt 6.*
|
|
||||||
|
|
||||||
# run:
|
|
||||||
# - {{ pin_subpackage('slsdetlib', exact=True) }}
|
|
||||||
# - qwt 6.*
|
|
||||||
# - qt 4.8.*
|
|
||||||
# - expat
|
|
@ -34,7 +34,7 @@ add_executable(ctbGui
|
|||||||
ctbAdcs.cpp
|
ctbAdcs.cpp
|
||||||
ctbPattern.cpp
|
ctbPattern.cpp
|
||||||
ctbAcquisition.cpp
|
ctbAcquisition.cpp
|
||||||
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/tiffio/src/tiffIO.cpp
|
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/tiffIO.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -43,7 +43,6 @@ target_include_directories(ctbGui PRIVATE
|
|||||||
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/dataStructures
|
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/dataStructures
|
||||||
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/interpolations
|
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/interpolations
|
||||||
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/
|
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/
|
||||||
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/tiffio/include/
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Headders needed for ROOT dictionary generation
|
# Headders needed for ROOT dictionary generation
|
||||||
@ -62,6 +61,7 @@ set( HEADERS
|
|||||||
#set(ROOT_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
|
#set(ROOT_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
# ROOT dictionary generation
|
# ROOT dictionary generation
|
||||||
|
include("${ROOT_DIR}/RootMacros.cmake")
|
||||||
root_generate_dictionary(ctbDict ${HEADERS} LINKDEF ctbLinkDef.h)
|
root_generate_dictionary(ctbDict ${HEADERS} LINKDEF ctbLinkDef.h)
|
||||||
add_library(ctbRootLib SHARED ctbDict.cxx)
|
add_library(ctbRootLib SHARED ctbDict.cxx)
|
||||||
target_include_directories(ctbRootLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
target_include_directories(ctbRootLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
@ -83,12 +83,7 @@ target_link_libraries(ctbGui PUBLIC
|
|||||||
${TIFF_LIBRARIES}
|
${TIFF_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
#set_target_properties(ctbGui PROPERTIES
|
set_target_properties(ctbGui PROPERTIES
|
||||||
# RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||||
#
|
|
||||||
#)
|
|
||||||
|
|
||||||
install(TARGETS ctbGui ctbRootLib
|
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
||||||
)
|
)
|
@ -21,10 +21,9 @@ fi
|
|||||||
|
|
||||||
if [ -f "$infile" ]
|
if [ -f "$infile" ]
|
||||||
then
|
then
|
||||||
dir=$(dirname $infile)
|
gcc -DINFILE="\"$infile\"" -DOUTFILE="\"$outfile\"" -DOUTFILEBIN="\"$outfilebin\"" -o $exe generator.c ;
|
||||||
gcc -DINFILE="\"$infile\"" -DOUTFILE="\"$outfile\"" -DOUTFILEBIN="\"$outfilebin\"" -o $exe generator.c -I$dir;
|
|
||||||
echo compiling
|
echo compiling
|
||||||
echo gcc -DINFILE="\"$infile\"" -DOUTFILE="\"$outfile\"" -DOUTFILEBIN="\"$outfilebin\"" -o $exe generator.c -I$dir;
|
echo gcc -DINFILE="\"$infile\"" -DOUTFILE="\"$outfile\"" -DOUTFILEBIN="\"$outfilebin\"" -o $exe generator.c ;
|
||||||
$exe ;
|
$exe ;
|
||||||
echo cleaning
|
echo cleaning
|
||||||
rm $exe
|
rm $exe
|
||||||
|
@ -69,14 +69,14 @@ void setoutput(int bit) {
|
|||||||
mask=mask<<bit;
|
mask=mask<<bit;
|
||||||
iopat |= mask;
|
iopat |= mask;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
void setclk(int bit) {
|
void setclk(int bit) {
|
||||||
uint64_t mask=1;
|
uint64_t mask=1;
|
||||||
mask=mask<<bit;
|
mask=mask<<bit;
|
||||||
iopat |= mask;
|
iopat |= mask;
|
||||||
clkpat |= mask;
|
clkpat |= mask;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
void clearbit(int bit){
|
void clearbit(int bit){
|
||||||
uint64_t mask=1;
|
uint64_t mask=1;
|
||||||
mask=mask<<bit;
|
mask=mask<<bit;
|
||||||
@ -157,7 +157,7 @@ main(void) {
|
|||||||
#include INFILE
|
#include INFILE
|
||||||
|
|
||||||
fprintf(fd,"patioctrl 0x%016llx\n",iopat);
|
fprintf(fd,"patioctrl 0x%016llx\n",iopat);
|
||||||
//fprintf(fd,"patclkctrl 0x%016llx\n",clkpat);
|
fprintf(fd,"patclkctrl 0x%016llx\n",clkpat);
|
||||||
fprintf(fd,"patlimits 0x%04x 0x%04x\n",start, stop);
|
fprintf(fd,"patlimits 0x%04x 0x%04x\n",start, stop);
|
||||||
|
|
||||||
for (iloop=0; iloop<MAXLOOPS; iloop++) {
|
for (iloop=0; iloop<MAXLOOPS; iloop++) {
|
||||||
|
@ -34,12 +34,6 @@ Python bindings
|
|||||||
* pybind11 (packaged in libs/)
|
* pybind11 (packaged in libs/)
|
||||||
|
|
||||||
|
|
||||||
-----------------------
|
|
||||||
Moench executables
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
* libtiff
|
|
||||||
|
|
||||||
-----------------------
|
-----------------------
|
||||||
Documentation
|
Documentation
|
||||||
-----------------------
|
-----------------------
|
||||||
|
@ -305,18 +305,8 @@ Firmware Troubleshooting with blackfin
|
|||||||
|
|
||||||
5. If one can't list it, read the next section to try to get the blackfin to list it.
|
5. If one can't list it, read the next section to try to get the blackfin to list it.
|
||||||
|
|
||||||
How to get back mtd3 drive remotely (udpating kernel)
|
How to get back mtd3 drive remotely (copying new kernel)
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
You have 2 alternatives to update the kernel.
|
|
||||||
|
|
||||||
1. Commands via software (>= v6.0.0)
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
sls_detector_put updatekernel /home/...path-to-kernel-image
|
|
||||||
|
|
||||||
|
|
||||||
2. or command line
|
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
|
@ -45,7 +45,6 @@ int main() {
|
|||||||
|
|
||||||
for (const auto &cmd : commands) {
|
for (const auto &cmd : commands) {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
std::cout << cmd << '\n';
|
|
||||||
proxy.Call(cmd, {}, -1, slsDetectorDefs::HELP_ACTION, os);
|
proxy.Call(cmd, {}, -1, slsDetectorDefs::HELP_ACTION, os);
|
||||||
|
|
||||||
auto tmp = os.str().erase(0, cmd.size());
|
auto tmp = os.str().erase(0, cmd.size());
|
||||||
|
@ -136,7 +136,7 @@ can use dir()
|
|||||||
'__str__', '__subclasshook__', '_adc_register', '_frozen',
|
'__str__', '__subclasshook__', '_adc_register', '_frozen',
|
||||||
'_register', 'acquire', 'adcclk', 'adcphase', 'adcpipeline',
|
'_register', 'acquire', 'adcclk', 'adcphase', 'adcpipeline',
|
||||||
'adcreg', 'asamples', 'auto_comp_disable', 'clearAcquiringFlag',
|
'adcreg', 'asamples', 'auto_comp_disable', 'clearAcquiringFlag',
|
||||||
'clearBit', 'clearROI', 'client_version', 'config',
|
'clearBit', 'clearROI', 'client_version', 'config', 'copyDetectorServer',
|
||||||
'counters', 'daclist', 'dacvalues', 'dbitclk', 'dbitphase' ...
|
'counters', 'daclist', 'dacvalues', 'dbitclk', 'dbitphase' ...
|
||||||
|
|
||||||
Since the list for Detector is rather long it's an good idea to filter it.
|
Since the list for Detector is rather long it's an good idea to filter it.
|
||||||
|
@ -5,42 +5,17 @@ Detector Server Upgrade
|
|||||||
|
|
||||||
**Location:** slsDetectorPackage/serverBin/ folder for every release.
|
**Location:** slsDetectorPackage/serverBin/ folder for every release.
|
||||||
|
|
||||||
.. note ::
|
|
||||||
|
|
||||||
For Mythen3, Gotthard2 and Eiger, you need to add scripts to automatically start detector server upon power on. See :ref:`Automatic start<Automatic start servers>` for more details.
|
|
||||||
|
|
||||||
.. note ::
|
|
||||||
|
|
||||||
Eiger requires a manual reboot. Or killall the servers and restart the new linked one. If you are in the process of updating firmware, then don't reboot yet.
|
|
||||||
|
|
||||||
|
|
||||||
From 6.1.1 and above (no tftp required)
|
|
||||||
---------------------------------------
|
|
||||||
|
|
||||||
#. Program from console
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
# the following command copies new server, creates a soft link to xxxDetectorServerxxx
|
|
||||||
# [Jungfrau][CTB][Moench] also deletes the old server binary and edits initttab to respawn server on reboot
|
|
||||||
# Then, the detector controller will reboot (except Eiger)
|
|
||||||
sls_detector_put updatedetectorserver /complete-path-to-binary/xxxDetectorServerxxx
|
|
||||||
|
|
||||||
#. Copy the detector server specific config files or any others required to the detector:
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
sls_detector_put execcommand "tftp pcxxx -r configxxx -g"
|
|
||||||
|
|
||||||
5.0.0 - 6.1.1
|
|
||||||
--------------
|
|
||||||
|
|
||||||
#. Install tftp and copy detector server binary to tftp folder
|
#. Install tftp and copy detector server binary to tftp folder
|
||||||
#. Program from console
|
#. Program from console
|
||||||
|
|
||||||
|
.. note ::
|
||||||
|
|
||||||
|
These instructions are for upgrades from v5.0.0. For earlier versions, contact us.
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
# the following command copies new server from pc tftp folder, creates a soft link to xxxDetectorServerxxx
|
# copies new server from pc tftp folder, creates a soft link to xxxDetectorServerxxx
|
||||||
# [Jungfrau][CTB][Moench] also edits initttab to respawn server on reboot
|
# [Jungfrau][CTB][Moench] also edits initttab to respawn server on reboot
|
||||||
# Then, the detector controller will reboot (except Eiger)
|
# Then, the detector controller will reboot (except Eiger)
|
||||||
sls_detector_put copydetectorserver xxxDetectorServerxxx pcxxx
|
sls_detector_put copydetectorserver xxxDetectorServerxxx pcxxx
|
||||||
@ -52,15 +27,18 @@ From 6.1.1 and above (no tftp required)
|
|||||||
sls_detector_put execcommand "tftp pcxxx -r configxxx -g"
|
sls_detector_put execcommand "tftp pcxxx -r configxxx -g"
|
||||||
|
|
||||||
|
|
||||||
Troubleshooting with tftp
|
.. note ::
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
For Mythen3, Gotthard2 and Eiger, you need to add scripts to automatically start detector server upon power on. See :ref:`Automatic start<Automatic start servers>` for more details.
|
||||||
|
|
||||||
|
.. note ::
|
||||||
|
|
||||||
|
Eiger requires a manual reboot. Or killall the servers and restart the new linked one. If you are in the process of updating firmware, then don't reboot yet.
|
||||||
|
|
||||||
|
|
||||||
|
Errors
|
||||||
|
------
|
||||||
|
|
||||||
#. tftp write error: There is no space left. Please delete some old binaries and try again.
|
#. tftp write error: There is no space left. Please delete some old binaries and try again.
|
||||||
|
|
||||||
#. text file busy: You are trying to copy the same server.
|
#. text file busy: You are trying to copy the same server.
|
||||||
|
|
||||||
|
|
||||||
Older than 5.0.0
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
Please contact us.
|
|
@ -247,19 +247,6 @@ Possible causes could be the following:
|
|||||||
* For Jungfrau, refer to :ref:`Jungfrau Power Supply Troubleshooting<Jungfrau Troubleshooting Power Supply>`.
|
* For Jungfrau, refer to :ref:`Jungfrau Power Supply Troubleshooting<Jungfrau Troubleshooting Power Supply>`.
|
||||||
|
|
||||||
|
|
||||||
Cannot ping module (Nios)
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
If you executed "reboot" command on the board, you cannot ping it anymore unless you power cycle. To reboot the controller, please use the software command ("rebootcontroller"), which talks to the microcontroller.
|
|
||||||
|
|
||||||
Gotthard2
|
|
||||||
---------
|
|
||||||
|
|
||||||
Cannot get data without a module attached
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
You cannot get data without a module attached as a specific pin is floating. Attach module to get data.
|
|
||||||
|
|
||||||
|
|
||||||
Gotthard
|
Gotthard
|
||||||
----------
|
----------
|
||||||
|
@ -3,33 +3,33 @@
|
|||||||
### edit with hostname or IP address of your detector
|
### edit with hostname or IP address of your detector
|
||||||
############################################
|
############################################
|
||||||
#hostname bchip181+
|
#hostname bchip181+
|
||||||
hostname bchip119.psi.ch
|
hostname bchip181+
|
||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
### edit with hostname or 1Gbs IP address of your server
|
### edit with hostname or 1Gbs IP address of your server
|
||||||
############################################
|
############################################
|
||||||
rx_hostname mpc2011:1777
|
rx_hostname mpc2011
|
||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
### edit with 10 Gbs IP of your server
|
### edit with 10 Gbs IP of your server
|
||||||
############################################
|
############################################
|
||||||
udp_dstip 10.1.2.102
|
udp_dstip 10.1.1.102
|
||||||
#############################################
|
#############################################
|
||||||
### edit with any number in the subnet of your server (first 3 numbers as above)
|
### edit with any number in the subnet of your server (first 3 numbers as above)
|
||||||
############################################
|
############################################
|
||||||
udp_srcip 10.1.2.19
|
udp_srcip 10.1.1.19
|
||||||
udp_dstport 32000
|
udp_dstport 32411
|
||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
### edit with 10 Gbs IP of your server
|
### edit with 10 Gbs IP of your server
|
||||||
############################################
|
############################################
|
||||||
rx_zmqip 10.1.2.102
|
rx_zmqip 10.1.1.102
|
||||||
rx_zmqport 77000
|
rx_zmqport 50003
|
||||||
#############################################
|
#############################################
|
||||||
### edit with 1 Gbs IP of PC where you will run the GUI
|
### edit with 1 Gbs IP of PC where you will run the GUI
|
||||||
############################################
|
############################################
|
||||||
zmqip 129.129.202.132
|
zmqip 129.129.202.98
|
||||||
zmqport 77001
|
zmqport 50001
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ rx_zmqstream 1
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
frames 1000
|
frames 100000
|
||||||
period 0.0006
|
period 0.0006
|
||||||
exptime 0.00035
|
exptime 0.00035
|
||||||
|
|
||||||
@ -62,9 +62,3 @@ highvoltage 90
|
|||||||
#adcreg 0x14 0x40
|
#adcreg 0x14 0x40
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
frames 10
|
|
||||||
period 0.1
|
|
||||||
rx_jsonpara subframes 1
|
|
||||||
rx_jsonpara frameMode raw
|
|
||||||
rx_jsonpara detectorMode analog
|
|
||||||
|
5658
libs/catch/catch.hpp
5658
libs/catch/catch.hpp
File diff suppressed because it is too large
Load Diff
Submodule libs/pybind11 updated: 914c06fb25...8de7772cc7
27
libzmq-pkg-config/FindZeroMQ.cmake
Executable file
27
libzmq-pkg-config/FindZeroMQ.cmake
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#From: https://github.com/zeromq/cppzmq/
|
||||||
|
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)
|
||||||
|
find_package(PkgConfig)
|
||||||
|
pkg_check_modules(PC_LIBZMQ QUIET libzmq)
|
||||||
|
|
||||||
|
set(ZeroMQ_VERSION ${PC_LIBZMQ_VERSION})
|
||||||
|
find_library(ZeroMQ_LIBRARY NAMES libzmq.so libzmq.dylib libzmq.dll
|
||||||
|
PATHS ${PC_LIBZMQ_LIBDIR} ${PC_LIBZMQ_LIBRARY_DIRS})
|
||||||
|
find_library(ZeroMQ_STATIC_LIBRARY NAMES libzmq-static.a libzmq.a libzmq.dll.a
|
||||||
|
PATHS ${PC_LIBZMQ_LIBDIR} ${PC_LIBZMQ_LIBRARY_DIRS})
|
||||||
|
|
||||||
|
if(ZeroMQ_LIBRARY OR ZeroMQ_STATIC_LIBRARY)
|
||||||
|
set(ZeroMQ_FOUND ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (TARGET libzmq)
|
||||||
|
# avoid errors defining targets twice
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(libzmq SHARED IMPORTED)
|
||||||
|
set_property(TARGET libzmq PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PC_LIBZMQ_INCLUDE_DIRS})
|
||||||
|
set_property(TARGET libzmq PROPERTY IMPORTED_LOCATION ${ZeroMQ_LIBRARY})
|
||||||
|
|
||||||
|
add_library(libzmq-static STATIC IMPORTED ${PC_LIBZMQ_INCLUDE_DIRS})
|
||||||
|
set_property(TARGET libzmq-static PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PC_LIBZMQ_INCLUDE_DIRS})
|
||||||
|
set_property(TARGET libzmq-static PROPERTY IMPORTED_LOCATION ${ZeroMQ_STATIC_LIBRARY})
|
@ -13,11 +13,11 @@ import subprocess
|
|||||||
|
|
||||||
from parse import remove_comments
|
from parse import remove_comments
|
||||||
|
|
||||||
|
allow_bitwise_op = ["M3_GainCaps"]
|
||||||
|
allow_bitwise_op = ["streamingInterface"]
|
||||||
|
|
||||||
allow_bitwise_op = ["streamingInterface", "M3_GainCaps"]
|
op_key = {"operator|": "__or__",
|
||||||
|
"operator&" : "__and__"}
|
||||||
op_key = {"operator|": "|",
|
|
||||||
"operator&" : "&"}
|
|
||||||
|
|
||||||
def single_line_enum(line):
|
def single_line_enum(line):
|
||||||
sub = line[line.find('{')+1:line.find('}')]
|
sub = line[line.find('{')+1:line.find('}')]
|
||||||
@ -92,7 +92,8 @@ def generate_enum_string(enums):
|
|||||||
|
|
||||||
#Here add the operators
|
#Here add the operators
|
||||||
for op in operators:
|
for op in operators:
|
||||||
data.append(f"\n\t.def(py::self {op_key[op]} slsDetectorDefs::{key}())")
|
data.append(f"\n\t.def(\"{op_key[op]}\", py::overload_cast< const slsDetectorDefs::streamingInterface&, const slsDetectorDefs::streamingInterface&>(&{op}))")
|
||||||
|
|
||||||
|
|
||||||
data.append(';\n\n')
|
data.append(';\n\n')
|
||||||
return ''.join(data)
|
return ''.join(data)
|
||||||
|
@ -6,57 +6,49 @@ sls::Detector class. The tool needs the libclang bindings
|
|||||||
to be installed.
|
to be installed.
|
||||||
|
|
||||||
When the Detector API is updated this file should be run
|
When the Detector API is updated this file should be run
|
||||||
manually.
|
manually
|
||||||
"""
|
"""
|
||||||
from clang import cindex
|
from clang import cindex
|
||||||
import subprocess
|
import subprocess
|
||||||
import argparse
|
import argparse
|
||||||
import sys
|
|
||||||
import time
|
|
||||||
from pathlib import Path
|
|
||||||
from parse import system_include_paths, clang_format_version
|
|
||||||
|
|
||||||
REDC = '\033[91m'
|
|
||||||
GREENC = '\033[92m'
|
|
||||||
ENDC = '\033[0m'
|
|
||||||
def red(msg):
|
|
||||||
return f'{REDC}{msg}{ENDC}'
|
|
||||||
|
|
||||||
def green(msg):
|
|
||||||
return f'{GREENC}{msg}{ENDC}'
|
|
||||||
|
|
||||||
def check_clang_format_version(required_version):
|
|
||||||
if (ver := clang_format_version()) != required_version:
|
|
||||||
msg = red(f'Clang format version {required_version} required, detected: {ver}. Bye!')
|
|
||||||
print(msg)
|
|
||||||
sys.exit(1)
|
|
||||||
else:
|
|
||||||
msg = green(f'Found clang-format version {ver}')
|
|
||||||
print(msg)
|
|
||||||
|
|
||||||
def check_for_compile_commands_json(path):
|
|
||||||
# print(f"Looking for compile data base in: {path}")
|
|
||||||
compile_data_base_file = path/'compile_commands.json'
|
|
||||||
if not compile_data_base_file.exists():
|
|
||||||
msg = red(f"No compile_commands.json file found in {path}. Bye!")
|
|
||||||
print(msg)
|
|
||||||
sys.exit(1)
|
|
||||||
else:
|
|
||||||
msg = green(f'Found: {compile_data_base_file}')
|
|
||||||
print(msg)
|
|
||||||
|
|
||||||
|
from parse import system_include_paths
|
||||||
|
|
||||||
default_build_path = "/home/l_frojdh/sls/build/"
|
default_build_path = "/home/l_frojdh/sls/build/"
|
||||||
fpath = "../../slsDetectorSoftware/src/Detector.cpp"
|
fpath = "../../slsDetectorSoftware/src/Detector.cpp"
|
||||||
|
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument(
|
||||||
|
"-p",
|
||||||
|
"--build_path",
|
||||||
|
help="Path to the build database",
|
||||||
|
type=str,
|
||||||
|
default=default_build_path,
|
||||||
|
)
|
||||||
|
cargs = parser.parse_args()
|
||||||
|
|
||||||
|
db = cindex.CompilationDatabase.fromDirectory(cargs.build_path)
|
||||||
|
index = cindex.Index.create()
|
||||||
|
args = db.getCompileCommands(fpath)
|
||||||
|
args = list(iter(args).__next__().arguments)[0:-1]
|
||||||
|
args = args + "-x c++ --std=c++11".split()
|
||||||
|
syspath = system_include_paths("clang++")
|
||||||
|
incargs = ["-I" + inc for inc in syspath]
|
||||||
|
args = args + incargs
|
||||||
|
|
||||||
|
|
||||||
|
tu = index.parse(fpath, args=args)
|
||||||
|
|
||||||
|
|
||||||
m = []
|
m = []
|
||||||
ag = []
|
ag = []
|
||||||
|
|
||||||
lines = []
|
lines = []
|
||||||
|
|
||||||
ag2 = []
|
ag2 = []
|
||||||
|
|
||||||
cn = []
|
cn = []
|
||||||
|
|
||||||
def get_arguments(node):
|
def get_arguments(node):
|
||||||
@ -74,7 +66,7 @@ def get_arguments_with_default(node):
|
|||||||
args = []
|
args = []
|
||||||
for arg in node.get_arguments():
|
for arg in node.get_arguments():
|
||||||
tokens = [t.spelling for t in arg.get_tokens()]
|
tokens = [t.spelling for t in arg.get_tokens()]
|
||||||
# print(tokens)
|
print(tokens)
|
||||||
if '=' in tokens:
|
if '=' in tokens:
|
||||||
if arg.type.spelling == "sls::Positions": #TODO! automate
|
if arg.type.spelling == "sls::Positions": #TODO! automate
|
||||||
args.append("py::arg() = Positions{}")
|
args.append("py::arg() = Positions{}")
|
||||||
@ -119,67 +111,33 @@ def visit(node):
|
|||||||
lines.append(
|
lines.append(
|
||||||
f'.def("{child.spelling}",{fs} &Detector::{child.spelling}{args})'
|
f'.def("{child.spelling}",{fs} &Detector::{child.spelling}{args})'
|
||||||
)
|
)
|
||||||
if cargs.verbose:
|
|
||||||
print(f'&Detector::{child.spelling}{args})')
|
|
||||||
cn.append(child)
|
cn.append(child)
|
||||||
for child in node.get_children():
|
for child in node.get_children():
|
||||||
visit(child)
|
visit(child)
|
||||||
|
|
||||||
|
# .def("setRxHostname",
|
||||||
|
# (void (Detector::*)(const std::string &, Positions)) &
|
||||||
|
# Detector::setRxHostname,
|
||||||
|
# py::arg(), py::arg() = Positions{})
|
||||||
|
# .def("setRxHostname",
|
||||||
|
# (void (Detector::*)(const std::vector<std::string> &)) &
|
||||||
|
# Detector::setRxHostname,
|
||||||
|
# py::arg())
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
parser = argparse.ArgumentParser()
|
|
||||||
parser.add_argument(
|
|
||||||
"-p",
|
|
||||||
"--build_path",
|
|
||||||
help="Path to the build database",
|
|
||||||
type=Path,
|
|
||||||
default=default_build_path,
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
|
||||||
"-v",
|
|
||||||
"--verbose",
|
|
||||||
help="more output",
|
|
||||||
action='store_true',
|
|
||||||
)
|
|
||||||
cargs = parser.parse_args()
|
|
||||||
|
|
||||||
check_clang_format_version(12)
|
|
||||||
check_for_compile_commands_json(cargs.build_path)
|
|
||||||
|
|
||||||
print("Parsing functions in Detector.h - ", end = "", flush = True)
|
|
||||||
t0 = time.perf_counter()
|
|
||||||
#parse functions
|
|
||||||
db = cindex.CompilationDatabase.fromDirectory(cargs.build_path)
|
|
||||||
index = cindex.Index.create()
|
|
||||||
args = db.getCompileCommands(fpath)
|
|
||||||
args = list(iter(args).__next__().arguments)[0:-1]
|
|
||||||
args = args + "-x c++ --std=c++11".split()
|
|
||||||
syspath = system_include_paths("clang++")
|
|
||||||
incargs = ["-I" + inc for inc in syspath]
|
|
||||||
args = args + incargs
|
|
||||||
tu = index.parse(fpath, args=args)
|
|
||||||
visit(tu.cursor)
|
visit(tu.cursor)
|
||||||
print(green('OK'))
|
|
||||||
print(f'Parsing took {time.perf_counter()-t0:.3f}s')
|
|
||||||
|
|
||||||
print("Read detector_in.cpp - ", end = "")
|
|
||||||
with open("../src/detector_in.cpp") as f:
|
with open("../src/detector_in.cpp") as f:
|
||||||
data = f.read()
|
data = f.read()
|
||||||
s = "".join(lines)
|
s = "".join(lines)
|
||||||
s += ";"
|
s += ";"
|
||||||
text = data.replace("[[FUNCTIONS]]", s)
|
text = data.replace("[[FUNCTIONS]]", s)
|
||||||
warning = "/* WARINING This file is auto generated any edits might be overwritten without warning */\n\n"
|
warning = "/* WARINING This file is auto generated any edits might be overwritten without warning */\n\n"
|
||||||
print(green("OK"))
|
|
||||||
print("Writing to detector.cpp - ", end = "")
|
|
||||||
with open("../src/detector.cpp", "w") as f:
|
with open("../src/detector.cpp", "w") as f:
|
||||||
f.write(warning)
|
f.write(warning)
|
||||||
f.write(text)
|
f.write(text)
|
||||||
print(green('OK'))
|
|
||||||
|
|
||||||
# run clang format on the output
|
# run clang format on the output
|
||||||
print('Running clang format on generated source -', end = "")
|
|
||||||
subprocess.run(["clang-format", "../src/detector.cpp", "-i"])
|
subprocess.run(["clang-format", "../src/detector.cpp", "-i"])
|
||||||
print(green(" OK"))
|
|
||||||
|
|
||||||
print("Changes since last commit:")
|
|
||||||
subprocess.run(['git', 'diff', '../src/detector.cpp'])
|
|
||||||
|
@ -5,12 +5,6 @@ import subprocess
|
|||||||
from subprocess import PIPE
|
from subprocess import PIPE
|
||||||
import os
|
import os
|
||||||
|
|
||||||
def clang_format_version():
|
|
||||||
p = subprocess.run(['clang-format', '--version'], capture_output = True)
|
|
||||||
ver = p.stdout.decode().split()[2]
|
|
||||||
major = int(ver.split('.')[0])
|
|
||||||
return major
|
|
||||||
|
|
||||||
|
|
||||||
def remove_comments(text):
|
def remove_comments(text):
|
||||||
def replacer(match):
|
def replacer(match):
|
||||||
|
@ -1,45 +1,43 @@
|
|||||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
from .detector import Detector, freeze
|
from .detector import Detector
|
||||||
from .utils import element_if_equal
|
from .utils import element_if_equal
|
||||||
from .dacs import DetectorDacs, NamedDacs
|
from .dacs import DetectorDacs
|
||||||
import _slsdet
|
import _slsdet
|
||||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||||
from .detector_property import DetectorProperty
|
from .detector_property import DetectorProperty
|
||||||
|
|
||||||
# class CtbDacs(DetectorDacs):
|
class CtbDacs(DetectorDacs):
|
||||||
# """
|
"""
|
||||||
# Ctb dacs
|
Ctb dacs
|
||||||
# """
|
"""
|
||||||
# _dacs = [('dac0', dacIndex(0), 0, 4000, 1400),
|
_dacs = [('dac0', dacIndex(0), 0, 4000, 1400),
|
||||||
# ('dac1', dacIndex(1), 0, 4000, 1200),
|
('dac1', dacIndex(1), 0, 4000, 1200),
|
||||||
# ('dac2', dacIndex(2), 0, 4000, 900),
|
('dac2', dacIndex(2), 0, 4000, 900),
|
||||||
# ('dac3', dacIndex(3), 0, 4000, 1050),
|
('dac3', dacIndex(3), 0, 4000, 1050),
|
||||||
# ('dac4', dacIndex(4), 0, 4000, 1400),
|
('dac4', dacIndex(4), 0, 4000, 1400),
|
||||||
# ('dac5', dacIndex(5), 0, 4000, 655),
|
('dac5', dacIndex(5), 0, 4000, 655),
|
||||||
# ('dac6', dacIndex(6), 0, 4000, 2000),
|
('dac6', dacIndex(6), 0, 4000, 2000),
|
||||||
# ('dac7', dacIndex(7), 0, 4000, 1400),
|
('dac7', dacIndex(7), 0, 4000, 1400),
|
||||||
# ('dac8', dacIndex(8), 0, 4000, 850),
|
('dac8', dacIndex(8), 0, 4000, 850),
|
||||||
# ('dac9', dacIndex(9), 0, 4000, 2000),
|
('dac9', dacIndex(9), 0, 4000, 2000),
|
||||||
# ('dac10', dacIndex(10), 0, 4000, 2294),
|
('dac10', dacIndex(10), 0, 4000, 2294),
|
||||||
# ('dac11', dacIndex(11), 0, 4000, 983),
|
('dac11', dacIndex(11), 0, 4000, 983),
|
||||||
# ('dac12', dacIndex(12), 0, 4000, 1475),
|
('dac12', dacIndex(12), 0, 4000, 1475),
|
||||||
# ('dac13', dacIndex(13), 0, 4000, 1200),
|
('dac13', dacIndex(13), 0, 4000, 1200),
|
||||||
# ('dac14', dacIndex(14), 0, 4000, 1600),
|
('dac14', dacIndex(14), 0, 4000, 1600),
|
||||||
# ('dac15', dacIndex(15), 0, 4000, 1455),
|
('dac15', dacIndex(15), 0, 4000, 1455),
|
||||||
# ('dac16', dacIndex(16), 0, 4000, 0),
|
('dac16', dacIndex(16), 0, 4000, 0),
|
||||||
# ('dac17', dacIndex(17), 0, 4000, 1000),
|
('dac17', dacIndex(17), 0, 4000, 1000),
|
||||||
# ]
|
]
|
||||||
# _dacnames = [_d[0] for _d in _dacs]
|
_dacnames = [_d[0] for _d in _dacs]
|
||||||
|
|
||||||
from .utils import element
|
from .utils import element
|
||||||
@freeze
|
|
||||||
class Ctb(Detector):
|
class Ctb(Detector):
|
||||||
def __init__(self, id = 0):
|
def __init__(self, id = 0):
|
||||||
super().__init__(id)
|
super().__init__(id)
|
||||||
self._frozen = False
|
self._frozen = False
|
||||||
# self._dacs = CtbDacs(self)
|
self._dacs = CtbDacs(self)
|
||||||
self._dacs = NamedDacs(self)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dacs(self):
|
def dacs(self):
|
||||||
|
@ -36,79 +36,6 @@ class Dac(DetectorProperty):
|
|||||||
dacstr = ''.join([f'{item:5d}' for item in self.get()])
|
dacstr = ''.join([f'{item:5d}' for item in self.get()])
|
||||||
return f'{self.__name__:15s}:{dacstr}'
|
return f'{self.__name__:15s}:{dacstr}'
|
||||||
|
|
||||||
class NamedDacs:
|
|
||||||
"""
|
|
||||||
New implementation of the detector dacs. Used at the momen for
|
|
||||||
Ctb but should replace the old one for all detectors
|
|
||||||
"""
|
|
||||||
_frozen = False
|
|
||||||
_direct_access = ['_detector', '_current', '_dacnames']
|
|
||||||
def __init__(self, detector):
|
|
||||||
self._detector = detector
|
|
||||||
self._current = 0
|
|
||||||
|
|
||||||
self._dacnames = [n.replace(" ", "") for n in detector.getDacNames()]
|
|
||||||
# # Populate the dacs
|
|
||||||
for i,name in enumerate(self._dacnames):
|
|
||||||
#name, enum, low, high, default, detector
|
|
||||||
setattr(self, name, Dac(name, dacIndex(i), 0, 4000, 1000, detector))
|
|
||||||
|
|
||||||
self._frozen = True
|
|
||||||
|
|
||||||
# def __getattr__(self, name):
|
|
||||||
# return self.__getattribute__('_' + name)
|
|
||||||
|
|
||||||
def __setattr__(self, name, value):
|
|
||||||
if not self._frozen:
|
|
||||||
#durining init we need to be able to set up the class
|
|
||||||
super().__setattr__(name, value)
|
|
||||||
else:
|
|
||||||
#Later we restrict us to manipulate dacs and a few fields
|
|
||||||
if name in self._direct_access:
|
|
||||||
super().__setattr__(name, value)
|
|
||||||
elif name in self._dacnames:
|
|
||||||
return self.__getattribute__(name).__setitem__(slice(None, None, None), value)
|
|
||||||
else:
|
|
||||||
raise AttributeError(f'Dac not found: {name}')
|
|
||||||
|
|
||||||
def __next__(self):
|
|
||||||
if self._current >= len(self._dacnames):
|
|
||||||
self._current = 0
|
|
||||||
raise StopIteration
|
|
||||||
else:
|
|
||||||
self._current += 1
|
|
||||||
return self.__getattribute__(self._dacnames[self._current-1])
|
|
||||||
# return self.__getattr__(self._dacnames[self._current-1])
|
|
||||||
|
|
||||||
def __iter__(self):
|
|
||||||
return self
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
r_str = ['========== DACS =========']
|
|
||||||
r_str += [repr(dac) for dac in self]
|
|
||||||
return '\n'.join(r_str)
|
|
||||||
def get_asarray(self):
|
|
||||||
"""
|
|
||||||
Read the dacs into a numpy array with dimensions [ndacs, nmodules]
|
|
||||||
"""
|
|
||||||
dac_array = np.zeros((len(self._dacnames), len(self._detector)))
|
|
||||||
for i, _d in enumerate(self):
|
|
||||||
dac_array[i,:] = _d[:]
|
|
||||||
return dac_array
|
|
||||||
|
|
||||||
def to_array(self):
|
|
||||||
return self.get_asarray()
|
|
||||||
|
|
||||||
def set_from_array(self, dac_array):
|
|
||||||
"""
|
|
||||||
Set the dacs from an numpy array with dac values. [ndacs, nmodules]
|
|
||||||
"""
|
|
||||||
dac_array = dac_array.astype(np.int)
|
|
||||||
for i, _d in enumerate(self):
|
|
||||||
_d[:] = dac_array[i]
|
|
||||||
|
|
||||||
def from_array(self, dac_array):
|
|
||||||
self.set_from_array(dac_array)
|
|
||||||
|
|
||||||
class DetectorDacs:
|
class DetectorDacs:
|
||||||
_dacs = []
|
_dacs = []
|
||||||
@ -123,7 +50,7 @@ class DetectorDacs:
|
|||||||
# Index to support iteration
|
# Index to support iteration
|
||||||
self._current = 0
|
self._current = 0
|
||||||
|
|
||||||
# Name the attributes?
|
# Populate the dacs
|
||||||
for _d in self._dacs:
|
for _d in self._dacs:
|
||||||
setattr(self, '_'+_d[0], Dac(*_d, detector))
|
setattr(self, '_'+_d[0], Dac(*_d, detector))
|
||||||
|
|
||||||
@ -132,9 +59,6 @@ class DetectorDacs:
|
|||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
return self.__getattribute__('_' + name)
|
return self.__getattribute__('_' + name)
|
||||||
|
|
||||||
@property
|
|
||||||
def dacnames(self):
|
|
||||||
return [_d[0] for _d in _dacs]
|
|
||||||
|
|
||||||
def __setattr__(self, name, value):
|
def __setattr__(self, name, value):
|
||||||
if name in self._dacnames:
|
if name in self._dacnames:
|
||||||
|
@ -224,19 +224,6 @@ class Detector(CppDetectorApi):
|
|||||||
"""
|
"""
|
||||||
return ut.lhex(self.getDetectorServerVersion())
|
return ut.lhex(self.getDetectorServerVersion())
|
||||||
|
|
||||||
@property
|
|
||||||
@element
|
|
||||||
def kernelversion(self):
|
|
||||||
"""
|
|
||||||
Kernel version on the detector including time and date
|
|
||||||
|
|
||||||
Example
|
|
||||||
-------
|
|
||||||
>>> d.kernelversion
|
|
||||||
'#37 PREEMPT Thu Oct 13 14:51:04 CEST 2016'
|
|
||||||
"""
|
|
||||||
return self.getKernelVersion()
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def clientversion(self):
|
def clientversion(self):
|
||||||
"""Client software version in format [YYMMDD]
|
"""Client software version in format [YYMMDD]
|
||||||
@ -258,7 +245,7 @@ class Detector(CppDetectorApi):
|
|||||||
@element
|
@element
|
||||||
def rx_threads(self):
|
def rx_threads(self):
|
||||||
"""
|
"""
|
||||||
Get thread ids from the receiver in order of [parent, tcp, listener 0, processor 0, streamer 0, listener 1, processor 1, streamer 1, arping].
|
Get thread ids from the receiver in order of [parent, tcp, listener 0, processor 0, streamer 0, listener 1, processor 1, streamer 1].
|
||||||
|
|
||||||
Note
|
Note
|
||||||
-----
|
-----
|
||||||
@ -268,17 +255,6 @@ class Detector(CppDetectorApi):
|
|||||||
"""
|
"""
|
||||||
return self.getRxThreadIds()
|
return self.getRxThreadIds()
|
||||||
|
|
||||||
@property
|
|
||||||
@element
|
|
||||||
def rx_arping(self):
|
|
||||||
"""Starts a thread in slsReceiver to arping the interface it is listening every minute. Useful in 10G mode. """
|
|
||||||
return self.getRxArping()
|
|
||||||
|
|
||||||
@rx_arping.setter
|
|
||||||
def rx_arping(self, value):
|
|
||||||
ut.set_using_dict(self.setRxArping, value)
|
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def dr(self):
|
def dr(self):
|
||||||
@ -287,7 +263,7 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
Note
|
Note
|
||||||
-----
|
-----
|
||||||
[Eiger] Options: 4, 8, 12, 16, 32. If set to 32, also sets clkdivider to 2 (quarter speed), else to 0 (full speed)\n
|
[Eiger] Options: 4, 8, 16, 32. If set to 32, also sets clkdivider to 2 (quarter speed), else to 0 (full speed)\n
|
||||||
[Mythen3] Options: 8, 16, 32 \n
|
[Mythen3] Options: 8, 16, 32 \n
|
||||||
[Jungfrau][Gotthard][Ctb][Moench][Mythen3][Gotthard2] 16
|
[Jungfrau][Gotthard][Ctb][Moench][Mythen3][Gotthard2] 16
|
||||||
"""
|
"""
|
||||||
@ -599,13 +575,13 @@ class Detector(CppDetectorApi):
|
|||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def rx_framescaught(self):
|
def rx_framescaught(self):
|
||||||
"""Number of frames caught by each port in receiver."""
|
"""Number of frames caught by receiver."""
|
||||||
return self.getFramesCaught()
|
return self.getFramesCaught()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def nextframenumber(self):
|
def nextframenumber(self):
|
||||||
"""[Eiger][Jungfrau][Moench][CTB] Next frame number. Stopping acquisition might result in different frame numbers for different modules. """
|
"""[Eiger][Jungfrau] Next frame number. Stopping acquisition might result in different frame numbers for different modules. """
|
||||||
return self.getNextFrameNumber()
|
return self.getNextFrameNumber()
|
||||||
|
|
||||||
@nextframenumber.setter
|
@nextframenumber.setter
|
||||||
@ -1474,19 +1450,6 @@ class Detector(CppDetectorApi):
|
|||||||
def trimval(self, value):
|
def trimval(self, value):
|
||||||
ut.set_using_dict(self.setAllTrimbits, value)
|
ut.set_using_dict(self.setAllTrimbits, value)
|
||||||
|
|
||||||
@property
|
|
||||||
@element
|
|
||||||
def master(self):
|
|
||||||
"""
|
|
||||||
[Eiger] Sets half module to master and others to slaves.\n
|
|
||||||
[Gotthard][Gotthard2][Mythen3][Eiger] Gets if the current module/ half module is master.
|
|
||||||
"""
|
|
||||||
return self.getMaster()
|
|
||||||
|
|
||||||
@master.setter
|
|
||||||
def master(self, value):
|
|
||||||
ut.set_using_dict(self.setMaster, value)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def lock(self):
|
def lock(self):
|
||||||
@ -1571,16 +1534,8 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def daclist(self):
|
def daclist(self):
|
||||||
"""
|
"""Gets the list of enums for every dac for this detector."""
|
||||||
List of enums for every dac for this detector.
|
return self.getDacList()
|
||||||
:setter: Only implemented for Chiptestboard
|
|
||||||
|
|
||||||
"""
|
|
||||||
return self.getDacNames()
|
|
||||||
|
|
||||||
@daclist.setter
|
|
||||||
def daclist(self, value):
|
|
||||||
self.setDacNames(value)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dacvalues(self):
|
def dacvalues(self):
|
||||||
@ -1701,7 +1656,6 @@ class Detector(CppDetectorApi):
|
|||||||
'client': self.clientversion,
|
'client': self.clientversion,
|
||||||
'firmware': self.firmwareversion,
|
'firmware': self.firmwareversion,
|
||||||
'detectorserver': self.detectorserverversion,
|
'detectorserver': self.detectorserverversion,
|
||||||
'kernel': self.kernelversion,
|
|
||||||
'receiver': self.rx_version}
|
'receiver': self.rx_version}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -1926,13 +1880,13 @@ class Detector(CppDetectorApi):
|
|||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def rx_frameindex(self):
|
def rx_frameindex(self):
|
||||||
"""Current frame index received for each port in receiver during acquisition."""
|
"""Current frame index received in receiver during acquisition."""
|
||||||
return self.getRxCurrentFrameIndex()
|
return self.getRxCurrentFrameIndex()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def rx_missingpackets(self):
|
def rx_missingpackets(self):
|
||||||
"""Gets the number of missing packets for each port in receiver. Negative number denotes extra packets. """
|
"""Gets the number of missing packets for each port in receiver."""
|
||||||
return self.getNumMissingPackets()
|
return self.getNumMissingPackets()
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -1945,7 +1899,7 @@ class Detector(CppDetectorApi):
|
|||||||
def datastream(self):
|
def datastream(self):
|
||||||
"""
|
"""
|
||||||
datastream [left|right] [0, 1]
|
datastream [left|right] [0, 1]
|
||||||
[Eiger] Enables or disables data streaming from left or/and right side of detector for 10GbE mode. 1 (enabled) by default.
|
[Eiger] Enables or disables data streaming from left or/and right side of detector. 1 (enabled) by default.
|
||||||
"""
|
"""
|
||||||
result = {}
|
result = {}
|
||||||
for port in [defs.LEFT, defs.RIGHT]:
|
for port in [defs.LEFT, defs.RIGHT]:
|
||||||
@ -2147,21 +2101,6 @@ class Detector(CppDetectorApi):
|
|||||||
"""
|
"""
|
||||||
return ut.reduce_time(self.getMeasuredSubFramePeriod())
|
return ut.reduce_time(self.getMeasuredSubFramePeriod())
|
||||||
|
|
||||||
@property
|
|
||||||
@element
|
|
||||||
def top(self):
|
|
||||||
"""[Eiger] Sets half module to top (1), else bottom.
|
|
||||||
|
|
||||||
Note
|
|
||||||
-----
|
|
||||||
Advanced Function!
|
|
||||||
"""
|
|
||||||
return self.getTop()
|
|
||||||
|
|
||||||
@top.setter
|
|
||||||
def top(self, value):
|
|
||||||
ut.set_using_dict(self.setTop, value)
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
------------------<<<Jungfrau specific>>>-------------------------
|
------------------<<<Jungfrau specific>>>-------------------------
|
||||||
"""
|
"""
|
||||||
@ -2562,7 +2501,6 @@ class Detector(CppDetectorApi):
|
|||||||
-----
|
-----
|
||||||
|
|
||||||
:getter: always returns in seconds. To get in datetime.delta, use getBurstPeriod
|
:getter: always returns in seconds. To get in datetime.delta, use getBurstPeriod
|
||||||
:setter: Not Implemented
|
|
||||||
|
|
||||||
Example
|
Example
|
||||||
-----------
|
-----------
|
||||||
@ -3066,7 +3004,7 @@ class Detector(CppDetectorApi):
|
|||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def patsetbit(self):
|
def patsetbit(self):
|
||||||
"""[Ctb][Moench][Mythen3] Sets the mask applied to every pattern to the selected bits.
|
"""[Ctb][Moench][Mythen3] Selects the bits that will have a pattern mask applied to the selected patmask for every pattern.
|
||||||
|
|
||||||
Example
|
Example
|
||||||
--------
|
--------
|
||||||
@ -3083,7 +3021,7 @@ class Detector(CppDetectorApi):
|
|||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def patmask(self):
|
def patmask(self):
|
||||||
"""[Ctb][Moench][Mythen3] Selects the bits that will have a pattern mask applied to the selected patmask for every pattern.
|
"""[Ctb][Moench][Mythen3] Sets the mask applied to every pattern to the selected bits.
|
||||||
|
|
||||||
Example
|
Example
|
||||||
--------
|
--------
|
||||||
@ -3484,7 +3422,7 @@ class Detector(CppDetectorApi):
|
|||||||
[Gotthard2][Mythen3] Frequency of clock in Hz.
|
[Gotthard2][Mythen3] Frequency of clock in Hz.
|
||||||
|
|
||||||
Note
|
Note
|
||||||
----
|
-----
|
||||||
|
|
||||||
:setter: Not implemented. Use clkdiv to set frequency
|
:setter: Not implemented. Use clkdiv to set frequency
|
||||||
|
|
||||||
@ -3498,60 +3436,10 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
def readout(self):
|
def readout(self):
|
||||||
"""
|
"""
|
||||||
[Mythen3] Starts detector readout. Status changes to TRANSMITTING and automatically returns to idle at the end of readout.
|
Mythen3] Starts detector readout. Status changes to TRANSMITTING and automatically returns to idle at the end of readout.
|
||||||
"""
|
"""
|
||||||
self.startDetectorReadout()
|
self.startDetectorReadout()
|
||||||
|
|
||||||
@property
|
|
||||||
@element
|
|
||||||
def polarity(self):
|
|
||||||
"""[Mythen3] Set positive or negative polarity. Enum: polarity"""
|
|
||||||
return self.getPolarity()
|
|
||||||
|
|
||||||
@polarity.setter
|
|
||||||
def polarity(self, value):
|
|
||||||
ut.set_using_dict(self.setPolarity, value)
|
|
||||||
|
|
||||||
@property
|
|
||||||
@element
|
|
||||||
def interpolation(self):
|
|
||||||
"""[Mythen3] Enable or disable interpolation. Enabling also enables all counters """
|
|
||||||
return self.getInterpolation()
|
|
||||||
|
|
||||||
@interpolation.setter
|
|
||||||
def interpolation(self, value):
|
|
||||||
ut.set_using_dict(self.setInterpolation, value)
|
|
||||||
|
|
||||||
@property
|
|
||||||
@element
|
|
||||||
def pumpprobe(self):
|
|
||||||
"""[Mythen3] Enable or disable pump probe mode. """
|
|
||||||
return self.getPumpProbe()
|
|
||||||
|
|
||||||
@pumpprobe.setter
|
|
||||||
def pumpprobe(self, value):
|
|
||||||
ut.set_using_dict(self.setPumpProbe, value)
|
|
||||||
|
|
||||||
@property
|
|
||||||
@element
|
|
||||||
def apulse(self):
|
|
||||||
"""[Mythen3] Enable or disable analog pulsing. """
|
|
||||||
return self.getAnalogPulsing()
|
|
||||||
|
|
||||||
@apulse.setter
|
|
||||||
def apulse(self, value):
|
|
||||||
ut.set_using_dict(self.setAnalogPulsing, value)
|
|
||||||
|
|
||||||
@property
|
|
||||||
@element
|
|
||||||
def dpulse(self):
|
|
||||||
"""[Mythen3] Enable or disable digital pulsing. """
|
|
||||||
return self.getDigitalPulsing()
|
|
||||||
|
|
||||||
@dpulse.setter
|
|
||||||
def dpulse(self, value):
|
|
||||||
ut.set_using_dict(self.setDigitalPulsing, value)
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
---------------------------<<<Debug>>>---------------------------
|
---------------------------<<<Debug>>>---------------------------
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
/* WARINING This file is auto generated any edits might be overwritten without
|
/* WARINING This file is auto generated any edits might be overwritten without
|
||||||
* warning */
|
* warning */
|
||||||
|
|
||||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
|
||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
|
||||||
#include <pybind11/chrono.h>
|
#include <pybind11/chrono.h>
|
||||||
#include <pybind11/operators.h>
|
#include <pybind11/operators.h>
|
||||||
#include <pybind11/pybind11.h>
|
#include <pybind11/pybind11.h>
|
||||||
@ -67,10 +67,6 @@ void init_det(py::module &m) {
|
|||||||
(Result<int64_t>(Detector::*)(sls::Positions) const) &
|
(Result<int64_t>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getDetectorServerVersion,
|
Detector::getDetectorServerVersion,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getKernelVersion",
|
|
||||||
(Result<std::string>(Detector::*)(sls::Positions) const) &
|
|
||||||
Detector::getKernelVersion,
|
|
||||||
py::arg() = Positions{})
|
|
||||||
.def("getSerialNumber",
|
.def("getSerialNumber",
|
||||||
(Result<int64_t>(Detector::*)(sls::Positions) const) &
|
(Result<int64_t>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getSerialNumber,
|
Detector::getSerialNumber,
|
||||||
@ -173,12 +169,6 @@ void init_det(py::module &m) {
|
|||||||
.def("setFlipRows",
|
.def("setFlipRows",
|
||||||
(void (Detector::*)(bool, sls::Positions)) & Detector::setFlipRows,
|
(void (Detector::*)(bool, sls::Positions)) & Detector::setFlipRows,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("getMaster",
|
|
||||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
|
||||||
Detector::getMaster,
|
|
||||||
py::arg() = Positions{})
|
|
||||||
.def("setMaster", (void (Detector::*)(bool, int)) & Detector::setMaster,
|
|
||||||
py::arg(), py::arg())
|
|
||||||
.def("isVirtualDetectorServer",
|
.def("isVirtualDetectorServer",
|
||||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::isVirtualDetectorServer,
|
Detector::isVirtualDetectorServer,
|
||||||
@ -476,9 +466,7 @@ void init_det(py::module &m) {
|
|||||||
(void (Detector::*)()) & Detector::clearAcquiringFlag)
|
(void (Detector::*)()) & Detector::clearAcquiringFlag)
|
||||||
.def("startReceiver", (void (Detector::*)()) & Detector::startReceiver)
|
.def("startReceiver", (void (Detector::*)()) & Detector::startReceiver)
|
||||||
.def("stopReceiver", (void (Detector::*)()) & Detector::stopReceiver)
|
.def("stopReceiver", (void (Detector::*)()) & Detector::stopReceiver)
|
||||||
.def("startDetector",
|
.def("startDetector", (void (Detector::*)()) & Detector::startDetector)
|
||||||
(void (Detector::*)(sls::Positions)) & Detector::startDetector,
|
|
||||||
py::arg() = Positions{})
|
|
||||||
.def("startDetectorReadout",
|
.def("startDetectorReadout",
|
||||||
(void (Detector::*)()) & Detector::startDetectorReadout)
|
(void (Detector::*)()) & Detector::startDetectorReadout)
|
||||||
.def("stopDetector",
|
.def("stopDetector",
|
||||||
@ -493,17 +481,14 @@ void init_det(py::module &m) {
|
|||||||
Detector::getReceiverStatus,
|
Detector::getReceiverStatus,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getFramesCaught",
|
.def("getFramesCaught",
|
||||||
(Result<std::vector<int64_t>>(Detector::*)(sls::Positions) const) &
|
(Result<int64_t>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getFramesCaught,
|
Detector::getFramesCaught,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getNumMissingPackets",
|
.def(
|
||||||
(Result<std::vector<int64_t>>(Detector::*)(sls::Positions) const) &
|
"getNumMissingPackets",
|
||||||
|
(Result<std::vector<uint64_t>>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getNumMissingPackets,
|
Detector::getNumMissingPackets,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getRxCurrentFrameIndex",
|
|
||||||
(Result<std::vector<int64_t>>(Detector::*)(sls::Positions) const) &
|
|
||||||
Detector::getRxCurrentFrameIndex,
|
|
||||||
py::arg() = Positions{})
|
|
||||||
.def("getNextFrameNumber",
|
.def("getNextFrameNumber",
|
||||||
(Result<uint64_t>(Detector::*)(sls::Positions) const) &
|
(Result<uint64_t>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getNextFrameNumber,
|
Detector::getNextFrameNumber,
|
||||||
@ -776,16 +761,9 @@ void init_det(py::module &m) {
|
|||||||
Detector::getRxLastClientIP,
|
Detector::getRxLastClientIP,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getRxThreadIds",
|
.def("getRxThreadIds",
|
||||||
(Result<std::array<pid_t, 9>>(Detector::*)(sls::Positions) const) &
|
(Result<std::array<pid_t, 8>>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getRxThreadIds,
|
Detector::getRxThreadIds,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getRxArping",
|
|
||||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
|
||||||
Detector::getRxArping,
|
|
||||||
py::arg() = Positions{})
|
|
||||||
.def("setRxArping",
|
|
||||||
(void (Detector::*)(bool, sls::Positions)) & Detector::setRxArping,
|
|
||||||
py::arg(), py::arg() = Positions{})
|
|
||||||
.def("getFileFormat",
|
.def("getFileFormat",
|
||||||
(Result<defs::fileFormat>(Detector::*)(sls::Positions) const) &
|
(Result<defs::fileFormat>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getFileFormat,
|
Detector::getFileFormat,
|
||||||
@ -1015,13 +993,6 @@ void init_det(py::module &m) {
|
|||||||
sls::Positions)) &
|
sls::Positions)) &
|
||||||
Detector::setDataStream,
|
Detector::setDataStream,
|
||||||
py::arg(), py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg(), py::arg() = Positions{})
|
||||||
.def("getTop",
|
|
||||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
|
||||||
Detector::getTop,
|
|
||||||
py::arg() = Positions{})
|
|
||||||
.def("setTop",
|
|
||||||
(void (Detector::*)(bool, sls::Positions)) & Detector::setTop,
|
|
||||||
py::arg(), py::arg() = Positions{})
|
|
||||||
.def("getChipVersion",
|
.def("getChipVersion",
|
||||||
(Result<double>(Detector::*)(sls::Positions) const) &
|
(Result<double>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getChipVersion,
|
Detector::getChipVersion,
|
||||||
@ -1280,6 +1251,10 @@ void init_det(py::module &m) {
|
|||||||
(Result<std::array<ns, 3>>(Detector::*)(sls::Positions) const) &
|
(Result<std::array<ns, 3>>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getGateDelayForAllGates,
|
Detector::getGateDelayForAllGates,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
|
.def("getMaster",
|
||||||
|
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||||
|
Detector::getMaster,
|
||||||
|
py::arg() = Positions{})
|
||||||
.def("getChipStatusRegister",
|
.def("getChipStatusRegister",
|
||||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getChipStatusRegister,
|
Detector::getChipStatusRegister,
|
||||||
@ -1290,46 +1265,6 @@ void init_det(py::module &m) {
|
|||||||
.def("getGainCaps",
|
.def("getGainCaps",
|
||||||
(Result<int>(Detector::*)(sls::Positions)) & Detector::getGainCaps,
|
(Result<int>(Detector::*)(sls::Positions)) & Detector::getGainCaps,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getPolarity",
|
|
||||||
(Result<defs::polarity>(Detector::*)(sls::Positions) const) &
|
|
||||||
Detector::getPolarity,
|
|
||||||
py::arg() = Positions{})
|
|
||||||
.def("setPolarity",
|
|
||||||
(void (Detector::*)(defs::polarity, sls::Positions)) &
|
|
||||||
Detector::setPolarity,
|
|
||||||
py::arg(), py::arg() = Positions{})
|
|
||||||
.def("getInterpolation",
|
|
||||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
|
||||||
Detector::getInterpolation,
|
|
||||||
py::arg() = Positions{})
|
|
||||||
.def("setInterpolation",
|
|
||||||
(void (Detector::*)(bool, sls::Positions)) &
|
|
||||||
Detector::setInterpolation,
|
|
||||||
py::arg(), py::arg() = Positions{})
|
|
||||||
.def("getPumpProbe",
|
|
||||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
|
||||||
Detector::getPumpProbe,
|
|
||||||
py::arg() = Positions{})
|
|
||||||
.def("setPumpProbe",
|
|
||||||
(void (Detector::*)(bool, sls::Positions)) &
|
|
||||||
Detector::setPumpProbe,
|
|
||||||
py::arg(), py::arg() = Positions{})
|
|
||||||
.def("getAnalogPulsing",
|
|
||||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
|
||||||
Detector::getAnalogPulsing,
|
|
||||||
py::arg() = Positions{})
|
|
||||||
.def("setAnalogPulsing",
|
|
||||||
(void (Detector::*)(bool, sls::Positions)) &
|
|
||||||
Detector::setAnalogPulsing,
|
|
||||||
py::arg(), py::arg() = Positions{})
|
|
||||||
.def("getDigitalPulsing",
|
|
||||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
|
||||||
Detector::getDigitalPulsing,
|
|
||||||
py::arg() = Positions{})
|
|
||||||
.def("setDigitalPulsing",
|
|
||||||
(void (Detector::*)(bool, sls::Positions)) &
|
|
||||||
Detector::setDigitalPulsing,
|
|
||||||
py::arg(), py::arg() = Positions{})
|
|
||||||
.def("getNumberOfAnalogSamples",
|
.def("getNumberOfAnalogSamples",
|
||||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getNumberOfAnalogSamples,
|
Detector::getNumberOfAnalogSamples,
|
||||||
@ -1467,19 +1402,6 @@ void init_det(py::module &m) {
|
|||||||
(void (Detector::*)(bool, sls::Positions)) &
|
(void (Detector::*)(bool, sls::Positions)) &
|
||||||
Detector::setLEDEnable,
|
Detector::setLEDEnable,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("setDacNames",
|
|
||||||
(void (Detector::*)(const std::vector<std::string>)) &
|
|
||||||
Detector::setDacNames,
|
|
||||||
py::arg())
|
|
||||||
.def("getDacNames", (std::vector<std::string>(Detector::*)() const) &
|
|
||||||
Detector::getDacNames)
|
|
||||||
.def("getDacIndex",
|
|
||||||
(defs::dacIndex(Detector::*)(const std::string &)) &
|
|
||||||
Detector::getDacIndex,
|
|
||||||
py::arg())
|
|
||||||
.def("getDacName",
|
|
||||||
(std::string(Detector::*)(defs::dacIndex)) & Detector::getDacName,
|
|
||||||
py::arg())
|
|
||||||
.def("setPattern",
|
.def("setPattern",
|
||||||
(void (Detector::*)(const std::string &, sls::Positions)) &
|
(void (Detector::*)(const std::string &, sls::Positions)) &
|
||||||
Detector::setPattern,
|
Detector::setPattern,
|
||||||
@ -1584,21 +1506,17 @@ void init_det(py::module &m) {
|
|||||||
Detector::setAdditionalJsonParameter,
|
Detector::setAdditionalJsonParameter,
|
||||||
py::arg(), py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg(), py::arg() = Positions{})
|
||||||
.def("programFPGA",
|
.def("programFPGA",
|
||||||
(void (Detector::*)(const std::string &, const bool,
|
(void (Detector::*)(const std::string &, sls::Positions)) &
|
||||||
sls::Positions)) &
|
|
||||||
Detector::programFPGA,
|
Detector::programFPGA,
|
||||||
py::arg(), py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("resetFPGA",
|
.def("resetFPGA",
|
||||||
(void (Detector::*)(sls::Positions)) & Detector::resetFPGA,
|
(void (Detector::*)(sls::Positions)) & Detector::resetFPGA,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("updateDetectorServer",
|
.def("copyDetectorServer",
|
||||||
(void (Detector::*)(const std::string &, sls::Positions)) &
|
(void (Detector::*)(const std::string &, const std::string &,
|
||||||
Detector::updateDetectorServer,
|
sls::Positions)) &
|
||||||
py::arg(), py::arg() = Positions{})
|
Detector::copyDetectorServer,
|
||||||
.def("updateKernel",
|
py::arg(), py::arg(), py::arg() = Positions{})
|
||||||
(void (Detector::*)(const std::string &, sls::Positions)) &
|
|
||||||
Detector::updateKernel,
|
|
||||||
py::arg(), py::arg() = Positions{})
|
|
||||||
.def("rebootController",
|
.def("rebootController",
|
||||||
(void (Detector::*)(sls::Positions)) & Detector::rebootController,
|
(void (Detector::*)(sls::Positions)) & Detector::rebootController,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
@ -1607,19 +1525,6 @@ void init_det(py::module &m) {
|
|||||||
const std::string &, sls::Positions)) &
|
const std::string &, sls::Positions)) &
|
||||||
Detector::updateFirmwareAndServer,
|
Detector::updateFirmwareAndServer,
|
||||||
py::arg(), py::arg(), py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg(), py::arg(), py::arg() = Positions{})
|
||||||
.def("updateFirmwareAndServer",
|
|
||||||
(void (Detector::*)(const std::string &, const std::string &,
|
|
||||||
sls::Positions)) &
|
|
||||||
Detector::updateFirmwareAndServer,
|
|
||||||
py::arg(), py::arg(), py::arg() = Positions{})
|
|
||||||
.def("getUpdateMode",
|
|
||||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
|
||||||
Detector::getUpdateMode,
|
|
||||||
py::arg() = Positions{})
|
|
||||||
.def("setUpdateMode",
|
|
||||||
(void (Detector::*)(const bool, sls::Positions)) &
|
|
||||||
Detector::setUpdateMode,
|
|
||||||
py::arg(), py::arg() = Positions{})
|
|
||||||
.def("readRegister",
|
.def("readRegister",
|
||||||
(Result<uint32_t>(Detector::*)(uint32_t, sls::Positions) const) &
|
(Result<uint32_t>(Detector::*)(uint32_t, sls::Positions) const) &
|
||||||
Detector::readRegister,
|
Detector::readRegister,
|
||||||
@ -1709,5 +1614,9 @@ void init_det(py::module &m) {
|
|||||||
Detector::getMeasurementTime,
|
Detector::getMeasurementTime,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("getUserDetails",
|
.def("getUserDetails",
|
||||||
(std::string(Detector::*)() const) & Detector::getUserDetails);
|
(std::string(Detector::*)() const) & Detector::getUserDetails)
|
||||||
|
.def("getRxCurrentFrameIndex",
|
||||||
|
(Result<uint64_t>(Detector::*)(sls::Positions) const) &
|
||||||
|
Detector::getRxCurrentFrameIndex,
|
||||||
|
py::arg() = Positions{});
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
/* WARINING This file is auto generated any edits might be overwritten without
|
/* WARINING This file is auto generated any edits might be overwritten without warning */
|
||||||
* warning */
|
|
||||||
|
|
||||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
@ -43,19 +42,15 @@ void init_enums(py::module &m) {
|
|||||||
|
|
||||||
py::enum_<slsDetectorDefs::frameDiscardPolicy>(Defs, "frameDiscardPolicy")
|
py::enum_<slsDetectorDefs::frameDiscardPolicy>(Defs, "frameDiscardPolicy")
|
||||||
.value("NO_DISCARD", slsDetectorDefs::frameDiscardPolicy::NO_DISCARD)
|
.value("NO_DISCARD", slsDetectorDefs::frameDiscardPolicy::NO_DISCARD)
|
||||||
.value("DISCARD_EMPTY_FRAMES",
|
.value("DISCARD_EMPTY_FRAMES", slsDetectorDefs::frameDiscardPolicy::DISCARD_EMPTY_FRAMES)
|
||||||
slsDetectorDefs::frameDiscardPolicy::DISCARD_EMPTY_FRAMES)
|
.value("DISCARD_PARTIAL_FRAMES", slsDetectorDefs::frameDiscardPolicy::DISCARD_PARTIAL_FRAMES)
|
||||||
.value("DISCARD_PARTIAL_FRAMES",
|
.value("NUM_DISCARD_POLICIES", slsDetectorDefs::frameDiscardPolicy::NUM_DISCARD_POLICIES)
|
||||||
slsDetectorDefs::frameDiscardPolicy::DISCARD_PARTIAL_FRAMES)
|
|
||||||
.value("NUM_DISCARD_POLICIES",
|
|
||||||
slsDetectorDefs::frameDiscardPolicy::NUM_DISCARD_POLICIES)
|
|
||||||
.export_values();
|
.export_values();
|
||||||
|
|
||||||
py::enum_<slsDetectorDefs::fileFormat>(Defs, "fileFormat")
|
py::enum_<slsDetectorDefs::fileFormat>(Defs, "fileFormat")
|
||||||
.value("BINARY", slsDetectorDefs::fileFormat::BINARY)
|
.value("BINARY", slsDetectorDefs::fileFormat::BINARY)
|
||||||
.value("HDF5", slsDetectorDefs::fileFormat::HDF5)
|
.value("HDF5", slsDetectorDefs::fileFormat::HDF5)
|
||||||
.value("NUM_FILE_FORMATS",
|
.value("NUM_FILE_FORMATS", slsDetectorDefs::fileFormat::NUM_FILE_FORMATS)
|
||||||
slsDetectorDefs::fileFormat::NUM_FILE_FORMATS)
|
|
||||||
.export_values();
|
.export_values();
|
||||||
|
|
||||||
py::enum_<slsDetectorDefs::dimension>(Defs, "dimension")
|
py::enum_<slsDetectorDefs::dimension>(Defs, "dimension")
|
||||||
@ -64,25 +59,19 @@ void init_enums(py::module &m) {
|
|||||||
.export_values();
|
.export_values();
|
||||||
|
|
||||||
py::enum_<slsDetectorDefs::externalSignalFlag>(Defs, "externalSignalFlag")
|
py::enum_<slsDetectorDefs::externalSignalFlag>(Defs, "externalSignalFlag")
|
||||||
.value("TRIGGER_IN_RISING_EDGE",
|
.value("TRIGGER_IN_RISING_EDGE", slsDetectorDefs::externalSignalFlag::TRIGGER_IN_RISING_EDGE)
|
||||||
slsDetectorDefs::externalSignalFlag::TRIGGER_IN_RISING_EDGE)
|
.value("TRIGGER_IN_FALLING_EDGE", slsDetectorDefs::externalSignalFlag::TRIGGER_IN_FALLING_EDGE)
|
||||||
.value("TRIGGER_IN_FALLING_EDGE",
|
.value("INVERSION_ON", slsDetectorDefs::externalSignalFlag::INVERSION_ON)
|
||||||
slsDetectorDefs::externalSignalFlag::TRIGGER_IN_FALLING_EDGE)
|
.value("INVERSION_OFF", slsDetectorDefs::externalSignalFlag::INVERSION_OFF)
|
||||||
.value("INVERSION_ON",
|
|
||||||
slsDetectorDefs::externalSignalFlag::INVERSION_ON)
|
|
||||||
.value("INVERSION_OFF",
|
|
||||||
slsDetectorDefs::externalSignalFlag::INVERSION_OFF)
|
|
||||||
.export_values();
|
.export_values();
|
||||||
|
|
||||||
py::enum_<slsDetectorDefs::timingMode>(Defs, "timingMode")
|
py::enum_<slsDetectorDefs::timingMode>(Defs, "timingMode")
|
||||||
.value("AUTO_TIMING", slsDetectorDefs::timingMode::AUTO_TIMING)
|
.value("AUTO_TIMING", slsDetectorDefs::timingMode::AUTO_TIMING)
|
||||||
.value("TRIGGER_EXPOSURE",
|
.value("TRIGGER_EXPOSURE", slsDetectorDefs::timingMode::TRIGGER_EXPOSURE)
|
||||||
slsDetectorDefs::timingMode::TRIGGER_EXPOSURE)
|
|
||||||
.value("GATED", slsDetectorDefs::timingMode::GATED)
|
.value("GATED", slsDetectorDefs::timingMode::GATED)
|
||||||
.value("BURST_TRIGGER", slsDetectorDefs::timingMode::BURST_TRIGGER)
|
.value("BURST_TRIGGER", slsDetectorDefs::timingMode::BURST_TRIGGER)
|
||||||
.value("TRIGGER_GATED", slsDetectorDefs::timingMode::TRIGGER_GATED)
|
.value("TRIGGER_GATED", slsDetectorDefs::timingMode::TRIGGER_GATED)
|
||||||
.value("NUM_TIMING_MODES",
|
.value("NUM_TIMING_MODES", slsDetectorDefs::timingMode::NUM_TIMING_MODES)
|
||||||
slsDetectorDefs::timingMode::NUM_TIMING_MODES)
|
|
||||||
.export_values();
|
.export_values();
|
||||||
|
|
||||||
py::enum_<slsDetectorDefs::dacIndex>(Defs, "dacIndex")
|
py::enum_<slsDetectorDefs::dacIndex>(Defs, "dacIndex")
|
||||||
@ -170,16 +159,13 @@ void init_enums(py::module &m) {
|
|||||||
.value("HIGH_VOLTAGE", slsDetectorDefs::dacIndex::HIGH_VOLTAGE)
|
.value("HIGH_VOLTAGE", slsDetectorDefs::dacIndex::HIGH_VOLTAGE)
|
||||||
.value("TEMPERATURE_ADC", slsDetectorDefs::dacIndex::TEMPERATURE_ADC)
|
.value("TEMPERATURE_ADC", slsDetectorDefs::dacIndex::TEMPERATURE_ADC)
|
||||||
.value("TEMPERATURE_FPGA", slsDetectorDefs::dacIndex::TEMPERATURE_FPGA)
|
.value("TEMPERATURE_FPGA", slsDetectorDefs::dacIndex::TEMPERATURE_FPGA)
|
||||||
.value("TEMPERATURE_FPGAEXT",
|
.value("TEMPERATURE_FPGAEXT", slsDetectorDefs::dacIndex::TEMPERATURE_FPGAEXT)
|
||||||
slsDetectorDefs::dacIndex::TEMPERATURE_FPGAEXT)
|
|
||||||
.value("TEMPERATURE_10GE", slsDetectorDefs::dacIndex::TEMPERATURE_10GE)
|
.value("TEMPERATURE_10GE", slsDetectorDefs::dacIndex::TEMPERATURE_10GE)
|
||||||
.value("TEMPERATURE_DCDC", slsDetectorDefs::dacIndex::TEMPERATURE_DCDC)
|
.value("TEMPERATURE_DCDC", slsDetectorDefs::dacIndex::TEMPERATURE_DCDC)
|
||||||
.value("TEMPERATURE_SODL", slsDetectorDefs::dacIndex::TEMPERATURE_SODL)
|
.value("TEMPERATURE_SODL", slsDetectorDefs::dacIndex::TEMPERATURE_SODL)
|
||||||
.value("TEMPERATURE_SODR", slsDetectorDefs::dacIndex::TEMPERATURE_SODR)
|
.value("TEMPERATURE_SODR", slsDetectorDefs::dacIndex::TEMPERATURE_SODR)
|
||||||
.value("TEMPERATURE_FPGA2",
|
.value("TEMPERATURE_FPGA2", slsDetectorDefs::dacIndex::TEMPERATURE_FPGA2)
|
||||||
slsDetectorDefs::dacIndex::TEMPERATURE_FPGA2)
|
.value("TEMPERATURE_FPGA3", slsDetectorDefs::dacIndex::TEMPERATURE_FPGA3)
|
||||||
.value("TEMPERATURE_FPGA3",
|
|
||||||
slsDetectorDefs::dacIndex::TEMPERATURE_FPGA3)
|
|
||||||
.value("TRIMBIT_SCAN", slsDetectorDefs::dacIndex::TRIMBIT_SCAN)
|
.value("TRIMBIT_SCAN", slsDetectorDefs::dacIndex::TRIMBIT_SCAN)
|
||||||
.value("V_POWER_A", slsDetectorDefs::dacIndex::V_POWER_A)
|
.value("V_POWER_A", slsDetectorDefs::dacIndex::V_POWER_A)
|
||||||
.value("V_POWER_B", slsDetectorDefs::dacIndex::V_POWER_B)
|
.value("V_POWER_B", slsDetectorDefs::dacIndex::V_POWER_B)
|
||||||
@ -218,20 +204,15 @@ void init_enums(py::module &m) {
|
|||||||
.value("VERYLOWGAIN", slsDetectorDefs::detectorSettings::VERYLOWGAIN)
|
.value("VERYLOWGAIN", slsDetectorDefs::detectorSettings::VERYLOWGAIN)
|
||||||
.value("G1_HIGHGAIN", slsDetectorDefs::detectorSettings::G1_HIGHGAIN)
|
.value("G1_HIGHGAIN", slsDetectorDefs::detectorSettings::G1_HIGHGAIN)
|
||||||
.value("G1_LOWGAIN", slsDetectorDefs::detectorSettings::G1_LOWGAIN)
|
.value("G1_LOWGAIN", slsDetectorDefs::detectorSettings::G1_LOWGAIN)
|
||||||
.value("G2_HIGHCAP_HIGHGAIN",
|
.value("G2_HIGHCAP_HIGHGAIN", slsDetectorDefs::detectorSettings::G2_HIGHCAP_HIGHGAIN)
|
||||||
slsDetectorDefs::detectorSettings::G2_HIGHCAP_HIGHGAIN)
|
.value("G2_HIGHCAP_LOWGAIN", slsDetectorDefs::detectorSettings::G2_HIGHCAP_LOWGAIN)
|
||||||
.value("G2_HIGHCAP_LOWGAIN",
|
.value("G2_LOWCAP_HIGHGAIN", slsDetectorDefs::detectorSettings::G2_LOWCAP_HIGHGAIN)
|
||||||
slsDetectorDefs::detectorSettings::G2_HIGHCAP_LOWGAIN)
|
.value("G2_LOWCAP_LOWGAIN", slsDetectorDefs::detectorSettings::G2_LOWCAP_LOWGAIN)
|
||||||
.value("G2_LOWCAP_HIGHGAIN",
|
|
||||||
slsDetectorDefs::detectorSettings::G2_LOWCAP_HIGHGAIN)
|
|
||||||
.value("G2_LOWCAP_LOWGAIN",
|
|
||||||
slsDetectorDefs::detectorSettings::G2_LOWCAP_LOWGAIN)
|
|
||||||
.value("G4_HIGHGAIN", slsDetectorDefs::detectorSettings::G4_HIGHGAIN)
|
.value("G4_HIGHGAIN", slsDetectorDefs::detectorSettings::G4_HIGHGAIN)
|
||||||
.value("G4_LOWGAIN", slsDetectorDefs::detectorSettings::G4_LOWGAIN)
|
.value("G4_LOWGAIN", slsDetectorDefs::detectorSettings::G4_LOWGAIN)
|
||||||
.value("GAIN0", slsDetectorDefs::detectorSettings::GAIN0)
|
.value("GAIN0", slsDetectorDefs::detectorSettings::GAIN0)
|
||||||
.value("UNDEFINED", slsDetectorDefs::detectorSettings::UNDEFINED)
|
.value("UNDEFINED", slsDetectorDefs::detectorSettings::UNDEFINED)
|
||||||
.value("UNINITIALIZED",
|
.value("UNINITIALIZED", slsDetectorDefs::detectorSettings::UNINITIALIZED)
|
||||||
slsDetectorDefs::detectorSettings::UNINITIALIZED)
|
|
||||||
.export_values();
|
.export_values();
|
||||||
|
|
||||||
py::enum_<slsDetectorDefs::clockIndex>(Defs, "clockIndex")
|
py::enum_<slsDetectorDefs::clockIndex>(Defs, "clockIndex")
|
||||||
@ -244,8 +225,7 @@ void init_enums(py::module &m) {
|
|||||||
py::enum_<slsDetectorDefs::readoutMode>(Defs, "readoutMode")
|
py::enum_<slsDetectorDefs::readoutMode>(Defs, "readoutMode")
|
||||||
.value("ANALOG_ONLY", slsDetectorDefs::readoutMode::ANALOG_ONLY)
|
.value("ANALOG_ONLY", slsDetectorDefs::readoutMode::ANALOG_ONLY)
|
||||||
.value("DIGITAL_ONLY", slsDetectorDefs::readoutMode::DIGITAL_ONLY)
|
.value("DIGITAL_ONLY", slsDetectorDefs::readoutMode::DIGITAL_ONLY)
|
||||||
.value("ANALOG_AND_DIGITAL",
|
.value("ANALOG_AND_DIGITAL", slsDetectorDefs::readoutMode::ANALOG_AND_DIGITAL)
|
||||||
slsDetectorDefs::readoutMode::ANALOG_AND_DIGITAL)
|
|
||||||
.export_values();
|
.export_values();
|
||||||
|
|
||||||
py::enum_<slsDetectorDefs::speedLevel>(Defs, "speedLevel")
|
py::enum_<slsDetectorDefs::speedLevel>(Defs, "speedLevel")
|
||||||
@ -259,22 +239,17 @@ void init_enums(py::module &m) {
|
|||||||
py::enum_<slsDetectorDefs::burstMode>(Defs, "burstMode")
|
py::enum_<slsDetectorDefs::burstMode>(Defs, "burstMode")
|
||||||
.value("BURST_INTERNAL", slsDetectorDefs::burstMode::BURST_INTERNAL)
|
.value("BURST_INTERNAL", slsDetectorDefs::burstMode::BURST_INTERNAL)
|
||||||
.value("BURST_EXTERNAL", slsDetectorDefs::burstMode::BURST_EXTERNAL)
|
.value("BURST_EXTERNAL", slsDetectorDefs::burstMode::BURST_EXTERNAL)
|
||||||
.value("CONTINUOUS_INTERNAL",
|
.value("CONTINUOUS_INTERNAL", slsDetectorDefs::burstMode::CONTINUOUS_INTERNAL)
|
||||||
slsDetectorDefs::burstMode::CONTINUOUS_INTERNAL)
|
.value("CONTINUOUS_EXTERNAL", slsDetectorDefs::burstMode::CONTINUOUS_EXTERNAL)
|
||||||
.value("CONTINUOUS_EXTERNAL",
|
|
||||||
slsDetectorDefs::burstMode::CONTINUOUS_EXTERNAL)
|
|
||||||
.value("NUM_BURST_MODES", slsDetectorDefs::burstMode::NUM_BURST_MODES)
|
.value("NUM_BURST_MODES", slsDetectorDefs::burstMode::NUM_BURST_MODES)
|
||||||
.export_values();
|
.export_values();
|
||||||
|
|
||||||
py::enum_<slsDetectorDefs::timingSourceType>(Defs, "timingSourceType")
|
py::enum_<slsDetectorDefs::timingSourceType>(Defs, "timingSourceType")
|
||||||
.value("TIMING_INTERNAL",
|
.value("TIMING_INTERNAL", slsDetectorDefs::timingSourceType::TIMING_INTERNAL)
|
||||||
slsDetectorDefs::timingSourceType::TIMING_INTERNAL)
|
.value("TIMING_EXTERNAL", slsDetectorDefs::timingSourceType::TIMING_EXTERNAL)
|
||||||
.value("TIMING_EXTERNAL",
|
|
||||||
slsDetectorDefs::timingSourceType::TIMING_EXTERNAL)
|
|
||||||
.export_values();
|
.export_values();
|
||||||
|
|
||||||
py::enum_<slsDetectorDefs::M3_GainCaps>(Defs, "M3_GainCaps",
|
py::enum_<slsDetectorDefs::M3_GainCaps>(Defs, "M3_GainCaps")
|
||||||
py::arithmetic())
|
|
||||||
.value("M3_C10pre", slsDetectorDefs::M3_GainCaps::M3_C10pre)
|
.value("M3_C10pre", slsDetectorDefs::M3_GainCaps::M3_C10pre)
|
||||||
.value("M3_C15sh", slsDetectorDefs::M3_GainCaps::M3_C15sh)
|
.value("M3_C15sh", slsDetectorDefs::M3_GainCaps::M3_C15sh)
|
||||||
.value("M3_C30sh", slsDetectorDefs::M3_GainCaps::M3_C30sh)
|
.value("M3_C30sh", slsDetectorDefs::M3_GainCaps::M3_C30sh)
|
||||||
@ -290,17 +265,14 @@ void init_enums(py::module &m) {
|
|||||||
.value("BOTTOM", slsDetectorDefs::portPosition::BOTTOM)
|
.value("BOTTOM", slsDetectorDefs::portPosition::BOTTOM)
|
||||||
.export_values();
|
.export_values();
|
||||||
|
|
||||||
py::enum_<slsDetectorDefs::streamingInterface>(Defs, "streamingInterface",
|
py::enum_<slsDetectorDefs::streamingInterface>(Defs, "streamingInterface", py::arithmetic())
|
||||||
py::arithmetic())
|
|
||||||
.value("NONE", slsDetectorDefs::streamingInterface::NONE)
|
.value("NONE", slsDetectorDefs::streamingInterface::NONE)
|
||||||
.value("LOW_LATENCY_LINK",
|
.value("LOW_LATENCY_LINK", slsDetectorDefs::streamingInterface::LOW_LATENCY_LINK)
|
||||||
slsDetectorDefs::streamingInterface::LOW_LATENCY_LINK)
|
.value("ETHERNET_10GB", slsDetectorDefs::streamingInterface::ETHERNET_10GB)
|
||||||
.value("ETHERNET_10GB",
|
|
||||||
slsDetectorDefs::streamingInterface::ETHERNET_10GB)
|
|
||||||
.value("ALL", slsDetectorDefs::streamingInterface::ALL)
|
.value("ALL", slsDetectorDefs::streamingInterface::ALL)
|
||||||
.export_values()
|
.export_values()
|
||||||
.def(py::self | slsDetectorDefs::streamingInterface())
|
.def("__or__", py::overload_cast<const slsDetectorDefs::streamingInterface &, const slsDetectorDefs::streamingInterface &>(&operator|))
|
||||||
.def(py::self & slsDetectorDefs::streamingInterface());
|
.def("__and__", py::overload_cast<const slsDetectorDefs::streamingInterface &, const slsDetectorDefs::streamingInterface &>(&operator&));
|
||||||
|
|
||||||
py::enum_<slsDetectorDefs::vetoAlgorithm>(Defs, "vetoAlgorithm")
|
py::enum_<slsDetectorDefs::vetoAlgorithm>(Defs, "vetoAlgorithm")
|
||||||
.value("ALG_HITS", slsDetectorDefs::vetoAlgorithm::ALG_HITS)
|
.value("ALG_HITS", slsDetectorDefs::vetoAlgorithm::ALG_HITS)
|
||||||
@ -315,9 +287,4 @@ void init_enums(py::module &m) {
|
|||||||
.value("FIX_G2", slsDetectorDefs::gainMode::FIX_G2)
|
.value("FIX_G2", slsDetectorDefs::gainMode::FIX_G2)
|
||||||
.value("FIX_G0", slsDetectorDefs::gainMode::FIX_G0)
|
.value("FIX_G0", slsDetectorDefs::gainMode::FIX_G0)
|
||||||
.export_values();
|
.export_values();
|
||||||
|
|
||||||
py::enum_<slsDetectorDefs::polarity>(Defs, "polarity")
|
|
||||||
.value("POSITIVE", slsDetectorDefs::polarity::POSITIVE)
|
|
||||||
.value("NEGATIVE", slsDetectorDefs::polarity::NEGATIVE)
|
|
||||||
.export_values();
|
|
||||||
}
|
}
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
from slsdet.enums import streamingInterface
|
|
||||||
import pytest
|
|
||||||
def test_streamingInterface_bitwise():
|
|
||||||
"""Bitwise operations on streaming interfaces are allowed"""
|
|
||||||
|
|
||||||
sif_none = streamingInterface.NONE
|
|
||||||
sif_low = streamingInterface.LOW_LATENCY_LINK
|
|
||||||
sif_10g = streamingInterface.ETHERNET_10GB
|
|
||||||
sif_all = streamingInterface.ALL
|
|
||||||
|
|
||||||
assert sif_low | sif_none == sif_low
|
|
||||||
assert sif_10g | sif_none == sif_10g
|
|
||||||
assert sif_low | sif_10g == sif_all
|
|
||||||
assert sif_10g | sif_all == sif_all
|
|
||||||
|
|
||||||
assert sif_10g & sif_low == sif_none
|
|
||||||
assert sif_low & sif_low == sif_low
|
|
||||||
assert sif_all & sif_all == sif_all
|
|
||||||
|
|
||||||
def test_streamingInterface_bitwise_only_allowed_on_same_type():
|
|
||||||
with pytest.raises(Exception):
|
|
||||||
assert streamingInterface.LOW_LATENCY_LINK & 5 == 7
|
|
||||||
|
|
1
serverBin/ctbDetectorServerv6.0.0
Symbolic link
1
serverBin/ctbDetectorServerv6.0.0
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServerv6.0.0
|
@ -1 +0,0 @@
|
|||||||
../slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServerv6.1.0
|
|
1
serverBin/eigerDetectorServerv6.0.0
Symbolic link
1
serverBin/eigerDetectorServerv6.0.0
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServerv6.0.0
|
@ -1 +0,0 @@
|
|||||||
../slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServerv6.1.0
|
|
1
serverBin/gotthard2DetectorServerv6.0.0
Symbolic link
1
serverBin/gotthard2DetectorServerv6.0.0
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServerv6.0.0
|
@ -1 +0,0 @@
|
|||||||
../slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServerv6.1.0
|
|
1
serverBin/gotthardDetectorServerv6.0.0
Symbolic link
1
serverBin/gotthardDetectorServerv6.0.0
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServerv6.0.0
|
@ -1 +0,0 @@
|
|||||||
../slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServerv6.1.0
|
|
1
serverBin/jungfrauDetectorServerv6.0.0
Symbolic link
1
serverBin/jungfrauDetectorServerv6.0.0
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv6.0.0
|
@ -1 +0,0 @@
|
|||||||
../slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv6.1.0
|
|
1
serverBin/moenchDetectorServerv6.0.0
Symbolic link
1
serverBin/moenchDetectorServerv6.0.0
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv6.0.0
|
@ -1 +0,0 @@
|
|||||||
../slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv6.1.0
|
|
1
serverBin/mythen3DetectorServerv6.0.0
Symbolic link
1
serverBin/mythen3DetectorServerv6.0.0
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv6.0.0
|
@ -1 +0,0 @@
|
|||||||
../slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv6.1.0
|
|
Binary file not shown.
Binary file not shown.
@ -5,44 +5,44 @@
|
|||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
class MovingStat {
|
|
||||||
|
class MovingStat
|
||||||
|
{
|
||||||
|
|
||||||
/** @short approximated moving average structure */
|
/** @short approximated moving average structure */
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
/** constructor
|
/** constructor
|
||||||
\param nn number of samples parameter to be used
|
\param nn number of samples parameter to be used
|
||||||
*/
|
*/
|
||||||
MovingStat(int nn) : n(nn), m_n(0), m_newM(0),m_newM2(0) {}
|
MovingStat(int nn) : n(nn), m_n(0), m_newM(0),m_newM2(0) {}
|
||||||
// void setPointers(double *me, double *va) {mean=me; var=va;}
|
// void setPointers(double *me, double *va) {mean=me; var=va;}
|
||||||
/**
|
/**
|
||||||
clears the moving average number of samples parameter, mean and standard
|
clears the moving average number of samples parameter, mean and standard deviation
|
||||||
deviation
|
|
||||||
*/
|
*/
|
||||||
void Clear() {
|
void Clear()
|
||||||
|
{
|
||||||
m_n = 0;
|
m_n = 0;
|
||||||
m_newM=0;
|
m_newM=0;
|
||||||
m_newM2=0;
|
m_newM2=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
clears the moving average number of samples parameter, mean and standard
|
clears the moving average number of samples parameter, mean and standard deviation
|
||||||
deviation
|
|
||||||
*/
|
*/
|
||||||
void Set(double val, double rms = 0, int m = -1) {
|
void Set(double val, double rms=0, int m=-1)
|
||||||
if (m >= 0)
|
{
|
||||||
m_n = m;
|
if (m>=0) m_n = m; else m_n = n;
|
||||||
else
|
|
||||||
m_n = n;
|
|
||||||
m_newM=val*m_n;
|
m_newM=val*m_n;
|
||||||
SetRMS(rms);
|
SetRMS(rms);
|
||||||
// cout << "set " << val << " " << m << " " << m_n << " " << m_newM <<
|
// cout << "set " << val << " " << m << " " << m_n << " " << m_newM << endl;
|
||||||
// endl;
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
clears the moving average number of samples parameter, mean and standard
|
clears the moving average number of samples parameter, mean and standard deviation
|
||||||
deviation
|
|
||||||
*/
|
*/
|
||||||
void SetRMS(double rms) {
|
void SetRMS(double rms)
|
||||||
|
{
|
||||||
if (rms<=0) {
|
if (rms<=0) {
|
||||||
if (m_n>0)
|
if (m_n>0)
|
||||||
m_newM2=m_newM*m_newM/m_n;
|
m_newM2=m_newM*m_newM/m_n;
|
||||||
@ -63,11 +63,7 @@ class MovingStat {
|
|||||||
\param i number of samples parameter to be set
|
\param i number of samples parameter to be set
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int SetN(int i) {
|
int SetN(int i) {if (i>=1) n=i; return n;};
|
||||||
if (i >= 1)
|
|
||||||
n = i;
|
|
||||||
return n;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
gets number of samples parameter
|
gets number of samples parameter
|
||||||
@ -75,15 +71,12 @@ class MovingStat {
|
|||||||
*/
|
*/
|
||||||
int GetN() {return m_n;};
|
int GetN() {return m_n;};
|
||||||
|
|
||||||
/** calculates the moving average i.e. adds if number of elements is lower
|
/** calculates the moving average i.e. adds if number of elements is lower than number of samples parameter, pushes otherwise
|
||||||
than number of samples parameter, pushes otherwise \param x value to
|
\param x value to calculate the moving average
|
||||||
calculate the moving average
|
|
||||||
*/
|
*/
|
||||||
inline void Calc(double x) {
|
inline void Calc(double x) {
|
||||||
if (m_n < n)
|
if (m_n<n) Add(x);
|
||||||
Add(x);
|
else Push(x);
|
||||||
else
|
|
||||||
Push(x);
|
|
||||||
}
|
}
|
||||||
/** adds the element to the accumulated average and standard deviation
|
/** adds the element to the accumulated average and standard deviation
|
||||||
\param x value to add
|
\param x value to add
|
||||||
@ -91,40 +84,51 @@ class MovingStat {
|
|||||||
inline void Add(double x) {
|
inline void Add(double x) {
|
||||||
m_n++;
|
m_n++;
|
||||||
|
|
||||||
if (m_n == 1) {
|
if (m_n == 1)
|
||||||
|
{
|
||||||
m_newM = x;
|
m_newM = x;
|
||||||
m_newM2 = x*x;
|
m_newM2 = x*x;
|
||||||
} else {
|
} else {
|
||||||
m_newM = m_newM + x;
|
m_newM = m_newM + x;
|
||||||
m_newM2 = m_newM2 + x*x;
|
m_newM2 = m_newM2 + x*x;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Push(double x) {
|
}
|
||||||
/** adds the element to the accumulated average and squared mean, while
|
|
||||||
subtracting the current value of the average and squared average
|
|
||||||
|
inline void Push(double x)
|
||||||
|
{
|
||||||
|
/** adds the element to the accumulated average and squared mean, while subtracting the current value of the average and squared average
|
||||||
\param x value to push
|
\param x value to push
|
||||||
*/
|
*/
|
||||||
if (m_n == 0) {
|
if (m_n == 0)
|
||||||
|
{
|
||||||
m_newM = x;
|
m_newM = x;
|
||||||
m_newM2 = x*x;
|
m_newM2 = x*x;
|
||||||
m_n++;
|
m_n++;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
m_newM = m_newM + x - m_newM/m_n;
|
m_newM = m_newM + x - m_newM/m_n;
|
||||||
m_newM2 = m_newM2 + x*x - m_newM2/m_n;
|
m_newM2 = m_newM2 + x*x - m_newM2/m_n;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** returns the current number of elements of the moving average
|
/** returns the current number of elements of the moving average
|
||||||
\returns returns the current number of elements of the moving average
|
\returns returns the current number of elements of the moving average
|
||||||
*/
|
*/
|
||||||
int NumDataValues() const { return m_n; }
|
int NumDataValues() const
|
||||||
|
{
|
||||||
|
return m_n;
|
||||||
|
}
|
||||||
/** returns the mean, 0 if no elements are inside
|
/** returns the mean, 0 if no elements are inside
|
||||||
\returns returns the mean
|
\returns returns the mean
|
||||||
*/
|
*/
|
||||||
inline double Mean() const {
|
inline double Mean() const
|
||||||
// cout << "get " << m_n << " " << m_newM << " " << m_newM/m_n <<
|
{
|
||||||
// endl;
|
// cout << "get " << m_n << " " << m_newM << " " << m_newM/m_n << endl;
|
||||||
|
|
||||||
|
|
||||||
return (m_n > 0) ? m_newM/m_n : 0.0;
|
return (m_n > 0) ? m_newM/m_n : 0.0;
|
||||||
}
|
}
|
||||||
@ -132,19 +136,24 @@ class MovingStat {
|
|||||||
/** returns the squared mean, 0 if no elements are inside
|
/** returns the squared mean, 0 if no elements are inside
|
||||||
\returns returns the squared average
|
\returns returns the squared average
|
||||||
*/
|
*/
|
||||||
double M2() const { return ((m_n > 1) ? m_newM2 / m_n : 0.0); }
|
double M2() const
|
||||||
|
{
|
||||||
|
return ( (m_n > 1) ? m_newM2/m_n : 0.0 );
|
||||||
|
}
|
||||||
|
|
||||||
/** returns the variance, 0 if no elements are inside
|
/** returns the variance, 0 if no elements are inside
|
||||||
\returns returns the variance
|
\returns returns the variance
|
||||||
*/
|
*/
|
||||||
inline double Variance() const {
|
inline double Variance() const
|
||||||
|
{
|
||||||
return (m_n > 0) ? m_newM2/m_n-m_newM/m_n*m_newM/m_n : 0.0;
|
return (m_n > 0) ? m_newM2/m_n-m_newM/m_n*m_newM/m_n : 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** returns the standard deviation, 0 if no elements are inside
|
/** returns the standard deviation, 0 if no elements are inside
|
||||||
\returns returns the standard deviation
|
\returns returns the standard deviation
|
||||||
*/
|
*/
|
||||||
inline double StandardDeviation() const {
|
inline double StandardDeviation() const
|
||||||
|
{
|
||||||
|
|
||||||
return sqrt(Variance());//
|
return sqrt(Variance());//
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,27 @@
|
|||||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
class RunningStat {
|
class RunningStat
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
RunningStat() : m_n(0) {}
|
RunningStat() : m_n(0) {}
|
||||||
|
|
||||||
void Clear() { m_n = 0; }
|
void Clear()
|
||||||
|
{
|
||||||
|
m_n = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void Push(double x) {
|
void Push(double x)
|
||||||
|
{
|
||||||
m_n++;
|
m_n++;
|
||||||
|
|
||||||
// See Knuth TAOCP vol 2, 3rd edition, page 232
|
// See Knuth TAOCP vol 2, 3rd edition, page 232
|
||||||
if (m_n == 1) {
|
if (m_n == 1)
|
||||||
|
{
|
||||||
m_oldM = m_newM = x;
|
m_oldM = m_newM = x;
|
||||||
m_oldS = 0.0;
|
m_oldS = 0.0;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_newM = m_oldM + (x - m_oldM)/m_n;
|
m_newM = m_oldM + (x - m_oldM)/m_n;
|
||||||
m_newS = m_oldS + (x - m_oldM)*(x - m_newM);
|
m_newS = m_oldS + (x - m_oldM)*(x - m_newM);
|
||||||
|
|
||||||
@ -23,13 +31,25 @@ class RunningStat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int NumDataValues() const { return m_n; }
|
int NumDataValues() const
|
||||||
|
{
|
||||||
|
return m_n;
|
||||||
|
}
|
||||||
|
|
||||||
double Mean() const { return (m_n > 0) ? m_newM : 0.0; }
|
double Mean() const
|
||||||
|
{
|
||||||
|
return (m_n > 0) ? m_newM : 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
double Variance() const { return ((m_n > 1) ? m_newS / (m_n - 1) : 0.0); }
|
double Variance() const
|
||||||
|
{
|
||||||
|
return ( (m_n > 1) ? m_newS/(m_n - 1) : 0.0 );
|
||||||
|
}
|
||||||
|
|
||||||
double StandardDeviation() const { return sqrt(Variance()); }
|
double StandardDeviation() const
|
||||||
|
{
|
||||||
|
return sqrt( Variance() );
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_n;
|
int m_n;
|
||||||
|
@ -1,31 +1,45 @@
|
|||||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
class Stat {
|
class Stat
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Stat() : n(0), m(0.), m2(0.) {}
|
Stat() : n(0), m(0.), m2(0.) {}
|
||||||
|
|
||||||
void Clear() {
|
void Clear()
|
||||||
|
{
|
||||||
n = 0;
|
n = 0;
|
||||||
m=0;
|
m=0;
|
||||||
m2=0;
|
m2=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Push(double x) {
|
void Push(double x)
|
||||||
|
{
|
||||||
|
|
||||||
m+=x;
|
m+=x;
|
||||||
m2+=x*x;
|
m2+=x*x;
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
|
|
||||||
int NumDataValues() const { return n; }
|
int NumDataValues() const
|
||||||
|
{
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
double Mean() const { return (n > 0) ? m / n : 0.0; }
|
double Mean() const
|
||||||
|
{
|
||||||
|
return (n > 0) ? m/n : 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
double Variance() const {
|
double Variance() const
|
||||||
|
{
|
||||||
return ( (n >0 ) ? (m2/n-m*m/(n*n)) : 0.0 );
|
return ( (n >0 ) ? (m2/n-m*m/(n*n)) : 0.0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
double StandardDeviation() const { return sqrt(Variance()); }
|
double StandardDeviation() const
|
||||||
|
{
|
||||||
|
return sqrt( Variance() );
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int n;
|
int n;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -10,18 +10,22 @@
|
|||||||
* */
|
* */
|
||||||
|
|
||||||
//#include "sls_receiver_defs.h"
|
//#include "sls_receiver_defs.h"
|
||||||
#include <iostream>
|
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
typedef double double32_t;
|
typedef double double32_t;
|
||||||
typedef float float32_t;
|
typedef float float32_t;
|
||||||
typedef int int32_t;
|
typedef int int32_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Circular Fifo (a.k.a. Circular Buffer)
|
/** Circular Fifo (a.k.a. Circular Buffer)
|
||||||
* Thread safe for one reader, and one writer */
|
* Thread safe for one reader, and one writer */
|
||||||
template <typename Element> class CircularFifo {
|
template<typename Element>
|
||||||
|
class CircularFifo {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CircularFifo(unsigned int Size) : tail(0), head(0){
|
CircularFifo(unsigned int Size) : tail(0), head(0){
|
||||||
Capacity = Size + 1;
|
Capacity = Size + 1;
|
||||||
array.resize(Capacity);
|
array.resize(Capacity);
|
||||||
@ -52,18 +56,23 @@ template <typename Element> class CircularFifo {
|
|||||||
unsigned int increment(unsigned int idx_) const;
|
unsigned int increment(unsigned int idx_) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Element> int CircularFifo<Element>::getDataValue() const {
|
template<typename Element>
|
||||||
|
int CircularFifo<Element>::getDataValue() const
|
||||||
|
{
|
||||||
int value;
|
int value;
|
||||||
sem_getvalue(&data_mutex, &value);
|
sem_getvalue(&data_mutex, &value);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Element> int CircularFifo<Element>::getFreeValue() const {
|
template<typename Element>
|
||||||
|
int CircularFifo<Element>::getFreeValue() const
|
||||||
|
{
|
||||||
int value;
|
int value;
|
||||||
sem_getvalue(&free_mutex, &value);
|
sem_getvalue(&free_mutex, &value);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Producer only: Adds item to the circular queue.
|
/** Producer only: Adds item to the circular queue.
|
||||||
* If queue is full at 'push' operation no update/overwrite
|
* If queue is full at 'push' operation no update/overwrite
|
||||||
* will happen, it is up to the caller to handle this case
|
* will happen, it is up to the caller to handle this case
|
||||||
@ -72,7 +81,8 @@ template <typename Element> int CircularFifo<Element>::getFreeValue() const {
|
|||||||
* \param no_block if true, return immediately if fifo is full
|
* \param no_block if true, return immediately if fifo is full
|
||||||
* \return whether operation was successful or not */
|
* \return whether operation was successful or not */
|
||||||
template<typename Element>
|
template<typename Element>
|
||||||
bool CircularFifo<Element>::push(Element *&item_, bool no_block) {
|
bool CircularFifo<Element>::push(Element*& item_, bool no_block)
|
||||||
|
{
|
||||||
// check for fifo full
|
// check for fifo full
|
||||||
if (no_block && isFull())
|
if (no_block && isFull())
|
||||||
return false;
|
return false;
|
||||||
@ -92,7 +102,8 @@ bool CircularFifo<Element>::push(Element *&item_, bool no_block) {
|
|||||||
* \param no_block if true, return immediately if fifo is full
|
* \param no_block if true, return immediately if fifo is full
|
||||||
* \return whether operation was successful or not */
|
* \return whether operation was successful or not */
|
||||||
template<typename Element>
|
template<typename Element>
|
||||||
bool CircularFifo<Element>::pop(Element *&item_, bool no_block) {
|
bool CircularFifo<Element>::pop(Element*& item_, bool no_block)
|
||||||
|
{
|
||||||
// check for fifo empty
|
// check for fifo empty
|
||||||
if (no_block && isEmpty())
|
if (no_block && isEmpty())
|
||||||
return false;
|
return false;
|
||||||
@ -109,7 +120,9 @@ bool CircularFifo<Element>::pop(Element *&item_, bool no_block) {
|
|||||||
* as the Procuder adds more items.
|
* as the Procuder adds more items.
|
||||||
*
|
*
|
||||||
* \return true if circular buffer is empty */
|
* \return true if circular buffer is empty */
|
||||||
template <typename Element> bool CircularFifo<Element>::isEmpty() const {
|
template<typename Element>
|
||||||
|
bool CircularFifo<Element>::isEmpty() const
|
||||||
|
{
|
||||||
return (getDataValue() == 0);
|
return (getDataValue() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +131,9 @@ template <typename Element> bool CircularFifo<Element>::isEmpty() const {
|
|||||||
* as the Consumer catches up.
|
* as the Consumer catches up.
|
||||||
*
|
*
|
||||||
* \return true if circular buffer is full. */
|
* \return true if circular buffer is full. */
|
||||||
template <typename Element> bool CircularFifo<Element>::isFull() const {
|
template<typename Element>
|
||||||
|
bool CircularFifo<Element>::isFull() const
|
||||||
|
{
|
||||||
return (getFreeValue() == 0);
|
return (getFreeValue() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +143,8 @@ template <typename Element> bool CircularFifo<Element>::isFull() const {
|
|||||||
* \param idx_ the index to the incremented/wrapped
|
* \param idx_ the index to the incremented/wrapped
|
||||||
* \return new value for the index */
|
* \return new value for the index */
|
||||||
template<typename Element>
|
template<typename Element>
|
||||||
unsigned int CircularFifo<Element>::increment(unsigned int idx_) const {
|
unsigned int CircularFifo<Element>::increment(unsigned int idx_) const
|
||||||
|
{
|
||||||
// increment or wrap
|
// increment or wrap
|
||||||
// =================
|
// =================
|
||||||
// index++;
|
// index++;
|
||||||
@ -139,3 +155,4 @@ unsigned int CircularFifo<Element>::increment(unsigned int idx_) const {
|
|||||||
idx_ = (idx_+1) % Capacity;
|
idx_ = (idx_+1) % Capacity;
|
||||||
return idx_;
|
return idx_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,95 +5,80 @@
|
|||||||
|
|
||||||
#include "MovingStat.h"
|
#include "MovingStat.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class commonModeSubtraction {
|
class commonModeSubtraction {
|
||||||
|
|
||||||
/** @short class to calculate the common mode of the pedestals based on an
|
/** @short class to calculate the common mode of the pedestals based on an approximated moving average*/
|
||||||
* approximated moving average*/
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** constructor
|
/** constructor
|
||||||
\param nn number of samples for the moving average to calculate the
|
\param nn number of samples for the moving average to calculate the average common mode
|
||||||
average common mode \param iroi number of regions on which one can
|
\param iroi number of regions on which one can calculate the common mode separately. Defaults to 1 i.e. whole detector
|
||||||
calculate the common mode separately. Defaults to 1 i.e. whole detector
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
commonModeSubtraction(int nn = 1000, int iroi = 1)
|
commonModeSubtraction(int nn=1000, int iroi=1) : cmStat(NULL), cmPed(NULL), nCm(NULL), nROI(iroi) {cmStat=new MovingStat[nROI]; for (int i=0; i<nROI; i++) cmStat[i].SetN(nn); cmPed=new double[nROI]; nCm=new double[nROI];};
|
||||||
: cmStat(NULL), cmPed(NULL), nCm(NULL), nROI(iroi) {
|
|
||||||
cmStat = new MovingStat[nROI];
|
|
||||||
for (int i = 0; i < nROI; i++)
|
|
||||||
cmStat[i].SetN(nn);
|
|
||||||
cmPed = new double[nROI];
|
|
||||||
nCm = new double[nROI];
|
|
||||||
};
|
|
||||||
|
|
||||||
/** destructor - deletes the moving average(s) and the sum of pedestals
|
/** destructor - deletes the moving average(s) and the sum of pedestals calculator(s) */
|
||||||
* calculator(s) */
|
virtual ~commonModeSubtraction() {delete [] cmStat; delete [] cmPed; delete [] nCm;};
|
||||||
virtual ~commonModeSubtraction() {
|
|
||||||
delete[] cmStat;
|
|
||||||
delete[] cmPed;
|
|
||||||
delete[] nCm;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** clears the moving average and the sum of pedestals calculation - virtual
|
|
||||||
* func*/
|
/** clears the moving average and the sum of pedestals calculation - virtual func*/
|
||||||
virtual void Clear(){
|
virtual void Clear(){
|
||||||
for (int i=0; i<nROI; i++) {
|
for (int i=0; i<nROI; i++) {
|
||||||
cmStat[i].Clear();
|
cmStat[i].Clear();
|
||||||
nCm[i]=0;
|
nCm[i]=0;
|
||||||
cmPed[i]=0;
|
cmPed[i]=0;
|
||||||
}
|
}};
|
||||||
};
|
|
||||||
|
|
||||||
/** adds the average of pedestals to the moving average and reinitializes
|
/** adds the average of pedestals to the moving average and reinitializes the calculation of the sum of pedestals for all ROIs. - virtual func*/
|
||||||
* the calculation of the sum of pedestals for all ROIs. - virtual func*/
|
|
||||||
virtual void newFrame(){
|
virtual void newFrame(){
|
||||||
for (int i=0; i<nROI; i++) {
|
for (int i=0; i<nROI; i++) {
|
||||||
if (nCm[i] > 0)
|
if (nCm[i]>0) cmStat[i].Calc(cmPed[i]/nCm[i]);
|
||||||
cmStat[i].Calc(cmPed[i] / nCm[i]);
|
|
||||||
nCm[i]=0;
|
nCm[i]=0;
|
||||||
cmPed[i]=0;
|
cmPed[i]=0;
|
||||||
}
|
}};
|
||||||
};
|
|
||||||
|
|
||||||
/** adds the pixel to the sum of pedestals -- virtual func must be
|
/** adds the pixel to the sum of pedestals -- virtual func must be overloaded to define the regions of interest
|
||||||
overloaded to define the regions of interest \param val value to add
|
\param val value to add
|
||||||
\param ix pixel x coordinate
|
\param ix pixel x coordinate
|
||||||
\param iy pixel y coordinate
|
\param iy pixel y coordinate
|
||||||
*/
|
*/
|
||||||
virtual void addToCommonMode(double val, int ix=0, int iy=0) {
|
virtual void addToCommonMode(double val, int ix=0, int iy=0) {
|
||||||
(void)ix;
|
(void) ix; (void) iy;
|
||||||
(void)iy;
|
|
||||||
|
|
||||||
//if (isc>=0 && isc<nROI) {
|
//if (isc>=0 && isc<nROI) {
|
||||||
cmPed[0]+=val;
|
cmPed[0]+=val;
|
||||||
nCm[0]++;//}
|
nCm[0]++;//}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** gets the common mode i.e. the difference between the current average sum
|
/** gets the common mode i.e. the difference between the current average sum of pedestals mode and the average pedestal -- virtual func must be overloaded to define the regions of interest
|
||||||
of pedestals mode and the average pedestal -- virtual func must be
|
\param ix pixel x coordinate
|
||||||
overloaded to define the regions of interest \param ix pixel x coordinate
|
|
||||||
\param iy pixel y coordinate
|
\param iy pixel y coordinate
|
||||||
\return the difference between the current average sum of pedestals and
|
\return the difference between the current average sum of pedestals and the average pedestal
|
||||||
the average pedestal
|
|
||||||
*/
|
*/
|
||||||
virtual double getCommonMode(int ix=0, int iy=0) {
|
virtual double getCommonMode(int ix=0, int iy=0) {
|
||||||
(void)ix;
|
(void) ix; (void) iy;
|
||||||
(void)iy;
|
if (nCm[0]>0) return cmPed[0]/nCm[0]-cmStat[0].Mean();
|
||||||
if (nCm[0] > 0)
|
return 0;};
|
||||||
return cmPed[0] / nCm[0] - cmStat[0].Mean();
|
|
||||||
return 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MovingStat *cmStat; /**<array of moving average of the pedestal average per
|
MovingStat *cmStat; /**<array of moving average of the pedestal average per region of interest */
|
||||||
region of interest */
|
double *cmPed; /**< array storing the sum of pedestals per region of interest */
|
||||||
double *
|
double *nCm; /**< array storing the number of pixels currently contributing to the pedestals */
|
||||||
cmPed; /**< array storing the sum of pedestals per region of interest */
|
const int nROI; /**< constant parameter for number of regions on which the common mode should be calculated separately e.g. supercolumns */
|
||||||
double *nCm; /**< array storing the number of pixels currently contributing
|
|
||||||
to the pedestals */
|
|
||||||
const int
|
|
||||||
nROI; /**< constant parameter for number of regions on which the common
|
|
||||||
mode should be calculated separately e.g. supercolumns */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -7,14 +7,13 @@
|
|||||||
|
|
||||||
class commonModeSubtraction {
|
class commonModeSubtraction {
|
||||||
|
|
||||||
/** @short class to calculate the common mode of the pedestals based on an
|
/** @short class to calculate the common mode of the pedestals based on an approximated moving average*/
|
||||||
* approximated moving average*/
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** constructor
|
/** constructor
|
||||||
\param nn number of samples for the moving average to calculate the
|
\param nn number of samples for the moving average to calculate the average common mode
|
||||||
average common mode \param iroi number of regions on which one can
|
\param iroi number of regions on which one can calculate the common mode separately. Defaults to 1 i.e. whole detector
|
||||||
calculate the common mode separately. Defaults to 1 i.e. whole detector
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
commonModeSubtraction(int iroi=1, int ns=3) : nsigma(ns), nROI(iroi) {
|
commonModeSubtraction(int iroi=1, int ns=3) : nsigma(ns), nROI(iroi) {
|
||||||
@ -23,13 +22,8 @@ class commonModeSubtraction {
|
|||||||
nCm=new double[nROI];
|
nCm=new double[nROI];
|
||||||
};
|
};
|
||||||
|
|
||||||
/** destructor - deletes the moving average(s) and the sum of pedestals
|
/** destructor - deletes the moving average(s) and the sum of pedestals calculator(s) */
|
||||||
* calculator(s) */
|
virtual ~commonModeSubtraction() {delete [] mean; delete [] mean2; delete [] nCm;};
|
||||||
virtual ~commonModeSubtraction() {
|
|
||||||
delete[] mean;
|
|
||||||
delete[] mean2;
|
|
||||||
delete[] nCm;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* commonModeSubtraction(commonModeSubtraction *cs) { */
|
/* commonModeSubtraction(commonModeSubtraction *cs) { */
|
||||||
/* if (cs) new commonModeSubtraction(cs->getNRoi(), cs->nsigma); */
|
/* if (cs) new commonModeSubtraction(cs->getNRoi(), cs->nsigma); */
|
||||||
@ -39,18 +33,15 @@ class commonModeSubtraction {
|
|||||||
return new commonModeSubtraction(this->nROI, this->nsigma);
|
return new commonModeSubtraction(this->nROI, this->nsigma);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** clears the moving average and the sum of pedestals calculation - virtual
|
/** clears the moving average and the sum of pedestals calculation - virtual func*/
|
||||||
* func*/
|
|
||||||
virtual void Clear(){
|
virtual void Clear(){
|
||||||
for (int i=0; i<nROI; i++) {
|
for (int i=0; i<nROI; i++) {
|
||||||
mean[i]=0;
|
mean[i]=0;
|
||||||
nCm[i]=0;
|
nCm[i]=0;
|
||||||
mean2[i]=0;
|
mean2[i]=0;
|
||||||
}
|
}};
|
||||||
};
|
|
||||||
|
|
||||||
/** adds the average of pedestals to the moving average and reinitializes
|
/** adds the average of pedestals to the moving average and reinitializes the calculation of the sum of pedestals for all ROIs. - virtual func*/
|
||||||
* the calculation of the sum of pedestals for all ROIs. - virtual func*/
|
|
||||||
virtual void newFrame(){
|
virtual void newFrame(){
|
||||||
//cout << "Reset CM" << endl;
|
//cout << "Reset CM" << endl;
|
||||||
for (int i=0; i<nROI; i++) {
|
for (int i=0; i<nROI; i++) {
|
||||||
@ -58,11 +49,10 @@ class commonModeSubtraction {
|
|||||||
nCm[i]=0;
|
nCm[i]=0;
|
||||||
mean[i]=0;
|
mean[i]=0;
|
||||||
mean2[i]=0;
|
mean2[i]=0;
|
||||||
}
|
}};
|
||||||
};
|
|
||||||
|
|
||||||
/** adds the pixel to the sum of pedestals -- virtual func must be
|
/** adds the pixel to the sum of pedestals -- virtual func must be overloaded to define the regions of interest
|
||||||
overloaded to define the regions of interest \param val value to add
|
\param val value to add
|
||||||
\param ix pixel x coordinate
|
\param ix pixel x coordinate
|
||||||
\param iy pixel y coordinate
|
\param iy pixel y coordinate
|
||||||
*/
|
*/
|
||||||
@ -82,11 +72,10 @@ class commonModeSubtraction {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** gets the common mode i.e. the difference between the current average sum
|
/** gets the common mode i.e. the difference between the current average sum of pedestals mode and the average pedestal
|
||||||
of pedestals mode and the average pedestal \param ix pixel x coordinate
|
\param ix pixel x coordinate
|
||||||
\param iy pixel y coordinate
|
\param iy pixel y coordinate
|
||||||
\return the difference between the current average sum of pedestals and
|
\return the difference between the current average sum of pedestals and the average pedestal
|
||||||
the average pedestal
|
|
||||||
*/
|
*/
|
||||||
virtual double getCommonMode(int ix=0, int iy=0) {
|
virtual double getCommonMode(int ix=0, int iy=0) {
|
||||||
int iroi=getROI(ix,iy);
|
int iroi=getROI(ix,iy);
|
||||||
@ -94,9 +83,8 @@ class commonModeSubtraction {
|
|||||||
/* return 100; */
|
/* return 100; */
|
||||||
/* else */
|
/* else */
|
||||||
/* return -100; */
|
/* return -100; */
|
||||||
// cout << "*" << ix << " " << iy << " " << iroi << " " << mean[iroi] <<
|
// cout << "*" << ix << " " << iy << " " << iroi << " " << mean[iroi] << " " << nCm[iroi]<< endl;
|
||||||
// " " << nCm[iroi]<< endl; if (ix==15 && iy==15) cout << "-" <<
|
// if (ix==15 && iy==15) cout << "-" << mean[iroi]/nCm[iroi] << endl;
|
||||||
// mean[iroi]/nCm[iroi] << endl;
|
|
||||||
if (iroi>=0 && iroi<nROI) {
|
if (iroi>=0 && iroi<nROI) {
|
||||||
if (nCm[iroi]>0)
|
if (nCm[iroi]>0)
|
||||||
return mean[iroi]/nCm[iroi];
|
return mean[iroi]/nCm[iroi];
|
||||||
@ -104,19 +92,16 @@ class commonModeSubtraction {
|
|||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** gets the common mode i.e. the difference between the current average sum
|
/** gets the common mode i.e. the difference between the current average sum of pedestals mode and the average pedestal
|
||||||
of pedestals mode and the average pedestal \param ix pixel x coordinate
|
\param ix pixel x coordinate
|
||||||
\param iy pixel y coordinate
|
\param iy pixel y coordinate
|
||||||
\return the difference between the current average sum of pedestals and
|
\return the difference between the current average sum of pedestals and the average pedestal
|
||||||
the average pedestal
|
|
||||||
*/
|
*/
|
||||||
virtual double getCommonModeRMS(int ix=0, int iy=0) {
|
virtual double getCommonModeRMS(int ix=0, int iy=0) {
|
||||||
int iroi=getROI(ix,iy);
|
int iroi=getROI(ix,iy);
|
||||||
if (iroi>=0 && iroi<nROI) {
|
if (iroi>=0 && iroi<nROI) {
|
||||||
if (nCm[iroi]>0)
|
if (nCm[iroi]>0)
|
||||||
return sqrt(mean2[iroi] / nCm[iroi] -
|
return sqrt(mean2[iroi]/nCm[iroi]-(mean[iroi]/nCm[iroi])*(mean[iroi]/nCm[iroi]));
|
||||||
(mean[iroi] / nCm[iroi]) *
|
|
||||||
(mean[iroi] / nCm[iroi]));
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
@ -124,25 +109,21 @@ class commonModeSubtraction {
|
|||||||
/**
|
/**
|
||||||
gets the common mode ROI for pixel ix, iy -should be overloaded!
|
gets the common mode ROI for pixel ix, iy -should be overloaded!
|
||||||
*/
|
*/
|
||||||
virtual int getROI(int ix, int iy) {
|
virtual int getROI(int ix, int iy){ (void) ix; (void) iy; return 0;};
|
||||||
(void)ix;
|
|
||||||
(void)iy;
|
|
||||||
return 0;
|
|
||||||
};
|
|
||||||
int getNRoi(){return nROI;};
|
int getNRoi(){return nROI;};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
double *mean; /**<array of moving average of the pedestal average per region
|
double *mean; /**<array of moving average of the pedestal average per region of interest */
|
||||||
of interest */
|
double *mean2; /**< array storing the sum of pedestals per region of interest */
|
||||||
double *
|
double *nCm; /**< array storing the number of pixels currently contributing to the pedestals */
|
||||||
mean2; /**< array storing the sum of pedestals per region of interest */
|
int nsigma; /** number of rms above which the pedestal should be considered as a photon */
|
||||||
double *nCm; /**< array storing the number of pixels currently contributing
|
const int nROI; /**< constant parameter for number of regions on which the common mode should be calculated separately e.g. supercolumns */
|
||||||
to the pedestals */
|
|
||||||
int nsigma; /** number of rms above which the pedestal should be considered
|
|
||||||
as a photon */
|
|
||||||
const int
|
|
||||||
nROI; /**< constant parameter for number of regions on which the common
|
|
||||||
mode should be calculated separately e.g. supercolumns */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,26 +3,19 @@
|
|||||||
#ifndef MYTHEN301JCTBDATA_H
|
#ifndef MYTHEN301JCTBDATA_H
|
||||||
#define MYTHEN301JCTBDATA_H
|
#define MYTHEN301JCTBDATA_H
|
||||||
|
|
||||||
|
|
||||||
class mythen3_01_jctbData : public slsDetectorData<short unsigned int> {
|
class mythen3_01_jctbData : public slsDetectorData<short unsigned int> {
|
||||||
|
|
||||||
public:
|
|
||||||
mythen3_01_jctbData(int nch = 64 * 3, int dr = 24, int off = 5)
|
|
||||||
: slsDetectorData<short unsigned int>(64 * 3, 1, dr * 8 * nch, NULL,
|
|
||||||
NULL, NULL),
|
|
||||||
dynamicRange(dr), serialOffset(off), frameNumber(0),
|
|
||||||
numberOfCounters(nch){};
|
|
||||||
|
|
||||||
virtual void getPixel(int ip, int &x, int &y) {
|
public:
|
||||||
x = -1;
|
mythen3_01_jctbData( int nch=64*3,int dr=24, int off=5): slsDetectorData<short unsigned int>(64*3,1,dr*8*nch,NULL,NULL,NULL), dynamicRange(dr), serialOffset(off), frameNumber(0), numberOfCounters(nch) {};
|
||||||
y = -1;
|
|
||||||
};
|
virtual void getPixel(int ip, int &x, int &y) {x=-1; y=-1;};
|
||||||
|
|
||||||
virtual short unsigned int getChannel(char *data, int ix, int iy=0) {
|
virtual short unsigned int getChannel(char *data, int ix, int iy=0) {
|
||||||
int ret=-1;
|
int ret=-1;
|
||||||
short unsigned int *val =
|
short unsigned int *val=mythen03_frame(data,dynamicRange,numberOfCounters,serialOffset);
|
||||||
mythen03_frame(data, dynamicRange, numberOfCounters, serialOffset);
|
if (ix>=0 && ix<numberOfCounters) ret=val[ix];
|
||||||
if (ix >= 0 && ix < numberOfCounters)
|
|
||||||
ret = val[ix];
|
|
||||||
delete [] val;
|
delete [] val;
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
@ -48,10 +41,11 @@ class mythen3_01_jctbData : public slsDetectorData<short unsigned int> {
|
|||||||
val=new short unsigned int*[1];
|
val=new short unsigned int*[1];
|
||||||
val[0]=mythen03_frame(ptr,dynamicRange,nx,serialOffset);
|
val[0]=mythen03_frame(ptr,dynamicRange,nx,serialOffset);
|
||||||
return val;
|
return val;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual short unsigned int *mythen03_frame(char *ptr, int dr = 24,
|
|
||||||
int nch = 64 * 3, int off = 5) {
|
virtual short unsigned int* mythen03_frame(char *ptr, int dr=24, int nch=64*3, int off=5) {
|
||||||
// off=0;
|
// off=0;
|
||||||
//int iarg;
|
//int iarg;
|
||||||
int64_t word, *wp;
|
int64_t word, *wp;
|
||||||
@ -72,8 +66,7 @@ class mythen3_01_jctbData : public slsDetectorData<short unsigned int> {
|
|||||||
wp=(int64_t*)ptr;
|
wp=(int64_t*)ptr;
|
||||||
|
|
||||||
for (iw=0; iw<nch/nb; iw) {
|
for (iw=0; iw<nch/nb; iw) {
|
||||||
word = *wp;
|
word=*wp;;
|
||||||
;
|
|
||||||
if (ioff<off) {
|
if (ioff<off) {
|
||||||
ioff++;
|
ioff++;
|
||||||
cout <<"*";
|
cout <<"*";
|
||||||
@ -92,10 +85,10 @@ class mythen3_01_jctbData : public slsDetectorData<short unsigned int> {
|
|||||||
|
|
||||||
idr++;
|
idr++;
|
||||||
|
|
||||||
|
|
||||||
if (idr==dr) {
|
if (idr==dr) {
|
||||||
idr=0;
|
idr=0;
|
||||||
// cout << dec << " " << iw << " " << val[iw] << " " <<
|
// cout << dec << " " << iw << " " << val[iw] << " " << val[iw+nch/2] << endl;
|
||||||
// val[iw+nch/2] << endl;
|
|
||||||
cout <<dec << iw<<endl;
|
cout <<dec << iw<<endl;
|
||||||
iw++;
|
iw++;
|
||||||
}//end if()
|
}//end if()
|
||||||
@ -111,32 +104,22 @@ class mythen3_01_jctbData : public slsDetectorData<short unsigned int> {
|
|||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int setFrameNumber(int f = 0) {
|
virtual int setFrameNumber(int f=0) {if (f>=0) frameNumber=f; return frameNumber; };
|
||||||
if (f >= 0)
|
virtual int setDynamicRange(int d=-1) {if (d>0 && d<=24) dynamicRange=d; return dynamicRange;};
|
||||||
frameNumber = f;
|
virtual int setSerialOffset(int d=-1) {if (d>=0) serialOffset=d; return serialOffset;};
|
||||||
return frameNumber;
|
virtual int setNumberOfCounters(int d=-1) {if (d>=0) numberOfCounters=d; return numberOfCounters;};
|
||||||
};
|
|
||||||
virtual int setDynamicRange(int d = -1) {
|
|
||||||
if (d > 0 && d <= 24)
|
|
||||||
dynamicRange = d;
|
|
||||||
return dynamicRange;
|
|
||||||
};
|
|
||||||
virtual int setSerialOffset(int d = -1) {
|
|
||||||
if (d >= 0)
|
|
||||||
serialOffset = d;
|
|
||||||
return serialOffset;
|
|
||||||
};
|
|
||||||
virtual int setNumberOfCounters(int d = -1) {
|
|
||||||
if (d >= 0)
|
|
||||||
numberOfCounters = d;
|
|
||||||
return numberOfCounters;
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int dynamicRange;
|
int dynamicRange;
|
||||||
int serialOffset;
|
int serialOffset;
|
||||||
int frameNumber;
|
int frameNumber;
|
||||||
int numberOfCounters;
|
int numberOfCounters;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,24 +3,22 @@
|
|||||||
#ifndef MYTHEN302JCTBDATA_H
|
#ifndef MYTHEN302JCTBDATA_H
|
||||||
#define MYTHEN302JCTBDATA_H
|
#define MYTHEN302JCTBDATA_H
|
||||||
|
|
||||||
|
|
||||||
#include "Mythen3_01_jctbData.h"
|
#include "Mythen3_01_jctbData.h"
|
||||||
//class mythen3_02_jctbData : public slsDetectorData<short unsigned int> {
|
//class mythen3_02_jctbData : public slsDetectorData<short unsigned int> {
|
||||||
class mythen3_02_jctbData : public mythen3_01_jctbData {
|
class mythen3_02_jctbData : public mythen3_01_jctbData {
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
mythen3_02_jctbData(int nch = 64 * 3, int dr = 24, int off = 5)
|
mythen3_02_jctbData( int nch=64*3,int dr=24, int off=5): mythen3_01_jctbData( nch,dr, off)
|
||||||
: mythen3_01_jctbData(nch, dr, off)
|
//slsDetectorData<short unsigned int>(64*3,1,dr*8*nch,NULL,NULL,NULL), dynamicRange(dr), serialOffset(off), frameNumber(0), numberOfCounters(nch)
|
||||||
// slsDetectorData<short unsigned
|
|
||||||
// int>(64*3,1,dr*8*nch,NULL,NULL,NULL), dynamicRange(dr),
|
|
||||||
// serialOffset(off), frameNumber(0), numberOfCounters(nch)
|
|
||||||
{};
|
{};
|
||||||
|
|
||||||
/* virtual void getPixel(int ip, int &x, int &y) {x=-1; y=-1;}; */
|
/* virtual void getPixel(int ip, int &x, int &y) {x=-1; y=-1;}; */
|
||||||
|
|
||||||
/* virtual short unsigned int getChannel(char *data, int ix, int iy=0) { */
|
/* virtual short unsigned int getChannel(char *data, int ix, int iy=0) { */
|
||||||
/* int ret=-1; */
|
/* int ret=-1; */
|
||||||
/* short unsigned int
|
/* short unsigned int *val=mythen03_frame(data,dynamicRange,numberOfCounters,serialOffset); */
|
||||||
* *val=mythen03_frame(data,dynamicRange,numberOfCounters,serialOffset); */
|
|
||||||
/* if (ix>=0 && ix<numberOfCounters) ret=val[ix]; */
|
/* if (ix>=0 && ix<numberOfCounters) ret=val[ix]; */
|
||||||
/* delete [] val; */
|
/* delete [] val; */
|
||||||
/* return ret; */
|
/* return ret; */
|
||||||
@ -50,8 +48,8 @@ class mythen3_02_jctbData : public mythen3_01_jctbData {
|
|||||||
|
|
||||||
/* } */
|
/* } */
|
||||||
|
|
||||||
virtual short unsigned int *mythen03_frame(char *ptr, int dr = 24,
|
|
||||||
int nch = 64 * 3, int off = 5) {
|
virtual short unsigned int* mythen03_frame(char *ptr, int dr=24, int nch=64*3, int off=5) {
|
||||||
// off=0;
|
// off=0;
|
||||||
//int iarg;
|
//int iarg;
|
||||||
int64_t word, *wp;
|
int64_t word, *wp;
|
||||||
@ -94,10 +92,10 @@ class mythen3_02_jctbData : public mythen3_01_jctbData {
|
|||||||
|
|
||||||
idr++;
|
idr++;
|
||||||
|
|
||||||
|
|
||||||
if (idr==dr) {
|
if (idr==dr) {
|
||||||
idr=0;
|
idr=0;
|
||||||
// cout << dec << " " << iw << " " << val[iw] << " " <<
|
// cout << dec << " " << iw << " " << val[iw] << " " << val[iw+nch/2] << endl;
|
||||||
// val[iw+nch/2] << endl;
|
|
||||||
cout <<dec << iw<<endl;
|
cout <<dec << iw<<endl;
|
||||||
iw++;
|
iw++;
|
||||||
}//end if()
|
}//end if()
|
||||||
@ -113,14 +111,11 @@ class mythen3_02_jctbData : public mythen3_01_jctbData {
|
|||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* virtual int setFrameNumber(int f=0) {if (f>=0) frameNumber=f; return
|
/* virtual int setFrameNumber(int f=0) {if (f>=0) frameNumber=f; return frameNumber; }; */
|
||||||
* frameNumber; }; */
|
/* virtual int setDynamicRange(int d=-1) {if (d>0 && d<=24) dynamicRange=d; return dynamicRange;}; */
|
||||||
/* virtual int setDynamicRange(int d=-1) {if (d>0 && d<=24) dynamicRange=d;
|
/* virtual int setSerialOffset(int d=-1) {if (d>=0) serialOffset=d; return serialOffset;}; */
|
||||||
* return dynamicRange;}; */
|
/* virtual int setNumberOfCounters(int d=-1) {if (d>=0) numberOfCounters=d; return numberOfCounters;}; */
|
||||||
/* virtual int setSerialOffset(int d=-1) {if (d>=0) serialOffset=d; return
|
|
||||||
* serialOffset;}; */
|
|
||||||
/* virtual int setNumberOfCounters(int d=-1) {if (d>=0) numberOfCounters=d;
|
|
||||||
* return numberOfCounters;}; */
|
|
||||||
|
|
||||||
/* private: */
|
/* private: */
|
||||||
|
|
||||||
@ -128,6 +123,10 @@ class mythen3_02_jctbData : public mythen3_01_jctbData {
|
|||||||
/* int serialOffset; */
|
/* int serialOffset; */
|
||||||
/* int frameNumber; */
|
/* int frameNumber; */
|
||||||
/* int numberOfCounters; */
|
/* int numberOfCounters; */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,17 +3,14 @@
|
|||||||
#ifndef ADCSAR2_JCTBDATA_H
|
#ifndef ADCSAR2_JCTBDATA_H
|
||||||
#define ADCSAR2_JCTBDATA_H
|
#define ADCSAR2_JCTBDATA_H
|
||||||
|
|
||||||
|
|
||||||
class adcSar2_jctbData : public slsDetectorData<short unsigned int> {
|
class adcSar2_jctbData : public slsDetectorData<short unsigned int> {
|
||||||
|
|
||||||
public:
|
|
||||||
adcSar2_jctbData(int nsamples = 1000)
|
|
||||||
: slsDetectorData<short unsigned int>(nsamples, 1, nsamples * 8, NULL,
|
|
||||||
NULL, NULL){};
|
|
||||||
|
|
||||||
virtual void getPixel(int ip, int &x, int &y) {
|
public:
|
||||||
x = ip / 8;
|
adcSar2_jctbData(int nsamples=1000): slsDetectorData<short unsigned int>(nsamples,1,nsamples*8,NULL,NULL,NULL){};
|
||||||
y = 1;
|
|
||||||
};
|
virtual void getPixel(int ip, int &x, int &y) {x=ip/8; y=1;};
|
||||||
|
|
||||||
virtual short unsigned int getChannel(char *data, int ix, int iy=0) {
|
virtual short unsigned int getChannel(char *data, int ix, int iy=0) {
|
||||||
int adcvalue=0;
|
int adcvalue=0;
|
||||||
@ -52,14 +49,17 @@ class adcSar2_jctbData : public slsDetectorData<short unsigned int> {
|
|||||||
|
|
||||||
/* } */
|
/* } */
|
||||||
|
|
||||||
virtual int setFrameNumber(int f = 0) {
|
|
||||||
if (f >= 0)
|
|
||||||
frameNumber = f;
|
virtual int setFrameNumber(int f=0) {if (f>=0) frameNumber=f; return frameNumber; };
|
||||||
return frameNumber;
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int frameNumber;
|
int frameNumber;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -7,66 +7,53 @@
|
|||||||
|
|
||||||
class chiptestBoardData : public slsDetectorData<uint16_t> {
|
class chiptestBoardData : public slsDetectorData<uint16_t> {
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
chiptestBoard data structure. Works for data acquired using the
|
chiptestBoard data structure. Works for data acquired using the chiptestBoard.
|
||||||
chiptestBoard. Inherits and implements slsDetectorData.
|
Inherits and implements slsDetectorData.
|
||||||
|
|
||||||
Constructor (no error checking if datasize and offsets are compatible!)
|
Constructor (no error checking if datasize and offsets are compatible!)
|
||||||
\param npx number of pixels in the x direction
|
\param npx number of pixels in the x direction
|
||||||
\param npy number of pixels in the y direction (1 for strips)
|
\param npy number of pixels in the y direction (1 for strips)
|
||||||
\param nadc number of adcs
|
\param nadc number of adcs
|
||||||
\param offset offset at the beginning of the pattern
|
\param offset offset at the beginning of the pattern
|
||||||
\param dMap array of size nx*ny storing the pointers to the data in the
|
\param dMap array of size nx*ny storing the pointers to the data in the dataset (as offset)
|
||||||
dataset (as offset) \param dMask Array of size nx*ny storing the polarity of
|
\param dMask Array of size nx*ny storing the polarity of the data in the dataset (should be 0 if no inversion is required, 0xffffffff is inversion is required)
|
||||||
the data in the dataset (should be 0 if no inversion is required, 0xffffffff
|
\param dROI Array of size nx*ny. The elements are 1s if the channel is good or in the ROI, 0 is bad or out of the ROI. NULL (default) means all 1s.
|
||||||
is inversion is required) \param dROI Array of size nx*ny. The elements are
|
|
||||||
1s if the channel is good or in the ROI, 0 is bad or out of the ROI. NULL
|
|
||||||
(default) means all 1s.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
chiptestBoardData(int npx, int npy, int nadc, int offset, int **dMap = NULL,
|
chiptestBoardData(int npx, int npy, int nadc, int offset, int **dMap=NULL, uint16_t **dMask=NULL, int **dROI=NULL): slsDetectorData<uint16_t>(npx, npy, nadc*(npx*npy)+offset, dMap, dMask, dROI), nAdc(nadc), offSize(offset), iframe(0) {}; // should be? nadc*(npx*npy+offset)
|
||||||
uint16_t **dMask = NULL, int **dROI = NULL)
|
|
||||||
: slsDetectorData<uint16_t>(npx, npy, nadc * (npx * npy) + offset, dMap,
|
|
||||||
dMask, dROI),
|
|
||||||
nAdc(nadc), offSize(offset),
|
|
||||||
iframe(0){}; // should be? nadc*(npx*npy+offset)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Returns the frame number for the given dataset. Virtual func: works for
|
Returns the frame number for the given dataset. Virtual func: works for slsDetectorReceiver data (also for each packet), but can be overloaded.
|
||||||
slsDetectorReceiver data (also for each packet), but can be overloaded.
|
|
||||||
\param buff pointer to the dataset
|
\param buff pointer to the dataset
|
||||||
\returns frame number
|
\returns frame number
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
virtual int getFrameNumber(char *buff) {
|
virtual int getFrameNumber(char *buff){(void)buff; return iframe;};
|
||||||
(void)buff;
|
|
||||||
return iframe;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Loops over a memory slot until a complete frame is found (i.e. all packets
|
Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors!
|
||||||
0 to nPackets, same frame number). Can be overloaded for different kind of
|
\param data pointer to the memory to be analyzed
|
||||||
detectors! \param data pointer to the memory to be analyzed \param ndata
|
\param ndata size of frame returned
|
||||||
size of frame returned \param dsize size of the memory slot to be analyzed
|
\param dsize size of the memory slot to be analyzed
|
||||||
\returns always return the pointer to data (no frame loss!)
|
\returns always return the pointer to data (no frame loss!)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
virtual char *findNextFrame(char *data, int &ndata, int dsize) {
|
virtual char *findNextFrame(char *data, int &ndata, int dsize) {ndata=dsize;setDataSize(dsize); return data;};
|
||||||
ndata = dsize;
|
|
||||||
setDataSize(dsize);
|
|
||||||
return data;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Loops over a file stream until a complete frame is found (i.e. all packets
|
Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors!
|
||||||
0 to nPackets, same frame number). Can be overloaded for different kind of
|
\param filebin input file stream (binary)
|
||||||
detectors! \param filebin input file stream (binary) \returns pointer to
|
\returns pointer to the first packet of the last good frame, NULL if no frame is found or last frame is incomplete
|
||||||
the first packet of the last good frame, NULL if no frame is found or last
|
|
||||||
frame is incomplete
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream &filebin) {
|
virtual char *readNextFrame(ifstream &filebin) {
|
||||||
@ -78,8 +65,7 @@ class chiptestBoardData : public slsDetectorData<uint16_t> {
|
|||||||
if (filebin.read((char*)&afifo_length,sizeof(uint32_t))) {
|
if (filebin.read((char*)&afifo_length,sizeof(uint32_t))) {
|
||||||
setDataSize(afifo_length*nAdc*sizeof(uint16_t));
|
setDataSize(afifo_length*nAdc*sizeof(uint16_t));
|
||||||
afifo_cont=new uint16_t[afifo_length*nAdc];
|
afifo_cont=new uint16_t[afifo_length*nAdc];
|
||||||
if (filebin.read((char *)afifo_cont,
|
if (filebin.read((char*)afifo_cont,afifo_length*sizeof(uint16_t)*nAdc)) {
|
||||||
afifo_length * sizeof(uint16_t) * nAdc)) {
|
|
||||||
iframe++;
|
iframe++;
|
||||||
return (char*)afifo_cont;
|
return (char*)afifo_cont;
|
||||||
} else {
|
} else {
|
||||||
@ -95,9 +81,11 @@ class chiptestBoardData : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
const int nAdc; /**<number of ADC read out */
|
const int nAdc; /**<number of ADC read out */
|
||||||
const int offSize; /**< offset at the beginning of the frame (depends on the
|
const int offSize; /**< offset at the beginning of the frame (depends on the pattern) */
|
||||||
pattern) */
|
|
||||||
int iframe; /**< frame number (calculated in software! not in the data)*/
|
int iframe; /**< frame number (calculated in software! not in the data)*/
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,34 +2,25 @@
|
|||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
#ifndef DESERIALIZER_H
|
#ifndef DESERIALIZER_H
|
||||||
#define DESERIALIZER_H
|
#define DESERIALIZER_H
|
||||||
#include "slsDetectorData.h"
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include "slsDetectorData.h"
|
||||||
|
|
||||||
class deserializer : public slsDetectorData<int> {
|
class deserializer : public slsDetectorData<int> {
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
deserializer(std::vector<int> dbl, int nch = 64 * 3, int dr = 24,
|
|
||||||
int off = 2)
|
|
||||||
: slsDetectorData<int>(nch, 1, nch * dr * 8 + off * 8, NULL, NULL,
|
|
||||||
NULL),
|
|
||||||
dynamicRange(dr), serialOffset(off), frameNumber(0),
|
|
||||||
numberOfCounters(nch), dbitlist(dbl){};
|
|
||||||
|
|
||||||
deserializer(std::vector<int> dbl, int nch, int dr, int off, int ds)
|
|
||||||
: slsDetectorData<int>(nch, 1, ds, NULL, NULL, NULL), dynamicRange(dr),
|
|
||||||
serialOffset(off), frameNumber(0), numberOfCounters(nch),
|
|
||||||
dbitlist(dbl){};
|
|
||||||
|
|
||||||
virtual void getPixel(int ip, int &x, int &y) {
|
deserializer( std::vector <int> dbl, int nch=64*3,int dr=24, int off=2): slsDetectorData<int>(nch,1,nch*dr*8+off*8,NULL,NULL,NULL), dynamicRange(dr), serialOffset(off), frameNumber(0), numberOfCounters(nch), dbitlist(dbl) {};
|
||||||
x = -1;
|
|
||||||
y = -1;
|
deserializer( std::vector <int> dbl, int nch,int dr, int off, int ds): slsDetectorData<int>(nch,1,ds,NULL,NULL,NULL), dynamicRange(dr), serialOffset(off), frameNumber(0), numberOfCounters(nch), dbitlist(dbl) {};
|
||||||
};
|
|
||||||
|
virtual void getPixel(int ip, int &x, int &y) {x=-1; y=-1;};
|
||||||
|
|
||||||
virtual int getChannel(char *data, int ix, int iy=0) {
|
virtual int getChannel(char *data, int ix, int iy=0) {
|
||||||
int ret=-1;
|
int ret=-1;
|
||||||
if (ix>=0 && ix<numberOfCounters) {
|
if (ix>=0 && ix<numberOfCounters) {
|
||||||
int *val = deserializeAll(data, dbitlist, dynamicRange,
|
int *val=deserializeAll(data,dbitlist,dynamicRange,numberOfCounters,serialOffset);
|
||||||
numberOfCounters, serialOffset);
|
|
||||||
ret=val[ix];
|
ret=val[ix];
|
||||||
delete [] val;
|
delete [] val;
|
||||||
}
|
}
|
||||||
@ -57,13 +48,15 @@ class deserializer : public slsDetectorData<int> {
|
|||||||
val=new int*[1];
|
val=new int*[1];
|
||||||
val[0]=deserializeAll(ptr,dbitlist,dynamicRange,nx,serialOffset);
|
val[0]=deserializeAll(ptr,dbitlist,dynamicRange,nx,serialOffset);
|
||||||
return val;
|
return val;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int *deserializeAll(char *ptr, std::vector<int> dbl, int dr = 24,
|
|
||||||
int nch = 64 * 3, int off = 5) {
|
static int* deserializeAll(char *ptr, std::vector <int> dbl, int dr=24, int nch=64*3, int off=5) {
|
||||||
// off=0;
|
// off=0;
|
||||||
//int iarg;
|
//int iarg;
|
||||||
|
|
||||||
|
|
||||||
cout <<"** deserializer: " << endl;
|
cout <<"** deserializer: " << endl;
|
||||||
cout << "** Number of chans:\t" << nch << endl;
|
cout << "** Number of chans:\t" << nch << endl;
|
||||||
cout << "** Serial Offset:\t" << off << endl;
|
cout << "** Serial Offset:\t" << off << endl;
|
||||||
@ -98,8 +91,7 @@ class deserializer : public slsDetectorData<int> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (iw=0; iw<nw; iw) {
|
for (iw=0; iw<nw; iw) {
|
||||||
word = *wp;
|
word=*wp;;
|
||||||
;
|
|
||||||
if (ioff<off) {
|
if (ioff<off) {
|
||||||
ioff++;
|
ioff++;
|
||||||
// cout <<"*";
|
// cout <<"*";
|
||||||
@ -111,8 +103,7 @@ class deserializer : public slsDetectorData<int> {
|
|||||||
// for (const auto &bit : dbl) {
|
// for (const auto &bit : dbl) {
|
||||||
ich=iw+nch*ib/nb;
|
ich=iw+nch*ib/nb;
|
||||||
/* if (ich>1060) */
|
/* if (ich>1060) */
|
||||||
/* cout << iw << " " << idr << " " << ib << " " << bit << "
|
/* cout << iw << " " << idr << " " << ib << " " << bit << " " << ich << " " << val[ich] << " ** " ; */
|
||||||
* " << ich << " " << val[ich] << " ** " ; */
|
|
||||||
bit=dbl[ib];
|
bit=dbl[ib];
|
||||||
ww=one<<bit;
|
ww=one<<bit;
|
||||||
if (word&(ww) && ich<nch) {
|
if (word&(ww) && ich<nch) {
|
||||||
@ -120,8 +111,7 @@ class deserializer : public slsDetectorData<int> {
|
|||||||
val[ich]|=(1<<idr);
|
val[ich]|=(1<<idr);
|
||||||
}
|
}
|
||||||
/* if (ich>1060) */
|
/* if (ich>1060) */
|
||||||
/* cout << val[ich] << " " << hex << word << " " << ww <<
|
/* cout << val[ich] << " " << hex << word << " " << ww << " " << (word&(ww)) << dec <<endl; */
|
||||||
* " " << (word&(ww)) << dec <<endl; */
|
|
||||||
/* //else { */
|
/* //else { */
|
||||||
//cout << "-" ;
|
//cout << "-" ;
|
||||||
//}
|
//}
|
||||||
@ -133,8 +123,7 @@ class deserializer : public slsDetectorData<int> {
|
|||||||
|
|
||||||
if (idr==dr) {
|
if (idr==dr) {
|
||||||
idr=0;
|
idr=0;
|
||||||
// cout << dec << " " << iw << " " << val[iw] << " " <<
|
// cout << dec << " " << iw << " " << val[iw] << " " << val[iw+nch/2] << endl;
|
||||||
// val[iw+nch/2] << endl;
|
|
||||||
// cout <<dec << iw<<endl;
|
// cout <<dec << iw<<endl;
|
||||||
iw++;
|
iw++;
|
||||||
}//end if()
|
}//end if()
|
||||||
@ -144,11 +133,11 @@ class deserializer : public slsDetectorData<int> {
|
|||||||
// ii++;
|
// ii++;
|
||||||
}//end for
|
}//end for
|
||||||
|
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int *deserializeList(char *ptr, std::vector<int> dbl, int dr = 24,
|
static int* deserializeList(char *ptr, std::vector <int> dbl, int dr=24, int nch=64*3, int off=5) {
|
||||||
int nch = 64 * 3, int off = 5) {
|
|
||||||
// off=0;
|
// off=0;
|
||||||
//int iarg;
|
//int iarg;
|
||||||
// int64_t word;
|
// int64_t word;
|
||||||
@ -175,8 +164,7 @@ class deserializer : public slsDetectorData<int> {
|
|||||||
// for (const auto &bit : dbl) {
|
// for (const auto &bit : dbl) {
|
||||||
|
|
||||||
/* if (ich>1060) */
|
/* if (ich>1060) */
|
||||||
/* cout << iw << " " << idr << " " << ib << " " << bit << " " << ich
|
/* cout << iw << " " << idr << " " << ib << " " << bit << " " << ich << " " << val[ich] << " ** " ; */
|
||||||
* << " " << val[ich] << " ** " ; */
|
|
||||||
bit=dbl[ib];
|
bit=dbl[ib];
|
||||||
//ioff=off;
|
//ioff=off;
|
||||||
idr=0;
|
idr=0;
|
||||||
@ -193,41 +181,28 @@ class deserializer : public slsDetectorData<int> {
|
|||||||
// ib++;
|
// ib++;
|
||||||
}//end for
|
}//end for
|
||||||
|
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int setFrameNumber(int f = 0) {
|
virtual int setFrameNumber(int f=0) {if (f>=0) frameNumber=f; return frameNumber; };
|
||||||
if (f >= 0)
|
virtual int setDynamicRange(int d=-1) {if (d>0 && d<=24) dynamicRange=d; return dynamicRange;};
|
||||||
frameNumber = f;
|
virtual int setSerialOffset(int d=-1) {if (d>=0) serialOffset=d; return serialOffset;};
|
||||||
return frameNumber;
|
virtual int setNumberOfCounters(int d=-1) {if (d>=0) numberOfCounters=d; return numberOfCounters;};
|
||||||
};
|
virtual std::vector <int> setDBitList(std::vector <int> dbl) {dbitlist=dbl; return dbitlist;};
|
||||||
virtual int setDynamicRange(int d = -1) {
|
|
||||||
if (d > 0 && d <= 24)
|
|
||||||
dynamicRange = d;
|
|
||||||
return dynamicRange;
|
|
||||||
};
|
|
||||||
virtual int setSerialOffset(int d = -1) {
|
|
||||||
if (d >= 0)
|
|
||||||
serialOffset = d;
|
|
||||||
return serialOffset;
|
|
||||||
};
|
|
||||||
virtual int setNumberOfCounters(int d = -1) {
|
|
||||||
if (d >= 0)
|
|
||||||
numberOfCounters = d;
|
|
||||||
return numberOfCounters;
|
|
||||||
};
|
|
||||||
virtual std::vector<int> setDBitList(std::vector<int> dbl) {
|
|
||||||
dbitlist = dbl;
|
|
||||||
return dbitlist;
|
|
||||||
};
|
|
||||||
virtual std::vector <int> getDBitList() {return dbitlist;};
|
virtual std::vector <int> getDBitList() {return dbitlist;};
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int dynamicRange;
|
int dynamicRange;
|
||||||
int serialOffset;
|
int serialOffset;
|
||||||
int frameNumber;
|
int frameNumber;
|
||||||
int numberOfCounters;
|
int numberOfCounters;
|
||||||
std::vector <int> dbitlist;
|
std::vector <int> dbitlist;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,6 +4,13 @@
|
|||||||
#define GOTTHARD2MODULEDATANEW_H
|
#define GOTTHARD2MODULEDATANEW_H
|
||||||
#include "gotthardModuleDataNew.h"
|
#include "gotthardModuleDataNew.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class gotthardDoubleModuleDataNew : public slsDetectorData<uint16_t> {
|
class gotthardDoubleModuleDataNew : public slsDetectorData<uint16_t> {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -11,22 +18,29 @@ class gotthardDoubleModuleDataNew : public slsDetectorData<uint16_t> {
|
|||||||
const int offset;
|
const int offset;
|
||||||
int iframe;
|
int iframe;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Implements the slsReceiverData structure for the gotthard read out by a module
|
Implements the slsReceiverData structure for the gotthard read out by a module i.e. using the slsReceiver
|
||||||
i.e. using the slsReceiver (1x1280 pixels, 2 packets 1286 large etc.) \param c
|
(1x1280 pixels, 2 packets 1286 large etc.)
|
||||||
crosstalk parameter for the output buffer
|
\param c crosstalk parameter for the output buffer
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gotthardDoubleModuleDataNew(int off = 24 * 2, int nmod = 2)
|
|
||||||
: slsDetectorData<uint16_t>(1280 * nmod, 1, nmod * (1280 * 2 + off)),
|
gotthardDoubleModuleDataNew(int off=24*2, int nmod=2): slsDetectorData<uint16_t>(1280*nmod, 1, nmod*(1280*2+off)), nModules(nmod), offset(off),iframe(0) {
|
||||||
nModules(nmod), offset(off), iframe(0) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef BCHIP074_BCHIP075
|
#ifdef BCHIP074_BCHIP075
|
||||||
cout << "This is a bchip074-bchip075 system " << endl;
|
cout << "This is a bchip074-bchip075 system " << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
uint16_t **dMask;
|
uint16_t **dMask;
|
||||||
int **dMap;
|
int **dMap;
|
||||||
int ix, iy;
|
int ix, iy;
|
||||||
@ -47,23 +61,22 @@ class gotthardDoubleModuleDataNew : public slsDetectorData<uint16_t> {
|
|||||||
if (imod==0)
|
if (imod==0)
|
||||||
dMap[0][ix] =ipix*2+offset;
|
dMap[0][ix] =ipix*2+offset;
|
||||||
else
|
else
|
||||||
dMap[0][ix] = 1280 * 2 + 2 * offset +
|
dMap[0][ix] = 1280*2+2*offset+ipix*2;//dataSize-2-ix;//+2*offset;
|
||||||
ipix * 2; // dataSize-2-ix;//+2*offset;
|
|
||||||
// dMap[0][ix] = 2*ipix+offset*(imod+1)+1280*2*imod;
|
// dMap[0][ix] = 2*ipix+offset*(imod+1)+1280*2*imod;
|
||||||
dMask[0][ix] = 0x0;
|
dMask[0][ix] = 0x0;
|
||||||
#ifdef BCHIP074_BCHIP075
|
#ifdef BCHIP074_BCHIP075
|
||||||
int ibad=ix/2+1280*imod;
|
int ibad=ix/2+1280*imod;
|
||||||
if ((ibad >= 128 * 4 && ibad < 128 * 5) ||
|
if ((ibad>=128*4 && ibad<128*5) || (ibad>=9*128 && ibad<10*128) || (ibad>=(1280+128*4) && ibad<ibad>=(1280+128*6)))
|
||||||
(ibad >= 9 * 128 && ibad < 10 * 128) ||
|
|
||||||
(ibad >= (1280 + 128 * 4) && ibad < ibad >= (1280 + 128 * 6)))
|
|
||||||
dataROIMask[0][ix]=0;
|
dataROIMask[0][ix]=0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
setDataMap(dMap);
|
setDataMap(dMap);
|
||||||
setDataMask(dMask);
|
setDataMask(dMask);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Returns the frame number for the given dataset.
|
Returns the frame number for the given dataset.
|
||||||
@ -72,41 +85,37 @@ class gotthardDoubleModuleDataNew : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int getFrameNumber(char *buff) {
|
|
||||||
if (offset >= sizeof(sls_detector_header))
|
int getFrameNumber(char *buff){if (offset>=sizeof(sls_detector_header)) return ((sls_detector_header*)buff)->frameNumber; return iframe;};//*((int*)(buff+5))&0xffffff;};
|
||||||
return ((sls_detector_header *)buff)->frameNumber;
|
|
||||||
return iframe;
|
|
||||||
}; //*((int*)(buff+5))&0xffffff;};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
gets the packets number (last packet is labelled with 0 and is replaced with
|
gets the packets number (last packet is labelled with 0 and is replaced with 40)
|
||||||
40) \param buff pointer to the memory \returns packet number
|
\param buff pointer to the memory
|
||||||
|
\returns packet number
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int getPacketNumber(char *buff) {
|
int getPacketNumber(char *buff){if (offset>=sizeof(sls_detector_header))return ((sls_detector_header*)buff)->packetNumber;};
|
||||||
if (offset >= sizeof(sls_detector_header))
|
|
||||||
return ((sls_detector_header *)buff)->packetNumber;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Loops over a memory slot until a complete frame is found (i.e. all
|
Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func
|
||||||
packets 0 to nPackets, same frame number). purely virtual func \param
|
\param data pointer to the memory to be analyzed
|
||||||
data pointer to the memory to be analyzed \param ndata reference to the
|
\param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot
|
||||||
amount of data found for the frame, in case the frame is incomplete at
|
\param dsize size of the memory slot to be analyzed
|
||||||
the end of the memory slot \param dsize size of the memory slot to be
|
\returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
||||||
analyzed \returns pointer to the beginning of the last good frame (might
|
|
||||||
be incomplete if ndata smaller than dataSize), or NULL if no frame is
|
|
||||||
found
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
||||||
if (dsize < dataSize)
|
if (dsize<dataSize) ndata=dsize;
|
||||||
ndata = dsize;
|
else ndata=dataSize;
|
||||||
else
|
|
||||||
ndata = dataSize;
|
|
||||||
return data;
|
return data;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream &filebin) {
|
virtual char *readNextFrame(ifstream &filebin) {
|
||||||
@ -122,15 +131,14 @@ class gotthardDoubleModuleDataNew : public slsDetectorData<uint16_t> {
|
|||||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
||||||
char *data=new char[dataSize];
|
char *data=new char[dataSize];
|
||||||
char *d=readNextFrame(filebin, ff, np, data);
|
char *d=readNextFrame(filebin, ff, np, data);
|
||||||
if (d == NULL) {
|
if (d==NULL) {delete [] data; data=NULL;}
|
||||||
delete[] data;
|
|
||||||
data = NULL;
|
|
||||||
}
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream &filebin, int &ff, int &np,
|
|
||||||
char *data) {
|
|
||||||
|
|
||||||
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
||||||
char *retval=0;
|
char *retval=0;
|
||||||
int nd;
|
int nd;
|
||||||
int fnum = -1;
|
int fnum = -1;
|
||||||
@ -149,7 +157,18 @@ class gotthardDoubleModuleDataNew : public slsDetectorData<uint16_t> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,18 +4,26 @@
|
|||||||
#define GOTTHARDSHORTMODULEDATA_H
|
#define GOTTHARDSHORTMODULEDATA_H
|
||||||
#include "slsReceiverData.h"
|
#include "slsReceiverData.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class gotthardShortModuleData : public slsReceiverData<uint16_t> {
|
class gotthardShortModuleData : public slsReceiverData<uint16_t> {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Implements the slsReceiverData structure for the gotthard short read out by a
|
Implements the slsReceiverData structure for the gotthard short read out by a module i.e. using the slsReceiver
|
||||||
module i.e. using the slsReceiver (1x256 pixels, 1 packet 256 large etc.)
|
(1x256 pixels, 1 packet 256 large etc.)
|
||||||
\param c crosstalk parameter for the output buffer
|
\param c crosstalk parameter for the output buffer
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gotthardShortModuleData(double c = 0)
|
|
||||||
: slsReceiverData<uint16_t>(xpixels, ypixels, npackets, buffersize),
|
gotthardShortModuleData(double c=0): slsReceiverData<uint16_t>(xpixels, ypixels, npackets, buffersize), xtalk(c){
|
||||||
xtalk(c) {
|
|
||||||
|
|
||||||
uint16_t **dMask;
|
uint16_t **dMask;
|
||||||
int **dMap;
|
int **dMap;
|
||||||
@ -43,6 +51,7 @@ class gotthardShortModuleData : public slsReceiverData<uint16_t> {
|
|||||||
setDataMask(dMask);
|
setDataMask(dMask);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Returns the frame number for the given dataset.
|
Returns the frame number for the given dataset.
|
||||||
@ -51,15 +60,23 @@ class gotthardShortModuleData : public slsReceiverData<uint16_t> {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int getFrameNumber(char *buff) { return (*(int *)buff); };
|
int getFrameNumber(char *buff){
|
||||||
|
return (*(int*)buff);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
gets the packets number (last packet is labelled with 0 and is replaced with
|
gets the packets number (last packet is labelled with 0 and is replaced with 40)
|
||||||
40) \param buff pointer to the memory \returns packet number
|
\param buff pointer to the memory
|
||||||
|
\returns packet number
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int getPacketNumber(char *buff) { return 1; };
|
int getPacketNumber(char *buff){
|
||||||
|
return 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
returns the pixel value as double correcting for the output buffer crosstalk
|
returns the pixel value as double correcting for the output buffer crosstalk
|
||||||
@ -74,27 +91,32 @@ returns the pixel value as double correcting for the output buffer crosstalk
|
|||||||
if (xtalk==0)
|
if (xtalk==0)
|
||||||
return slsDetectorData<uint16_t>::getValue(data, ix, iy);
|
return slsDetectorData<uint16_t>::getValue(data, ix, iy);
|
||||||
else
|
else
|
||||||
return slsDetectorData<uint16_t>::getValue(data, ix, iy) -
|
return slsDetectorData<uint16_t>::getValue(data, ix, iy)-xtalk*slsDetectorData<uint16_t>::getValue(data, ix-1, iy);
|
||||||
xtalk *
|
|
||||||
slsDetectorData<uint16_t>::getValue(data, ix - 1, iy);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** sets the output buffer crosstalk correction parameter
|
/** sets the output buffer crosstalk correction parameter
|
||||||
\param c output buffer crosstalk correction parameter to be set
|
\param c output buffer crosstalk correction parameter to be set
|
||||||
\returns current value for the output buffer crosstalk correction parameter
|
\returns current value for the output buffer crosstalk correction parameter
|
||||||
|
|
||||||
*/
|
*/
|
||||||
double setXTalk(double c) {
|
double setXTalk(double c) {xtalk=c; return xtalk;}
|
||||||
xtalk = c;
|
|
||||||
return xtalk;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** gets the output buffer crosstalk parameter
|
/** gets the output buffer crosstalk parameter
|
||||||
\returns current value for the output buffer crosstalk correction parameter
|
\returns current value for the output buffer crosstalk correction parameter
|
||||||
*/
|
*/
|
||||||
double getXTalk() {return xtalk;}
|
double getXTalk() {return xtalk;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
double xtalk; /**<output buffer crosstalk correction parameter */
|
double xtalk; /**<output buffer crosstalk correction parameter */
|
||||||
const static int xpixels = 256;
|
const static int xpixels = 256;
|
||||||
const static int ypixels = 1;
|
const static int ypixels = 1;
|
||||||
@ -102,4 +124,6 @@ returns the pixel value as double correcting for the output buffer crosstalk
|
|||||||
const static int buffersize = 518;
|
const static int buffersize = 518;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,21 +4,25 @@
|
|||||||
#define IMAGEZMQ16BIT_H
|
#define IMAGEZMQ16BIT_H
|
||||||
#include "slsDetectorData.h"
|
#include "slsDetectorData.h"
|
||||||
|
|
||||||
|
|
||||||
class imageZmq16bit : public slsDetectorData<uint16_t> {
|
class imageZmq16bit : public slsDetectorData<uint16_t> {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// int iframe;
|
// int iframe;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Implements the slsReceiverData structure for the moench02 prototype read
|
Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver
|
||||||
out by a module i.e. using the slsReceiver (160x160 pixels, 40 packets
|
(160x160 pixels, 40 packets 1286 large etc.)
|
||||||
1286 large etc.) \param c crosstalk parameter for the output buffer
|
\param c crosstalk parameter for the output buffer
|
||||||
|
|
||||||
*/
|
*/
|
||||||
// moench03T1ZmqDataNew(int ns=5000): slsDetectorData<uint16_t>(400, 400,
|
// moench03T1ZmqDataNew(int ns=5000): slsDetectorData<uint16_t>(400, 400, ns*32*2+sizeof(int)), nSamples(ns), offset(sizeof(int)), xtalk(0.00021) {
|
||||||
// ns*32*2+sizeof(int)), nSamples(ns), offset(sizeof(int)), xtalk(0.00021) {
|
imageZmq16bit(int nnx=400, int nny=400): slsDetectorData<uint16_t>(nnx, nny, 2*nnx*nny) {
|
||||||
imageZmq16bit(int nnx = 400, int nny = 400)
|
|
||||||
: slsDetectorData<uint16_t>(nnx, nny, 2 * nnx * nny) {
|
|
||||||
cout << "* " << nx << " " << ny << endl;
|
cout << "* " << nx << " " << ny << endl;
|
||||||
int is=0;
|
int is=0;
|
||||||
for (int row=0; row<ny; row++){
|
for (int row=0; row<ny; row++){
|
||||||
@ -27,23 +31,22 @@ class imageZmq16bit : public slsDetectorData<uint16_t> {
|
|||||||
is++;
|
is++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual double getValue(char *data, int ix, int iy=0) {
|
virtual double getValue(char *data, int ix, int iy=0) {
|
||||||
|
|
||||||
cout << ix << " " << ix << dataMap[iy][ix] << 2 * nx * ny << " "
|
cout << ix << " " << ix << dataMap[iy][ix] << 2*nx*ny << " "<< endl;
|
||||||
<< endl;
|
|
||||||
uint16_t val=getChannel(data, ix, iy)&0x3fff;
|
uint16_t val=getChannel(data, ix, iy)&0x3fff;
|
||||||
return val;
|
return val;
|
||||||
};
|
};
|
||||||
|
|
||||||
int getFrameNumber(char *buff) {
|
|
||||||
return *((int *)buff);
|
|
||||||
}; //*((int*)(buff+5))&0xffffff;};
|
|
||||||
|
|
||||||
int getPacketNumber(char *buff) {
|
int getFrameNumber(char *buff){return *((int*)buff);};//*((int*)(buff+5))&0xffffff;};
|
||||||
return 0;
|
|
||||||
} //((*(((int*)(buff+4))))&0xff)+1;};
|
|
||||||
|
int getPacketNumber(char *buff){return 0;}//((*(((int*)(buff+4))))&0xff)+1;};
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream &filebin) {
|
virtual char *readNextFrame(ifstream &filebin) {
|
||||||
int ff=-1, np=-1;
|
int ff=-1, np=-1;
|
||||||
@ -58,21 +61,21 @@ class imageZmq16bit : public slsDetectorData<uint16_t> {
|
|||||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
||||||
char *data=new char[2*nx*ny];
|
char *data=new char[2*nx*ny];
|
||||||
char *d=readNextFrame(filebin, ff, np, data);
|
char *d=readNextFrame(filebin, ff, np, data);
|
||||||
if (d == NULL) {
|
if (d==NULL) {delete [] data; data=NULL;}
|
||||||
delete[] data;
|
|
||||||
data = NULL;
|
|
||||||
}
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream &filebin, int &ff, int &np,
|
|
||||||
char *data) {
|
|
||||||
|
|
||||||
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
||||||
//char *retval=0;
|
//char *retval=0;
|
||||||
// int nd;
|
// int nd;
|
||||||
//int fnum = -1;
|
//int fnum = -1;
|
||||||
np=0;
|
np=0;
|
||||||
// int pn;
|
// int pn;
|
||||||
|
|
||||||
|
|
||||||
// if (ff>=0)
|
// if (ff>=0)
|
||||||
// fnum=ff;
|
// fnum=ff;
|
||||||
|
|
||||||
@ -84,19 +87,41 @@ class imageZmq16bit : public slsDetectorData<uint16_t> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
||||||
if (dsize < 2 * nx * ny)
|
if (dsize<2*nx*ny) ndata=dsize;
|
||||||
ndata = dsize;
|
else ndata=2*nx*ny;
|
||||||
else
|
|
||||||
ndata = 2 * nx * ny;
|
|
||||||
return data;
|
return data;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// virtual int setFrameNumber(int ff){iframe=ff};
|
// virtual int setFrameNumber(int ff){iframe=ff};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int getPacketNumber(int x, int y) {return 0;};
|
int getPacketNumber(int x, int y) {return 0;};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,21 +4,25 @@
|
|||||||
#define IMAGEZMQ32BIT_H
|
#define IMAGEZMQ32BIT_H
|
||||||
#include "slsDetectorData.h"
|
#include "slsDetectorData.h"
|
||||||
|
|
||||||
|
|
||||||
class imageZmq32bit : public slsDetectorData<uint16_t> {
|
class imageZmq32bit : public slsDetectorData<uint16_t> {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// int iframe;
|
// int iframe;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Implements the slsReceiverData structure for the moench02 prototype read
|
Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver
|
||||||
out by a module i.e. using the slsReceiver (160x160 pixels, 40 packets
|
(160x160 pixels, 40 packets 1286 large etc.)
|
||||||
1286 large etc.) \param c crosstalk parameter for the output buffer
|
\param c crosstalk parameter for the output buffer
|
||||||
|
|
||||||
*/
|
*/
|
||||||
// moench03T1ZmqDataNew(int ns=5000): slsDetectorData<uint16_t>(400, 400,
|
// moench03T1ZmqDataNew(int ns=5000): slsDetectorData<uint16_t>(400, 400, ns*32*2+sizeof(int)), nSamples(ns), offset(sizeof(int)), xtalk(0.00021) {
|
||||||
// ns*32*2+sizeof(int)), nSamples(ns), offset(sizeof(int)), xtalk(0.00021) {
|
imageZmq32bit(int nnx=400, int nny=400): slsDetectorData<uint16_t>(nnx, nny, sizeof(uint32_t)*nnx*nny) {
|
||||||
imageZmq32bit(int nnx = 400, int nny = 400)
|
|
||||||
: slsDetectorData<uint16_t>(nnx, nny, sizeof(uint32_t) * nnx * nny) {
|
|
||||||
cout << "* " << nx << " " << ny << endl;
|
cout << "* " << nx << " " << ny << endl;
|
||||||
int is=0;
|
int is=0;
|
||||||
for (int row=0; row<ny; row++){
|
for (int row=0; row<ny; row++){
|
||||||
@ -27,23 +31,22 @@ class imageZmq32bit : public slsDetectorData<uint16_t> {
|
|||||||
is++;
|
is++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* virtual double getValue(char *data, int ix, int iy=0) { */
|
/* virtual double getValue(char *data, int ix, int iy=0) { */
|
||||||
|
|
||||||
/* //cout << ix << " " << ix << dataMap[iy][ix] << 2*nx*ny << " "<< endl;
|
/* //cout << ix << " " << ix << dataMap[iy][ix] << 2*nx*ny << " "<< endl; */
|
||||||
*/
|
|
||||||
/* uint16_t val=getChannel(data, ix, iy); */
|
/* uint16_t val=getChannel(data, ix, iy); */
|
||||||
/* return val; */
|
/* return val; */
|
||||||
/* }; */
|
/* }; */
|
||||||
|
|
||||||
int getFrameNumber(char *buff) {
|
|
||||||
return *((int *)buff);
|
|
||||||
}; //*((int*)(buff+5))&0xffffff;};
|
|
||||||
|
|
||||||
int getPacketNumber(char *buff) {
|
int getFrameNumber(char *buff){return *((int*)buff);};//*((int*)(buff+5))&0xffffff;};
|
||||||
return 0;
|
|
||||||
} //((*(((int*)(buff+4))))&0xff)+1;};
|
|
||||||
|
int getPacketNumber(char *buff){return 0;}//((*(((int*)(buff+4))))&0xff)+1;};
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream &filebin) {
|
virtual char *readNextFrame(ifstream &filebin) {
|
||||||
int ff=-1, np=-1;
|
int ff=-1, np=-1;
|
||||||
@ -58,21 +61,21 @@ class imageZmq32bit : public slsDetectorData<uint16_t> {
|
|||||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
||||||
char *data=new char[2*nx*ny];
|
char *data=new char[2*nx*ny];
|
||||||
char *d=readNextFrame(filebin, ff, np, data);
|
char *d=readNextFrame(filebin, ff, np, data);
|
||||||
if (d == NULL) {
|
if (d==NULL) {delete [] data; data=NULL;}
|
||||||
delete[] data;
|
|
||||||
data = NULL;
|
|
||||||
}
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream &filebin, int &ff, int &np,
|
|
||||||
char *data) {
|
|
||||||
|
|
||||||
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
||||||
//char *retval=0;
|
//char *retval=0;
|
||||||
// int nd;
|
// int nd;
|
||||||
//int fnum = -1;
|
//int fnum = -1;
|
||||||
np=0;
|
np=0;
|
||||||
// int pn;
|
// int pn;
|
||||||
|
|
||||||
|
|
||||||
// if (ff>=0)
|
// if (ff>=0)
|
||||||
// fnum=ff;
|
// fnum=ff;
|
||||||
|
|
||||||
@ -84,19 +87,41 @@ class imageZmq32bit : public slsDetectorData<uint16_t> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
||||||
if (dsize < 2 * nx * ny)
|
if (dsize<2*nx*ny) ndata=dsize;
|
||||||
ndata = dsize;
|
else ndata=2*nx*ny;
|
||||||
else
|
|
||||||
ndata = 2 * nx * ny;
|
|
||||||
return data;
|
return data;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// virtual int setFrameNumber(int ff){iframe=ff};
|
// virtual int setFrameNumber(int ff){iframe=ff};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int getPacketNumber(int x, int y) {return 0;};
|
int getPacketNumber(int x, int y) {return 0;};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -8,8 +8,7 @@
|
|||||||
/**
|
/**
|
||||||
@short structure for a Detector Packet or Image Header
|
@short structure for a Detector Packet or Image Header
|
||||||
@li frameNumber is the frame number
|
@li frameNumber is the frame number
|
||||||
@li expLength is the subframe number (32 bit eiger) or real time exposure
|
@li expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
|
||||||
time in 100ns (others)
|
|
||||||
@li packetNumber is the packet number
|
@li packetNumber is the packet number
|
||||||
@li bunchId is the bunch id from beamline
|
@li bunchId is the bunch id from beamline
|
||||||
@li timestamp is the time stamp with 10 MHz clock
|
@li timestamp is the time stamp with 10 MHz clock
|
||||||
@ -28,21 +27,23 @@ typedef struct {
|
|||||||
|
|
||||||
} jf_header;
|
} jf_header;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class jungfrauHighZSingleChipData : public slsDetectorData<uint16_t> {
|
class jungfrauHighZSingleChipData : public slsDetectorData<uint16_t> {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int iframe;
|
|
||||||
|
|
||||||
|
int iframe;
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
Implements the slsReceiverData structure for the moench02 prototype read
|
Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver
|
||||||
out by a module i.e. using the slsReceiver (160x160 pixels, 40 packets
|
(160x160 pixels, 40 packets 1286 large etc.)
|
||||||
1286 large etc.) \param c crosstalk parameter for the output buffer
|
\param c crosstalk parameter for the output buffer
|
||||||
|
|
||||||
*/
|
*/
|
||||||
jungfrauHighZSingleChipData()
|
jungfrauHighZSingleChipData(): slsDetectorData<uint16_t>(256, 256, 256*256*2+sizeof(jf_header)) {
|
||||||
: slsDetectorData<uint16_t>(256, 256,
|
|
||||||
256 * 256 * 2 + sizeof(jf_header)) {
|
|
||||||
|
|
||||||
for (int ix=0; ix<256; ix++) {
|
for (int ix=0; ix<256; ix++) {
|
||||||
for (int iy=0; iy<256; iy++) {
|
for (int iy=0; iy<256; iy++) {
|
||||||
@ -57,12 +58,14 @@ class jungfrauHighZSingleChipData : public slsDetectorData<uint16_t> {
|
|||||||
// cout << "data struct created" << endl;
|
// cout << "data struct created" << endl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the value of the selected channel for the given dataset as
|
Returns the value of the selected channel for the given dataset as double.
|
||||||
double. \param data pointer to the dataset (including headers etc) \param
|
\param data pointer to the dataset (including headers etc)
|
||||||
ix pixel number in the x direction \param iy pixel number in the y
|
\param ix pixel number in the x direction
|
||||||
direction \returns data for the selected channel, with inversion if
|
\param iy pixel number in the y direction
|
||||||
required as double
|
\returns data for the selected channel, with inversion if required as double
|
||||||
|
|
||||||
*/
|
*/
|
||||||
virtual double getValue(char *data, int ix, int iy=0) {
|
virtual double getValue(char *data, int ix, int iy=0) {
|
||||||
@ -71,12 +74,16 @@ class jungfrauHighZSingleChipData : public slsDetectorData<uint16_t> {
|
|||||||
return val;
|
return val;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* virtual void calcGhost(char *data, int ix, int iy) { */
|
/* virtual void calcGhost(char *data, int ix, int iy) { */
|
||||||
/* double val=0; */
|
/* double val=0; */
|
||||||
/* ghost[iy][ix]=0; */
|
/* ghost[iy][ix]=0; */
|
||||||
|
|
||||||
/* } */
|
/* } */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* virtual void calcGhost(char *data) { */
|
/* virtual void calcGhost(char *data) { */
|
||||||
/* for (int ix=0; ix<25; ix++){ */
|
/* for (int ix=0; ix<25; ix++){ */
|
||||||
/* for (int iy=0; iy<200; iy++) { */
|
/* for (int iy=0; iy<200; iy++) { */
|
||||||
@ -86,6 +93,7 @@ class jungfrauHighZSingleChipData : public slsDetectorData<uint16_t> {
|
|||||||
/* // cout << "*" << endl; */
|
/* // cout << "*" << endl; */
|
||||||
/* } */
|
/* } */
|
||||||
|
|
||||||
|
|
||||||
/* double getGhost(int ix, int iy) { */
|
/* double getGhost(int ix, int iy) { */
|
||||||
/* return 0; */
|
/* return 0; */
|
||||||
/* }; */
|
/* }; */
|
||||||
@ -106,9 +114,9 @@ class jungfrauHighZSingleChipData : public slsDetectorData<uint16_t> {
|
|||||||
/* unsigned char bunchid[8]; */
|
/* unsigned char bunchid[8]; */
|
||||||
/* }; */
|
/* }; */
|
||||||
|
|
||||||
int getFrameNumber(char *buff) {
|
|
||||||
return ((jf_header *)buff)->bunchNumber;
|
|
||||||
}; //*((int*)(buff+5))&0xffffff;};
|
int getFrameNumber(char *buff){return ((jf_header*)buff)->bunchNumber;};//*((int*)(buff+5))&0xffffff;};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@ -119,34 +127,25 @@ class jungfrauHighZSingleChipData : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
int getPacketNumber(char *buff) {
|
int getPacketNumber(char *buff){return 0;}//((*(((int*)(buff+4))))&0xff)+1;};
|
||||||
return 0;
|
|
||||||
} //((*(((int*)(buff+4))))&0xff)+1;};
|
|
||||||
|
|
||||||
/* /\** */
|
/* /\** */
|
||||||
|
|
||||||
/* Loops over a memory slot until a complete frame is found (i.e. all
|
/* Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func */
|
||||||
* packets 0 to nPackets, same frame number). purely virtual func */
|
|
||||||
/* \param data pointer to the memory to be analyzed */
|
/* \param data pointer to the memory to be analyzed */
|
||||||
/* \param ndata reference to the amount of data found for the frame, in
|
/* \param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot */
|
||||||
* case the frame is incomplete at the end of the memory slot */
|
|
||||||
/* \param dsize size of the memory slot to be analyzed */
|
/* \param dsize size of the memory slot to be analyzed */
|
||||||
/* \returns pointer to the beginning of the last good frame (might be
|
/* \returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found */
|
||||||
* incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
/* virtual char *findNextFrame(char *data, int &ndata, int
|
/* virtual char *findNextFrame(char *data, int &ndata, int dsize){ndata=dsize; setDataSize(dsize); return data;}; */
|
||||||
* dsize){ndata=dsize; setDataSize(dsize); return data;}; */
|
|
||||||
|
|
||||||
/* /\** */
|
/* /\** */
|
||||||
|
|
||||||
/* Loops over a file stream until a complete frame is found (i.e. all
|
/* Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors! */
|
||||||
* packets 0 to nPackets, same frame number). Can be overloaded for
|
|
||||||
* different kind of detectors! */
|
|
||||||
/* \param filebin input file stream (binary) */
|
/* \param filebin input file stream (binary) */
|
||||||
/* \returns pointer to the begin of the last good frame, NULL if no
|
/* \returns pointer to the begin of the last good frame, NULL if no frame is found or last frame is incomplete */
|
||||||
* frame is found or last frame is incomplete */
|
|
||||||
|
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
/* virtual char *readNextFrame(ifstream &filebin){ */
|
/* virtual char *readNextFrame(ifstream &filebin){ */
|
||||||
@ -171,6 +170,7 @@ class jungfrauHighZSingleChipData : public slsDetectorData<uint16_t> {
|
|||||||
/* return NULL; */
|
/* return NULL; */
|
||||||
/* }; */
|
/* }; */
|
||||||
|
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream &filebin) {
|
virtual char *readNextFrame(ifstream &filebin) {
|
||||||
int ff=-1, np=-1;
|
int ff=-1, np=-1;
|
||||||
return readNextFrame(filebin, ff, np);
|
return readNextFrame(filebin, ff, np);
|
||||||
@ -184,15 +184,14 @@ class jungfrauHighZSingleChipData : public slsDetectorData<uint16_t> {
|
|||||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
||||||
char *data=new char[dataSize];
|
char *data=new char[dataSize];
|
||||||
char *d=readNextFrame(filebin, ff, np, data);
|
char *d=readNextFrame(filebin, ff, np, data);
|
||||||
if (d == NULL) {
|
if (d==NULL) {delete [] data; data=NULL;}
|
||||||
delete[] data;
|
|
||||||
data = NULL;
|
|
||||||
}
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream &filebin, int &ff, int &np,
|
|
||||||
char *data) {
|
|
||||||
|
|
||||||
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
||||||
char *retval=0;
|
char *retval=0;
|
||||||
int nd;
|
int nd;
|
||||||
int fnum = -1;
|
int fnum = -1;
|
||||||
@ -213,27 +212,29 @@ class jungfrauHighZSingleChipData : public slsDetectorData<uint16_t> {
|
|||||||
return NULL;
|
return NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Loops over a memory slot until a complete frame is found (i.e. all
|
Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func
|
||||||
packets 0 to nPackets, same frame number). purely virtual func \param
|
\param data pointer to the memory to be analyzed
|
||||||
data pointer to the memory to be analyzed \param ndata reference to the
|
\param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot
|
||||||
amount of data found for the frame, in case the frame is incomplete at
|
\param dsize size of the memory slot to be analyzed
|
||||||
the end of the memory slot \param dsize size of the memory slot to be
|
\returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
||||||
analyzed \returns pointer to the beginning of the last good frame (might
|
|
||||||
be incomplete if ndata smaller than dataSize), or NULL if no frame is
|
|
||||||
found
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
||||||
if (dsize < dataSize)
|
if (dsize<dataSize) ndata=dsize;
|
||||||
ndata = dsize;
|
else ndata=dataSize;
|
||||||
else
|
|
||||||
ndata = dataSize;
|
|
||||||
return data;
|
return data;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
//int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,9 +4,12 @@
|
|||||||
#define MOENCH02CTBDATA_H
|
#define MOENCH02CTBDATA_H
|
||||||
#include "slsDetectorData.h"
|
#include "slsDetectorData.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class moench02CtbData : public slsDetectorData<uint16_t> {
|
class moench02CtbData : public slsDetectorData<uint16_t> {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int iframe;
|
int iframe;
|
||||||
// int *xmap, *ymap;
|
// int *xmap, *ymap;
|
||||||
int nadc;
|
int nadc;
|
||||||
@ -15,17 +18,23 @@ class moench02CtbData : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
int maplength;
|
int maplength;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Implements the slsReceiverData structure for the moench02 prototype read
|
Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver
|
||||||
out by a module i.e. using the slsReceiver (160x160 pixels, 40 packets
|
(160x160 pixels, 40 packets 1286 large etc.)
|
||||||
1286 large etc.) \param c crosstalk parameter for the output buffer
|
\param c crosstalk parameter for the output buffer
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
moench02CtbData(int ns = 6400)
|
|
||||||
: slsDetectorData<uint16_t>(160, 160, ns * 2 * 32, NULL, NULL),
|
moench02CtbData(int ns=6400): slsDetectorData<uint16_t>(160, 160, ns*2*32, NULL, NULL) , nadc(32), sc_width(40), sc_height(160) {
|
||||||
nadc(32), sc_width(40), sc_height(160) {
|
|
||||||
|
|
||||||
int adc_off[4]={40,0,120,80};
|
int adc_off[4]={40,0,120,80};
|
||||||
int adc_nr[4]={8,10,20,22};
|
int adc_nr[4]={8,10,20,22};
|
||||||
@ -47,9 +56,9 @@ class moench02CtbData : public slsDetectorData<uint16_t> {
|
|||||||
row=i/sc_width;
|
row=i/sc_width;
|
||||||
dataMap[row][col]=(32*i+iadc)*2;
|
dataMap[row][col]=(32*i+iadc)*2;
|
||||||
if (dataMap[row][col]<0 || dataMap[row][col]>=dataSize) {
|
if (dataMap[row][col]<0 || dataMap[row][col]>=dataSize) {
|
||||||
cout << "Error: pointer " << dataMap[row][col]
|
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
|
||||||
<< " out of range " << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,8 +68,7 @@ class moench02CtbData : public slsDetectorData<uint16_t> {
|
|||||||
iiadc=i%32;
|
iiadc=i%32;
|
||||||
iadc=-1;
|
iadc=-1;
|
||||||
for (int iii=0; iii<4; iii++) {
|
for (int iii=0; iii<4; iii++) {
|
||||||
if (iiadc == adc_nr[iii])
|
if (iiadc==adc_nr[iii]) iadc=iii;
|
||||||
iadc = iii;
|
|
||||||
}
|
}
|
||||||
ix=isample%sc_width;
|
ix=isample%sc_width;
|
||||||
iy=isample/sc_width;
|
iy=isample/sc_width;
|
||||||
@ -84,8 +92,10 @@ class moench02CtbData : public slsDetectorData<uint16_t> {
|
|||||||
cerr<<"WRONG ARRAY LENGTH"<<endl;
|
cerr<<"WRONG ARRAY LENGTH"<<endl;
|
||||||
cerr<<"Trying to access the "<<ip<<"-th element"<<endl;
|
cerr<<"Trying to access the "<<ip<<"-th element"<<endl;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Returns the frame number for the given dataset. Purely virtual func.
|
Returns the frame number for the given dataset. Purely virtual func.
|
||||||
@ -94,10 +104,8 @@ class moench02CtbData : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
virtual int getFrameNumber(char *buff) {
|
|
||||||
(void)buff;
|
virtual int getFrameNumber(char *buff){(void)buff; return iframe;};
|
||||||
return iframe;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@ -112,28 +120,21 @@ class moench02CtbData : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Loops over a memory slot until a complete frame is found (i.e. all packets
|
Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func
|
||||||
0 to nPackets, same frame number). purely virtual func \param data pointer
|
\param data pointer to the memory to be analyzed
|
||||||
to the memory to be analyzed \param ndata reference to the amount of data
|
\param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot
|
||||||
found for the frame, in case the frame is incomplete at the end of the
|
\param dsize size of the memory slot to be analyzed
|
||||||
memory slot \param dsize size of the memory slot to be analyzed \returns
|
\returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
||||||
pointer to the beginning of the last good frame (might be incomplete if
|
|
||||||
ndata smaller than dataSize), or NULL if no frame is found
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
virtual char *findNextFrame(char *data, int &ndata, int dsize) {
|
virtual char *findNextFrame(char *data, int &ndata, int dsize){ndata=dsize; setDataSize(dsize); return data;};
|
||||||
ndata = dsize;
|
|
||||||
setDataSize(dsize);
|
|
||||||
return data;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Loops over a file stream until a complete frame is found (i.e. all packets
|
Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors!
|
||||||
0 to nPackets, same frame number). Can be overloaded for different kind of
|
\param filebin input file stream (binary)
|
||||||
detectors! \param filebin input file stream (binary) \returns pointer to
|
\returns pointer to the begin of the last good frame, NULL if no frame is found or last frame is incomplete
|
||||||
the begin of the last good frame, NULL if no frame is found or last frame
|
|
||||||
is incomplete
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
virtual char *readNextFrame(ifstream &filebin){
|
virtual char *readNextFrame(ifstream &filebin){
|
||||||
@ -144,8 +145,7 @@ class moench02CtbData : public slsDetectorData<uint16_t> {
|
|||||||
afifo_cont=new uint16_t[dataSize/2];
|
afifo_cont=new uint16_t[dataSize/2];
|
||||||
while (filebin.read(((char*)afifo_cont)+ib,2)) {
|
while (filebin.read(((char*)afifo_cont)+ib,2)) {
|
||||||
ib+=2;
|
ib+=2;
|
||||||
if (ib == dataSize)
|
if (ib==dataSize) break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (ib>0) {
|
if (ib>0) {
|
||||||
iframe++;
|
iframe++;
|
||||||
@ -160,6 +160,12 @@ class moench02CtbData : public slsDetectorData<uint16_t> {
|
|||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,25 +4,31 @@
|
|||||||
#define MOENCH03CTBDATA_H
|
#define MOENCH03CTBDATA_H
|
||||||
#include "slsDetectorData.h"
|
#include "slsDetectorData.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class moench03CtbData : public slsDetectorData<uint16_t> {
|
class moench03CtbData : public slsDetectorData<uint16_t> {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int iframe;
|
int iframe;
|
||||||
int nadc;
|
int nadc;
|
||||||
int sc_width;
|
int sc_width;
|
||||||
int sc_height;
|
int sc_height;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Implements the slsReceiverData structure for the moench02 prototype read
|
Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver
|
||||||
out by a module i.e. using the slsReceiver (160x160 pixels, 40 packets
|
(160x160 pixels, 40 packets 1286 large etc.)
|
||||||
1286 large etc.) \param c crosstalk parameter for the output buffer
|
\param c crosstalk parameter for the output buffer
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
moench03CtbData(int ns = 5000)
|
|
||||||
: slsDetectorData<uint16_t>(400, 400, ns * 2 * 32, NULL, NULL),
|
moench03CtbData(int ns=5000): slsDetectorData<uint16_t>(400, 400, ns*2*32, NULL, NULL) , nadc(32), sc_width(25), sc_height(200) {
|
||||||
nadc(32), sc_width(25), sc_height(200) {
|
|
||||||
|
|
||||||
int row, col;
|
int row, col;
|
||||||
|
|
||||||
@ -30,15 +36,17 @@ class moench03CtbData : public slsDetectorData<uint16_t> {
|
|||||||
int iadc;
|
int iadc;
|
||||||
int ix, iy;
|
int ix, iy;
|
||||||
|
|
||||||
int adc_nr[32] = {200, 225, 250, 275, 300, 325, 350, 375, 0, 25, 50,
|
int adc_nr[32]={200,225,250,275,300,325,350,375,\
|
||||||
75, 100, 125, 150, 175, 175, 150, 125, 100, 75, 50,
|
0,25,50,75,100,125,150,175,\
|
||||||
25, 0, 375, 350, 325, 300, 275, 250, 225, 200};
|
175,150,125,100,75,50,25,0,\
|
||||||
|
375,350,325,300,275,250,225,200};
|
||||||
|
|
||||||
/* int adc_nr[32]={300,325,350,375,300,325,350,375, \ */
|
/* int adc_nr[32]={300,325,350,375,300,325,350,375, \ */
|
||||||
/* 200,225,250,275,200,225,250,275,\ */
|
/* 200,225,250,275,200,225,250,275,\ */
|
||||||
/* 100,125,150,175,100,125,150,175,\ */
|
/* 100,125,150,175,100,125,150,175,\ */
|
||||||
/* 0,25,50,75,0,25,50,75}; */
|
/* 0,25,50,75,0,25,50,75}; */
|
||||||
|
|
||||||
|
|
||||||
for (iadc=0; iadc<nadc; iadc++) {
|
for (iadc=0; iadc<nadc; iadc++) {
|
||||||
for (int i=0; i<sc_width*sc_height; i++) {
|
for (int i=0; i<sc_width*sc_height; i++) {
|
||||||
col=adc_nr[iadc]+(i%sc_width);
|
col=adc_nr[iadc]+(i%sc_width);
|
||||||
@ -49,8 +57,8 @@ class moench03CtbData : public slsDetectorData<uint16_t> {
|
|||||||
}
|
}
|
||||||
dataMap[row][col]=(nadc*i+iadc)*2;
|
dataMap[row][col]=(nadc*i+iadc)*2;
|
||||||
if (dataMap[row][col]<0 || dataMap[row][col]>=2*400*400)
|
if (dataMap[row][col]<0 || dataMap[row][col]>=2*400*400)
|
||||||
cout << "Error: pointer " << dataMap[row][col]
|
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
|
||||||
<< " out of range " << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i=0; i<nx*ny; i++) {
|
for (int i=0; i<nx*ny; i++) {
|
||||||
@ -65,12 +73,19 @@ class moench03CtbData : public slsDetectorData<uint16_t> {
|
|||||||
xmap[i]=adc_nr[iadc]+ix;
|
xmap[i]=adc_nr[iadc]+ix;
|
||||||
ymap[i]=ny/2+iy;
|
ymap[i]=ny/2+iy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
iframe=0;
|
iframe=0;
|
||||||
// cout << "data struct created" << endl;
|
// cout << "data struct created" << endl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Returns the frame number for the given dataset. Purely virtual func.
|
Returns the frame number for the given dataset. Purely virtual func.
|
||||||
@ -79,10 +94,8 @@ class moench03CtbData : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
virtual int getFrameNumber(char *buff) {
|
|
||||||
(void)buff;
|
virtual int getFrameNumber(char *buff){(void)buff; return iframe;};
|
||||||
return iframe;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@ -97,28 +110,21 @@ class moench03CtbData : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Loops over a memory slot until a complete frame is found (i.e. all packets
|
Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func
|
||||||
0 to nPackets, same frame number). purely virtual func \param data pointer
|
\param data pointer to the memory to be analyzed
|
||||||
to the memory to be analyzed \param ndata reference to the amount of data
|
\param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot
|
||||||
found for the frame, in case the frame is incomplete at the end of the
|
\param dsize size of the memory slot to be analyzed
|
||||||
memory slot \param dsize size of the memory slot to be analyzed \returns
|
\returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
||||||
pointer to the beginning of the last good frame (might be incomplete if
|
|
||||||
ndata smaller than dataSize), or NULL if no frame is found
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
virtual char *findNextFrame(char *data, int &ndata, int dsize) {
|
virtual char *findNextFrame(char *data, int &ndata, int dsize){ndata=dsize; setDataSize(dsize); return data;};
|
||||||
ndata = dsize;
|
|
||||||
setDataSize(dsize);
|
|
||||||
return data;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Loops over a file stream until a complete frame is found (i.e. all packets
|
Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors!
|
||||||
0 to nPackets, same frame number). Can be overloaded for different kind of
|
\param filebin input file stream (binary)
|
||||||
detectors! \param filebin input file stream (binary) \returns pointer to
|
\returns pointer to the begin of the last good frame, NULL if no frame is found or last frame is incomplete
|
||||||
the begin of the last good frame, NULL if no frame is found or last frame
|
|
||||||
is incomplete
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
virtual char *readNextFrame(ifstream &filebin){
|
virtual char *readNextFrame(ifstream &filebin){
|
||||||
@ -129,8 +135,7 @@ class moench03CtbData : public slsDetectorData<uint16_t> {
|
|||||||
afifo_cont=new uint16_t[dataSize/2];
|
afifo_cont=new uint16_t[dataSize/2];
|
||||||
while (filebin.read(((char*)afifo_cont)+ib,2)) {
|
while (filebin.read(((char*)afifo_cont)+ib,2)) {
|
||||||
ib+=2;
|
ib+=2;
|
||||||
if (ib == dataSize)
|
if (ib==dataSize) break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (ib>0) {
|
if (ib>0) {
|
||||||
iframe++;
|
iframe++;
|
||||||
@ -143,6 +148,12 @@ class moench03CtbData : public slsDetectorData<uint16_t> {
|
|||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,29 +4,36 @@
|
|||||||
#define MOENCH03T1CTBDATA_H
|
#define MOENCH03T1CTBDATA_H
|
||||||
#include "slsDetectorData.h"
|
#include "slsDetectorData.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class moench03T1CtbData : public slsDetectorData<uint16_t> {
|
class moench03T1CtbData : public slsDetectorData<uint16_t> {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int iframe;
|
int iframe;
|
||||||
int nadc;
|
int nadc;
|
||||||
int sc_width;
|
int sc_width;
|
||||||
int sc_height;
|
int sc_height;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Implements the slsReceiverData structure for the moench02 prototype read
|
Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver
|
||||||
out by a module i.e. using the slsReceiver (160x160 pixels, 40 packets
|
(160x160 pixels, 40 packets 1286 large etc.)
|
||||||
1286 large etc.) \param c crosstalk parameter for the output buffer
|
\param c crosstalk parameter for the output buffer
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
moench03T1CtbData(int ns = 5000)
|
|
||||||
: slsDetectorData<uint16_t>(400, 400, ns * 2 * 32, NULL, NULL),
|
|
||||||
nadc(32), sc_width(25), sc_height(200) {
|
|
||||||
|
|
||||||
int adc_nr[32] = {300, 325, 350, 375, 300, 325, 350, 375, 200, 225, 250,
|
moench03T1CtbData(int ns=5000): slsDetectorData<uint16_t>(400, 400, ns*2*32, NULL, NULL) , nadc(32), sc_width(25), sc_height(200) {
|
||||||
275, 200, 225, 250, 275, 100, 125, 150, 175, 100, 125,
|
|
||||||
150, 175, 0, 25, 50, 75, 0, 25, 50, 75};
|
|
||||||
|
int adc_nr[32]={300,325,350,375,300,325,350,375, \
|
||||||
|
200,225,250,275,200,225,250,275,\
|
||||||
|
100,125,150,175,100,125,150,175,\
|
||||||
|
0,25,50,75,0,25,50,75};
|
||||||
|
|
||||||
int row, col;
|
int row, col;
|
||||||
|
|
||||||
@ -34,6 +41,10 @@ class moench03T1CtbData : public slsDetectorData<uint16_t> {
|
|||||||
int iadc;
|
int iadc;
|
||||||
int ix, iy;
|
int ix, iy;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (iadc=0; iadc<nadc; iadc++) {
|
for (iadc=0; iadc<nadc; iadc++) {
|
||||||
for (int i=0; i<sc_width*sc_height; i++) {
|
for (int i=0; i<sc_width*sc_height; i++) {
|
||||||
col=adc_nr[iadc]+(i%sc_width);
|
col=adc_nr[iadc]+(i%sc_width);
|
||||||
@ -44,8 +55,8 @@ class moench03T1CtbData : public slsDetectorData<uint16_t> {
|
|||||||
}
|
}
|
||||||
dataMap[row][col]=(nadc*i+iadc)*2;
|
dataMap[row][col]=(nadc*i+iadc)*2;
|
||||||
if (dataMap[row][col]<0 || dataMap[row][col]>=2*400*400)
|
if (dataMap[row][col]<0 || dataMap[row][col]>=2*400*400)
|
||||||
cout << "Error: pointer " << dataMap[row][col]
|
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
|
||||||
<< " out of range " << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int adc4;
|
int adc4;
|
||||||
@ -63,12 +74,19 @@ class moench03T1CtbData : public slsDetectorData<uint16_t> {
|
|||||||
xmap[i]=adc_nr[iadc]+ix;
|
xmap[i]=adc_nr[iadc]+ix;
|
||||||
ymap[i]=ny/2+iy;
|
ymap[i]=ny/2+iy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
iframe=0;
|
iframe=0;
|
||||||
// cout << "data struct created" << endl;
|
// cout << "data struct created" << endl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Returns the frame number for the given dataset. Purely virtual func.
|
Returns the frame number for the given dataset. Purely virtual func.
|
||||||
@ -77,10 +95,8 @@ class moench03T1CtbData : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
virtual int getFrameNumber(char *buff) {
|
|
||||||
(void)buff;
|
virtual int getFrameNumber(char *buff){(void)buff; return iframe;};
|
||||||
return iframe;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@ -95,28 +111,21 @@ class moench03T1CtbData : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Loops over a memory slot until a complete frame is found (i.e. all packets
|
Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func
|
||||||
0 to nPackets, same frame number). purely virtual func \param data pointer
|
\param data pointer to the memory to be analyzed
|
||||||
to the memory to be analyzed \param ndata reference to the amount of data
|
\param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot
|
||||||
found for the frame, in case the frame is incomplete at the end of the
|
\param dsize size of the memory slot to be analyzed
|
||||||
memory slot \param dsize size of the memory slot to be analyzed \returns
|
\returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
||||||
pointer to the beginning of the last good frame (might be incomplete if
|
|
||||||
ndata smaller than dataSize), or NULL if no frame is found
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
virtual char *findNextFrame(char *data, int &ndata, int dsize) {
|
virtual char *findNextFrame(char *data, int &ndata, int dsize){ndata=dsize; setDataSize(dsize); return data;};
|
||||||
ndata = dsize;
|
|
||||||
setDataSize(dsize);
|
|
||||||
return data;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Loops over a file stream until a complete frame is found (i.e. all packets
|
Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors!
|
||||||
0 to nPackets, same frame number). Can be overloaded for different kind of
|
\param filebin input file stream (binary)
|
||||||
detectors! \param filebin input file stream (binary) \returns pointer to
|
\returns pointer to the begin of the last good frame, NULL if no frame is found or last frame is incomplete
|
||||||
the begin of the last good frame, NULL if no frame is found or last frame
|
|
||||||
is incomplete
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
virtual char *readNextFrame(ifstream &filebin){
|
virtual char *readNextFrame(ifstream &filebin){
|
||||||
@ -127,8 +136,7 @@ class moench03T1CtbData : public slsDetectorData<uint16_t> {
|
|||||||
afifo_cont=new uint16_t[dataSize/2];
|
afifo_cont=new uint16_t[dataSize/2];
|
||||||
while (filebin.read(((char*)afifo_cont)+ib,2)) {
|
while (filebin.read(((char*)afifo_cont)+ib,2)) {
|
||||||
ib+=2;
|
ib+=2;
|
||||||
if (ib == dataSize)
|
if (ib==dataSize) break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (ib>0) {
|
if (ib>0) {
|
||||||
iframe++;
|
iframe++;
|
||||||
@ -141,6 +149,12 @@ class moench03T1CtbData : public slsDetectorData<uint16_t> {
|
|||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,12 +2,52 @@
|
|||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
#ifndef MOENCH03T1RECDATANEW_H
|
#ifndef MOENCH03T1RECDATANEW_H
|
||||||
#define MOENCH03T1RECDATANEW_H
|
#define MOENCH03T1RECDATANEW_H
|
||||||
#include "sls/sls_detector_defs.h"
|
|
||||||
#include "slsDetectorData.h"
|
#include "slsDetectorData.h"
|
||||||
|
|
||||||
|
//#define VERSION_V2
|
||||||
|
/**
|
||||||
|
@short structure for a Detector Packet or Image Header
|
||||||
|
@li frameNumber is the frame number
|
||||||
|
@li expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
|
||||||
|
@li packetNumber is the packet number
|
||||||
|
@li bunchId is the bunch id from beamline
|
||||||
|
@li timestamp is the time stamp with 10 MHz clock
|
||||||
|
@li modId is the unique module id (unique even for left, right, top, bottom)
|
||||||
|
@li xCoord is the x coordinate in the complete detector system
|
||||||
|
@li yCoord is the y coordinate in the complete detector system
|
||||||
|
@li zCoord is the z coordinate in the complete detector system
|
||||||
|
@li debug is for debugging purposes
|
||||||
|
@li roundRNumber is the round robin set number
|
||||||
|
@li detType is the detector type see :: detectorType
|
||||||
|
@li version is the version number of this structure format
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
uint64_t frameNumber; /**< is the frame number */
|
||||||
|
uint32_t expLength; /**< is the subframe number (32 bit eiger) or real time exposure time in 100ns (others) */
|
||||||
|
uint32_t packetNumber; /**< is the packet number */
|
||||||
|
uint64_t bunchId; /**< is the bunch id from beamline */
|
||||||
|
uint64_t timestamp; /**< is the time stamp with 10 MHz clock */
|
||||||
|
uint16_t modId; /**< is the unique module id (unique even for left, right, top, bottom) */
|
||||||
|
uint16_t xCoord; /**< is the x coordinate in the complete detector system */
|
||||||
|
uint16_t yCoord; /**< is the y coordinate in the complete detector system */
|
||||||
|
uint16_t zCoord; /**< is the z coordinate in the complete detector system */
|
||||||
|
uint32_t debug; /**< is for debugging purposes */
|
||||||
|
uint16_t roundRNumber; /**< is the round robin set number */
|
||||||
|
uint8_t detType; /**< is the detector type see :: detectorType */
|
||||||
|
uint8_t version; /**< is the version number of this structure format */
|
||||||
|
#ifndef VERSION_V1
|
||||||
|
uint64_t packetCaught[8]; /**< is the version number of this structure format */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} sls_detector_header;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int iframe;
|
int iframe;
|
||||||
int nadc;
|
int nadc;
|
||||||
int sc_width;
|
int sc_width;
|
||||||
@ -16,27 +56,27 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
double ghost[200][25];
|
double ghost[200][25];
|
||||||
|
|
||||||
// Single point of definition if we need to customize
|
|
||||||
using header = sls::defs::sls_receiver_header;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Implements the slsReceiverData structure for the moench02 prototype read
|
Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver
|
||||||
out by a module i.e. using the slsReceiver (160x160 pixels, 40 packets
|
(160x160 pixels, 40 packets 1286 large etc.)
|
||||||
1286 large etc.) \param c crosstalk parameter for the output buffer
|
\param c crosstalk parameter for the output buffer
|
||||||
|
|
||||||
*/
|
*/
|
||||||
moench03T1ReceiverDataNew(int ns = 5000)
|
moench03T1ReceiverDataNew(int ns=5000): slsDetectorData<uint16_t>(400, 400, ns*2*32+sizeof(sls_detector_header)), nSamples(ns) {
|
||||||
: slsDetectorData<uint16_t>(400, 400, ns * 2 * 32 + sizeof(header)),
|
|
||||||
nSamples(ns) {
|
|
||||||
|
|
||||||
int nadc=32;
|
int nadc=32;
|
||||||
int sc_width=25;
|
int sc_width=25;
|
||||||
int sc_height=200;
|
int sc_height=200;
|
||||||
|
|
||||||
int adc_nr[32] = {300, 325, 350, 375, 300, 325, 350, 375, 200, 225, 250,
|
int adc_nr[32]={300,325,350,375,300,325,350,375, \
|
||||||
275, 200, 225, 250, 275, 100, 125, 150, 175, 100, 125,
|
200,225,250,275,200,225,250,275,\
|
||||||
150, 175, 0, 25, 50, 75, 0, 25, 50, 75};
|
100,125,150,175,100,125,150,175,\
|
||||||
|
0,25,50,75,0,25,50,75};
|
||||||
|
|
||||||
int row, col;
|
int row, col;
|
||||||
|
|
||||||
@ -62,15 +102,12 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
|||||||
} else {
|
} else {
|
||||||
row=200+i/sc_width;
|
row=200+i/sc_width;
|
||||||
}
|
}
|
||||||
dataMap[row][col] = sizeof(header) +
|
dataMap[row][col]=sizeof(sls_detector_header)+(nadc*i+iadc)*2;//+16*(ip+1);
|
||||||
(nadc * i + iadc) * 2; //+16*(ip+1);
|
|
||||||
#ifdef HIGHZ
|
#ifdef HIGHZ
|
||||||
dataMask[row][col]=0x3fff; //invert data
|
dataMask[row][col]=0x3fff; //invert data
|
||||||
#endif
|
#endif
|
||||||
if (dataMap[row][col] < 0 ||
|
if (dataMap[row][col]<0 || dataMap[row][col]>=nSamples*2*32)
|
||||||
dataMap[row][col] >= nSamples * 2 * 32)
|
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
|
||||||
std::cout << "Error: pointer " << dataMap[row][col]
|
|
||||||
<< " out of range " << std::endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -82,13 +119,13 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
|||||||
ghost[iy][ix]=0.;
|
ghost[iy][ix]=0.;
|
||||||
|
|
||||||
int ipacket;
|
int ipacket;
|
||||||
uint ibyte;
|
int ibyte;
|
||||||
int ii=0;
|
int ii=0;
|
||||||
for (ibyte = 0; ibyte < sizeof(header) / 2; ibyte++) {
|
for (ibyte=0; ibyte<sizeof(sls_detector_header)/2; ibyte++){
|
||||||
xmap[ibyte]=-1;
|
xmap[ibyte]=-1;
|
||||||
ymap[ibyte]=-1;
|
ymap[ibyte]=-1;
|
||||||
}
|
}
|
||||||
int off = sizeof(header) / 2;
|
int off=sizeof(sls_detector_header)/2;
|
||||||
for (ipacket=0; ipacket<npackets; ipacket++) {
|
for (ipacket=0; ipacket<npackets; ipacket++) {
|
||||||
for (ibyte=0; ibyte< 8192/2; ibyte++) {
|
for (ibyte=0; ibyte< 8192/2; ibyte++) {
|
||||||
i=ipacket*8208/2+ibyte;
|
i=ipacket*8208/2+ibyte;
|
||||||
@ -115,19 +152,35 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
|||||||
// cout << "data struct created" << endl;
|
// cout << "data struct created" << endl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the value of the selected channel for the given dataset as
|
Returns the value of the selected channel for the given dataset as double.
|
||||||
double. \param data pointer to the dataset (including headers etc) \param
|
\param data pointer to the dataset (including headers etc)
|
||||||
ix pixel number in the x direction \param iy pixel number in the y
|
\param ix pixel number in the x direction
|
||||||
direction \returns data for the selected channel, with inversion if
|
\param iy pixel number in the y direction
|
||||||
required as double
|
\returns data for the selected channel, with inversion if required as double
|
||||||
|
|
||||||
*/
|
*/
|
||||||
double getValue(char *data, int ix, int iy = 0) override {
|
virtual double getValue(char *data, int ix, int iy=0) {
|
||||||
|
/* cout << " x "<< ix << " y"<< iy << " val " << getChannel(data, ix, iy)<< endl;*/
|
||||||
|
/* double val=0, vout=getChannel(data, ix, iy); */
|
||||||
|
/* int x1=ix%25; */
|
||||||
|
/* for (int ix=0; ix<16; ix++) { */
|
||||||
|
/* for (int ii=0; ii<2; ii++) { */
|
||||||
|
/* val+=getChannel(data,x1+25*ix,iy); */
|
||||||
|
/* val+=getChannel(data,x1+25*ix,399-iy); */
|
||||||
|
/* } */
|
||||||
|
/* } */
|
||||||
|
/* vout+=0.0008*val-6224; */
|
||||||
|
/* return vout; //(double)getChannel(data, ix, iy);
|
||||||
|
*/
|
||||||
uint16_t val=getChannel(data, ix, iy)&0x3fff;
|
uint16_t val=getChannel(data, ix, iy)&0x3fff;
|
||||||
return val;
|
return val;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual void calcGhost(char *data, int ix, int iy) {
|
virtual void calcGhost(char *data, int ix, int iy) {
|
||||||
double val=0;
|
double val=0;
|
||||||
/* for (int ix=0; ix<25; ix++){ */
|
/* for (int ix=0; ix<25; ix++){ */
|
||||||
@ -147,8 +200,11 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
|||||||
/* } */
|
/* } */
|
||||||
/* } */
|
/* } */
|
||||||
// cout << "*" << endl;
|
// cout << "*" << endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual void calcGhost(char *data) {
|
virtual void calcGhost(char *data) {
|
||||||
for (int ix=0; ix<25; ix++){
|
for (int ix=0; ix<25; ix++){
|
||||||
for (int iy=0; iy<200; iy++) {
|
for (int iy=0; iy<200; iy++) {
|
||||||
@ -158,11 +214,10 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
|||||||
// cout << "*" << endl;
|
// cout << "*" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double getGhost(int ix, int iy) {
|
double getGhost(int ix, int iy) {
|
||||||
if (iy < 200)
|
if (iy<200) return ghost[iy][ix%25];
|
||||||
return ghost[iy][ix % 25];
|
if (iy<400) return ghost[399-iy][ix%25];
|
||||||
if (iy < 400)
|
|
||||||
return ghost[399 - iy][ix % 25];
|
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -174,9 +229,17 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int getFrameNumber(char *buff) {
|
/* class jfrau_packet_header_t { */
|
||||||
return ((header *)buff)->detHeader.frameNumber;
|
/* public: */
|
||||||
}
|
/* unsigned char reserved[4]; */
|
||||||
|
/* unsigned char packetNumber[1]; */
|
||||||
|
/* unsigned char frameNumber[3]; */
|
||||||
|
/* unsigned char bunchid[8]; */
|
||||||
|
/* }; */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int getFrameNumber(char *buff){return ((sls_detector_header*)buff)->frameNumber;};//*((int*)(buff+5))&0xffffff;};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@ -187,36 +250,81 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
int getPacketNumber(char *buff) {
|
int getPacketNumber(char *buff){return ((sls_detector_header*)buff)->packetNumber;}//((*(((int*)(buff+4))))&0xff)+1;};
|
||||||
return ((header *)buff)->detHeader.packetNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *readNextFrame(std::ifstream &filebin) override {
|
/* /\** */
|
||||||
|
|
||||||
|
/* Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func */
|
||||||
|
/* \param data pointer to the memory to be analyzed */
|
||||||
|
/* \param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot */
|
||||||
|
/* \param dsize size of the memory slot to be analyzed */
|
||||||
|
/* \returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found */
|
||||||
|
|
||||||
|
/* *\/ */
|
||||||
|
/* virtual char *findNextFrame(char *data, int &ndata, int dsize){ndata=dsize; setDataSize(dsize); return data;}; */
|
||||||
|
|
||||||
|
|
||||||
|
/* /\** */
|
||||||
|
|
||||||
|
/* Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors! */
|
||||||
|
/* \param filebin input file stream (binary) */
|
||||||
|
/* \returns pointer to the begin of the last good frame, NULL if no frame is found or last frame is incomplete */
|
||||||
|
|
||||||
|
/* *\/ */
|
||||||
|
/* virtual char *readNextFrame(ifstream &filebin){ */
|
||||||
|
/* // int afifo_length=0; */
|
||||||
|
/* uint16_t *afifo_cont; */
|
||||||
|
/* int ib=0; */
|
||||||
|
/* if (filebin.is_open()) { */
|
||||||
|
/* afifo_cont=new uint16_t[dataSize/2]; */
|
||||||
|
/* while (filebin.read(((char*)afifo_cont)+ib,2)) { */
|
||||||
|
/* ib+=2; */
|
||||||
|
/* if (ib==dataSize) break; */
|
||||||
|
/* } */
|
||||||
|
/* if (ib>0) { */
|
||||||
|
/* iframe++; */
|
||||||
|
/* // cout << ib << "-" << endl; */
|
||||||
|
/* return (char*)afifo_cont; */
|
||||||
|
/* } else { */
|
||||||
|
/* delete [] afifo_cont; */
|
||||||
|
/* return NULL; */
|
||||||
|
/* } */
|
||||||
|
/* } */
|
||||||
|
/* return NULL; */
|
||||||
|
/* }; */
|
||||||
|
|
||||||
|
|
||||||
|
virtual char *readNextFrame(ifstream &filebin) {
|
||||||
int ff=-1, np=-1;
|
int ff=-1, np=-1;
|
||||||
return readNextFrame(filebin, ff, np);
|
return readNextFrame(filebin, ff, np);
|
||||||
}
|
};
|
||||||
|
|
||||||
// not present in base class
|
virtual char *readNextFrame(ifstream &filebin, int &ff) {
|
||||||
virtual char *readNextFrame(std::ifstream &filebin, int &ff) {
|
|
||||||
int np=-1;
|
int np=-1;
|
||||||
return readNextFrame(filebin, ff, np);
|
return readNextFrame(filebin, ff, np);
|
||||||
};
|
};
|
||||||
|
|
||||||
// not present in base class
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
||||||
virtual char *readNextFrame(std::ifstream &filebin, int &ff, int &np) {
|
|
||||||
char *data=new char[dataSize];
|
char *data=new char[dataSize];
|
||||||
char *d=readNextFrame(filebin, ff, np, data);
|
char *d=readNextFrame(filebin, ff, np, data);
|
||||||
if (d == NULL) {
|
if (d==NULL) {delete [] data; data=NULL;}
|
||||||
delete[] data;
|
|
||||||
data = NULL;
|
|
||||||
}
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
// not present in base class
|
|
||||||
virtual char *readNextFrame(std::ifstream &filebin, int &ff, int &np,
|
|
||||||
char *data) {
|
|
||||||
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
||||||
|
char *retval=0;
|
||||||
|
int nd;
|
||||||
|
int fnum = -1;
|
||||||
np=0;
|
np=0;
|
||||||
|
int pn;
|
||||||
|
|
||||||
|
// cout << dataSize << endl;
|
||||||
|
if (ff>=0)
|
||||||
|
fnum=ff;
|
||||||
|
|
||||||
if (filebin.is_open()) {
|
if (filebin.is_open()) {
|
||||||
if (filebin.read(data, dataSize) ){
|
if (filebin.read(data, dataSize) ){
|
||||||
ff=getFrameNumber(data);
|
ff=getFrameNumber(data);
|
||||||
@ -224,30 +332,35 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nullptr;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Loops over a memory slot until a complete frame is found (i.e. all
|
Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func
|
||||||
packets 0 to nPackets, same frame number). purely virtual func \param
|
\param data pointer to the memory to be analyzed
|
||||||
data pointer to the memory to be analyzed \param ndata reference to the
|
\param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot
|
||||||
amount of data found for the frame, in case the frame is incomplete at
|
\param dsize size of the memory slot to be analyzed
|
||||||
the end of the memory slot \param dsize size of the memory slot to be
|
\returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
||||||
analyzed \returns pointer to the beginning of the last good frame (might
|
|
||||||
be incomplete if ndata smaller than dataSize), or NULL if no frame is
|
|
||||||
found
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
char *findNextFrame(char *data, int &ndata, int dsize) override {
|
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
||||||
if (dsize < dataSize)
|
if (dsize<dataSize) ndata=dsize;
|
||||||
ndata = dsize;
|
else ndata=dataSize;
|
||||||
else
|
|
||||||
ndata = dataSize;
|
|
||||||
return data;
|
return data;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
//int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -9,8 +9,7 @@
|
|||||||
/**
|
/**
|
||||||
@short structure for a Detector Packet or Image Header
|
@short structure for a Detector Packet or Image Header
|
||||||
@li frameNumber is the frame number
|
@li frameNumber is the frame number
|
||||||
@li expLength is the subframe number (32 bit eiger) or real time exposure
|
@li expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
|
||||||
time in 100ns (others)
|
|
||||||
@li packetNumber is the packet number
|
@li packetNumber is the packet number
|
||||||
@li bunchId is the bunch id from beamline
|
@li bunchId is the bunch id from beamline
|
||||||
@li timestamp is the time stamp with 10 MHz clock
|
@li timestamp is the time stamp with 10 MHz clock
|
||||||
@ -25,13 +24,11 @@
|
|||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint64_t frameNumber; /**< is the frame number */
|
uint64_t frameNumber; /**< is the frame number */
|
||||||
uint32_t expLength; /**< is the subframe number (32 bit eiger) or real time
|
uint32_t expLength; /**< is the subframe number (32 bit eiger) or real time exposure time in 100ns (others) */
|
||||||
exposure time in 100ns (others) */
|
|
||||||
uint32_t packetNumber; /**< is the packet number */
|
uint32_t packetNumber; /**< is the packet number */
|
||||||
uint64_t bunchId; /**< is the bunch id from beamline */
|
uint64_t bunchId; /**< is the bunch id from beamline */
|
||||||
uint64_t timestamp; /**< is the time stamp with 10 MHz clock */
|
uint64_t timestamp; /**< is the time stamp with 10 MHz clock */
|
||||||
uint16_t modId; /**< is the unique module id (unique even for left, right,
|
uint16_t modId; /**< is the unique module id (unique even for left, right, top, bottom) */
|
||||||
top, bottom) */
|
|
||||||
uint16_t xCoord; /**< is the x coordinate in the complete detector system */
|
uint16_t xCoord; /**< is the x coordinate in the complete detector system */
|
||||||
uint16_t yCoord; /**< is the y coordinate in the complete detector system */
|
uint16_t yCoord; /**< is the y coordinate in the complete detector system */
|
||||||
uint16_t zCoord; /**< is the z coordinate in the complete detector system */
|
uint16_t zCoord; /**< is the z coordinate in the complete detector system */
|
||||||
@ -41,41 +38,44 @@ typedef struct {
|
|||||||
uint8_t version; /**< is the version number of this structure format */
|
uint8_t version; /**< is the version number of this structure format */
|
||||||
} sls_detector_header;
|
} sls_detector_header;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int iframe;
|
int iframe;
|
||||||
int nadc;
|
int nadc;
|
||||||
int sc_width;
|
int sc_width;
|
||||||
int sc_height;
|
int sc_height;
|
||||||
const int nSamples;
|
const int nSamples;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Implements the slsReceiverData structure for the moench02 prototype read
|
Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver
|
||||||
out by a module i.e. using the slsReceiver (160x160 pixels, 40 packets
|
(160x160 pixels, 40 packets 1286 large etc.)
|
||||||
1286 large etc.) \param c crosstalk parameter for the output buffer
|
\param c crosstalk parameter for the output buffer
|
||||||
|
|
||||||
*/
|
*/
|
||||||
#ifdef HOR
|
#ifdef HOR
|
||||||
moench03T1ReceiverDataNew(int ns = 5000)
|
moench03T1ReceiverDataNew(int ns=5000): slsDetectorData<uint16_t>(800, 200, ns*2*32+sizeof(sls_detector_header)), nSamples(ns) {
|
||||||
: slsDetectorData<uint16_t>(800, 200,
|
|
||||||
ns * 2 * 32 + sizeof(sls_detector_header)),
|
|
||||||
nSamples(ns) {
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef VERT
|
#ifdef VERT
|
||||||
moench03T1ReceiverDataNew(int ns = 5000)
|
moench03T1ReceiverDataNew(int ns=5000): slsDetectorData<uint16_t>(200, 800, ns*2*32+sizeof(sls_detector_header)), nSamples(ns) {
|
||||||
: slsDetectorData<uint16_t>(
|
|
||||||
200, 800, ns * 2 * 32 + sizeof(sls_detector_header)),
|
|
||||||
nSamples(ns) {
|
|
||||||
#endif
|
#endif
|
||||||
int nadc=32;
|
int nadc=32;
|
||||||
int sc_width=25;
|
int sc_width=25;
|
||||||
int sc_height=200;
|
int sc_height=200;
|
||||||
|
|
||||||
int adc_nr[32] = {300, 325, 350, 375, 300, 325, 350, 375,
|
int adc_nr[32]={300,325,350,375,300,325,350,375, \
|
||||||
200, 225, 250, 275, 200, 225, 250, 275,
|
200,225,250,275,200,225,250,275,\
|
||||||
100, 125, 150, 175, 100, 125, 150, 175,
|
100,125,150,175,100,125,150,175,\
|
||||||
0,25,50,75,0,25,50,75};
|
0,25,50,75,0,25,50,75};
|
||||||
|
|
||||||
int row, col;
|
int row, col;
|
||||||
@ -89,6 +89,7 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
|||||||
int adc4(0);
|
int adc4(0);
|
||||||
int pix;
|
int pix;
|
||||||
|
|
||||||
|
|
||||||
int off=0;
|
int off=0;
|
||||||
#ifdef OFF_1
|
#ifdef OFF_1
|
||||||
off=1;
|
off=1;
|
||||||
@ -109,13 +110,9 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
|||||||
} else {
|
} else {
|
||||||
row=200+i/sc_width;
|
row=200+i/sc_width;
|
||||||
}
|
}
|
||||||
pix = sizeof(sls_detector_header) +
|
pix=sizeof(sls_detector_header)+(nadc*i+iadc)*2;//+16*(ip+1);
|
||||||
(nadc * i + iadc) * 2; //+16*(ip+1);
|
if (pix<0 || pix>=nSamples*2*32+sizeof(sls_detector_header))
|
||||||
if (pix < 0 ||
|
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
|
||||||
pix >= nSamples * 2 * 32 +
|
|
||||||
sizeof(sls_detector_header))
|
|
||||||
cout << "Error: pointer " << dataMap[row][col]
|
|
||||||
<< " out of range " << endl;
|
|
||||||
ix=col;
|
ix=col;
|
||||||
iy=row;
|
iy=row;
|
||||||
#ifdef HOR
|
#ifdef HOR
|
||||||
@ -177,6 +174,8 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
|||||||
// cout << "data struct created" << endl;
|
// cout << "data struct created" << endl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Returns the frame number for the given dataset. Purely virtual func.
|
Returns the frame number for the given dataset. Purely virtual func.
|
||||||
@ -193,9 +192,9 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
|||||||
/* unsigned char bunchid[8]; */
|
/* unsigned char bunchid[8]; */
|
||||||
/* }; */
|
/* }; */
|
||||||
|
|
||||||
int getFrameNumber(char *buff) {
|
|
||||||
return ((sls_detector_header *)buff)->frameNumber;
|
|
||||||
}; //*((int*)(buff+5))&0xffffff;};
|
int getFrameNumber(char *buff){return ((sls_detector_header*)buff)->frameNumber;};//*((int*)(buff+5))&0xffffff;};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@ -206,35 +205,25 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
int getPacketNumber(char *buff) {
|
int getPacketNumber(char *buff){return ((sls_detector_header*)buff)->packetNumber;}//((*(((int*)(buff+4))))&0xff)+1;};
|
||||||
return ((sls_detector_header *)buff)->packetNumber;
|
|
||||||
} //((*(((int*)(buff+4))))&0xff)+1;};
|
|
||||||
|
|
||||||
/* /\** */
|
/* /\** */
|
||||||
|
|
||||||
/* Loops over a memory slot until a complete frame is found (i.e.
|
/* Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func */
|
||||||
* all packets 0 to nPackets, same frame number). purely virtual func */
|
|
||||||
/* \param data pointer to the memory to be analyzed */
|
/* \param data pointer to the memory to be analyzed */
|
||||||
/* \param ndata reference to the amount of data found for the
|
/* \param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot */
|
||||||
* frame, in case the frame is incomplete at the end of the memory slot
|
|
||||||
*/
|
|
||||||
/* \param dsize size of the memory slot to be analyzed */
|
/* \param dsize size of the memory slot to be analyzed */
|
||||||
/* \returns pointer to the beginning of the last good frame (might
|
/* \returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found */
|
||||||
* be incomplete if ndata smaller than dataSize), or NULL if no frame is
|
|
||||||
* found */
|
|
||||||
|
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
/* virtual char *findNextFrame(char *data, int &ndata, int
|
/* virtual char *findNextFrame(char *data, int &ndata, int dsize){ndata=dsize; setDataSize(dsize); return data;}; */
|
||||||
* dsize){ndata=dsize; setDataSize(dsize); return data;}; */
|
|
||||||
|
|
||||||
/* /\** */
|
/* /\** */
|
||||||
|
|
||||||
/* Loops over a file stream until a complete frame is found (i.e.
|
/* Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors! */
|
||||||
* all packets 0 to nPackets, same frame number). Can be overloaded for
|
|
||||||
* different kind of detectors! */
|
|
||||||
/* \param filebin input file stream (binary) */
|
/* \param filebin input file stream (binary) */
|
||||||
/* \returns pointer to the begin of the last good frame, NULL if no
|
/* \returns pointer to the begin of the last good frame, NULL if no frame is found or last frame is incomplete */
|
||||||
* frame is found or last frame is incomplete */
|
|
||||||
|
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
/* virtual char *readNextFrame(ifstream &filebin){ */
|
/* virtual char *readNextFrame(ifstream &filebin){ */
|
||||||
@ -259,6 +248,7 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
|||||||
/* return NULL; */
|
/* return NULL; */
|
||||||
/* }; */
|
/* }; */
|
||||||
|
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream &filebin) {
|
virtual char *readNextFrame(ifstream &filebin) {
|
||||||
int ff=-1, np=-1;
|
int ff=-1, np=-1;
|
||||||
return readNextFrame(filebin, ff, np);
|
return readNextFrame(filebin, ff, np);
|
||||||
@ -272,15 +262,14 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
|||||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
||||||
char *data=new char[dataSize];
|
char *data=new char[dataSize];
|
||||||
char *d=readNextFrame(filebin, ff, np, data);
|
char *d=readNextFrame(filebin, ff, np, data);
|
||||||
if (d == NULL) {
|
if (d==NULL) {delete [] data; data=NULL;}
|
||||||
delete[] data;
|
|
||||||
data = NULL;
|
|
||||||
}
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream & filebin, int &ff, int &np,
|
|
||||||
char *data) {
|
|
||||||
|
|
||||||
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
||||||
char *retval=0;
|
char *retval=0;
|
||||||
int nd;
|
int nd;
|
||||||
int fnum = -1;
|
int fnum = -1;
|
||||||
@ -299,29 +288,36 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Loops over a memory slot until a complete frame is found (i.e. all
|
Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func
|
||||||
packets 0 to nPackets, same frame number). purely virtual func \param
|
\param data pointer to the memory to be analyzed
|
||||||
data pointer to the memory to be analyzed \param ndata reference to
|
\param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot
|
||||||
the amount of data found for the frame, in case the frame is
|
\param dsize size of the memory slot to be analyzed
|
||||||
incomplete at the end of the memory slot \param dsize size of the
|
\returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
||||||
memory slot to be analyzed \returns pointer to the beginning of the
|
|
||||||
last good frame (might be incomplete if ndata smaller than dataSize),
|
|
||||||
or NULL if no frame is found
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
||||||
if (dsize < dataSize)
|
if (dsize<dataSize) ndata=dsize;
|
||||||
ndata = dsize;
|
else ndata=dataSize;
|
||||||
else
|
|
||||||
ndata = dataSize;
|
|
||||||
return data;
|
return data;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
//int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,21 +4,26 @@
|
|||||||
#define MOENCH03T1REORDERED_H
|
#define MOENCH03T1REORDERED_H
|
||||||
#include "slsDetectorData.h"
|
#include "slsDetectorData.h"
|
||||||
|
|
||||||
|
|
||||||
class moench03T1ReorderedData : public slsDetectorData<uint16_t> {
|
class moench03T1ReorderedData : public slsDetectorData<uint16_t> {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Implements the slsReceiverData structure for the moench02 prototype read
|
Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver
|
||||||
out by a module i.e. using the slsReceiver (160x160 pixels, 40 packets
|
(160x160 pixels, 40 packets 1286 large etc.)
|
||||||
1286 large etc.) \param c crosstalk parameter for the output buffer
|
\param c crosstalk parameter for the output buffer
|
||||||
|
|
||||||
fwrite(&ff, 8, 1,of);//write detector frame number
|
fwrite(&ff, 8, 1,of);//write detector frame number
|
||||||
fwrite(&ifr, 8, 1,of);//write datset frame number
|
fwrite(&ifr, 8, 1,of);//write datset frame number
|
||||||
fwrite(data,2,NX*NY,of);//write reordered data
|
fwrite(data,2,NX*NY,of);//write reordered data
|
||||||
*/
|
*/
|
||||||
moench03T1ReorderedData()
|
moench03T1ReorderedData(): slsDetectorData<uint16_t>(400, 400, 2*400*400+2*8) {
|
||||||
: slsDetectorData<uint16_t>(400, 400, 2 * 400 * 400 + 2 * 8) {
|
|
||||||
for (int iy=0; iy<400; iy++)
|
for (int iy=0; iy<400; iy++)
|
||||||
for (int ix=0; ix<400; ix++)
|
for (int ix=0; ix<400; ix++)
|
||||||
dataMap[iy][ix]=2*8+2*(iy*400+ix);
|
dataMap[iy][ix]=2*8+2*(iy*400+ix);
|
||||||
@ -36,6 +41,8 @@ class moench03T1ReorderedData : public slsDetectorData<uint16_t> {
|
|||||||
// cout << "data struct created" << endl;
|
// cout << "data struct created" << endl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Returns the frame number for the given dataset. Purely virtual func.
|
Returns the frame number for the given dataset. Purely virtual func.
|
||||||
@ -52,32 +59,27 @@ class moench03T1ReorderedData : public slsDetectorData<uint16_t> {
|
|||||||
/* unsigned char bunchid[8]; */
|
/* unsigned char bunchid[8]; */
|
||||||
/* }; */
|
/* }; */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int getFrameNumber(char *buff){return *((int*)buff);};
|
int getFrameNumber(char *buff){return *((int*)buff);};
|
||||||
|
|
||||||
/* /\** */
|
/* /\** */
|
||||||
|
|
||||||
/* Loops over a memory slot until a complete frame is found (i.e. all
|
/* Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func */
|
||||||
* packets 0 to nPackets, same frame number). purely virtual func */
|
|
||||||
/* \param data pointer to the memory to be analyzed */
|
/* \param data pointer to the memory to be analyzed */
|
||||||
/* \param ndata reference to the amount of data found for the frame, in
|
/* \param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot */
|
||||||
* case the frame is incomplete at the end of the memory slot */
|
|
||||||
/* \param dsize size of the memory slot to be analyzed */
|
/* \param dsize size of the memory slot to be analyzed */
|
||||||
/* \returns pointer to the beginning of the last good frame (might be
|
/* \returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found */
|
||||||
* incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
/* virtual char *findNextFrame(char *data, int &ndata, int
|
/* virtual char *findNextFrame(char *data, int &ndata, int dsize){ndata=dsize; setDataSize(dsize); return data;}; */
|
||||||
* dsize){ndata=dsize; setDataSize(dsize); return data;}; */
|
|
||||||
|
|
||||||
/* /\** */
|
/* /\** */
|
||||||
|
|
||||||
/* Loops over a file stream until a complete frame is found (i.e. all
|
/* Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors! */
|
||||||
* packets 0 to nPackets, same frame number). Can be overloaded for
|
|
||||||
* different kind of detectors! */
|
|
||||||
/* \param filebin input file stream (binary) */
|
/* \param filebin input file stream (binary) */
|
||||||
/* \returns pointer to the begin of the last good frame, NULL if no
|
/* \returns pointer to the begin of the last good frame, NULL if no frame is found or last frame is incomplete */
|
||||||
* frame is found or last frame is incomplete */
|
|
||||||
|
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
/* virtual char *readNextFrame(ifstream &filebin){ */
|
/* virtual char *readNextFrame(ifstream &filebin){ */
|
||||||
@ -102,6 +104,7 @@ class moench03T1ReorderedData : public slsDetectorData<uint16_t> {
|
|||||||
/* return NULL; */
|
/* return NULL; */
|
||||||
/* }; */
|
/* }; */
|
||||||
|
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream &filebin) {
|
virtual char *readNextFrame(ifstream &filebin) {
|
||||||
int ff=-1, np=-1;
|
int ff=-1, np=-1;
|
||||||
return readNextFrame(filebin, ff, np);
|
return readNextFrame(filebin, ff, np);
|
||||||
@ -115,15 +118,14 @@ class moench03T1ReorderedData : public slsDetectorData<uint16_t> {
|
|||||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
||||||
char *data=new char[dataSize];
|
char *data=new char[dataSize];
|
||||||
char *d=readNextFrame(filebin, ff, np, data);
|
char *d=readNextFrame(filebin, ff, np, data);
|
||||||
if (d == NULL) {
|
if (d==NULL) {delete [] data; data=NULL;}
|
||||||
delete[] data;
|
|
||||||
data = NULL;
|
|
||||||
}
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream &filebin, int &ff, int &np,
|
|
||||||
char *data) {
|
|
||||||
|
|
||||||
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
||||||
char *retval=0;
|
char *retval=0;
|
||||||
int nd;
|
int nd;
|
||||||
int fnum = -1;
|
int fnum = -1;
|
||||||
@ -141,29 +143,36 @@ class moench03T1ReorderedData : public slsDetectorData<uint16_t> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Loops over a memory slot until a complete frame is found (i.e. all
|
Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func
|
||||||
packets 0 to nPackets, same frame number). purely virtual func \param
|
\param data pointer to the memory to be analyzed
|
||||||
data pointer to the memory to be analyzed \param ndata reference to the
|
\param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot
|
||||||
amount of data found for the frame, in case the frame is incomplete at
|
\param dsize size of the memory slot to be analyzed
|
||||||
the end of the memory slot \param dsize size of the memory slot to be
|
\returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
||||||
analyzed \returns pointer to the beginning of the last good frame (might
|
|
||||||
be incomplete if ndata smaller than dataSize), or NULL if no frame is
|
|
||||||
found
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
||||||
if (dsize < dataSize)
|
if (dsize<dataSize) ndata=dsize;
|
||||||
ndata = dsize;
|
else ndata=dataSize;
|
||||||
else
|
|
||||||
ndata = dataSize;
|
|
||||||
return data;
|
return data;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
//int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,9 +4,12 @@
|
|||||||
#define MOENCH03T1ZMQDATA_H
|
#define MOENCH03T1ZMQDATA_H
|
||||||
#include "slsDetectorData.h"
|
#include "slsDetectorData.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class moench03T1ZmqData : public slsDetectorData<uint16_t> {
|
class moench03T1ZmqData : public slsDetectorData<uint16_t> {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int iframe;
|
int iframe;
|
||||||
int nadc;
|
int nadc;
|
||||||
int sc_width;
|
int sc_width;
|
||||||
@ -14,24 +17,28 @@ class moench03T1ZmqData : public slsDetectorData<uint16_t> {
|
|||||||
const int nPackets; /**<number of UDP packets constituting one frame */
|
const int nPackets; /**<number of UDP packets constituting one frame */
|
||||||
const int packetSize; /**< size of a udp packet */
|
const int packetSize; /**< size of a udp packet */
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Implements the slsReceiverData structure for the moench02 prototype read
|
Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver
|
||||||
out by a module i.e. using the slsReceiver (160x160 pixels, 40 packets
|
(160x160 pixels, 40 packets 1286 large etc.)
|
||||||
1286 large etc.) \param c crosstalk parameter for the output buffer
|
\param c crosstalk parameter for the output buffer
|
||||||
|
|
||||||
*/
|
*/
|
||||||
moench03T1ZmqData(int npackets = 40, int ps = 8192)
|
moench03T1ZmqData(int npackets=40, int ps=8192): slsDetectorData<uint16_t>(400, 400, ps*npackets), packetSize(ps), nPackets(npackets) {
|
||||||
: slsDetectorData<uint16_t>(400, 400, ps * npackets), packetSize(ps),
|
|
||||||
nPackets(npackets) {
|
|
||||||
|
|
||||||
int nadc=32;
|
int nadc=32;
|
||||||
int sc_width=25;
|
int sc_width=25;
|
||||||
int sc_height=200;
|
int sc_height=200;
|
||||||
|
|
||||||
int adc_nr[32] = {300, 325, 350, 375, 300, 325, 350, 375, 200, 225, 250,
|
int adc_nr[32]={300,325,350,375,300,325,350,375, \
|
||||||
275, 200, 225, 250, 275, 100, 125, 150, 175, 100, 125,
|
200,225,250,275,200,225,250,275,\
|
||||||
150, 175, 0, 25, 50, 75, 0, 25, 50, 75};
|
100,125,150,175,100,125,150,175,\
|
||||||
|
0,25,50,75,0,25,50,75};
|
||||||
|
|
||||||
int row, col;
|
int row, col;
|
||||||
|
|
||||||
@ -58,10 +65,8 @@ class moench03T1ZmqData : public slsDetectorData<uint16_t> {
|
|||||||
row=200+i/sc_width;
|
row=200+i/sc_width;
|
||||||
}
|
}
|
||||||
dataMap[row][col]=(nadc*i+iadc)*2;//+16*(ip+1);
|
dataMap[row][col]=(nadc*i+iadc)*2;//+16*(ip+1);
|
||||||
if (dataMap[row][col] < 0 ||
|
if (dataMap[row][col]<0 || dataMap[row][col]>=8192*40)
|
||||||
dataMap[row][col] >= 8192 * 40)
|
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
|
||||||
cout << "Error: pointer " << dataMap[row][col]
|
|
||||||
<< " out of range " << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,10 +102,15 @@ class moench03T1ZmqData : public slsDetectorData<uint16_t> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
iframe=0;
|
iframe=0;
|
||||||
// cout << "data struct created" << endl;
|
// cout << "data struct created" << endl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Returns the frame number for the given dataset. Purely virtual func.
|
Returns the frame number for the given dataset. Purely virtual func.
|
||||||
@ -117,9 +127,9 @@ class moench03T1ZmqData : public slsDetectorData<uint16_t> {
|
|||||||
/* unsigned char bunchid[8]; */
|
/* unsigned char bunchid[8]; */
|
||||||
/* }; */
|
/* }; */
|
||||||
|
|
||||||
int getFrameNumber(char *buff) {
|
|
||||||
return iframe;
|
|
||||||
}; //*((int*)(buff+5))&0xffffff;};
|
int getFrameNumber(char *buff){return iframe;};//*((int*)(buff+5))&0xffffff;};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@ -130,34 +140,25 @@ class moench03T1ZmqData : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
int getPacketNumber(char *buff) {
|
int getPacketNumber(char *buff){return 0;}//((*(((int*)(buff+4))))&0xff)+1;};
|
||||||
return 0;
|
|
||||||
} //((*(((int*)(buff+4))))&0xff)+1;};
|
|
||||||
|
|
||||||
/* /\** */
|
/* /\** */
|
||||||
|
|
||||||
/* Loops over a memory slot until a complete frame is found (i.e. all
|
/* Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func */
|
||||||
* packets 0 to nPackets, same frame number). purely virtual func */
|
|
||||||
/* \param data pointer to the memory to be analyzed */
|
/* \param data pointer to the memory to be analyzed */
|
||||||
/* \param ndata reference to the amount of data found for the frame, in
|
/* \param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot */
|
||||||
* case the frame is incomplete at the end of the memory slot */
|
|
||||||
/* \param dsize size of the memory slot to be analyzed */
|
/* \param dsize size of the memory slot to be analyzed */
|
||||||
/* \returns pointer to the beginning of the last good frame (might be
|
/* \returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found */
|
||||||
* incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
/* virtual char *findNextFrame(char *data, int &ndata, int
|
/* virtual char *findNextFrame(char *data, int &ndata, int dsize){ndata=dsize; setDataSize(dsize); return data;}; */
|
||||||
* dsize){ndata=dsize; setDataSize(dsize); return data;}; */
|
|
||||||
|
|
||||||
/* /\** */
|
/* /\** */
|
||||||
|
|
||||||
/* Loops over a file stream until a complete frame is found (i.e. all
|
/* Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors! */
|
||||||
* packets 0 to nPackets, same frame number). Can be overloaded for
|
|
||||||
* different kind of detectors! */
|
|
||||||
/* \param filebin input file stream (binary) */
|
/* \param filebin input file stream (binary) */
|
||||||
/* \returns pointer to the begin of the last good frame, NULL if no
|
/* \returns pointer to the begin of the last good frame, NULL if no frame is found or last frame is incomplete */
|
||||||
* frame is found or last frame is incomplete */
|
|
||||||
|
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
/* virtual char *readNextFrame(ifstream &filebin){ */
|
/* virtual char *readNextFrame(ifstream &filebin){ */
|
||||||
@ -182,6 +183,7 @@ class moench03T1ZmqData : public slsDetectorData<uint16_t> {
|
|||||||
/* return NULL; */
|
/* return NULL; */
|
||||||
/* }; */
|
/* }; */
|
||||||
|
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream &filebin) {
|
virtual char *readNextFrame(ifstream &filebin) {
|
||||||
int ff=-1, np=-1;
|
int ff=-1, np=-1;
|
||||||
return readNextFrame(filebin, ff, np);
|
return readNextFrame(filebin, ff, np);
|
||||||
@ -195,21 +197,21 @@ class moench03T1ZmqData : public slsDetectorData<uint16_t> {
|
|||||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
||||||
char *data=new char[packetSize*nPackets];
|
char *data=new char[packetSize*nPackets];
|
||||||
char *d=readNextFrame(filebin, ff, np, data);
|
char *d=readNextFrame(filebin, ff, np, data);
|
||||||
if (d == NULL) {
|
if (d==NULL) {delete [] data; data=NULL;}
|
||||||
delete[] data;
|
|
||||||
data = NULL;
|
|
||||||
}
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream &filebin, int &ff, int &np,
|
|
||||||
char *data) {
|
|
||||||
|
|
||||||
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
||||||
char *retval=0;
|
char *retval=0;
|
||||||
int nd;
|
int nd;
|
||||||
int fnum = -1;
|
int fnum = -1;
|
||||||
np=0;
|
np=0;
|
||||||
int pn;
|
int pn;
|
||||||
|
|
||||||
|
|
||||||
if (ff>=0)
|
if (ff>=0)
|
||||||
fnum=ff;
|
fnum=ff;
|
||||||
|
|
||||||
@ -221,29 +223,48 @@ class moench03T1ZmqData : public slsDetectorData<uint16_t> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Loops over a memory slot until a complete frame is found (i.e. all
|
Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func
|
||||||
packets 0 to nPackets, same frame number). purely virtual func \param
|
\param data pointer to the memory to be analyzed
|
||||||
data pointer to the memory to be analyzed \param ndata reference to the
|
\param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot
|
||||||
amount of data found for the frame, in case the frame is incomplete at
|
\param dsize size of the memory slot to be analyzed
|
||||||
the end of the memory slot \param dsize size of the memory slot to be
|
\returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
||||||
analyzed \returns pointer to the beginning of the last good frame (might
|
|
||||||
be incomplete if ndata smaller than dataSize), or NULL if no frame is
|
|
||||||
found
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
||||||
if (dsize < packetSize * nPackets)
|
if (dsize<packetSize*nPackets) ndata=dsize;
|
||||||
ndata = dsize;
|
else ndata=packetSize*nPackets;
|
||||||
else
|
|
||||||
ndata = packetSize * nPackets;
|
|
||||||
return data;
|
return data;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,9 +4,11 @@
|
|||||||
#define MOENCH03T1ZMQDATANEW_H
|
#define MOENCH03T1ZMQDATANEW_H
|
||||||
#include "slsDetectorData.h"
|
#include "slsDetectorData.h"
|
||||||
|
|
||||||
|
|
||||||
class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
|
class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// int iframe;
|
// int iframe;
|
||||||
int nadc;
|
int nadc;
|
||||||
int sc_width;
|
int sc_width;
|
||||||
@ -14,29 +16,33 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
|
|||||||
const int nSamples;
|
const int nSamples;
|
||||||
const int offset;
|
const int offset;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
double ghost[200][25];
|
double ghost[200][25];
|
||||||
double xtalk;
|
double xtalk;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Implements the slsReceiverData structure for the moench02 prototype read
|
Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver
|
||||||
out by a module i.e. using the slsReceiver (160x160 pixels, 40 packets
|
(160x160 pixels, 40 packets 1286 large etc.)
|
||||||
1286 large etc.) \param c crosstalk parameter for the output buffer
|
\param c crosstalk parameter for the output buffer
|
||||||
|
|
||||||
*/
|
*/
|
||||||
// moench03T1ZmqDataNew(int ns=5000): slsDetectorData<uint16_t>(400, 400,
|
// moench03T1ZmqDataNew(int ns=5000): slsDetectorData<uint16_t>(400, 400, ns*32*2+sizeof(int)), nSamples(ns), offset(sizeof(int)), xtalk(0.00021) {
|
||||||
// ns*32*2+sizeof(int)), nSamples(ns), offset(sizeof(int)), xtalk(0.00021) {
|
moench03T1ZmqDataNew(int ns=5000, int oo=2*2): slsDetectorData<uint16_t>(400, 400, ns*32*2+oo), nSamples(ns), offset(oo), xtalk(0.00021) {
|
||||||
moench03T1ZmqDataNew(int ns = 5000, int oo = 2 * 2)
|
cout << "M0.3" << endl;
|
||||||
: slsDetectorData<uint16_t>(400, 400, ns * 32 * 2 + oo), nSamples(ns),
|
|
||||||
offset(oo), xtalk(0.00021) {
|
|
||||||
std::cout << "M0.3" << std::endl;
|
|
||||||
int nadc=32;
|
int nadc=32;
|
||||||
int sc_width=25;
|
int sc_width=25;
|
||||||
int sc_height=200;
|
int sc_height=200;
|
||||||
|
|
||||||
int adc_nr[32] = {300, 325, 350, 375, 300, 325, 350, 375, 200, 225, 250,
|
int adc_nr[32]={300,325,350,375,300,325,350,375, \
|
||||||
275, 200, 225, 250, 275, 100, 125, 150, 175, 100, 125,
|
200,225,250,275,200,225,250,275,\
|
||||||
150, 175, 0, 25, 50, 75, 0, 25, 50, 75};
|
100,125,150,175,100,125,150,175,\
|
||||||
|
0,25,50,75,0,25,50,75};
|
||||||
|
|
||||||
/* int adc_nr[32]={350,375,150,175,350,375,150,175, \
|
/* int adc_nr[32]={350,375,150,175,350,375,150,175, \
|
||||||
300,325,100,125,300,325,100,125,\
|
300,325,100,125,300,325,100,125,\
|
||||||
@ -49,7 +55,7 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
|
|||||||
int iadc;
|
int iadc;
|
||||||
int ix, iy;
|
int ix, iy;
|
||||||
|
|
||||||
// int npackets=40;
|
int npackets=40;
|
||||||
int i;
|
int i;
|
||||||
int adc4(0);
|
int adc4(0);
|
||||||
|
|
||||||
@ -67,16 +73,15 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
|
|||||||
} else {
|
} else {
|
||||||
row=200+i/sc_width;
|
row=200+i/sc_width;
|
||||||
}
|
}
|
||||||
dataMap[row][col] =
|
dataMap[row][col]=(nadc*i+iadc)*2+offset;//+16*(ip+1);
|
||||||
(nadc * i + iadc) * 2 + offset; //+16*(ip+1);
|
|
||||||
if (dataMap[row][col]<0 || dataMap[row][col]>=dataSize)
|
if (dataMap[row][col]<0 || dataMap[row][col]>=dataSize)
|
||||||
std::cout << "Error: pointer " << dataMap[row][col]
|
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
|
||||||
<< " out of range " << std::endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
int ii=0;
|
int ii=0;
|
||||||
|
|
||||||
for (i=0; i< dataSize; i++) {
|
for (i=0; i< dataSize; i++) {
|
||||||
@ -103,30 +108,34 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
ii++;
|
ii++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (int ix=0; ix<25; ix++)
|
for (int ix=0; ix<25; ix++)
|
||||||
for (int iy=0; iy<200; iy++)
|
for (int iy=0; iy<200; iy++)
|
||||||
ghost[iy][ix]=0.;
|
ghost[iy][ix]=0.;
|
||||||
|
|
||||||
|
|
||||||
// iframe=0;
|
// iframe=0;
|
||||||
// cout << "data struct created" << endl;
|
// cout << "data struct created" << endl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
double getXTalk(){return xtalk;};
|
double getXTalk(){return xtalk;};
|
||||||
void setXTalk(double g) {xtalk=g;};
|
void setXTalk(double g) {xtalk=g;};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the value of the selected channel for the given dataset as
|
Returns the value of the selected channel for the given dataset as double.
|
||||||
double. \param data pointer to the dataset (including headers etc) \param
|
\param data pointer to the dataset (including headers etc)
|
||||||
ix pixel number in the x direction \param iy pixel number in the y
|
\param ix pixel number in the x direction
|
||||||
direction \returns data for the selected channel, with inversion if
|
\param iy pixel number in the y direction
|
||||||
required as double
|
\returns data for the selected channel, with inversion if required as double
|
||||||
|
|
||||||
*/
|
*/
|
||||||
virtual double getValue(char *data, int ix, int iy=0) {
|
virtual double getValue(char *data, int ix, int iy=0) {
|
||||||
/* cout << " x "<< ix << " y"<< iy << " val " << getChannel(data, ix,
|
/* cout << " x "<< ix << " y"<< iy << " val " << getChannel(data, ix, iy)<< endl;*/
|
||||||
* iy)<< endl;*/
|
|
||||||
/* double val=0, vout=getChannel(data, ix, iy); */
|
/* double val=0, vout=getChannel(data, ix, iy); */
|
||||||
/* int x1=ix%25; */
|
/* int x1=ix%25; */
|
||||||
/* for (int ix=0; ix<16; ix++) { */
|
/* for (int ix=0; ix<16; ix++) { */
|
||||||
@ -142,6 +151,8 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
|
|||||||
return ((double)getChannel(data, ix, iy))+xtalk*getGhost(iy,iy);
|
return ((double)getChannel(data, ix, iy))+xtalk*getGhost(iy,iy);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual void calcGhost(char *data, int ix, int iy) {
|
virtual void calcGhost(char *data, int ix, int iy) {
|
||||||
double val=0;
|
double val=0;
|
||||||
/* for (int ix=0; ix<25; ix++){ */
|
/* for (int ix=0; ix<25; ix++){ */
|
||||||
@ -160,8 +171,11 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
|
|||||||
/* } */
|
/* } */
|
||||||
/* } */
|
/* } */
|
||||||
// cout << "*" << endl;
|
// cout << "*" << endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual void calcGhost(char *data) {
|
virtual void calcGhost(char *data) {
|
||||||
for (int ix=0; ix<25; ix++){
|
for (int ix=0; ix<25; ix++){
|
||||||
for (int iy=0; iy<200; iy++) {
|
for (int iy=0; iy<200; iy++) {
|
||||||
@ -171,14 +185,14 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
|
|||||||
// cout << "*" << endl;
|
// cout << "*" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double getGhost(int ix, int iy) {
|
double getGhost(int ix, int iy) {
|
||||||
if (iy < 200)
|
if (iy<200) return ghost[iy][ix%25];
|
||||||
return ghost[iy][ix % 25];
|
if (iy<400) return ghost[399-iy][ix%25];
|
||||||
if (iy < 400)
|
|
||||||
return ghost[399 - iy][ix % 25];
|
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Returns the frame number for the given dataset. Purely virtual func.
|
Returns the frame number for the given dataset. Purely virtual func.
|
||||||
@ -195,9 +209,9 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
|
|||||||
/* unsigned char bunchid[8]; */
|
/* unsigned char bunchid[8]; */
|
||||||
/* }; */
|
/* }; */
|
||||||
|
|
||||||
int getFrameNumber(char *buff) {
|
|
||||||
return *((int *)buff);
|
|
||||||
}; //*((int*)(buff+5))&0xffffff;};
|
int getFrameNumber(char *buff){return *((int*)buff);};//*((int*)(buff+5))&0xffffff;};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@ -208,34 +222,25 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
int getPacketNumber(char *buff) {
|
int getPacketNumber(char *buff){return 0;}//((*(((int*)(buff+4))))&0xff)+1;};
|
||||||
return 0;
|
|
||||||
} //((*(((int*)(buff+4))))&0xff)+1;};
|
|
||||||
|
|
||||||
/* /\** */
|
/* /\** */
|
||||||
|
|
||||||
/* Loops over a memory slot until a complete frame is found (i.e. all
|
/* Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func */
|
||||||
* packets 0 to nPackets, same frame number). purely virtual func */
|
|
||||||
/* \param data pointer to the memory to be analyzed */
|
/* \param data pointer to the memory to be analyzed */
|
||||||
/* \param ndata reference to the amount of data found for the frame, in
|
/* \param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot */
|
||||||
* case the frame is incomplete at the end of the memory slot */
|
|
||||||
/* \param dsize size of the memory slot to be analyzed */
|
/* \param dsize size of the memory slot to be analyzed */
|
||||||
/* \returns pointer to the beginning of the last good frame (might be
|
/* \returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found */
|
||||||
* incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
/* virtual char *findNextFrame(char *data, int &ndata, int
|
/* virtual char *findNextFrame(char *data, int &ndata, int dsize){ndata=dsize; setDataSize(dsize); return data;}; */
|
||||||
* dsize){ndata=dsize; setDataSize(dsize); return data;}; */
|
|
||||||
|
|
||||||
/* /\** */
|
/* /\** */
|
||||||
|
|
||||||
/* Loops over a file stream until a complete frame is found (i.e. all
|
/* Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors! */
|
||||||
* packets 0 to nPackets, same frame number). Can be overloaded for
|
|
||||||
* different kind of detectors! */
|
|
||||||
/* \param filebin input file stream (binary) */
|
/* \param filebin input file stream (binary) */
|
||||||
/* \returns pointer to the begin of the last good frame, NULL if no
|
/* \returns pointer to the begin of the last good frame, NULL if no frame is found or last frame is incomplete */
|
||||||
* frame is found or last frame is incomplete */
|
|
||||||
|
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
/* virtual char *readNextFrame(ifstream &filebin){ */
|
/* virtual char *readNextFrame(ifstream &filebin){ */
|
||||||
@ -260,34 +265,35 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
|
|||||||
/* return NULL; */
|
/* return NULL; */
|
||||||
/* }; */
|
/* }; */
|
||||||
|
|
||||||
virtual char *readNextFrame(std::ifstream &filebin) {
|
|
||||||
|
virtual char *readNextFrame(ifstream &filebin) {
|
||||||
int ff=-1, np=-1;
|
int ff=-1, np=-1;
|
||||||
return readNextFrame(filebin, ff, np);
|
return readNextFrame(filebin, ff, np);
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual char *readNextFrame(std::ifstream &filebin, int &ff) {
|
virtual char *readNextFrame(ifstream &filebin, int &ff) {
|
||||||
int np=-1;
|
int np=-1;
|
||||||
return readNextFrame(filebin, ff, np);
|
return readNextFrame(filebin, ff, np);
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual char *readNextFrame(std::ifstream &filebin, int &ff, int &np) {
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
||||||
char *data=new char[32*2*nSamples];
|
char *data=new char[32*2*nSamples];
|
||||||
char *d=readNextFrame(filebin, ff, np, data);
|
char *d=readNextFrame(filebin, ff, np, data);
|
||||||
if (d == NULL) {
|
if (d==NULL) {delete [] data; data=NULL;}
|
||||||
delete[] data;
|
|
||||||
data = NULL;
|
|
||||||
}
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual char *readNextFrame(std::ifstream &filebin, int &ff, int &np,
|
|
||||||
char *data) {
|
|
||||||
|
|
||||||
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
||||||
//char *retval=0;
|
//char *retval=0;
|
||||||
// int nd;
|
// int nd;
|
||||||
//int fnum = -1;
|
//int fnum = -1;
|
||||||
np=0;
|
np=0;
|
||||||
// int pn;
|
// int pn;
|
||||||
|
|
||||||
|
|
||||||
// if (ff>=0)
|
// if (ff>=0)
|
||||||
// fnum=ff;
|
// fnum=ff;
|
||||||
|
|
||||||
@ -299,31 +305,50 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Loops over a memory slot until a complete frame is found (i.e. all
|
Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func
|
||||||
packets 0 to nPackets, same frame number). purely virtual func \param
|
\param data pointer to the memory to be analyzed
|
||||||
data pointer to the memory to be analyzed \param ndata reference to the
|
\param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot
|
||||||
amount of data found for the frame, in case the frame is incomplete at
|
\param dsize size of the memory slot to be analyzed
|
||||||
the end of the memory slot \param dsize size of the memory slot to be
|
\returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
||||||
analyzed \returns pointer to the beginning of the last good frame (might
|
|
||||||
be incomplete if ndata smaller than dataSize), or NULL if no frame is
|
|
||||||
found
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
||||||
if (dsize < 32 * 2 * nSamples)
|
if (dsize<32*2*nSamples) ndata=dsize;
|
||||||
ndata = dsize;
|
else ndata=32*2*nSamples;
|
||||||
else
|
|
||||||
ndata = 32 * 2 * nSamples;
|
|
||||||
return data;
|
return data;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// virtual int setFrameNumber(int ff){iframe=ff};
|
// virtual int setFrameNumber(int ff){iframe=ff};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int getPacketNumber(int x, int y) {return 0;};
|
int getPacketNumber(int x, int y) {return 0;};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,25 +4,31 @@
|
|||||||
#define MOENCH03TCTBDATA_H
|
#define MOENCH03TCTBDATA_H
|
||||||
#include "slsDetectorData.h"
|
#include "slsDetectorData.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class moench03TCtbData : public slsDetectorData<uint16_t> {
|
class moench03TCtbData : public slsDetectorData<uint16_t> {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int iframe;
|
int iframe;
|
||||||
int nadc;
|
int nadc;
|
||||||
int sc_width;
|
int sc_width;
|
||||||
int sc_height;
|
int sc_height;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Implements the slsReceiverData structure for the moench02 prototype read
|
Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver
|
||||||
out by a module i.e. using the slsReceiver (160x160 pixels, 40 packets
|
(160x160 pixels, 40 packets 1286 large etc.)
|
||||||
1286 large etc.) \param c crosstalk parameter for the output buffer
|
\param c crosstalk parameter for the output buffer
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
moench03TCtbData(int ns = 5000)
|
|
||||||
: slsDetectorData<uint16_t>(400, 400, ns * 2 * 32, NULL, NULL),
|
moench03TCtbData(int ns=5000): slsDetectorData<uint16_t>(400, 400, ns*2*32, NULL, NULL) , nadc(32), sc_width(25), sc_height(200) {
|
||||||
nadc(32), sc_width(25), sc_height(200) {
|
|
||||||
|
|
||||||
int row, col;
|
int row, col;
|
||||||
|
|
||||||
@ -30,15 +36,21 @@ class moench03TCtbData : public slsDetectorData<uint16_t> {
|
|||||||
int iadc;
|
int iadc;
|
||||||
int ix, iy;
|
int ix, iy;
|
||||||
|
|
||||||
int adc_nr[32] = {300, 325, 350, 375, 300, 325, 350, 375, 200, 225, 250,
|
|
||||||
275, 200, 225, 250, 275, 100, 125, 150, 175, 100, 125,
|
|
||||||
150, 175, 0, 25, 50, 75, 0, 25, 50, 75};
|
int adc_nr[32]={300,325,350,375,300,325,350,375, \
|
||||||
|
200,225,250,275,200,225,250,275,\
|
||||||
|
100,125,150,175,100,125,150,175,\
|
||||||
|
0,25,50,75,0,25,50,75};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* int adc_nr[32]={200,225,250,275,300,325,350,375,\ */
|
/* int adc_nr[32]={200,225,250,275,300,325,350,375,\ */
|
||||||
/* 0,25,50,75,100,125,150,175,\ */
|
/* 0,25,50,75,100,125,150,175,\ */
|
||||||
/* 175,150,125,100,75,50,25,0,\ */
|
/* 175,150,125,100,75,50,25,0,\ */
|
||||||
/* 375,350,325,300,275,250,225,200}; */
|
/* 375,350,325,300,275,250,225,200}; */
|
||||||
|
|
||||||
|
|
||||||
for (iadc=0; iadc<nadc; iadc++) {
|
for (iadc=0; iadc<nadc; iadc++) {
|
||||||
for (int i=0; i<sc_width*sc_height; i++) {
|
for (int i=0; i<sc_width*sc_height; i++) {
|
||||||
col=adc_nr[iadc]+(i%sc_width);
|
col=adc_nr[iadc]+(i%sc_width);
|
||||||
@ -49,8 +61,8 @@ class moench03TCtbData : public slsDetectorData<uint16_t> {
|
|||||||
}
|
}
|
||||||
dataMap[row][col]=(nadc*i+iadc)*2;
|
dataMap[row][col]=(nadc*i+iadc)*2;
|
||||||
if (dataMap[row][col]<0 || dataMap[row][col]>=2*400*400)
|
if (dataMap[row][col]<0 || dataMap[row][col]>=2*400*400)
|
||||||
cout << "Error: pointer " << dataMap[row][col]
|
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
|
||||||
<< " out of range " << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int adc4;
|
int adc4;
|
||||||
@ -68,6 +80,8 @@ class moench03TCtbData : public slsDetectorData<uint16_t> {
|
|||||||
xmap[i]=adc_nr[iadc]+ix;
|
xmap[i]=adc_nr[iadc]+ix;
|
||||||
ymap[i]=ny/2+iy;
|
ymap[i]=ny/2+iy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* for (int i=0; i<nx*ny; i++) { */
|
/* for (int i=0; i<nx*ny; i++) { */
|
||||||
@ -83,12 +97,18 @@ class moench03TCtbData : public slsDetectorData<uint16_t> {
|
|||||||
/* ymap[i]=ny/2+iy; */
|
/* ymap[i]=ny/2+iy; */
|
||||||
/* } */
|
/* } */
|
||||||
|
|
||||||
|
|
||||||
/* } */
|
/* } */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
iframe=0;
|
iframe=0;
|
||||||
// cout << "data struct created" << endl;
|
// cout << "data struct created" << endl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Returns the frame number for the given dataset. Purely virtual func.
|
Returns the frame number for the given dataset. Purely virtual func.
|
||||||
@ -97,10 +117,8 @@ class moench03TCtbData : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
virtual int getFrameNumber(char *buff) {
|
|
||||||
(void)buff;
|
virtual int getFrameNumber(char *buff){(void)buff; return iframe;};
|
||||||
return iframe;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@ -115,28 +133,21 @@ class moench03TCtbData : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Loops over a memory slot until a complete frame is found (i.e. all packets
|
Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func
|
||||||
0 to nPackets, same frame number). purely virtual func \param data pointer
|
\param data pointer to the memory to be analyzed
|
||||||
to the memory to be analyzed \param ndata reference to the amount of data
|
\param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot
|
||||||
found for the frame, in case the frame is incomplete at the end of the
|
\param dsize size of the memory slot to be analyzed
|
||||||
memory slot \param dsize size of the memory slot to be analyzed \returns
|
\returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
||||||
pointer to the beginning of the last good frame (might be incomplete if
|
|
||||||
ndata smaller than dataSize), or NULL if no frame is found
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
virtual char *findNextFrame(char *data, int &ndata, int dsize) {
|
virtual char *findNextFrame(char *data, int &ndata, int dsize){ndata=dsize; setDataSize(dsize); return data;};
|
||||||
ndata = dsize;
|
|
||||||
setDataSize(dsize);
|
|
||||||
return data;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Loops over a file stream until a complete frame is found (i.e. all packets
|
Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors!
|
||||||
0 to nPackets, same frame number). Can be overloaded for different kind of
|
\param filebin input file stream (binary)
|
||||||
detectors! \param filebin input file stream (binary) \returns pointer to
|
\returns pointer to the begin of the last good frame, NULL if no frame is found or last frame is incomplete
|
||||||
the begin of the last good frame, NULL if no frame is found or last frame
|
|
||||||
is incomplete
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
virtual char *readNextFrame(ifstream &filebin){
|
virtual char *readNextFrame(ifstream &filebin){
|
||||||
@ -147,8 +158,7 @@ class moench03TCtbData : public slsDetectorData<uint16_t> {
|
|||||||
afifo_cont=new uint16_t[dataSize/2];
|
afifo_cont=new uint16_t[dataSize/2];
|
||||||
while (filebin.read(((char*)afifo_cont)+ib,2)) {
|
while (filebin.read(((char*)afifo_cont)+ib,2)) {
|
||||||
ib+=2;
|
ib+=2;
|
||||||
if (ib == dataSize)
|
if (ib==dataSize) break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (ib>0) {
|
if (ib>0) {
|
||||||
iframe++;
|
iframe++;
|
||||||
@ -161,6 +171,12 @@ class moench03TCtbData : public slsDetectorData<uint16_t> {
|
|||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -8,8 +8,7 @@
|
|||||||
/**
|
/**
|
||||||
@short structure for a Detector Packet or Image Header
|
@short structure for a Detector Packet or Image Header
|
||||||
@li frameNumber is the frame number
|
@li frameNumber is the frame number
|
||||||
@li expLength is the subframe number (32 bit eiger) or real time exposure
|
@li expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
|
||||||
time in 100ns (others)
|
|
||||||
@li packetNumber is the packet number
|
@li packetNumber is the packet number
|
||||||
@li bunchId is the bunch id from beamline
|
@li bunchId is the bunch id from beamline
|
||||||
@li timestamp is the time stamp with 10 MHz clock
|
@li timestamp is the time stamp with 10 MHz clock
|
||||||
@ -24,13 +23,11 @@
|
|||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint64_t frameNumber; /**< is the frame number */
|
uint64_t frameNumber; /**< is the frame number */
|
||||||
uint32_t expLength; /**< is the subframe number (32 bit eiger) or real time
|
uint32_t expLength; /**< is the subframe number (32 bit eiger) or real time exposure time in 100ns (others) */
|
||||||
exposure time in 100ns (others) */
|
|
||||||
uint32_t packetNumber; /**< is the packet number */
|
uint32_t packetNumber; /**< is the packet number */
|
||||||
uint64_t bunchId; /**< is the bunch id from beamline */
|
uint64_t bunchId; /**< is the bunch id from beamline */
|
||||||
uint64_t timestamp; /**< is the time stamp with 10 MHz clock */
|
uint64_t timestamp; /**< is the time stamp with 10 MHz clock */
|
||||||
uint16_t modId; /**< is the unique module id (unique even for left, right,
|
uint16_t modId; /**< is the unique module id (unique even for left, right, top, bottom) */
|
||||||
top, bottom) */
|
|
||||||
uint16_t xCoord; /**< is the x coordinate in the complete detector system */
|
uint16_t xCoord; /**< is the x coordinate in the complete detector system */
|
||||||
uint16_t yCoord; /**< is the y coordinate in the complete detector system */
|
uint16_t yCoord; /**< is the y coordinate in the complete detector system */
|
||||||
uint16_t zCoord; /**< is the z coordinate in the complete detector system */
|
uint16_t zCoord; /**< is the z coordinate in the complete detector system */
|
||||||
@ -38,14 +35,17 @@ typedef struct {
|
|||||||
uint16_t roundRNumber; /**< is the round robin set number */
|
uint16_t roundRNumber; /**< is the round robin set number */
|
||||||
uint8_t detType; /**< is the detector type see :: detectorType */
|
uint8_t detType; /**< is the detector type see :: detectorType */
|
||||||
uint8_t version; /**< is the version number of this structure format */
|
uint8_t version; /**< is the version number of this structure format */
|
||||||
uint64_t
|
uint64_t packetCaught[8]; /**< is the version number of this structure format */
|
||||||
packetCaught[8]; /**< is the version number of this structure format */
|
|
||||||
|
|
||||||
} sls_detector_header;
|
} sls_detector_header;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class moench04CtbReceiver10GbData : public slsDetectorData<uint16_t> {
|
class moench04CtbReceiver10GbData : public slsDetectorData<uint16_t> {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int iframe;
|
int iframe;
|
||||||
int nadc;
|
int nadc;
|
||||||
int sc_width;
|
int sc_width;
|
||||||
@ -53,25 +53,25 @@ class moench04CtbReceiver10GbData : public slsDetectorData<uint16_t> {
|
|||||||
const int aSamples;
|
const int aSamples;
|
||||||
const int dSamples;
|
const int dSamples;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Implements the slsReceiverData structure for the moench02 prototype read
|
Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver
|
||||||
out by a module i.e. using the slsReceiver (160x160 pixels, 40 packets
|
(160x160 pixels, 40 packets 1286 large etc.)
|
||||||
1286 large etc.) \param c crosstalk parameter for the output buffer
|
\param c crosstalk parameter for the output buffer
|
||||||
|
|
||||||
*/
|
*/
|
||||||
moench04CtbReceiver10GbData(int nas = 5000, int nds = 0)
|
moench04CtbReceiver10GbData(int nas=5000, int nds=0): slsDetectorData<uint16_t>(400, 400, nas*2*32+sizeof(sls_detector_header)+nds*8), aSamples(nas), dSamples(nds) {
|
||||||
: slsDetectorData<uint16_t>(
|
|
||||||
400, 400, nas * 2 * 32 + sizeof(sls_detector_header) + nds * 8),
|
|
||||||
aSamples(nas), dSamples(nds) {
|
|
||||||
|
|
||||||
int nadc=32;
|
int nadc=32;
|
||||||
int sc_width=25;
|
int sc_width=25;
|
||||||
int sc_height=200;
|
int sc_height=200;
|
||||||
|
|
||||||
int adc_nr[32] = {9, 8, 11, 10, 13, 12, 15, 14, 1, 0, 3,
|
int adc_nr[32]={9, 8,11,10,13,12,15,14,1,0,3,2,5,4,7,6,23,22,21,20,19,18,17,16,31,30,29,28,27,26,25,24 };
|
||||||
2, 5, 4, 7, 6, 23, 22, 21, 20, 19, 18,
|
|
||||||
17, 16, 31, 30, 29, 28, 27, 26, 25, 24};
|
|
||||||
|
|
||||||
int row, col;
|
int row, col;
|
||||||
|
|
||||||
@ -99,17 +99,11 @@ class moench04CtbReceiver10GbData : public slsDetectorData<uint16_t> {
|
|||||||
row=200+i/sc_width;
|
row=200+i/sc_width;
|
||||||
}
|
}
|
||||||
if (nds>0)
|
if (nds>0)
|
||||||
dataMap[row][col] =
|
dataMap[row][col]=sizeof(sls_detector_header)+((nadc+4)*i+iadc)*2;//+16*(ip+1);
|
||||||
sizeof(sls_detector_header) +
|
|
||||||
((nadc + 4) * i + iadc) * 2; //+16*(ip+1);
|
|
||||||
else
|
else
|
||||||
dataMap[row][col] =
|
dataMap[row][col]=sizeof(sls_detector_header)+(nadc*i+iadc)*2;//+16*(ip+1);
|
||||||
sizeof(sls_detector_header) +
|
if (dataMap[row][col]<0 || dataMap[row][col]>=aSamples*2*32)
|
||||||
(nadc * i + iadc) * 2; //+16*(ip+1);
|
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
|
||||||
if (dataMap[row][col] < 0 ||
|
|
||||||
dataMap[row][col] >= aSamples * 2 * 32)
|
|
||||||
cout << "Error: pointer " << dataMap[row][col]
|
|
||||||
<< " out of range " << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,6 +120,7 @@ class moench04CtbReceiver10GbData : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
/* for (ibyte=0; ibyte<dataSize; ibyte++) { */
|
/* for (ibyte=0; ibyte<dataSize; ibyte++) { */
|
||||||
|
|
||||||
|
|
||||||
/* for (ipacket=0; ipacket<npackets; ipacket++) { */
|
/* for (ipacket=0; ipacket<npackets; ipacket++) { */
|
||||||
/* for (ibyte=0; ibyte< 8192/2; ibyte++) { */
|
/* for (ibyte=0; ibyte< 8192/2; ibyte++) { */
|
||||||
/* i=ipacket*8208/2+ibyte; */
|
/* i=ipacket*8208/2+ibyte; */
|
||||||
@ -152,6 +147,8 @@ class moench04CtbReceiver10GbData : public slsDetectorData<uint16_t> {
|
|||||||
// cout << "data struct created" << endl;
|
// cout << "data struct created" << endl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Returns the frame number for the given dataset. Purely virtual func.
|
Returns the frame number for the given dataset. Purely virtual func.
|
||||||
@ -168,9 +165,9 @@ class moench04CtbReceiver10GbData : public slsDetectorData<uint16_t> {
|
|||||||
/* unsigned char bunchid[8]; */
|
/* unsigned char bunchid[8]; */
|
||||||
/* }; */
|
/* }; */
|
||||||
|
|
||||||
int getFrameNumber(char *buff) {
|
|
||||||
return ((sls_detector_header *)buff)->frameNumber;
|
|
||||||
}; //*((int*)(buff+5))&0xffffff;};
|
int getFrameNumber(char *buff){return ((sls_detector_header*)buff)->frameNumber;};//*((int*)(buff+5))&0xffffff;};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@ -181,34 +178,25 @@ class moench04CtbReceiver10GbData : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
int getPacketNumber(char *buff) {
|
int getPacketNumber(char *buff){return ((sls_detector_header*)buff)->packetNumber;}//((*(((int*)(buff+4))))&0xff)+1;};
|
||||||
return ((sls_detector_header *)buff)->packetNumber;
|
|
||||||
} //((*(((int*)(buff+4))))&0xff)+1;};
|
|
||||||
|
|
||||||
/* /\** */
|
/* /\** */
|
||||||
|
|
||||||
/* Loops over a memory slot until a complete frame is found (i.e. all
|
/* Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func */
|
||||||
* packets 0 to nPackets, same frame number). purely virtual func */
|
|
||||||
/* \param data pointer to the memory to be analyzed */
|
/* \param data pointer to the memory to be analyzed */
|
||||||
/* \param ndata reference to the amount of data found for the frame, in
|
/* \param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot */
|
||||||
* case the frame is incomplete at the end of the memory slot */
|
|
||||||
/* \param dsize size of the memory slot to be analyzed */
|
/* \param dsize size of the memory slot to be analyzed */
|
||||||
/* \returns pointer to the beginning of the last good frame (might be
|
/* \returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found */
|
||||||
* incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
/* virtual char *findNextFrame(char *data, int &ndata, int
|
/* virtual char *findNextFrame(char *data, int &ndata, int dsize){ndata=dsize; setDataSize(dsize); return data;}; */
|
||||||
* dsize){ndata=dsize; setDataSize(dsize); return data;}; */
|
|
||||||
|
|
||||||
/* /\** */
|
/* /\** */
|
||||||
|
|
||||||
/* Loops over a file stream until a complete frame is found (i.e. all
|
/* Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors! */
|
||||||
* packets 0 to nPackets, same frame number). Can be overloaded for
|
|
||||||
* different kind of detectors! */
|
|
||||||
/* \param filebin input file stream (binary) */
|
/* \param filebin input file stream (binary) */
|
||||||
/* \returns pointer to the begin of the last good frame, NULL if no
|
/* \returns pointer to the begin of the last good frame, NULL if no frame is found or last frame is incomplete */
|
||||||
* frame is found or last frame is incomplete */
|
|
||||||
|
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
/* virtual char *readNextFrame(ifstream &filebin){ */
|
/* virtual char *readNextFrame(ifstream &filebin){ */
|
||||||
@ -233,6 +221,7 @@ class moench04CtbReceiver10GbData : public slsDetectorData<uint16_t> {
|
|||||||
/* return NULL; */
|
/* return NULL; */
|
||||||
/* }; */
|
/* }; */
|
||||||
|
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream &filebin) {
|
virtual char *readNextFrame(ifstream &filebin) {
|
||||||
int ff=-1, np=-1;
|
int ff=-1, np=-1;
|
||||||
return readNextFrame(filebin, ff, np);
|
return readNextFrame(filebin, ff, np);
|
||||||
@ -246,15 +235,14 @@ class moench04CtbReceiver10GbData : public slsDetectorData<uint16_t> {
|
|||||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
||||||
char *data=new char[dataSize];
|
char *data=new char[dataSize];
|
||||||
char *d=readNextFrame(filebin, ff, np, data);
|
char *d=readNextFrame(filebin, ff, np, data);
|
||||||
if (d == NULL) {
|
if (d==NULL) {delete [] data; data=NULL;}
|
||||||
delete[] data;
|
|
||||||
data = NULL;
|
|
||||||
}
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream &filebin, int &ff, int &np,
|
|
||||||
char *data) {
|
|
||||||
|
|
||||||
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
||||||
char *retval=0;
|
char *retval=0;
|
||||||
int nd;
|
int nd;
|
||||||
int fnum = -1;
|
int fnum = -1;
|
||||||
@ -273,29 +261,36 @@ class moench04CtbReceiver10GbData : public slsDetectorData<uint16_t> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Loops over a memory slot until a complete frame is found (i.e. all
|
Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func
|
||||||
packets 0 to nPackets, same frame number). purely virtual func \param
|
\param data pointer to the memory to be analyzed
|
||||||
data pointer to the memory to be analyzed \param ndata reference to the
|
\param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot
|
||||||
amount of data found for the frame, in case the frame is incomplete at
|
\param dsize size of the memory slot to be analyzed
|
||||||
the end of the memory slot \param dsize size of the memory slot to be
|
\returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
||||||
analyzed \returns pointer to the beginning of the last good frame (might
|
|
||||||
be incomplete if ndata smaller than dataSize), or NULL if no frame is
|
|
||||||
found
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
||||||
if (dsize < dataSize)
|
if (dsize<dataSize) ndata=dsize;
|
||||||
ndata = dsize;
|
else ndata=dataSize;
|
||||||
else
|
|
||||||
ndata = dataSize;
|
|
||||||
return data;
|
return data;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
//int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -8,8 +8,7 @@
|
|||||||
/**
|
/**
|
||||||
@short structure for a Detector Packet or Image Header
|
@short structure for a Detector Packet or Image Header
|
||||||
@li frameNumber is the frame number
|
@li frameNumber is the frame number
|
||||||
@li expLength is the subframe number (32 bit eiger) or real time exposure
|
@li expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
|
||||||
time in 100ns (others)
|
|
||||||
@li packetNumber is the packet number
|
@li packetNumber is the packet number
|
||||||
@li bunchId is the bunch id from beamline
|
@li bunchId is the bunch id from beamline
|
||||||
@li timestamp is the time stamp with 10 MHz clock
|
@li timestamp is the time stamp with 10 MHz clock
|
||||||
@ -24,13 +23,11 @@
|
|||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint64_t frameNumber; /**< is the frame number */
|
uint64_t frameNumber; /**< is the frame number */
|
||||||
uint32_t expLength; /**< is the subframe number (32 bit eiger) or real time
|
uint32_t expLength; /**< is the subframe number (32 bit eiger) or real time exposure time in 100ns (others) */
|
||||||
exposure time in 100ns (others) */
|
|
||||||
uint32_t packetNumber; /**< is the packet number */
|
uint32_t packetNumber; /**< is the packet number */
|
||||||
uint64_t bunchId; /**< is the bunch id from beamline */
|
uint64_t bunchId; /**< is the bunch id from beamline */
|
||||||
uint64_t timestamp; /**< is the time stamp with 10 MHz clock */
|
uint64_t timestamp; /**< is the time stamp with 10 MHz clock */
|
||||||
uint16_t modId; /**< is the unique module id (unique even for left, right,
|
uint16_t modId; /**< is the unique module id (unique even for left, right, top, bottom) */
|
||||||
top, bottom) */
|
|
||||||
uint16_t xCoord; /**< is the x coordinate in the complete detector system */
|
uint16_t xCoord; /**< is the x coordinate in the complete detector system */
|
||||||
uint16_t yCoord; /**< is the y coordinate in the complete detector system */
|
uint16_t yCoord; /**< is the y coordinate in the complete detector system */
|
||||||
uint16_t zCoord; /**< is the z coordinate in the complete detector system */
|
uint16_t zCoord; /**< is the z coordinate in the complete detector system */
|
||||||
@ -38,14 +35,17 @@ typedef struct {
|
|||||||
uint16_t roundRNumber; /**< is the round robin set number */
|
uint16_t roundRNumber; /**< is the round robin set number */
|
||||||
uint8_t detType; /**< is the detector type see :: detectorType */
|
uint8_t detType; /**< is the detector type see :: detectorType */
|
||||||
uint8_t version; /**< is the version number of this structure format */
|
uint8_t version; /**< is the version number of this structure format */
|
||||||
uint64_t
|
uint64_t packetCaught[8]; /**< is the version number of this structure format */
|
||||||
packetCaught[8]; /**< is the version number of this structure format */
|
|
||||||
|
|
||||||
} sls_detector_header;
|
} sls_detector_header;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class moench04CtbReceiverData : public slsDetectorData<uint16_t> {
|
class moench04CtbReceiverData : public slsDetectorData<uint16_t> {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int iframe;
|
int iframe;
|
||||||
int nadc;
|
int nadc;
|
||||||
int sc_width;
|
int sc_width;
|
||||||
@ -53,25 +53,25 @@ class moench04CtbReceiverData : public slsDetectorData<uint16_t> {
|
|||||||
const int aSamples;
|
const int aSamples;
|
||||||
const int dSamples;
|
const int dSamples;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Implements the slsReceiverData structure for the moench02 prototype read
|
Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver
|
||||||
out by a module i.e. using the slsReceiver (160x160 pixels, 40 packets
|
(160x160 pixels, 40 packets 1286 large etc.)
|
||||||
1286 large etc.) \param c crosstalk parameter for the output buffer
|
\param c crosstalk parameter for the output buffer
|
||||||
|
|
||||||
*/
|
*/
|
||||||
moench04CtbReceiverData(int nas = 5000, int nds = 0)
|
moench04CtbReceiverData(int nas=5000, int nds=0): slsDetectorData<uint16_t>(400, 400, nas*2*32+sizeof(sls_detector_header)+nds*8), aSamples(nas), dSamples(nds) {
|
||||||
: slsDetectorData<uint16_t>(
|
|
||||||
400, 400, nas * 2 * 32 + sizeof(sls_detector_header) + nds * 8),
|
|
||||||
aSamples(nas), dSamples(nds) {
|
|
||||||
|
|
||||||
int nadc=32;
|
int nadc=32;
|
||||||
int sc_width=25;
|
int sc_width=25;
|
||||||
int sc_height=200;
|
int sc_height=200;
|
||||||
|
|
||||||
int adc_nr[32] = {9, 8, 11, 10, 13, 12, 15, 14, 1, 0, 3,
|
int adc_nr[32]={9, 8,11,10,13,12,15,14,1,0,3,2,5,4,7,6,23,22,21,20,19,18,17,16,31,30,29,28,27,26,25,24 };
|
||||||
2, 5, 4, 7, 6, 23, 22, 21, 20, 19, 18,
|
|
||||||
17, 16, 31, 30, 29, 28, 27, 26, 25, 24};
|
|
||||||
|
|
||||||
int row, col;
|
int row, col;
|
||||||
|
|
||||||
@ -98,13 +98,9 @@ class moench04CtbReceiverData : public slsDetectorData<uint16_t> {
|
|||||||
} else {
|
} else {
|
||||||
row=200+i/sc_width;
|
row=200+i/sc_width;
|
||||||
}
|
}
|
||||||
dataMap[row][col] = sizeof(sls_detector_header) +
|
dataMap[row][col]=sizeof(sls_detector_header)+(nadc*i+iadc)*2;//+16*(ip+1);
|
||||||
(nadc * i + iadc) * 2; //+16*(ip+1);
|
if (dataMap[row][col]<0 || dataMap[row][col]>=aSamples*2*32)
|
||||||
if (dataMap[row][col] < 0 ||
|
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
|
||||||
dataMap[row][col] >=
|
|
||||||
aSamples * 2 * 32 + sizeof(sls_detector_header))
|
|
||||||
cout << "Error: pointer " << dataMap[row][col]
|
|
||||||
<< " out of range " << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,6 +117,7 @@ class moench04CtbReceiverData : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
/* for (ibyte=0; ibyte<dataSize; ibyte++) { */
|
/* for (ibyte=0; ibyte<dataSize; ibyte++) { */
|
||||||
|
|
||||||
|
|
||||||
/* for (ipacket=0; ipacket<npackets; ipacket++) { */
|
/* for (ipacket=0; ipacket<npackets; ipacket++) { */
|
||||||
/* for (ibyte=0; ibyte< 8192/2; ibyte++) { */
|
/* for (ibyte=0; ibyte< 8192/2; ibyte++) { */
|
||||||
/* i=ipacket*8208/2+ibyte; */
|
/* i=ipacket*8208/2+ibyte; */
|
||||||
@ -147,6 +144,8 @@ class moench04CtbReceiverData : public slsDetectorData<uint16_t> {
|
|||||||
// cout << "data struct created" << endl;
|
// cout << "data struct created" << endl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Returns the frame number for the given dataset. Purely virtual func.
|
Returns the frame number for the given dataset. Purely virtual func.
|
||||||
@ -163,9 +162,9 @@ class moench04CtbReceiverData : public slsDetectorData<uint16_t> {
|
|||||||
/* unsigned char bunchid[8]; */
|
/* unsigned char bunchid[8]; */
|
||||||
/* }; */
|
/* }; */
|
||||||
|
|
||||||
int getFrameNumber(char *buff) {
|
|
||||||
return ((sls_detector_header *)buff)->frameNumber;
|
|
||||||
}; //*((int*)(buff+5))&0xffffff;};
|
int getFrameNumber(char *buff){return ((sls_detector_header*)buff)->frameNumber;};//*((int*)(buff+5))&0xffffff;};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@ -176,34 +175,25 @@ class moench04CtbReceiverData : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
int getPacketNumber(char *buff) {
|
int getPacketNumber(char *buff){return ((sls_detector_header*)buff)->packetNumber;}//((*(((int*)(buff+4))))&0xff)+1;};
|
||||||
return ((sls_detector_header *)buff)->packetNumber;
|
|
||||||
} //((*(((int*)(buff+4))))&0xff)+1;};
|
|
||||||
|
|
||||||
/* /\** */
|
/* /\** */
|
||||||
|
|
||||||
/* Loops over a memory slot until a complete frame is found (i.e. all
|
/* Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func */
|
||||||
* packets 0 to nPackets, same frame number). purely virtual func */
|
|
||||||
/* \param data pointer to the memory to be analyzed */
|
/* \param data pointer to the memory to be analyzed */
|
||||||
/* \param ndata reference to the amount of data found for the frame, in
|
/* \param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot */
|
||||||
* case the frame is incomplete at the end of the memory slot */
|
|
||||||
/* \param dsize size of the memory slot to be analyzed */
|
/* \param dsize size of the memory slot to be analyzed */
|
||||||
/* \returns pointer to the beginning of the last good frame (might be
|
/* \returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found */
|
||||||
* incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
/* virtual char *findNextFrame(char *data, int &ndata, int
|
/* virtual char *findNextFrame(char *data, int &ndata, int dsize){ndata=dsize; setDataSize(dsize); return data;}; */
|
||||||
* dsize){ndata=dsize; setDataSize(dsize); return data;}; */
|
|
||||||
|
|
||||||
/* /\** */
|
/* /\** */
|
||||||
|
|
||||||
/* Loops over a file stream until a complete frame is found (i.e. all
|
/* Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors! */
|
||||||
* packets 0 to nPackets, same frame number). Can be overloaded for
|
|
||||||
* different kind of detectors! */
|
|
||||||
/* \param filebin input file stream (binary) */
|
/* \param filebin input file stream (binary) */
|
||||||
/* \returns pointer to the begin of the last good frame, NULL if no
|
/* \returns pointer to the begin of the last good frame, NULL if no frame is found or last frame is incomplete */
|
||||||
* frame is found or last frame is incomplete */
|
|
||||||
|
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
/* virtual char *readNextFrame(ifstream &filebin){ */
|
/* virtual char *readNextFrame(ifstream &filebin){ */
|
||||||
@ -228,6 +218,7 @@ class moench04CtbReceiverData : public slsDetectorData<uint16_t> {
|
|||||||
/* return NULL; */
|
/* return NULL; */
|
||||||
/* }; */
|
/* }; */
|
||||||
|
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream &filebin) {
|
virtual char *readNextFrame(ifstream &filebin) {
|
||||||
int ff=-1, np=-1;
|
int ff=-1, np=-1;
|
||||||
return readNextFrame(filebin, ff, np);
|
return readNextFrame(filebin, ff, np);
|
||||||
@ -241,15 +232,14 @@ class moench04CtbReceiverData : public slsDetectorData<uint16_t> {
|
|||||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
||||||
char *data=new char[dataSize];
|
char *data=new char[dataSize];
|
||||||
char *d=readNextFrame(filebin, ff, np, data);
|
char *d=readNextFrame(filebin, ff, np, data);
|
||||||
if (d == NULL) {
|
if (d==NULL) {delete [] data; data=NULL;}
|
||||||
delete[] data;
|
|
||||||
data = NULL;
|
|
||||||
}
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream &filebin, int &ff, int &np,
|
|
||||||
char *data) {
|
|
||||||
|
|
||||||
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
||||||
char *retval=0;
|
char *retval=0;
|
||||||
int nd;
|
int nd;
|
||||||
int fnum = -1;
|
int fnum = -1;
|
||||||
@ -268,29 +258,36 @@ class moench04CtbReceiverData : public slsDetectorData<uint16_t> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Loops over a memory slot until a complete frame is found (i.e. all
|
Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func
|
||||||
packets 0 to nPackets, same frame number). purely virtual func \param
|
\param data pointer to the memory to be analyzed
|
||||||
data pointer to the memory to be analyzed \param ndata reference to the
|
\param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot
|
||||||
amount of data found for the frame, in case the frame is incomplete at
|
\param dsize size of the memory slot to be analyzed
|
||||||
the end of the memory slot \param dsize size of the memory slot to be
|
\returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
||||||
analyzed \returns pointer to the beginning of the last good frame (might
|
|
||||||
be incomplete if ndata smaller than dataSize), or NULL if no frame is
|
|
||||||
found
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
||||||
if (dsize < dataSize)
|
if (dsize<dataSize) ndata=dsize;
|
||||||
ndata = dsize;
|
else ndata=dataSize;
|
||||||
else
|
|
||||||
ndata = dataSize;
|
|
||||||
return data;
|
return data;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
//int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,64 +3,70 @@
|
|||||||
#ifndef MOENCH04ZMQ10GBDATA_H
|
#ifndef MOENCH04ZMQ10GBDATA_H
|
||||||
#define MOENCH04ZMQ10GBDATA_H
|
#define MOENCH04ZMQ10GBDATA_H
|
||||||
#include "slsDetectorData.h"
|
#include "slsDetectorData.h"
|
||||||
#include "sls/sls_detector_defs.h"
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
|
||||||
class moench04CtbZmq10GbData : public slsDetectorData<uint16_t> {
|
class moench04CtbZmq10GbData : public slsDetectorData<uint16_t> {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int iframe;
|
int iframe;
|
||||||
int nadc;
|
int nadc;
|
||||||
int sc_width;
|
int sc_width;
|
||||||
int sc_height;
|
int sc_height;
|
||||||
const int aSamples;
|
const int aSamples;
|
||||||
const int dSamples;
|
const int dSamples;
|
||||||
int off;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Implements the slsReceiverData structure for the moench02 prototype read
|
Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver
|
||||||
out by a module i.e. using the slsReceiver (160x160 pixels, 40 packets
|
(160x160 pixels, 40 packets 1286 large etc.)
|
||||||
1286 large etc.) \param c crosstalk parameter for the output buffer
|
\param c crosstalk parameter for the output buffer
|
||||||
|
|
||||||
*/
|
*/
|
||||||
// moench04CtbZmq10GbData(int nas=5000, int nds=0):
|
//moench04CtbZmq10GbData(int nas=5000, int nds=0): slsDetectorData<uint16_t>(400, 400, nas*2*32+nds*8), aSamples(nas), dSamples(nds), nadc(32), sc_width(25), sc_height(200) {
|
||||||
// slsDetectorData<uint16_t>(400, 400, nas*2*32+nds*8), aSamples(nas),
|
moench04CtbZmq10GbData(int nas=5000, int nds=0): slsDetectorData<uint16_t>(400, 400, (nas > 0) && (nds>0) ? max(nas,nds)*(32*2+8) : nas*32*2+nds*8), nadc(32), sc_width(25), sc_height(200), aSamples(nas), dSamples(nds) {
|
||||||
// dSamples(nds), nadc(32), sc_width(25), sc_height(200) {
|
|
||||||
|
|
||||||
moench04CtbZmq10GbData(int nas = 5000, int nds = 0)
|
/* int ds; */
|
||||||
: slsDetectorData<uint16_t>(400, 400,
|
/* if (nas && nds) */
|
||||||
#ifdef RAWDATA
|
/* if (nds>nas) */
|
||||||
sizeof(slsDetectorDefs::sls_receiver_header) +
|
/* ds=nds*(32*2+8); */
|
||||||
#endif
|
/* else */
|
||||||
((nas > 0) && (nds > 0)
|
/* ds=nas*(32*2+8); */
|
||||||
? max(nas, nds) * (32 * 2 + 8)
|
/* else */
|
||||||
: nas * 32 * 2 + nds * 8)),
|
/* ds=nas*32*2+nds*8; */
|
||||||
nadc(32), sc_width(25), sc_height(200), aSamples(nas), dSamples(nds) {
|
|
||||||
#ifdef RAWDATA
|
|
||||||
off=sizeof(slsDetectorDefs::sls_receiver_header);
|
|
||||||
#endif
|
|
||||||
#ifndef RAWDATA
|
|
||||||
#ifndef CTB
|
|
||||||
off=sizeof(int);
|
|
||||||
#endif
|
|
||||||
#ifdef CTB
|
|
||||||
off=0;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
cout << "off is " << off << endl;
|
/* new slsDetectorData<uint16_t>(400, 400, ds); */
|
||||||
|
|
||||||
if (off>0)
|
int adc_nr[32]={9, 8,11,10,13,12,15,14,1,0,3,2,5,4,7,6,23,22,21,20,19,18,17,16,31,30,29,28,27,26,25,24 };
|
||||||
cout << "M04 RAW DATA NEW " << endl;
|
|
||||||
|
/*
|
||||||
|
iadc=ptr%32
|
||||||
|
isample=ptr/32
|
||||||
|
|
||||||
|
col=(adc_nr[iadc]%16)*25+isample%25
|
||||||
|
if (adc_nr[iadc]<16)
|
||||||
|
row=199-isample/25;
|
||||||
else
|
else
|
||||||
cout << "M04 ZMQ DATA NEW " << endl;
|
row=200+isample/25
|
||||||
|
|
||||||
int adc_nr[32] = {9, 8, 11, 10, 13, 12, 15, 14, 1, 0, 3,
|
|
||||||
2, 5, 4, 7, 6, 23, 22, 21, 20, 19, 18,
|
|
||||||
17, 16, 31, 30, 29, 28, 27, 26, 25, 24};
|
|
||||||
|
|
||||||
|
|
||||||
|
adc0 col(9*25..10*25-1) row(199..0)
|
||||||
|
adc1 col(8*25..9*25-1) row(199..0)
|
||||||
|
adc2 col(11*25..12*25-1) row(199..0)
|
||||||
|
adc3 col(10*25..11*25-1) row(199..0)
|
||||||
|
adc4 col(13*25..14*25-1) row(199..0)
|
||||||
|
adc5 col(12*25..13*25-1) row(199..0)
|
||||||
|
adc6 col(15*25..16*25-1) row(199..0)
|
||||||
|
adc7 col(14*25..15*25-1) row(199..0)
|
||||||
|
adc8 col(1*25..2*25-1) row(199..0)
|
||||||
|
*/
|
||||||
|
|
||||||
int row, col;
|
int row, col;
|
||||||
|
|
||||||
@ -87,52 +93,72 @@ class moench04CtbZmq10GbData : public slsDetectorData<uint16_t> {
|
|||||||
row=200+i/sc_width;
|
row=200+i/sc_width;
|
||||||
}
|
}
|
||||||
if (nds>0)
|
if (nds>0)
|
||||||
dataMap[row][col] =
|
dataMap[row][col]=((nadc+4)*i+iadc)*2;//+16*(ip+1);
|
||||||
((nadc + 4) * i + iadc) * 2 + off; //+16*(ip+1);
|
|
||||||
else
|
else
|
||||||
dataMap[row][col] =
|
dataMap[row][col]=(nadc*i+iadc)*2;//+16*(ip+1);
|
||||||
(nadc * i + iadc) * 2 + off; //+16*(ip+1);
|
if (dataMap[row][col]<0 || dataMap[row][col]>=aSamples*2*32)
|
||||||
if (dataMap[row][col] < 0 ||
|
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
|
||||||
dataMap[row][col] >= aSamples * 2 * 32 + off)
|
|
||||||
cout << "Error: pointer " << dataMap[row][col]
|
|
||||||
<< " out of range " << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* for (ibyte=0; ibyte<sizeof(sls_detector_header)/2; ibyte++){ */
|
||||||
|
/* xmap[ibyte]=-1; */
|
||||||
|
/* ymap[ibyte]=-1; */
|
||||||
|
/* } */
|
||||||
|
/* int off=sizeof(sls_detector_header)/2; */
|
||||||
|
|
||||||
|
/* for (ibyte=0; ibyte<dataSize; ibyte++) { */
|
||||||
|
|
||||||
|
|
||||||
|
/* for (ipacket=0; ipacket<npackets; ipacket++) { */
|
||||||
|
/* for (ibyte=0; ibyte< 8192/2; ibyte++) { */
|
||||||
|
/* i=ipacket*8208/2+ibyte; */
|
||||||
|
/* isample=ii/nadc; */
|
||||||
|
/* if (isample<nSamples) { */
|
||||||
|
/* iadc=ii%nadc; */
|
||||||
|
/* adc4 = (int)iadc/4; */
|
||||||
|
/* ix=isample%sc_width; */
|
||||||
|
/* iy=isample/sc_width; */
|
||||||
|
/* if (adc4%2==0) { */
|
||||||
|
/* xmap[i+off]=adc_nr[iadc]+ix; */
|
||||||
|
/* ymap[i+off]=ny/2-1-iy; */
|
||||||
|
/* } else { */
|
||||||
|
/* xmap[i+off]=adc_nr[iadc]+ix; */
|
||||||
|
/* ymap[i+off]=ny/2+iy; */
|
||||||
|
/* } */
|
||||||
|
/* } */
|
||||||
|
/* ii++; */
|
||||||
|
/* // } */
|
||||||
|
/* } */
|
||||||
|
/* } */
|
||||||
|
|
||||||
iframe=0;
|
iframe=0;
|
||||||
// cout << "data struct created" << endl;
|
// cout << "data struct created" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int getGain(char *data, int x, int y) {
|
int getGain(char *data, int x, int y) {
|
||||||
// int aoff=aSamples*2*32;
|
// int aoff=aSamples*2*32;
|
||||||
int irow;
|
int irow;
|
||||||
int isc=x/sc_width;
|
int isc=x/sc_width;
|
||||||
int icol=x%sc_width;
|
int icol=x%sc_width;
|
||||||
if (y < 200)
|
if (y<200) irow=sc_height-1-y;
|
||||||
irow = sc_height - 1 - y;
|
|
||||||
else {
|
else {
|
||||||
irow=y-sc_height;
|
irow=y-sc_height;
|
||||||
isc++;
|
isc++;
|
||||||
}
|
}
|
||||||
int ibit[32] = {-1, -1, -1, -1, -1, -1, 1, 3, 5, 7, -1,
|
int ibit[32]={-1,-1,-1,-1,-1,-1,1,3,5,7,-1,-1,-1,-1,-1,-1,62,60,58,56,54,52,50,48,63,61,59,57,55,53,51,49};
|
||||||
-1, -1, -1, -1, -1, 62, 60, 58, 56, 54, 52,
|
|
||||||
50, 48, 63, 61, 59, 57, 55, 53, 51, 49};
|
|
||||||
int isample=irow*sc_width+icol;
|
int isample=irow*sc_width+icol;
|
||||||
|
|
||||||
uint64_t sample;
|
uint64_t sample;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
if (isc < 0 || isc >= 32)
|
if (isc<0 || isc>=32) return 0;
|
||||||
return 0;
|
if (ibit[isc]<0 || ibit[isc]>=64) return 0;
|
||||||
if (ibit[isc] < 0 || ibit[isc] >= 64)
|
|
||||||
return 0;
|
|
||||||
if (dSamples>isample) {
|
if (dSamples>isample) {
|
||||||
ptr=data+32*(isample+1)+8*isample;
|
ptr=data+32*(isample+1)+8*isample;
|
||||||
sample=*((uint64_t*)ptr);
|
sample=*((uint64_t*)ptr);
|
||||||
// cout << isc << " " << ibit[isc] << " " << isample << hex <<
|
// cout << isc << " " << ibit[isc] << " " << isample << hex << sample << dec << endl;
|
||||||
// sample << dec << endl;
|
|
||||||
if (sample & (1<<ibit[isc]))
|
if (sample & (1<<ibit[isc]))
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
@ -157,12 +183,9 @@ class moench04CtbZmq10GbData : public slsDetectorData<uint16_t> {
|
|||||||
/* unsigned char bunchid[8]; */
|
/* unsigned char bunchid[8]; */
|
||||||
/* }; */
|
/* }; */
|
||||||
|
|
||||||
int getFrameNumber(char *buff) {
|
|
||||||
#ifdef RAWDATA
|
|
||||||
return ((slsDetectorDefs::sls_receiver_header *)buff)->detHeader.frameNumber;
|
int getFrameNumber(char *buff){return iframe;};//((sls_detector_header*)buff)->frameNumber;};//*((int*)(buff+5))&0xffffff;};
|
||||||
#endif
|
|
||||||
return (int)(*buff);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@ -173,14 +196,48 @@ class moench04CtbZmq10GbData : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
int getPacketNumber(char *buff) {
|
//int getPacketNumber(char *buff){return ((sls_detector_header*)buff)->packetNumber;}//((*(((int*)(buff+4))))&0xff)+1;};
|
||||||
#ifdef RAWDATA
|
|
||||||
return ((slsDetectorDefs::sls_receiver_header *)buff)->detHeader.packetNumber;
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
}
|
/* /\** */
|
||||||
|
|
||||||
|
/* Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func */
|
||||||
|
/* \param data pointer to the memory to be analyzed */
|
||||||
|
/* \param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot */
|
||||||
|
/* \param dsize size of the memory slot to be analyzed */
|
||||||
|
/* \returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found */
|
||||||
|
|
||||||
|
/* *\/ */
|
||||||
|
/* virtual char *findNextFrame(char *data, int &ndata, int dsize){ndata=dsize; setDataSize(dsize); return data;}; */
|
||||||
|
|
||||||
|
|
||||||
|
/* /\** */
|
||||||
|
|
||||||
|
/* Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors! */
|
||||||
|
/* \param filebin input file stream (binary) */
|
||||||
|
/* \returns pointer to the begin of the last good frame, NULL if no frame is found or last frame is incomplete */
|
||||||
|
|
||||||
|
/* *\/ */
|
||||||
|
/* virtual char *readNextFrame(ifstream &filebin){ */
|
||||||
|
/* // int afifo_length=0; */
|
||||||
|
/* uint16_t *afifo_cont; */
|
||||||
|
/* int ib=0; */
|
||||||
|
/* if (filebin.is_open()) { */
|
||||||
|
/* afifo_cont=new uint16_t[dataSize/2]; */
|
||||||
|
/* while (filebin.read(((char*)afifo_cont)+ib,2)) { */
|
||||||
|
/* ib+=2; */
|
||||||
|
/* if (ib==dataSize) break; */
|
||||||
|
/* } */
|
||||||
|
/* if (ib>0) { */
|
||||||
|
/* iframe++; */
|
||||||
|
/* // cout << ib << "-" << endl; */
|
||||||
|
/* return (char*)afifo_cont; */
|
||||||
|
/* } else { */
|
||||||
|
/* delete [] afifo_cont; */
|
||||||
|
/* return NULL; */
|
||||||
|
/* } */
|
||||||
|
/* } */
|
||||||
|
/* return NULL; */
|
||||||
|
/* }; */
|
||||||
|
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream &filebin) {
|
virtual char *readNextFrame(ifstream &filebin) {
|
||||||
@ -196,19 +253,15 @@ class moench04CtbZmq10GbData : public slsDetectorData<uint16_t> {
|
|||||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
||||||
char *data=new char[dataSize];
|
char *data=new char[dataSize];
|
||||||
char *d=readNextFrame(filebin, ff, np, data);
|
char *d=readNextFrame(filebin, ff, np, data);
|
||||||
if (d == NULL) {
|
if (d==NULL) {delete [] data; data=NULL;}
|
||||||
delete[] data;
|
|
||||||
data = NULL;
|
|
||||||
}
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream & filebin, int &ff, int &np,
|
|
||||||
char *data) {
|
|
||||||
// char *retval=0;
|
|
||||||
#ifndef RAWDATA
|
|
||||||
|
|
||||||
|
|
||||||
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
||||||
|
// char *retval=0;
|
||||||
// int nd;
|
// int nd;
|
||||||
// int fnum = -1;
|
// int fnum = -1;
|
||||||
np=0;
|
np=0;
|
||||||
@ -226,51 +279,36 @@ class moench04CtbZmq10GbData : public slsDetectorData<uint16_t> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RAWDATA
|
|
||||||
//int nd;
|
|
||||||
int fnum = -1;
|
|
||||||
np = 0;
|
|
||||||
//int pn;
|
|
||||||
|
|
||||||
// cout << dataSize << endl;
|
|
||||||
if (ff >= 0)
|
|
||||||
fnum = ff;
|
|
||||||
|
|
||||||
if (filebin.is_open()) {
|
|
||||||
if (filebin.read(data, dataSize)) {
|
|
||||||
ff = getFrameNumber(data);
|
|
||||||
np = getPacketNumber(data);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Loops over a memory slot until a complete frame is found (i.e. all
|
Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func
|
||||||
packets 0 to nPackets, same frame number). purely virtual func \param
|
\param data pointer to the memory to be analyzed
|
||||||
data pointer to the memory to be analyzed \param ndata reference to
|
\param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot
|
||||||
the amount of data found for the frame, in case the frame is
|
\param dsize size of the memory slot to be analyzed
|
||||||
incomplete at the end of the memory slot \param dsize size of the
|
\returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
||||||
memory slot to be analyzed \returns pointer to the beginning of the
|
|
||||||
last good frame (might be incomplete if ndata smaller than dataSize),
|
|
||||||
or NULL if no frame is found
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
||||||
if (dsize < dataSize)
|
if (dsize<dataSize) ndata=dsize;
|
||||||
ndata = dsize;
|
else ndata=dataSize;
|
||||||
else
|
|
||||||
ndata = dataSize;
|
|
||||||
return data;
|
return data;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
//int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -4,9 +4,13 @@
|
|||||||
#define MOENCH04ZMQDATA_H
|
#define MOENCH04ZMQDATA_H
|
||||||
#include "slsDetectorData.h"
|
#include "slsDetectorData.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class moench04CtbZmqData : public slsDetectorData<uint16_t> {
|
class moench04CtbZmqData : public slsDetectorData<uint16_t> {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int iframe;
|
int iframe;
|
||||||
int nadc;
|
int nadc;
|
||||||
int sc_width;
|
int sc_width;
|
||||||
@ -14,20 +18,22 @@ class moench04CtbZmqData : public slsDetectorData<uint16_t> {
|
|||||||
const int aSamples;
|
const int aSamples;
|
||||||
const int dSamples;
|
const int dSamples;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Implements the slsReceiverData structure for the moench02 prototype read
|
Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver
|
||||||
out by a module i.e. using the slsReceiver (160x160 pixels, 40 packets
|
(160x160 pixels, 40 packets 1286 large etc.)
|
||||||
1286 large etc.) \param c crosstalk parameter for the output buffer
|
\param c crosstalk parameter for the output buffer
|
||||||
|
|
||||||
*/
|
*/
|
||||||
moench04CtbZmqData(int nas = 5000, int nds = 0)
|
moench04CtbZmqData(int nas=5000, int nds=0): slsDetectorData<uint16_t>(400, 400, nas*2*32+nds*8), nadc(32), sc_width(25), sc_height(200), aSamples(nas), dSamples(nds) {
|
||||||
: slsDetectorData<uint16_t>(400, 400, nas * 2 * 32 + nds * 8), nadc(32),
|
|
||||||
sc_width(25), sc_height(200), aSamples(nas), dSamples(nds) {
|
|
||||||
|
|
||||||
int adc_nr[32] = {9, 8, 11, 10, 13, 12, 15, 14, 1, 0, 3,
|
|
||||||
2, 5, 4, 7, 6, 23, 22, 21, 20, 19, 18,
|
int adc_nr[32]={9, 8,11,10,13,12,15,14,1,0,3,2,5,4,7,6,23,22,21,20,19,18,17,16,31,30,29,28,27,26,25,24 };
|
||||||
17, 16, 31, 30, 29, 28, 27, 26, 25, 24};
|
|
||||||
|
|
||||||
int row, col;
|
int row, col;
|
||||||
|
|
||||||
@ -54,14 +60,13 @@ class moench04CtbZmqData : public slsDetectorData<uint16_t> {
|
|||||||
row=200+i/sc_width;
|
row=200+i/sc_width;
|
||||||
}
|
}
|
||||||
dataMap[row][col]=(nadc*i+iadc)*2;//+16*(ip+1);
|
dataMap[row][col]=(nadc*i+iadc)*2;//+16*(ip+1);
|
||||||
if (dataMap[row][col] < 0 ||
|
if (dataMap[row][col]<0 || dataMap[row][col]>=aSamples*2*32)
|
||||||
dataMap[row][col] >= aSamples * 2 * 32)
|
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
|
||||||
cout << "Error: pointer " << dataMap[row][col]
|
|
||||||
<< " out of range " << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* for (ibyte=0; ibyte<sizeof(sls_detector_header)/2; ibyte++){ */
|
/* for (ibyte=0; ibyte<sizeof(sls_detector_header)/2; ibyte++){ */
|
||||||
/* xmap[ibyte]=-1; */
|
/* xmap[ibyte]=-1; */
|
||||||
/* ymap[ibyte]=-1; */
|
/* ymap[ibyte]=-1; */
|
||||||
@ -70,6 +75,7 @@ class moench04CtbZmqData : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
/* for (ibyte=0; ibyte<dataSize; ibyte++) { */
|
/* for (ibyte=0; ibyte<dataSize; ibyte++) { */
|
||||||
|
|
||||||
|
|
||||||
/* for (ipacket=0; ipacket<npackets; ipacket++) { */
|
/* for (ipacket=0; ipacket<npackets; ipacket++) { */
|
||||||
/* for (ibyte=0; ibyte< 8192/2; ibyte++) { */
|
/* for (ibyte=0; ibyte< 8192/2; ibyte++) { */
|
||||||
/* i=ipacket*8208/2+ibyte; */
|
/* i=ipacket*8208/2+ibyte; */
|
||||||
@ -101,28 +107,22 @@ class moench04CtbZmqData : public slsDetectorData<uint16_t> {
|
|||||||
int irow;
|
int irow;
|
||||||
int isc=x/sc_width;
|
int isc=x/sc_width;
|
||||||
int icol=x%sc_width;
|
int icol=x%sc_width;
|
||||||
if (y < 200)
|
if (y<200) irow=sc_height-1-y;
|
||||||
irow = sc_height - 1 - y;
|
|
||||||
else {
|
else {
|
||||||
irow=y-sc_height;
|
irow=y-sc_height;
|
||||||
isc++;
|
isc++;
|
||||||
}
|
}
|
||||||
int ibit[32] = {-1, -1, -1, -1, -1, -1, 1, 3, 5, 7, -1,
|
int ibit[32]={-1,-1,-1,-1,-1,-1,1,3,5,7,-1,-1,-1,-1,-1,-1,62,60,58,56,54,52,50,48,63,61,59,57,55,53,51,49};
|
||||||
-1, -1, -1, -1, -1, 62, 60, 58, 56, 54, 52,
|
|
||||||
50, 48, 63, 61, 59, 57, 55, 53, 51, 49};
|
|
||||||
int isample=irow*sc_width+icol;
|
int isample=irow*sc_width+icol;
|
||||||
|
|
||||||
uint64_t sample;
|
uint64_t sample;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
if (isc < 0 || isc >= 32)
|
if (isc<0 || isc>=32) return 0;
|
||||||
return 0;
|
if (ibit[isc]<0 || ibit[isc]>=64) return 0;
|
||||||
if (ibit[isc] < 0 || ibit[isc] >= 64)
|
|
||||||
return 0;
|
|
||||||
if (dSamples>isample) {
|
if (dSamples>isample) {
|
||||||
ptr=data+aoff+8*isample;
|
ptr=data+aoff+8*isample;
|
||||||
sample=*((uint64_t*)ptr);
|
sample=*((uint64_t*)ptr);
|
||||||
// cout << isc << " " << ibit[isc] << " " << isample << hex <<
|
// cout << isc << " " << ibit[isc] << " " << isample << hex << sample << dec << endl;
|
||||||
// sample << dec << endl;
|
|
||||||
if (sample & (1<<ibit[isc]))
|
if (sample & (1<<ibit[isc]))
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
@ -147,9 +147,9 @@ class moench04CtbZmqData : public slsDetectorData<uint16_t> {
|
|||||||
/* unsigned char bunchid[8]; */
|
/* unsigned char bunchid[8]; */
|
||||||
/* }; */
|
/* }; */
|
||||||
|
|
||||||
int getFrameNumber(char *buff) {
|
|
||||||
return iframe;
|
|
||||||
}; //((sls_detector_header*)buff)->frameNumber;};//*((int*)(buff+5))&0xffffff;};
|
int getFrameNumber(char *buff){return iframe;};//((sls_detector_header*)buff)->frameNumber;};//*((int*)(buff+5))&0xffffff;};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@ -160,33 +160,25 @@ class moench04CtbZmqData : public slsDetectorData<uint16_t> {
|
|||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
// int getPacketNumber(char *buff){return
|
//int getPacketNumber(char *buff){return ((sls_detector_header*)buff)->packetNumber;}//((*(((int*)(buff+4))))&0xff)+1;};
|
||||||
// ((sls_detector_header*)buff)->packetNumber;}//((*(((int*)(buff+4))))&0xff)+1;};
|
|
||||||
|
|
||||||
/* /\** */
|
/* /\** */
|
||||||
|
|
||||||
/* Loops over a memory slot until a complete frame is found (i.e. all
|
/* Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func */
|
||||||
* packets 0 to nPackets, same frame number). purely virtual func */
|
|
||||||
/* \param data pointer to the memory to be analyzed */
|
/* \param data pointer to the memory to be analyzed */
|
||||||
/* \param ndata reference to the amount of data found for the frame, in
|
/* \param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot */
|
||||||
* case the frame is incomplete at the end of the memory slot */
|
|
||||||
/* \param dsize size of the memory slot to be analyzed */
|
/* \param dsize size of the memory slot to be analyzed */
|
||||||
/* \returns pointer to the beginning of the last good frame (might be
|
/* \returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found */
|
||||||
* incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
/* virtual char *findNextFrame(char *data, int &ndata, int
|
/* virtual char *findNextFrame(char *data, int &ndata, int dsize){ndata=dsize; setDataSize(dsize); return data;}; */
|
||||||
* dsize){ndata=dsize; setDataSize(dsize); return data;}; */
|
|
||||||
|
|
||||||
/* /\** */
|
/* /\** */
|
||||||
|
|
||||||
/* Loops over a file stream until a complete frame is found (i.e. all
|
/* Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors! */
|
||||||
* packets 0 to nPackets, same frame number). Can be overloaded for
|
|
||||||
* different kind of detectors! */
|
|
||||||
/* \param filebin input file stream (binary) */
|
/* \param filebin input file stream (binary) */
|
||||||
/* \returns pointer to the begin of the last good frame, NULL if no
|
/* \returns pointer to the begin of the last good frame, NULL if no frame is found or last frame is incomplete */
|
||||||
* frame is found or last frame is incomplete */
|
|
||||||
|
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
/* virtual char *readNextFrame(ifstream &filebin){ */
|
/* virtual char *readNextFrame(ifstream &filebin){ */
|
||||||
@ -211,6 +203,7 @@ class moench04CtbZmqData : public slsDetectorData<uint16_t> {
|
|||||||
/* return NULL; */
|
/* return NULL; */
|
||||||
/* }; */
|
/* }; */
|
||||||
|
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream &filebin) {
|
virtual char *readNextFrame(ifstream &filebin) {
|
||||||
int ff=-1, np=-1;
|
int ff=-1, np=-1;
|
||||||
return readNextFrame(filebin, ff, np);
|
return readNextFrame(filebin, ff, np);
|
||||||
@ -224,15 +217,14 @@ class moench04CtbZmqData : public slsDetectorData<uint16_t> {
|
|||||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
|
||||||
char *data=new char[dataSize];
|
char *data=new char[dataSize];
|
||||||
char *d=readNextFrame(filebin, ff, np, data);
|
char *d=readNextFrame(filebin, ff, np, data);
|
||||||
if (d == NULL) {
|
if (d==NULL) {delete [] data; data=NULL;}
|
||||||
delete[] data;
|
|
||||||
data = NULL;
|
|
||||||
}
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream &filebin, int &ff, int &np,
|
|
||||||
char *data) {
|
|
||||||
|
|
||||||
|
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
||||||
// char *retval=0;
|
// char *retval=0;
|
||||||
//int nd;
|
//int nd;
|
||||||
//int fnum = -1;
|
//int fnum = -1;
|
||||||
@ -251,29 +243,36 @@ class moench04CtbZmqData : public slsDetectorData<uint16_t> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Loops over a memory slot until a complete frame is found (i.e. all
|
Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func
|
||||||
packets 0 to nPackets, same frame number). purely virtual func \param
|
\param data pointer to the memory to be analyzed
|
||||||
data pointer to the memory to be analyzed \param ndata reference to the
|
\param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot
|
||||||
amount of data found for the frame, in case the frame is incomplete at
|
\param dsize size of the memory slot to be analyzed
|
||||||
the end of the memory slot \param dsize size of the memory slot to be
|
\returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
||||||
analyzed \returns pointer to the beginning of the last good frame (might
|
|
||||||
be incomplete if ndata smaller than dataSize), or NULL if no frame is
|
|
||||||
found
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
virtual char *findNextFrame(char *data, int &ndata, int dsize){
|
||||||
if (dsize < dataSize)
|
if (dsize<dataSize) ndata=dsize;
|
||||||
ndata = dsize;
|
else ndata=dataSize;
|
||||||
else
|
|
||||||
ndata = dataSize;
|
|
||||||
return data;
|
return data;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
//int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,216 +0,0 @@
|
|||||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
|
||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
|
||||||
#ifndef MOENCHDATA_H
|
|
||||||
#define MOENCHDATA_H
|
|
||||||
#include "slsDetectorData.h"
|
|
||||||
#include "sls/sls_detector_defs.h"
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
class moenchData : public slsDetectorData<uint16_t> {
|
|
||||||
|
|
||||||
private:
|
|
||||||
int iframe;
|
|
||||||
int nadc;
|
|
||||||
int sc_width;
|
|
||||||
int sc_height;
|
|
||||||
const int aSamples;
|
|
||||||
const int dSamples;
|
|
||||||
int off;
|
|
||||||
int *adc_nr;
|
|
||||||
int *ibit;
|
|
||||||
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
Implements the slsReceiverData structure for the moench02 prototype read
|
|
||||||
out by a module i.e. using the slsReceiver (160x160 pixels, 40 packets
|
|
||||||
1286 large etc.) \param c crosstalk parameter for the output buffer
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
moenchData(int off, int nadc_i, int *adc_nr_in, int *ibit_in, int nas = 5000, int nds = 0, int nx_i=400, int ny_i=400)
|
|
||||||
: nadc(nadc_i), slsDetectorData<uint16_t>(nx_i, ny_i,off+((nas > 0) && (nds > 0)
|
|
||||||
? max(nas, nds) * (nadc_i * 2 + 8)
|
|
||||||
: nas * nadc_i * 2 + nds * 8)),
|
|
||||||
sc_width(25), sc_height(200), aSamples(nas), dSamples(nds) {
|
|
||||||
|
|
||||||
|
|
||||||
adc_nr=new int[nadc];
|
|
||||||
if (ibit_in)
|
|
||||||
ibit=new int[nadc];
|
|
||||||
else
|
|
||||||
ibit=NULL;
|
|
||||||
for (iadc=0; iadc<nadc; iadc++) {
|
|
||||||
adc_nr[iadc]=adc_nr_in[iadc];
|
|
||||||
if (ibit)
|
|
||||||
ibit[iadc]=ibit_in[iadc];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int row, col;
|
|
||||||
int iadc;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (int is = 0; is < aSamples; is++) {
|
|
||||||
|
|
||||||
for (iadc = 0; iadc < nadc; iadc++) {
|
|
||||||
i = is;
|
|
||||||
// adc4=(int)iadc/4;
|
|
||||||
if (i < sc_width * sc_height) {
|
|
||||||
// for (int i=0; i<sc_width*sc_height; i++) {
|
|
||||||
col = (adc_nr[iadc] % 16) * sc_width + (i % sc_width);
|
|
||||||
// if (adc4%2==0) {
|
|
||||||
if (iadc < 16) {
|
|
||||||
row = 199 - i / sc_width;
|
|
||||||
} else {
|
|
||||||
row = 200 + i / sc_width;
|
|
||||||
}
|
|
||||||
if (nds > 0)
|
|
||||||
dataMap[row][col] =
|
|
||||||
((nadc + 4) * i + iadc) * 2 + off; //+16*(ip+1);
|
|
||||||
else
|
|
||||||
dataMap[row][col] =
|
|
||||||
(nadc * i + iadc) * 2 + off; //+16*(ip+1);
|
|
||||||
if (dataMap[row][col] < 0 ||
|
|
||||||
dataMap[row][col] >= aSamples * 2 * 32 + off)
|
|
||||||
cout << "Error: pointer " << dataMap[row][col]
|
|
||||||
<< " out of range " << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
iframe = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
virtual int getGain(char *data, int x, int y) {
|
|
||||||
// int aoff=aSamples*2*32;
|
|
||||||
|
|
||||||
if (ibit) {
|
|
||||||
int irow;
|
|
||||||
int isc = x / sc_width;
|
|
||||||
int icol = x % sc_width;
|
|
||||||
if (y < 200)
|
|
||||||
irow = sc_height - 1 - y;
|
|
||||||
else {
|
|
||||||
irow = y - sc_height;
|
|
||||||
isc++;
|
|
||||||
}
|
|
||||||
int isample = irow * sc_width + icol;
|
|
||||||
|
|
||||||
uint64_t sample;
|
|
||||||
char *ptr;
|
|
||||||
if (isc < 0 || isc >= 32)
|
|
||||||
return 0;
|
|
||||||
if (ibit[isc] < 0 || ibit[isc] >= 64)
|
|
||||||
return 0;
|
|
||||||
if (dSamples > isample) {
|
|
||||||
ptr = data + 32 * (isample + 1) + 8 * isample;
|
|
||||||
sample = *((uint64_t *)ptr);
|
|
||||||
if (sample & (1 << ibit[isc]))
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
|
|
||||||
Returns the frame number for the given dataset. Purely virtual func.
|
|
||||||
\param buff pointer to the dataset
|
|
||||||
\returns frame number
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int getFrameNumber(char *buff) {
|
|
||||||
return (int* buff)[0];
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
|
|
||||||
Returns the packet number for the given dataset. purely virtual func
|
|
||||||
\param buff pointer to the dataset
|
|
||||||
\returns packet number number
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
int getPacketNumber(char *buff) {
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream & filebin) {
|
|
||||||
int ff = -1, np = -1;
|
|
||||||
return readNextFrame(filebin, ff, np);
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream & filebin, int &ff) {
|
|
||||||
int np = -1;
|
|
||||||
return readNextFrame(filebin, ff, np);
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream & filebin, int &ff, int &np) {
|
|
||||||
char *data = new char[dataSize];
|
|
||||||
char *d = readNextFrame(filebin, ff, np, data);
|
|
||||||
if (d == NULL) {
|
|
||||||
delete[] data;
|
|
||||||
data = NULL;
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
virtual char *readNextFrame(ifstream & filebin, int &ff, int &np,
|
|
||||||
char *data) {
|
|
||||||
|
|
||||||
char *retval = 0;
|
|
||||||
int nd;
|
|
||||||
int fnum = -1;
|
|
||||||
np = 0;
|
|
||||||
int pn;
|
|
||||||
|
|
||||||
// cout << dataSize << endl;
|
|
||||||
//if (ff >= 0)
|
|
||||||
// fnum = ff;
|
|
||||||
|
|
||||||
if (filebin.is_open()) {
|
|
||||||
if (filebin.read(data, dataSize)) {
|
|
||||||
ff = getFrameNumber(data);
|
|
||||||
np = getPacketNumber(data);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
|
|
||||||
Loops over a memory slot until a complete frame is found (i.e. all
|
|
||||||
packets 0 to nPackets, same frame number). purely virtual func \param
|
|
||||||
data pointer to the memory to be analyzed \param ndata reference to
|
|
||||||
the amount of data found for the frame, in case the frame is
|
|
||||||
incomplete at the end of the memory slot \param dsize size of the
|
|
||||||
memory slot to be analyzed \returns pointer to the beginning of the
|
|
||||||
last good frame (might be incomplete if ndata smaller than dataSize),
|
|
||||||
or NULL if no frame is found
|
|
||||||
|
|
||||||
*/
|
|
||||||
virtual char *findNextFrame(char *data, int &ndata, int dsize) {
|
|
||||||
if (dsize < dataSize)
|
|
||||||
ndata = dsize;
|
|
||||||
else
|
|
||||||
ndata = dataSize;
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -3,158 +3,52 @@
|
|||||||
#ifndef SLSDETECTORDATA_H
|
#ifndef SLSDETECTORDATA_H
|
||||||
#define SLSDETECTORDATA_H
|
#define SLSDETECTORDATA_H
|
||||||
|
|
||||||
#include <fstream>
|
#include <inttypes.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
template <class dataType> class slsDetectorData {
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
|
template <class dataType>
|
||||||
|
class slsDetectorData {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const int nx; /**< Number of pixels in the x direction */
|
const int nx; /**< Number of pixels in the x direction */
|
||||||
const int ny; /**< Number of pixels in the y direction */
|
const int ny; /**< Number of pixels in the y direction */
|
||||||
int dataSize; /**<size of the data constituting one frame */
|
int dataSize; /**<size of the data constituting one frame */
|
||||||
int **dataMap; /**< Array of size nx*ny storing the pointers to the data in
|
int **dataMap; /**< Array of size nx*ny storing the pointers to the data in the dataset (as offset)*/
|
||||||
the dataset (as offset)*/
|
dataType **dataMask; /**< Array of size nx*ny storing the polarity of the data in the dataset (should be 0 if no inversion is required, 0xffffffff is inversion is required) */
|
||||||
dataType **dataMask; /**< Array of size nx*ny storing the polarity of the
|
int **dataROIMask; /**< Array of size nx*ny 1 if channel is good (or in the ROI), 0 if bad channel (or out of ROI) */
|
||||||
data in the dataset (should be 0 if no inversion is
|
|
||||||
required, 0xffffffff is inversion is required) */
|
|
||||||
int **dataROIMask; /**< Array of size nx*ny 1 if channel is good (or in the
|
|
||||||
ROI), 0 if bad channel (or out of ROI) */
|
|
||||||
int *xmap;
|
int *xmap;
|
||||||
int *ymap;
|
int *ymap;
|
||||||
dataType **orderedData;
|
dataType **orderedData;
|
||||||
int isOrdered;
|
int isOrdered;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
General slsDetectors data structure. Works for data acquired using the
|
|
||||||
slsDetectorReceiver. Can be generalized to other detectors (many virtual
|
|
||||||
funcs).
|
General slsDetectors data structure. Works for data acquired using the slsDetectorReceiver. Can be generalized to other detectors (many virtual funcs).
|
||||||
|
|
||||||
Constructor (no error checking if datasize and offsets are compatible!)
|
Constructor (no error checking if datasize and offsets are compatible!)
|
||||||
\param npx number of pixels in the x direction
|
\param npx number of pixels in the x direction
|
||||||
\param npy number of pixels in the y direction (1 for strips)
|
\param npy number of pixels in the y direction (1 for strips)
|
||||||
\param dsize size of the data
|
\param dsize size of the data
|
||||||
\param dMap array of size nx*ny storing the pointers to the data in the
|
\param dMap array of size nx*ny storing the pointers to the data in the dataset (as offset)
|
||||||
dataset (as offset) \param dMask Array of size nx*ny storing the polarity of
|
\param dMask Array of size nx*ny storing the polarity of the data in the dataset (should be 0 if no inversion is required, 0xffffffff is inversion is required)
|
||||||
the data in the dataset (should be 0 if no inversion is required, 0xffffffff
|
\param dROI Array of size nx*ny. The elements are 1s if the channel is good or in the ROI, 0 is bad or out of the ROI. NULL (default) means all 1s.
|
||||||
is inversion is required) \param dROI Array of size nx*ny. The elements are
|
|
||||||
1s if the channel is good or in the ROI, 0 is bad or out of the ROI. NULL
|
|
||||||
(default) means all 1s.
|
|
||||||
*/
|
|
||||||
slsDetectorData(int npx, int npy, int dsize, int **dMap = NULL,
|
|
||||||
dataType **dMask = NULL, int **dROI = NULL);
|
|
||||||
|
|
||||||
virtual ~slsDetectorData();
|
|
||||||
|
|
||||||
// Virtual functions
|
|
||||||
virtual int getPointer(int ix, int iy) { return dataMap[iy][ix]; };
|
|
||||||
virtual void getPixel(int ip, int &x, int &y);
|
|
||||||
virtual dataType **getData(char *ptr, int dsize = -1);
|
|
||||||
virtual double **getImage(char *ptr, int dsize = -1);
|
|
||||||
virtual dataType getChannel(char *data, int ix, int iy = 0);
|
|
||||||
virtual int getGain(char *data, int ix, int iy = 0) { return 0; };
|
|
||||||
virtual double getValue(char *data, int ix, int iy = 0) {
|
|
||||||
return (double)getChannel(data, ix, iy);
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual int getFrameNumber(char *buff) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Loops over a memory slot until a complete frame is found (i.e. all
|
|
||||||
packets 0 to nPackets, same frame number). purely virtual func \param
|
|
||||||
data pointer to the memory to be analyzed \param ndata reference to the
|
|
||||||
amount of data found for the frame, in case the frame is incomplete at
|
|
||||||
the end of the memory slot \param dsize size of the memory slot to be
|
|
||||||
analyzed \returns pointer to the beginning of the last good frame (might
|
|
||||||
be incomplete if ndata smaller than dataSize), or NULL if no frame is
|
|
||||||
found
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
virtual char *findNextFrame(char *data, int &ndata, int dsize) = 0;
|
slsDetectorData(int npx, int npy, int dsize, int **dMap=NULL, dataType **dMask=NULL, int **dROI=NULL): nx(npx), ny(npy), dataSize(dsize), orderedData(NULL), isOrdered(0) {
|
||||||
|
|
||||||
//Returns a pointer to the next complete frame, if none found nullptr
|
|
||||||
//data needs to be deallocated by caller
|
|
||||||
virtual char *readNextFrame(std::ifstream &filebin) = 0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//END Virtual functions
|
|
||||||
|
|
||||||
/**
|
|
||||||
defines the data map (as offset) - no error checking if datasize and
|
|
||||||
offsets are compatible! \param dMap array of size nx*ny storing the
|
|
||||||
pointers to the data in the dataset (as offset). If NULL (default),the
|
|
||||||
data are arranged as if read out row by row
|
|
||||||
(dataMap[iy][ix]=(iy*nx+ix)*sizeof(dataType);)
|
|
||||||
*/
|
|
||||||
void setDataMap(int **dMap = NULL);
|
|
||||||
|
|
||||||
/**
|
|
||||||
defines the data mask i.e. the polarity of the data
|
|
||||||
\param dMask Array of size nx*ny storing the polarity of the data in the
|
|
||||||
dataset (should be 0 if no inversion is required, 0xffffffff is inversion
|
|
||||||
is required)
|
|
||||||
|
|
||||||
*/
|
|
||||||
void setDataMask(dataType **dMask = NULL);
|
|
||||||
/**
|
|
||||||
defines the region of interest and/or the bad channels mask
|
|
||||||
\param dROI Array of size nx*ny. The ements are 1s if the channel is
|
|
||||||
good or in the ROI, 0 is bad or out of the ROI. NULL (default) means all
|
|
||||||
1s.
|
|
||||||
|
|
||||||
*/
|
|
||||||
void setDataROIMask(int **dROI = NULL);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Define bad channel or roi mask for a single channel
|
|
||||||
\param ix channel x coordinate
|
|
||||||
\param iy channel y coordinate (1 for strips)
|
|
||||||
\param i 1 if pixel is good (or in the roi), 0 if bad
|
|
||||||
\returns 1 if pixel is good, 0 if it's bad, -1 if pixel is out of range
|
|
||||||
*/
|
|
||||||
int setGood(int ix, int iy, int i = 1);
|
|
||||||
|
|
||||||
// returns 1 if pixel is good, 0 if it's bad, -1 if pixel is out of range
|
|
||||||
int isGood(int ix, int iy);
|
|
||||||
|
|
||||||
// returns total number of channels, outparam npx and npy x,y dimensions
|
|
||||||
int getDetectorSize(int &npx, int &npy);
|
|
||||||
|
|
||||||
/** Returns the size of the data frame */
|
|
||||||
int getDataSize() { return dataSize; };
|
|
||||||
|
|
||||||
/** changes the size of the data frame */
|
|
||||||
int setDataSize(int d) {
|
|
||||||
dataSize = d;
|
|
||||||
return dataSize;
|
|
||||||
};
|
|
||||||
|
|
||||||
void newFrame() { isOrdered = 0; };
|
|
||||||
|
|
||||||
/**
|
|
||||||
Returns the value of the selected channel for the given dataset. Virtual
|
|
||||||
function, can be overloaded. \param data pointer to the dataset
|
|
||||||
(including headers etc) \param ix pixel number in the x direction \param
|
|
||||||
iy pixel number in the y direction \returns data for the selected
|
|
||||||
channel, with inversion if required
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename dataType>
|
|
||||||
slsDetectorData<dataType>::slsDetectorData(int npx, int npy, int dsize,
|
|
||||||
int **dMap, dataType **dMask,
|
|
||||||
int **dROI)
|
|
||||||
: nx(npx), ny(npy), dataSize(dsize), orderedData(NULL), isOrdered(0) {
|
|
||||||
|
|
||||||
int el=dsize/sizeof(dataType);
|
int el=dsize/sizeof(dataType);
|
||||||
xmap=new int[el];
|
xmap=new int[el];
|
||||||
ymap=new int[el];
|
ymap=new int[el];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
orderedData=new dataType*[ny];
|
orderedData=new dataType*[ny];
|
||||||
dataMap=new int*[ny];
|
dataMap=new int*[ny];
|
||||||
dataMask=new dataType*[ny];
|
dataMask=new dataType*[ny];
|
||||||
@ -166,6 +60,7 @@ slsDetectorData<dataType>::slsDetectorData(int npx, int npy, int dsize,
|
|||||||
dataROIMask[i] = new int[nx];
|
dataROIMask[i] = new int[nx];
|
||||||
for (int j=0; j<nx; j++)
|
for (int j=0; j<nx; j++)
|
||||||
dataROIMask[i][j]=1;
|
dataROIMask[i][j]=1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int ip=0; ip<el; ip++){
|
for (int ip=0; ip<el; ip++){
|
||||||
@ -176,9 +71,10 @@ slsDetectorData<dataType>::slsDetectorData(int npx, int npy, int dsize,
|
|||||||
setDataMap(dMap);
|
setDataMap(dMap);
|
||||||
setDataMask(dMask);
|
setDataMask(dMask);
|
||||||
setDataROIMask(dROI);
|
setDataROIMask(dROI);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename dataType> slsDetectorData<dataType>::~slsDetectorData() {
|
virtual ~slsDetectorData() {
|
||||||
for(int i = 0; i < ny; i++) {
|
for(int i = 0; i < ny; i++) {
|
||||||
delete [] dataMap[i];
|
delete [] dataMap[i];
|
||||||
delete [] dataMask[i];
|
delete [] dataMask[i];
|
||||||
@ -191,10 +87,14 @@ template <typename dataType> slsDetectorData<dataType>::~slsDetectorData() {
|
|||||||
delete [] orderedData;
|
delete [] orderedData;
|
||||||
delete [] xmap;
|
delete [] xmap;
|
||||||
delete [] ymap;
|
delete [] ymap;
|
||||||
}
|
};
|
||||||
|
|
||||||
template <typename dataType>
|
virtual int getPointer(int ix,int iy) {return dataMap[iy][ix];};
|
||||||
void slsDetectorData<dataType>::setDataMap(int **dMap) {
|
/**
|
||||||
|
defines the data map (as offset) - no error checking if datasize and offsets are compatible!
|
||||||
|
\param dMap array of size nx*ny storing the pointers to the data in the dataset (as offset). If NULL (default),the data are arranged as if read out row by row (dataMap[iy][ix]=(iy*nx+ix)*sizeof(dataType);)
|
||||||
|
*/
|
||||||
|
void setDataMap(int **dMap=NULL) {
|
||||||
|
|
||||||
int ip=0;
|
int ip=0;
|
||||||
int ix, iy;
|
int ix, iy;
|
||||||
@ -226,10 +126,16 @@ void slsDetectorData<dataType>::setDataMap(int **dMap) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// cout << "nx:" <<nx << " ny:" << ny << endl;
|
// cout << "nx:" <<nx << " ny:" << ny << endl;
|
||||||
}
|
|
||||||
|
|
||||||
template <typename dataType>
|
};
|
||||||
void slsDetectorData<dataType>::setDataMask(dataType **dMask) {
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
defines the data mask i.e. the polarity of the data
|
||||||
|
\param dMask Array of size nx*ny storing the polarity of the data in the dataset (should be 0 if no inversion is required, 0xffffffff is inversion is required)
|
||||||
|
|
||||||
|
*/
|
||||||
|
void setDataMask(dataType **dMask=NULL){
|
||||||
|
|
||||||
if (dMask!=NULL) {
|
if (dMask!=NULL) {
|
||||||
|
|
||||||
@ -241,10 +147,14 @@ void slsDetectorData<dataType>::setDataMask(dataType **dMask) {
|
|||||||
for (int ix=0; ix<nx; ix++)
|
for (int ix=0; ix<nx; ix++)
|
||||||
dataMask[iy][ix]=0;
|
dataMask[iy][ix]=0;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
/**
|
||||||
|
defines the region of interest and/or the bad channels mask
|
||||||
|
\param dROI Array of size nx*ny. The lements are 1s if the channel is good or in the ROI, 0 is bad or out of the ROI. NULL (default) means all 1s.
|
||||||
|
|
||||||
|
*/
|
||||||
|
void setDataROIMask(int **dROI=NULL){
|
||||||
|
|
||||||
template <typename dataType>
|
|
||||||
void slsDetectorData<dataType>::setDataROIMask(int **dROI) {
|
|
||||||
if (dROI!=NULL) {
|
if (dROI!=NULL) {
|
||||||
|
|
||||||
for (int iy=0; iy<ny; iy++)
|
for (int iy=0; iy<ny; iy++)
|
||||||
@ -255,39 +165,46 @@ void slsDetectorData<dataType>::setDataROIMask(int **dROI) {
|
|||||||
for (int iy=0; iy<ny; iy++)
|
for (int iy=0; iy<ny; iy++)
|
||||||
for (int ix=0; ix<nx; ix++)
|
for (int ix=0; ix<nx; ix++)
|
||||||
dataROIMask[iy][ix]=1;
|
dataROIMask[iy][ix]=1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename dataType>
|
|
||||||
int slsDetectorData<dataType>::setGood(int ix, int iy, int i) {
|
|
||||||
if (ix >= 0 && ix < nx && iy >= 0 && iy < ny)
|
|
||||||
dataROIMask[iy][ix] = i;
|
|
||||||
return isGood(ix, iy);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename dataType>
|
|
||||||
int slsDetectorData<dataType>::isGood(int ix, int iy) {
|
|
||||||
if (ix >= 0 && ix < nx && iy >= 0 && iy < ny)
|
|
||||||
return dataROIMask[iy][ix];
|
|
||||||
else
|
|
||||||
return -1;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename dataType>
|
/**
|
||||||
int slsDetectorData<dataType>::getDetectorSize(int &npx, int &npy) {
|
Define bad channel or roi mask for a single channel
|
||||||
npx = nx;
|
\param ix channel x coordinate
|
||||||
npy = ny;
|
\param iy channel y coordinate (1 for strips)
|
||||||
return nx * ny;
|
\param i 1 if pixel is good (or in the roi), 0 if bad
|
||||||
}
|
\returns 1 if pixel is good, 0 if it's bad, -1 if pixel is out of range
|
||||||
|
*/
|
||||||
|
int setGood(int ix, int iy, int i=1) { if (ix>=0 && ix<nx && iy>=0 && iy<ny) dataROIMask[iy][ix]=i; return isGood(ix,iy);};
|
||||||
|
/**
|
||||||
|
Define bad channel or roi mask for a single channel
|
||||||
|
\param ix channel x coordinate
|
||||||
|
\param iy channel y coordinate (1 for strips)
|
||||||
|
\returns 1 if pixel is good, 0 if it's bad, -1 if pixel is out of range
|
||||||
|
*/
|
||||||
|
int isGood(int ix, int iy) { if (ix>=0 && ix<nx && iy>=0 && iy<ny) return dataROIMask[iy][ix]; else return -1;};
|
||||||
|
|
||||||
template <typename dataType>
|
/**
|
||||||
void slsDetectorData<dataType>::getPixel(int ip, int &x, int &y) {
|
Returns detector size in x,y
|
||||||
x = xmap[ip];
|
\param npx reference to number of channels in x
|
||||||
y = ymap[ip];
|
\param npy reference to number of channels in y (will be 1 for strips)
|
||||||
}
|
\returns total number of channels
|
||||||
|
*/
|
||||||
|
int getDetectorSize(int &npx, int &npy){npx=nx; npy=ny; return nx*ny;};
|
||||||
|
|
||||||
template <typename dataType>
|
/** Returns the size of the data frame */
|
||||||
dataType **slsDetectorData<dataType>::getData(char *ptr, int dsize) {
|
int getDataSize() {return dataSize;};
|
||||||
|
|
||||||
|
/** changes the size of the data frame */
|
||||||
|
int setDataSize(int d) {dataSize=d; return dataSize;};
|
||||||
|
|
||||||
|
|
||||||
|
virtual void getPixel(int ip, int &x, int &y) {x=xmap[ip]; y=ymap[ip];};
|
||||||
|
|
||||||
|
virtual dataType **getData(char *ptr, int dsize=-1) {
|
||||||
int el=dsize/sizeof(dataType);
|
int el=dsize/sizeof(dataType);
|
||||||
//dataType **data;
|
//dataType **data;
|
||||||
int ix,iy;
|
int ix,iy;
|
||||||
@ -296,8 +213,7 @@ dataType **slsDetectorData<dataType>::getData(char *ptr, int dsize) {
|
|||||||
// data[i]=new dataType[nx];
|
// data[i]=new dataType[nx];
|
||||||
//}
|
//}
|
||||||
isOrdered=0;
|
isOrdered=0;
|
||||||
if (dsize <= 0 || dsize > dataSize)
|
if (dsize<=0 || dsize>dataSize) dsize=dataSize;
|
||||||
dsize = dataSize;
|
|
||||||
|
|
||||||
for (int ip=0; ip<(el); ip++) {
|
for (int ip=0; ip<(el); ip++) {
|
||||||
getPixel(ip,ix,iy);
|
getPixel(ip,ix,iy);
|
||||||
@ -310,8 +226,9 @@ dataType **slsDetectorData<dataType>::getData(char *ptr, int dsize) {
|
|||||||
return orderedData;
|
return orderedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename dataType>
|
void newFrame(){isOrdered=0;};
|
||||||
double **slsDetectorData<dataType>::getImage(char *ptr, int dsize) {
|
|
||||||
|
virtual double **getImage(char *ptr, int dsize=-1) {
|
||||||
|
|
||||||
double **data;
|
double **data;
|
||||||
int ix,iy;
|
int ix,iy;
|
||||||
@ -320,8 +237,7 @@ double **slsDetectorData<dataType>::getImage(char *ptr, int dsize) {
|
|||||||
data[i]=new double[nx];
|
data[i]=new double[nx];
|
||||||
}
|
}
|
||||||
int el=dsize/sizeof(dataType);
|
int el=dsize/sizeof(dataType);
|
||||||
if (dsize <= 0 || dsize > dataSize)
|
if (dsize<=0 || dsize>dataSize) dsize=dataSize;
|
||||||
dsize = dataSize;
|
|
||||||
for (int ip=0; ip<el; ip++) {
|
for (int ip=0; ip<el; ip++) {
|
||||||
getPixel(ip,ix,iy);
|
getPixel(ip,ix,iy);
|
||||||
if (ix>=0 && ix<nx && iy>=0 && iy<ny) {
|
if (ix>=0 && ix<nx && iy>=0 && iy<ny) {
|
||||||
@ -329,12 +245,21 @@ double **slsDetectorData<dataType>::getImage(char *ptr, int dsize) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
};
|
||||||
template <typename dataType>
|
|
||||||
dataType slsDetectorData<dataType>::getChannel(char *data, int ix, int iy) {
|
/**
|
||||||
|
Returns the value of the selected channel for the given dataset. Virtual function, can be overloaded.
|
||||||
|
\param data pointer to the dataset (including headers etc)
|
||||||
|
\param ix pixel number in the x direction
|
||||||
|
\param iy pixel number in the y direction
|
||||||
|
\returns data for the selected channel, with inversion if required
|
||||||
|
|
||||||
|
*/
|
||||||
|
virtual dataType getChannel(char *data, int ix, int iy=0) {
|
||||||
dataType m=0, d=0;
|
dataType m=0, d=0;
|
||||||
if (ix >= 0 && ix < nx && iy >= 0 && iy < ny && dataMap[iy][ix] >= 0 &&
|
if (ix>=0 && ix<nx && iy>=0 && iy<ny && dataMap[iy][ix]>=0 && dataMap[iy][ix]<dataSize) {
|
||||||
dataMap[iy][ix] < dataSize) {
|
// cout << ix << " " << iy << " " ;
|
||||||
|
//cout << dataMap[ix][iy] << " " << (void*)data << " " << dataSize<< endl;
|
||||||
m=dataMask[iy][ix];
|
m=dataMask[iy][ix];
|
||||||
if (isOrdered==0)
|
if (isOrdered==0)
|
||||||
d=*((dataType*)(data+getPointer(ix,iy)));
|
d=*((dataType*)(data+getPointer(ix,iy)));
|
||||||
@ -344,4 +269,80 @@ dataType slsDetectorData<dataType>::getChannel(char *data, int ix, int iy) {
|
|||||||
return d^m;
|
return d^m;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
virtual int getGain(char *data, int ix, int iy=0){return 0;};
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Returns the value of the selected channel for the given dataset. Virtual function, can be overloaded.
|
||||||
|
\param data pointer to the dataset (including headers etc)
|
||||||
|
\param ix pixel number in the x direction
|
||||||
|
\param iy pixel number in the y direction
|
||||||
|
\returns data for the selected channel, with inversion if required or -1 if its a missing packet
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual int getChannelwithMissingPackets(char *data, int ix, int iy) {
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the value of the selected channel for the given dataset as double.
|
||||||
|
\param data pointer to the dataset (including headers etc)
|
||||||
|
\param ix pixel number in the x direction
|
||||||
|
\param iy pixel number in the y direction
|
||||||
|
\returns data for the selected channel, with inversion if required as double
|
||||||
|
|
||||||
|
*/
|
||||||
|
virtual double getValue(char *data, int ix, int iy=0) {
|
||||||
|
/* cout << " x "<< ix << " y"<< iy << " val " << getChannel(data, ix, iy)<< endl;*/
|
||||||
|
return (double)getChannel(data, ix, iy);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the frame number for the given dataset. Purely virtual func.
|
||||||
|
\param buff pointer to the dataset
|
||||||
|
\returns frame number
|
||||||
|
|
||||||
|
*/
|
||||||
|
virtual int getFrameNumber(char *buff)=0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Returns the packet number for the given dataset. purely virtual func
|
||||||
|
\param buff pointer to the dataset
|
||||||
|
\returns packet number number
|
||||||
|
|
||||||
|
|
||||||
|
virtual int getPacketNumber(char *buff)=0;
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func
|
||||||
|
\param data pointer to the memory to be analyzed
|
||||||
|
\param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot
|
||||||
|
\param dsize size of the memory slot to be analyzed
|
||||||
|
\returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
||||||
|
|
||||||
|
*/
|
||||||
|
virtual char *findNextFrame(char *data, int &ndata, int dsize)=0;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors!
|
||||||
|
\param filebin input file stream (binary)
|
||||||
|
\returns pointer to the begin of the last good frame, NULL if no frame is found or last frame is incomplete
|
||||||
|
|
||||||
|
*/
|
||||||
|
virtual char *readNextFrame(ifstream &filebin)=0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -9,10 +9,11 @@
|
|||||||
template <class dataType>
|
template <class dataType>
|
||||||
class slsReceiverData : public slsDetectorData<dataType> {
|
class slsReceiverData : public slsDetectorData<dataType> {
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
slsReceiver data structure. Works for data acquired using the
|
slsReceiver data structure. Works for data acquired using the slsDetectorReceiver subdivided in different packets with headers and footers.
|
||||||
slsDetectorReceiver subdivided in different packets with headers and footers.
|
|
||||||
Inherits and implements slsDetectorData.
|
Inherits and implements slsDetectorData.
|
||||||
|
|
||||||
Constructor (no error checking if datasize and offsets are compatible!)
|
Constructor (no error checking if datasize and offsets are compatible!)
|
||||||
@ -20,48 +21,43 @@ Constructor (no error checking if datasize and offsets are compatible!)
|
|||||||
\param npy number of pixels in the y direction (1 for strips)
|
\param npy number of pixels in the y direction (1 for strips)
|
||||||
\param np number of packets
|
\param np number of packets
|
||||||
\param psize packets size
|
\param psize packets size
|
||||||
\param dMap array of size nx*ny storing the pointers to the data in the dataset
|
\param dMap array of size nx*ny storing the pointers to the data in the dataset (as offset)
|
||||||
(as offset) \param dMask Array of size nx*ny storing the polarity of the data in
|
\param dMask Array of size nx*ny storing the polarity of the data in the dataset (should be 0 if no inversion is required, 0xffffffff is inversion is required)
|
||||||
the dataset (should be 0 if no inversion is required, 0xffffffff is inversion is
|
\param dROI Array of size nx*ny. The elements are 1s if the channel is good or in the ROI, 0 is bad or out of the ROI. NULL (default) means all 1s.
|
||||||
required) \param dROI Array of size nx*ny. The elements are 1s if the channel is
|
|
||||||
good or in the ROI, 0 is bad or out of the ROI. NULL (default) means all 1s.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
slsReceiverData(int npx, int npy, int np, int psize, int **dMap = NULL,
|
slsReceiverData(int npx, int npy, int np, int psize, int **dMap=NULL, dataType **dMask=NULL, int **dROI=NULL): slsDetectorData<dataType>(npx, npy, np*psize, dMap, dMask, dROI), nPackets(np), packetSize(psize) {};
|
||||||
dataType **dMask = NULL, int **dROI = NULL)
|
|
||||||
: slsDetectorData<dataType>(npx, npy, np * psize, dMap, dMask, dROI),
|
|
||||||
nPackets(np), packetSize(psize){};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Returns the frame number for the given dataset. Virtual func: works for
|
Returns the frame number for the given dataset. Virtual func: works for slsDetectorReceiver data (also for each packet), but can be overloaded.
|
||||||
slsDetectorReceiver data (also for each packet), but can be overloaded. \param
|
\param buff pointer to the dataset
|
||||||
buff pointer to the dataset \returns frame number
|
\returns frame number
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
virtual int getFrameNumber(char *buff) {
|
virtual int getFrameNumber(char *buff){return ((*(int*)buff)&(0xffffff00))>>8;};
|
||||||
return ((*(int *)buff) & (0xffffff00)) >> 8;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Returns the packet number for the given dataset. Virtual func: works for
|
Returns the packet number for the given dataset. Virtual func: works for slsDetectorReceiver packets, but can be overloaded.
|
||||||
slsDetectorReceiver packets, but can be overloaded. \param buff pointer to the
|
\param buff pointer to the dataset
|
||||||
dataset \returns packet number number
|
\returns packet number number
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
virtual int getPacketNumber(char *buff){return (*(int*)buff)&0xff;};
|
virtual int getPacketNumber(char *buff){return (*(int*)buff)&0xff;};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Loops over a memory slot until a complete frame is found (i.e. all packets 0 to
|
Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors!
|
||||||
nPackets, same frame number). Can be overloaded for different kind of
|
\param data pointer to the memory to be analyzed
|
||||||
detectors! \param data pointer to the memory to be analyzed \param ndata size
|
\param ndata size of frame returned
|
||||||
of frame returned \param dsize size of the memory slot to be analyzed \returns
|
\param dsize size of the memory slot to be analyzed
|
||||||
pointer to the first packet of the last good frame (might be incomplete if
|
\returns pointer to the first packet of the last good frame (might be incomplete if npackets lower than the number of packets), or NULL if no frame is found
|
||||||
npackets lower than the number of packets), or NULL if no frame is found
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -75,8 +71,7 @@ good or in the ROI, 0 is bad or out of the ROI. NULL (default) means all 1s.
|
|||||||
//cout <<"fnum:"<<fn<<" pnum:"<<pnum<<" np:"<< np << "\t";
|
//cout <<"fnum:"<<fn<<" pnum:"<<pnum<<" np:"<< np << "\t";
|
||||||
|
|
||||||
if (pnum<1 || pnum>nPackets) {
|
if (pnum<1 || pnum>nPackets) {
|
||||||
// cout << "Bad packet number " << pnum << " frame "<< fn <<
|
//cout << "Bad packet number " << pnum << " frame "<< fn << endl;
|
||||||
// endl;
|
|
||||||
retval=NULL;
|
retval=NULL;
|
||||||
np=0;
|
np=0;
|
||||||
} else if (pnum==1) {
|
} else if (pnum==1) {
|
||||||
@ -87,8 +82,7 @@ good or in the ROI, 0 is bad or out of the ROI. NULL (default) means all 1s.
|
|||||||
fnum=fn;
|
fnum=fn;
|
||||||
} else if (fn!=fnum) {
|
} else if (fn!=fnum) {
|
||||||
if (fnum!=-1) {
|
if (fnum!=-1) {
|
||||||
/* cout << " **Incomplete frame number " << fnum << " pnum "
|
/* cout << " **Incomplete frame number " << fnum << " pnum " << pnum << " " << getFrameNumber(p) << endl;*/
|
||||||
* << pnum << " " << getFrameNumber(p) << endl;*/
|
|
||||||
retval=NULL;
|
retval=NULL;
|
||||||
}
|
}
|
||||||
np=0;
|
np=0;
|
||||||
@ -97,30 +91,24 @@ good or in the ROI, 0 is bad or out of the ROI. NULL (default) means all 1s.
|
|||||||
dd+=packetSize;
|
dd+=packetSize;
|
||||||
np++;
|
np++;
|
||||||
//cout <<"fnum:"<<fn<<" pnum:"<<pnum<<" np:"<< np << "\t";
|
//cout <<"fnum:"<<fn<<" pnum:"<<pnum<<" np:"<< np << "\t";
|
||||||
// cout << pnum << " " << fn << " " << np << " " << dd << " " <<
|
// cout << pnum << " " << fn << " " << np << " " << dd << " " << dsize << endl;
|
||||||
// dsize << endl;
|
|
||||||
if (np==nPackets){
|
if (np==nPackets){
|
||||||
if (pnum==nPackets) {
|
if (pnum==nPackets) {
|
||||||
//cprintf(BG_GREEN, "Frame Found\n");
|
//cprintf(BG_GREEN, "Frame Found\n");
|
||||||
// cout << "Frame found!" << endl;
|
// cout << "Frame found!" << endl;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
// cprintf(BG_RED, "Too many packets for this frame!
|
//cprintf(BG_RED, "Too many packets for this frame! fnum:%d, pnum:%d np:%d\n",fnum,pnum,np);
|
||||||
// fnum:%d, pnum:%d np:%d\n",fnum,pnum,np);
|
cout << "Too many packets for this frame! "<< fnum << " " << pnum << endl;//cprintf(BG_RED,"Exiting\n");exit(-1);
|
||||||
cout << "Too many packets for this frame! " << fnum << " "
|
|
||||||
<< pnum
|
|
||||||
<< endl; // cprintf(BG_RED,"Exiting\n");exit(-1);
|
|
||||||
retval=NULL;
|
retval=NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (np<nPackets) {
|
if (np<nPackets) {
|
||||||
if (np>0){
|
if (np>0){
|
||||||
// cprintf(BG_RED, "Too few packets for this frame! fnum:%d,
|
//cprintf(BG_RED, "Too few packets for this frame! fnum:%d, pnum:%d np:%d\n",fnum,pnum,np);
|
||||||
// pnum:%d np:%d\n",fnum,pnum,np);
|
cout << "Too few packets for this frame! "<< fnum << " " << pnum << " " << np <<endl;//cprintf(BG_RED,"Exiting\n");exit(-1);
|
||||||
cout << "Too few packets for this frame! " << fnum << " "
|
|
||||||
<< pnum << " " << np
|
|
||||||
<< endl; // cprintf(BG_RED,"Exiting\n");exit(-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,11 +119,9 @@ good or in the ROI, 0 is bad or out of the ROI. NULL (default) means all 1s.
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Loops over a file stream until a complete frame is found (i.e. all packets 0 to
|
Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors!
|
||||||
nPackets, same frame number). Can be overloaded for different kind of
|
\param filebin input file stream (binary)
|
||||||
detectors! \param filebin input file stream (binary) \returns pointer to the
|
\returns pointer to the first packet of the last good frame, NULL if no frame is found or last frame is incomplete
|
||||||
first packet of the last good frame, NULL if no frame is found or last frame is
|
|
||||||
incomplete
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -153,6 +139,7 @@ good or in the ROI, 0 is bad or out of the ROI. NULL (default) means all 1s.
|
|||||||
np=nd/packetSize;
|
np=nd/packetSize;
|
||||||
// cout << np << endl;
|
// cout << np << endl;
|
||||||
|
|
||||||
|
|
||||||
if (retval==data && np==nPackets) {
|
if (retval==data && np==nPackets) {
|
||||||
// cout << "-" << endl;
|
// cout << "-" << endl;
|
||||||
return data;
|
return data;
|
||||||
@ -164,8 +151,7 @@ good or in the ROI, 0 is bad or out of the ROI. NULL (default) means all 1s.
|
|||||||
} else if (retval!=NULL) {
|
} else if (retval!=NULL) {
|
||||||
// cout << "+" << endl;;
|
// cout << "+" << endl;;
|
||||||
for (int ip=0; ip<np; ip++)
|
for (int ip=0; ip<np; ip++)
|
||||||
memcpy(data + ip * packetSize,
|
memcpy(data+ip*packetSize,retval+ip*packetSize,packetSize);
|
||||||
retval + ip * packetSize, packetSize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (np>nPackets) {
|
} else if (np>nPackets) {
|
||||||
@ -182,14 +168,13 @@ good or in the ROI, 0 is bad or out of the ROI. NULL (default) means all 1s.
|
|||||||
return NULL;
|
return NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Loops over a file stream until a complete frame is found (i.e. all
|
Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors!
|
||||||
packets 0 to nPackets, same frame number). Can be overloaded for
|
\param filebin input file stream (binary)
|
||||||
different kind of detectors! \param filebin input file stream (binary)
|
|
||||||
\param fnum frame number of frame returned
|
\param fnum frame number of frame returned
|
||||||
\returns pointer to the first packet of the last good frame, NULL if no
|
\returns pointer to the first packet of the last good frame, NULL if no frame is found or last frame is incomplete
|
||||||
frame is found or last frame is incomplete
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -209,6 +194,7 @@ good or in the ROI, 0 is bad or out of the ROI. NULL (default) means all 1s.
|
|||||||
np=nd/packetSize;
|
np=nd/packetSize;
|
||||||
// cout << np << endl;
|
// cout << np << endl;
|
||||||
|
|
||||||
|
|
||||||
if (retval==data && np==nPackets) {
|
if (retval==data && np==nPackets) {
|
||||||
// cout << "-" << endl;
|
// cout << "-" << endl;
|
||||||
return data;
|
return data;
|
||||||
@ -220,8 +206,7 @@ good or in the ROI, 0 is bad or out of the ROI. NULL (default) means all 1s.
|
|||||||
} else if (retval!=NULL) {
|
} else if (retval!=NULL) {
|
||||||
// cout << "+" << endl;;
|
// cout << "+" << endl;;
|
||||||
for (int ip=0; ip<np; ip++)
|
for (int ip=0; ip<np; ip++)
|
||||||
memcpy(data + ip * packetSize,
|
memcpy(data+ip*packetSize,retval+ip*packetSize,packetSize);
|
||||||
retval + ip * packetSize, packetSize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (np>nPackets) {
|
} else if (np>nPackets) {
|
||||||
@ -239,13 +224,9 @@ good or in the ROI, 0 is bad or out of the ROI. NULL (default) means all 1s.
|
|||||||
return NULL;
|
return NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual int *readNextFramewithMissingPackets(ifstream &filebin, int &fnum) {
|
virtual int* readNextFramewithMissingPackets(ifstream &filebin, int& fnum) {return NULL;}
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
virtual void getChannelArray(double* data, char* buffer){};
|
virtual void getChannelArray(double* data, char* buffer){};
|
||||||
virtual int *readNextFrameOnlyData(ifstream &filebin, int &fnum) {
|
virtual int* readNextFrameOnlyData(ifstream &filebin, int& fnum) {return NULL;};
|
||||||
return NULL;
|
|
||||||
};
|
|
||||||
virtual int* decodeData(int* datain) {return NULL;};
|
virtual int* decodeData(int* datain) {return NULL;};
|
||||||
virtual int getPacketNumber(int x, int y) {return 0;};
|
virtual int getPacketNumber(int x, int y) {return 0;};
|
||||||
|
|
||||||
@ -254,4 +235,6 @@ good or in the ROI, 0 is bad or out of the ROI. NULL (default) means all 1s.
|
|||||||
const int packetSize; /**< size of a udp packet */
|
const int packetSize; /**< size of a udp packet */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -6,23 +6,20 @@
|
|||||||
#define MYROOT
|
#define MYROOT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef MYROOT
|
#ifdef MYROOT
|
||||||
#include <TGraphErrors.h>
|
#include <TMath.h>
|
||||||
#include <TH1F.h>
|
#include <TH1F.h>
|
||||||
#include <TH2F.h>
|
#include <TH2F.h>
|
||||||
#include <TMath.h>
|
#include <TGraphErrors.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#define max(a,b) ((a) > (b) ? (a) : (b))
|
#define max(a,b) ((a) > (b) ? (a) : (b))
|
||||||
#define min(a,b) ((a) < (b) ? (a) : (b))
|
#define min(a,b) ((a) < (b) ? (a) : (b))
|
||||||
#define ELEM_SWAP(a, b) \
|
#define ELEM_SWAP(a,b) { register int t=(a);(a)=(b);(b)=t; }
|
||||||
{ \
|
|
||||||
register int t = (a); \
|
|
||||||
(a) = (b); \
|
|
||||||
(b) = t; \
|
|
||||||
}
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -32,8 +29,8 @@ Double_t energyCalibrationFunctions::pedestal(Double_t *x, Double_t *par) {
|
|||||||
return par[0]-par[1]*sign*x[0];
|
return par[0]-par[1]*sign*x[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
Double_t energyCalibrationFunctions::gaussChargeSharing(Double_t *x,
|
|
||||||
Double_t *par) {
|
Double_t energyCalibrationFunctions::gaussChargeSharing(Double_t *x, Double_t *par) {
|
||||||
Double_t f, arg=0;
|
Double_t f, arg=0;
|
||||||
// Gaussian exponent
|
// Gaussian exponent
|
||||||
if (par[3]!=0) {
|
if (par[3]!=0) {
|
||||||
@ -47,15 +44,12 @@ Double_t energyCalibrationFunctions::gaussChargeSharing(Double_t *x,
|
|||||||
return par[4]*f+pedestal(x,par);
|
return par[4]*f+pedestal(x,par);
|
||||||
}
|
}
|
||||||
|
|
||||||
Double_t energyCalibrationFunctions::gaussChargeSharingKb(Double_t *x,
|
Double_t energyCalibrationFunctions::gaussChargeSharingKb(Double_t *x, Double_t *par) {
|
||||||
Double_t *par) {
|
|
||||||
Double_t f, arg=0,argb=0;
|
Double_t f, arg=0,argb=0;
|
||||||
// Gaussian exponent
|
// Gaussian exponent
|
||||||
if (par[3]!=0) {
|
if (par[3]!=0) {
|
||||||
arg=sign*(x[0]-par[2])/par[3];
|
arg=sign*(x[0]-par[2])/par[3];
|
||||||
argb = sign * (x[0] - (par[6] * par[2])) /
|
argb=sign*(x[0]-(par[6]*par[2]))/par[3]; // using absolute kb mean might seem better but like this the ratio can be fixed
|
||||||
par[3]; // using absolute kb mean might seem better but like this
|
|
||||||
// the ratio can be fixed
|
|
||||||
}
|
}
|
||||||
// the Gaussian
|
// the Gaussian
|
||||||
f=TMath::Exp(-1*arg*arg/2.);
|
f=TMath::Exp(-1*arg*arg/2.);
|
||||||
@ -67,9 +61,7 @@ Double_t energyCalibrationFunctions::gaussChargeSharingKb(Double_t *x,
|
|||||||
return par[4]*f+pedestal(x,par);
|
return par[4]*f+pedestal(x,par);
|
||||||
}
|
}
|
||||||
|
|
||||||
Double_t
|
Double_t energyCalibrationFunctions::gaussChargeSharingKaDoublet(Double_t *x, Double_t *par) {
|
||||||
energyCalibrationFunctions::gaussChargeSharingKaDoublet(Double_t *x,
|
|
||||||
Double_t *par) {
|
|
||||||
Double_t f, f2, arg=0, arg2=0;
|
Double_t f, f2, arg=0, arg2=0;
|
||||||
// Gaussian exponent
|
// Gaussian exponent
|
||||||
if (par[3]!=0) {
|
if (par[3]!=0) {
|
||||||
@ -81,18 +73,14 @@ energyCalibrationFunctions::gaussChargeSharingKaDoublet(Double_t *x,
|
|||||||
f2=TMath::Exp(-1*arg2*arg2/2.);
|
f2=TMath::Exp(-1*arg2*arg2/2.);
|
||||||
// Gaussian + error function
|
// Gaussian + error function
|
||||||
f=f+par[5]/2.*(TMath::Erfc(arg/(TMath::Sqrt(2.))));
|
f=f+par[5]/2.*(TMath::Erfc(arg/(TMath::Sqrt(2.))));
|
||||||
f2 = f2 +
|
f2=f2+par[5]/2.*(TMath::Erfc(arg/(TMath::Sqrt(2.)))); // shouldn't this be arg2?
|
||||||
par[5] / 2. *
|
|
||||||
(TMath::Erfc(arg / (TMath::Sqrt(2.)))); // shouldn't this be arg2?
|
|
||||||
// Gaussian + error function + pedestal
|
// Gaussian + error function + pedestal
|
||||||
return par[4]*f+par[7]*f2+pedestal(x,par);
|
return par[4]*f+par[7]*f2+pedestal(x,par);
|
||||||
}
|
}
|
||||||
|
|
||||||
Double_t energyCalibrationFunctions::gaussChargeSharingPixel(Double_t *x,
|
Double_t energyCalibrationFunctions::gaussChargeSharingPixel(Double_t *x, Double_t *par) {
|
||||||
Double_t *par) {
|
|
||||||
Double_t f;
|
Double_t f;
|
||||||
if (par[3] <= 0 || par[2] * (*x) <= 0 || par[5] < 0 || par[4] <= 0)
|
if (par[3]<=0 || par[2]*(*x)<=0 || par[5]<0 || par[4]<=0) return 0;
|
||||||
return 0;
|
|
||||||
|
|
||||||
Double_t pp[3];
|
Double_t pp[3];
|
||||||
|
|
||||||
@ -100,6 +88,7 @@ Double_t energyCalibrationFunctions::gaussChargeSharingPixel(Double_t *x,
|
|||||||
pp[1]=par[2];
|
pp[1]=par[2];
|
||||||
pp[2]=par[3];
|
pp[2]=par[3];
|
||||||
|
|
||||||
|
|
||||||
f=(par[5]-par[6]*(TMath::Log(*x/par[2])))*erfBox(x,pp);
|
f=(par[5]-par[6]*(TMath::Log(*x/par[2])))*erfBox(x,pp);
|
||||||
f+=par[4]*TMath::Gaus(*x, par[2], par[3], kTRUE);
|
f+=par[4]*TMath::Gaus(*x, par[2], par[3], kTRUE);
|
||||||
return f+pedestal(x,par);
|
return f+pedestal(x,par);
|
||||||
@ -107,6 +96,8 @@ Double_t energyCalibrationFunctions::gaussChargeSharingPixel(Double_t *x,
|
|||||||
|
|
||||||
Double_t energyCalibrationFunctions::erfBox(Double_t *z, Double_t *par) {
|
Double_t energyCalibrationFunctions::erfBox(Double_t *z, Double_t *par) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Double_t m=par[0];
|
Double_t m=par[0];
|
||||||
Double_t M=par[1];
|
Double_t M=par[1];
|
||||||
|
|
||||||
@ -118,39 +109,39 @@ Double_t energyCalibrationFunctions::erfBox(Double_t *z, Double_t *par) {
|
|||||||
if (m==M)
|
if (m==M)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
if (par[2]<=0) {
|
if (par[2]<=0) {
|
||||||
if (*z>=m && *z<=M)
|
if (*z>=m && *z<=M)
|
||||||
return 1./(M-m);
|
return 1./(M-m);
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (TMath::Erfc((z[0] - M) / par[2]) -
|
return (TMath::Erfc((z[0]-M)/par[2])-TMath::Erfc((z[0]-m)/par[2]))*0.5/(M-m);
|
||||||
TMath::Erfc((z[0] - m) / par[2])) *
|
|
||||||
0.5 / (M - m);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// basic erf function
|
// basic erf function
|
||||||
Double_t energyCalibrationFunctions::erfFunction(Double_t *x, Double_t *par) {
|
Double_t energyCalibrationFunctions::erfFunction(Double_t *x, Double_t *par) {
|
||||||
double arg=0;
|
double arg=0;
|
||||||
if (par[1] != 0)
|
if (par[1]!=0) arg=(par[0]-x[0])/par[1];
|
||||||
arg = (par[0] - x[0]) / par[1];
|
|
||||||
return ((par[2]/2.*(1+TMath::Erf(sign*arg/(TMath::Sqrt(2))))));
|
return ((par[2]/2.*(1+TMath::Erf(sign*arg/(TMath::Sqrt(2))))));
|
||||||
};
|
};
|
||||||
|
|
||||||
Double_t energyCalibrationFunctions::erfFunctionChargeSharing(Double_t *x,
|
|
||||||
Double_t *par) {
|
Double_t energyCalibrationFunctions::erfFunctionChargeSharing(Double_t *x, Double_t *par) {
|
||||||
Double_t f;
|
Double_t f;
|
||||||
|
|
||||||
f = erfFunction(x, par + 2) * (1 + par[5] * (par[2] - x[0])) + par[0] -
|
f=erfFunction(x, par+2)*(1+par[5]*(par[2]-x[0]))+par[0]-par[1]*x[0]*sign;
|
||||||
par[1] * x[0] * sign;
|
|
||||||
return f;
|
return f;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Double_t energyCalibrationFunctions::erfFuncFluo(Double_t *x, Double_t *par) {
|
Double_t energyCalibrationFunctions::erfFuncFluo(Double_t *x, Double_t *par) {
|
||||||
Double_t f;
|
Double_t f;
|
||||||
f = erfFunctionChargeSharing(x, par) +
|
f=erfFunctionChargeSharing(x, par)+erfFunction(x, par+6)*(1+par[9]*(par[6]-x[0]));
|
||||||
erfFunction(x, par + 6) * (1 + par[9] * (par[6] - x[0]));
|
|
||||||
return f;
|
return f;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
@ -177,14 +168,13 @@ double energyCalibrationFunctions::median(double *x, int n) {
|
|||||||
return xmed[k];
|
return xmed[k];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int energyCalibrationFunctions::quick_select(int arr[], int n){
|
int energyCalibrationFunctions::quick_select(int arr[], int n){
|
||||||
int low, high ;
|
int low, high ;
|
||||||
int median;
|
int median;
|
||||||
int middle, ll, hh;
|
int middle, ll, hh;
|
||||||
|
|
||||||
low = 0;
|
low = 0 ; high = n-1 ; median = (low + high) / 2;
|
||||||
high = n - 1;
|
|
||||||
median = (low + high) / 2;
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (high <= low) /* One element only */
|
if (high <= low) /* One element only */
|
||||||
return arr[median] ;
|
return arr[median] ;
|
||||||
@ -197,12 +187,9 @@ int energyCalibrationFunctions::quick_select(int arr[], int n) {
|
|||||||
|
|
||||||
/* Find median of low, middle and high items; swap into position low */
|
/* Find median of low, middle and high items; swap into position low */
|
||||||
middle = (low + high) / 2;
|
middle = (low + high) / 2;
|
||||||
if (arr[middle] > arr[high])
|
if (arr[middle] > arr[high]) ELEM_SWAP(arr[middle], arr[high]) ;
|
||||||
ELEM_SWAP(arr[middle], arr[high]);
|
if (arr[low] > arr[high]) ELEM_SWAP(arr[low], arr[high]) ;
|
||||||
if (arr[low] > arr[high])
|
if (arr[middle] > arr[low]) ELEM_SWAP(arr[middle], arr[low]) ;
|
||||||
ELEM_SWAP(arr[low], arr[high]);
|
|
||||||
if (arr[middle] > arr[low])
|
|
||||||
ELEM_SWAP(arr[middle], arr[low]);
|
|
||||||
|
|
||||||
/* Swap low item (now in position middle) into position (low+1) */
|
/* Swap low item (now in position middle) into position (low+1) */
|
||||||
ELEM_SWAP(arr[middle], arr[low+1]) ;
|
ELEM_SWAP(arr[middle], arr[low+1]) ;
|
||||||
@ -211,12 +198,8 @@ int energyCalibrationFunctions::quick_select(int arr[], int n) {
|
|||||||
ll = low + 1;
|
ll = low + 1;
|
||||||
hh = high;
|
hh = high;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
do
|
do ll++; while (arr[low] > arr[ll]) ;
|
||||||
ll++;
|
do hh--; while (arr[hh] > arr[low]) ;
|
||||||
while (arr[low] > arr[ll]);
|
|
||||||
do
|
|
||||||
hh--;
|
|
||||||
while (arr[hh] > arr[low]);
|
|
||||||
|
|
||||||
if (hh < ll)
|
if (hh < ll)
|
||||||
break;
|
break;
|
||||||
@ -239,31 +222,27 @@ int energyCalibrationFunctions::kth_smallest(int *a, int n, int k) {
|
|||||||
register int i,j,l,m ;
|
register int i,j,l,m ;
|
||||||
register double x ;
|
register double x ;
|
||||||
|
|
||||||
l = 0;
|
l=0 ; m=n-1 ;
|
||||||
m = n - 1;
|
|
||||||
while (l<m) {
|
while (l<m) {
|
||||||
x=a[k] ;
|
x=a[k] ;
|
||||||
i=l ;
|
i=l ;
|
||||||
j=m ;
|
j=m ;
|
||||||
do {
|
do {
|
||||||
while (a[i] < x)
|
while (a[i]<x) i++ ;
|
||||||
i++;
|
while (x<a[j]) j-- ;
|
||||||
while (x < a[j])
|
|
||||||
j--;
|
|
||||||
if (i<=j) {
|
if (i<=j) {
|
||||||
ELEM_SWAP(a[i],a[j]) ;
|
ELEM_SWAP(a[i],a[j]) ;
|
||||||
i++;
|
i++ ; j-- ;
|
||||||
j--;
|
|
||||||
}
|
}
|
||||||
} while (i<=j) ;
|
} while (i<=j) ;
|
||||||
if (j < k)
|
if (j<k) l=i ;
|
||||||
l = i;
|
if (k<i) m=j ;
|
||||||
if (k < i)
|
|
||||||
m = j;
|
|
||||||
}
|
}
|
||||||
return a[k] ;
|
return a[k] ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef MYROOT
|
#ifdef MYROOT
|
||||||
Double_t energyCalibrationFunctions::spectrum(Double_t *x, Double_t *par) {
|
Double_t energyCalibrationFunctions::spectrum(Double_t *x, Double_t *par) {
|
||||||
return gaussChargeSharing(x,par);
|
return gaussChargeSharing(x,par);
|
||||||
@ -273,8 +252,7 @@ Double_t energyCalibrationFunctions::spectrumkb(Double_t *x, Double_t *par) {
|
|||||||
return gaussChargeSharingKb(x,par);
|
return gaussChargeSharingKb(x,par);
|
||||||
}
|
}
|
||||||
|
|
||||||
Double_t energyCalibrationFunctions::spectrumkadoublet(Double_t *x,
|
Double_t energyCalibrationFunctions::spectrumkadoublet(Double_t *x, Double_t *par) {
|
||||||
Double_t *par) {
|
|
||||||
return gaussChargeSharingKaDoublet(x,par);
|
return gaussChargeSharingKaDoublet(x,par);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,66 +260,65 @@ Double_t energyCalibrationFunctions::spectrumPixel(Double_t *x, Double_t *par) {
|
|||||||
return gaussChargeSharingPixel(x,par);
|
return gaussChargeSharingPixel(x,par);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Double_t energyCalibrationFunctions::scurve(Double_t *x, Double_t *par) {
|
Double_t energyCalibrationFunctions::scurve(Double_t *x, Double_t *par) {
|
||||||
return erfFunctionChargeSharing(x,par);
|
return erfFunctionChargeSharing(x,par);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Double_t energyCalibrationFunctions::scurveFluo(Double_t *x, Double_t *par) {
|
Double_t energyCalibrationFunctions::scurveFluo(Double_t *x, Double_t *par) {
|
||||||
return erfFuncFluo(x,par);
|
return erfFuncFluo(x,par);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
energyCalibration::energyCalibration()
|
energyCalibration::energyCalibration() :
|
||||||
:
|
|
||||||
#ifdef MYROOT
|
#ifdef MYROOT
|
||||||
fit_min(-1), fit_max(-1), bg_offset(-1), bg_slope(-1), flex(-1),
|
fit_min(-1),
|
||||||
noise(-1), ampl(-1), cs_slope(-1), kb_mean(-1), kb_frac(-1), mean2(-1),
|
fit_max(-1),
|
||||||
ampl2(-1), fscurve(NULL), fspectrum(NULL), fspectrumkb(NULL),
|
bg_offset(-1),
|
||||||
|
bg_slope(-1),
|
||||||
|
flex(-1),
|
||||||
|
noise(-1),
|
||||||
|
ampl(-1),
|
||||||
|
cs_slope(-1),
|
||||||
|
kb_mean(-1),
|
||||||
|
kb_frac(-1),
|
||||||
|
mean2(-1),
|
||||||
|
ampl2(-1),
|
||||||
|
fscurve(NULL),
|
||||||
|
fspectrum(NULL),
|
||||||
|
fspectrumkb(NULL),
|
||||||
fspectrumkadoublet(NULL),
|
fspectrumkadoublet(NULL),
|
||||||
#endif
|
#endif
|
||||||
funcs(NULL), plot_flag(1), // fit parameters output to screen
|
funcs(NULL),
|
||||||
cs_flag(1) {
|
plot_flag(1), // fit parameters output to screen
|
||||||
|
cs_flag(1)
|
||||||
|
{
|
||||||
|
|
||||||
#ifdef MYROOT
|
#ifdef MYROOT
|
||||||
funcs=new energyCalibrationFunctions();
|
funcs=new energyCalibrationFunctions();
|
||||||
|
|
||||||
fscurve = new TF1("fscurve", funcs, &energyCalibrationFunctions::scurve, 0,
|
fscurve=new TF1("fscurve",funcs,&energyCalibrationFunctions::scurve,0,1000,6,"energyCalibrationFunctions","scurve");
|
||||||
1000, 6, "energyCalibrationFunctions", "scurve");
|
fscurve->SetParNames("Background Offset","Background Slope","Inflection Point","Noise RMS", "Number of Photons","Charge Sharing Slope");
|
||||||
fscurve->SetParNames("Background Offset", "Background Slope",
|
|
||||||
"Inflection Point", "Noise RMS", "Number of Photons",
|
|
||||||
"Charge Sharing Slope");
|
|
||||||
|
|
||||||
fspectrum =
|
fspectrum=new TF1("fspectrum",funcs,&energyCalibrationFunctions::spectrum,0,1000,6,"energyCalibrationFunctions","spectrum");
|
||||||
new TF1("fspectrum", funcs, &energyCalibrationFunctions::spectrum, 0,
|
fspectrum->SetParNames("Background Pedestal","Background slope", "Peak position","Noise RMS", "Number of Photons","Charge Sharing Pedestal");
|
||||||
1000, 6, "energyCalibrationFunctions", "spectrum");
|
fspectrumkb=new TF1("fspectrumkb",funcs,&energyCalibrationFunctions::spectrumkb,0,1000,8,"energyCalibrationFunctions","spectrumkb");
|
||||||
fspectrum->SetParNames("Background Pedestal", "Background slope",
|
fspectrumkb->SetParNames("Background Pedestal","Background slope", "Peak position","Noise RMS", "Number of Photons","Charge Sharing Pedestal","kb mean","kb frac");
|
||||||
"Peak position", "Noise RMS", "Number of Photons",
|
|
||||||
"Charge Sharing Pedestal");
|
|
||||||
fspectrumkb =
|
|
||||||
new TF1("fspectrumkb", funcs, &energyCalibrationFunctions::spectrumkb,
|
|
||||||
0, 1000, 8, "energyCalibrationFunctions", "spectrumkb");
|
|
||||||
fspectrumkb->SetParNames("Background Pedestal", "Background slope",
|
|
||||||
"Peak position", "Noise RMS", "Number of Photons",
|
|
||||||
"Charge Sharing Pedestal", "kb mean", "kb frac");
|
|
||||||
|
|
||||||
fspectrumkadoublet =
|
fspectrumkadoublet=new TF1("fspectrumkadoublet",funcs,&energyCalibrationFunctions::spectrumkadoublet,0,1000,8,"energyCalibrationFunctions","spectrumkadoublet");
|
||||||
new TF1("fspectrumkadoublet", funcs,
|
fspectrumkadoublet->SetParNames("Background Pedestal","Background slope", "Peak position","Noise RMS", "Number of Photons","Charge Sharing Pedestal","ka2 mean","n2");
|
||||||
&energyCalibrationFunctions::spectrumkadoublet, 0, 1000, 8,
|
|
||||||
"energyCalibrationFunctions", "spectrumkadoublet");
|
|
||||||
fspectrumkadoublet->SetParNames(
|
|
||||||
"Background Pedestal", "Background slope", "Peak position", "Noise RMS",
|
|
||||||
"Number of Photons", "Charge Sharing Pedestal", "ka2 mean", "n2");
|
|
||||||
|
|
||||||
fspixel =
|
fspixel=new TF1("fspixel",funcs,&energyCalibrationFunctions::spectrumPixel,0,1000,7,"energyCalibrationFunctions","spectrumPixel");
|
||||||
new TF1("fspixel", funcs, &energyCalibrationFunctions::spectrumPixel, 0,
|
fspixel->SetParNames("Background Pedestal","Background slope", "Peak position","Noise RMS", "Number of Photons","Charge Sharing Pedestal","Corner");
|
||||||
1000, 7, "energyCalibrationFunctions", "spectrumPixel");
|
|
||||||
fspixel->SetParNames("Background Pedestal", "Background slope",
|
|
||||||
"Peak position", "Noise RMS", "Number of Photons",
|
|
||||||
"Charge Sharing Pedestal", "Corner");
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void energyCalibration::fixParameter(int ip, Double_t val){
|
void energyCalibration::fixParameter(int ip, Double_t val){
|
||||||
|
|
||||||
fscurve->FixParameter(ip, val);
|
fscurve->FixParameter(ip, val);
|
||||||
@ -350,6 +327,7 @@ void energyCalibration::fixParameter(int ip, Double_t val) {
|
|||||||
fspectrumkadoublet->FixParameter(ip, val);
|
fspectrumkadoublet->FixParameter(ip, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void energyCalibration::releaseParameter(int ip){
|
void energyCalibration::releaseParameter(int ip){
|
||||||
|
|
||||||
fscurve->ReleaseParameter(ip);
|
fscurve->ReleaseParameter(ip);
|
||||||
@ -358,6 +336,12 @@ void energyCalibration::releaseParameter(int ip) {
|
|||||||
fspectrumkadoublet->ReleaseParameter(ip);
|
fspectrumkadoublet->ReleaseParameter(ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
energyCalibration::~energyCalibration(){
|
energyCalibration::~energyCalibration(){
|
||||||
#ifdef MYROOT
|
#ifdef MYROOT
|
||||||
delete fscurve;
|
delete fscurve;
|
||||||
@ -365,12 +349,16 @@ energyCalibration::~energyCalibration() {
|
|||||||
delete fspectrumkb;
|
delete fspectrumkb;
|
||||||
delete fspectrumkadoublet;
|
delete fspectrumkadoublet;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MYROOT
|
#ifdef MYROOT
|
||||||
|
|
||||||
TH1F *energyCalibration::createMedianHistogram(TH2F *h2, int ch0, int nch,
|
|
||||||
int direction) {
|
|
||||||
|
|
||||||
|
|
||||||
|
TH1F* energyCalibration::createMedianHistogram(TH2F* h2, int ch0, int nch, int direction) {
|
||||||
|
|
||||||
if (h2==NULL || nch==0)
|
if (h2==NULL || nch==0)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -381,8 +369,7 @@ TH1F *energyCalibration::createMedianHistogram(TH2F *h2, int ch0, int nch,
|
|||||||
double val=-1;
|
double val=-1;
|
||||||
|
|
||||||
if (direction==0) {
|
if (direction==0) {
|
||||||
h1 = new TH1F("median", "Median", h2->GetYaxis()->GetNbins(),
|
h1=new TH1F("median","Median",h2->GetYaxis()->GetNbins(),h2->GetYaxis()->GetXmin(),h2->GetYaxis()->GetXmax());
|
||||||
h2->GetYaxis()->GetXmin(), h2->GetYaxis()->GetXmax());
|
|
||||||
for (int ib=0; ib<h1->GetXaxis()->GetNbins(); ib++) {
|
for (int ib=0; ib<h1->GetXaxis()->GetNbins(); ib++) {
|
||||||
for (int ich=0; ich<nch; ich++) {
|
for (int ich=0; ich<nch; ich++) {
|
||||||
x[ich]=h2->GetBinContent(ch0+ich+1,ib+1);
|
x[ich]=h2->GetBinContent(ch0+ich+1,ib+1);
|
||||||
@ -391,8 +378,7 @@ TH1F *energyCalibration::createMedianHistogram(TH2F *h2, int ch0, int nch,
|
|||||||
h1->SetBinContent(ib+1,val);
|
h1->SetBinContent(ib+1,val);
|
||||||
}
|
}
|
||||||
} else if (direction==1) {
|
} else if (direction==1) {
|
||||||
h1 = new TH1F("median", "Median", h2->GetXaxis()->GetNbins(),
|
h1=new TH1F("median","Median",h2->GetXaxis()->GetNbins(),h2->GetXaxis()->GetXmin(),h2->GetXaxis()->GetXmax());
|
||||||
h2->GetXaxis()->GetXmin(), h2->GetXaxis()->GetXmax());
|
|
||||||
for (int ib=0; ib<h1->GetYaxis()->GetNbins(); ib++) {
|
for (int ib=0; ib<h1->GetYaxis()->GetNbins(); ib++) {
|
||||||
for (int ich=0; ich<nch; ich++) {
|
for (int ich=0; ich<nch; ich++) {
|
||||||
x[ich]=h2->GetBinContent(ib+1,ch0+ich+1);
|
x[ich]=h2->GetBinContent(ib+1,ch0+ich+1);
|
||||||
@ -404,8 +390,22 @@ TH1F *energyCalibration::createMedianHistogram(TH2F *h2, int ch0, int nch,
|
|||||||
delete [] x;
|
delete [] x;
|
||||||
|
|
||||||
return h1;
|
return h1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void energyCalibration::setStartParameters(Double_t *par){
|
void energyCalibration::setStartParameters(Double_t *par){
|
||||||
bg_offset=par[0];
|
bg_offset=par[0];
|
||||||
bg_slope=par[1];
|
bg_slope=par[1];
|
||||||
@ -441,6 +441,7 @@ void energyCalibration::setStartParametersKaDoublet(Double_t *par) {
|
|||||||
//fit_max = 800;
|
//fit_max = 800;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void energyCalibration::getStartParameters(Double_t *par){
|
void energyCalibration::getStartParameters(Double_t *par){
|
||||||
par[0]=bg_offset;
|
par[0]=bg_offset;
|
||||||
par[1]=bg_slope;
|
par[1]=bg_slope;
|
||||||
@ -472,6 +473,7 @@ int energyCalibration::setChargeSharing(int p) {
|
|||||||
return cs_flag;
|
return cs_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef MYROOT
|
#ifdef MYROOT
|
||||||
void energyCalibration::initFitFunction(TF1 *fun, TH1 *h1) {
|
void energyCalibration::initFitFunction(TF1 *fun, TH1 *h1) {
|
||||||
|
|
||||||
@ -485,29 +487,32 @@ void energyCalibration::initFitFunction(TF1 *fun, TH1 *h1) {
|
|||||||
if (min==-1)
|
if (min==-1)
|
||||||
min=h1->GetXaxis()->GetXmin();
|
min=h1->GetXaxis()->GetXmin();
|
||||||
|
|
||||||
|
|
||||||
if (bg_offset==-1)
|
if (bg_offset==-1)
|
||||||
mypar[0]=0;
|
mypar[0]=0;
|
||||||
else
|
else
|
||||||
mypar[0]=bg_offset;
|
mypar[0]=bg_offset;
|
||||||
|
|
||||||
|
|
||||||
if (bg_slope==-1)
|
if (bg_slope==-1)
|
||||||
mypar[1]=0;
|
mypar[1]=0;
|
||||||
else
|
else
|
||||||
mypar[1]=bg_slope;
|
mypar[1]=bg_slope;
|
||||||
|
|
||||||
|
|
||||||
if (flex==-1)
|
if (flex==-1)
|
||||||
mypar[2]=(min+max)/2.;
|
mypar[2]=(min+max)/2.;
|
||||||
else
|
else
|
||||||
mypar[2]=flex;
|
mypar[2]=flex;
|
||||||
|
|
||||||
|
|
||||||
if (noise==-1)
|
if (noise==-1)
|
||||||
mypar[3]=0.1;
|
mypar[3]=0.1;
|
||||||
else
|
else
|
||||||
mypar[3]=noise;
|
mypar[3]=noise;
|
||||||
|
|
||||||
if (ampl==-1)
|
if (ampl==-1)
|
||||||
mypar[4] =
|
mypar[4]=h1->GetBinContent(h1->GetXaxis()->FindBin(0.5*(max+min)));
|
||||||
h1->GetBinContent(h1->GetXaxis()->FindBin(0.5 * (max + min)));
|
|
||||||
else
|
else
|
||||||
mypar[4]=ampl;
|
mypar[4]=ampl;
|
||||||
|
|
||||||
@ -519,6 +524,7 @@ void energyCalibration::initFitFunction(TF1 *fun, TH1 *h1) {
|
|||||||
fun->SetParameters(mypar);
|
fun->SetParameters(mypar);
|
||||||
|
|
||||||
fun->SetRange(min,max);
|
fun->SetRange(min,max);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void energyCalibration::initFitFunctionKb(TF1 *fun, TH1 *h1) {
|
void energyCalibration::initFitFunctionKb(TF1 *fun, TH1 *h1) {
|
||||||
@ -533,29 +539,32 @@ void energyCalibration::initFitFunctionKb(TF1 *fun, TH1 *h1) {
|
|||||||
if (min==-1)
|
if (min==-1)
|
||||||
min=h1->GetXaxis()->GetXmin();
|
min=h1->GetXaxis()->GetXmin();
|
||||||
|
|
||||||
|
|
||||||
if (bg_offset==-1)
|
if (bg_offset==-1)
|
||||||
mypar[0]=0;
|
mypar[0]=0;
|
||||||
else
|
else
|
||||||
mypar[0]=bg_offset;
|
mypar[0]=bg_offset;
|
||||||
|
|
||||||
|
|
||||||
if (bg_slope==-1)
|
if (bg_slope==-1)
|
||||||
mypar[1]=0;
|
mypar[1]=0;
|
||||||
else
|
else
|
||||||
mypar[1]=bg_slope;
|
mypar[1]=bg_slope;
|
||||||
|
|
||||||
|
|
||||||
if (flex==-1)
|
if (flex==-1)
|
||||||
mypar[2]=(min+max)/2.;
|
mypar[2]=(min+max)/2.;
|
||||||
else
|
else
|
||||||
mypar[2]=flex;
|
mypar[2]=flex;
|
||||||
|
|
||||||
|
|
||||||
if (noise==-1)
|
if (noise==-1)
|
||||||
mypar[3]=0.1;
|
mypar[3]=0.1;
|
||||||
else
|
else
|
||||||
mypar[3]=noise;
|
mypar[3]=noise;
|
||||||
|
|
||||||
if (ampl==-1)
|
if (ampl==-1)
|
||||||
mypar[4] =
|
mypar[4]=h1->GetBinContent(h1->GetXaxis()->FindBin(0.5*(max+min)));
|
||||||
h1->GetBinContent(h1->GetXaxis()->FindBin(0.5 * (max + min)));
|
|
||||||
else
|
else
|
||||||
mypar[4]=ampl;
|
mypar[4]=ampl;
|
||||||
|
|
||||||
@ -577,6 +586,7 @@ void energyCalibration::initFitFunctionKb(TF1 *fun, TH1 *h1) {
|
|||||||
fun->SetParameters(mypar);
|
fun->SetParameters(mypar);
|
||||||
|
|
||||||
fun->SetRange(min,max);
|
fun->SetRange(min,max);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void energyCalibration::initFitFunctionKaDoublet(TF1 *fun, TH1 *h1) {
|
void energyCalibration::initFitFunctionKaDoublet(TF1 *fun, TH1 *h1) {
|
||||||
@ -591,29 +601,32 @@ void energyCalibration::initFitFunctionKaDoublet(TF1 *fun, TH1 *h1) {
|
|||||||
if (min==-1)
|
if (min==-1)
|
||||||
min=h1->GetXaxis()->GetXmin();
|
min=h1->GetXaxis()->GetXmin();
|
||||||
|
|
||||||
|
|
||||||
if (bg_offset==-1)
|
if (bg_offset==-1)
|
||||||
mypar[0]=0;
|
mypar[0]=0;
|
||||||
else
|
else
|
||||||
mypar[0]=bg_offset;
|
mypar[0]=bg_offset;
|
||||||
|
|
||||||
|
|
||||||
if (bg_slope==-1)
|
if (bg_slope==-1)
|
||||||
mypar[1]=0;
|
mypar[1]=0;
|
||||||
else
|
else
|
||||||
mypar[1]=bg_slope;
|
mypar[1]=bg_slope;
|
||||||
|
|
||||||
|
|
||||||
if (flex==-1)
|
if (flex==-1)
|
||||||
mypar[2]=(min+max)/2.;
|
mypar[2]=(min+max)/2.;
|
||||||
else
|
else
|
||||||
mypar[2]=flex;
|
mypar[2]=flex;
|
||||||
|
|
||||||
|
|
||||||
if (noise==-1)
|
if (noise==-1)
|
||||||
mypar[3]=0.1;
|
mypar[3]=0.1;
|
||||||
else
|
else
|
||||||
mypar[3]=noise;
|
mypar[3]=noise;
|
||||||
|
|
||||||
if (ampl==-1)
|
if (ampl==-1)
|
||||||
mypar[4] =
|
mypar[4]=h1->GetBinContent(h1->GetXaxis()->FindBin(0.5*(max+min)));
|
||||||
h1->GetBinContent(h1->GetXaxis()->FindBin(0.5 * (max + min)));
|
|
||||||
else
|
else
|
||||||
mypar[4]=ampl;
|
mypar[4]=ampl;
|
||||||
|
|
||||||
@ -635,10 +648,11 @@ void energyCalibration::initFitFunctionKaDoublet(TF1 *fun, TH1 *h1) {
|
|||||||
fun->SetParameters(mypar);
|
fun->SetParameters(mypar);
|
||||||
|
|
||||||
fun->SetRange(min,max);
|
fun->SetRange(min,max);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TF1 *energyCalibration::fitFunction(TF1 *fun, TH1 *h1, Double_t *mypar,
|
TF1* energyCalibration::fitFunction(TF1 *fun, TH1 *h1, Double_t *mypar, Double_t *emypar) {
|
||||||
Double_t *emypar) {
|
|
||||||
|
|
||||||
TF1* fitfun;
|
TF1* fitfun;
|
||||||
|
|
||||||
@ -659,8 +673,8 @@ TF1 *energyCalibration::fitFunction(TF1 *fun, TH1 *h1, Double_t *mypar,
|
|||||||
return fitfun;
|
return fitfun;
|
||||||
}
|
}
|
||||||
|
|
||||||
TF1 *energyCalibration::fitFunctionKb(TF1 *fun, TH1 *h1, Double_t *mypar,
|
TF1* energyCalibration::fitFunctionKb(TF1 *fun, TH1 *h1, Double_t *mypar, Double_t *emypar) {
|
||||||
Double_t *emypar) {
|
|
||||||
|
|
||||||
TF1* fitfun;
|
TF1* fitfun;
|
||||||
|
|
||||||
@ -681,8 +695,8 @@ TF1 *energyCalibration::fitFunctionKb(TF1 *fun, TH1 *h1, Double_t *mypar,
|
|||||||
return fitfun;
|
return fitfun;
|
||||||
}
|
}
|
||||||
|
|
||||||
TF1 *energyCalibration::fitFunctionKaDoublet(TF1 *fun, TH1 *h1, Double_t *mypar,
|
TF1* energyCalibration::fitFunctionKaDoublet(TF1 *fun, TH1 *h1, Double_t *mypar, Double_t *emypar) {
|
||||||
Double_t *emypar) {
|
|
||||||
|
|
||||||
TF1* fitfun;
|
TF1* fitfun;
|
||||||
|
|
||||||
@ -695,6 +709,7 @@ TF1 *energyCalibration::fitFunctionKaDoublet(TF1 *fun, TH1 *h1, Double_t *mypar,
|
|||||||
} else
|
} else
|
||||||
h1->Fit(fname,"R0Q");
|
h1->Fit(fname,"R0Q");
|
||||||
|
|
||||||
|
|
||||||
fitfun= h1->GetFunction(fname);
|
fitfun= h1->GetFunction(fname);
|
||||||
fitfun->GetParameters(mypar);
|
fitfun->GetParameters(mypar);
|
||||||
for (int ip=0; ip<8; ip++) {
|
for (int ip=0; ip<8; ip++) {
|
||||||
@ -708,27 +723,27 @@ TF1 *energyCalibration::fitSCurve(TH1 *h1, Double_t *mypar, Double_t *emypar) {
|
|||||||
return fitFunction(fscurve, h1, mypar, emypar);
|
return fitFunction(fscurve, h1, mypar, emypar);
|
||||||
}
|
}
|
||||||
|
|
||||||
TF1 *energyCalibration::fitSpectrum(TH1 *h1, Double_t *mypar,
|
|
||||||
Double_t *emypar) {
|
|
||||||
|
|
||||||
|
|
||||||
|
TF1* energyCalibration::fitSpectrum(TH1 *h1, Double_t *mypar, Double_t *emypar) {
|
||||||
initFitFunction(fspectrum,h1);
|
initFitFunction(fspectrum,h1);
|
||||||
return fitFunction(fspectrum, h1, mypar, emypar);
|
return fitFunction(fspectrum, h1, mypar, emypar);
|
||||||
}
|
}
|
||||||
|
|
||||||
TF1 *energyCalibration::fitSpectrumKb(TH1 *h1, Double_t *mypar,
|
TF1* energyCalibration::fitSpectrumKb(TH1 *h1, Double_t *mypar, Double_t *emypar) {
|
||||||
Double_t *emypar) {
|
|
||||||
initFitFunctionKb(fspectrumkb,h1);
|
initFitFunctionKb(fspectrumkb,h1);
|
||||||
return fitFunctionKb(fspectrumkb, h1, mypar, emypar);
|
return fitFunctionKb(fspectrumkb, h1, mypar, emypar);
|
||||||
}
|
}
|
||||||
|
|
||||||
TF1 *energyCalibration::fitSpectrumKaDoublet(TH1 *h1, Double_t *mypar,
|
TF1* energyCalibration::fitSpectrumKaDoublet(TH1 *h1, Double_t *mypar, Double_t *emypar) {
|
||||||
Double_t *emypar) {
|
|
||||||
initFitFunctionKaDoublet(fspectrumkadoublet,h1);
|
initFitFunctionKaDoublet(fspectrumkadoublet,h1);
|
||||||
return fitFunctionKaDoublet(fspectrumkadoublet, h1, mypar, emypar);
|
return fitFunctionKaDoublet(fspectrumkadoublet, h1, mypar, emypar);
|
||||||
}
|
}
|
||||||
|
|
||||||
TGraphErrors *energyCalibration::linearCalibration(
|
|
||||||
int nscan, Double_t *en, Double_t *een, Double_t *fl, Double_t *efl,
|
TGraphErrors* energyCalibration::linearCalibration(int nscan, Double_t *en, Double_t *een, Double_t *fl, Double_t *efl, Double_t &gain, Double_t &off, Double_t &egain, Double_t &eoff) {
|
||||||
Double_t &gain, Double_t &off, Double_t &egain, Double_t &eoff) {
|
|
||||||
|
|
||||||
TGraphErrors *gr;
|
TGraphErrors *gr;
|
||||||
|
|
||||||
@ -755,17 +770,15 @@ TGraphErrors *energyCalibration::linearCalibration(
|
|||||||
return gr;
|
return gr;
|
||||||
}
|
}
|
||||||
|
|
||||||
TGraphErrors *energyCalibration::calibrate(int nscan, Double_t *en,
|
|
||||||
Double_t *een, TH1F **h1,
|
TGraphErrors* energyCalibration::calibrate(int nscan, Double_t *en, Double_t *een, TH1F **h1, Double_t &gain, Double_t &off, Double_t &egain, Double_t &eoff, int integral) {
|
||||||
Double_t &gain, Double_t &off,
|
|
||||||
Double_t &egain, Double_t &eoff,
|
|
||||||
int integral) {
|
|
||||||
|
|
||||||
TH1F *h;
|
TH1F *h;
|
||||||
|
|
||||||
Double_t mypar[6], emypar[6];
|
Double_t mypar[6], emypar[6];
|
||||||
Double_t fl[nscan], efl[nscan];
|
Double_t fl[nscan], efl[nscan];
|
||||||
|
|
||||||
|
|
||||||
for (int ien=0; ien<nscan; ien++) {
|
for (int ien=0; ien<nscan; ien++) {
|
||||||
h=h1[ien];
|
h=h1[ien];
|
||||||
if (integral)
|
if (integral)
|
||||||
@ -777,6 +790,11 @@ TGraphErrors *energyCalibration::calibrate(int nscan, Double_t *en,
|
|||||||
efl[ien]=emypar[2];
|
efl[ien]=emypar[2];
|
||||||
}
|
}
|
||||||
return linearCalibration(nscan,en,een,fl,efl,gain,off, egain, eoff);
|
return linearCalibration(nscan,en,een,fl,efl,gain,off, egain, eoff);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#define MYROOT
|
#define MYROOT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef __MAKECINT__
|
#ifdef __MAKECINT__
|
||||||
#define MYROOT
|
#define MYROOT
|
||||||
#endif
|
#endif
|
||||||
@ -22,35 +23,40 @@
|
|||||||
#define MYROOT
|
#define MYROOT
|
||||||
|
|
||||||
#ifdef MYROOT
|
#ifdef MYROOT
|
||||||
#include <TF1.h>
|
|
||||||
#include <TROOT.h>
|
#include <TROOT.h>
|
||||||
|
#include <TF1.h>
|
||||||
class TH1F;
|
class TH1F;
|
||||||
class TH2F;
|
class TH2F;
|
||||||
class TGraphErrors;
|
class TGraphErrors;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const double conven=1000./3.6; /**< electrons/keV */
|
const double conven=1000./3.6; /**< electrons/keV */
|
||||||
const double el=1.67E-4; /**< electron charge in fC */
|
const double el=1.67E-4; /**< electron charge in fC */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\mainpage Common Root library for SLS detectors data analysis
|
\mainpage Common Root library for SLS detectors data analysis
|
||||||
*
|
*
|
||||||
* \section intro_sec Introduction
|
* \section intro_sec Introduction
|
||||||
We know very well s-curves etc. but at the end everybody uses different
|
We know very well s-curves etc. but at the end everybody uses different functions ;-).
|
||||||
functions ;-).
|
|
||||||
|
|
||||||
* \subsection mot_sec Motivation
|
* \subsection mot_sec Motivation
|
||||||
It would be greate to use everybody the same functions...
|
It would be greate to use everybody the same functions...
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@libdoc The energiCalibration class contains all the necessary functions for
|
@libdoc The energiCalibration class contains all the necessary functions for s-curve fitting and linear calibration of the threshold.
|
||||||
s-curve fitting and linear calibration of the threshold.
|
|
||||||
*
|
*
|
||||||
* @short Energy calibration functions
|
* @short Energy calibration functions
|
||||||
* @author Anna Bergamaschi
|
* @author Anna Bergamaschi
|
||||||
@ -60,28 +66,21 @@ s-curve fitting and linear calibration of the threshold.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
class containing all the possible energy calibration functions (scurves with
|
class containing all the possible energy calibration functions (scurves with and without charge sharing, gaussian spectrum with and without charge sharing, possibility of chosing the sign of the X-axis)
|
||||||
and without charge sharing, gaussian spectrum with and without charge sharing,
|
|
||||||
possibility of chosing the sign of the X-axis)
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
class energyCalibrationFunctions {
|
class energyCalibrationFunctions {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
energyCalibrationFunctions(int s=-1) {setScanSign(s);};
|
energyCalibrationFunctions(int s=-1) {setScanSign(s);};
|
||||||
|
|
||||||
/** sets scan sign
|
/** sets scan sign
|
||||||
\param s can be 1 (energy and x-axis have the same direction) or -1
|
\param s can be 1 (energy and x-axis have the same direction) or -1 (energy and x-axis have opposite directions) otherwise gets
|
||||||
(energy and x-axis have opposite directions) otherwise gets \returns
|
\returns current scan sign can be 1 (energy and x-axis have the same direction) or -1 (energy and x-axis have opposite directions)
|
||||||
current scan sign can be 1 (energy and x-axis have the same direction) or
|
|
||||||
-1 (energy and x-axis have opposite directions)
|
|
||||||
*/
|
*/
|
||||||
int setScanSign(int s = 0) {
|
int setScanSign(int s=0) {if (s==1 || s==-1) sign=s; return sign;};;
|
||||||
if (s == 1 || s == -1)
|
|
||||||
sign = s;
|
|
||||||
return sign;
|
|
||||||
};
|
|
||||||
;
|
|
||||||
|
|
||||||
#ifdef MYROOT
|
#ifdef MYROOT
|
||||||
/**
|
/**
|
||||||
@ -98,8 +97,7 @@ class energyCalibrationFunctions {
|
|||||||
par[2] is the gaussian peak position
|
par[2] is the gaussian peak position
|
||||||
par[3] is the RMS of the gaussian (and of the pedestal)
|
par[3] is the RMS of the gaussian (and of the pedestal)
|
||||||
par[4] is the height of the function
|
par[4] is the height of the function
|
||||||
par[5] is the fractional height of the charge sharing pedestal (scales
|
par[5] is the fractional height of the charge sharing pedestal (scales with par[3])
|
||||||
with par[3])
|
|
||||||
*/
|
*/
|
||||||
Double_t gaussChargeSharing(Double_t *x, Double_t *par);
|
Double_t gaussChargeSharing(Double_t *x, Double_t *par);
|
||||||
Double_t gaussChargeSharingKb(Double_t *x, Double_t *par);
|
Double_t gaussChargeSharingKb(Double_t *x, Double_t *par);
|
||||||
@ -111,8 +109,7 @@ class energyCalibrationFunctions {
|
|||||||
par[2] is the gaussian peak position
|
par[2] is the gaussian peak position
|
||||||
par[3] is the RMS of the gaussian (and of the pedestal)
|
par[3] is the RMS of the gaussian (and of the pedestal)
|
||||||
par[4] is the height of the function
|
par[4] is the height of the function
|
||||||
par[5] is the fractional height of the charge sharing pedestal (scales
|
par[5] is the fractional height of the charge sharing pedestal (scales with par[3])
|
||||||
with par[3])
|
|
||||||
*/
|
*/
|
||||||
Double_t gaussChargeSharingPixel(Double_t *x, Double_t *par);
|
Double_t gaussChargeSharingPixel(Double_t *x, Double_t *par);
|
||||||
|
|
||||||
@ -130,8 +127,7 @@ class energyCalibrationFunctions {
|
|||||||
par[2] is the inflection point
|
par[2] is the inflection point
|
||||||
par[3] is the RMS
|
par[3] is the RMS
|
||||||
par[4] is the amplitude
|
par[4] is the amplitude
|
||||||
par[5] is the angual coefficient of the charge sharing slope (scales
|
par[5] is the angual coefficient of the charge sharing slope (scales with par[3])
|
||||||
with par[3])
|
|
||||||
*/
|
*/
|
||||||
Double_t erfFunctionChargeSharing(Double_t *x, Double_t *par);
|
Double_t erfFunctionChargeSharing(Double_t *x, Double_t *par);
|
||||||
|
|
||||||
@ -141,59 +137,64 @@ class energyCalibrationFunctions {
|
|||||||
par[2] is the inflection point of the first energy
|
par[2] is the inflection point of the first energy
|
||||||
par[3] is the RMS of the first energy
|
par[3] is the RMS of the first energy
|
||||||
par[4] is the amplitude of the first energy
|
par[4] is the amplitude of the first energy
|
||||||
par[5] is the angual coefficient of the charge sharing slope of the
|
par[5] is the angual coefficient of the charge sharing slope of the first energy (scales with par[3])
|
||||||
first energy (scales with par[3]) par[6] is the inflection point of the
|
par[6] is the inflection point of the second energy
|
||||||
second energy par[7] is the RMS of the second energy par[8] is the
|
par[7] is the RMS of the second energy
|
||||||
amplitude of the second energy par[9] is the angual coefficient of the
|
par[8] is the amplitude of the second energy
|
||||||
charge sharing slope of the second energy (scales with par[8])
|
par[9] is the angual coefficient of the charge sharing slope of the second energy (scales with par[8])
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Double_t erfFuncFluo(Double_t *x, Double_t *par);
|
Double_t erfFuncFluo(Double_t *x, Double_t *par);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
static function Gaussian with charge sharing pedestal with the correct
|
static function Gaussian with charge sharing pedestal with the correct scan sign
|
||||||
scan sign par[0] is the absolute height of the background pedestal par[1]
|
par[0] is the absolute height of the background pedestal
|
||||||
is the slope of the pedestal par[2] is the gaussian peak position par[3]
|
par[1] is the slope of the pedestal
|
||||||
is the RMS of the gaussian (and of the pedestal) par[4] is the height of
|
par[2] is the gaussian peak position
|
||||||
the function par[5] is the fractional height of the charge sharing
|
par[3] is the RMS of the gaussian (and of the pedestal)
|
||||||
pedestal (scales with par[4]
|
par[4] is the height of the function
|
||||||
|
par[5] is the fractional height of the charge sharing pedestal (scales with par[4]
|
||||||
*/
|
*/
|
||||||
Double_t spectrum(Double_t *x, Double_t *par);
|
Double_t spectrum(Double_t *x, Double_t *par);
|
||||||
Double_t spectrumkb(Double_t *x, Double_t *par);
|
Double_t spectrumkb(Double_t *x, Double_t *par);
|
||||||
Double_t spectrumkadoublet(Double_t *x, Double_t *par);
|
Double_t spectrumkadoublet(Double_t *x, Double_t *par);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
static function Gaussian with charge sharing pedestal with the correct
|
static function Gaussian with charge sharing pedestal with the correct scan sign
|
||||||
scan sign par[0] is the absolute height of the background pedestal par[1]
|
par[0] is the absolute height of the background pedestal
|
||||||
is the slope of the pedestal par[2] is the gaussian peak position par[3]
|
par[1] is the slope of the pedestal
|
||||||
is the RMS of the gaussian (and of the pedestal) par[4] is the height of
|
par[2] is the gaussian peak position
|
||||||
the function par[5] is the fractional height of the charge sharing
|
par[3] is the RMS of the gaussian (and of the pedestal)
|
||||||
pedestal (scales with par[4]
|
par[4] is the height of the function
|
||||||
|
par[5] is the fractional height of the charge sharing pedestal (scales with par[4]
|
||||||
*/
|
*/
|
||||||
Double_t spectrumPixel(Double_t *x, Double_t *par);
|
Double_t spectrumPixel(Double_t *x, Double_t *par);
|
||||||
|
|
||||||
|
|
||||||
/** Erf function with charge sharing slope with the correct scan sign
|
/** Erf function with charge sharing slope with the correct scan sign
|
||||||
par[0] is the pedestal
|
par[0] is the pedestal
|
||||||
par[1] is the slope of the pedestal
|
par[1] is the slope of the pedestal
|
||||||
par[2] is the inflection point
|
par[2] is the inflection point
|
||||||
par[3] is the RMS
|
par[3] is the RMS
|
||||||
par[4] is the amplitude
|
par[4] is the amplitude
|
||||||
par[5] is the angual coefficient of the charge sharing slope (scales
|
par[5] is the angual coefficient of the charge sharing slope (scales with par[3])
|
||||||
with par[3])
|
|
||||||
*/
|
*/
|
||||||
Double_t scurve(Double_t *x, Double_t *par);
|
Double_t scurve(Double_t *x, Double_t *par);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Double Erf function with charge sharing slope
|
/** Double Erf function with charge sharing slope
|
||||||
par[0] is the pedestal
|
par[0] is the pedestal
|
||||||
par[1] is the slope of the pedestal
|
par[1] is the slope of the pedestal
|
||||||
par[2] is the inflection point of the first energy
|
par[2] is the inflection point of the first energy
|
||||||
par[3] is the RMS of the first energy
|
par[3] is the RMS of the first energy
|
||||||
par[4] is the amplitude of the first energy
|
par[4] is the amplitude of the first energy
|
||||||
par[5] is the angual coefficient of the charge sharing slope of the first
|
par[5] is the angual coefficient of the charge sharing slope of the first energy (scales with par[3])
|
||||||
energy (scales with par[3]) par[6] is the inflection point of the second
|
par[6] is the inflection point of the second energy
|
||||||
energy par[7] is the RMS of the second energy par[8] is the amplitude of
|
par[7] is the RMS of the second energy
|
||||||
the second energy par[9] is the angual coefficient of the charge sharing
|
par[8] is the amplitude of the second energy
|
||||||
slope of the second energy (scales with par[8])
|
par[9] is the angual coefficient of the charge sharing slope of the second energy (scales with par[8])
|
||||||
*/
|
*/
|
||||||
Double_t scurveFluo(Double_t *x, Double_t *par);
|
Double_t scurveFluo(Double_t *x, Double_t *par);
|
||||||
|
|
||||||
@ -208,6 +209,8 @@ class energyCalibrationFunctions {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int sign;
|
int sign;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -217,16 +220,15 @@ class energyCalibrationFunctions {
|
|||||||
|
|
||||||
class energyCalibration {
|
class energyCalibration {
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
default constructor - creates the function with which the s-curves
|
default constructor - creates the function with which the s-curves will be fitted
|
||||||
will be fitted
|
|
||||||
*/
|
*/
|
||||||
energyCalibration();
|
energyCalibration();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
default destructor - deletes the function with which the s-curves will
|
default destructor - deletes the function with which the s-curves will be fitted
|
||||||
be fitted
|
|
||||||
*/
|
*/
|
||||||
~energyCalibration();
|
~energyCalibration();
|
||||||
|
|
||||||
@ -234,17 +236,11 @@ class energyCalibration {
|
|||||||
\param p plot flag (-1 gets, 0 unsets, >0 plot)
|
\param p plot flag (-1 gets, 0 unsets, >0 plot)
|
||||||
\returns current plot flag
|
\returns current plot flag
|
||||||
*/
|
*/
|
||||||
int setPlotFlag(int p = -1) {
|
int setPlotFlag(int p=-1) {if (p>=0) plot_flag=p; return plot_flag;};
|
||||||
if (p >= 0)
|
|
||||||
plot_flag = p;
|
|
||||||
return plot_flag;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** sets scan sign
|
/** sets scan sign
|
||||||
\param s can be 1 (energy and x-axis have the same direction) or -1
|
\param s can be 1 (energy and x-axis have the same direction) or -1 (energy and x-axis have opposite directions) otherwise gets
|
||||||
(energy and x-axis have opposite directions) otherwise gets \returns
|
\returns current scan sign can be 1 (energy and x-axis have the same direction) or -1 (energy and x-axis have opposite directions)
|
||||||
current scan sign can be 1 (energy and x-axis have the same direction) or
|
|
||||||
-1 (energy and x-axis have opposite directions)
|
|
||||||
*/
|
*/
|
||||||
int setScanSign(int s=0) {return funcs->setScanSign(s);};
|
int setScanSign(int s=0) {return funcs->setScanSign(s);};
|
||||||
|
|
||||||
@ -254,6 +250,7 @@ class energyCalibration {
|
|||||||
*/
|
*/
|
||||||
int setChargeSharing(int p=-1);
|
int setChargeSharing(int p=-1);
|
||||||
|
|
||||||
|
|
||||||
void fixParameter(int ip, Double_t val);
|
void fixParameter(int ip, Double_t val);
|
||||||
|
|
||||||
void releaseParameter(int ip);
|
void releaseParameter(int ip);
|
||||||
@ -261,35 +258,28 @@ class energyCalibration {
|
|||||||
#ifdef MYROOT
|
#ifdef MYROOT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates an histogram with the median of nchannels starting from a
|
Creates an histogram with the median of nchannels starting from a specified one. the direction on which it is mediated can be selected (defaults to x=0)
|
||||||
specified one. the direction on which it is mediated can be selected
|
\param h2 2D histogram on which the median will be calculated
|
||||||
(defaults to x=0) \param h2 2D histogram on which the median will be
|
\param ch0 starting channel
|
||||||
calculated \param ch0 starting channel \param nch number of channels to
|
\param nch number of channels to be mediated
|
||||||
be mediated \param direction can be either 0 (x, default) or 1 (y)
|
\param direction can be either 0 (x, default) or 1 (y)
|
||||||
\returns a TH1F histogram with the X-axis as a clone of the h2 Y (if
|
\returns a TH1F histogram with the X-axis as a clone of the h2 Y (if direction=0) or X (if direction=0) axis, and on the Y axis the median of the counts of the mediated channels f h2
|
||||||
direction=0) or X (if direction=0) axis, and on the Y axis the median of
|
|
||||||
the counts of the mediated channels f h2
|
|
||||||
*/
|
*/
|
||||||
static TH1F *createMedianHistogram(TH2F *h2, int ch0, int nch,
|
static TH1F* createMedianHistogram(TH2F* h2, int ch0, int nch, int direction=0);
|
||||||
int direction = 0);
|
|
||||||
|
|
||||||
/** sets the s-curve fit range
|
/** sets the s-curve fit range
|
||||||
\param mi minimum of the fit range (-1 is histogram x-min)
|
\param mi minimum of the fit range (-1 is histogram x-min)
|
||||||
\param ma maximum of the fit range (-1 is histogram x-max)
|
\param ma maximum of the fit range (-1 is histogram x-max)
|
||||||
*/
|
*/
|
||||||
void setFitRange(Double_t mi, Double_t ma) {
|
void setFitRange(Double_t mi, Double_t ma){fit_min=mi; fit_max=ma;};
|
||||||
fit_min = mi;
|
|
||||||
fit_max = ma;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** gets the s-curve fit range
|
/** gets the s-curve fit range
|
||||||
\param mi reference for minimum of the fit range (-1 is histogram x-min)
|
\param mi reference for minimum of the fit range (-1 is histogram x-min)
|
||||||
\param ma reference for maximum of the fit range (-1 is histogram x-max)
|
\param ma reference for maximum of the fit range (-1 is histogram x-max)
|
||||||
*/
|
*/
|
||||||
void getFitRange(Double_t &mi, Double_t &ma) {
|
void getFitRange(Double_t &mi, Double_t &ma){mi=fit_min; ma=fit_max;};
|
||||||
mi = fit_min;
|
|
||||||
ma = fit_max;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** set start parameters for the s-curve function
|
/** set start parameters for the s-curve function
|
||||||
\param par parameters, -1 sets to auto-calculation
|
\param par parameters, -1 sets to auto-calculation
|
||||||
@ -298,8 +288,7 @@ class energyCalibration {
|
|||||||
par[2] is the inflection point
|
par[2] is the inflection point
|
||||||
par[3] is the RMS
|
par[3] is the RMS
|
||||||
par[4] is the amplitude
|
par[4] is the amplitude
|
||||||
par[5] is the angual coefficient of the charge sharing slope (scales
|
par[5] is the angual coefficient of the charge sharing slope (scales with par[3]) -- always positive
|
||||||
with par[3]) -- always positive
|
|
||||||
*/
|
*/
|
||||||
void setStartParameters(Double_t *par);
|
void setStartParameters(Double_t *par);
|
||||||
void setStartParametersKb(Double_t *par);
|
void setStartParametersKb(Double_t *par);
|
||||||
@ -312,8 +301,7 @@ class energyCalibration {
|
|||||||
par[2] is the inflection point
|
par[2] is the inflection point
|
||||||
par[3] is the RMS
|
par[3] is the RMS
|
||||||
par[4] is the amplitude
|
par[4] is the amplitude
|
||||||
par[5] is the angual coefficient of the charge sharing slope (scales
|
par[5] is the angual coefficient of the charge sharing slope (scales with par[3]) -- always positive
|
||||||
with par[3]) -- always positive
|
|
||||||
*/
|
*/
|
||||||
void getStartParameters(Double_t *par);
|
void getStartParameters(Double_t *par);
|
||||||
|
|
||||||
@ -322,23 +310,23 @@ class energyCalibration {
|
|||||||
\param h1 1d-histogram to be fitted
|
\param h1 1d-histogram to be fitted
|
||||||
\param mypar pointer to fit parameters array
|
\param mypar pointer to fit parameters array
|
||||||
\param emypar pointer to fit parameter errors
|
\param emypar pointer to fit parameter errors
|
||||||
\returns the fitted function - can be used e.g. to get the Chi2 or
|
\returns the fitted function - can be used e.g. to get the Chi2 or similar
|
||||||
similar
|
|
||||||
*/
|
*/
|
||||||
TF1 *fitSCurve(TH1 *h1, Double_t *mypar, Double_t *emypar);
|
TF1 *fitSCurve(TH1 *h1, Double_t *mypar, Double_t *emypar);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
fits histogram with the spectrum
|
fits histogram with the spectrum
|
||||||
\param h1 1d-histogram to be fitted
|
\param h1 1d-histogram to be fitted
|
||||||
\param mypar pointer to fit parameters array
|
\param mypar pointer to fit parameters array
|
||||||
\param emypar pointer to fit parameter errors
|
\param emypar pointer to fit parameter errors
|
||||||
\returns the fitted function - can be used e.g. to get the Chi2 or
|
\returns the fitted function - can be used e.g. to get the Chi2 or similar
|
||||||
similar
|
|
||||||
*/
|
*/
|
||||||
TF1 *fitSpectrum(TH1 *h1, Double_t *mypar, Double_t *emypar);
|
TF1 *fitSpectrum(TH1 *h1, Double_t *mypar, Double_t *emypar);
|
||||||
TF1 *fitSpectrumKb(TH1 *h1, Double_t *mypar, Double_t *emypar);
|
TF1 *fitSpectrumKb(TH1 *h1, Double_t *mypar, Double_t *emypar);
|
||||||
TF1 *fitSpectrumKaDoublet(TH1 *h1, Double_t *mypar, Double_t *emypar);
|
TF1 *fitSpectrumKaDoublet(TH1 *h1, Double_t *mypar, Double_t *emypar);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
calculates gain and offset for the set of inflection points
|
calculates gain and offset for the set of inflection points
|
||||||
\param nscan number of energy scans
|
\param nscan number of energy scans
|
||||||
@ -352,10 +340,7 @@ class energyCalibration {
|
|||||||
\param eoff reference to the error on the offset resulting from the fit
|
\param eoff reference to the error on the offset resulting from the fit
|
||||||
\returns graph energy vs inflection point
|
\returns graph energy vs inflection point
|
||||||
*/
|
*/
|
||||||
TGraphErrors *linearCalibration(int nscan, Double_t *en, Double_t *een,
|
TGraphErrors* linearCalibration(int nscan, Double_t *en, Double_t *een, Double_t *fl, Double_t *efl, Double_t &gain, Double_t &off, Double_t &egain, Double_t &eoff);
|
||||||
Double_t *fl, Double_t *efl, Double_t &gain,
|
|
||||||
Double_t &off, Double_t &egain,
|
|
||||||
Double_t &eoff);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
calculates gain and offset for the set of energy scans
|
calculates gain and offset for the set of energy scans
|
||||||
@ -369,11 +354,7 @@ class energyCalibration {
|
|||||||
\param eoff reference to the error on the offset resulting from the fit
|
\param eoff reference to the error on the offset resulting from the fit
|
||||||
\returns graph energy vs inflection point
|
\returns graph energy vs inflection point
|
||||||
*/
|
*/
|
||||||
TGraphErrors *calibrateScurves(int nscan, Double_t *en, Double_t *een,
|
TGraphErrors* calibrateScurves(int nscan, Double_t *en, Double_t *een, TH1F **h1, Double_t &gain, Double_t &off, Double_t &egain, Double_t &eoff){return calibrate(nscan, en, een, h1, gain, off, egain, eoff, 1);};
|
||||||
TH1F **h1, Double_t &gain, Double_t &off,
|
|
||||||
Double_t &egain, Double_t &eoff) {
|
|
||||||
return calibrate(nscan, en, een, h1, gain, off, egain, eoff, 1);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
calculates gain and offset for the set of energy spectra
|
calculates gain and offset for the set of energy spectra
|
||||||
@ -387,14 +368,12 @@ class energyCalibration {
|
|||||||
\param eoff reference to the error on the offset resulting from the fit
|
\param eoff reference to the error on the offset resulting from the fit
|
||||||
\returns graph energy vs peak
|
\returns graph energy vs peak
|
||||||
*/
|
*/
|
||||||
TGraphErrors *calibrateSpectra(int nscan, Double_t *en, Double_t *een,
|
TGraphErrors* calibrateSpectra(int nscan, Double_t *en, Double_t *een, TH1F **h1, Double_t &gain, Double_t &off, Double_t &egain, Double_t &eoff){return calibrate(nscan, en, een, h1, gain, off, egain, eoff, 0);};
|
||||||
TH1F **h1, Double_t &gain, Double_t &off,
|
|
||||||
Double_t &egain, Double_t &eoff) {
|
|
||||||
return calibrate(nscan, en, een, h1, gain, off, egain, eoff, 0);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
private:
|
private:
|
||||||
|
|
||||||
#ifdef MYROOT
|
#ifdef MYROOT
|
||||||
/**
|
/**
|
||||||
calculates gain and offset for the set of energies
|
calculates gain and offset for the set of energies
|
||||||
@ -409,16 +388,13 @@ class energyCalibration {
|
|||||||
\param integral 1 is an s-curve set (default), 0 spectra
|
\param integral 1 is an s-curve set (default), 0 spectra
|
||||||
\returns graph energy vs peak/inflection point
|
\returns graph energy vs peak/inflection point
|
||||||
*/
|
*/
|
||||||
TGraphErrors *calibrate(int nscan, Double_t *en, Double_t *een, TH1F **h1,
|
TGraphErrors* calibrate(int nscan, Double_t *en, Double_t *een, TH1F **h1, Double_t &gain, Double_t &off, Double_t &egain, Double_t &eoff, int integral=1);
|
||||||
Double_t &gain, Double_t &off, Double_t &egain,
|
|
||||||
Double_t &eoff, int integral = 1);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initializes the start parameters and the range of the fit depending on
|
Initializes the start parameters and the range of the fit depending on the histogram characteristics and/or on the start parameters specified by the user
|
||||||
the histogram characteristics and/or on the start parameters specified by
|
\param fun pointer to function to be initialized
|
||||||
the user \param fun pointer to function to be initialized \param h1
|
\param h1 histogram from which to extract the range and start parameters, if not already specified by the user
|
||||||
histogram from which to extract the range and start parameters, if not
|
|
||||||
already specified by the user
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -426,25 +402,24 @@ class energyCalibration {
|
|||||||
void initFitFunctionKb(TF1 *fun, TH1 *h1);
|
void initFitFunctionKb(TF1 *fun, TH1 *h1);
|
||||||
void initFitFunctionKaDoublet(TF1 *fun, TH1 *h1);
|
void initFitFunctionKaDoublet(TF1 *fun, TH1 *h1);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Performs the fit according to the flags specified and returns the fitted
|
Performs the fit according to the flags specified and returns the fitted function
|
||||||
function \param fun function to fit \param h1 histogram to fit \param
|
\param fun function to fit
|
||||||
mypar pointer to fit parameters array \param emypar pointer to fit
|
\param h1 histogram to fit
|
||||||
parameter errors \returns the fitted function - can be used e.g. to get
|
\param mypar pointer to fit parameters array
|
||||||
the Chi2 or similar
|
\param emypar pointer to fit parameter errors
|
||||||
|
\returns the fitted function - can be used e.g. to get the Chi2 or similar
|
||||||
*/
|
*/
|
||||||
TF1 *fitFunction(TF1 *fun, TH1 *h1, Double_t *mypar, Double_t *emypar);
|
TF1 *fitFunction(TF1 *fun, TH1 *h1, Double_t *mypar, Double_t *emypar);
|
||||||
TF1 *fitFunctionKb(TF1 *fun, TH1 *h1, Double_t *mypar, Double_t *emypar);
|
TF1 *fitFunctionKb(TF1 *fun, TH1 *h1, Double_t *mypar, Double_t *emypar);
|
||||||
TF1 *fitFunctionKaDoublet(TF1 *fun, TH1 *h1, Double_t *mypar,
|
TF1 *fitFunctionKaDoublet(TF1 *fun, TH1 *h1, Double_t *mypar, Double_t *emypar);
|
||||||
Double_t *emypar);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MYROOT
|
#ifdef MYROOT
|
||||||
Double_t fit_min; /**< minimum of the s-curve fitting range, -1 is histogram
|
Double_t fit_min; /**< minimum of the s-curve fitting range, -1 is histogram x-min */
|
||||||
x-min */
|
Double_t fit_max; /**< maximum of the s-curve fitting range, -1 is histogram x-max */
|
||||||
Double_t fit_max; /**< maximum of the s-curve fitting range, -1 is histogram
|
|
||||||
x-max */
|
|
||||||
|
|
||||||
Double_t bg_offset; /**< start value for the background pedestal */
|
Double_t bg_offset; /**< start value for the background pedestal */
|
||||||
Double_t bg_slope; /**< start value for the background slope */
|
Double_t bg_slope; /**< start value for the background slope */
|
||||||
@ -461,8 +436,7 @@ class energyCalibration {
|
|||||||
|
|
||||||
TF1 *fspectrum; /**< function with which the spectrum will be fitted */
|
TF1 *fspectrum; /**< function with which the spectrum will be fitted */
|
||||||
TF1 *fspectrumkb; /**< function with which the spectrum will be fitted */
|
TF1 *fspectrumkb; /**< function with which the spectrum will be fitted */
|
||||||
TF1 *fspectrumkadoublet; /**< function with which the spectrum will be
|
TF1 *fspectrumkadoublet; /**< function with which the spectrum will be fitted */
|
||||||
fitted */
|
|
||||||
|
|
||||||
TF1 *fspixel; /**< function with which the spectrum will be fitted */
|
TF1 *fspixel; /**< function with which the spectrum will be fitted */
|
||||||
|
|
||||||
@ -471,8 +445,27 @@ class energyCalibration {
|
|||||||
energyCalibrationFunctions *funcs;
|
energyCalibrationFunctions *funcs;
|
||||||
int plot_flag; /**< 0 does not plot, >0 plots (flags?) */
|
int plot_flag; /**< 0 does not plot, >0 plots (flags?) */
|
||||||
|
|
||||||
int cs_flag; /**< 0 functions without charge sharing contribution, >0 with
|
int cs_flag; /**< 0 functions without charge sharing contribution, >0 with charge sharing contribution */
|
||||||
charge sharing contribution */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,19 +3,19 @@
|
|||||||
#ifndef GHOSTSUMMATION_H
|
#ifndef GHOSTSUMMATION_H
|
||||||
#define GHOSTSUMMATION_H
|
#define GHOSTSUMMATION_H
|
||||||
|
|
||||||
#include "slsDetectorData.h"
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include "slsDetectorData.h"
|
||||||
|
|
||||||
template <class dataType> class ghostSummation {
|
template <class dataType> class ghostSummation {
|
||||||
|
|
||||||
/** @short virtual calss to handle ghosting*/
|
/** @short virtual calss to handle ghosting*/
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** constructor
|
/** constructor
|
||||||
\param xt crosstalk
|
\param xt crosstalk
|
||||||
*/
|
*/
|
||||||
ghostSummation(slsDetectorData<dataType> *d, double xt)
|
ghostSummation(slsDetectorData<dataType> *d, double xt) : xtalk(xt),det(d), nx(1), ny(1) {
|
||||||
: xtalk(xt), det(d), nx(1), ny(1) {
|
|
||||||
if (det)
|
if (det)
|
||||||
det->getDetectorSize(nx,ny);
|
det->getDetectorSize(nx,ny);
|
||||||
ghost=new double[nx*ny];
|
ghost=new double[nx*ny];
|
||||||
@ -28,18 +28,18 @@ template <class dataType> class ghostSummation {
|
|||||||
ny=1;
|
ny=1;
|
||||||
det->getDetectorSize(nx,ny);
|
det->getDetectorSize(nx,ny);
|
||||||
ghost=new double[nx*ny];
|
ghost=new double[nx*ny];
|
||||||
}
|
|
||||||
virtual ~ghostSummation() { delete[] ghost; };
|
|
||||||
|
|
||||||
virtual ghostSummation *Clone() { return new ghostSummation(this); }
|
}
|
||||||
|
~ghostSummation() {delete [] ghost;};
|
||||||
|
|
||||||
|
virtual ghostSummation *Clone() {
|
||||||
|
return new ghostSummation(this);
|
||||||
|
}
|
||||||
|
|
||||||
double getXTalk(){return xtalk;};
|
double getXTalk(){return xtalk;};
|
||||||
void setXTalk(double g) {xtalk=g;};
|
void setXTalk(double g) {xtalk=g;};
|
||||||
|
|
||||||
virtual double calcGhost(char *data, int ix, int iy = 1) {
|
virtual double calcGhost(char *data, int ix, int iy=1){ghost[iy*nx+ix]=0; return 0;};
|
||||||
ghost[iy * nx + ix] = 0;
|
|
||||||
return 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual void calcGhost(char *data){
|
virtual void calcGhost(char *data){
|
||||||
for (int iy=0; iy<ny; iy++)
|
for (int iy=0; iy<ny; iy++)
|
||||||
@ -48,8 +48,7 @@ template <class dataType> class ghostSummation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual double getGhost(int ix, int iy) {
|
virtual double getGhost(int ix, int iy) {
|
||||||
if (ix < 0 || ix >= nx || iy < 0 || iy >= ny)
|
if (ix<0 || ix>=nx || iy<0 || iy>=ny) return 0;
|
||||||
return 0;
|
|
||||||
return ghost[iy*nx+ix];
|
return ghost[iy*nx+ix];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,6 +57,11 @@ template <class dataType> class ghostSummation {
|
|||||||
slsDetectorData<dataType> *det;
|
slsDetectorData<dataType> *det;
|
||||||
double *ghost;
|
double *ghost;
|
||||||
int nx, ny;
|
int nx, ny;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user