mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-20 00:37:12 +02:00
Compare commits
398 Commits
Author | SHA1 | Date | |
---|---|---|---|
f299a34e59 | |||
b1c93bb3df | |||
9e8a874e39 | |||
2c7b730987 | |||
4fe1a2c6df | |||
1322cff405 | |||
7f3d5e8a7e | |||
bf199767dc | |||
eaae54ebf5 | |||
6889741480 | |||
3030c262f1 | |||
6b391a34dc | |||
a2dd35ae38 | |||
e00c5068af | |||
c951b10b0f | |||
c5012a2d5a | |||
58050f72da | |||
eae1fb6609 | |||
5b5e0f109b | |||
f2e69fb5a3 | |||
adf6a4c471 | |||
94382c1ece | |||
28f1f6c1cd | |||
a95ab1e13e | |||
5e9d70948b | |||
b0073597f7 | |||
c4675da0c3 | |||
ba008db29a | |||
950096daf9 | |||
d07873ee39 | |||
f8df11886a | |||
d976c9fcf9 | |||
c4ae32b216 | |||
c689b8b954 | |||
fea94b15d5 | |||
955bc74a91 | |||
8727a93e3e | |||
83221ee955 | |||
398f3734ec | |||
f96f716f39 | |||
781e8fc67f | |||
66e9b80995 | |||
7bde337d58 | |||
1cea6af590 | |||
1539326fda | |||
dfc886a65b | |||
c4e7086d99 | |||
5ce79ec9fa | |||
dc78e23449 | |||
f2c0ff7f98 | |||
32cf46a8a3 | |||
fa2c842745 | |||
6a27207875 | |||
a62d6a2fb8 | |||
5518531620 | |||
fd631ebb71 | |||
21d23be522 | |||
28a5aa8342 | |||
5ee3f5cf4c | |||
72ac2745ea | |||
206041989f | |||
2fff9f5bfe | |||
90c34e4942 | |||
bb26b993ea | |||
d7ad995dd1 | |||
f53d260202 | |||
35556e96d1 | |||
2123fb47a5 | |||
38ad5d7931 | |||
aaeaeab576 | |||
03ec2c53ab | |||
d7e2ab8ec4 | |||
a92d931a8f | |||
615b3b2557 | |||
1797d39216 | |||
0f9fd5cd73 | |||
73b5c3ac57 | |||
18b8720c17 | |||
7de9401bc7 | |||
705ddb7f42 | |||
8eb04c33b5 | |||
cd5d327988 | |||
c3180737ed | |||
ba37a51858 | |||
2417f9cd7b | |||
b61ca18967 | |||
567e821569 | |||
1f64d2a4e2 | |||
96d64778ee | |||
2f2e4da628 | |||
b3587bcee5 | |||
40572b6b23 | |||
031241ae28 | |||
f9fff97f8a | |||
6c5c4f00b3 | |||
ba9a0c7917 | |||
ba3bc9c408 | |||
026771f42d | |||
d05be2519a | |||
11ea071543 | |||
4aba8b6ac0 | |||
82570bc084 | |||
fe467cdf70 | |||
925a750f9a | |||
eb2040f0a7 | |||
4b2cb7ecc1 | |||
badff47663 | |||
1084e5361b | |||
828859838b | |||
9b7ef84515 | |||
aa8610fb04 | |||
798f221764 | |||
4155e301b8 | |||
8c279695de | |||
bc7ebd45df | |||
3fdae431b0 | |||
7b59b7e7d5 | |||
19b85b8e40 | |||
61d7c76d55 | |||
93bb0c9aed | |||
f9d832bf34 | |||
8e771c48bd | |||
5a49182626 | |||
f4a0780b51 | |||
f73a15e786 | |||
fa84d17a19 | |||
12c7389b8d | |||
8006043a97 | |||
45012df95b | |||
8c6da7da1b | |||
f2fc187f13 | |||
fee110c73a | |||
995f0924e5 | |||
eebc1109b0 | |||
97d1c520e6 | |||
3822258dfa | |||
df4f37efc6 | |||
107234f4c5 | |||
59a7a462ab | |||
e16212bd23 | |||
be50344b45 | |||
0a3905802f | |||
833c07707f | |||
9b4fc02b0e | |||
b109ea8d7d | |||
29a7e227a3 | |||
cfd3680176 | |||
87aa5099f2 | |||
030cfacc9b | |||
b318f8126d | |||
17295bf662 | |||
58cadefa61 | |||
e0d10d0e01 | |||
6964326c7f | |||
6cda61a612 | |||
7a66dd08a3 | |||
5f94b5c246 | |||
16f7b42533 | |||
1b06edac9b | |||
d597636c1e | |||
0f99dd141e | |||
da630a8e05 | |||
cfb017f66a | |||
b3ff825ce8 | |||
c6fd13e49c | |||
e6472da5f1 | |||
5de5884341 | |||
b4f3c0586f | |||
aaade64e0b | |||
ffa9bbe8d2 | |||
3c6d7ca4a5 | |||
7242a6901a | |||
2a40c7f48e | |||
ca054626e6 | |||
6e6fcec698 | |||
3d52a2f169 | |||
8a4a6c7004 | |||
288b59d292 | |||
296518819e | |||
2a48f70320 | |||
07f71d3886 | |||
dde24559f3 | |||
b591a42ae7 | |||
032b4117dd | |||
af9c67539f | |||
27d223d199 | |||
26bc737445 | |||
61c495f218 | |||
c3c3f78c59 | |||
400e69cef2 | |||
1cf5033c99 | |||
21ce0055b2 | |||
4b987abf41 | |||
40b62ef5a4 | |||
5bcde789ac | |||
221bb65c0e | |||
02634abbbc | |||
bd95126da2 | |||
4a112104ad | |||
9bc6c44e51 | |||
8c15b52b87 | |||
9e7a133422 | |||
cb8c7eea54 | |||
0d35b966ff | |||
49d47e633d | |||
e23b3b0471 | |||
4f0634fe62 | |||
1980a7d80c | |||
014b8cf9a6 | |||
f123a280bb | |||
7abb18e5c8 | |||
fc0b25cfa7 | |||
aafe049a9b | |||
7a4c1161ab | |||
94013a7fad | |||
aecf3bb7db | |||
3497175b15 | |||
298e1dd1fe | |||
f981825172 | |||
3b2feba3b2 | |||
386b6601a8 | |||
9a48d9b832 | |||
2c5ff0e9bf | |||
e89b65002a | |||
5866e330c1 | |||
5c06549982 | |||
975a5a4cab | |||
57ac5c0dab | |||
6a20a780fe | |||
7afe0c510e | |||
8ec0ac4eb3 | |||
322970ebed | |||
9e40c06786 | |||
caedfbebd5 | |||
3ca52176b7 | |||
867bce8b38 | |||
170db19f48 | |||
4b7ab98135 | |||
72362b0334 | |||
794b6f8090 | |||
7fd5d7c610 | |||
199ecbce80 | |||
d4a2af1693 | |||
e247605b76 | |||
0735f890a3 | |||
3d78b7b6a7 | |||
1b5e939748 | |||
2ef9aa0ea0 | |||
cadb4cff93 | |||
e04242c5fa | |||
434aa78a04 | |||
cf045d8a1d | |||
a98271f0c2 | |||
5c393e6204 | |||
5eaea5fb8d | |||
f0ba8a06ce | |||
4b0fb5029f | |||
b4c207fc4e | |||
f77b6ab068 | |||
0daada9266 | |||
422a928be4 | |||
156ce0df00 | |||
62c4bfab64 | |||
28963e313b | |||
11c1fb0e11 | |||
9ebff9c8a8 | |||
ad907a43be | |||
ea5ac6ad03 | |||
d1ea74120d | |||
0c4ae89cd9 | |||
38b7e23ac4 | |||
08ac9b4ce8 | |||
51a3f3fd4d | |||
29c788b9f7 | |||
0f37481972 | |||
0d787788ea | |||
498a8bda9f | |||
3e874a3650 | |||
3881e2cd21 | |||
ee4aa94bbe | |||
d2e8c3bebc | |||
0d2598bd77 | |||
eebd1552f2 | |||
26958e99ef | |||
7457c56533 | |||
d10d9462a3 | |||
c6dddaba97 | |||
a0bdfcdae3 | |||
d3e60eba80 | |||
10ce82fc5f | |||
b59d69325e | |||
336f8ceb50 | |||
947252c852 | |||
e635ff035c | |||
8dae9243a5 | |||
ce14435c68 | |||
ba0c6ff286 | |||
d14fdc3a3f | |||
8e2b89d488 | |||
5f0a3eaee4 | |||
a23a3f4467 | |||
7f5640dd4e | |||
d191cee548 | |||
97192c5342 | |||
f7893f7f79 | |||
d4d8cbe9bc | |||
7b1cb517c0 | |||
2fe06c7163 | |||
6f6ee19906 | |||
c2f57f5ab0 | |||
160ce17a91 | |||
9686f78300 | |||
25eccdffab | |||
f99ebc7f21 | |||
935f7bc960 | |||
b52a8d2d61 | |||
4bff894782 | |||
1008944a6a | |||
99dc9bd44d | |||
0a34192a8d | |||
09684518c5 | |||
8e2494729b | |||
d9be3250ad | |||
95751766cd | |||
c36dfc3992 | |||
f78a98797f | |||
151c3ee062 | |||
f982a59a7c | |||
100d748154 | |||
b2d39d4785 | |||
c350b53b7f | |||
6a89e3e1a5 | |||
cac353748e | |||
4a97dd0eba | |||
dea402a7e7 | |||
206740efd6 | |||
56703c4886 | |||
1bd1d0d64d | |||
6b363a16fe | |||
6691680091 | |||
2ac421365d | |||
9913194774 | |||
a084ea2d0f | |||
2f61764fd7 | |||
1a60b59a48 | |||
a3c5c16417 | |||
8c40c02fc5 | |||
bdfdd5dbda | |||
1f549d51fa | |||
fc78bb9384 | |||
a6e8be2d67 | |||
5a483eaf29 | |||
dfbf7ab39a | |||
5292075a0a | |||
0bd6563e45 | |||
b0f34f2d4b | |||
6080e90bbb | |||
e76900ca9a | |||
cc0f1d9fcd | |||
dc24cfb9c3 | |||
869eee4d98 | |||
c34190f9f2 | |||
d1d730b779 | |||
b73b98ce3f | |||
ca2c284017 | |||
ce9f76d017 | |||
40bc498e9a | |||
eaf0d8668b | |||
dddd8eb849 | |||
a77964e1dd | |||
9d5cff3b34 | |||
23ea16f4b8 | |||
ca4618d8f4 | |||
ddfb66e999 | |||
7721787748 | |||
e6349d0312 | |||
373cfad645 | |||
d79447ed3a | |||
0b006b5080 | |||
6a780de22f | |||
d9ecec9bf7 | |||
8740e4f683 | |||
79d6ea614a | |||
f0e106f94f | |||
1bdff2b681 | |||
553b7d8568 | |||
e7e4bf13c3 | |||
095a7eac05 | |||
bba6e1667b | |||
21046bcae0 | |||
eec7b22582 | |||
e246a33269 | |||
0a2a5933da | |||
dc1e01b444 | |||
6a71e61c12 | |||
615835f03d | |||
dd6a95d041 | |||
cff4d162c1 |
4
.gitignore
vendored
4
.gitignore
vendored
@ -12,6 +12,10 @@ build
|
||||
RELEASE.txt
|
||||
Testing/
|
||||
|
||||
ctbDict.cpp
|
||||
ctbDict.h
|
||||
|
||||
|
||||
|
||||
*.pyc
|
||||
*/__pycache__/*
|
||||
|
@ -46,5 +46,5 @@ deploy:
|
||||
provider: script
|
||||
script: find $HOME/miniconda/conda-bld/${TRAVIS_OS_NAME}-64 -name "*.tar.bz2" -exec anaconda -t $CONDA_TOKEN upload --force {} \;
|
||||
on:
|
||||
branch: filip1
|
||||
branch: developer
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.9)
|
||||
cmake_minimum_required(VERSION 3.11)
|
||||
project(slsDetectorPackage)
|
||||
set(PROJECT_VERSION 5.0.0)
|
||||
|
||||
@ -42,6 +42,9 @@ option (SLS_USE_TESTS "TESTS" OFF)
|
||||
option (SLS_USE_INTEGRATION_TESTS "Integration Tests" OFF)
|
||||
option(SLS_USE_SANITIZER "Sanitizers for debugging" OFF)
|
||||
option(SLS_USE_PYTHON "Python bindings" OFF)
|
||||
option(SLS_USE_CTBGUI "ctb GUI" OFF)
|
||||
option(SLS_BUILD_DOCS "docs" OFF)
|
||||
option(SLS_BUILD_EXAMPLES "examples" OFF)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
@ -66,6 +69,7 @@ target_compile_options(slsProjectWarnings INTERFACE
|
||||
-Wredundant-decls
|
||||
# -Wconversion
|
||||
-Wdouble-promotion
|
||||
-Werror=return-type
|
||||
|
||||
)
|
||||
|
||||
@ -102,11 +106,10 @@ endif()
|
||||
|
||||
|
||||
if(SLS_USE_SANITIZER)
|
||||
target_compile_options(slsProjectOptions INTERFACE -fsanitize=address,undefined -fno-omit-frame-pointer)
|
||||
#target_compile_options(slsProjectOptions INTERFACE -fsanitize=address,undefined)
|
||||
target_link_libraries(slsProjectOptions INTERFACE -fsanitize=address,undefined)
|
||||
# target_compile_options(slsProjectOptions INTERFACE -fsanitize=thread)
|
||||
# target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread)
|
||||
# target_compile_options(slsProjectOptions INTERFACE -fsanitize=address,undefined -fno-omit-frame-pointer)
|
||||
# target_link_libraries(slsProjectOptions INTERFACE -fsanitize=address,undefined)
|
||||
target_compile_options(slsProjectOptions INTERFACE -fsanitize=thread)
|
||||
target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread)
|
||||
endif()
|
||||
|
||||
#rapidjson
|
||||
@ -153,7 +156,6 @@ if (SLS_USE_RECEIVER)
|
||||
find_package(HDF5 1.10 COMPONENTS CXX REQUIRED)
|
||||
endif (SLS_USE_HDF5)
|
||||
add_subdirectory(slsReceiverSoftware)
|
||||
add_subdirectory(manual/manual-api)
|
||||
endif (SLS_USE_RECEIVER)
|
||||
|
||||
if (SLS_USE_GUI)
|
||||
@ -177,15 +179,21 @@ if (SLS_USE_PYTHON)
|
||||
add_subdirectory(python)
|
||||
endif(SLS_USE_PYTHON)
|
||||
|
||||
if (SLS_USE_CTBGUI)
|
||||
add_subdirectory(ctbGui)
|
||||
endif(SLS_USE_CTBGUI)
|
||||
|
||||
configure_file( .clang-tidy
|
||||
${CMAKE_BINARY_DIR}/.clang-tidy
|
||||
)
|
||||
|
||||
if (SLS_BUILD_EXAMPLES)
|
||||
add_subdirectory(sample)
|
||||
endif(SLS_BUILD_EXAMPLES)
|
||||
|
||||
add_subdirectory(sample)
|
||||
|
||||
add_subdirectory(docs)
|
||||
|
||||
if(SLS_BUILD_DOCS)
|
||||
add_subdirectory(docs)
|
||||
endif(SLS_BUILD_DOCS)
|
||||
|
||||
|
||||
|
||||
|
21
cmk.sh
21
cmk.sh
@ -10,6 +10,7 @@ DEBUG=0
|
||||
PYTHON=0
|
||||
TESTS=0
|
||||
SIMULATOR=0
|
||||
CTBGUI=0
|
||||
|
||||
|
||||
CLEAN=0
|
||||
@ -18,7 +19,7 @@ CMAKE_PRE=""
|
||||
CMAKE_POST=""
|
||||
|
||||
usage() { echo -e "
|
||||
Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [i] [-h] [-d <HDF5 directory>] [-j] <Number of threads>
|
||||
Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [-h] [-d <HDF5 directory>] [-j] <Number of threads>
|
||||
-[no option]: only make
|
||||
-c: Clean
|
||||
-b: Builds/Rebuilds CMake files normal mode
|
||||
@ -29,6 +30,7 @@ Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [i] [-h] [-d <HDF5 directory>] [-j]
|
||||
-r: Build/Rebuilds only receiver
|
||||
-g: Build/Rebuilds only gui
|
||||
-s: Simulator
|
||||
-u: Chip Test Gui
|
||||
-j: Number of threads to compile through
|
||||
-e: Debug mode
|
||||
-i: Builds tests
|
||||
@ -67,7 +69,7 @@ For rebuilding only certain sections
|
||||
|
||||
" ; exit 1; }
|
||||
|
||||
while getopts ":bpchd:j:trgeis" opt ; do
|
||||
while getopts ":bpchd:j:trgeisu" opt ; do
|
||||
case $opt in
|
||||
b)
|
||||
echo "Building of CMake files Required"
|
||||
@ -122,6 +124,10 @@ while getopts ":bpchd:j:trgeis" opt ; do
|
||||
echo "Compiling Options: Simulator"
|
||||
SIMULATOR=1
|
||||
;;
|
||||
u)
|
||||
echo "Compiling Options: Chip Test Gui"
|
||||
CTBGUI=1
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG"
|
||||
usage
|
||||
@ -149,7 +155,7 @@ if [ $TEXTCLIENT -eq 0 ] && [ $RECEIVER -eq 0 ] && [ $GUI -eq 0 ]; then
|
||||
echo "Enabling Compile Option: TextClient, Receiver and GUI"
|
||||
else
|
||||
if [ $TEXTCLIENT -eq 1 ]; then
|
||||
CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON "
|
||||
CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON -DSLS_USE_RECEIVER=OFF "
|
||||
echo "Enabling Compile Option: TextClient"
|
||||
fi
|
||||
if [ $RECEIVER -eq 1 ]; then
|
||||
@ -188,14 +194,19 @@ fi
|
||||
|
||||
#Simulator
|
||||
if [ $SIMULATOR -eq 1 ]; then
|
||||
CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_SIMULATOR=ON "
|
||||
CMAKE_POST+=" -DSLS_USE_SIMULATOR=ON "
|
||||
echo "Simulator Option enabled"
|
||||
fi
|
||||
|
||||
#Chip Test Gui
|
||||
if [ $CTBGUI -eq 1 ]; then
|
||||
CMAKE_POST+=" -DSLS_USE_CTBGUI=ON "
|
||||
echo "CTB Gui Option enabled"
|
||||
fi
|
||||
|
||||
#Tests
|
||||
if [ $TESTS -eq 1 ]; then
|
||||
CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_TESTS=ON -DSLS_USE_INTEGRATION_TESTS=ON"
|
||||
CMAKE_POST+=" -DSLS_USE_TESTS=ON -DSLS_USE_INTEGRATION_TESTS=ON"
|
||||
echo "Tests Option enabled"
|
||||
fi
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
package:
|
||||
name: sls_detector_software
|
||||
version: "filip1"
|
||||
version: "developer"
|
||||
|
||||
source:
|
||||
- path: ..
|
||||
@ -76,7 +76,7 @@ outputs:
|
||||
run:
|
||||
- python
|
||||
- numpy
|
||||
- sls_detector_lib=filip1
|
||||
- sls_detector_lib=developer
|
||||
- pyzmq
|
||||
- libstdcxx-ng
|
||||
- libgcc-ng
|
||||
|
83
ctbGui/CMakeLists.txt
Normal file
83
ctbGui/CMakeLists.txt
Normal file
@ -0,0 +1,83 @@
|
||||
|
||||
|
||||
find_package(ROOT CONFIG REQUIRED COMPONENTS Core Gui)
|
||||
find_package(TIFF REQUIRED)
|
||||
|
||||
target_include_directories(ROOT::Core INTERFACE "${ROOT_INCLUDE_DIRS}")
|
||||
add_library(ROOT::Flags_CXX IMPORTED INTERFACE)
|
||||
separate_arguments(ROOT_CXX_FLAGS)
|
||||
target_compile_options(ROOT::Flags_CXX INTERFACE ${ROOT_CXX_FLAGS})
|
||||
separate_arguments(ROOT_DEFINITIONS)
|
||||
target_compile_definitions(ROOT::Flags_CXX INTERFACE ${ROOT_DEFINITIONS})
|
||||
|
||||
# This fixes a bug in the linker flags
|
||||
string(REPLACE "-L " "-L" ROOT_EXE_LINKER_FLAGS "${ROOT_EXE_LINKER_FLAGS}")
|
||||
separate_arguments(ROOT_EXE_LINKER_FLAGS)
|
||||
|
||||
# Stuck into using old property method due to separate -L and -l arguments
|
||||
# (A full path to -l is better!)
|
||||
set_property(TARGET ROOT::Flags_CXX PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES ${ROOT_EXE_LINKER_FLAGS})
|
||||
set_property(TARGET ROOT::Core PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${ROOT_INCLUDE_DIRS}")
|
||||
|
||||
|
||||
add_executable(ctbGui
|
||||
ctbGui.cpp
|
||||
ctbMain.cpp
|
||||
ctbDacs.cpp
|
||||
ctbPowers.cpp
|
||||
ctbSlowAdcs.cpp
|
||||
ctbSignals.cpp
|
||||
ctbAdcs.cpp
|
||||
ctbPattern.cpp
|
||||
ctbAcquisition.cpp
|
||||
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/tiffIO.cpp
|
||||
)
|
||||
|
||||
|
||||
#TODO! Replace with target
|
||||
target_include_directories(ctbGui PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/dataStructures
|
||||
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/interpolations
|
||||
${CMAKE_SOURCE_DIR}/slsDetectorCalibration/
|
||||
)
|
||||
|
||||
# Headders needed for ROOT dictionary generation
|
||||
set( HEADERS
|
||||
ctbDefs.h
|
||||
ctbMain.h
|
||||
ctbDacs.h
|
||||
ctbPattern.h
|
||||
ctbSignals.h
|
||||
ctbAdcs.h
|
||||
ctbAcquisition.h
|
||||
ctbPowers.h
|
||||
ctbSlowAdcs.h
|
||||
)
|
||||
|
||||
#set(ROOT_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
# ROOT dictionary generation
|
||||
include("${ROOT_DIR}/modules/RootNewMacros.cmake")
|
||||
root_generate_dictionary(ctbDict ${HEADERS} LINKDEF ctbLinkDef.h)
|
||||
add_library(ctbRootLib SHARED ctbDict.cxx)
|
||||
target_include_directories(ctbRootLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_link_libraries(ctbRootLib PUBLIC
|
||||
ROOT::Core
|
||||
slsDetectorShared
|
||||
slsSupportLib
|
||||
${ROOT_LIBRARIES}
|
||||
${ROOT_EXE_LINKER_FLAGS}
|
||||
)
|
||||
|
||||
target_link_libraries(ctbGui PUBLIC
|
||||
slsDetectorShared
|
||||
slsSupportLib
|
||||
ctbRootLib
|
||||
${TIFF_LIBRARIES}
|
||||
)
|
||||
|
||||
set_target_properties(ctbGui PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
@ -1,17 +1,17 @@
|
||||
|
||||
|
||||
INCS=ctbMain.h ctbDacs.h ctbPattern.h ctbSignals.h ctbAdcs.h ctbAcquisition.h ctbPowers.h ctbSlowAdcs.h
|
||||
SRC= $(SRC:.h=.cpp) ctbDict.cpp
|
||||
SRC= $(INCS:.h=.cpp) ctbDict.cpp
|
||||
LINKDEF=ctbLinkDef.h
|
||||
ZMQLIB=../slsReceiverSoftware/include
|
||||
LIBRARYCBF=$(CBFLIBDIR)/lib/*.o
|
||||
|
||||
INCDIR=-I../slsReceiverSoftware/include/ -I../slsDetectorSoftware/include/ -I../slsSupportLib/include/ -I../slsDetectorCalibration -I../slsDetectorCalibration/dataStructures -I$(CBFLIBDIR)/include -I../slsDetectorCalibration/interpolations
|
||||
LDFLAG=-L../bin -lSlsDetector -lSlsSupport -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -L$(ZMQLIB) -L$(CBFLIBDIR)/lib/ -std=c++11
|
||||
LDFLAG=-L../build/bin -lSlsDetector -lSlsSupport -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -L$(ZMQLIB) -L$(CBFLIBDIR)/lib/ -std=c++11
|
||||
#
|
||||
MAIN=ctbGui.cpp
|
||||
|
||||
DESTDIR?=../bin
|
||||
DESTDIR?=../build/bin
|
||||
|
||||
|
||||
OBJS = $(SRC:.cpp=.o) $(MAIN:.cpp=.o)
|
||||
@ -30,13 +30,13 @@ ctbDict.cpp: $(INCS) $(LINKDEF)
|
||||
|
||||
%.o : %.cpp
|
||||
echo $@
|
||||
g++ -DMYROOT `source root-config --cflags --glibs` -lMinuit -DCTB $(LDFLAG) -o $@ -c $< $(INCDIR)
|
||||
g++ -DMYROOT `root-config --cflags --glibs` -lMinuit -DCTB $(LDFLAG) -o $@ -c $< $(INCDIR)
|
||||
#$(CXX) -o $@ -c $< $(INCLUDES) $(DFLAGS) -fPIC $(EPICSFLAGS) -lpthread #$(FLAGS)
|
||||
|
||||
|
||||
|
||||
$(DESTDIR)/ctbGui: $(OBJS) $(LINKDEF)
|
||||
g++ -DMYROOT `source root-config --cflags --glibs` -lMinuit -DCTB $(LDFLAG) -o ctbGui $(INCDIR) $(OBJS) ../slsDetectorCalibration/tiffIO.cpp
|
||||
g++ -DMYROOT `root-config --cflags --glibs` -lMinuit -DCTB $(LDFLAG) -o ctbGui $(INCDIR) $(OBJS) ../slsDetectorCalibration/tiffIO.cpp
|
||||
mv ctbGui $(DESTDIR)
|
||||
|
||||
clean:
|
||||
|
@ -24,7 +24,8 @@
|
||||
#include <fstream>
|
||||
|
||||
#include "ctbAcquisition.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "ctbDefs.h"
|
||||
#include "Detector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
#include "ctbMain.h"
|
||||
#include "moench03CtbData.h"
|
||||
@ -39,6 +40,7 @@
|
||||
#include "Mythen3_02_jctbData.h"
|
||||
#include "adcSar2_jctbData.h"
|
||||
#include "moench04CtbZmqData.h"
|
||||
#include "moench04CtbZmq10GbData.h"
|
||||
#include "deserializer.h"
|
||||
#include "detectorData.h"
|
||||
|
||||
@ -47,7 +49,7 @@ using namespace std;
|
||||
|
||||
|
||||
|
||||
ctbAcquisition::ctbAcquisition(TGVerticalFrame *page, multiSlsDetector *det) : TGGroupFrame(page,"Acquisition",kVerticalFrame), myDet(det), myCanvas(NULL), globalPlot(0), nAnalogSamples(1), nDigitalSamples(1), dataStructure(NULL), photonFinder(NULL), cmSub(0), dBitMask(0xffffffffffffffff), deserializer(0) {
|
||||
ctbAcquisition::ctbAcquisition(TGVerticalFrame *page, sls::Detector *det) : TGGroupFrame(page,"Acquisition",kVerticalFrame), myDet(det), myCanvas(NULL), globalPlot(0), tenG(0), nAnalogSamples(1), nDigitalSamples(1), dataStructure(NULL), photonFinder(NULL), cmSub(0), dBitMask(0xffffffffffffffff), deserializer(0) {
|
||||
|
||||
adcFit=NULL;
|
||||
bitPlot=NULL;
|
||||
@ -70,8 +72,11 @@ ctbAcquisition::ctbAcquisition(TGVerticalFrame *page, multiSlsDetector *det) : T
|
||||
cFileSave->SetTextJustify(kTextRight);
|
||||
cFileSave->Connect("Toggled(Bool_t)","ctbAcquisition",this,"setFsave(Bool_t)");
|
||||
|
||||
|
||||
eFname = new TGTextEntry(hframe, (myDet->getFileName()).c_str());
|
||||
std::string temp = "run";
|
||||
try {
|
||||
temp = myDet->getFileNamePrefix().tsquash("Different values");
|
||||
} CATCH_DISPLAY ("Could not get file name prefix.", "ctbAcquisition::ctbAcquisition")
|
||||
eFname = new TGTextEntry(hframe, temp.c_str());
|
||||
|
||||
hframe->AddFrame(eFname,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
|
||||
eFname->MapWindow();
|
||||
@ -112,7 +117,11 @@ ctbAcquisition::ctbAcquisition(TGVerticalFrame *page, multiSlsDetector *det) : T
|
||||
|
||||
|
||||
|
||||
eOutdir = new TGTextEntry(hframe, (myDet->getFilePath()).c_str());
|
||||
temp = "/tmp/";
|
||||
try {
|
||||
temp = myDet->getFilePath().tsquash("Different values");
|
||||
} CATCH_DISPLAY ("Could not get file path.", "ctbAcquisition::ctbAcquisition")
|
||||
eOutdir = new TGTextEntry(hframe, temp.c_str());
|
||||
|
||||
hframe->AddFrame(eOutdir,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5));
|
||||
eOutdir->MapWindow();
|
||||
@ -596,20 +605,11 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
|
||||
acqThread = new TThread("acqThread",
|
||||
ctbAcquisition::ThreadHandle,(void*)this);
|
||||
// acqThread->Run();
|
||||
cout <<"Registering progress callback" << endl;
|
||||
try {
|
||||
myDet->registerProgressCallback(&progressCallback,(void*)this);
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
cout <<"Registering data callback" << endl;
|
||||
try{
|
||||
try {
|
||||
myDet->registerDataCallback(&dataCallback, (void*)this);
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get register call back.", "ctbAcquisition::ctbAcquisition")
|
||||
|
||||
cout <<"Done" << endl;
|
||||
|
||||
@ -663,10 +663,6 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
countsHisto[i]=h1;
|
||||
}
|
||||
|
||||
int nx,ny;
|
||||
int csize=3;
|
||||
int nsigma=5;
|
||||
|
||||
dataStructure=NULL;
|
||||
commonMode=NULL;
|
||||
photonFinder=NULL;
|
||||
@ -770,7 +766,7 @@ void ctbAcquisition::canvasClicked() {
|
||||
void ctbAcquisition::setCanvas(TCanvas* c) {
|
||||
myCanvas=c;
|
||||
myCanvas->cd();
|
||||
myCanvas->AddExec("dynamic",Form("((ctbAcquisition*)0x%x)->canvasClicked()",this));
|
||||
myCanvas->AddExec("dynamic",Form("((ctbAcquisition*)%p)->canvasClicked()",this));
|
||||
// myCanvas->AddExec("ex","canvasClicked()");
|
||||
}
|
||||
void ctbAcquisition::dataCallback(detectorData *data, long unsigned int index, unsigned int dum, void* pArgs) {
|
||||
@ -805,8 +801,6 @@ digital:
|
||||
sample0 (dbit0 + dbit1 +...)
|
||||
sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
|
||||
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
||||
|
||||
if (action == PUT_ACTION) {
|
||||
std::vector <int> dbitlist;
|
||||
|
||||
@ -844,19 +838,18 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
// cout <<"------"<< index << " " << ip << " " << data->npoints << endl;
|
||||
//#endif
|
||||
int ig=0;
|
||||
int i, ii, ich=0, ib, vv;
|
||||
int i, ii, ib;
|
||||
// TList *l= adcStack->GetHists();
|
||||
// TList *l1= countsStack->GetHists();
|
||||
TH1F *h;
|
||||
TH1F *h1;
|
||||
TH1F *hb;
|
||||
int nb, x,y;
|
||||
int x;
|
||||
double ped=0;
|
||||
int vv1,vv2;
|
||||
int dsize=-1;
|
||||
int *val=NULL;
|
||||
int nx=1, ny=1, jj;
|
||||
short unsigned int *va;
|
||||
int nx=1, ny=1;
|
||||
|
||||
if (dataStructure) {
|
||||
dataStructure->getDetectorSize(nx,ny);
|
||||
cout << "Data structure: " << dataStructure << " size " << nx << " " << ny << endl;
|
||||
@ -872,7 +865,7 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
int nadc;
|
||||
int ndbit;
|
||||
|
||||
|
||||
tenG = 0;
|
||||
|
||||
|
||||
|
||||
@ -893,7 +886,17 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
}
|
||||
} else
|
||||
ndbit=dbitlist.size();
|
||||
if (tenG){
|
||||
|
||||
if (nDigitalSamples && nAnalogSamples){
|
||||
if (nDigitalSamples>nAnalogSamples)
|
||||
dsize=nDigitalSamples*(32*2+8);
|
||||
else
|
||||
dsize=nAnalogSamples*(32*2+8);
|
||||
} else
|
||||
dsize=32*2*nAnalogSamples+8*nDigitalSamples;
|
||||
|
||||
} else
|
||||
dsize=nadc*2*nAnalogSamples+ndbit*(nDigitalSamples-dBitOffset/8)/8;
|
||||
|
||||
cout << "dataBytes is " << data->databytes << " expected " << dsize << endl;
|
||||
@ -905,7 +908,11 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
i=0;
|
||||
|
||||
|
||||
char *d_data= data->data+2*nadc*nAnalogSamples;
|
||||
char *d_data;
|
||||
if (tenG)
|
||||
d_data= data->data;
|
||||
else
|
||||
d_data = data->data+2*nadc*nAnalogSamples;
|
||||
char dval;
|
||||
|
||||
|
||||
@ -967,6 +974,10 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
ig=ii;
|
||||
else
|
||||
ig=adclist.at(ii);
|
||||
|
||||
// if (tenG)
|
||||
// aval=data->getChannel(i);
|
||||
// else
|
||||
aval=data->getChannel(i);//*((uint16_t*)(data->cvalues+i*2));//
|
||||
|
||||
if (plotFlag[ig]) {
|
||||
@ -983,6 +994,7 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
|
||||
i++;
|
||||
}
|
||||
if (tenG) i+=4;
|
||||
|
||||
}
|
||||
|
||||
@ -992,7 +1004,9 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
if (dbitlist.empty()) {
|
||||
for (ip=0; ip<nDigitalSamples; ip++) {
|
||||
for (ig=0; ig<8; ig++) {
|
||||
|
||||
if (tenG)
|
||||
dval=*(d_data+ip*(8+32*2)+32*2+ig);
|
||||
else
|
||||
dval=*(d_data+ip*8+ig);
|
||||
|
||||
for (ib=(ig)*8; ib<(ig+1)*8; ib++) {
|
||||
@ -1010,7 +1024,6 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
} else {
|
||||
ii=0;
|
||||
int iii=0;
|
||||
int nb=dbitlist.size();
|
||||
for (const auto &value : dbitlist) {
|
||||
ib=value;
|
||||
hb=bitHisto[ib];
|
||||
@ -1176,10 +1189,10 @@ void ctbAcquisition::changeDetector(){
|
||||
photonFinder=NULL;
|
||||
dataStructure=NULL;
|
||||
commonMode=NULL;
|
||||
TH2F *h2DMapOld=h2DMapAn;
|
||||
|
||||
// TH2F *h2ScanOld=h2Scan;
|
||||
TH1F *h1DMapOld=h1DMap;
|
||||
int dim=2;
|
||||
|
||||
|
||||
int nx,ny;
|
||||
int csize=3;
|
||||
int nsigma=5;
|
||||
@ -1197,7 +1210,16 @@ void ctbAcquisition::changeDetector(){
|
||||
// commonMode=new moench03CommonMode();
|
||||
break;
|
||||
case MOENCH04:
|
||||
|
||||
try {
|
||||
auto retval = myDet->getTenGiga().tsquash("Different values");
|
||||
if (retval) {
|
||||
dataStructure=new moench04CtbZmq10GbData(nAnalogSamples, nDigitalSamples);
|
||||
} else {
|
||||
dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples);
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get ten giga enable.", "ctbAcquisition::changeDetector")
|
||||
|
||||
cout << "MOENCH 0.4!" << endl;
|
||||
commonMode=new moench03CommonMode();
|
||||
break;
|
||||
@ -1411,7 +1433,7 @@ void ctbAcquisition::setBitGraph(int i ,int en, Pixel_t col) {
|
||||
float off=0;
|
||||
for (int ii=0; ii<NSIGNALS; ii++) {
|
||||
if (bitPlotFlag[ii]) {bitOffset[ii]=off;
|
||||
off+=1.5;
|
||||
off+=static_cast<float>(1.5);
|
||||
cout << "bit " << ii << " offset " << bitOffset[ii] << endl;
|
||||
}
|
||||
}
|
||||
@ -1427,73 +1449,64 @@ void ctbAcquisition::setBitGraph(int i ,int en, Pixel_t col) {
|
||||
void ctbAcquisition::setOutdir() {
|
||||
try {
|
||||
myDet->setFilePath(eOutdir->GetText());
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
// // cout << "setting dac! "<< id << endl;
|
||||
|
||||
// myDet->setDAC(dacsEntry->GetIntNumber(), (slsDetectorDefs::dacIndex)id, dacsUnit->IsOn());
|
||||
|
||||
// getValue();
|
||||
|
||||
} CATCH_DISPLAY ("Could not set file path", "ctbAcquisition::setOutdir")
|
||||
}
|
||||
|
||||
void ctbAcquisition::setFname() {
|
||||
try {
|
||||
myDet->setFileName(eFname->GetText());
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
// int val=myDet->setDAC(-1, (slsDetectorDefs::dacIndex)id, dacsUnit->IsOn());
|
||||
// char s[100];
|
||||
|
||||
// sprintf(s,"%d",val);
|
||||
|
||||
// dacsValue->SetText(s);
|
||||
|
||||
|
||||
// return val;
|
||||
|
||||
myDet->setFileNamePrefix(eFname->GetText());
|
||||
} CATCH_DISPLAY ("Could not set file name prefix", "ctbAcquisition::setFname")
|
||||
}
|
||||
|
||||
void ctbAcquisition::setFindex() {
|
||||
|
||||
try {
|
||||
myDet->setFileIndex(eFindex->GetNumber());
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
myDet->setAcquisitionIndex(eFindex->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set acquisition index", "ctbAcquisition::setFindex")
|
||||
}
|
||||
|
||||
|
||||
void ctbAcquisition::setFsave(Bool_t b) {
|
||||
try {
|
||||
myDet->setFileWrite(b);
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
eFname->SetState(b);
|
||||
eOutdir->SetState(b);
|
||||
|
||||
} CATCH_DISPLAY ("Could not set file write", "ctbAcquisition::setFsave")
|
||||
}
|
||||
|
||||
void ctbAcquisition::update() {
|
||||
try {
|
||||
auto retval = myDet->getFileNamePrefix().tsquash("Different values");
|
||||
eFname->SetText(retval.c_str());
|
||||
} CATCH_DISPLAY ("Could not get file name prefix", "ctbAcquisition::update")
|
||||
|
||||
try {
|
||||
auto retval = myDet->getAcquisitionIndex().tsquash("Different values");
|
||||
eFindex->SetNumber(retval);
|
||||
} CATCH_DISPLAY ("Could not get acquisition index", "ctbAcquisition::update")
|
||||
|
||||
try {
|
||||
auto retval = myDet->getFileWrite().tsquash("Different values");
|
||||
cFileSave->SetOn(retval);
|
||||
} CATCH_DISPLAY ("Could not get file write", "ctbAcquisition::update")
|
||||
|
||||
eFname->SetText((myDet->getFileName()).c_str());
|
||||
eOutdir->SetText((myDet->getFilePath()).c_str());
|
||||
eFindex->SetNumber(myDet->getFileIndex());
|
||||
cFileSave->SetOn(myDet->getFileWrite());
|
||||
eFname->SetState(cFileSave->IsOn());
|
||||
eOutdir->SetState(cFileSave->IsOn());
|
||||
eFindex->SetState(cFileSave->IsOn());
|
||||
// eMeasurements->SetNumber(myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1));
|
||||
setAnalogSamples(myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES,-1));
|
||||
setDigitalSamples(myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES,-1));
|
||||
roMode=myDet->setReadOutFlags();
|
||||
|
||||
try {
|
||||
auto retval = myDet->getNumberOfAnalogSamples().tsquash("Different values");
|
||||
setAnalogSamples(retval);
|
||||
} CATCH_DISPLAY ("Could not get number of analog samples", "ctbAcquisition::update")
|
||||
|
||||
try {
|
||||
auto retval = myDet->getNumberOfDigitalSamples().tsquash("Different values");
|
||||
setDigitalSamples(retval);
|
||||
} CATCH_DISPLAY ("Could not get number of digital samples", "ctbAcquisition::update")
|
||||
|
||||
try {
|
||||
roMode = static_cast<int>(myDet->getReadoutMode().tsquash("Different values"));
|
||||
setReadoutMode(roMode);
|
||||
//nChannels=myDet->getTotalNumberOfChannels();
|
||||
} CATCH_DISPLAY ("Could not get readout mode", "ctbAcquisition::update")
|
||||
|
||||
updateChans();
|
||||
|
||||
if (dataStructure) {
|
||||
@ -1507,7 +1520,14 @@ void ctbAcquisition::update() {
|
||||
}
|
||||
|
||||
}
|
||||
dBitOffset=myDet->getReceiverDbitOffset();
|
||||
|
||||
try {
|
||||
dBitOffset = myDet->getRxDbitOffset().tsquash("Different values");
|
||||
} CATCH_DISPLAY ("Could not get receiver dbit offset", "ctbAcquisition::update")
|
||||
|
||||
try {
|
||||
tenG = myDet->getTenGiga().tsquash("Different values");
|
||||
} CATCH_DISPLAY ("Could not get ten giga enable", "ctbAcquisition::update")
|
||||
|
||||
// char aargs[10][100];
|
||||
// char *args[10];
|
||||
@ -1568,10 +1588,8 @@ void ctbAcquisition::loadPattern() {
|
||||
|
||||
cout << "Load: " << fname << endl;
|
||||
try {
|
||||
myDet->retrieveDetectorSetup(fname);
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
myDet->loadParameters(fname);
|
||||
} CATCH_DISPLAY ("Could not load parameters", "ctbAcquisition::loadPattern")
|
||||
}
|
||||
}
|
||||
|
||||
@ -1582,16 +1600,26 @@ void ctbAcquisition::toggleAcquisition() {
|
||||
if (acqThread->GetState()==1 || acqThread->GetState()==6) {
|
||||
/** update all infos useful for the acquisition! */
|
||||
|
||||
setAnalogSamples(myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES,-1));
|
||||
setDigitalSamples(myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES,-1));
|
||||
dBitOffset=myDet->getReceiverDbitOffset();
|
||||
roMode=myDet->setReadOutFlags();
|
||||
try {
|
||||
auto retval = myDet->getNumberOfAnalogSamples().tsquash("Different values");
|
||||
setAnalogSamples(retval);
|
||||
} CATCH_DISPLAY ("Could not get number of analog samples", "ctbAcquisition::toggleAcquisition")
|
||||
|
||||
try {
|
||||
auto retval = myDet->getNumberOfDigitalSamples().tsquash("Different values");
|
||||
setDigitalSamples(retval);
|
||||
} CATCH_DISPLAY ("Could not get number of digital samples", "ctbAcquisition::toggleAcquisition")
|
||||
|
||||
try {
|
||||
dBitOffset = myDet->getRxDbitOffset().tsquash("Different values");
|
||||
} CATCH_DISPLAY ("Could not get receiver dbit offset", "ctbAcquisition::toggleAcquisition")
|
||||
|
||||
try {
|
||||
roMode = static_cast<int>(myDet->getReadoutMode().tsquash("Different values"));
|
||||
setReadoutMode(roMode);
|
||||
} CATCH_DISPLAY ("Could not get readout mode", "ctbAcquisition::toggleAcquisition")
|
||||
|
||||
|
||||
|
||||
// iScanStep=0;
|
||||
|
||||
cout << "Run" << endl;
|
||||
bStatus->SetText("Stop");
|
||||
ip=0;
|
||||
@ -1641,11 +1669,9 @@ void ctbAcquisition::toggleAcquisition() {
|
||||
|
||||
} else {
|
||||
StopFlag=1;
|
||||
try {
|
||||
myDet->stopAcquisition();
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
try{
|
||||
myDet->stopDetector();
|
||||
} CATCH_DISPLAY ("Could not stop acquisition", "ctbAcquisition::toggleAcquisition")
|
||||
stop=1;
|
||||
bStatus->SetText("Start");
|
||||
// acqThread->Kill();
|
||||
@ -1662,27 +1688,30 @@ void ctbAcquisition::acquisitionFinished() {
|
||||
void ctbAcquisition::startAcquisition(){
|
||||
cout << "Detector started " <<eMeasurements->GetNumber()<< endl;
|
||||
stop=0;
|
||||
|
||||
try {
|
||||
tenG = myDet->getTenGiga().tsquash("Different values");
|
||||
} CATCH_DISPLAY ("Could not get ten giga enable", "ctbAcquisition::startAcquisition")
|
||||
|
||||
for (int im=0; im<eMeasurements->GetNumber(); im++) {
|
||||
try {
|
||||
myDet->acquire();
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
cout << im << endl;
|
||||
if (stop) break;
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not acquire", "ctbAcquisition::startAcquisition")
|
||||
|
||||
cout << im << endl;
|
||||
if (stop)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void* ctbAcquisition::ThreadHandle(void *arg)
|
||||
{
|
||||
ctbAcquisition *acq = static_cast<ctbAcquisition*>(arg);
|
||||
int i=0;
|
||||
|
||||
acq->startAcquisition();
|
||||
acq->acquisitionFinished();
|
||||
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ctbAcquisition::progressCallback(double f,void* arg) {
|
||||
@ -1715,12 +1744,6 @@ void ctbAcquisition::setPatternCompiler(const char* t) {
|
||||
}
|
||||
void ctbAcquisition::setMeasurements() {
|
||||
|
||||
|
||||
|
||||
// myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,eMeasurements->GetNumber());
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ctbAcquisition::setAnalogSamples(int n) {
|
||||
@ -1775,11 +1798,11 @@ void ctbAcquisition::setDigitalSamples(int n) {
|
||||
void ctbAcquisition::setReadoutMode(int f) {
|
||||
|
||||
roMode=f;
|
||||
slsDetectorDefs::readOutFlags flags=(slsDetectorDefs::readOutFlags)f;
|
||||
if (flags&slsDetectorDefs::DIGITAL_ONLY) {
|
||||
slsDetectorDefs::readoutMode flag=(slsDetectorDefs::readoutMode)f;
|
||||
if (flag == slsDetectorDefs::DIGITAL_ONLY) {
|
||||
nAnalogSamples=0;
|
||||
adclist.clear();
|
||||
} else if (flags&slsDetectorDefs::ANALOG_AND_DIGITAL) {
|
||||
} else if (flag ==slsDetectorDefs::ANALOG_AND_DIGITAL) {
|
||||
;
|
||||
}
|
||||
else {
|
||||
@ -1825,46 +1848,32 @@ void ctbAcquisition::setDbitEnable(Int_t reg){
|
||||
|
||||
void ctbAcquisition::updateChans() {
|
||||
|
||||
/** dbitlist updated */
|
||||
std::vector <int> dbl;
|
||||
// dbit list
|
||||
try {
|
||||
dbl = myDet->getReceiverDbitList();
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
auto retval = myDet->getRxDbitList().tsquash("Different values");
|
||||
dbitlist.clear();
|
||||
if (dbl.empty())
|
||||
;
|
||||
else {
|
||||
for (const auto &value : dbl)
|
||||
if (!retval.empty()) {
|
||||
for (const auto &value : retval)
|
||||
dbitlist.push_back(value);
|
||||
}
|
||||
uint32_t reg;
|
||||
} CATCH_DISPLAY ("Could not get receiver dbit list.", "ctbAcquisition::updateChans")
|
||||
|
||||
// adc mask
|
||||
try {
|
||||
reg=myDet->getADCEnableMask();
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
/* adc updated */
|
||||
auto retval = myDet->getADCEnableMask().tsquash("Different values");
|
||||
adclist.clear();
|
||||
// // updateChans();
|
||||
if (reg!=0xffffffff) {
|
||||
if (retval!=0xffffffff) {
|
||||
for (int i=0; i<NADCS; i++) {
|
||||
if (reg&(1<<i))
|
||||
if (retval&(1<<i)) {
|
||||
adclist.push_back(i);
|
||||
// // else enableFlag[i]=1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get adc enable mask.", "ctbAcquisition::updateChans")
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ctbAcquisition::resetPedestal() {
|
||||
if (photonFinder) {
|
||||
photonFinder->newDataSet();
|
||||
|
@ -23,7 +23,10 @@ class TH1F;
|
||||
class TGLabel;
|
||||
class TGTextButton;
|
||||
|
||||
class multiSlsDetector;
|
||||
namespace sls
|
||||
{
|
||||
class Detector;
|
||||
};
|
||||
class detectorData;
|
||||
|
||||
template <class dataType> class slsDetectorData;
|
||||
@ -112,7 +115,7 @@ class ctbAcquisition : public TGGroupFrame {
|
||||
// TH1I *plotAdc[NADCS];
|
||||
|
||||
|
||||
multiSlsDetector* myDet;
|
||||
sls::Detector* myDet;
|
||||
|
||||
int plotFlag[NADCS];
|
||||
int bitPlotFlag[NSIGNALS];
|
||||
@ -151,6 +154,7 @@ class ctbAcquisition : public TGGroupFrame {
|
||||
int globalPlot;
|
||||
int adcPlot;
|
||||
int dbitPlot;
|
||||
int tenG;
|
||||
|
||||
int nAnalogSamples, nDigitalSamples;
|
||||
// int iScanStep;
|
||||
@ -168,7 +172,7 @@ class ctbAcquisition : public TGGroupFrame {
|
||||
int deserializer;
|
||||
|
||||
public:
|
||||
ctbAcquisition(TGVerticalFrame*, multiSlsDetector*);
|
||||
ctbAcquisition(TGVerticalFrame*, sls::Detector*);
|
||||
void setOutdir();
|
||||
void setFname();
|
||||
void setMeasurements();
|
||||
|
@ -24,14 +24,14 @@
|
||||
#include <fstream>
|
||||
|
||||
#include "ctbAdcs.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "slsDetectorCommand.h"
|
||||
#include "ctbDefs.h"
|
||||
#include "Detector.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
ctbAdc::ctbAdc(TGVerticalFrame *page, int i, multiSlsDetector *det)
|
||||
ctbAdc::ctbAdc(TGVerticalFrame *page, int i, sls::Detector *det)
|
||||
: TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
|
||||
|
||||
TGHorizontalFrame *hframe=this;
|
||||
@ -155,7 +155,7 @@ void ctbAdc::setAdcAlias(char *tit, int plot, int color) {
|
||||
string ctbAdc::getAdcAlias() {
|
||||
|
||||
char line[1000];
|
||||
sprintf(line,"ADC%d %s %d %x\n",id,sAdcLabel->GetText()->Data(),sAdcPlot->IsOn(),fColorSel->GetColor());
|
||||
sprintf(line,"ADC%d %s %d %lx\n",id,sAdcLabel->GetText()->Data(),sAdcPlot->IsOn(),fColorSel->GetColor());
|
||||
return string(line);
|
||||
}
|
||||
|
||||
@ -264,7 +264,7 @@ void ctbAdc::setPlot(Bool_t b){
|
||||
|
||||
|
||||
|
||||
ctbAdcs::ctbAdcs(TGVerticalFrame *page, multiSlsDetector *det)
|
||||
ctbAdcs::ctbAdcs(TGVerticalFrame *page, sls::Detector *det)
|
||||
: TGGroupFrame(page,"Adcs",kVerticalFrame), myDet(det) {
|
||||
|
||||
|
||||
@ -272,7 +272,6 @@ ctbAdcs::ctbAdcs(TGVerticalFrame *page, multiSlsDetector *det)
|
||||
page->AddFrame(this,new TGLayoutHints( kLHintsTop | kLHintsExpandX , 10,10,10,10));
|
||||
MapWindow();
|
||||
|
||||
char tit[100];
|
||||
|
||||
|
||||
TGHorizontalFrame* hframe=new TGHorizontalFrame(this, 800,800);
|
||||
@ -415,108 +414,41 @@ ctbAdcs::ctbAdcs(TGVerticalFrame *page, multiSlsDetector *det)
|
||||
|
||||
int ctbAdcs::setEnable(int reg) {
|
||||
|
||||
// char aargs[10][100];
|
||||
// char *args[10];
|
||||
string retval;
|
||||
int retreg;
|
||||
|
||||
// for (int i=0; i<10; i++) args[i]=aargs[i];
|
||||
|
||||
// sprintf(args[0],"adcenable");
|
||||
// sprintf(args[1],"%x",reg);
|
||||
// slsDetectorCommand *cmd=new slsDetectorCommand(myDet);
|
||||
// if (reg>-1) {
|
||||
// retval=cmd->executeLine(1,args,slsDetectorDefs::PUT_ACTION);
|
||||
// }
|
||||
if (reg>-1) {
|
||||
try {
|
||||
if (reg > -1) {
|
||||
myDet->setADCEnableMask(reg);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
auto retval = myDet->getADCEnableMask().tsquash("Different values");
|
||||
eEnableMask->SetHexNumber(retval);
|
||||
return retval;
|
||||
} CATCH_DISPLAY ("Could not set/get adc enablemask.", "ctbAdcs::setEnable")
|
||||
|
||||
}
|
||||
// retval=cmd->executeLine(1,args,slsDetectorDefs::GET_ACTION);
|
||||
// cout <<"enable: " << retval << endl;;
|
||||
// delete cmd;
|
||||
|
||||
// sscanf(retval.c_str(),"%x",&retreg);
|
||||
try {
|
||||
retreg=myDet->getADCEnableMask();
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
eEnableMask->SetHexNumber(retreg);
|
||||
|
||||
return retreg;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ctbAdcs::setInvert(int reg) {
|
||||
|
||||
// char aargs[10][100];
|
||||
// char *args[10];
|
||||
string retval;
|
||||
int retreg;
|
||||
|
||||
// for (int i=0; i<10; i++) args[i]=aargs[i];
|
||||
|
||||
//sprint// f(args[0],"adcinvert");
|
||||
// sprintf(args[1],"%x",reg);
|
||||
// slsDetectorCommand *cmd=new slsDetectorCommand(myDet);
|
||||
|
||||
if (reg>-1) {
|
||||
try {
|
||||
if (reg > -1) {
|
||||
myDet->setADCInvert(reg);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
auto retval = myDet->getADCInvert().tsquash("Different values");
|
||||
eInversionMask->SetHexNumber(retval);
|
||||
return retval;
|
||||
} CATCH_DISPLAY ("Could not set/get adc enablemask.", "ctbAdcs::setEnable")
|
||||
|
||||
//retval=cmd->executeLine(1,args,slsDetectorDefs::PUT_ACTION);
|
||||
}
|
||||
try {
|
||||
retreg=myDet->getADCInvert();
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
// retval=cmd->executeLine(1,args,slsDetectorDefs::GET_ACTION);
|
||||
// cout <<"invert: " << retval << endl;;
|
||||
// delete cmd;
|
||||
|
||||
// sscanf(retval.c_str(),"%x",&retreg);
|
||||
eInversionMask->SetHexNumber(retreg);
|
||||
return retreg;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ctbAdcs::update() {
|
||||
Int_t invreg;//=myDet->readRegister(67);//(120);
|
||||
Int_t disreg;//=myDet->readRegister(120);//(94);
|
||||
// for (int i=0; i<10; i++)
|
||||
// args[i]=aargs[i];
|
||||
|
||||
// string retval;
|
||||
// sprintf(args[0],"adcenable");
|
||||
// slsDetectorCommand *cmd=new slsDetectorCommand(myDet);
|
||||
// retval=cmd->executeLine(1,args,slsDetectorDefs::GET_ACTION);
|
||||
// delete cmd;
|
||||
// // cout << retval << endl;
|
||||
|
||||
// sscanf(retval.c_str(),"adcenable %x",&disreg);
|
||||
|
||||
// eInversionMask->SetHexNumber(invreg);
|
||||
// eEnableMask->SetHexNumber(disreg);
|
||||
Int_t invreg;
|
||||
Int_t disreg;
|
||||
|
||||
disreg=setEnable();
|
||||
invreg=setInvert();
|
||||
|
||||
|
||||
for (int is=0; is<NADCS; is++) {
|
||||
sAdc[is]->setAdcAlias(NULL,-1,-1);
|
||||
if (invreg & (1<<is) )
|
||||
@ -528,42 +460,29 @@ void ctbAdcs::update() {
|
||||
sAdc[is]->setEnable(kTRUE);
|
||||
else
|
||||
sAdc[is]->setEnable(kFALSE);
|
||||
|
||||
|
||||
}
|
||||
|
||||
Emit("AdcEnable(Int_t)", disreg);
|
||||
|
||||
}
|
||||
string ctbAdcs::getAdcParameters() {
|
||||
|
||||
ostringstream line;
|
||||
|
||||
line << "reg "<< hex << setInvert() << "# ADC invert reg" << dec << endl;
|
||||
line << "reg "<< hex << setEnable() << " # ADC enable reg"<< dec << endl;
|
||||
// line << "reg "<< hex << 67 << " " << myDet->readRegister(67) << "# ADC invert reg" << dec << endl;
|
||||
// line << "reg "<< hex << 120 << " " << myDet->readRegister(120) << " # ADC enable reg"<< dec << endl;
|
||||
// // line << "reg "<< hex << 94 << " " << myDet->readRegister(94) << " # ADC enable reg"<< dec << endl;
|
||||
return line.str();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ctbAdcs::CheckAll() {
|
||||
|
||||
|
||||
for (int is=0; is<NADCS; is++){
|
||||
sAdc[is]->setPlot(kTRUE);
|
||||
// sAdc[is]->setEnabled(kTRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ctbAdcs::RemoveAll() {
|
||||
|
||||
|
||||
for (int is=0; is<NADCS; is++) {
|
||||
// sAdc[is]->setEnabled(kFALSE);
|
||||
sAdc[is]->setPlot(kFALSE);
|
||||
}
|
||||
}
|
||||
@ -571,51 +490,32 @@ void ctbAdcs::RemoveAll() {
|
||||
|
||||
|
||||
void ctbAdcs::CheckHalf0() {
|
||||
|
||||
|
||||
for (int is=0; is<NADCS/2; is++) {
|
||||
sAdc[is]->setPlot(kTRUE);
|
||||
// sAdc[is]->setEnabled(kTRUE)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ctbAdcs::RemoveHalf0() {
|
||||
|
||||
|
||||
for (int is=0; is<NADCS/2; is++){
|
||||
// sAdc[is]->setEnabled(kFALSE);
|
||||
sAdc[is]->setPlot(kFALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void ctbAdcs::CheckHalf1() {
|
||||
|
||||
|
||||
for (int is=NADCS/2; is<NADCS; is++){
|
||||
sAdc[is]->setPlot(kTRUE);
|
||||
// sAdc[is]->setEnabled(kTRUE)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ctbAdcs::RemoveHalf1() {
|
||||
|
||||
|
||||
for (int is=NADCS/2; is<NADCS; is++){
|
||||
// sAdc[is]->setEnabled(kFALSE);
|
||||
sAdc[is]->setPlot(kFALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TGraph* ctbAdcs::getGraph(int i) {
|
||||
|
||||
// if (i>=0 && i<NADCS)
|
||||
// return sAdc[i]->getGraph();
|
||||
// return NULL;
|
||||
// }
|
||||
|
||||
int ctbAdcs::setAdcAlias(string line) {
|
||||
|
||||
int is=-1, plot=0, color=-1;
|
||||
@ -657,33 +557,23 @@ void ctbAdcs::AdcEnable(Int_t b){
|
||||
|
||||
void ctbAdcs::ToggledAdcEnable(Int_t b){
|
||||
|
||||
|
||||
Int_t oreg=setEnable();//myDet->readRegister(67);
|
||||
Int_t oreg=setEnable();
|
||||
Int_t m=1<<b;
|
||||
|
||||
|
||||
if (sAdc[b]->getEnable())
|
||||
oreg|=m;
|
||||
else
|
||||
oreg&=~m;
|
||||
|
||||
// cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg << endl;
|
||||
|
||||
setEnable(oreg);//)writeRegister(67, oreg);
|
||||
//oreg=setEnable();//myDet->readRegister(67);
|
||||
|
||||
setEnable(oreg);
|
||||
|
||||
Emit("AdcEnable(Int_t)", oreg);
|
||||
//cout << "enable!" << endl;
|
||||
// Emit("ToggledAdcPlot(Int_t)", b);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ctbAdcs::ToggledAdcInvert(Int_t b){
|
||||
|
||||
// char val[1000];
|
||||
Int_t oreg=setInvert();//myDet->readRegister(67);
|
||||
Int_t oreg=setInvert();
|
||||
Int_t m=1<<b;
|
||||
|
||||
|
||||
@ -692,15 +582,7 @@ void ctbAdcs::ToggledAdcInvert(Int_t b){
|
||||
else
|
||||
oreg&=~m;
|
||||
|
||||
// cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg << endl;
|
||||
|
||||
setInvert(oreg);//)writeRegister(67, oreg);
|
||||
// oreg=setInvert();//myDet->readRegister(67);
|
||||
|
||||
// cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg << endl;
|
||||
|
||||
//sprintf(val,"%X",oreg);
|
||||
//eInversionMask->SetHexNumber(oreg);
|
||||
setInvert(oreg);
|
||||
}
|
||||
|
||||
|
||||
@ -710,22 +592,23 @@ void ctbAdcs::ToggledAdcInvert(Int_t b){
|
||||
Pixel_t ctbAdcs::getColor(int i){
|
||||
if (i>=0 && i<NADCS)
|
||||
return sAdc[i]->getColor();
|
||||
return static_cast<Pixel_t>(-1);
|
||||
}
|
||||
|
||||
Bool_t ctbAdcs::getEnabled(int i){
|
||||
if (i>=0 && i<NADCS)
|
||||
return sAdc[i]->getEnabled();
|
||||
|
||||
return static_cast<Bool_t>(-1);
|
||||
}
|
||||
|
||||
Bool_t ctbAdcs::getEnable(int i){
|
||||
if (i>=0 && i<NADCS)
|
||||
return sAdc[i]->getEnable();
|
||||
|
||||
return static_cast<Bool_t>(-1);
|
||||
}
|
||||
|
||||
Bool_t ctbAdcs::getPlot(int i){
|
||||
if (i>=0 && i<NADCS)
|
||||
return sAdc[i]->getPlot();
|
||||
|
||||
return static_cast<Bool_t>(-1);
|
||||
}
|
||||
|
@ -28,7 +28,10 @@ class TGTab;
|
||||
|
||||
class TGraph;
|
||||
|
||||
class multiSlsDetector;
|
||||
namespace sls
|
||||
{
|
||||
class Detector;
|
||||
};
|
||||
|
||||
#include <string>
|
||||
using namespace std;
|
||||
@ -49,10 +52,10 @@ class ctbAdc : public TGHorizontalFrame {
|
||||
// TGraph *gADC;
|
||||
|
||||
int id;
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *myDet;
|
||||
|
||||
public:
|
||||
ctbAdc(TGVerticalFrame *page, int i, multiSlsDetector *det);
|
||||
ctbAdc(TGVerticalFrame *page, int i, sls::Detector *det);
|
||||
|
||||
|
||||
void setAdcAlias(char *tit, int plot, int color);
|
||||
@ -89,7 +92,7 @@ class ctbAdcs : public TGGroupFrame {
|
||||
private:
|
||||
|
||||
ctbAdc *sAdc[NADCS];
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *myDet;
|
||||
|
||||
|
||||
TGTextButton *bCheckAll;
|
||||
@ -115,7 +118,7 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
ctbAdcs(TGVerticalFrame *page, multiSlsDetector *det);
|
||||
ctbAdcs(TGVerticalFrame *page, sls::Detector *det);
|
||||
int setAdcAlias(string line);
|
||||
string getAdcAlias();
|
||||
string getAdcParameters();
|
||||
|
@ -9,17 +9,14 @@
|
||||
#include <TGButton.h>
|
||||
|
||||
#include "ctbDacs.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "ctbDefs.h"
|
||||
#include "Detector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ctbDac::ctbDac(TGGroupFrame *page, int idac, multiSlsDetector *det) : TGHorizontalFrame(page, 800,50) , id(idac), myDet(det) {
|
||||
|
||||
ctbDac::ctbDac(TGGroupFrame *page, int idac, sls::Detector *det) : TGHorizontalFrame(page, 800,50) , id(idac), myDet(det) {
|
||||
|
||||
TGHorizontalFrame *hframe=this;
|
||||
|
||||
@ -104,12 +101,9 @@ int ctbDac::setLabel(char *tit, int mv) {
|
||||
}
|
||||
|
||||
string ctbDac::getLabel() {
|
||||
|
||||
ostringstream line;
|
||||
line << dacsLabel->GetText() << " " << dacsUnit->IsOn() << endl;
|
||||
|
||||
// line << "DAC" << dec << id << " " << dacsUnit->IsOn() << endl;
|
||||
|
||||
return line.str();
|
||||
|
||||
}
|
||||
@ -119,65 +113,45 @@ void ctbDac::setValue(Long_t a) {setValue();}
|
||||
|
||||
void ctbDac::setValue() {
|
||||
|
||||
|
||||
|
||||
cout << "setting dac! "<< id << " value " << dacsEntry->GetIntNumber() << " units " << dacsUnit->IsOn() << endl;
|
||||
|
||||
try {
|
||||
myDet->setDAC(dacsEntry->GetIntNumber(), (slsDetectorDefs::dacIndex)id, dacsUnit->IsOn()); } catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
myDet->setDAC(static_cast<slsDetectorDefs::dacIndex>(id), dacsEntry->GetIntNumber(), dacsUnit->IsOn());
|
||||
} CATCH_DISPLAY ("Could not set dac " + to_string(id) + ".", "ctbDac::setValue")
|
||||
|
||||
getValue();
|
||||
|
||||
}
|
||||
|
||||
void ctbDac::setOn(Bool_t b) {
|
||||
|
||||
|
||||
|
||||
// cout << "setting dac! "<< id << endl;
|
||||
|
||||
if ( dacsLabel->IsOn()) {
|
||||
setValue();
|
||||
} else {
|
||||
try {
|
||||
myDet->setDAC(-100, (slsDetectorDefs::dacIndex)id, 0);
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
myDet->setDAC(static_cast<slsDetectorDefs::dacIndex>(id), -100, false);
|
||||
} CATCH_DISPLAY ("Could not power off dac " + to_string(id) + ".", "ctbDac::setOn")
|
||||
}
|
||||
getValue();
|
||||
|
||||
}
|
||||
|
||||
int ctbDac::getValue() {
|
||||
int val;
|
||||
try {
|
||||
val=myDet->setDAC(-1,(slsDetectorDefs::dacIndex)id, dacsUnit->IsOn());
|
||||
} catch (...) {
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
char s[100];
|
||||
int val = myDet->getDAC(static_cast<slsDetectorDefs::dacIndex>(id), dacsUnit->IsOn()).tsquash("Different values");
|
||||
cout << "dac " << id << " " << val << endl;
|
||||
sprintf(s,"%d",val);
|
||||
dacsValue->SetText(s);
|
||||
if (val>=0) {
|
||||
dacsValue->SetText(to_string(val).c_str());
|
||||
if (val >= 0) {
|
||||
dacsLabel->SetOn(kTRUE);
|
||||
} else {
|
||||
dacsLabel->SetOn(kFALSE);
|
||||
}
|
||||
|
||||
|
||||
return val;
|
||||
} CATCH_DISPLAY ("Could not get dac " + to_string(id) + ".", "ctbDac::getValue")
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ctbDacs::ctbDacs(TGVerticalFrame *page, multiSlsDetector *det) : TGGroupFrame(page,"DACs",kVerticalFrame) , myDet(det){
|
||||
|
||||
ctbDacs::ctbDacs(TGVerticalFrame *page, sls::Detector *det) : TGGroupFrame(page,"DACs",kVerticalFrame) , myDet(det){
|
||||
|
||||
SetTitlePos(TGGroupFrame::kLeft);
|
||||
page->AddFrame(this,new TGLayoutHints( kLHintsTop | kLHintsExpandX , 10,10,10,10));
|
||||
@ -192,14 +166,12 @@ ctbDacs::ctbDacs(TGVerticalFrame *page, multiSlsDetector *det) : TGGroupFrame(
|
||||
}
|
||||
dacs[NDACS]=new ctbDac(this, slsDetectorDefs::ADC_VPP, myDet);
|
||||
dacs[NDACS+1]=new ctbDac(this, slsDetectorDefs::HIGH_VOLTAGE, myDet);
|
||||
dacs[NDACS]->setLabel("ADC Vpp",2);
|
||||
dacs[NDACS+1]->setLabel("High Voltage",3);
|
||||
|
||||
dacs[NDACS]->setLabel((char*)"ADC Vpp",2);
|
||||
dacs[NDACS+1]->setLabel((char*)"High Voltage",3);
|
||||
}
|
||||
|
||||
|
||||
int ctbDacs::setDacAlias(string line) {
|
||||
|
||||
int is=-1, mv=0;
|
||||
char tit[100];
|
||||
int narg=sscanf(line.c_str(),"DAC%d %s %d",&is,tit,&mv);
|
||||
@ -217,7 +189,6 @@ string ctbDacs::getDacAlias() {
|
||||
for (int i=0; i<NDACS; i++)
|
||||
line << dacs[i]->getLabel() << endl;
|
||||
return line.str();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -225,8 +196,6 @@ string ctbDacs::getDacAlias() {
|
||||
|
||||
|
||||
string ctbDacs::getDacParameters() {
|
||||
|
||||
|
||||
ostringstream line;
|
||||
|
||||
for (int i=0; i<NDACS; i++) {
|
||||
@ -234,18 +203,12 @@ string ctbDacs::getDacParameters() {
|
||||
line << "dac:" << i << " " << dacs[i]->getValue() << endl;
|
||||
}
|
||||
return line.str();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ctbDacs::update() {
|
||||
|
||||
for (int idac=0; idac<NDACS+1; idac++) {
|
||||
dacs[idac]->getValue();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -15,7 +15,10 @@ class TGNumberEntry;
|
||||
class TGCheckButton;
|
||||
|
||||
|
||||
class multiSlsDetector;
|
||||
namespace sls
|
||||
{
|
||||
class Detector;
|
||||
};
|
||||
|
||||
#include <string>
|
||||
using namespace std;
|
||||
@ -32,9 +35,9 @@ class ctbDac : public TGHorizontalFrame {
|
||||
TGLabel *dacsValue;
|
||||
int id;
|
||||
|
||||
multiSlsDetector* myDet;
|
||||
sls::Detector* myDet;
|
||||
public:
|
||||
ctbDac(TGGroupFrame*, int , multiSlsDetector*);
|
||||
ctbDac(TGGroupFrame*, int , sls::Detector*);
|
||||
void setValue();
|
||||
void setValue(Long_t);
|
||||
int getValue();
|
||||
@ -55,10 +58,10 @@ private:
|
||||
|
||||
ctbDac *dacs[NDACS+2];
|
||||
|
||||
multiSlsDetector* myDet;
|
||||
sls::Detector* myDet;
|
||||
|
||||
public:
|
||||
ctbDacs(TGVerticalFrame *page, multiSlsDetector*);
|
||||
ctbDacs(TGVerticalFrame *page, sls::Detector*);
|
||||
|
||||
int setDacAlias(string line);
|
||||
// int setDacAlias(string line);
|
||||
|
84
ctbGui/ctbDefs.h
Executable file
84
ctbGui/ctbDefs.h
Executable file
@ -0,0 +1,84 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
#include <chrono>
|
||||
|
||||
//#include "sls_detector_exceptions.h"
|
||||
//#include "ansi.h"
|
||||
#define RED "\x1b[31m"
|
||||
#define RESET "\x1b[0m"
|
||||
#define BOLD "\x1b[1m"
|
||||
#define cprintf(code, format, ...) printf(code format RESET, ##__VA_ARGS__)
|
||||
|
||||
|
||||
#define CATCH_DISPLAY(m, s) catch(...) { ctbDefs::DisplayExceptions(m, s); }
|
||||
#define CATCH_HANDLE(...) catch(...) { ctbDefs::HandleExceptions(__VA_ARGS__); }
|
||||
|
||||
class ctbDefs {
|
||||
public:
|
||||
/**
|
||||
* Empty Constructor
|
||||
*/
|
||||
ctbDefs(){};
|
||||
|
||||
// convert double seconds to chrono ns
|
||||
static std::chrono::nanoseconds ConvertDoubleStoChronoNS(double timeS) {
|
||||
using std::chrono::duration;
|
||||
using std::chrono::duration_cast;
|
||||
using std::chrono::nanoseconds;
|
||||
return duration_cast<nanoseconds>(duration<double>(timeS));
|
||||
}
|
||||
|
||||
// convert chrono ns to doubel s
|
||||
static double ConvertChronoNStoDoubleS(std::chrono::nanoseconds timeNs) {
|
||||
using std::chrono::duration;
|
||||
using std::chrono::duration_cast;
|
||||
return duration_cast<duration<double>>(timeNs).count();
|
||||
}
|
||||
|
||||
static void DisplayExceptions(std::string emsg, std::string src) {
|
||||
try {
|
||||
throw;
|
||||
} /* catch (const sls::SocketError &e) {
|
||||
throw;
|
||||
} catch (const sls::SharedMemoryError &e) {
|
||||
throw;
|
||||
} */catch (const std::exception &e) {
|
||||
ExceptionMessage(emsg, e.what(), src);
|
||||
}
|
||||
};
|
||||
|
||||
template <class CT> struct NonDeduced { using type = CT; };
|
||||
template <class S, typename RT, typename... CT>
|
||||
static void HandleExceptions(const std::string emsg, const std::string src, S* s,
|
||||
RT (S::*somefunc)(CT...),
|
||||
typename NonDeduced<CT>::type... Args) {
|
||||
try {
|
||||
throw;
|
||||
} /*catch (const sls::SocketError &e) {
|
||||
throw;
|
||||
} catch (const sls::SharedMemoryError &e) {
|
||||
throw;
|
||||
} */catch (const std::exception &e) {
|
||||
|
||||
ExceptionMessage(emsg, e.what(), src);
|
||||
(s->*somefunc)(Args...);
|
||||
}
|
||||
};
|
||||
|
||||
static void ExceptionMessage(std::string message,
|
||||
std::string exceptionMessage,
|
||||
std::string source) {
|
||||
// because sls_detector_exceptions cannot be included
|
||||
if (exceptionMessage.find("hared memory")) {
|
||||
throw;
|
||||
}
|
||||
if (exceptionMessage.find("annot connect")) {
|
||||
throw;
|
||||
}
|
||||
cprintf(RED, "Warning (%s): %s [Caught Exception: %s]\n", source.c_str(), message.c_str(), exceptionMessage.c_str());
|
||||
//return Message(qDefs::WARNING, message + std::string("\nCaught exception:\n") + exceptionMessage, source);
|
||||
};
|
||||
|
||||
};
|
@ -9,11 +9,11 @@
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
|
||||
#include "multiSlsDetector.h"
|
||||
#include "Detector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
//#include "sls_receiver_defs.h"
|
||||
#include "ctbMain.h"
|
||||
#include "ctbDefs.h"
|
||||
using namespace std;
|
||||
|
||||
|
||||
@ -61,31 +61,27 @@ int main(int argc, char **argv) {
|
||||
|
||||
|
||||
cout << " *** " << endl;
|
||||
|
||||
sls::Detector *myDet = nullptr;
|
||||
try {
|
||||
/****** Create detector ****************/
|
||||
multiSlsDetector *myDet=new multiSlsDetector(id);
|
||||
// myDet->setOnline(slsDetectorDefs::ONLINE_FLAG);
|
||||
myDet=new sls::Detector(id);
|
||||
cout << "Created multi detector id " << id << endl;
|
||||
|
||||
//cout << id << " " << myDet << " " << myDet->setOnline() << endl;
|
||||
if (cf) {
|
||||
myDet->readConfigurationFile(cfname);
|
||||
} else
|
||||
myDet->loadConfig(cfname);
|
||||
cout << "Config file loaded successfully" << endl;
|
||||
} else {
|
||||
cout << "No config file specified" << endl;
|
||||
}
|
||||
cout << "hostname " << myDet->getHostname() << endl;
|
||||
|
||||
cout << "aa" << endl;
|
||||
|
||||
cout << "Created multi detector id " << id << " hostname " << myDet->getHostname() << endl;
|
||||
|
||||
|
||||
cout << "bb" << endl;
|
||||
if (pf) {
|
||||
myDet->retrieveDetectorSetup(pfname);
|
||||
} else
|
||||
myDet->loadParameters(pfname);
|
||||
cout << "Loaded parameter file successfully" << endl;
|
||||
} else{
|
||||
cout << "No parameter file specified" << endl;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not create detector/ load config/parameters.", "ctbGui::main")
|
||||
|
||||
/***********Create GUI stuff *******************/
|
||||
TApplication theApp("App",&argc,argv);
|
||||
@ -141,7 +137,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
|
||||
gROOT->ForceStyle();
|
||||
ctbMain *mf=new ctbMain(gClient->GetRoot(),myDet);
|
||||
ctbMain *mf=new ctbMain(gClient->GetRoot(), myDet);
|
||||
|
||||
cout << " *** " << argc << endl;
|
||||
for (int ia=0; ia<argc; ia++)
|
||||
|
@ -29,15 +29,13 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
#include "multiSlsDetector.h"
|
||||
#include "Detector.h"
|
||||
#include "ctbDefs.h"
|
||||
#include "ctbMain.h"
|
||||
#include "ctbDacs.h"
|
||||
#include "ctbSlowAdcs.h"
|
||||
@ -52,7 +50,7 @@ using namespace std;
|
||||
|
||||
|
||||
|
||||
ctbMain::ctbMain(const TGWindow *p, multiSlsDetector *det)
|
||||
ctbMain::ctbMain(const TGWindow *p, sls::Detector *det)
|
||||
: TGMainFrame(p,800,800), pwrs(NULL), senses(NULL) {
|
||||
|
||||
myDet=det;
|
||||
@ -304,7 +302,7 @@ void ctbMain::HandleMenu(Int_t id)
|
||||
fi.fIniDir = StrDup(dir);
|
||||
printf("fIniDir = %s\n", fi.fIniDir);
|
||||
new TGFileDialog(gClient->GetRoot(), this, kFDOpen, &fi);
|
||||
printf("Open file: %s (dir: %s)\n", fi.fFilename);
|
||||
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
|
||||
// dir = fi.fIniDir;
|
||||
if (fi.fFilename)
|
||||
loadAlias(fi.fFilename);
|
||||
@ -320,13 +318,12 @@ void ctbMain::HandleMenu(Int_t id)
|
||||
fi.fIniDir = StrDup(dir);
|
||||
printf("fIniDir = %s\n", fi.fIniDir);
|
||||
new TGFileDialog(gClient->GetRoot(), this, kFDSave, &fi);
|
||||
printf("Save file: %s (dir: %s)\n", fi.fFilename);
|
||||
printf("Save file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
|
||||
// dir = fi.fIniDir;
|
||||
if (fi.fFilename)
|
||||
saveAlias(fi.fFilename);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: //fMenuFile->AddEntry("Open Parameters", im++);
|
||||
cout << "Open Parameters" << endl;
|
||||
{
|
||||
@ -343,23 +340,7 @@ void ctbMain::HandleMenu(Int_t id)
|
||||
}
|
||||
break;
|
||||
|
||||
case 3: //fMenuFile->AddEntry("Save Parameters", im++);
|
||||
cout << "Save Parameters" << endl;
|
||||
{
|
||||
static TString dir(".");
|
||||
TGFileInfo fi;
|
||||
//fi.fFileTypes = filetypes;
|
||||
fi.fIniDir = StrDup(dir);
|
||||
printf("fIniDir = %s\n", fi.fIniDir);
|
||||
new TGFileDialog(gClient->GetRoot(), this, kFDSave, &fi);
|
||||
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
|
||||
// dir = fi.fIniDir;
|
||||
if (fi.fFilename)
|
||||
saveParameters(fi.fFilename);
|
||||
}
|
||||
break;
|
||||
|
||||
case 4: // fMenuFile->AddEntry("Open Configuration", im++);
|
||||
case 3: // fMenuFile->AddEntry("Open Configuration", im++);
|
||||
cout << "Open configuration" << endl;
|
||||
{
|
||||
static TString dir(".");
|
||||
@ -375,23 +356,7 @@ void ctbMain::HandleMenu(Int_t id)
|
||||
}
|
||||
break;
|
||||
|
||||
case 5: // fMenuFile->AddEntry("Save Configuration", im++);
|
||||
cout << "Save configuration" << endl;
|
||||
{
|
||||
static TString dir(".");
|
||||
TGFileInfo fi;
|
||||
//fi.fFileTypes = filetypes;
|
||||
fi.fIniDir = StrDup(dir);
|
||||
printf("fIniDir = %s\n", fi.fIniDir);
|
||||
new TGFileDialog(gClient->GetRoot(), this, kFDSave, &fi);
|
||||
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
|
||||
// dir = fi.fIniDir;
|
||||
if (fi.fFilename)
|
||||
saveConfiguration(fi.fFilename);
|
||||
}
|
||||
break;
|
||||
|
||||
case 6: //fMenuFile->AddEntry("Open Pattern", im++);
|
||||
case 4: //fMenuFile->AddEntry("Open Pattern", im++);
|
||||
cout << "Open pattern" << endl;
|
||||
{
|
||||
static TString dir(".");
|
||||
@ -407,7 +372,7 @@ void ctbMain::HandleMenu(Int_t id)
|
||||
}
|
||||
break;
|
||||
|
||||
case 7: //fMenuFile->AddEntry("Save Pattern", im++);
|
||||
case 5: //fMenuFile->AddEntry("Save Pattern", im++);
|
||||
cout << "Save pattern" << endl;
|
||||
{
|
||||
static TString dir(".");
|
||||
@ -419,11 +384,11 @@ void ctbMain::HandleMenu(Int_t id)
|
||||
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
|
||||
// dir = fi.fIniDir;
|
||||
if (fi.fFilename)
|
||||
saveParameters(fi.fFilename);
|
||||
savePattern(fi.fFilename);
|
||||
}
|
||||
break;
|
||||
|
||||
case 8: // fMenuFile->AddEntry("Exit", im++);
|
||||
case 6: // fMenuFile->AddEntry("Exit", im++);
|
||||
CloseWindow();
|
||||
|
||||
default:
|
||||
@ -439,7 +404,7 @@ int ctbMain::setADCPlot(Int_t i) {
|
||||
// cout << "ADC " << i << " plot or color toggled" << endl;
|
||||
// acq->setGraph(i,adcs->getGraph(i));
|
||||
acq->setGraph(i,adcs->getEnabled(i),adcs->getColor(i));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -448,120 +413,31 @@ int ctbMain::setSignalPlot(Int_t i) {
|
||||
// cout << "ADC " << i << " plot or color toggled" << endl;
|
||||
// acq->setGraph(i,adcs->getGraph(i));
|
||||
acq->setBitGraph(i,sig->getPlot(i),sig->getColor(i));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int ctbMain::loadConfiguration(string fname) {
|
||||
|
||||
myDet->readConfigurationFile(fname);
|
||||
|
||||
// string line;
|
||||
// int i;
|
||||
// ifstream myfile (fname.c_str());
|
||||
// if (myfile.is_open())
|
||||
// {
|
||||
// while ( getline (myfile,line) )
|
||||
// {
|
||||
|
||||
|
||||
|
||||
// }
|
||||
// myfile.close();
|
||||
// }
|
||||
|
||||
// else cout << "Unable to open file";
|
||||
|
||||
return 0;
|
||||
|
||||
void ctbMain::loadConfiguration(string fname) {
|
||||
try{
|
||||
myDet->loadConfig(fname);
|
||||
} CATCH_DISPLAY ("Could not load config.", "ctbMain::loadConfiguration")
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int ctbMain::saveConfiguration(string fname) {
|
||||
|
||||
|
||||
myDet->writeConfigurationFile(fname);
|
||||
// string line;
|
||||
// int i;
|
||||
// ofstream myfile (fname.c_str());
|
||||
// if (myfile.is_open())
|
||||
// {
|
||||
|
||||
|
||||
// myfile.close();
|
||||
// }
|
||||
|
||||
// else cout << "Unable to open file";
|
||||
|
||||
return 0;
|
||||
|
||||
void ctbMain::loadParameters(string fname) {
|
||||
try{
|
||||
myDet->loadParameters(fname);
|
||||
} CATCH_DISPLAY ("Could not load parameters.", "ctbMain::loadParameters")
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int ctbMain::loadParameters(string fname) {
|
||||
|
||||
myDet->retrieveDetectorSetup(fname);
|
||||
|
||||
// string line;
|
||||
// int i;
|
||||
// ifstream myfile (fname.c_str());
|
||||
// if (myfile.is_open())
|
||||
// {
|
||||
// while ( getline (myfile,line) )
|
||||
// {
|
||||
|
||||
|
||||
|
||||
// }
|
||||
// myfile.close();
|
||||
// }
|
||||
|
||||
// else cout << "Unable to open file";
|
||||
|
||||
return 0;
|
||||
|
||||
void ctbMain::savePattern(string fname) {
|
||||
try{
|
||||
myDet->savePattern(fname);
|
||||
} CATCH_DISPLAY ("Could not save pattern.", "ctbMain::savePattern")
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int ctbMain::saveParameters(string fname) {
|
||||
|
||||
|
||||
string line;
|
||||
int i;
|
||||
myDet->dumpDetectorSetup(fname);
|
||||
// ofstream myfile (fname.c_str());
|
||||
// if (myfile.is_open())
|
||||
// {
|
||||
|
||||
// myfile << dacs->getDacParameters();
|
||||
// myfile << sig->getSignalParameters();
|
||||
// myfile << adcs->getAdcParameters();
|
||||
|
||||
// myfile.close();
|
||||
// }
|
||||
|
||||
// else cout << "Unable to open file";
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int ctbMain::loadAlias(string fname) {
|
||||
|
||||
|
||||
@ -589,7 +465,7 @@ int ctbMain::loadAlias(string fname) {
|
||||
else if (sscanf(line.c_str(),"PAT%s",aaaa)>0) {
|
||||
pat->setPatternAlias(line);
|
||||
// cout << "---------" << line<< endl;
|
||||
} else if (sscanf(line.c_str(),"V%s",&i)>0) {
|
||||
} else if (sscanf(line.c_str(),"V%s",aaaa)>0) {
|
||||
if (pwrs) pwrs->setPwrAlias(line);
|
||||
// cout << "+++++++++" << line<< endl;
|
||||
} else if (sscanf(line.c_str(),"SENSE%d",&i)>0) {
|
||||
@ -615,7 +491,6 @@ int ctbMain::saveAlias(string fname) {
|
||||
|
||||
|
||||
string line;
|
||||
int i;
|
||||
ofstream myfile (fname.c_str());
|
||||
if (myfile.is_open())
|
||||
{
|
||||
|
@ -33,7 +33,10 @@ class ctbPowers;
|
||||
|
||||
class ctbSignals;
|
||||
|
||||
class multiSlsDetector;
|
||||
namespace sls
|
||||
{
|
||||
class Detector;
|
||||
};
|
||||
|
||||
class ctbPattern;
|
||||
class ctbAdcs;
|
||||
@ -47,7 +50,7 @@ class ctbMain : public TGMainFrame {
|
||||
private:
|
||||
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *myDet;
|
||||
|
||||
|
||||
|
||||
@ -96,15 +99,14 @@ private:
|
||||
|
||||
|
||||
public:
|
||||
ctbMain(const TGWindow *p, multiSlsDetector *det);
|
||||
ctbMain(const TGWindow *p, sls::Detector *det);
|
||||
|
||||
|
||||
int loadAlias(string fname);
|
||||
int saveAlias(string fname);
|
||||
int loadParameters(string fname);
|
||||
int saveParameters(string fname);
|
||||
int loadConfiguration(string fname);
|
||||
int saveConfiguration(string fname);
|
||||
void loadParameters(string fname);
|
||||
void savePattern(string fname);
|
||||
void loadConfiguration(string fname);
|
||||
void tabSelected(Int_t);
|
||||
int setADCPlot(Int_t);
|
||||
int setSignalPlot(Int_t);
|
||||
|
@ -24,15 +24,16 @@
|
||||
#include <fstream>
|
||||
|
||||
#include "ctbPattern.h"
|
||||
#include "multiSlsDetector.h"
|
||||
|
||||
#include "ctbDefs.h"
|
||||
#include "Detector.h"
|
||||
#include <chrono>
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ctbLoop::ctbLoop(TGGroupFrame *page, int i, multiSlsDetector *det) : TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
|
||||
ctbLoop::ctbLoop(TGGroupFrame *page, int i, sls::Detector *det) : TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
|
||||
|
||||
TGHorizontalFrame *hframe=this;
|
||||
|
||||
@ -116,47 +117,29 @@ ctbLoop::ctbLoop(TGGroupFrame *page, int i, multiSlsDetector *det) : TGHorizonta
|
||||
}
|
||||
|
||||
void ctbLoop::setNLoops() {
|
||||
|
||||
int start, stop, n;
|
||||
|
||||
|
||||
start=-1;
|
||||
stop=-1;
|
||||
n=eLoopNumber->GetNumber();
|
||||
try{
|
||||
myDet->setPatternLoops(id,start, stop,n);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
|
||||
myDet->setPatternLoopCycles(id, eLoopNumber->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set number of pattern loops for level " + to_string(id) + ".", "ctbLoop::setNLoops")
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ctbLoop::update() {
|
||||
try{
|
||||
|
||||
int start, stop, n;
|
||||
|
||||
std::array<int, 3> loop;
|
||||
|
||||
try {
|
||||
loop=myDet->getPatternLoops(id);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
auto loop = myDet->getPatternLoopCycles(id).tsquash("Different values");
|
||||
eLoopNumber->SetNumber(loop);
|
||||
auto loopaddr = myDet->getPatternLoopAddresses(id).tsquash("Different values");
|
||||
eLoopStartAddr->SetHexNumber(loopaddr[0]);
|
||||
eLoopStopAddr->SetHexNumber(loopaddr[1]);
|
||||
|
||||
|
||||
eLoopStartAddr->SetHexNumber(loop[0]);
|
||||
eLoopStopAddr->SetHexNumber(loop[1]);
|
||||
eLoopNumber->SetNumber(loop[2]);
|
||||
} CATCH_DISPLAY ("Could not get pattern loops for level " + to_string(id) + ".", "ctbLoop::update")
|
||||
}
|
||||
|
||||
|
||||
|
||||
ctbWait::ctbWait(TGGroupFrame *page, int i, multiSlsDetector *det) : TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
|
||||
ctbWait::ctbWait(TGGroupFrame *page, int i, sls::Detector *det) : TGHorizontalFrame(page, 800,800), id(i), myDet(det) {
|
||||
|
||||
char tit[100];
|
||||
TGHorizontalFrame *hframe=this;
|
||||
@ -211,41 +194,25 @@ ctbWait::ctbWait(TGGroupFrame *page, int i, multiSlsDetector *det) : TGHorizonta
|
||||
|
||||
|
||||
void ctbWait::setWaitTime() {
|
||||
|
||||
|
||||
Long64_t t=eWaitTime->GetNumber();
|
||||
try{
|
||||
t=myDet->setPatternWaitTime(id,t);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
myDet->setPatternWaitTime(id, eWaitTime->GetNumber());
|
||||
|
||||
} CATCH_DISPLAY ("Could not set pattern wait time for level " + to_string(id) + ".", "ctbWait::setWaitTime")
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ctbWait::update() {
|
||||
|
||||
int start, stop, n, addr;
|
||||
|
||||
Long64_t t=-1;
|
||||
try{
|
||||
|
||||
t=myDet->setPatternWaitTime(id,t);
|
||||
} catch (...) {
|
||||
auto time = myDet->getPatternWaitTime(id).tsquash("Different values");
|
||||
auto addr = myDet->getPatternWaitAddr(id).tsquash("Different values");
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
try{
|
||||
addr=myDet->setPatternWaitAddr(id,-1);
|
||||
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
eWaitAddr->SetHexNumber(addr);
|
||||
eWaitTime->SetNumber(t);
|
||||
eWaitTime->SetNumber(time);
|
||||
|
||||
} CATCH_DISPLAY ("Could not get pattern loops for level " + to_string(id) + ".", "ctbWait::update")
|
||||
}
|
||||
|
||||
|
||||
@ -256,7 +223,7 @@ void ctbWait::update() {
|
||||
|
||||
|
||||
|
||||
ctbPattern::ctbPattern(TGVerticalFrame *page, multiSlsDetector *det)
|
||||
ctbPattern::ctbPattern(TGVerticalFrame *page, sls::Detector *det)
|
||||
: TGGroupFrame(page,"Pattern",kVerticalFrame), myDet(det) {
|
||||
|
||||
|
||||
@ -490,7 +457,7 @@ ctbPattern::ctbPattern(TGVerticalFrame *page, multiSlsDetector *det)
|
||||
hframe->MapWindow();
|
||||
|
||||
|
||||
sprintf(tit, "Number of cycles: ");
|
||||
sprintf(tit, "Number of triggers: ");
|
||||
|
||||
label= new TGLabel(hframe, tit);
|
||||
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
|
||||
@ -500,14 +467,14 @@ ctbPattern::ctbPattern(TGVerticalFrame *page, multiSlsDetector *det)
|
||||
|
||||
|
||||
|
||||
eCycles = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
|
||||
eTriggers = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
|
||||
TGNumberFormat::kNEANonNegative,
|
||||
TGNumberFormat::kNELNoLimits);
|
||||
hframe->AddFrame( eCycles,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
|
||||
eCycles->MapWindow();
|
||||
eCycles->Resize(150,30);
|
||||
e= eCycles->TGNumberEntry::GetNumberEntry();
|
||||
e->Connect("ReturnPressed()","ctbPattern",this,"setCycles()");
|
||||
hframe->AddFrame( eTriggers,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
|
||||
eTriggers->MapWindow();
|
||||
eTriggers->Resize(150,30);
|
||||
e= eTriggers->TGNumberEntry::GetNumberEntry();
|
||||
e->Connect("ReturnPressed()","ctbPattern",this,"setTriggers()");
|
||||
|
||||
|
||||
// sprintf(tit, "Number of measurements: ");
|
||||
@ -809,134 +776,64 @@ ctbPattern::ctbPattern(TGVerticalFrame *page, multiSlsDetector *det)
|
||||
}
|
||||
|
||||
void ctbPattern::update() {
|
||||
try{
|
||||
auto retval = myDet->getRUNClock().tsquash("Different values");
|
||||
eRunClkFreq->SetNumber(retval);
|
||||
} CATCH_DISPLAY ("Could not get run clock.", "ctbPattern::update")
|
||||
|
||||
int start, stop, n, addr;
|
||||
try{
|
||||
auto retval = myDet->getADCClock().tsquash("Different values");
|
||||
eAdcClkFreq->SetNumber(retval);
|
||||
} CATCH_DISPLAY ("Could not get adc clock.", "ctbPattern::update")
|
||||
|
||||
Long_t t;
|
||||
try{
|
||||
auto retval = myDet->getADCPhase().tsquash("Different values");
|
||||
eAdcClkPhase->SetNumber(retval);
|
||||
} CATCH_DISPLAY ("Could not get adc phase shift.", "ctbPattern::update")
|
||||
|
||||
try{
|
||||
auto retval = myDet->getADCPipeline().tsquash("Different values");
|
||||
eAdcPipeline->SetNumber(retval);
|
||||
} CATCH_DISPLAY ("Could not get adc pipeline.", "ctbPattern::update")
|
||||
|
||||
try {
|
||||
n=myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER,-1,0);
|
||||
} catch (...) {
|
||||
try{
|
||||
auto retval = myDet->getDBITClock().tsquash("Different values");
|
||||
eDBitClkFreq->SetNumber(retval);
|
||||
} CATCH_DISPLAY ("Could not get dbit clock.", "ctbPattern::update")
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
try{
|
||||
auto retval = myDet->getDBITPhase().tsquash("Different values");
|
||||
eDBitClkPhase->SetNumber(retval);
|
||||
} CATCH_DISPLAY ("Could not get dbit phase shift.", "ctbPattern::update")
|
||||
|
||||
eRunClkFreq->SetNumber(n);
|
||||
try{
|
||||
auto retval = myDet->getDBITPipeline().tsquash("Different values");
|
||||
eDBitPipeline->SetNumber(retval);
|
||||
} CATCH_DISPLAY ("Could not get dbit pipeline.", "ctbPattern::update")
|
||||
|
||||
try {
|
||||
n=myDet->setSpeed(slsDetectorDefs::ADC_CLOCK,-1,0);
|
||||
} catch (...) {
|
||||
try{
|
||||
auto retval = myDet->getNumberOfFrames().tsquash("Different values");
|
||||
eFrames->SetNumber(retval);
|
||||
} CATCH_DISPLAY ("Could not get number of frames.", "ctbPattern::update")
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
try{
|
||||
auto timeNs = myDet->getPeriod().tsquash("Different values");
|
||||
ePeriod->SetNumber(ctbDefs::ConvertChronoNStoDoubleS(timeNs));
|
||||
} CATCH_DISPLAY ("Could not get period.", "ctbPattern::update")
|
||||
|
||||
eAdcClkFreq->SetNumber(n);
|
||||
try{
|
||||
auto retval = myDet->getNumberOfTriggers().tsquash("Different values");
|
||||
eTriggers->SetNumber(retval);
|
||||
} CATCH_DISPLAY ("Could not get number of triggers.", "ctbPattern::update")
|
||||
|
||||
try {
|
||||
n=myDet->setSpeed(slsDetectorDefs::ADC_PHASE,-1,0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
eAdcClkPhase->SetNumber(n);
|
||||
|
||||
try {
|
||||
n=myDet->setSpeed(slsDetectorDefs::ADC_PIPELINE,-1,0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
|
||||
eAdcPipeline->SetNumber(n);
|
||||
|
||||
try {
|
||||
n=myDet->setSpeed(slsDetectorDefs::DBIT_CLOCK,-1,0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
|
||||
eDBitClkFreq->SetNumber(n);
|
||||
|
||||
try {
|
||||
n=myDet->setSpeed(slsDetectorDefs::DBIT_PHASE,-1,0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
|
||||
eDBitClkPhase->SetNumber(n);
|
||||
try {
|
||||
myDet->setSpeed(slsDetectorDefs::DBIT_PIPELINE,0,-1);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
eDBitPipeline->SetNumber(n);
|
||||
|
||||
try {
|
||||
n=myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
eFrames->SetNumber(n);
|
||||
|
||||
|
||||
try {
|
||||
n=myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ePeriod->SetNumber(((Double_t)n)*1E-9);
|
||||
|
||||
try {
|
||||
n=myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
eCycles->SetNumber(n);
|
||||
|
||||
|
||||
// try {
|
||||
// myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1);
|
||||
// } catch (...) {
|
||||
|
||||
// cout << "Do nothing for this error" << endl;
|
||||
// }
|
||||
|
||||
// eMeasurements->SetNumber(n);
|
||||
|
||||
start=-1;
|
||||
stop=-1;
|
||||
n=-1;
|
||||
std::array<int, 3> loop;
|
||||
|
||||
try {
|
||||
loop=myDet->getPatternLoops(-1);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
eStartAddr->SetHexNumber(loop[0]);
|
||||
eStopAddr->SetHexNumber(loop[1]);
|
||||
try{
|
||||
auto retval = myDet->getPatternLoopAddresses(-1).tsquash("Different values");
|
||||
eStartAddr->SetHexNumber(retval[0]);
|
||||
eStopAddr->SetHexNumber(retval[1]);
|
||||
} CATCH_DISPLAY ("Could not get dbit phase shift.", "ctbPattern::update")
|
||||
|
||||
for (int iloop=0; iloop<NLOOPS; iloop++) {
|
||||
eLoop[iloop]->update();
|
||||
|
||||
}
|
||||
|
||||
for (int iwait=0; iwait<NWAITS; iwait++) {
|
||||
@ -946,8 +843,9 @@ try {
|
||||
getAnalogSamples();
|
||||
getDigitalSamples();
|
||||
getReadoutMode();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ctbPattern::setFile() {
|
||||
patternFileChanged(patternFile->GetText());
|
||||
|
||||
@ -984,7 +882,8 @@ void ctbPattern::setPatternAlias(string line){
|
||||
|
||||
string ctbPattern::getPatternAlias() {
|
||||
char line[100000];
|
||||
sprintf("PATCOMPILER %s\nPATFILE %s\n",patternCompiler->GetText(),patternFile->GetText());
|
||||
sprintf(line, "PATCOMPILER %s\nPATFILE %s\n",patternCompiler->GetText(),patternFile->GetText());
|
||||
return line;
|
||||
}
|
||||
|
||||
|
||||
@ -1032,154 +931,103 @@ string ctbPattern::getPatternFile() {
|
||||
}
|
||||
|
||||
void ctbPattern::setFrames() {
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,eFrames->GetNumber());
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
try{
|
||||
myDet->setNumberOfFrames(eFrames->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set number of frames", "ctbPattern::setFrames")
|
||||
}
|
||||
|
||||
void ctbPattern::setCycles() {
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,eFrames->GetNumber());
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
void ctbPattern::setTriggers() {
|
||||
try{
|
||||
myDet->setNumberOfTriggers(eTriggers->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set number of triggers", "ctbPattern::setTriggers")
|
||||
}
|
||||
|
||||
// void ctbPattern::setMeasurements() {
|
||||
// try {
|
||||
// myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,eFrames->GetNumber());
|
||||
// } catch (...) {
|
||||
|
||||
// cout << "Do nothing for this error" << endl;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
void ctbPattern::setPeriod() {
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,ePeriod->GetNumber()*1E9);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
using std::chrono::duration;
|
||||
using std::chrono::duration_cast;
|
||||
using std::chrono::nanoseconds;
|
||||
try{
|
||||
auto timeNs = ctbDefs::ConvertDoubleStoChronoNS(ePeriod->GetNumber());
|
||||
myDet->setPeriod(timeNs);
|
||||
} CATCH_DISPLAY ("Could not set period", "ctbPattern::setPeriod")
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ctbPattern::setAdcFreq() {
|
||||
try {
|
||||
myDet->setSpeed(slsDetectorDefs::ADC_CLOCK,eAdcClkFreq->GetNumber(),0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
try{
|
||||
myDet->setADCClock(eAdcClkFreq->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set adc clock", "ctbPattern::setAdcFreq")
|
||||
}
|
||||
|
||||
void ctbPattern::setRunFreq() {
|
||||
try{
|
||||
myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER,eRunClkFreq->GetNumber(),0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
myDet->setRUNClock(eRunClkFreq->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set run clock", "ctbPattern::setRunFreq")
|
||||
}
|
||||
|
||||
void ctbPattern::setDBitFreq() {
|
||||
// cout <<"Not setting dbit frequency to " << eDBitClkFreq->GetNumber()<< endl;
|
||||
try {
|
||||
myDet->setSpeed(slsDetectorDefs::DBIT_CLOCK,eDBitClkFreq->GetNumber(),0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
try{
|
||||
myDet->setDBITClock(eDBitClkFreq->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set dbit clock", "ctbPattern::setDBitFreq")
|
||||
}
|
||||
|
||||
void ctbPattern::setAdcPhase() {
|
||||
try {
|
||||
myDet->setSpeed(slsDetectorDefs::ADC_PHASE,eAdcClkPhase->GetNumber(),0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
try{
|
||||
myDet->setADCPhase(eAdcClkPhase->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set adc phase shift", "ctbPattern::setAdcPhase")
|
||||
}
|
||||
|
||||
void ctbPattern::setDBitPhase() {
|
||||
// cout <<"Not setting dbit phase to " << eDBitClkPhase->GetNumber()<< endl;
|
||||
try {
|
||||
myDet->setSpeed(slsDetectorDefs::DBIT_PHASE,eDBitClkPhase->GetNumber(),0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
try{
|
||||
myDet->setDBITPhase(eDBitClkPhase->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set dbit phase shift", "ctbPattern::setDBitPhase")
|
||||
}
|
||||
|
||||
|
||||
void ctbPattern::setAdcPipeline() {
|
||||
try {
|
||||
myDet->setSpeed(slsDetectorDefs::ADC_PIPELINE,eAdcPipeline->GetNumber(),0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
try{
|
||||
myDet->setADCPipeline(eAdcPipeline->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set adc pipeline", "ctbPattern::setAdcPipeline")
|
||||
}
|
||||
|
||||
|
||||
void ctbPattern::setDBitPipeline() {
|
||||
// cout <<"Not setting dbit pipeline to " << eDBitPipeline->GetNumber() << endl;
|
||||
try {
|
||||
myDet->setSpeed(slsDetectorDefs::DBIT_PIPELINE,eDBitPipeline->GetNumber(),0);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
try{
|
||||
myDet->setDBITPipeline(eDBitPipeline->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set dbit pipeline", "ctbPattern::setDBitPipeline")
|
||||
}
|
||||
|
||||
|
||||
void ctbPattern::setAnalogSamples() {
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES,eAnalogSamples->GetNumber());
|
||||
} catch (...) {
|
||||
try{
|
||||
myDet->setNumberOfAnalogSamples(eAnalogSamples->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set number of analog sampels", "ctbPattern::setAnalogSamples")
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
analogSamplesChanged(eAnalogSamples->GetNumber());
|
||||
}
|
||||
|
||||
void ctbPattern::setDigitalSamples() {
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES,eDigitalSamples->GetNumber());
|
||||
} catch (...) {
|
||||
try{
|
||||
myDet->setNumberOfDigitalSamples(eDigitalSamples->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set number of digital samples", "ctbPattern::setDigitalSamples")
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
digitalSamplesChanged(eDigitalSamples->GetNumber());
|
||||
}
|
||||
|
||||
void ctbPattern::setReadoutMode(Bool_t) {
|
||||
// cout << "Set readout mode to be implemented" << endl;
|
||||
slsDetectorDefs::readOutFlags flags;
|
||||
if (cbAnalog->IsOn() && cbDigital->IsOn()) flags=slsDetectorDefs::ANALOG_AND_DIGITAL;
|
||||
else if (~cbAnalog->IsOn() && cbDigital->IsOn()) flags=slsDetectorDefs::DIGITAL_ONLY;
|
||||
else if (cbAnalog->IsOn() && ~cbDigital->IsOn()) flags=slsDetectorDefs::NORMAL_READOUT;
|
||||
else flags=slsDetectorDefs::GET_READOUT_FLAGS;
|
||||
try {
|
||||
myDet->setReadOutFlags(flags);
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
slsDetectorDefs::readoutMode flag = slsDetectorDefs::ANALOG_ONLY;
|
||||
if (cbAnalog->IsOn() && cbDigital->IsOn())
|
||||
flag=slsDetectorDefs::ANALOG_AND_DIGITAL;
|
||||
else if (~cbAnalog->IsOn() && cbDigital->IsOn())
|
||||
flag=slsDetectorDefs::DIGITAL_ONLY;
|
||||
else if (cbAnalog->IsOn() && ~cbDigital->IsOn())
|
||||
flag=slsDetectorDefs::ANALOG_ONLY;
|
||||
else {
|
||||
throw runtime_error("unkown readout flag");
|
||||
}
|
||||
cout << "Set readout flags " << hex << flags << dec << endl;
|
||||
myDet->setReadoutMode(flag);
|
||||
cout << "Set readout flag: " << flag << endl;
|
||||
} CATCH_DISPLAY ("Could not set readout flag", "ctbPattern::setReadoutMode")
|
||||
|
||||
getReadoutMode();
|
||||
// myDet->setTimer(slsDetectorDefs::SAMPLES_CTB,eSamples->GetNumber());
|
||||
//samplesChanged(eSamples->GetNumber());
|
||||
}
|
||||
|
||||
void ctbPattern::readoutModeChanged(int flags) {
|
||||
@ -1188,70 +1036,55 @@ void ctbPattern::readoutModeChanged(int flags) {
|
||||
}
|
||||
|
||||
int ctbPattern::getReadoutMode() {
|
||||
// cout << "Get readout mode to be implemented" << endl;
|
||||
slsDetectorDefs::readOutFlags flags;
|
||||
try {
|
||||
flags=(slsDetectorDefs::readOutFlags) myDet->setReadOutFlags();
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
cout << "++++++++++++++++++++"<< hex << flags << dec << endl;
|
||||
if (flags&slsDetectorDefs::ANALOG_AND_DIGITAL) {
|
||||
cout << "analog and digital" << hex << slsDetectorDefs::ANALOG_AND_DIGITAL << dec<< endl;
|
||||
try{
|
||||
auto retval = myDet->getReadoutMode().tsquash("Different values");
|
||||
switch(retval) {
|
||||
case slsDetectorDefs::ANALOG_AND_DIGITAL:
|
||||
cout << "analog and digital" << endl;
|
||||
cbAnalog->SetOn(kTRUE);
|
||||
cbDigital->SetOn(kTRUE);
|
||||
} else if (flags&slsDetectorDefs::DIGITAL_ONLY) {
|
||||
cout << "digital only" << hex << slsDetectorDefs::DIGITAL_ONLY << dec << endl;
|
||||
break;
|
||||
case slsDetectorDefs::DIGITAL_ONLY:
|
||||
cout << "digital only" << endl;
|
||||
cbAnalog->SetOn(kFALSE);
|
||||
cbDigital->SetOn(kTRUE);
|
||||
}// else if (flags==slsDetectorDefs::NORMAL_READOUT) {
|
||||
// cbAnalog->SetOn(kTRUE);
|
||||
// cbDigital->SetOn(kFALSE);
|
||||
// }
|
||||
else {
|
||||
break;
|
||||
case slsDetectorDefs::ANALOG_ONLY:
|
||||
cout << "analog only" << endl;
|
||||
flags=slsDetectorDefs::NORMAL_READOUT;
|
||||
cbAnalog->SetOn(kTRUE);
|
||||
cbDigital->SetOn(kFALSE);
|
||||
break;
|
||||
default:
|
||||
throw("unknown readout flag");
|
||||
}
|
||||
Emit("readoutModeChanged(int)",static_cast<int>(retval));
|
||||
return retval;
|
||||
} CATCH_DISPLAY ("Could not get readout flags", "ctbPattern::getReadoutMode")
|
||||
|
||||
Emit("readoutModeChanged(int)",(int)flags);
|
||||
return (int)flags;
|
||||
|
||||
// myDet->setTimer(slsDetectorDefs::SAMPLES_CTB,eSamples->GetNumber());
|
||||
//samplesChanged(eSamples->GetNumber());
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ctbPattern::getAnalogSamples() {
|
||||
int n;
|
||||
try {
|
||||
n=(myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES,-1));
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
eAnalogSamples->SetNumber((Double_t)n);
|
||||
try{
|
||||
auto retval = myDet->getNumberOfAnalogSamples().tsquash("Different values");
|
||||
eAnalogSamples->SetNumber((Double_t)retval);
|
||||
Emit("analogSamplesChanged(const int)", eAnalogSamples->GetNumber());
|
||||
return eAnalogSamples->GetNumber();
|
||||
} CATCH_DISPLAY ("Could not get number of triggers.", "ctbPattern::update")
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ctbPattern::getDigitalSamples() {
|
||||
int n;
|
||||
try {
|
||||
|
||||
n=(myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES,-1));
|
||||
} catch (...) {
|
||||
|
||||
cout << "Do nothing for this error" << endl;
|
||||
}
|
||||
|
||||
eDigitalSamples->SetNumber(((Double_t)n));
|
||||
try{
|
||||
auto retval = myDet->getNumberOfDigitalSamples().tsquash("Different values");
|
||||
eDigitalSamples->SetNumber((Double_t)retval);
|
||||
Emit("digitalSamplesChanged(const int)", eDigitalSamples->GetNumber());
|
||||
return eDigitalSamples->GetNumber();
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get number of triggers.", "ctbPattern::update")
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void ctbPattern::analogSamplesChanged(const int t){
|
||||
|
@ -27,7 +27,10 @@ class energyCalibration;
|
||||
class TGTextButton;
|
||||
class TGTab;
|
||||
|
||||
class multiSlsDetector;
|
||||
namespace sls
|
||||
{
|
||||
class Detector;
|
||||
};
|
||||
|
||||
|
||||
#include <string>
|
||||
@ -46,10 +49,10 @@ class ctbLoop : public TGHorizontalFrame {
|
||||
|
||||
int id;
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *myDet;
|
||||
|
||||
public:
|
||||
ctbLoop(TGGroupFrame *page, int i,multiSlsDetector *det);
|
||||
ctbLoop(TGGroupFrame *page, int i,sls::Detector *det);
|
||||
|
||||
void setNLoops();
|
||||
void update();
|
||||
@ -67,10 +70,10 @@ class ctbWait : public TGHorizontalFrame {
|
||||
|
||||
int id;
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *myDet;
|
||||
|
||||
public:
|
||||
ctbWait(TGGroupFrame *page, int i,multiSlsDetector *det);
|
||||
ctbWait(TGGroupFrame *page, int i,sls::Detector *det);
|
||||
|
||||
void setWaitTime();
|
||||
void update();
|
||||
@ -99,7 +102,7 @@ private:
|
||||
TGNumberEntry *eStopAddr;
|
||||
TGNumberEntry *eFrames;
|
||||
TGNumberEntry *ePeriod;
|
||||
TGNumberEntry *eCycles;
|
||||
TGNumberEntry *eTriggers;
|
||||
// TGNumberEntry *eMeasurements;
|
||||
TGNumberEntry *eAdcPipeline;
|
||||
TGNumberEntry *eDBitPipeline;
|
||||
@ -122,11 +125,11 @@ private:
|
||||
|
||||
char pat[PATLEN*8];
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *myDet;
|
||||
|
||||
public:
|
||||
|
||||
ctbPattern(TGVerticalFrame *page, multiSlsDetector *det);
|
||||
ctbPattern(TGVerticalFrame *page, sls::Detector *det);
|
||||
|
||||
void update();
|
||||
void setAdcFreq();
|
||||
@ -138,7 +141,7 @@ public:
|
||||
void setAdcPipeline();
|
||||
void setDBitPipeline();
|
||||
void setFrames();
|
||||
void setCycles();
|
||||
void setTriggers();
|
||||
// void setMeasurements();
|
||||
void setPeriod();
|
||||
|
||||
|
@ -10,61 +10,48 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#include "ctbDefs.h"
|
||||
#include "ctbDacs.h"
|
||||
#include "ctbPowers.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "Detector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
ctbPower::ctbPower(TGGroupFrame* f, int i, multiSlsDetector* d)
|
||||
ctbPower::ctbPower(TGGroupFrame* f, int i, sls::Detector* d)
|
||||
: ctbDac(f, i, d)
|
||||
{
|
||||
cout << "****************************************************************power " << i << endl;
|
||||
dacsUnit->SetOn(kTRUE);
|
||||
dacsUnit->SetEnabled(kFALSE);
|
||||
int ii=0;
|
||||
|
||||
switch(i) {
|
||||
case slsDetectorDefs::V_POWER_IO:
|
||||
dacsLabel->SetText("VIO");
|
||||
ii=slsDetectorDefs::I_POWER_IO;
|
||||
break;
|
||||
case slsDetectorDefs::V_POWER_A:
|
||||
dacsLabel->SetText("VA");
|
||||
ii=slsDetectorDefs::I_POWER_A;
|
||||
break;
|
||||
case slsDetectorDefs::V_POWER_B:
|
||||
dacsLabel->SetText("VB");
|
||||
ii=slsDetectorDefs::I_POWER_B;
|
||||
break;
|
||||
case slsDetectorDefs::V_POWER_C:
|
||||
dacsLabel->SetText("VC");
|
||||
ii=slsDetectorDefs::I_POWER_C;
|
||||
break;
|
||||
case slsDetectorDefs::V_POWER_D:
|
||||
dacsLabel->SetText("VD");
|
||||
ii=slsDetectorDefs::I_POWER_D;
|
||||
break;
|
||||
case slsDetectorDefs::V_POWER_CHIP:
|
||||
dacsLabel->SetText("VCHIP");
|
||||
dacsLabel->SetEnabled(kFALSE);
|
||||
ii=-1;
|
||||
break;
|
||||
default:
|
||||
dacsLabel->SetText("Bad index");
|
||||
ii=-1;
|
||||
break;
|
||||
};
|
||||
|
||||
// ctbSlowAdc *vm=new ctbSlowAdc(f,i,d);
|
||||
// vm->setLabel("V: ");
|
||||
// if (ii>=0) {
|
||||
// ctbSlowAdc *im=new ctbSlowAdc(f,ii,d);
|
||||
// im->setLabel("I: ");
|
||||
// }
|
||||
|
||||
TGTextEntry *e=dacsEntry->TGNumberEntry::GetNumberEntry();
|
||||
e->Disconnect ("ReturnPressed()");
|
||||
@ -104,44 +91,45 @@ string ctbPower::getLabel() {
|
||||
}
|
||||
line << " " << dacsLabel->GetText() << endl;
|
||||
return line.str();
|
||||
|
||||
}
|
||||
|
||||
void ctbPower::setValue(Long_t a) {ctbPower::setValue();}
|
||||
|
||||
void ctbPower::setValue(Long_t a) {cout << "ssssssssss" << endl; ctbPower::setValue();}
|
||||
void ctbPower::setValue() {
|
||||
cout << "***************************Setting power " << dacsEntry->GetIntNumber() << " " << id << " " << 1 << endl;
|
||||
|
||||
|
||||
cout << "***************************Setting power " << dacsEntry->GetIntNumber() << " " << (slsDetectorDefs::dacIndex)id <<" " << 1 << endl;
|
||||
myDet->setDAC(dacsEntry->GetIntNumber(), (slsDetectorDefs::dacIndex)id, 1);
|
||||
try {
|
||||
myDet->setVoltage(static_cast<slsDetectorDefs::dacIndex>(id), dacsEntry->GetIntNumber());
|
||||
} CATCH_DISPLAY ("Could not set power " + to_string(id) + ".", "ctbPower::setValue")
|
||||
|
||||
getValue();
|
||||
|
||||
}
|
||||
|
||||
|
||||
int ctbPower::getValue() {
|
||||
try {
|
||||
|
||||
int val=myDet->setDAC(-1, (slsDetectorDefs::dacIndex)id, 1);
|
||||
char s[100];
|
||||
cout << "****************************Getting power " << val << " " << (slsDetectorDefs::dacIndex)id <<" " << 1 << endl;
|
||||
sprintf(s,"%d",val);
|
||||
dacsValue->SetText(s);
|
||||
if (val>0) {
|
||||
if (id!=slsDetectorDefs::V_POWER_CHIP)
|
||||
int val = myDet->getVoltage(static_cast<slsDetectorDefs::dacIndex>(id)).tsquash("Different values");
|
||||
cout << "****************************Getting power " << val << " " << id << " " << 1 << endl;
|
||||
|
||||
dacsValue->SetText(to_string(val).c_str());
|
||||
if (val > 0) {
|
||||
if (id != static_cast<int>(slsDetectorDefs::V_POWER_CHIP))
|
||||
dacsLabel->SetOn(kTRUE);
|
||||
} else {
|
||||
dacsLabel->SetOn(kFALSE);
|
||||
}
|
||||
|
||||
|
||||
return val;
|
||||
|
||||
} CATCH_DISPLAY ("Could not get power " + to_string(id) + ".", "ctbPower::getValue")
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ctbPowers::ctbPowers(TGVerticalFrame* page, multiSlsDetector* det) : TGGroupFrame(page,"Power Supplies",kVerticalFrame) , myDet(det){
|
||||
ctbPowers::ctbPowers(TGVerticalFrame* page, sls::Detector* det) : TGGroupFrame(page,"Power Supplies",kVerticalFrame) , myDet(det){
|
||||
|
||||
|
||||
SetTitlePos(TGGroupFrame::kLeft);
|
||||
@ -159,9 +147,8 @@ ctbPowers::ctbPowers(TGVerticalFrame* page, multiSlsDetector* det) : TGGroupFr
|
||||
|
||||
int ctbPowers::setPwrAlias(string line) {
|
||||
|
||||
int is=-1, mv=0;
|
||||
int is=-1;
|
||||
char tit[100];
|
||||
int narg;
|
||||
|
||||
if (sscanf(line.c_str(),"VA %s",tit)) {
|
||||
dacs[0]->setLabel(tit,1);
|
||||
@ -212,7 +199,6 @@ string ctbPowers::getPwrAlias() {
|
||||
|
||||
string ctbPowers::getPwrParameters() {
|
||||
|
||||
|
||||
ostringstream line;
|
||||
line << "v_a" << " " << dacs[0]->getValue() << " mv" << endl;
|
||||
line << "v_b" << " " << dacs[1]->getValue() << " mv" << endl;
|
||||
@ -225,19 +211,13 @@ string ctbPowers::getPwrParameters() {
|
||||
// line << "dac:" << i << " " << dacs[i]->getValue() << endl;
|
||||
// }
|
||||
return line.str();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ctbPowers::update() {
|
||||
|
||||
for (int idac=0; idac<NPOWERS; idac++) {
|
||||
|
||||
dacs[idac]->getValue();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -3,14 +3,7 @@
|
||||
|
||||
#include <TGFrame.h>
|
||||
|
||||
#ifndef CTB
|
||||
#define NPOWERS 0
|
||||
#else
|
||||
|
||||
#define NPOWERS 6
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -22,8 +15,10 @@ class TGCheckButton;
|
||||
|
||||
|
||||
|
||||
class multiSlsDetector;
|
||||
|
||||
namespace sls
|
||||
{
|
||||
class Detector;
|
||||
};
|
||||
|
||||
#include <string>
|
||||
using namespace std;
|
||||
@ -36,7 +31,7 @@ class ctbPower : public ctbDac {
|
||||
|
||||
public:
|
||||
|
||||
ctbPower(TGGroupFrame* f, int i, multiSlsDetector* d);
|
||||
ctbPower(TGGroupFrame* f, int i, sls::Detector* d);
|
||||
|
||||
string getLabel();
|
||||
|
||||
@ -54,11 +49,11 @@ class ctbPowers : public TGGroupFrame
|
||||
|
||||
ctbPower *dacs[NPOWERS];
|
||||
|
||||
multiSlsDetector* myDet;
|
||||
sls::Detector* myDet;
|
||||
|
||||
public:
|
||||
//ctbPowers();
|
||||
ctbPowers(TGVerticalFrame*, multiSlsDetector*);
|
||||
ctbPowers(TGVerticalFrame*, sls::Detector*);
|
||||
|
||||
int setPwrAlias(string);
|
||||
string getPwrAlias();
|
||||
|
@ -34,7 +34,8 @@
|
||||
|
||||
|
||||
#include "ctbSignals.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "ctbDefs.h"
|
||||
#include "Detector.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -43,7 +44,7 @@ using namespace std;
|
||||
//#define DEFAULTFN "run_0.encal"
|
||||
|
||||
|
||||
ctbSignal::ctbSignal(TGFrame *page, int i, multiSlsDetector *det)
|
||||
ctbSignal::ctbSignal(TGFrame *page, int i, sls::Detector *det)
|
||||
: TGHorizontalFrame(page, 800,50), myDet(det), id(i), hsig(NULL) {
|
||||
|
||||
|
||||
@ -178,10 +179,6 @@ int ctbSignal::fixOutput(int i) {
|
||||
|
||||
int ctbSignal::setDbitList(Long64_t r) {
|
||||
|
||||
Long64_t mask=((Long64_t)1<<id);
|
||||
|
||||
// cout << hex << r << dec <<endl;
|
||||
|
||||
if (r)
|
||||
sDbitList->SetOn(kTRUE,kFALSE);
|
||||
else
|
||||
@ -197,7 +194,6 @@ int ctbSignal::isPlot() { return sPlot->IsOn();}
|
||||
Pixel_t ctbSignal::getColor(){return fColorSel->GetColor();}
|
||||
|
||||
void ctbSignal::ToggledOutput(Bool_t b) {
|
||||
Long_t mask=b<<id;
|
||||
ToggledSignalOutput(id);
|
||||
if (b) {
|
||||
// sClock->SetEnabled(kTRUE);
|
||||
@ -249,7 +245,7 @@ void ctbSignal::ToggledSignalPlot(Int_t b){
|
||||
}
|
||||
|
||||
|
||||
ctbSignals::ctbSignals(TGVerticalFrame *page, multiSlsDetector *det)
|
||||
ctbSignals::ctbSignals(TGVerticalFrame *page, sls::Detector *det)
|
||||
: TGGroupFrame(page,"IO Signals",kVerticalFrame), myDet(det) {
|
||||
|
||||
|
||||
@ -259,7 +255,6 @@ ctbSignals::ctbSignals(TGVerticalFrame *page, multiSlsDetector *det)
|
||||
|
||||
|
||||
TGHorizontalFrame *hframe;
|
||||
char tit[100];
|
||||
|
||||
TGHorizontalFrame* hhframe=new TGHorizontalFrame(this, 800,800);
|
||||
AddFrame(hhframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
|
||||
@ -290,36 +285,6 @@ ctbSignals::ctbSignals(TGVerticalFrame *page, multiSlsDetector *det)
|
||||
|
||||
}
|
||||
|
||||
// #ifdef CTB
|
||||
// idac=62;
|
||||
// signals[idac]=new ctbSignal(vframe,idac,myDet);
|
||||
// vframe->AddFrame(signals[idac],new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
|
||||
// signals[idac]->MapWindow();
|
||||
// sprintf(tit,"DBIT Latch");
|
||||
|
||||
// signals[idac]->setSignalAlias(tit,-1,-1);
|
||||
|
||||
// signals[idac]->Connect("ToggledSignalOutput(Int_t)","ctbSignals",this,"ToggledOutReg(Int_t)");
|
||||
// signals[idac]->Connect("ToggledSignalDbitList(Int_t)","ctbSignals",this,"ToggledDbitList(Int_t)");
|
||||
// signals[idac]->Connect("ToggledSignalPlot(Int_t)","ctbSignals",this,"ToggledPlot(Int_t)");
|
||||
|
||||
|
||||
// #endif
|
||||
|
||||
|
||||
// idac=63;
|
||||
// signals[idac]=new ctbSignal(vframe,idac,myDet);
|
||||
// vframe->AddFrame(signals[idac],new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
|
||||
// signals[idac]->MapWindow();
|
||||
// sprintf(tit,"ADC Latch");
|
||||
|
||||
// signals[idac]->setSignalAlias(tit,-1,-1);
|
||||
|
||||
// signals[idac]->Connect("ToggledSignalOutput(Int_t)","ctbSignals",this,"ToggledOutReg(Int_t)");
|
||||
// signals[idac]->Connect("ToggledSignalDbitList(Int_t)","ctbSignals",this,"ToggledDbitList(Int_t)");
|
||||
// signals[idac]->Connect("ToggledSignalPlot(Int_t)","ctbSignals",this,"ToggledPlot(Int_t)");
|
||||
|
||||
|
||||
hframe=new TGHorizontalFrame(vframe, 800,50);
|
||||
vframe->AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 1,1,1,1));
|
||||
hframe->MapWindow();
|
||||
@ -398,63 +363,68 @@ string ctbSignals::getSignalAlias() {
|
||||
|
||||
|
||||
void ctbSignals::update() {
|
||||
Long64_t oreg=myDet->setPatternIOControl();//setCTBWord(-1,-1);
|
||||
// Long64_t creg=myDet->setPatternClockControl();//setCTBWord(-2,-1);
|
||||
try {
|
||||
|
||||
|
||||
char val[1000];
|
||||
Long64_t oreg = static_cast<Long64_t>(myDet->getPatternIOControl().tsquash("Different values"));
|
||||
cout << hex << oreg << dec << endl;
|
||||
// cout << hex << creg << dec << endl;
|
||||
|
||||
sprintf(val,"%llX",oreg);
|
||||
// eIOCntrlRegister->SetHexNumber(oreg);
|
||||
|
||||
|
||||
for (int idac=0; idac<NIOSIGNALS; idac++) {
|
||||
signals[idac]->setOutput(oreg);
|
||||
|
||||
}
|
||||
|
||||
Long64_t mask;
|
||||
std::vector <int> dbitlist=myDet->getReceiverDbitList();
|
||||
if (dbitlist.empty())
|
||||
} CATCH_DISPLAY ("Could not get patternIOcontrol.", "ctbSignals::update")
|
||||
|
||||
try {
|
||||
|
||||
auto dbitlist = myDet->getRxDbitList().tsquash("Different values");
|
||||
// enable all
|
||||
if (dbitlist.empty()) {
|
||||
for (int is=0; is<64; is++) {
|
||||
signals[is]->setDbitList(1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int is=0; is<64; is++) signals[is]->setDbitList(0);
|
||||
// disable all
|
||||
for (int is=0; is<64; is++) {
|
||||
signals[is]->setDbitList(0);
|
||||
}
|
||||
// enable selected
|
||||
for (const auto &value : dbitlist) {
|
||||
signals[value]->setDbitList(1);
|
||||
}
|
||||
}
|
||||
|
||||
} CATCH_DISPLAY ("Could not get receiver dbit list.", "ctbSignals::update")
|
||||
|
||||
eDbitOffset->SetNumber(myDet->getReceiverDbitOffset());
|
||||
try {
|
||||
auto val = myDet->getRxDbitOffset().tsquash("Different values");
|
||||
eDbitOffset->SetNumber(val);
|
||||
} CATCH_DISPLAY ("Could not get receiver dbit offset.", "ctbSignals::update")
|
||||
|
||||
}
|
||||
|
||||
|
||||
string ctbSignals::getSignalParameters() {
|
||||
|
||||
try {
|
||||
|
||||
auto val = myDet->getPatternIOControl().tsquash("Different values");
|
||||
ostringstream line;
|
||||
line << "patioctrl " << hex << myDet->setPatternIOControl() << dec << endl;//setCTBWord(-1,-1)
|
||||
line << "patioctrl " << hex << val << dec << endl;
|
||||
return line.str();
|
||||
|
||||
} CATCH_DISPLAY ("Could not get patternIOcontrol.", "ctbSignals::getSignalParameters")
|
||||
|
||||
return ("");
|
||||
}
|
||||
|
||||
void ctbSignals::ToggledOutReg(Int_t mask) {
|
||||
try {
|
||||
|
||||
char val[1000];
|
||||
Long64_t oreg=myDet->setPatternIOControl();//setCTBWord(-1,-1);
|
||||
Long64_t oreg = static_cast<Long64_t>(myDet->getPatternIOControl().tsquash("Different values"));
|
||||
Long64_t m=((Long64_t)1)<<mask;
|
||||
|
||||
|
||||
cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg;
|
||||
|
||||
|
||||
|
||||
if (signals[mask]->isOutput()) {
|
||||
cout << " or " << m ;
|
||||
oreg|=m;
|
||||
@ -464,55 +434,61 @@ void ctbSignals::ToggledOutReg(Int_t mask) {
|
||||
}
|
||||
cout << " after " << oreg << endl;
|
||||
|
||||
myDet->setPatternIOControl(oreg);//setCTBWord(-1,oreg);
|
||||
oreg=myDet->setPatternIOControl();//myDet->setCTBWord(-1,-1);
|
||||
|
||||
myDet->setPatternIOControl(static_cast<uint64_t>(oreg));
|
||||
oreg = static_cast<Long64_t>(myDet->getPatternIOControl().tsquash("Different values"));
|
||||
cout << dec << sizeof(Long64_t) << " " << mask << " " << hex << m << " ioreg " << oreg << endl;
|
||||
|
||||
sprintf(val,"%llX",oreg);
|
||||
// eIOCntrlRegister->SetHexNumber(oreg);
|
||||
eIOCntrlRegister->SetText(val);
|
||||
// eIOCntrlRegister->SetNumber(oreg);
|
||||
eIOCntrlRegister->SetText(to_string(oreg).c_str());
|
||||
|
||||
} CATCH_DISPLAY ("Could not get/set patternIOcontrol.", "ctbSignals::ToggledOutReg")
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ctbSignals::ToggledDbitList(Int_t mask){
|
||||
try {
|
||||
|
||||
auto dbitlist = myDet->getRxDbitList().tsquash("Different values");
|
||||
|
||||
|
||||
cout << "************* Here" << endl;
|
||||
|
||||
|
||||
|
||||
std::vector <int> new_dbitlist;
|
||||
std::vector <int> old_dbitlist=myDet->getReceiverDbitList();
|
||||
|
||||
char val[1000];
|
||||
Long64_t m=((Long64_t)1)<<mask;
|
||||
|
||||
if (old_dbitlist.empty() && signals[mask]->isDbitList())
|
||||
// anyway all enabled
|
||||
if ((dbitlist.empty()) && (signals[mask]->isDbitList())) {
|
||||
;
|
||||
}
|
||||
// set the dbitlist
|
||||
else {
|
||||
int ns=0;
|
||||
std::vector <int> new_dbitlist;
|
||||
for (int is=0; is<64; is++) {
|
||||
if (signals[is]->isDbitList()){
|
||||
new_dbitlist.push_back(is);
|
||||
ns++;
|
||||
cout << is << " " << ns << endl;
|
||||
cout << is << " " << new_dbitlist.size() - 1 << endl;
|
||||
}
|
||||
}
|
||||
if (ns>63) new_dbitlist.clear();
|
||||
myDet->setReceiverDbitList(new_dbitlist);
|
||||
if (new_dbitlist.size() > 64)
|
||||
new_dbitlist.clear();
|
||||
myDet->setRxDbitList(new_dbitlist);
|
||||
// get list again
|
||||
dbitlist = myDet->getRxDbitList().tsquash("Different values");
|
||||
}
|
||||
std::vector <int> dbitlist=myDet->getReceiverDbitList();
|
||||
if (dbitlist.empty())
|
||||
for (int is=0; is<64; is++) signals[is]->setDbitList(1);
|
||||
else
|
||||
for (int is=0; is<64; is++) signals[is]->setDbitList(0);
|
||||
for (const auto &value : dbitlist) signals[value]->setDbitList(1);
|
||||
|
||||
// enable all
|
||||
if (dbitlist.empty()) {
|
||||
for (int is=0; is<64; is++) {
|
||||
signals[is]->setDbitList(1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// disable all
|
||||
for (int is=0; is<64; is++) {
|
||||
signals[is]->setDbitList(0);
|
||||
}
|
||||
// enable selected
|
||||
for (const auto &value : dbitlist) {
|
||||
signals[value]->setDbitList(1);
|
||||
}
|
||||
}
|
||||
|
||||
} CATCH_DISPLAY ("Could not get/set receiver dbit list.", "ctbSignals::ToggledDbitList")
|
||||
}
|
||||
|
||||
|
||||
@ -533,16 +509,23 @@ void ctbSignals::ToggledSignalPlot(Int_t b) {
|
||||
|
||||
|
||||
Pixel_t ctbSignals::getColor(int i){
|
||||
if (i>=0 && i<NSIGNALS) return signals[i]->getColor();
|
||||
if (i>=0 && i<NSIGNALS)
|
||||
return signals[i]->getColor();
|
||||
return static_cast<Pixel_t>(-1);
|
||||
}
|
||||
|
||||
int ctbSignals::getPlot(int i){
|
||||
if (i>=0 && i<NSIGNALS) return signals[i]->isPlot();
|
||||
if (i>=0 && i<NSIGNALS)
|
||||
return signals[i]->isPlot();
|
||||
return -1;
|
||||
};
|
||||
|
||||
void ctbSignals::setDbitOffset(Long_t) {
|
||||
setDbitOffset();
|
||||
}
|
||||
|
||||
void ctbSignals::setDbitOffset(){
|
||||
myDet->setReceiverDbitOffset(eDbitOffset->GetNumber());
|
||||
try {
|
||||
myDet->setRxDbitOffset(eDbitOffset->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set receiver dbit offset.", "ctbSignals::setDbitOffset")
|
||||
}
|
||||
|
@ -25,7 +25,10 @@ class TGColorSelect;
|
||||
|
||||
|
||||
class TGNumberEntry;
|
||||
class multiSlsDetector;
|
||||
namespace sls
|
||||
{
|
||||
class Detector;
|
||||
};
|
||||
class ctbSignal;
|
||||
|
||||
#include <string>
|
||||
@ -45,14 +48,14 @@ private:
|
||||
TGNumberEntry *sEntry;
|
||||
TGColorSelect *fColorSel;
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *myDet;
|
||||
Int_t id;
|
||||
|
||||
TH1I *hsig;
|
||||
|
||||
public:
|
||||
|
||||
ctbSignal(TGFrame *page, int i, multiSlsDetector *det);
|
||||
ctbSignal(TGFrame *page, int i, sls::Detector *det);
|
||||
int setSignalAlias(char *tit, int plot, int col);
|
||||
string getSignalAlias();
|
||||
|
||||
@ -89,10 +92,10 @@ private:
|
||||
TGNumberEntry *eIOCntrlRegister;
|
||||
TGNumberEntry *eDbitOffset;
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *myDet;
|
||||
|
||||
public:
|
||||
ctbSignals(TGVerticalFrame *page, multiSlsDetector *det);
|
||||
ctbSignals(TGVerticalFrame *page, sls::Detector *det);
|
||||
int setSignalAlias(string line);
|
||||
string getSignalAlias();
|
||||
|
||||
|
@ -9,7 +9,8 @@
|
||||
#include <TGButton.h>
|
||||
|
||||
#include "ctbSlowAdcs.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "ctbDefs.h"
|
||||
#include "Detector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
using namespace std;
|
||||
@ -17,7 +18,7 @@ using namespace std;
|
||||
|
||||
|
||||
|
||||
ctbSlowAdc::ctbSlowAdc(TGGroupFrame *page, int idac, multiSlsDetector *det) : TGHorizontalFrame(page, 800,50) , id(idac), myDet(det) {
|
||||
ctbSlowAdc::ctbSlowAdc(TGGroupFrame *page, int idac, sls::Detector *det) : TGHorizontalFrame(page, 800,50) , id(idac), myDet(det) {
|
||||
|
||||
|
||||
TGHorizontalFrame *hframe=this;
|
||||
@ -55,9 +56,6 @@ ctbSlowAdc::ctbSlowAdc(TGGroupFrame *page, int idac, multiSlsDetector *det) : TG
|
||||
b->SetTextJustify(kTextLeft);
|
||||
|
||||
b->Connect("Clicked()","ctbSlowAdc",this,"getValue()");
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -66,38 +64,50 @@ int ctbSlowAdc::setLabel(char *tit) {
|
||||
if(tit)
|
||||
dacsLabel->SetText(tit);
|
||||
|
||||
|
||||
return id;
|
||||
|
||||
}
|
||||
|
||||
string ctbSlowAdc::getLabel() {
|
||||
|
||||
ostringstream line;
|
||||
line << dacsLabel->GetText() << endl;
|
||||
|
||||
// line << "DAC" << dec << id << " " << dacsUnit->IsOn() << endl;
|
||||
|
||||
return line.str();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int ctbSlowAdc::getValue() {
|
||||
try {
|
||||
std::string s;
|
||||
|
||||
int val=myDet->getADC((slsDetectorDefs::dacIndex)id);
|
||||
char s[100];
|
||||
cout << "adc " << id << " " << val << endl;
|
||||
sprintf(s,"%d mV",val);
|
||||
if (id==999)
|
||||
sprintf(s,"%d <20>C",val);
|
||||
dacsValue->SetText(s);
|
||||
|
||||
// temp
|
||||
if (id == static_cast<int>(slsDetectorDefs::SLOW_ADC_TEMP)) {
|
||||
|
||||
int val = myDet->getTemperature(static_cast<slsDetectorDefs::dacIndex>(id)).tsquash("Different values");
|
||||
cout << "slow adc temp" << " " << val << endl;
|
||||
|
||||
s = to_string(val) + " " + to_string(0x00b0) + "C";//<2F>C
|
||||
dacsValue->SetText(s.c_str());
|
||||
return val;
|
||||
}
|
||||
|
||||
// mv
|
||||
else {
|
||||
|
||||
int val = myDet->getSlowADC(static_cast<slsDetectorDefs::dacIndex>(id)).tsquash("Different values");
|
||||
cout << "slow adc " << id << " " << val << endl;
|
||||
|
||||
s = to_string(val) + " mV";
|
||||
dacsValue->SetText(s.c_str());
|
||||
return val;
|
||||
}
|
||||
|
||||
} CATCH_DISPLAY ("Could not get slow dac " + to_string(id) + ".", "ctbSlowAdc::getValue")
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -106,8 +116,7 @@ int ctbSlowAdc::getValue() {
|
||||
|
||||
|
||||
|
||||
ctbSlowAdcs::ctbSlowAdcs(TGVerticalFrame *page, multiSlsDetector *det) : TGGroupFrame(page,"Sense",kVerticalFrame) , myDet(det){
|
||||
|
||||
ctbSlowAdcs::ctbSlowAdcs(TGVerticalFrame *page, sls::Detector *det) : TGGroupFrame(page,"Sense",kVerticalFrame) , myDet(det){
|
||||
|
||||
SetTitlePos(TGGroupFrame::kLeft);
|
||||
page->AddFrame(this,new TGLayoutHints( kLHintsTop | kLHintsExpandX , 10,10,10,10));
|
||||
@ -116,14 +125,12 @@ ctbSlowAdcs::ctbSlowAdcs(TGVerticalFrame *page, multiSlsDetector *det) : TGGro
|
||||
// cout << "window mapped " << endl;
|
||||
|
||||
|
||||
for (int idac=0; idac<NSLOWADCS; idac++) {
|
||||
for (int idac=0; idac<NSLOWADCS + 1; idac++) {
|
||||
|
||||
adcs[idac]=new ctbSlowAdc(this, idac+1000, myDet);
|
||||
|
||||
}
|
||||
adcs[NSLOWADCS]=new ctbSlowAdc(this, 999, myDet);
|
||||
adcs[NSLOWADCS]->setLabel("Temperature");
|
||||
|
||||
adcs[NSLOWADCS]->setLabel((char*)"Temperature");
|
||||
}
|
||||
|
||||
|
||||
@ -133,7 +140,7 @@ int ctbSlowAdcs::setSlowAdcAlias(string line) {
|
||||
|
||||
int is=-1, mv=0;
|
||||
char tit[100];
|
||||
int narg=sscanf(line.c_str(),"SENSE%d %s",&is,tit,&mv);
|
||||
int narg=sscanf(line.c_str(),"SENSE%d %s %d",&is,tit,&mv);
|
||||
if (narg<2)
|
||||
return -1;
|
||||
if (is>=0 && is<NSLOWADCS)
|
||||
@ -149,7 +156,6 @@ string ctbSlowAdcs::getSlowAdcAlias() {
|
||||
for (int i=0; i<NSLOWADCS; i++)
|
||||
line << adcs[i]->getLabel() << endl;
|
||||
return line.str();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -157,7 +163,6 @@ string ctbSlowAdcs::getSlowAdcAlias() {
|
||||
|
||||
string ctbSlowAdcs::getAdcParameters() {
|
||||
|
||||
|
||||
ostringstream line;
|
||||
|
||||
for (int i=0; i<NSLOWADCS; i++) {
|
||||
@ -166,20 +171,12 @@ string ctbSlowAdcs::getAdcParameters() {
|
||||
}
|
||||
line << "adc:-1" << adcs[NSLOWADCS]->getValue() << endl;
|
||||
return line.str();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ctbSlowAdcs::update() {
|
||||
|
||||
|
||||
for (int idac=0; idac<NSLOWADCS+1; idac++) {
|
||||
|
||||
adcs[idac]->getValue();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -19,7 +19,10 @@ class TGTextButton;
|
||||
|
||||
|
||||
|
||||
class multiSlsDetector;
|
||||
namespace sls
|
||||
{
|
||||
class Detector;
|
||||
};
|
||||
|
||||
#include <string>
|
||||
using namespace std;
|
||||
@ -35,9 +38,9 @@ class ctbSlowAdc : public TGHorizontalFrame {
|
||||
TGLabel *dacsValue;
|
||||
int id;
|
||||
|
||||
multiSlsDetector* myDet;
|
||||
sls::Detector* myDet;
|
||||
public:
|
||||
ctbSlowAdc(TGGroupFrame*, int , multiSlsDetector*);
|
||||
ctbSlowAdc(TGGroupFrame*, int , sls::Detector*);
|
||||
int getValue();
|
||||
|
||||
int setLabel(char *tit);
|
||||
@ -56,10 +59,10 @@ private:
|
||||
|
||||
ctbSlowAdc *adcs[NSLOWADCS+1];
|
||||
|
||||
multiSlsDetector* myDet;
|
||||
sls::Detector* myDet;
|
||||
|
||||
public:
|
||||
ctbSlowAdcs(TGVerticalFrame *page, multiSlsDetector*);
|
||||
ctbSlowAdcs(TGVerticalFrame *page, sls::Detector*);
|
||||
|
||||
int setSlowAdcAlias(string line);
|
||||
// int setDacAlias(string line);
|
||||
|
@ -3,9 +3,11 @@ find_package(Sphinx)
|
||||
|
||||
|
||||
if (DOXYGEN_FOUND AND SPHINX_FOUND)
|
||||
|
||||
# #Utility to generate command line documentation
|
||||
message(${CMAKE_PROJECT_SORURCE_DIR}/slsDetectorSoftware/src)
|
||||
# Utility to generate command line documentation
|
||||
add_executable(gendoc src/gendoc.cpp)
|
||||
# This is a bit hacky, but better than exposing stuff?
|
||||
target_include_directories(gendoc PRIVATE ${PROJECT_SOURCE_DIR}/slsDetectorSoftware/src)
|
||||
target_link_libraries(gendoc PRIVATE
|
||||
slsDetectorShared
|
||||
)
|
||||
|
@ -36,7 +36,7 @@ int main() {
|
||||
|
||||
std::cout << "Generating command line documentation!\n";
|
||||
|
||||
sls::CmdProxy<sls::Detector> proxy(nullptr);
|
||||
sls::CmdProxy proxy(nullptr);
|
||||
auto commands = proxy.GetProxyCommands();
|
||||
|
||||
std::ofstream fs("commands.rst");
|
||||
|
132
examples/gotthard2_veto_photon.txt
Normal file
132
examples/gotthard2_veto_photon.txt
Normal file
@ -0,0 +1,132 @@
|
||||
#G1 Energy #G2 Energy
|
||||
300 7000
|
||||
|
||||
#G0 pedestal G1 pedestal G2 pedestal G0 gain G1 gain G2 gain (for every channel) ADU
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
||||
100 100 100 10 1 0.1
|
@ -8,7 +8,7 @@ period 0.000024984
|
||||
delay 0.999999968
|
||||
gates 1
|
||||
frames 300000.000000000
|
||||
cycles 1.000000000
|
||||
triggers 1.000000000
|
||||
timing auto
|
||||
fineoff 0.000000
|
||||
startscript none
|
||||
|
@ -22,56 +22,56 @@ TEST_CASE_METHOD(MultiDetectorFixture, "Set and get dacs",
|
||||
auto th = 1000;
|
||||
|
||||
// set and read back each individual dac of EIGER
|
||||
d.setDAC(0, di::E_SvP, 0);
|
||||
CHECK(d.setDAC(-1, di::E_SvP, 0) == 0);
|
||||
d.setDAC(4000, di::E_SvN, 0);
|
||||
CHECK(d.setDAC(-1, di::E_SvN, 0) == 4000);
|
||||
d.setDAC(2000, di::E_Vtr, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vtr, 0) == 2000);
|
||||
d.setDAC(3500, di::E_Vrf, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vrf, 0) == 3500);
|
||||
d.setDAC(1400, di::E_Vrs, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vrs, 0) == 1400);
|
||||
d.setDAC(2556, di::E_Vtgstv, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vtgstv, 0) == 2556);
|
||||
d.setDAC(1500, di::E_Vcmp_ll, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_ll, 0) == 1500);
|
||||
d.setDAC(1400, di::E_Vcmp_lr, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_lr, 0) == 1400);
|
||||
d.setDAC(4000, di::E_cal, 0);
|
||||
CHECK(d.setDAC(-1, di::E_cal, 0) == 4000);
|
||||
d.setDAC(1300, di::E_Vcmp_rl, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_rl, 0) == 1300);
|
||||
d.setDAC(1200, di::E_Vcmp_rr, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_rr, 0) == 1200);
|
||||
d.setDAC(1100, di::E_rxb_rb, 0);
|
||||
CHECK(d.setDAC(-1, di::E_rxb_rb, 0) == 1100);
|
||||
d.setDAC(1100, di::E_rxb_lb, 0);
|
||||
CHECK(d.setDAC(-1, di::E_rxb_lb, 0) == 1100);
|
||||
d.setDAC(1500, di::E_Vcp, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vcp, 0) == 1500);
|
||||
d.setDAC(2000, di::E_Vcn, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vcn, 0) == 2000);
|
||||
d.setDAC(1550, di::E_Vis, 0);
|
||||
CHECK(d.setDAC(-1, di::E_Vis, 0) == 1550);
|
||||
d.setDAC(0, di::SVP, 0);
|
||||
CHECK(d.setDAC(-1, di::SVP, 0) == 0);
|
||||
d.setDAC(4000, di::SVN, 0);
|
||||
CHECK(d.setDAC(-1, di::SVN, 0) == 4000);
|
||||
d.setDAC(2000, di::VTR, 0);
|
||||
CHECK(d.setDAC(-1, di::VTR, 0) == 2000);
|
||||
d.setDAC(3500, di::VRF, 0);
|
||||
CHECK(d.setDAC(-1, di::VRF, 0) == 3500);
|
||||
d.setDAC(1400, di::VRS, 0);
|
||||
CHECK(d.setDAC(-1, di::VRS, 0) == 1400);
|
||||
d.setDAC(2556, di::VTGSTV, 0);
|
||||
CHECK(d.setDAC(-1, di::VTGSTV, 0) == 2556);
|
||||
d.setDAC(1500, di::VCMP_LL, 0);
|
||||
CHECK(d.setDAC(-1, di::VCMP_LL, 0) == 1500);
|
||||
d.setDAC(1400, di::VCMP_LR, 0);
|
||||
CHECK(d.setDAC(-1, di::VCMP_LR, 0) == 1400);
|
||||
d.setDAC(4000, di::CAL, 0);
|
||||
CHECK(d.setDAC(-1, di::CAL, 0) == 4000);
|
||||
d.setDAC(1300, di::VCMP_RL, 0);
|
||||
CHECK(d.setDAC(-1, di::VCMP_RL, 0) == 1300);
|
||||
d.setDAC(1200, di::VCMP_RR, 0);
|
||||
CHECK(d.setDAC(-1, di::VCMP_RR, 0) == 1200);
|
||||
d.setDAC(1100, di::RXB_RB, 0);
|
||||
CHECK(d.setDAC(-1, di::RXB_RB, 0) == 1100);
|
||||
d.setDAC(1100, di::RXB_LB, 0);
|
||||
CHECK(d.setDAC(-1, di::RXB_LB, 0) == 1100);
|
||||
d.setDAC(1500, di::VCP, 0);
|
||||
CHECK(d.setDAC(-1, di::VCP, 0) == 1500);
|
||||
d.setDAC(2000, di::VCN, 0);
|
||||
CHECK(d.setDAC(-1, di::VCN, 0) == 2000);
|
||||
d.setDAC(1550, di::VIS, 0);
|
||||
CHECK(d.setDAC(-1, di::VIS, 0) == 1550);
|
||||
d.setDAC(660, di::IO_DELAY, 0);
|
||||
CHECK(d.setDAC(-1, di::IO_DELAY, 0) == 660);
|
||||
|
||||
// setting threshold sets all individual vcmp
|
||||
d.setDAC(th, di::THRESHOLD, 0);
|
||||
CHECK(d.setDAC(-1, di::THRESHOLD, 0) == th);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_ll, 0) == th);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_lr, 0) == th);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_rl, 0) == th);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_rr, 0) == th);
|
||||
CHECK(d.setDAC(-1, di::VCMP_LL, 0) == th);
|
||||
CHECK(d.setDAC(-1, di::VCMP_LR, 0) == th);
|
||||
CHECK(d.setDAC(-1, di::VCMP_RL, 0) == th);
|
||||
CHECK(d.setDAC(-1, di::VCMP_RR, 0) == th);
|
||||
|
||||
// different values gives -1
|
||||
if (d.getNumberOfDetectors() > 1) {
|
||||
d.setDAC(1600, di::E_Vcmp_ll, 0, 0);
|
||||
d.setDAC(1700, di::E_Vcmp_ll, 0, 1);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_ll, 0, 0) == 1600);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_ll, 0, 1) == 1700);
|
||||
CHECK(d.setDAC(-1, di::E_Vcmp_ll, 0) == -1);
|
||||
d.setDAC(1600, di::VCMP_LL, 0, 0);
|
||||
d.setDAC(1700, di::VCMP_LL, 0, 1);
|
||||
CHECK(d.setDAC(-1, di::VCMP_LL, 0, 0) == 1600);
|
||||
CHECK(d.setDAC(-1, di::VCMP_LL, 0, 1) == 1700);
|
||||
CHECK(d.setDAC(-1, di::VCMP_LL, 0) == -1);
|
||||
CHECK(d.setDAC(-1, di::THRESHOLD, 0) == -1);
|
||||
CHECK(d.setDAC(-1, di::THRESHOLD, 0, 0) == -1);
|
||||
CHECK(d.setDAC(-1, di::THRESHOLD, 0, 1) == -1);
|
||||
|
@ -102,8 +102,8 @@ TEST_CASE("single EIGER detector no receiver basic set and get",
|
||||
|
||||
// Setting and reading exposure time
|
||||
auto t = 1000000000;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, t);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME) == t);
|
||||
d.setExptime(t);
|
||||
CHECK(d.getExptime() == t);
|
||||
|
||||
// size of an eiger half module with and without gap pixels
|
||||
CHECK(d.getTotalNumberOfChannels() == 256 * 256 * 4);
|
||||
@ -143,8 +143,8 @@ TEST_CASE("Locking mechanism and last ip", "[.integration][.single]") {
|
||||
|
||||
// Can we still access the detector while it's locked
|
||||
auto t = 1300000000;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, t);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME) == t);
|
||||
d.setExptime(t);
|
||||
CHECK(d.getExptime() == t);
|
||||
|
||||
// unlock again and free
|
||||
d.lockServer(0);
|
||||
@ -163,12 +163,12 @@ TEST_CASE("Set settings", "[.integration][.single]"){
|
||||
|
||||
TEST_CASE("Timer functions", "[.integration][cli]") {
|
||||
// FRAME_NUMBER, /**< number of real time frames: total number of
|
||||
// acquisitions is number or frames*number of cycles */ ACQUISITION_TIME,
|
||||
// acquisitions is number or frames*number of triggers */ ACQUISITION_TIME,
|
||||
// /**< exposure time */ FRAME_PERIOD, /**< period between exposures */
|
||||
// DELAY_AFTER_TRIGGER, /**< delay between trigger and start of exposure or
|
||||
// readout (in triggered mode) */ GATES_NUMBER, /**< number of gates per
|
||||
// frame (in gated mode) */ CYCLES_NUMBER, /**< number of cycles: total
|
||||
// number of acquisitions is number or frames*number of cycles */
|
||||
// frame (in gated mode) */ TRIGGER_NUMBER, /**< number of triggers: total
|
||||
// number of acquisitions is number or frames*number of triggers */
|
||||
// ACTUAL_TIME, /**< Actual time of the detector's internal timer */
|
||||
// MEASUREMENT_TIME, /**< Time of the measurement from the detector (fifo)
|
||||
// */
|
||||
@ -190,49 +190,38 @@ TEST_CASE("Timer functions", "[.integration][cli]") {
|
||||
|
||||
// Number of frames
|
||||
auto frames = 5;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::FRAME_NUMBER, frames);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::FRAME_NUMBER) == frames);
|
||||
d.setNumberOfFrames(frames);
|
||||
CHECK(d.getNumberOfFrames() == frames);
|
||||
|
||||
auto exptime = 2000000000;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, exptime);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME) == exptime);
|
||||
d.setExptime(exptime);
|
||||
CHECK(d.getExptime() == exptime);
|
||||
|
||||
auto period = 2000000000;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::FRAME_PERIOD, period);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::FRAME_PERIOD) == period);
|
||||
d.setPeriod(period);
|
||||
CHECK(d.getPeriod() == period);
|
||||
|
||||
if (test::type != dt::EIGER) {
|
||||
auto delay = 10000;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::DELAY_AFTER_TRIGGER, delay);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::DELAY_AFTER_TRIGGER) ==
|
||||
d.setDelayAfterTrigger(delay);
|
||||
CHECK(d.getDelayAfterTrigger() ==
|
||||
delay);
|
||||
}
|
||||
|
||||
if (test::type != dt::EIGER) {
|
||||
auto gates = 1;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::GATES_NUMBER, gates);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::GATES_NUMBER) == gates);
|
||||
}
|
||||
|
||||
auto cycles = 2;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::CYCLES_NUMBER, cycles);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::CYCLES_NUMBER) == cycles);
|
||||
auto triggers = 2;
|
||||
d.setNumberOfTriggers(triggers);
|
||||
CHECK(d.getNumberOfTriggers() == triggers);
|
||||
|
||||
if (test::type == dt::EIGER) {
|
||||
auto subtime = 200;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::SUBFRAME_ACQUISITION_TIME,
|
||||
subtime);
|
||||
CHECK(d.setTimer(
|
||||
slsDetectorDefs::timerIndex::SUBFRAME_ACQUISITION_TIME) ==
|
||||
subtime);
|
||||
d.setSubExptime(subtime);
|
||||
CHECK(d.getSubExptime() == subtime);
|
||||
}
|
||||
// for (int i =0; i!=frames; ++i)
|
||||
d.startAndReadAll();
|
||||
|
||||
d.freeSharedMemory();
|
||||
|
||||
// If we add a timer we should add tests for the timer
|
||||
CHECK(slsDetectorDefs::MAX_TIMERS == 19);
|
||||
}
|
||||
|
||||
// TEST_CASE("Aquire", "[.integration][eiger]"){
|
||||
@ -243,13 +232,13 @@ TEST_CASE("Timer functions", "[.integration][cli]") {
|
||||
|
||||
// auto period = 1000000000;
|
||||
// auto exptime = 100000000;
|
||||
// d.setTimer(slsDetectorDefs::timerIndex::FRAME_NUMBER, 5);
|
||||
// d.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, exptime);
|
||||
// d.setTimer(slsDetectorDefs::timerIndex::FRAME_PERIOD, period);
|
||||
// d.setNumberOfFrames(5);
|
||||
// d.setExptime(exptime);
|
||||
// d.setPeriod(period);
|
||||
// d.startAndReadAll();
|
||||
|
||||
// auto rperiod =
|
||||
// d.getTimeLeft(slsDetectorDefs::timerIndex::MEASURED_PERIOD);
|
||||
// d.getMeasuredPeriod();
|
||||
// CHECK(rperiod == 0.1);
|
||||
|
||||
// d.freeSharedMemory();
|
||||
@ -474,7 +463,7 @@ TEST_CASE("Eiger or Jungfrau startingfnum", "[.eigerintegration][.jungfrauintegr
|
||||
REQUIRE(((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER) || (m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::JUNGFRAU)));
|
||||
REQUIRE(m.getHostname() == c.hostname);
|
||||
|
||||
CHECK(m.setTimer(slsDetectorDefs::FRAME_NUMBER, 1) == 1);
|
||||
CHECK(m.setNumberOfFrames(1) == 1);
|
||||
|
||||
// starting fnum
|
||||
uint64_t val = 8;
|
||||
|
@ -50,7 +50,7 @@ TEST_CASE("Set and read timers", "[.integration][.multi]") {
|
||||
|
||||
// DELAY_AFTER_TRIGGER,
|
||||
// GATES_NUMBER,
|
||||
// CYCLES_NUMBER,
|
||||
// TRIGGER_NUMBER,
|
||||
// ACTUAL_TIME
|
||||
// MEASUREMENT_TIME
|
||||
|
||||
|
@ -353,19 +353,19 @@ In the case of REAL CONTINUOUS readout, i.e. continuous acquire and readout from
|
||||
\begin{table}
|
||||
\begin{tabular}{|c|c|c|c|c|}
|
||||
\hline
|
||||
\tiny{GbE} & \tiny{dynamic range} & \tiny{continuos maximum frame rate(Hz)} & \tiny{minimum period ($\mu$s)}& \tiny{time to send out data ($\mu$s)}\\
|
||||
\tiny{GbE} & \tiny{dynamic range} & \tiny{continuos maximum frame rate(Hz)} & \tiny{minimum period ($\mu$s)}& \tiny{calculated/measered time to send out data ($\mu$s)}\\
|
||||
\hline
|
||||
1 & 16 & \textbf{256} & 3901 & \\
|
||||
\hline
|
||||
1 & 32 & \textbf{128} & 7820 & \\
|
||||
\hline
|
||||
10 & 4 & \textbf{10240} & 98 & 100\\
|
||||
10 & 4 & \textbf{10240} & 98 & 105/128\\
|
||||
\hline
|
||||
10 & 8 & \textbf{5120} & 196 & 200\\
|
||||
10 & 8 & \textbf{5120} & 196 & 210/250\\
|
||||
\hline
|
||||
10 & 16 & \textbf{2560} & 391 & 400\\
|
||||
10 & 16 & \textbf{2560} & 391 & 420/490\\
|
||||
\hline
|
||||
10 & 32 & \textbf{1280} & 782 & 800\\
|
||||
10 & 32 & \textbf{1280} & 782 & 840/977\\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\caption{Frame rate limits for the CONTINUOS streaming out of images, i.e. the data rate out is just below 1Gb/s or 10Gb/s. 1280~Hz for 32-bit, 10GbE is obtained from the 10GbE limitation. The maximum achievable frame rate is 977~Hz.}
|
||||
@ -609,17 +609,17 @@ The detector can be setup such to receive external triggers. Connect a LEMO sign
|
||||
\begin{verbatim}
|
||||
sls_detector_put 0-timing [auto/trigger/burst_trigger/gating]
|
||||
sls_detector_put 0-frames x
|
||||
sls_detector_put 0-cycles y
|
||||
sls_detector_put 0-triggers y
|
||||
sls_detector_acquire 0-
|
||||
\end{verbatim}
|
||||
No timeout is expected between the start of the acquisition and the arrival of the first trigger.
|
||||
|
||||
Here are the implemented options so far:
|
||||
\begin{itemize}
|
||||
\item {\tt{auto}} is the software controlled acquisition (does not use triggers), where {\tt{exptime}} and {\tt{period}} have to be set. Set number of cycles (i.e. triggers) to 1 using {\tt{cycles}}. Set number of frames using {\tt{frames}}.
|
||||
\item {\tt{trigger}} 1 frame taken for 1 trigger. Your {\tt{frames}} needs to be 1 always, {\tt{cycles}} can be changed and defines how many triggers are considered. {\tt{exptime}} needs to be set. In the GUI this is called trigger exposure series.
|
||||
\item {\tt{burst\_trigger}} gets only 1 trigger, but allows to take many frames. With {\tt{frames}} one can change the number of frames. {\tt{cycles}} needs to be 1. {\tt{exptime}} and {\tt{period}} have to be set. In the gui it is called trigger readout.
|
||||
\item{\tt{gating}} allows to get a frame only when the trigger pulse is gating. Note that in this case the exp time and period only depend on the gating signal. {\tt{cycles}} allows to select how many gates to consider. Set number of frames to 1 using {\tt{frames}}. IMPORTANT: Up to firmware 23, the last subframe is oblige to finish being taken, despite the gate signal going down. This will be configurable from later fw and software version. Also, in gating mode, due to timimg of the state machine, you need to leave 500~$\mu$s deadtime between the end on an acquisition and the next. This is as the state machine is unable to check for changes in the status in the first 500~$\mu$s. ATTENTION: if you are in 16 bit mode and you are applying online rate corrections, as now the exptime is generated by the trigger, you might not have correct rate corrections. If you know what the exposure time is in the gating signal, then you can set the {\tt{exptime}} once and the rate corrections will be correct. In 32 bit mode, it does not matter as the rate corrections depends on the {\tt{subexptime}} which is software set independently from the gate exptime.
|
||||
\item {\tt{auto}} is the software controlled acquisition (does not use triggers), where {\tt{exptime}} and {\tt{period}} have to be set. Set number of triggers (i.e. triggers) to 1 using {\tt{triggers}}. Set number of frames using {\tt{frames}}.
|
||||
\item {\tt{trigger}} 1 frame taken for 1 trigger. Your {\tt{frames}} needs to be 1 always, {\tt{triggers}} can be changed and defines how many triggers are considered. {\tt{exptime}} needs to be set. In the GUI this is called trigger exposure series.
|
||||
\item {\tt{burst\_trigger}} gets only 1 trigger, but allows to take many frames. With {\tt{frames}} one can change the number of frames. {\tt{triggers}} needs to be 1. {\tt{exptime}} and {\tt{period}} have to be set. In the gui it is called trigger readout.
|
||||
\item{\tt{gating}} allows to get a frame only when the trigger pulse is gating. Note that in this case the exp time and period only depend on the gating signal. {\tt{triggers}} allows to select how many gates to consider. Set number of frames to 1 using {\tt{frames}}. IMPORTANT: Up to firmware 23, the last subframe is oblige to finish being taken, despite the gate signal going down. This will be configurable from later fw and software version. Also, in gating mode, due to timimg of the state machine, you need to leave 500~$\mu$s deadtime between the end on an acquisition and the next. This is as the state machine is unable to check for changes in the status in the first 500~$\mu$s. ATTENTION: if you are in 16 bit mode and you are applying online rate corrections, as now the exptime is generated by the trigger, you might not have correct rate corrections. If you know what the exposure time is in the gating signal, then you can set the {\tt{exptime}} once and the rate corrections will be correct. In 32 bit mode, it does not matter as the rate corrections depends on the {\tt{subexptime}} which is software set independently from the gate exptime.
|
||||
|
||||
When using 32-bit mode, by default the acquisition ends the last complete subframe that was started when still the acquisition time was valid. This has been chosen as many people wants to know the exact acquisition time for when the detector was taking data and also, if {\tt{ratecorr}} are active, the last subframe will be correctly corrected, while otherwise it will be corrected with a wrong subdeadtime.
|
||||
However, from 4.1.0, in gating mode, an option to immediately terminate the subframe when the gate signal goes down it is implemented to stop the acquisition at the same time. This option is {\tt{./sls\_detector\_put interruptsubframe 1}} while the default option is {\tt{./sls\_detector\_put interruptsubframe 0}}.
|
||||
@ -628,13 +628,13 @@ However, from 4.1.0, in gating mode, an option to immediately terminate the subf
|
||||
|
||||
Hardware-wise, the ENABLE OUT signal outputs when the chips are really acquiring. This means that the single subframes will be output in 32 bit mode. The TRIGGER OUT outputs the sum-up-signal at the moment (which is useless). This will be changed in the future to output the envelop of the enable signal.
|
||||
|
||||
We are planning to change some functionality, i.e. unify the {\tt{trigger}} and {\tt{burst\_trigger}} trigger modes and make both {\tt{frames}} and {\tt{cycles}} configurable at the same time.
|
||||
We are planning to change some functionality, i.e. unify the {\tt{trigger}} and {\tt{burst\_trigger}} trigger modes and make both {\tt{frames}} and {\tt{triggers}} configurable at the same time.
|
||||
|
||||
There is the possibility to use {\tt{timing trigger/burst\_trigger}} and send software single commands to fake the trigger. This is done with:
|
||||
\begin{verbatim}
|
||||
sls_detector_put 0-timing [trigger/burst_trigger]
|
||||
sls_detector_put 0-frames x
|
||||
sls_detector_put 0-cycles y
|
||||
sls_detector_put 0-triggers y
|
||||
sls_detector_status trigger
|
||||
\end{verbatim}
|
||||
Note that this functionality is very (!) useful if you need to do something between and acquisition and the next. This can be used to do a fast threshold scan for example. See section~\ref{sec:fastthresholdscan}.
|
||||
@ -715,7 +715,7 @@ If \textbf{dr} is 32 and \textbf{clkdivider} is not 2, whatever the detector get
|
||||
Here is a list of parameters that should be reset:
|
||||
\begin{enumerate}
|
||||
\item \textbf{resetframescaught} should be reset to zero after every acquisition taken with {\tt{receiver start}},{\tt{status start}},{\tt{receiver stop}}. If the acquisition is taken with {\tt{sls\_detector\_acquire}}, there is no need to reset this.
|
||||
\item After changing the {\tt{timing}} mode of the detector, one should reset to '1' the unused value, in that specific timing mode, between \textbf{frames} and \textbf{cycles}. See section~\ref{triggering} for how to use the timing. At the present moment the detector will acquire more frames than planned if the variable not used between \textbf{frames} and \textbf{cycles} is not reset. In future releases, the unused variable will be ignored. Still resetting is a good practice.
|
||||
\item After changing the {\tt{timing}} mode of the detector, one should reset to '1' the unused value, in that specific timing mode, between \textbf{frames} and \textbf{triggers}. See section~\ref{triggering} for how to use the timing. At the present moment the detector will acquire more frames than planned if the variable not used between \textbf{frames} and \textbf{triggers} is not reset. In future releases, the unused variable will be ignored. Still resetting is a good practice.
|
||||
|
||||
\end{enumerate}
|
||||
|
||||
@ -794,9 +794,23 @@ Transmission delays should be chosen only to accomodate the writing speed of the
|
||||
Table~\ref{tcont} gives the times that are needed to transfer 1 images out of the 10~Gb Ethernet connection. This reflects the CONTINUOS frame rate achieavable. The disk speed can be monitored with {\tt{dstat}}. One you have worked out this, you can calculated the {\tt{txndelay\_frame}} delay as:
|
||||
|
||||
\begin{equation}
|
||||
{\tt{txndelay\_frame}}=-tsending+dr \cdot \frac{4*256*256*N\_half\_modules}{1024 \cdot 1000 \cdot disk\_speed [MB/s]}
|
||||
{\tt{txndelay\_frame}}=-t_sending+dr \cdot \frac{4*256*256*N\_half\_modules}{1024 \cdot 1000 \cdot disk\_speed [MB/s] \cdot 8}
|
||||
\end{equation}
|
||||
In 4-bit mode, for a disk seed of 320MB/s, the {\tt{txndelay\_frame}} is 300~$\mu$s (30000 to be set up to the detector). The sending time is 100~$\mu$s, such that an total ackievable writing sped of 1/400~$\mu$s (2.5~kHz) in achieved.
|
||||
In 4-bit mode, for a disk seed of 320MB/s, the {\tt{txndelay\_frame}} is 300~$\mu$s (30000 to be set up to the detector). The sending time is 100~$\mu$s, such that an total ackievable writing speed of 1/400~$\mu$s (2.5~kHz) in achieved.
|
||||
|
||||
Note that:
|
||||
\begin{enumerate}
|
||||
\item The continuos frame rate goes down when transmission delays are introduced:
|
||||
\begin{equation}
|
||||
continuos\_frame\_rate= \frac{1}{\tt{txndelay\_frame}+t\_sending}
|
||||
\end{equation}
|
||||
\item If your transmission delays reduce the continuos frame rate, you will saturate the memory on board at some point and you will corrupt images. Conservatively, we say that the number of maximum images in buffered mode is the one listed in table~\ref{timgs}, call N\_images. However, one can approximately say that (and here we need to test more, so do not believe to these numbers yet),
|
||||
\begin{equation}
|
||||
N\_tot\_images= N\_images+\frac{ N\_images}{frame\_rate \cdot (t\_delay\_frame + t\_sending) }
|
||||
\end{equation}
|
||||
|
||||
\end{enumerate}
|
||||
|
||||
|
||||
\section{Setting up the PC settings for 10Gb}\label{10g}
|
||||
|
||||
@ -818,12 +832,8 @@ ethtool -G xth1 rx 4096 #or wheterver is the max number for your pc
|
||||
ethtool -C xth1 rx-usecs 100
|
||||
ethtool -A xth1 rx on
|
||||
\end{verbatim}
|
||||
where {\tt{xth1}} can be replaced with the correct 10Gb device. To minimise loosing packets, priorities are set better as root user, so have the receiver as root.
|
||||
To try to bypass being root, we trued something like this:
|
||||
\begin{verbatim}
|
||||
/etc/security/limits.conf username – rtprio 99
|
||||
\end{verbatim}
|
||||
but somehow it did not fully worked so we kept the trick of being root.
|
||||
where {\tt{xth1}} can be replaced with the correct 10Gb device.
|
||||
NOTE THAT THIS SETTINGS WILL BE LOST IF YOU REBOOT THE COMPUTER.
|
||||
|
||||
Very important is to activate the flow control in 10Gb (in 1Gb it is on by default and not configurable)
|
||||
\begin{verbatim}
|
||||
@ -857,10 +867,18 @@ to make the settings permanent, edit /etc/sysctl.conf:
|
||||
\begin{verbatim}
|
||||
# 100MiB
|
||||
net.core.rmem_max = 104857600
|
||||
net.core.rmem_default= 104857600
|
||||
net.core.netdev_max_backlog = 250000
|
||||
\end{verbatim}
|
||||
and run \textbf{sysctl -p}.
|
||||
|
||||
To minimise loosing packets, priorities are set better as root user, so have the receiver as root.
|
||||
To try to bypass being root, we trued something like this:
|
||||
\begin{verbatim}
|
||||
/etc/security/limits.conf username – rtprio 99
|
||||
\end{verbatim}
|
||||
but somehow it did not fully worked so we kept the trick of being root.
|
||||
|
||||
Last, you can disable power saving in the CPU frequency (chose the appropriate command for your system):
|
||||
\begin{verbatim}
|
||||
cpupower frequency-info
|
||||
@ -895,9 +913,6 @@ mount -t tmpfs none /mnt/ramdisk -o size=10G
|
||||
\end{verbatim}
|
||||
check how many GB memory you can allocate, to avoid swapping otherwise
|
||||
|
||||
|
||||
|
||||
|
||||
\section{Offline processing and monitoring}
|
||||
|
||||
\subsection{Data out of the detector: UDP packets}\label{UDP}
|
||||
@ -935,19 +950,22 @@ If you use the option of writing raw files, you will have a raw file for each UD
|
||||
The master file is named: {\tt{filename\_master\_0.raw}} and for version ``4.0.0'' of the slsDetectorSoftware looks like:
|
||||
|
||||
\begin{verbatim}
|
||||
Version : 2.0
|
||||
Version : 4.0
|
||||
Detector Type : 3
|
||||
Dynamic Range : 32
|
||||
Ten Giga : 1
|
||||
Image Size : 524288 bytes
|
||||
x : 512 pixels
|
||||
y : 256 pixels
|
||||
Max. Frames Per File : 10000
|
||||
Total Frames : 1
|
||||
Exptime (ns) : 1000000000
|
||||
nPixelsX : 512 pixels
|
||||
nPixelsY : 256 pixels
|
||||
Max Frames Per File : 10000
|
||||
Total Frames : 3
|
||||
Exptime (ns) : 10000000
|
||||
SubExptime (ns) : 2621440
|
||||
SubPeriod(ns) : 2621440
|
||||
Period (ns) : 1000000000
|
||||
Timestamp : Mon Sep 3 09:07:05 2018
|
||||
Period (ns) : 0
|
||||
Gap Pixels Enable : 0
|
||||
Quad Enable : 0
|
||||
Timestamp : Wed Aug 21 16:30:20 2019
|
||||
|
||||
|
||||
#Frame Header
|
||||
@ -957,9 +975,9 @@ Packet Number : 4 bytes
|
||||
Bunch ID : 8 bytes
|
||||
Timestamp : 8 bytes
|
||||
Module Id : 2 bytes
|
||||
X Coordinate : 2 bytes
|
||||
Y Coordinate : 2 bytes
|
||||
Z Coordinate : 2 bytes
|
||||
Row : 2 bytes
|
||||
Column : 2 bytes
|
||||
Reserved : 2 bytes
|
||||
Debug : 4 bytes
|
||||
Round Robin Number : 2 bytes
|
||||
Detector Type : 1 byte
|
||||
@ -972,15 +990,15 @@ Note that if one wants to reconstruct the real time the detector was acquiring
|
||||
\subsection{Offline image reconstruction}
|
||||
The offline image reconstruction{\tt{slsImageReconstruction}} is not part of the package anymore. The code is still available doing \\
|
||||
{\tt{git clone git@git.psi.ch:sls\_detectors\_software/sls\_image\_reconstruction.git slsImageReconstruction}}.
|
||||
Checkout the {\tt{developer}} branch if in a 3.1.X release or the {\tt{v4.0.0}} branch if in 4.0.X release of the {\tt{slsDetector}} code.
|
||||
Checkout the {\tt{developer}} branch if in a 3.1.X release, the {\tt{v4.0.0}} branch if in 4.0.X release, or the {\tt{v4.1}} branch if in 4.1.X release of the {\tt{slsDetector}} code.
|
||||
|
||||
Three possible conversions are possible: into \textbf{cbf}, \textbf{hdf5} and \textbf{root} format. The detector writes 4 raw files per receiver. An offline image reconstruction executable has been written to collate the possible files together and produce output files. By default an interpolation between the values of the large pixels is performed. Gap pixels between modules are also inserted.
|
||||
|
||||
Note that the number of images per file is hardcoded and needs to match whatever you are using in {\tt{slsDetectorsPackage/slsReceiverSoftware/include/sls\_receiver\_defs.h}}:
|
||||
Note that the number of images per file in the 3.1.X release is hardcoded and needs to match whatever you are using in {\tt{slsDetectorsPackage/slsReceiverSoftware/include/sls\_receiver\_defs.h}}:
|
||||
\begin{verbatim}
|
||||
#define EIGER_MAX_FRAMES_PER_FILE 2000
|
||||
\end{verbatim}
|
||||
The default is 2000.
|
||||
The default is 2000 in the 3.1.X release. The default has been changed to 10000 frm realease 4.0.X and now this is picked up automatically without doing anything.
|
||||
|
||||
\subsubsection{cbf}
|
||||
The cbf executable executable uses the CBFlib-0.9.5 library (downloaded from the web as it downloads architecture dependent packages at installation).Edit the Makefile to correclty point at it.\\
|
||||
@ -1239,7 +1257,7 @@ We have also been requested if we could speed up the threshold scan. At the mome
|
||||
./sls_detector_put enablefwrite 0
|
||||
./sls_detector_put resetframescaught 0
|
||||
./sls_detector_put index 0
|
||||
./sls_detector_put cycles 21
|
||||
./sls_detector_put triggers 21
|
||||
./sls_detector_put receiver start
|
||||
./sls_detector_put status start
|
||||
for i in $(seq 0 20);
|
||||
@ -1497,8 +1515,8 @@ frames number
|
||||
where {\tt{number}} is a string to be interpreted as an integer.
|
||||
|
||||
\item \begin{verbatim}
|
||||
sls_detector_get cycles
|
||||
cycles number
|
||||
sls_detector_get triggers
|
||||
triggers number
|
||||
\end{verbatim}
|
||||
where {\tt{number}} is a string to be interpreted as an integer.
|
||||
|
||||
|
@ -111,7 +111,7 @@
|
||||
"delay"; // sets/gets delay after trigger in s
|
||||
"gates"; // sets/gets number of gates per frame in gated mode
|
||||
"frames"; // sets/gets number of frames
|
||||
"cycles"; // sets/gets number of cycles (use in trigger mode)
|
||||
"triggers"; // sets/gets number of triggers (use in trigger mode)
|
||||
"probes"; // sets/gets number of probes (advanced!)
|
||||
"measurements"; // sets/gets number of non-real time measurements
|
||||
/* read only timers */
|
||||
@ -120,7 +120,7 @@
|
||||
"delayl"; // gets delay left
|
||||
"gatesl"; // gets number of gates left
|
||||
"framesl"; // gets number of frames left
|
||||
"cyclesl"; // gets number of cycles left
|
||||
"triggersl"; // gets number of triggers left
|
||||
"now"; // gets time stamp from the dteector
|
||||
"timestamp"; // gets time stamp for the frames (fifo-style)
|
||||
"framescaught";// gets the entire frames caught by receiver
|
||||
|
@ -94,7 +94,7 @@ where: \\
|
||||
\textit{v0} is the scan0 variable with the desired precision, if scan0 is enabled;\\
|
||||
\textit{v1} is the scan1 variable with the desired precision, if scan1 is enabled;\\
|
||||
\textit{p} is the position index, if different positions are configured;\\
|
||||
\textit{f} is the frame index of the first frame stored in the file, if many frames and cycles are configured;\\
|
||||
\textit{f} is the frame index of the first frame stored in the file, if many frames and triggers are configured;\\
|
||||
\textit{i} is the file index;\\
|
||||
\textit{ext} is the file extension e.g. \textit{.raw} for MYTHEN and \E raw data, \textit{.dat} for MYTHEN processed data.
|
||||
\item[index i] Sets the starting index of the file i at the beginning of the acquisition (automatically incremented for each measurement).
|
||||
@ -115,10 +115,10 @@ Sets the number of gates per frame in gated (stroboscopic) mode.\\
|
||||
Refer to the detailed documentation to understand how the different timing modes work.
|
||||
\item[frames n]
|
||||
Sets the number of frames acquired sequentially per cycle (e.g. after each trigger), with the exposure time defined by exptime and the period defined by period (unless in gated mode). The frame index in the output file name will automatically be incremented.\\
|
||||
Note that the total number of images will be frames times cycles. Refer to detailed documentation to understand how the different timing modes work.
|
||||
\item[cycles n]
|
||||
Sets the number of cycles (e.g. number of triggers). The frame index in the output file name will automatically be incremented. \\
|
||||
Note that the total number of images will be by frames times cycles. Refer to the detailed documentation to understand how the different timing modes work.
|
||||
Note that the total number of images will be frames times triggers. Refer to detailed documentation to understand how the different timing modes work.
|
||||
\item[triggers n]
|
||||
Sets the number of triggers (e.g. number of triggers). The frame index in the output file name will automatically be incremented. \\
|
||||
Note that the total number of images will be by frames times triggers. Refer to the detailed documentation to understand how the different timing modes work.
|
||||
\item[probes] Sets the number of probes to accumulate for stroboscopic measurements. \\
|
||||
Refer to detailed documentation to understand how the different timing modes work.
|
||||
\item[measurements] Sets the number of repetitions of the acquisitions (non real time!). The file index in the file name will be automatically incremented.\\
|
||||
@ -231,7 +231,7 @@ It is normally recommended to use \verb=sls\_detector\_acquire [j-]=, which take
|
||||
%\item[delayl]
|
||||
%\item[gatesl]
|
||||
%\item[framesl]
|
||||
%\item[cyclesl]
|
||||
%\item[triggersl]
|
||||
%\item[frameindex]
|
||||
%\item[now]
|
||||
\end{description}
|
||||
@ -430,11 +430,11 @@ Returns the number of gates per frame in gated (stroboscopic) mode.
|
||||
Refer to detailed documentation to understand how the different timing modes work.
|
||||
\item[frames]
|
||||
Returns the number of frames acquired sequentially per cycle (e.g. after each trigger), with the exposure time defined by exptime and the period defined by period (unless in gated mode). Returned as a string to be interpreted as an integer ``frames integer''
|
||||
Note that the total number of images is frames times cycles.
|
||||
Note that the total number of images is frames times triggers.
|
||||
Refer to detailed documentation to understand how the different timing modes work.
|
||||
\item[cycles n]
|
||||
Returns the number of cycles (e.g. number of triggers). Returned as atring to be interpreted as an integer ``cycles integer''
|
||||
Note that the total number of images is frames times cycles.
|
||||
\item[triggers n]
|
||||
Returns the number of triggers (e.g. number of triggers). Returned as atring to be interpreted as an integer ``triggers integer''
|
||||
Note that the total number of images is frames times triggers.
|
||||
Refer to detailed documentation to understand how the different timing modes work.
|
||||
\item[probes] Returns the number of probes to accumulate for stroboscopic measurements.
|
||||
Refer to detailed documentation to understand how the different timing modes work.
|
||||
@ -556,7 +556,7 @@ It is normally recommended to use \verb=sls\_detector\_acquire [j-]=, which take
|
||||
\item[delayl] Returns the delay after trigger left for the current frame.
|
||||
\item[gatesl] Returns the number of gates left for the current frame.
|
||||
\item[framesl] Returns the number of frames left for the current cycle.
|
||||
\item[cyclesl] Returns the number of cycles left for the current acquisition.
|
||||
\item[triggersl] Returns the number of triggers left for the current acquisition.
|
||||
\item[now] Returns the current timestamp of the detector clock.
|
||||
\item[timestamp] Returns the timestamp of the acquisitions in a First-In/First-Out mode i.e. every time it is called it returns the timestamp of the first acquisition start of readout. The FIFO is reset everytime the acquisition is started.
|
||||
\end{description}
|
||||
|
@ -217,7 +217,7 @@ is used to configure the detector parameter var
|
||||
\item[delay t] Sets the delay after trigger (in s)
|
||||
\item[gates n] Sets the number of gates per frame
|
||||
\item[frames n] Sets the number of frames per cycle (e.g. after each trigger)
|
||||
\item[cycles n] Sets the number of cycles (e.g. number of triggers)
|
||||
\item[triggers n] Sets the number of triggers (e.g. number of triggers)
|
||||
\item[probes n] Sets the number of probes to accumulate (max 3)
|
||||
\item[dr n] Sets the dynamic range - can be (1,) 4, 8,16 or 24 bits
|
||||
\item[flags mode] Sets the readout flags - can be none or storeinram
|
||||
@ -298,7 +298,7 @@ is used to retrieve the detector parameter var
|
||||
\item[delay] Gets the delay after trigger (in s)
|
||||
\item[gates] Gets the number of gates per frame
|
||||
\item[frames] Gets the number of frames per cycle (e.g. after each trigger)
|
||||
\item[cycles] Gets the number of cycles (e.g. number of triggers)
|
||||
\item[triggers] Gets the number of triggers (e.g. number of triggers)
|
||||
\item[probes] Gets the number of probes to accumulate (max 3)
|
||||
\item[timestamp] Gets the internal time stamp of the nex frame acquired (i.e. during an acquisition, all timestamps of the frames are stored in a FIFO which can be read after the acquisition - returns -1 if the FIFO is empty)
|
||||
\item[dr] Gets the dynamic range
|
||||
|
@ -372,7 +372,7 @@ gs 1 -1 sc (Number of frames) col0 sh gr
|
||||
gs 1 -1 sc (Number of frames) col0 sh gr
|
||||
/Times-Roman ff 450.00 scf sf
|
||||
11325 9150 m
|
||||
gs 1 -1 sc (Number of cycles) col0 sh gr
|
||||
gs 1 -1 sc (Number of triggers) col0 sh gr
|
||||
/Times-Roman ff 240.00 scf sf
|
||||
5325 4950 m
|
||||
gs 1 -1 sc (Readout) col0 sh gr
|
||||
|
@ -118,7 +118,7 @@ Single
|
||||
21900 2700 22050 2700
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 6975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 15975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of cycles\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of triggers\001
|
||||
4 0 0 50 0 0 16 0.0000 4 165 810 5325 4950 Readout\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 2565 825 4125 Detection time\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 1785 825 5550 Dead time\001
|
||||
|
@ -95,7 +95,7 @@ Single
|
||||
4 0 0 50 0 0 30 0.0000 4 405 2580 9450 6600 Exposure time\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 6975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 15975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of cycles\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of triggers\001
|
||||
4 0 0 50 0 0 16 0.0000 4 165 810 5325 4950 Readout\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 2565 1050 4125 Detection time\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 1785 1050 5550 Dead time\001
|
||||
|
@ -341,7 +341,7 @@ gs 1 -1 sc (Number of frames) col0 sh gr
|
||||
gs 1 -1 sc (Number of frames) col0 sh gr
|
||||
/Times-Roman ff 450.00 scf sf
|
||||
11325 9150 m
|
||||
gs 1 -1 sc (Number of cycles) col0 sh gr
|
||||
gs 1 -1 sc (Number of triggers) col0 sh gr
|
||||
/Times-Roman ff 240.00 scf sf
|
||||
5325 4950 m
|
||||
gs 1 -1 sc (Readout) col0 sh gr
|
||||
|
@ -79,7 +79,7 @@ Single
|
||||
4200 5850 4650 5850
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 6975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 15975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of cycles\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of triggers\001
|
||||
4 0 0 50 0 0 16 0.0000 4 165 810 5325 4950 Readout\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 2565 825 4125 Detection time\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 1785 825 5550 Dead time\001
|
||||
|
@ -118,7 +118,7 @@ Single
|
||||
21900 2700 22050 2700
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 6975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 15975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of cycles\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of triggers\001
|
||||
4 0 0 50 0 0 16 0.0000 4 165 810 5325 4950 Readout\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 2565 825 4125 Detection time\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 1785 825 5550 Dead time\001
|
||||
|
@ -401,7 +401,7 @@ gs 1 -1 sc (External trigger) col0 sh gr
|
||||
gs 1 -1 sc (Number of frames) col0 sh gr
|
||||
/Times-Roman ff 450.00 scf sf
|
||||
12600 9150 m
|
||||
gs 1 -1 sc (Number of cycles) col0 sh gr
|
||||
gs 1 -1 sc (Number of triggers) col0 sh gr
|
||||
/Times-Roman ff 240.00 scf sf
|
||||
6600 4950 m
|
||||
gs 1 -1 sc (Readout) col0 sh gr
|
||||
|
@ -111,7 +111,7 @@ Single
|
||||
4 0 0 50 0 0 30 0.0000 4 300 1785 825 5550 Dead time\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 2760 825 2700 External trigger\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 8250 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 12600 9150 Number of cycles\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 12600 9150 Number of triggers\001
|
||||
4 0 0 50 0 0 16 0.0000 4 165 810 6600 4950 Readout\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 2580 4575 6225 Exposure time\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 1140 9525 6225 Period\001
|
||||
|
@ -79,7 +79,7 @@ Single
|
||||
4200 5850 4650 5850
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 6975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 15975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of cycles\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of triggers\001
|
||||
4 0 0 50 0 0 16 0.0000 4 165 810 5325 4950 Readout\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 2565 825 4125 Detection time\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 1785 825 5550 Dead time\001
|
||||
|
@ -217,7 +217,7 @@ is used to configure the detector parameter var
|
||||
\item[delay t] Sets the delay after trigger (in s)
|
||||
\item[gates n] Sets the number of gates per frame
|
||||
\item[frames n] Sets the number of frames per cycle (e.g. after each trigger)
|
||||
\item[cycles n] Sets the number of cycles (e.g. number of triggers)
|
||||
\item[triggers n] Sets the number of triggers (e.g. number of triggers)
|
||||
\item[probes n] Sets the number of probes to accumulate (max 3)
|
||||
\item[dr n] Sets the dynamic range - can be (1,) 4, 8,16 or 24 bits
|
||||
\item[flags mode] Sets the readout flags - can be none or storeinram
|
||||
@ -298,7 +298,7 @@ is used to retrieve the detector parameter var
|
||||
\item[delay] Gets the delay after trigger (in s)
|
||||
\item[gates] Gets the number of gates per frame
|
||||
\item[frames] Gets the number of frames per cycle (e.g. after each trigger)
|
||||
\item[cycles] Gets the number of cycles (e.g. number of triggers)
|
||||
\item[triggers] Gets the number of triggers (e.g. number of triggers)
|
||||
\item[probes] Gets the number of probes to accumulate (max 3)
|
||||
\item[timestamp] Gets the internal time stamp of the nex frame acquired (i.e. during an acquisition, all timestamps of the frames are stored in a FIFO which can be read after the acquisition - returns -1 if the FIFO is empty)
|
||||
\item[dr] Gets the dynamic range
|
||||
|
@ -127,7 +127,7 @@ where: \\
|
||||
\textit{v0} is the scan0 variable with the desired precision, if scan0 is enabled;\\
|
||||
\textit{v1} is the scan1 variable with the desired precision, if scan1 is enabled;\\
|
||||
\textit{p} is the position index, if different positions are configured;\\
|
||||
\textit{f} is the frame index of the first frame stored in the file, if many frames and cycles are configured;\\
|
||||
\textit{f} is the frame index of the first frame stored in the file, if many frames and triggers are configured;\\
|
||||
\textit{i} is the file index;\\
|
||||
\textit{ext} is the file extension e.g. \textit{.raw} for MYTHEN raw data, \textit{.dat} for MYTHEN processed data.
|
||||
|
||||
@ -241,7 +241,7 @@ Figure~\ref{eq:acqflow} shows in which sequence the various scripts and loops ar
|
||||
|
||||
|
||||
If you prefere to handle the acquisition from your acquisition enviroment, simply leave al scripts and scans disabled and call the acquition from your acquisition enviroment. \\
|
||||
Only the frames and cycles loops are defined in firmware and guarantee a precise timing of the acquisition which cannot replaced by any other method (you can synchronize to your beamline by hardware connection of the IO signals as described in~\ref{sec:timing}).
|
||||
Only the frames and triggers loops are defined in firmware and guarantee a precise timing of the acquisition which cannot replaced by any other method (you can synchronize to your beamline by hardware connection of the IO signals as described in~\ref{sec:timing}).
|
||||
|
||||
Hereafter a description of the meaning of the various loops:
|
||||
\begin{description}
|
||||
@ -259,11 +259,11 @@ Hereafter a description of the meaning of the various loops:
|
||||
The detector is moved in the angular positions specified by the positions command.\\
|
||||
The command for moving the detector should be defined as described in~\ref{sec:usersFunc}.\\
|
||||
All data acquired during a position loop will be merged together, unless the number of positions is set to 0. In this case single frames will be converted to angle without merging.\\
|
||||
Avoid using the position loop together with many frames/cycles.
|
||||
Avoid using the position loop together with many frames/triggers.
|
||||
|
||||
\item[Cycles loop] is executed in real time and defines e.g. the number of triggers that will be accepted. The total number of images will be given by frames times cycles.
|
||||
\item[Triggers loop] is executed in real time and defines e.g. the number of triggers that will be accepted. The total number of images will be given by frames times triggers.
|
||||
|
||||
\item[Frames loop] is executed in real time and defines e.g. the images acquired per trigger. The total number of images will be given by frames times cycles.
|
||||
\item[Frames loop] is executed in real time and defines e.g. the images acquired per trigger. The total number of images will be given by frames times triggers.
|
||||
\end{description}
|
||||
|
||||
Executing a script simply consists in a system call with the arguments specified below. The various scripts are executed only if they are enabled and different than \textit{none}. \\
|
||||
@ -332,11 +332,11 @@ In the following is a list of the main parameters involved in the acquisition ti
|
||||
\item[Period] is the period of the images acquired. If it is shorter than the exposure time plus readout time, it will be ignored.
|
||||
\item[Delay after trigger] can be set as a delay between the trigger signal and the start of the detection time.
|
||||
\item[Number of gates] is used only in \textit{gating} mode and is the number of times that the gate is toggled before the detector is read out. Useful for stroboscopic measurements with gate period shorter than the minim acquisition period of the detector, otherwise can be left to 1.
|
||||
\item[Number of frames] is the number of images to be acquired per cycle. Frames and cycles have the same meaning except in trigger mode, when frames means the number of images per trigger. The total number of images is frames time cycles.
|
||||
\item[Number of cycles] is the number of times that the frames are acquired. Frames and cycles have the same meaning except in trigger mode, when cycles means the number of triggers that will be accepted. The total number of images is frames time cycles.
|
||||
\item[Number of frames] is the number of images to be acquired per cycle. Frames and triggers have the same meaning except in trigger mode, when frames means the number of images per trigger. The total number of images is frames time triggers.
|
||||
\item[Number of triggers] is the number of times that the frames are acquired. Frames and triggers have the same meaning except in trigger mode, when triggers means the number of triggers that will be accepted. The total number of images is frames time triggers.
|
||||
\item[Number of probes] is used in stoboscopic measurements when the period is longer than the minimum acquisition period, but shorter than the frame rate.\\
|
||||
In this case the data can be summed in firmware. \\
|
||||
Currently it is implemented for Mythen only. If probes is set to 0, works normallyreturning an image for each readout, otherwise set number of cycles to 1. The maximum number of probes that can be set is 3. The detector will return a number of image equal to the number of probes, where all frames are going to be accumulated. The total number of readouts is number of frames time probes and for probes=1 the detector will return one image where all frames have been summed, for probes=2 two images where every second frame has been summed (each image accumulates the number of frames), for probes=3 three images where every third image has been summed (each image accumulates the number of frames).\\
|
||||
Currently it is implemented for Mythen only. If probes is set to 0, works normallyreturning an image for each readout, otherwise set number of triggers to 1. The maximum number of probes that can be set is 3. The detector will return a number of image equal to the number of probes, where all frames are going to be accumulated. The total number of readouts is number of frames time probes and for probes=1 the detector will return one image where all frames have been summed, for probes=2 two images where every second frame has been summed (each image accumulates the number of frames), for probes=3 three images where every third image has been summed (each image accumulates the number of frames).\\
|
||||
The returned images will always have 32~bit dynamic range, while the dynamic range if the detector defines the bit depth of the counters in rder to limit the readout time, if necessary.\\
|
||||
The probes counter waorks also in trigger and gating modes.
|
||||
\end{description}
|
||||
@ -349,14 +349,14 @@ The probes counter waorks also in trigger and gating modes.
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{images/normal_acquisition.eps}
|
||||
\end{center}
|
||||
\caption{Auto timing: the detection time is defined by the exposure time and the period by period (if longer than exposure time plus readout time). The total number of images is frames (in the example 3) times cycles (in the example 2), and in this case there is no difference between the acquisition of the two.}\label{fig:autotiming}
|
||||
\caption{Auto timing: the detection time is defined by the exposure time and the period by period (if longer than exposure time plus readout time). The total number of images is frames (in the example 3) times triggers (in the example 2), and in this case there is no difference between the acquisition of the two.}\label{fig:autotiming}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{images/gated_acquisition.eps}
|
||||
\end{center}
|
||||
\caption{Gating mode: the detector acquires for a number of gates define by the user (in this case 4) before being read out, independently on the timing of the gates. The detector remains insensitive during the readout time and then starts being active again. External gates given during the readout time are ignored. The total number of images is frames (in the example 3) times cycles (in the example 2), and in this case there is no difference between the acquisition of the two. The polarity of the external gate signal can be defined by the user through the \textit{external signal flag} (in the example active high).}\label{fig:gating}
|
||||
\caption{Gating mode: the detector acquires for a number of gates define by the user (in this case 4) before being read out, independently on the timing of the gates. The detector remains insensitive during the readout time and then starts being active again. External gates given during the readout time are ignored. The total number of images is frames (in the example 3) times triggers (in the example 2), and in this case there is no difference between the acquisition of the two. The polarity of the external gate signal can be defined by the user through the \textit{external signal flag} (in the example active high).}\label{fig:gating}
|
||||
\end{figure}
|
||||
|
||||
|
||||
@ -365,7 +365,7 @@ The probes counter waorks also in trigger and gating modes.
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{images/trigger_acquisition.eps}
|
||||
\end{center}
|
||||
\caption{Trigger mode: the external trigger signal defines the start of the beginning of the acquisition, which starts after the delay set by the user. For each trigger, the number of frames is acquired (in the example 3) and all trigger signals ignored. The number of trigger accepted is given by the number of cycles (in the example 2). The polarity of the external trigger signal can be defined by the user through the \textit{external signal flag} (in the example rising edge).}\label{fig:trig}
|
||||
\caption{Trigger mode: the external trigger signal defines the start of the beginning of the acquisition, which starts after the delay set by the user. For each trigger, the number of frames is acquired (in the example 3) and all trigger signals ignored. The number of trigger accepted is given by the number of triggers (in the example 2). The polarity of the external trigger signal can be defined by the user through the \textit{external signal flag} (in the example rising edge).}\label{fig:trig}
|
||||
\end{figure}
|
||||
|
||||
|
||||
@ -373,7 +373,7 @@ The probes counter waorks also in trigger and gating modes.
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{images/ro_trigger_acquisition.eps}
|
||||
\end{center}
|
||||
\caption{Read Out Trigger mode: the external trigger signal defines the beginning of the readout. The exposure time works as a time out for the waiting time for the trigger signal. The number of trigger accepted is given by the number of cycles (in the example 3) and it does not make sense to program more than one frame. The polarity of the external trigger signal can be defined by the user through the \textit{external signal flag} (in the example rising edge).}\label{fig:trig}
|
||||
\caption{Read Out Trigger mode: the external trigger signal defines the beginning of the readout. The exposure time works as a time out for the waiting time for the trigger signal. The number of trigger accepted is given by the number of triggers (in the example 3) and it does not make sense to program more than one frame. The polarity of the external trigger signal can be defined by the user through the \textit{external signal flag} (in the example rising edge).}\label{fig:trig}
|
||||
\end{figure}
|
||||
|
||||
|
||||
|
@ -91,7 +91,7 @@ where: \\
|
||||
\textit{v0} is the scan0 variable with the desired precision, if scan0 is enabled;\\
|
||||
\textit{v1} is the scan1 variable with the desired precision, if scan1 is enabled;\\
|
||||
\textit{p} is the position index, if different positions are configured;\\
|
||||
\textit{f} is the frame index of the first frame stored in the file, if many frames and cycles are configured;\\
|
||||
\textit{f} is the frame index of the first frame stored in the file, if many frames and triggers are configured;\\
|
||||
\textit{i} is the file index;\\
|
||||
\textit{ext} is the file extension e.g. \textit{.raw} for MYTHEN raw data, \textit{.dat} for MYTHEN processed data.
|
||||
\item[index i] Sets the starting index of the file i at the beginning of the acquisition (automatically incremented for each measurement).
|
||||
@ -110,10 +110,10 @@ Sets the number of gates per frame in gated (stroboscopic) mode.\\
|
||||
Refere to the detailed documentation to understand how the different timing modes work.
|
||||
\item[frames n]
|
||||
Sets the number of frames acquired sequentially per cycle (e.g. after each trigger), with the exposure time defined by exptime and the period defined by period (unless in gated mode). The frame index in the output file name will automatically be incremented.\\
|
||||
Note that the total number of images will be frames times cycles. Refere to detailed documentation to understand how the different timing modes work.
|
||||
\item[cycles n]
|
||||
Sets the number of cycles (e.g. number of triggers). The frame index in the output file name will automatically be incremented. \\
|
||||
Note that the total number of images will be by frames times cycles. Refere to the detailed documentation to understand how the different timing modes work.
|
||||
Note that the total number of images will be frames times triggers. Refere to detailed documentation to understand how the different timing modes work.
|
||||
\item[triggers n]
|
||||
Sets the number of triggers (e.g. number of triggers). The frame index in the output file name will automatically be incremented. \\
|
||||
Note that the total number of images will be by frames times triggers. Refere to the detailed documentation to understand how the different timing modes work.
|
||||
\item[probes] Sets the number of probes to accumulate for stroboscopic measurements. \\
|
||||
Refere to detailed documentation to understand how the different timing modes work.
|
||||
\item[measurements] Sets the number of repetitions of the acquisitions (non real time!). The file index in the file name will be automotically incremented.\\
|
||||
@ -234,7 +234,7 @@ It is normally reccomended to use \verb=sls\_detector\_acquire [j-]=, which take
|
||||
%\item[delayl]
|
||||
%\item[gatesl]
|
||||
%\item[framesl]
|
||||
%\item[cyclesl]
|
||||
%\item[triggersl]
|
||||
%\item[frameindex]
|
||||
%\item[now]
|
||||
\end{description}
|
||||
@ -393,11 +393,11 @@ Returns the number of gates per frame in gated (stroboscopic) mode.
|
||||
Refere to detailed documentation to understand how the different timing modes work.
|
||||
\item[frames]
|
||||
Returns the number of frames acquired sequentially per cycle (e.g. after each trigger), with the exposure time defined by exptime and the period defined by period (unless in gated mode).
|
||||
Note that the total number of images is frames times cycles.
|
||||
Note that the total number of images is frames times triggers.
|
||||
Refere to detailed documentation to understand how the different timing modes work.
|
||||
\item[cycles n]
|
||||
Returns the number of cycles (e.g. number of triggers).
|
||||
Note that the total number of images is frames times cycles.
|
||||
\item[triggers n]
|
||||
Returns the number of triggers (e.g. number of triggers).
|
||||
Note that the total number of images is frames times triggers.
|
||||
Refere to detailed documentation to understand how the different timing modes work.
|
||||
\item[probes] Returns the number of probes to accumulate for stroboscopic measurements.
|
||||
Refere to detailed documentation to understand how the different timing modes work.
|
||||
@ -518,7 +518,7 @@ It is normally reccomended to use \verb=sls\_detector\_acquire [j-]=, which take
|
||||
\item[delayl] Returns the delay after trigger left for the current frame.
|
||||
\item[gatesl] Returns the number of gates left for the current frame.
|
||||
\item[framesl] Returns the number of frames left for the current cycle.
|
||||
\item[cyclesl] Returns the number of cycles left for the current acquisition.
|
||||
\item[triggersl] Returns the number of triggers left for the current acquisition.
|
||||
\item[now] Returns the current timestamp of the detector clock.
|
||||
\item[timestamp] Returns the timestamp of the acquisitions in a First-In/First-Out mode i.e. every time it is called it returns the timestamp of the first acquisition start of readout. The FIFO is reset everytime the acquisition is started.
|
||||
\end{description}
|
||||
|
@ -217,7 +217,7 @@ is used to configure the detector parameter var
|
||||
\item[delay t] Sets the delay after trigger (in s)
|
||||
\item[gates n] Sets the number of gates per frame
|
||||
\item[frames n] Sets the number of frames per cycle (e.g. after each trigger)
|
||||
\item[cycles n] Sets the number of cycles (e.g. number of triggers)
|
||||
\item[triggers n] Sets the number of triggers (e.g. number of triggers)
|
||||
\item[probes n] Sets the number of probes to accumulate (max 3)
|
||||
\item[dr n] Sets the dynamic range - can be (1,) 4, 8,16 or 24 bits
|
||||
\item[flags mode] Sets the readout flags - can be none or storeinram
|
||||
@ -298,7 +298,7 @@ is used to retrieve the detector parameter var
|
||||
\item[delay] Gets the delay after trigger (in s)
|
||||
\item[gates] Gets the number of gates per frame
|
||||
\item[frames] Gets the number of frames per cycle (e.g. after each trigger)
|
||||
\item[cycles] Gets the number of cycles (e.g. number of triggers)
|
||||
\item[triggers] Gets the number of triggers (e.g. number of triggers)
|
||||
\item[probes] Gets the number of probes to accumulate (max 3)
|
||||
\item[timestamp] Gets the internal time stamp of the nex frame acquired (i.e. during an acquisition, all timestamps of the frames are stored in a FIFO which can be read after the acquisition - returns -1 if the FIFO is empty)
|
||||
\item[dr] Gets the dynamic range
|
||||
|
@ -5,8 +5,6 @@ pybind11_add_module(_sls_detector
|
||||
src/experimental.cpp
|
||||
)
|
||||
|
||||
|
||||
|
||||
target_link_libraries(_sls_detector PUBLIC
|
||||
slsDetectorShared
|
||||
slsReceiverShared
|
||||
@ -26,12 +24,12 @@ set( PYTHON_FILES
|
||||
dacs.py
|
||||
decorators.py
|
||||
detector_property.py
|
||||
detector.py
|
||||
eiger.py
|
||||
# detector.py
|
||||
# eiger.py
|
||||
errors.py
|
||||
experimental.py
|
||||
jungfrau_ctb.py
|
||||
jungfrau.py
|
||||
# jungfrau_ctb.py
|
||||
# jungfrau.py
|
||||
registers.py
|
||||
utils.py
|
||||
|
||||
@ -47,3 +45,6 @@ endforeach(FILE ${PYTHON_FILES})
|
||||
configure_file( scripts/basic.py
|
||||
${CMAKE_BINARY_DIR}/basic.py
|
||||
)
|
||||
configure_file( scripts/test_virtual.py
|
||||
${CMAKE_BINARY_DIR}/test_virtual.py
|
||||
)
|
@ -2,11 +2,9 @@ import os
|
||||
import sys
|
||||
import numpy as np
|
||||
sys.path.append(os.path.join(os.getcwd(), 'bin'))
|
||||
from sls_detector import Eiger, Detector
|
||||
from sls_detector import ExperimentalDetector
|
||||
|
||||
from _sls_detector.io import read_my302_file
|
||||
|
||||
# from sls_detector import Eiger, Jungfrau, Detector, defs
|
||||
from sls_detector import Detector
|
||||
from sls_detector import dacIndex
|
||||
d = Detector()
|
||||
e = ExperimentalDetector()
|
||||
|
||||
|
||||
|
77
python/scripts/generate_enums.py
Normal file
77
python/scripts/generate_enums.py
Normal file
@ -0,0 +1,77 @@
|
||||
"""
|
||||
Code generator for enum bindings in the Python extension.
|
||||
Reads the sls_detector_defs.h and enums_in.cpp then outputs
|
||||
enums.cpp
|
||||
|
||||
"""
|
||||
|
||||
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
|
||||
# def remove_comments(text):
|
||||
# def replacer(match):
|
||||
# s = match.group(0)
|
||||
# if s.startswith('/'):
|
||||
# return " " # note: a space and not an empty string
|
||||
# else:
|
||||
# return s
|
||||
# pattern = re.compile(
|
||||
# r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"',
|
||||
# re.DOTALL | re.MULTILINE
|
||||
# )
|
||||
# return re.sub(pattern, replacer, text)
|
||||
|
||||
def extract_enums(lines):
|
||||
line_iter = iter(lines)
|
||||
enums = {}
|
||||
for line in line_iter:
|
||||
m = re.search("(?<=enum )\w+(?= {)", line)
|
||||
if m:
|
||||
enum_name = m.group()
|
||||
# print(enum_name)
|
||||
fields = []
|
||||
while True:
|
||||
l = next(line_iter)
|
||||
if '};' in l:
|
||||
break
|
||||
m = re.search("\w+", l)
|
||||
try:
|
||||
# print('\t', m.group())
|
||||
fields.append(m.group())
|
||||
|
||||
except:
|
||||
pass
|
||||
enums[enum_name] = fields
|
||||
return enums
|
||||
|
||||
def generate_enum_string(enums):
|
||||
data = []
|
||||
for key, value in enums.items():
|
||||
data.append(f'py::enum_<slsDetectorDefs::{key}>(Defs, "{key}")\n')
|
||||
for v in value:
|
||||
data.append(f'\t.value("{v}", slsDetectorDefs::{key}::{v})\n')
|
||||
data.append('.export_values();\n\n')
|
||||
return ''.join(data)
|
||||
|
||||
with open('../../slsSupportLib/include/sls_detector_defs.h') as f:
|
||||
data = f.read()
|
||||
|
||||
data = remove_comments(data)
|
||||
data = data.splitlines()
|
||||
enums = extract_enums(data)
|
||||
s = generate_enum_string(enums)
|
||||
|
||||
with open('../src/enums_in.cpp') as f:
|
||||
data = f.read()
|
||||
|
||||
text = data.replace('[[ENUMS]]', s)
|
||||
warning = '/* WARINING This file is auto generated any edits might be overwritten without warning */\n\n'
|
||||
with open('../src/enums.cpp', 'w') as f:
|
||||
f.write(warning)
|
||||
f.write(text)
|
||||
|
||||
|
||||
# run clang format on the output
|
||||
subprocess.run(['clang-format', '../src/enums.cpp', '-i'])
|
56
python/scripts/list_tested_cmd.py
Normal file
56
python/scripts/list_tested_cmd.py
Normal file
@ -0,0 +1,56 @@
|
||||
import parse
|
||||
from pathlib import Path
|
||||
import os
|
||||
import locale
|
||||
import argparse
|
||||
path = Path('../../slsDetectorSoftware/tests/')
|
||||
import subprocess
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-s", "--startswith", help="for filter", type = str, default=None)
|
||||
args = parser.parse_args()
|
||||
|
||||
files = [f for f in os.listdir(path) if 'CmdProxy' in f]
|
||||
tested = []
|
||||
for fname in files:
|
||||
with open(path/fname) as f:
|
||||
data = f.read()
|
||||
|
||||
data = parse.remove_comments(data)
|
||||
data = data.splitlines()
|
||||
|
||||
|
||||
for line in data:
|
||||
if 'TEST_CASE' in line or 'SECTION' in line:
|
||||
cmd = line.split("\"")[1]
|
||||
tested.append(cmd)
|
||||
|
||||
out = subprocess.run(['g', 'list'], stdout = subprocess.PIPE, encoding=locale.getpreferredencoding())
|
||||
all_cmd = out.stdout.splitlines()
|
||||
all_cmd.pop(0)
|
||||
|
||||
|
||||
|
||||
if args.startswith is not None:
|
||||
all_cmd = [cmd for cmd in all_cmd if cmd.startswith(args.startswith)]
|
||||
tested = [cmd for cmd in tested if cmd.startswith(args.startswith)]
|
||||
|
||||
|
||||
|
||||
not_tested = [cmd for cmd in all_cmd if cmd not in tested]
|
||||
misnamed = [cmd for cmd in tested if cmd not in all_cmd]
|
||||
tested = [cmd for cmd in tested if cmd in all_cmd]
|
||||
|
||||
|
||||
print("\nThe following commands are tested:")
|
||||
for cmd in tested:
|
||||
print(cmd)
|
||||
|
||||
print("\nThe following commands are NOT tested:")
|
||||
for cmd in not_tested:
|
||||
print(cmd)
|
||||
|
||||
print(f"\nThe following {len(misnamed)} tests does not match commands and might be misnamed:")
|
||||
for cmd in misnamed:
|
||||
print(cmd)
|
||||
print(f'\nTests cover {len(tested)} of {len(all_cmd)} commands')
|
13
python/scripts/parse.py
Normal file
13
python/scripts/parse.py
Normal file
@ -0,0 +1,13 @@
|
||||
import re
|
||||
def remove_comments(text):
|
||||
def replacer(match):
|
||||
s = match.group(0)
|
||||
if s.startswith('/'):
|
||||
return " " # note: a space and not an empty string
|
||||
else:
|
||||
return s
|
||||
pattern = re.compile(
|
||||
r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"',
|
||||
re.DOTALL | re.MULTILINE
|
||||
)
|
||||
return re.sub(pattern, replacer, text)
|
164
python/scripts/test_virtual.py
Normal file
164
python/scripts/test_virtual.py
Normal file
@ -0,0 +1,164 @@
|
||||
import pytest
|
||||
import subprocess
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import datetime as dt
|
||||
|
||||
sys.path.append(os.path.join(os.getcwd(), "bin"))
|
||||
from sls_detector import ExperimentalDetector, detectorSettings
|
||||
|
||||
n_detectors = 3
|
||||
start_port = 1952
|
||||
port_step = 3
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def virtual_jf_detectors(request):
|
||||
"""
|
||||
Fixture that is run once for the module
|
||||
will launch virtual servers and clean up
|
||||
after
|
||||
"""
|
||||
print("Setting up virtual detectors")
|
||||
|
||||
# Ensure that no detector servers are running
|
||||
subprocess.run(["killall", "jungfrauDetectorServer_virtual"])
|
||||
|
||||
# Ensure no shared memory exists before tests start
|
||||
d = ExperimentalDetector()
|
||||
d.free()
|
||||
|
||||
# Start servers
|
||||
virtual_jf_detectors = [
|
||||
subprocess.Popen(
|
||||
[
|
||||
"bin/jungfrauDetectorServer_virtual",
|
||||
"--port",
|
||||
f"{start_port+port_step*i}",
|
||||
]
|
||||
)
|
||||
for i in range(n_detectors)
|
||||
]
|
||||
|
||||
# Allow server startup to complete
|
||||
time.sleep(3)
|
||||
|
||||
def fin():
|
||||
print("Cleaning up virtual detectors")
|
||||
d = ExperimentalDetector()
|
||||
d.free()
|
||||
subprocess.run(["killall", "jungfrauDetectorServer_virtual"])
|
||||
|
||||
request.addfinalizer(fin)
|
||||
return virtual_jf_detectors # provide the fixture value
|
||||
|
||||
|
||||
def test_shmid(virtual_jf_detectors):
|
||||
d = ExperimentalDetector()
|
||||
assert d.getShmId() == 0
|
||||
d.free()
|
||||
|
||||
d = ExperimentalDetector(73)
|
||||
assert d.getShmId() == 73
|
||||
d.free()
|
||||
|
||||
|
||||
def test_hostname(virtual_jf_detectors):
|
||||
d = ExperimentalDetector()
|
||||
d.hostname = "localhost"
|
||||
assert d.hostname == ["localhost"]
|
||||
|
||||
d.hostname = [f"localhost:{start_port+i*port_step}" for i in range(n_detectors)]
|
||||
assert d.hostname == ["localhost"] * n_detectors
|
||||
|
||||
|
||||
def test_fwversion(virtual_jf_detectors):
|
||||
d = ExperimentalDetector()
|
||||
assert d.detectorversion == 0 # Firmware of virtual detector
|
||||
assert d.getFirmwareVersion() == [0] * n_detectors
|
||||
|
||||
|
||||
def test_len(virtual_jf_detectors):
|
||||
d = ExperimentalDetector()
|
||||
assert len(d) == n_detectors
|
||||
assert d.size() == n_detectors
|
||||
|
||||
|
||||
def test_module_geometry(virtual_jf_detectors):
|
||||
d = ExperimentalDetector()
|
||||
geo = d.module_geometry
|
||||
assert geo.x == 1
|
||||
assert geo.y == 3
|
||||
|
||||
|
||||
def test_module_size(virtual_jf_detectors):
|
||||
d = ExperimentalDetector()
|
||||
geo = d.module_size
|
||||
assert geo.x == 1024
|
||||
assert geo.y == 512
|
||||
|
||||
|
||||
def test_settings(virtual_jf_detectors):
|
||||
d = ExperimentalDetector()
|
||||
assert d.settings == detectorSettings.DYNAMICGAIN
|
||||
|
||||
gain_list = [
|
||||
detectorSettings.FIXGAIN1,
|
||||
detectorSettings.FIXGAIN2,
|
||||
detectorSettings.FORCESWITCHG1,
|
||||
detectorSettings.FORCESWITCHG2,
|
||||
detectorSettings.DYNAMICHG0,
|
||||
detectorSettings.DYNAMICGAIN,
|
||||
]
|
||||
|
||||
# Set all viable gain for Jungfrau to make sure nothing is crashing
|
||||
for gain in gain_list:
|
||||
d.settings = gain
|
||||
assert d.settings == gain
|
||||
|
||||
d.setSettings(detectorSettings.FORCESWITCHG1, [1])
|
||||
assert d.settings == [
|
||||
detectorSettings.DYNAMICGAIN,
|
||||
detectorSettings.FORCESWITCHG1,
|
||||
detectorSettings.DYNAMICGAIN,
|
||||
]
|
||||
|
||||
d.settings = detectorSettings.DYNAMICGAIN
|
||||
assert d.settings == detectorSettings.DYNAMICGAIN
|
||||
|
||||
def test_frames(virtual_jf_detectors):
|
||||
d = ExperimentalDetector()
|
||||
d.frames = 10
|
||||
assert d.frames == 10
|
||||
|
||||
# def test_triggers(virtual_jf_detectors):
|
||||
|
||||
def test_exptime(virtual_jf_detectors):
|
||||
d = ExperimentalDetector()
|
||||
|
||||
#default value
|
||||
assert d.exptime == 1e-5
|
||||
|
||||
d.exptime = 1.5
|
||||
assert d.exptime == 1.5
|
||||
|
||||
t = dt.timedelta(microseconds=10)
|
||||
d.exptime = t
|
||||
assert d.exptime == 10e-6
|
||||
|
||||
def test_period(virtual_jf_detectors):
|
||||
d = ExperimentalDetector()
|
||||
|
||||
#default value
|
||||
d.period = 0
|
||||
assert d.period == 0
|
||||
|
||||
d.period = 1.5
|
||||
assert d.period == 1.5
|
||||
|
||||
t = dt.timedelta(microseconds=10)
|
||||
d.period = t
|
||||
assert d.period == 10e-6
|
||||
|
||||
|
@ -1,9 +1,17 @@
|
||||
from .detector import Detector, DetectorError, free_shared_memory
|
||||
from .eiger import Eiger
|
||||
from .experimental import ExperimentalDetector
|
||||
from .jungfrau import Jungfrau
|
||||
from .jungfrau_ctb import JungfrauCTB
|
||||
from _sls_detector import DetectorApi
|
||||
# from .detector import Detector, DetectorError, free_shared_memory
|
||||
# from .eiger import Eiger
|
||||
from .experimental import Detector
|
||||
|
||||
# from .jungfrau import Jungfrau
|
||||
# from .jungfrau_ctb import JungfrauCTB
|
||||
# from _sls_detector import DetectorApi
|
||||
|
||||
import _sls_detector
|
||||
|
||||
defs = _sls_detector.slsDetectorDefs
|
||||
runStatus = _sls_detector.slsDetectorDefs.runStatus
|
||||
speedLevel = _sls_detector.slsDetectorDefs.speedLevel
|
||||
timingMode = _sls_detector.slsDetectorDefs.timingMode
|
||||
dacIndex = _sls_detector.slsDetectorDefs.dacIndex
|
||||
detectorType = _sls_detector.slsDetectorDefs.detectorType
|
||||
detectorSettings = _sls_detector.slsDetectorDefs.detectorSettings
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,11 +1,30 @@
|
||||
from _sls_detector import multiDetectorApi
|
||||
from _sls_detector import CppDetectorApi
|
||||
from _sls_detector import slsDetectorDefs
|
||||
|
||||
runStatus = slsDetectorDefs.runStatus
|
||||
speedLevel = slsDetectorDefs.speedLevel
|
||||
dacIndex = slsDetectorDefs.dacIndex
|
||||
|
||||
from .utils import element_if_equal, all_equal
|
||||
from .utils import Geometry, to_geo
|
||||
import datetime as dt
|
||||
|
||||
from functools import wraps
|
||||
from collections import namedtuple
|
||||
|
||||
class Register:
|
||||
"""
|
||||
Helper class to read and write to registers using a
|
||||
more Pythonic syntax
|
||||
"""
|
||||
def __init__(self, detector):
|
||||
self._detector = detector
|
||||
|
||||
def __getitem__(self, key):
|
||||
return self._detector.readRegister(key)
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
self._detector.writeRegister(key, value)
|
||||
|
||||
|
||||
def freeze(cls):
|
||||
@ -35,72 +54,176 @@ def freeze(cls):
|
||||
|
||||
|
||||
@freeze
|
||||
class ExperimentalDetector(multiDetectorApi):
|
||||
class Detector(CppDetectorApi):
|
||||
"""
|
||||
This class is the base for detector specific
|
||||
interfaces. Most functions exists in two versions
|
||||
like the getExptime() function that uses the
|
||||
C++ API directly and the simplified exptime property.
|
||||
"""
|
||||
def __init__(self, multi_id = 0):
|
||||
|
||||
def __init__(self, multi_id=0):
|
||||
"""
|
||||
multi_id refers to the shared memory id of the
|
||||
slsDetectorPackage. Default value is 0.
|
||||
"""
|
||||
super().__init__(multi_id)
|
||||
self._register = Register(self)
|
||||
|
||||
# CONFIGURATION
|
||||
def __len__(self):
|
||||
return self.size()
|
||||
|
||||
def __repr__(self):
|
||||
return '{}(id = {})'.format(self.__class__.__name__,
|
||||
self.getShmId())
|
||||
|
||||
|
||||
def free(self):
|
||||
self.freeSharedMemory()
|
||||
|
||||
|
||||
|
||||
|
||||
# Acq
|
||||
@property
|
||||
def rx_status(self):
|
||||
"""
|
||||
Read the status of the receiver
|
||||
"""
|
||||
return element_if_equal(self.getReceiverStatus())
|
||||
def config(self):
|
||||
return NotImplementedError("config is set only")
|
||||
|
||||
@rx_status.setter
|
||||
def rx_status(self, status_str):
|
||||
if status_str == "start":
|
||||
self.startReceiver()
|
||||
elif status_str == "stop":
|
||||
self.stopReceiver()
|
||||
@config.setter
|
||||
def config(self, fname):
|
||||
self.loadConfig(fname)
|
||||
|
||||
@property
|
||||
def parameters(self):
|
||||
return NotImplementedError("parameters is set only")
|
||||
|
||||
@parameters.setter
|
||||
def parameters(self, fname):
|
||||
self.loadParameters(fname)
|
||||
|
||||
@property
|
||||
def hostname(self):
|
||||
return self.getHostname()
|
||||
|
||||
@hostname.setter
|
||||
def hostname(self, hostnames):
|
||||
if isinstance(hostnames, str):
|
||||
hostnames = [hostnames]
|
||||
if isinstance(hostnames, list):
|
||||
self.setHostname(hostnames)
|
||||
else:
|
||||
raise NotImplementedError("Unknown argument to rx_status")
|
||||
raise ValueError("hostname needs to be string or list of strings")
|
||||
|
||||
@property
|
||||
def busy(self):
|
||||
"""
|
||||
Checks if the detector is acquiring. Can also be set but should only be used if the acquire fails and
|
||||
leaves the detector with busy == True
|
||||
def fw_version(self):
|
||||
return element_if_equal(self.getFirmwareVersion())
|
||||
|
||||
.. note ::
|
||||
@property
|
||||
def server_version(self):
|
||||
#TODO! handle hex print
|
||||
return element_if_equal(self.getDetectorServerVersion())
|
||||
|
||||
Only works when the measurement is launched using acquire, not with status start!
|
||||
@property
|
||||
def client_version(self):
|
||||
return element_if_equal(self.getClientVersion())
|
||||
|
||||
Returns
|
||||
--------
|
||||
bool
|
||||
:py:obj:`True` if the detector is acquiring otherwise :py:obj:`False`
|
||||
@property
|
||||
def rx_version(self):
|
||||
return element_if_equal(self.getReceiverVersion())
|
||||
|
||||
Examples
|
||||
----------
|
||||
@property
|
||||
def detector_type(self):
|
||||
return element_if_equal(self.getDetectorType())
|
||||
|
||||
::
|
||||
@property
|
||||
def dr(self):
|
||||
return element_if_equal(self.getDynamicRange())
|
||||
|
||||
d.busy
|
||||
>> True
|
||||
@dr.setter
|
||||
def dr(self, dr):
|
||||
self.setDynamicRange(dr)
|
||||
|
||||
#If the detector is stuck reset by:
|
||||
d.busy = False
|
||||
@property
|
||||
def module_geometry(self):
|
||||
return to_geo(self.getModuleGeometry())
|
||||
|
||||
@property
|
||||
def module_size(self):
|
||||
ms = [to_geo(item) for item in self.getModuleSize()]
|
||||
return element_if_equal(ms)
|
||||
|
||||
@property
|
||||
def detector_size(self):
|
||||
return to_geo(self.getDetectorSize())
|
||||
|
||||
@property
|
||||
def settings(self):
|
||||
return element_if_equal(self.getSettings())
|
||||
|
||||
@settings.setter
|
||||
def settings(self, value):
|
||||
self.setSettings(value)
|
||||
|
||||
@property
|
||||
def frames(self):
|
||||
return element_if_equal(self.getNumberOfFrames())
|
||||
|
||||
@frames.setter
|
||||
def frames(self, n_frames):
|
||||
self.setNumberOfFrames(n_frames)
|
||||
|
||||
|
||||
"""
|
||||
return self.getAcquiringFlag()
|
||||
@property
|
||||
def exptime(self):
|
||||
res = self.getExptime()
|
||||
return element_if_equal([it.total_seconds() for it in res])
|
||||
|
||||
@exptime.setter
|
||||
def exptime(self, t):
|
||||
if isinstance(t, dt.timedelta):
|
||||
self.setExptime(t)
|
||||
else:
|
||||
self.setExptime(dt.timedelta(seconds=t))
|
||||
|
||||
@property
|
||||
def subexptime(self):
|
||||
res = self.getSubExptime()
|
||||
return element_if_equal([it.total_seconds() for it in res])
|
||||
|
||||
@subexptime.setter
|
||||
def subexptime(self, t):
|
||||
if isinstance(t, dt.timedelta):
|
||||
self.setSubExptime(t)
|
||||
else:
|
||||
self.setSubExptime(dt.timedelta(seconds=t))
|
||||
|
||||
|
||||
@property
|
||||
def period(self):
|
||||
res = self.getPeriod()
|
||||
return element_if_equal([it.total_seconds() for it in res])
|
||||
|
||||
@period.setter
|
||||
def period(self, t):
|
||||
if isinstance(t, dt.timedelta):
|
||||
self.setPeriod(t)
|
||||
else:
|
||||
self.setPeriod(dt.timedelta(seconds=t))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Time
|
||||
|
||||
|
||||
|
||||
#TODO! Rename to rx_framescaught
|
||||
@property
|
||||
def framescaught(self):
|
||||
return element_if_equal(self.getFramesCaught())
|
||||
|
||||
@busy.setter
|
||||
def busy(self, value):
|
||||
self.setAcquiringFlag(value)
|
||||
|
||||
# Configuration
|
||||
@property
|
||||
def startingfnum(self):
|
||||
return element_if_equal(self.getStartingFrameNumber())
|
||||
@ -109,22 +232,108 @@ class ExperimentalDetector(multiDetectorApi):
|
||||
def startingfnum(self, value):
|
||||
self.setStartingFrameNumber(value)
|
||||
|
||||
#TODO! testing switches on automatically?
|
||||
@property
|
||||
def config(self):
|
||||
return NotImplementedError("config is set only")
|
||||
def flowcontrol_10g(self):
|
||||
return element_if_equal(self.getTenGigaFlowControl())
|
||||
|
||||
@config.setter
|
||||
def config(self, fname):
|
||||
self.setConfig(fname)
|
||||
@flowcontrol_10g.setter
|
||||
def flowcontrol_10g(self, enable):
|
||||
self.setTenGigaFlowControl(enable)
|
||||
|
||||
#TODO! add txdelay
|
||||
|
||||
@property
|
||||
def use_receiver(self):
|
||||
return element_if_equal(self.getUseReceiverFlag())
|
||||
|
||||
@property
|
||||
def rx_hostname(self):
|
||||
return element_if_equal(self.getRxHostname())
|
||||
|
||||
@rx_hostname.setter
|
||||
def rx_hostname(self, hostname):
|
||||
self.setRxHostname(hostname)
|
||||
|
||||
@property
|
||||
def rx_tcpport(self):
|
||||
return element_if_equal(self.getRxPort())
|
||||
|
||||
@rx_tcpport.setter
|
||||
def rx_tcpport(self, port):
|
||||
self.setRxPort(port)
|
||||
|
||||
@property
|
||||
def rx_fifodepth(self):
|
||||
return element_if_equal(self.getRxFifoDepth())
|
||||
|
||||
@rx_fifodepth.setter
|
||||
def rx_fifodepth(self, frames):
|
||||
self.setRxFifoDepth(frames)
|
||||
|
||||
@property
|
||||
def rx_silent(self):
|
||||
return element_if_equal(self.getRxSilentMode())
|
||||
|
||||
@rx_silent.setter
|
||||
def rx_silent(self, value):
|
||||
self.setRxSilentMode(value)
|
||||
|
||||
@property
|
||||
def rx_discardpolicy(self):
|
||||
return element_if_equal(self.getRxFrameDiscardPolicy())
|
||||
|
||||
@rx_discardpolicy.setter
|
||||
def rx_discardpolicy(self, policy):
|
||||
self.setRxFrameDiscardPolicy()
|
||||
|
||||
@property
|
||||
def rx_padding(self):
|
||||
return element_if_equal(self.getPartialFramesPadding())
|
||||
|
||||
@rx_padding.setter
|
||||
def rx_padding(self, policy):
|
||||
self.setPartialFramesPadding(policy)
|
||||
|
||||
@property
|
||||
def rx_lock(self):
|
||||
"""Lock the receiver to a specific IP"""
|
||||
return element_if_equal(self.getRxLock())
|
||||
|
||||
@rx_lock.setter
|
||||
def rx_lock(self, value):
|
||||
self.setRxLock(value)
|
||||
|
||||
@property
|
||||
def rx_lastclient(self):
|
||||
return element_if_equal(self.getRxLastClientIP())
|
||||
|
||||
|
||||
#FILE
|
||||
|
||||
@property
|
||||
def fformat(self):
|
||||
return element_if_equal(self.getFileFormat())
|
||||
|
||||
@fformat.setter
|
||||
def fformat(self, format):
|
||||
self.setFileFormat(format)
|
||||
|
||||
@property
|
||||
def findex(self):
|
||||
return element_if_equal(self.getAcquisitionIndex())
|
||||
|
||||
@findex.setter
|
||||
def findex(self, index):
|
||||
self.setAcquisitionIndex(index)
|
||||
|
||||
# File
|
||||
@property
|
||||
def fname(self):
|
||||
return element_if_equal(self.getFileName())
|
||||
return element_if_equal(self.getFileNamePrefix())
|
||||
|
||||
@fname.setter
|
||||
def fname(self, file_name):
|
||||
self.setFileName(file_name)
|
||||
self.setFileNamePrefix(file_name)
|
||||
|
||||
@property
|
||||
def fpath(self):
|
||||
@ -150,31 +359,275 @@ class ExperimentalDetector(multiDetectorApi):
|
||||
def foverwrite(self, value):
|
||||
self.setFileOverWrite(value)
|
||||
|
||||
# Time
|
||||
@property
|
||||
def exptime(self):
|
||||
res = self.getExptime()
|
||||
return element_if_equal([it.total_seconds() for it in res])
|
||||
def fmaster(self):
|
||||
return element_if_equal(self.getMasterFileWrite())
|
||||
|
||||
@exptime.setter
|
||||
def exptime(self, t):
|
||||
self.setExptime(dt.timedelta(seconds=t))
|
||||
@fmaster.setter
|
||||
def fmaster(self, enable):
|
||||
self.setMasterFileWrite(enable)
|
||||
|
||||
@property
|
||||
def subexptime(self):
|
||||
res = self.getSubExptime()
|
||||
return element_if_equal([it.total_seconds() for it in res])
|
||||
def rx_framesperfile(self):
|
||||
return element_if_equal(self.getFramesPerFile())
|
||||
|
||||
@subexptime.setter
|
||||
def subexptime(self, t):
|
||||
self.setSubExptime(dt.timedelta(seconds=t))
|
||||
@rx_framesperfile.setter
|
||||
def rx_framesperfile(self, n_frames):
|
||||
self.setFramesPerFile(n_frames)
|
||||
|
||||
# ZMQ Streaming Parameters (Receiver<->Client)
|
||||
|
||||
@property
|
||||
def period(self):
|
||||
res = self.getPeriod()
|
||||
return element_if_equal([it.total_seconds() for it in res])
|
||||
def rx_datastream(self):
|
||||
return element_if_equal(self.getRxZmqDataStream())
|
||||
|
||||
@period.setter
|
||||
def period(self, t):
|
||||
self.setPeriod(dt.timedelta(seconds=t))
|
||||
@rx_datastream.setter
|
||||
def rx_zmqdatastream(self, enable):
|
||||
self.setRxZmqDataStream(enable)
|
||||
|
||||
@property
|
||||
def rx_readfreq(self):
|
||||
return element_if_equal(self.getRxZmqFrequency())
|
||||
|
||||
@rx_readfreq.setter
|
||||
def rx_readfreq(self, nth_frame):
|
||||
self.setRxZmqFrequency(nth_frame)
|
||||
|
||||
@property
|
||||
def rx_zmqport(self):
|
||||
return element_if_equal(self.getRxZmqPort())
|
||||
|
||||
@rx_zmqport.setter
|
||||
def rx_zmqport(self, port):
|
||||
self.setRxZmqPort(port)
|
||||
|
||||
@property
|
||||
def zmqport(self):
|
||||
return element_if_equal(self.getClientZmqPort())
|
||||
|
||||
@zmqport.setter
|
||||
def zmqport(self, port):
|
||||
self.setClientZmqPort(port)
|
||||
|
||||
@property
|
||||
def rx_zmqip(self):
|
||||
return element_if_equal(self.getRxZmqIP())
|
||||
|
||||
@rx_zmqip.setter
|
||||
def rx_zmqip(self, ip):
|
||||
self.setRxZmqIP(ip)
|
||||
|
||||
@property
|
||||
def zmqip(self):
|
||||
return element_if_equal(self.getClientZmqIp())
|
||||
|
||||
@zmqip.setter
|
||||
def zmqip(self, ip):
|
||||
self.setClientZmqIp(ip)
|
||||
|
||||
|
||||
@property
|
||||
def udp_dstip(self):
|
||||
return element_if_equal(self.getDestinationUDPIP())
|
||||
|
||||
@udp_dstip.setter
|
||||
def udp_dstip(self, ip):
|
||||
self.getDestinationUDPIP(ip)
|
||||
|
||||
@property
|
||||
def udp_dstip2(self):
|
||||
return element_if_equal(self.getDestinationUDPIP2())
|
||||
|
||||
@udp_dstip2.setter
|
||||
def udp_dstip2(self, ip):
|
||||
self.getDestinationUDPIP2(ip)
|
||||
|
||||
@property
|
||||
def udp_dstmac(self):
|
||||
return element_if_equal(self.getDestinationUDPMAC())
|
||||
|
||||
@udp_dstmac.setter
|
||||
def udp_dstmac(self, mac):
|
||||
self.getDestinationUDPMAC2(mac)
|
||||
|
||||
@property
|
||||
def udp_dstmac2(self):
|
||||
return element_if_equal(self.getDestinationUDPMAC2())
|
||||
|
||||
@udp_dstmac2.setter
|
||||
def udp_dstmac2(self, mac):
|
||||
self.getDestinationUDPMAC2(mac)
|
||||
|
||||
|
||||
@property
|
||||
def udp_dstport(self):
|
||||
return element_if_equal(self.getDestinationUDPPort())
|
||||
|
||||
@udp_dstport.setter
|
||||
def udp_dstport(self, port):
|
||||
self.setDestinationUDPPort(port)
|
||||
|
||||
@property
|
||||
def udp_dstport2(self):
|
||||
return element_if_equal(self.getDestinationUDPPort2())
|
||||
|
||||
@udp_dstport2.setter
|
||||
def udp_dstport2(self, port):
|
||||
self.setDestinationUDPPort2(port)
|
||||
|
||||
@property
|
||||
def src_udpmac(self):
|
||||
return element_if_equal(self.getSourceUDPMAC())
|
||||
|
||||
@src_udpmac.setter
|
||||
def src_udpmac(self, mac):
|
||||
self.setSourceUDPMAC(mac)
|
||||
|
||||
@property
|
||||
def src_udpip2(self):
|
||||
return element_if_equal(self.getSourceUDPIP())
|
||||
|
||||
@src_udpip2.setter
|
||||
def src_udpip2(self, ip):
|
||||
self.setSourceUDPIP(ip)
|
||||
|
||||
@property
|
||||
def src_udpip(self):
|
||||
return element_if_equal(self.getSourceUDPIP())
|
||||
|
||||
@src_udpip.setter
|
||||
def src_udpip(self, ip):
|
||||
self.setSourceUDPIP(ip)
|
||||
|
||||
|
||||
@property
|
||||
def src_udpmac2(self):
|
||||
return element_if_equal(self.getSourceUDPMAC2())
|
||||
|
||||
@src_udpmac2.setter
|
||||
def src_udpmac2(self, mac):
|
||||
self.setSourceUDPMAC2(mac)
|
||||
|
||||
@property
|
||||
def vhighvoltage(self):
|
||||
return element_if_equal(self.getHighVoltage())
|
||||
|
||||
@vhighvoltage.setter
|
||||
def vhighvoltage(self, v):
|
||||
self.setHighVoltage(v)
|
||||
|
||||
@property
|
||||
def user(self):
|
||||
return self.getUserDetails()
|
||||
|
||||
@property
|
||||
def settingspath(self):
|
||||
return element_if_equal(self.getSettingsPath())
|
||||
|
||||
@settingspath.setter
|
||||
def settingspath(self, path):
|
||||
self.setSettingsPath(path)
|
||||
|
||||
@property
|
||||
def status(self):
|
||||
return element_if_equal(self.getDetectorStatus())
|
||||
|
||||
@property
|
||||
def rx_status(self):
|
||||
return element_if_equal(self.getReceiverStatus())
|
||||
|
||||
|
||||
|
||||
@property
|
||||
def rx_udpsocksize(self):
|
||||
return element_if_equal(self.getRxUDPSocketBufferSize())
|
||||
|
||||
@rx_udpsocksize.setter
|
||||
def rx_udpsocksize(self, buffer_size):
|
||||
self.setRxUDPSocketBufferSize(buffer_size)
|
||||
|
||||
@property
|
||||
def rx_realudpsocksize(self):
|
||||
return element_if_equal(self.getRxRealUDPSocketBufferSize())
|
||||
|
||||
@property
|
||||
def trimbits(self):
|
||||
return NotImplementedError('trimbits are set only')
|
||||
|
||||
@trimbits.setter
|
||||
def trimbits(self, fname):
|
||||
self.loadTrimbits(fname)
|
||||
|
||||
@property
|
||||
def lock(self):
|
||||
return element_if_equal(self.getDetectorLock())
|
||||
|
||||
@lock.setter
|
||||
def lock(self, value):
|
||||
self.setDetectorLock(value)
|
||||
|
||||
@property
|
||||
def rx_lock(self):
|
||||
return element_if_equal(self.getRxLock())
|
||||
|
||||
@rx_lock.setter
|
||||
def rx_lock(self, value):
|
||||
self.setRxLock(value)
|
||||
|
||||
@property
|
||||
def lastclient(self):
|
||||
return element_if_equal(self.getLastClientIP())
|
||||
|
||||
@property
|
||||
def reg(self):
|
||||
return self._register
|
||||
|
||||
@property
|
||||
def ratecorr(self):
|
||||
""" tau in ns """
|
||||
return element_if_equal(self.getRateCorrection())
|
||||
|
||||
@ratecorr.setter
|
||||
def ratecorr(self, tau):
|
||||
self.setRateCorrection(tau)
|
||||
|
||||
@property
|
||||
def clkdivider(self):
|
||||
res = [int(value) for value in self.getSpeed()]
|
||||
return element_if_equal(res)
|
||||
|
||||
@clkdivider.setter
|
||||
def clkdivider(self, value):
|
||||
self.setSpeed(speedLevel(value))
|
||||
|
||||
@property
|
||||
def frameindex(self):
|
||||
return self.getRxCurrentFrameIndex()
|
||||
|
||||
@property
|
||||
def threshold(self):
|
||||
return element_if_equal(self.getThresholdEnergy())
|
||||
|
||||
@threshold.setter
|
||||
def threshold(self, eV):
|
||||
self.setThresholdEnergy(eV)
|
||||
|
||||
@property
|
||||
def timing(self):
|
||||
return element_if_equal(self.getTimingMode())
|
||||
|
||||
@timing.setter
|
||||
def timing(self, mode):
|
||||
self.setTimingMode(mode)
|
||||
|
||||
@property
|
||||
def trimen(self):
|
||||
return element_if_equal(self.getTrimEnergies())
|
||||
|
||||
@trimen.setter
|
||||
def trimen(self, energies):
|
||||
self.setTrimEnergies(energies)
|
||||
|
||||
@property
|
||||
def vthreshold(self):
|
||||
return element_if_equal(self.getDAC(dacIndex.THRESHOLD))
|
||||
|
@ -1,259 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Jungfrau detector class and support functions.
|
||||
Inherits from Detector.
|
||||
"""
|
||||
from .adcs import Adc, DetectorAdcs
|
||||
from .detector import Detector
|
||||
from .dacs import DetectorDacs
|
||||
from .utils import element_if_equal
|
||||
|
||||
|
||||
class JungfrauDacs(DetectorDacs):
|
||||
_dacs = [('vb_comp', 0, 4000, 1220),
|
||||
('vdd_prot', 0, 4000, 3000),
|
||||
('vin_com', 0, 4000, 1053),
|
||||
('vref_prech', 0, 4000, 1450),
|
||||
('vb_pixbuff', 0, 4000, 750),
|
||||
('vb_ds', 0, 4000, 1000),
|
||||
('vref_ds', 0, 4000, 480),
|
||||
('vref_comp', 0, 4000, 420),
|
||||
]
|
||||
_dacnames = [_d[0] for _d in _dacs]
|
||||
|
||||
class Jungfrau(Detector):
|
||||
"""
|
||||
Class used to control a Jungfrau detector. Inherits from the Detector class but a specialized
|
||||
class is needed to provide the correct dacs and unique functions.
|
||||
|
||||
"""
|
||||
_detector_dynamic_range = [4, 8, 16, 32]
|
||||
|
||||
_settings = ['dynamichg0',
|
||||
'dynamicgain',
|
||||
'fixgain1',
|
||||
'fixgain2',
|
||||
'forceswitchg1',
|
||||
'forceswitchg2']
|
||||
"""Available settings for Jungfrau"""
|
||||
|
||||
def __init__(self, multi_id=0):
|
||||
#Init on base calss
|
||||
super().__init__(multi_id)
|
||||
self._dacs = JungfrauDacs(self)
|
||||
|
||||
#Jungfrau specific temps, this can be reduced to a single value?
|
||||
self._temp = DetectorAdcs()
|
||||
self._temp.fpga = Adc('temp_fpga', self)
|
||||
# self._register = Register(self)
|
||||
|
||||
|
||||
@property
|
||||
def dacs(self):
|
||||
"""
|
||||
|
||||
An instance of DetectorDacs used for accessing the dacs of a single
|
||||
or multi detector.
|
||||
|
||||
Examples
|
||||
---------
|
||||
|
||||
::
|
||||
|
||||
#Jungfrau
|
||||
|
||||
|
||||
"""
|
||||
return self._dacs
|
||||
|
||||
@property
|
||||
def power_chip(self):
|
||||
"""Power on or off the ASICs, True for on False for off"""
|
||||
return self._api.isChipPowered()
|
||||
|
||||
@power_chip.setter
|
||||
def power_chip(self, value):
|
||||
self._api.powerChip(value)
|
||||
|
||||
@property
|
||||
def delay(self):
|
||||
"""Delay after trigger [s]"""
|
||||
return self._api.getDelay()/1e9
|
||||
|
||||
@delay.setter
|
||||
def delay(self, t):
|
||||
ns_time = int(t * 1e9)
|
||||
self._api.setDelay(ns_time)
|
||||
|
||||
@property
|
||||
def n_gates(self):
|
||||
return self._api.getNumberOfGates()
|
||||
|
||||
@n_gates.setter
|
||||
def n_gates(self, n):
|
||||
self._api.setNumberOfGates(n)
|
||||
|
||||
@property
|
||||
def n_probes(self):
|
||||
return self._api.getNumberOfProbes()
|
||||
|
||||
@n_probes.setter
|
||||
def n_probes(self, n):
|
||||
self._api.setNumberOfProbes(n)
|
||||
|
||||
@property
|
||||
def storagecell_start(self):
|
||||
"""
|
||||
First storage cell
|
||||
"""
|
||||
return self._api.getStoragecellStart()
|
||||
|
||||
@storagecell_start.setter
|
||||
def storagecell_start(self, value):
|
||||
self._api.setStoragecellStart(value)
|
||||
|
||||
|
||||
@property
|
||||
def n_storagecells(self):
|
||||
"""
|
||||
number of storage cells used for the measurements
|
||||
"""
|
||||
return self._api.getNumberOfStorageCells()
|
||||
|
||||
@n_storagecells.setter
|
||||
def n_storagecells(self, value):
|
||||
self._api.setNumberOfStorageCells(value)
|
||||
|
||||
@property
|
||||
def temp(self):
|
||||
"""
|
||||
An instance of DetectorAdcs used to read the temperature
|
||||
of different components
|
||||
|
||||
Examples
|
||||
-----------
|
||||
|
||||
::
|
||||
|
||||
detector.temp
|
||||
>>
|
||||
temp_fpga : 36.90°C, 45.60°C
|
||||
|
||||
a = detector.temp.fpga[:]
|
||||
a
|
||||
>> [36.568, 45.542]
|
||||
|
||||
|
||||
"""
|
||||
return self._temp
|
||||
|
||||
@property
|
||||
def temperature_threshold(self):
|
||||
"""Threshold for switching of chips"""
|
||||
return self._api.getThresholdTemperature()
|
||||
|
||||
@temperature_threshold.setter
|
||||
def temperature_threshold(self, t):
|
||||
self._api.setThresholdTemperature(t)
|
||||
|
||||
@property
|
||||
def temperature_control(self):
|
||||
"""
|
||||
Monitor the temperature of the detector and switch off chips if temperature_threshold is
|
||||
crossed
|
||||
|
||||
|
||||
Examples
|
||||
---------
|
||||
|
||||
::
|
||||
|
||||
#activate
|
||||
detector.temperature_control = True
|
||||
|
||||
#deactivate
|
||||
detector.temperature_control = False
|
||||
|
||||
|
||||
"""
|
||||
return self._api.getTemperatureControl()
|
||||
|
||||
@temperature_control.setter
|
||||
def temperature_control(self, v):
|
||||
self._api.setTemperatureControl(v)
|
||||
|
||||
@property
|
||||
def temperature_event(self):
|
||||
"""Have the temperature threshold been crossed?
|
||||
|
||||
Returns
|
||||
---------
|
||||
|
||||
:py:obj:`True` if the threshold have been crossed and temperature_control is active
|
||||
otherwise :py:obj:`False`
|
||||
|
||||
"""
|
||||
return self._api.getTemperatureEvent()
|
||||
|
||||
def reset_temperature_event(self):
|
||||
"""Reset the temperature_event. After reset temperature_event is False"""
|
||||
self._api.resetTemperatureEvent()
|
||||
|
||||
@property
|
||||
def rx_udpport(self):
|
||||
"""
|
||||
UDP port for the receiver. Each module have one port.
|
||||
Note! Eiger has two ports
|
||||
|
||||
::
|
||||
|
||||
[0:rx_udpport]
|
||||
|
||||
Examples
|
||||
-----------
|
||||
|
||||
::
|
||||
|
||||
d.rx_udpport
|
||||
>> [50010]
|
||||
|
||||
d.rx_udpport = [50010]
|
||||
|
||||
"""
|
||||
return self._api.getNetworkParameter('rx_udpport')
|
||||
|
||||
|
||||
@rx_udpport.setter
|
||||
def rx_udpport(self, ports):
|
||||
"""Requires iterating over elements two and two for setting ports"""
|
||||
for i, p in enumerate(ports):
|
||||
self._api.setNetworkParameter('rx_udpport', str(p), i)
|
||||
|
||||
@property
|
||||
def detector_mac(self):
|
||||
s = self._api.getNetworkParameter('detectormac')
|
||||
return element_if_equal(s)
|
||||
|
||||
|
||||
@detector_mac.setter
|
||||
def detector_mac(self, mac):
|
||||
if isinstance(mac, list):
|
||||
for i, m in enumerate(mac):
|
||||
self._api.setNetworkParameter('detectormac', m, i)
|
||||
else:
|
||||
self._api.setNetworkParameter('detectormac', mac, -1)
|
||||
|
||||
|
||||
@property
|
||||
def detector_ip(self):
|
||||
s = self._api.getNetworkParameter('detectorip')
|
||||
return element_if_equal(s)
|
||||
|
||||
@detector_ip.setter
|
||||
def detector_ip(self, ip):
|
||||
if isinstance(ip, list):
|
||||
for i, addr in enumerate(ip):
|
||||
self._api.setNetworkParameter('detectorip', addr, i)
|
||||
else:
|
||||
self._api.setNetworkParameter('detectorip', ip, -1)
|
@ -1,178 +0,0 @@
|
||||
from functools import partial
|
||||
from collections.abc import Iterable
|
||||
from collections import namedtuple
|
||||
import socket
|
||||
|
||||
from .detector import Detector
|
||||
from .utils import element_if_equal
|
||||
from .adcs import DetectorAdcs, Adc
|
||||
from .dacs import DetectorDacs
|
||||
from .detector_property import DetectorProperty
|
||||
from .registers import Register, Adc_register
|
||||
|
||||
class JungfrauCTBDacs(DetectorDacs):
|
||||
_dacs = [('dac0', 0, 4000, 1400),
|
||||
('dac1', 0, 4000, 1200),
|
||||
('dac2', 0, 4000, 900),
|
||||
('dac3', 0, 4000, 1050),
|
||||
('dac4', 0, 4000, 1400),
|
||||
('dac5', 0, 4000, 655),
|
||||
('dac6', 0, 4000, 2000),
|
||||
('dac7', 0, 4000, 1400),
|
||||
('dac8', 0, 4000, 850),
|
||||
('dac9', 0, 4000, 2000),
|
||||
('dac10', 0, 4000, 2294),
|
||||
('dac11', 0, 4000, 983),
|
||||
('dac12', 0, 4000, 1475),
|
||||
('dac13', 0, 4000, 1200),
|
||||
('dac14', 0, 4000, 1600),
|
||||
('dac15', 0, 4000, 1455),
|
||||
('dac16', 0, 4000, 0),
|
||||
('dac17', 0, 4000, 1000),
|
||||
]
|
||||
_dacnames = [_d[0] for _d in _dacs]
|
||||
|
||||
|
||||
|
||||
class JungfrauCTB(Detector):
|
||||
def __init__(self, id = 0):
|
||||
super().__init__(id)
|
||||
self._dacs = JungfrauCTBDacs(self)
|
||||
self._register = Register(self)
|
||||
self._adc_register = Adc_register(self)
|
||||
|
||||
@property
|
||||
def v_a(self):
|
||||
return self._api.getDac_mV('v_a', -1)
|
||||
|
||||
@v_a.setter
|
||||
def v_a(self, value):
|
||||
self._api.setDac_mV('v_a', -1, value)
|
||||
|
||||
@property
|
||||
def v_b(self):
|
||||
return self._api.getDac_mV('v_b', -1)
|
||||
|
||||
@v_b.setter
|
||||
def v_b(self, value):
|
||||
self._api.setDac_mV('v_b', -1, value)
|
||||
|
||||
|
||||
@property
|
||||
def v_c(self):
|
||||
return self._api.getDac_mV('v_c', -1)
|
||||
|
||||
@v_c.setter
|
||||
def v_c(self, value):
|
||||
self._api.setDac_mV('v_c', -1, value)
|
||||
|
||||
@property
|
||||
def v_d(self):
|
||||
return self._api.getDac_mV('v_d', -1)
|
||||
|
||||
@v_d.setter
|
||||
def v_d(self, value):
|
||||
self._api.setDac_mV('v_d', -1, value)
|
||||
|
||||
@property
|
||||
def v_io(self):
|
||||
return self._api.getDac_mV('v_io', -1)
|
||||
|
||||
@v_io.setter
|
||||
def v_io(self, value):
|
||||
self._api.setDac_mV('v_io', -1, value)
|
||||
|
||||
@property
|
||||
def v_limit(self):
|
||||
return self._api.getDac_mV('v_limit', -1)
|
||||
|
||||
@v_limit.setter
|
||||
def v_limit(self, value):
|
||||
self._api.setDac_mV('v_limit', -1, value)
|
||||
|
||||
@property
|
||||
def adc_register(self):
|
||||
return self._adc_register
|
||||
|
||||
# @property
|
||||
# def register(self):
|
||||
# return self._register
|
||||
|
||||
def adcOFF(self):
|
||||
"""Switch off the ADC"""
|
||||
self.adc_register[0x8] = 1
|
||||
|
||||
|
||||
|
||||
@property
|
||||
def dacs(self):
|
||||
"""
|
||||
|
||||
An instance of DetectorDacs used for accessing the dacs of a single
|
||||
or multi detector.
|
||||
|
||||
Examples
|
||||
---------
|
||||
|
||||
::
|
||||
|
||||
#JungfrauCTB
|
||||
|
||||
|
||||
"""
|
||||
return self._dacs
|
||||
|
||||
@property
|
||||
def dbitpipeline(self):
|
||||
return self._api.getDbitPipeline()
|
||||
|
||||
@dbitpipeline.setter
|
||||
def dbitpipeline(self, value):
|
||||
self._api.setDbitPipeline(value)
|
||||
|
||||
|
||||
@property
|
||||
def dbitphase(self):
|
||||
return self._api.getDbitPhase()
|
||||
|
||||
@dbitphase.setter
|
||||
def dbitphase(self, value):
|
||||
self._api.setDbitPhase(value)
|
||||
|
||||
@property
|
||||
def dbitclock(self):
|
||||
return self._api.getDbitClock()
|
||||
|
||||
@dbitclock.setter
|
||||
def dbitclock(self, value):
|
||||
self._api.setDbitClock(value)
|
||||
|
||||
@property
|
||||
def samples(self):
|
||||
return self._api.getJCTBSamples()
|
||||
|
||||
@samples.setter
|
||||
def samples(self, value):
|
||||
self._api.setJCTBSamples(value)
|
||||
|
||||
@property
|
||||
def readout_clock(self):
|
||||
"""
|
||||
Speed of the readout clock relative to the full speed
|
||||
|
||||
|
||||
Examples
|
||||
---------
|
||||
|
||||
::
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
return self._api.getReadoutClockSpeed()
|
||||
|
||||
|
||||
@readout_clock.setter
|
||||
def readout_clock(self, value):
|
||||
self._api.setReadoutClockSpeed(value)
|
@ -2,7 +2,16 @@
|
||||
Utility functions that are useful for testing and troubleshooting
|
||||
but not directly used in controlling the detector
|
||||
"""
|
||||
from collections import namedtuple
|
||||
import _sls_detector #C++ lib
|
||||
|
||||
Geometry = namedtuple('Geometry', ['x', 'y'])
|
||||
|
||||
def to_geo(value):
|
||||
if isinstance(value, _sls_detector.xy):
|
||||
return Geometry(x = value.x, y = value.y)
|
||||
else:
|
||||
raise ValueError("Can only convert sls_detector.xy")
|
||||
|
||||
def all_equal(mylist):
|
||||
"""If all elements are equal return true otherwise false"""
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,6 @@
|
||||
/* WARINING This file is auto generated any edits might be overwritten without
|
||||
* warning */
|
||||
|
||||
#include <pybind11/chrono.h>
|
||||
#include <pybind11/operators.h>
|
||||
#include <pybind11/pybind11.h>
|
||||
@ -7,6 +10,25 @@
|
||||
namespace py = pybind11;
|
||||
void init_enums(py::module &m) {
|
||||
py::class_<slsDetectorDefs> Defs(m, "slsDetectorDefs");
|
||||
py::class_<slsDetectorDefs::xy> xy(m, "xy");
|
||||
xy.def(py::init());
|
||||
xy.def(py::init<int, int>());
|
||||
xy.def_readwrite("x", &slsDetectorDefs::xy::x);
|
||||
xy.def_readwrite("y", &slsDetectorDefs::xy::y);
|
||||
|
||||
py::enum_<slsDetectorDefs::detectorType>(Defs, "detectorType")
|
||||
.value("GET_DETECTOR_TYPE",
|
||||
slsDetectorDefs::detectorType::GET_DETECTOR_TYPE)
|
||||
.value("GENERIC", slsDetectorDefs::detectorType::GENERIC)
|
||||
.value("EIGER", slsDetectorDefs::detectorType::EIGER)
|
||||
.value("GOTTHARD", slsDetectorDefs::detectorType::GOTTHARD)
|
||||
.value("JUNGFRAU", slsDetectorDefs::detectorType::JUNGFRAU)
|
||||
.value("CHIPTESTBOARD", slsDetectorDefs::detectorType::CHIPTESTBOARD)
|
||||
.value("MOENCH", slsDetectorDefs::detectorType::MOENCH)
|
||||
.value("MYTHEN3", slsDetectorDefs::detectorType::MYTHEN3)
|
||||
.value("GOTTHARD2", slsDetectorDefs::detectorType::GOTTHARD2)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::runStatus>(Defs, "runStatus")
|
||||
.value("IDLE", slsDetectorDefs::runStatus::IDLE)
|
||||
.value("ERROR", slsDetectorDefs::runStatus::ERROR)
|
||||
@ -16,4 +38,244 @@ void init_enums(py::module &m) {
|
||||
.value("RUNNING", slsDetectorDefs::runStatus::RUNNING)
|
||||
.value("STOPPED", slsDetectorDefs::runStatus::STOPPED)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::frameDiscardPolicy>(Defs, "frameDiscardPolicy")
|
||||
.value("GET_FRAME_DISCARD_POLICY",
|
||||
slsDetectorDefs::frameDiscardPolicy::GET_FRAME_DISCARD_POLICY)
|
||||
.value("NO_DISCARD", slsDetectorDefs::frameDiscardPolicy::NO_DISCARD)
|
||||
.value("DISCARD_EMPTY_FRAMES",
|
||||
slsDetectorDefs::frameDiscardPolicy::DISCARD_EMPTY_FRAMES)
|
||||
.value("DISCARD_PARTIAL_FRAMES",
|
||||
slsDetectorDefs::frameDiscardPolicy::DISCARD_PARTIAL_FRAMES)
|
||||
.value("NUM_DISCARD_POLICIES",
|
||||
slsDetectorDefs::frameDiscardPolicy::NUM_DISCARD_POLICIES)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::fileFormat>(Defs, "fileFormat")
|
||||
.value("GET_FILE_FORMAT", slsDetectorDefs::fileFormat::GET_FILE_FORMAT)
|
||||
.value("BINARY", slsDetectorDefs::fileFormat::BINARY)
|
||||
.value("HDF5", slsDetectorDefs::fileFormat::HDF5)
|
||||
.value("NUM_FILE_FORMATS",
|
||||
slsDetectorDefs::fileFormat::NUM_FILE_FORMATS)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::dimension>(Defs, "dimension")
|
||||
.value("X", slsDetectorDefs::dimension::X)
|
||||
.value("Y", slsDetectorDefs::dimension::Y)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::externalSignalFlag>(Defs, "externalSignalFlag")
|
||||
.value("GET_EXTERNAL_SIGNAL_FLAG",
|
||||
slsDetectorDefs::externalSignalFlag::GET_EXTERNAL_SIGNAL_FLAG)
|
||||
.value("SIGNAL_OFF", slsDetectorDefs::externalSignalFlag::SIGNAL_OFF)
|
||||
.value("GATE_IN_ACTIVE_HIGH",
|
||||
slsDetectorDefs::externalSignalFlag::GATE_IN_ACTIVE_HIGH)
|
||||
.value("GATE_IN_ACTIVE_LOW",
|
||||
slsDetectorDefs::externalSignalFlag::GATE_IN_ACTIVE_LOW)
|
||||
.value("TRIGGER_IN_RISING_EDGE",
|
||||
slsDetectorDefs::externalSignalFlag::TRIGGER_IN_RISING_EDGE)
|
||||
.value("TRIGGER_IN_FALLING_EDGE",
|
||||
slsDetectorDefs::externalSignalFlag::TRIGGER_IN_FALLING_EDGE)
|
||||
.value("RO_TRIGGER_IN_RISING_EDGE",
|
||||
slsDetectorDefs::externalSignalFlag::RO_TRIGGER_IN_RISING_EDGE)
|
||||
.value("RO_TRIGGER_IN_FALLING_EDGE",
|
||||
slsDetectorDefs::externalSignalFlag::RO_TRIGGER_IN_FALLING_EDGE)
|
||||
.value("GATE_OUT_ACTIVE_HIGH",
|
||||
slsDetectorDefs::externalSignalFlag::GATE_OUT_ACTIVE_HIGH)
|
||||
.value("GATE_OUT_ACTIVE_LOW",
|
||||
slsDetectorDefs::externalSignalFlag::GATE_OUT_ACTIVE_LOW)
|
||||
.value("TRIGGER_OUT_RISING_EDGE",
|
||||
slsDetectorDefs::externalSignalFlag::TRIGGER_OUT_RISING_EDGE)
|
||||
.value("TRIGGER_OUT_FALLING_EDGE",
|
||||
slsDetectorDefs::externalSignalFlag::TRIGGER_OUT_FALLING_EDGE)
|
||||
.value("RO_TRIGGER_OUT_RISING_EDGE",
|
||||
slsDetectorDefs::externalSignalFlag::RO_TRIGGER_OUT_RISING_EDGE)
|
||||
.value("RO_TRIGGER_OUT_FALLING_EDGE",
|
||||
slsDetectorDefs::externalSignalFlag::RO_TRIGGER_OUT_FALLING_EDGE)
|
||||
.value("OUTPUT_LOW", slsDetectorDefs::externalSignalFlag::OUTPUT_LOW)
|
||||
.value("OUTPUT_HIGH", slsDetectorDefs::externalSignalFlag::OUTPUT_HIGH)
|
||||
.value(
|
||||
"MASTER_SLAVE_SYNCHRONIZATION",
|
||||
slsDetectorDefs::externalSignalFlag::MASTER_SLAVE_SYNCHRONIZATION)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::timingMode>(Defs, "timingMode")
|
||||
.value("GET_TIMING_MODE", slsDetectorDefs::timingMode::GET_TIMING_MODE)
|
||||
.value("AUTO_TIMING", slsDetectorDefs::timingMode::AUTO_TIMING)
|
||||
.value("TRIGGER_EXPOSURE",
|
||||
slsDetectorDefs::timingMode::TRIGGER_EXPOSURE)
|
||||
.value("GATED", slsDetectorDefs::timingMode::GATED)
|
||||
.value("BURST_TRIGGER", slsDetectorDefs::timingMode::BURST_TRIGGER)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::dacIndex>(Defs, "dacIndex")
|
||||
.value("THRESHOLD", slsDetectorDefs::dacIndex::THRESHOLD)
|
||||
.value("CALIBRATION_PULSE",
|
||||
slsDetectorDefs::dacIndex::CALIBRATION_PULSE)
|
||||
.value("TRIMBIT_SIZE", slsDetectorDefs::dacIndex::TRIMBIT_SIZE)
|
||||
.value("PREAMP", slsDetectorDefs::dacIndex::PREAMP)
|
||||
.value("SHAPER1", slsDetectorDefs::dacIndex::SHAPER1)
|
||||
.value("SHAPER2", slsDetectorDefs::dacIndex::SHAPER2)
|
||||
.value("TEMPERATURE_ADC", slsDetectorDefs::dacIndex::TEMPERATURE_ADC)
|
||||
.value("TEMPERATURE_FPGA", slsDetectorDefs::dacIndex::TEMPERATURE_FPGA)
|
||||
.value("VREF_DS", slsDetectorDefs::dacIndex::VREF_DS)
|
||||
.value("VCASCN_PB", slsDetectorDefs::dacIndex::VCASCN_PB)
|
||||
.value("VCASCP_PB", slsDetectorDefs::dacIndex::VCASCP_PB)
|
||||
.value("VOUT_CM", slsDetectorDefs::dacIndex::VOUT_CM)
|
||||
.value("VCASC_OUT", slsDetectorDefs::dacIndex::VCASC_OUT)
|
||||
.value("VIN_CM", slsDetectorDefs::dacIndex::VIN_CM)
|
||||
.value("VREF_COMP", slsDetectorDefs::dacIndex::VREF_COMP)
|
||||
.value("IB_TESTC", slsDetectorDefs::dacIndex::IB_TESTC)
|
||||
.value("SVP", slsDetectorDefs::dacIndex::SVP)
|
||||
.value("SVN", slsDetectorDefs::dacIndex::SVN)
|
||||
.value("VTR", slsDetectorDefs::dacIndex::VTR)
|
||||
.value("VRF", slsDetectorDefs::dacIndex::VRF)
|
||||
.value("VRS", slsDetectorDefs::dacIndex::VRS)
|
||||
.value("VTGSTV", slsDetectorDefs::dacIndex::VTGSTV)
|
||||
.value("VCMP_LL", slsDetectorDefs::dacIndex::VCMP_LL)
|
||||
.value("VCMP_LR", slsDetectorDefs::dacIndex::VCMP_LR)
|
||||
.value("CAL", slsDetectorDefs::dacIndex::CAL)
|
||||
.value("VCMP_RL", slsDetectorDefs::dacIndex::VCMP_RL)
|
||||
.value("VCMP_RR", slsDetectorDefs::dacIndex::VCMP_RR)
|
||||
.value("RXB_RB", slsDetectorDefs::dacIndex::RXB_RB)
|
||||
.value("RXB_LB", slsDetectorDefs::dacIndex::RXB_LB)
|
||||
.value("VCP", slsDetectorDefs::dacIndex::VCP)
|
||||
.value("VCN", slsDetectorDefs::dacIndex::VCN)
|
||||
.value("VIS", slsDetectorDefs::dacIndex::VIS)
|
||||
.value("IO_DELAY", slsDetectorDefs::dacIndex::IO_DELAY)
|
||||
.value("ADC_VPP", slsDetectorDefs::dacIndex::ADC_VPP)
|
||||
.value("HIGH_VOLTAGE", slsDetectorDefs::dacIndex::HIGH_VOLTAGE)
|
||||
.value("TEMPERATURE_FPGAEXT",
|
||||
slsDetectorDefs::dacIndex::TEMPERATURE_FPGAEXT)
|
||||
.value("TEMPERATURE_10GE", slsDetectorDefs::dacIndex::TEMPERATURE_10GE)
|
||||
.value("TEMPERATURE_DCDC", slsDetectorDefs::dacIndex::TEMPERATURE_DCDC)
|
||||
.value("TEMPERATURE_SODL", slsDetectorDefs::dacIndex::TEMPERATURE_SODL)
|
||||
.value("TEMPERATURE_SODR", slsDetectorDefs::dacIndex::TEMPERATURE_SODR)
|
||||
.value("TEMPERATURE_FPGA2",
|
||||
slsDetectorDefs::dacIndex::TEMPERATURE_FPGA2)
|
||||
.value("TEMPERATURE_FPGA3",
|
||||
slsDetectorDefs::dacIndex::TEMPERATURE_FPGA3)
|
||||
.value("VIPRE", slsDetectorDefs::dacIndex::VIPRE)
|
||||
.value("VIINSH", slsDetectorDefs::dacIndex::VIINSH)
|
||||
.value("VDCSH", slsDetectorDefs::dacIndex::VDCSH)
|
||||
.value("VTH2", slsDetectorDefs::dacIndex::VTH2)
|
||||
.value("VPL", slsDetectorDefs::dacIndex::VPL)
|
||||
.value("VTH3", slsDetectorDefs::dacIndex::VTH3)
|
||||
.value("CASSH", slsDetectorDefs::dacIndex::CASSH)
|
||||
.value("CAS", slsDetectorDefs::dacIndex::CAS)
|
||||
.value("VICIN", slsDetectorDefs::dacIndex::VICIN)
|
||||
.value("VIPRE_OUT", slsDetectorDefs::dacIndex::VIPRE_OUT)
|
||||
.value("VREF_H_ADC", slsDetectorDefs::dacIndex::VREF_H_ADC)
|
||||
.value("VB_COMP_FE", slsDetectorDefs::dacIndex::VB_COMP_FE)
|
||||
.value("VB_COMP_ADC", slsDetectorDefs::dacIndex::VB_COMP_ADC)
|
||||
.value("VCOM_CDS", slsDetectorDefs::dacIndex::VCOM_CDS)
|
||||
.value("VREF_RESTORE", slsDetectorDefs::dacIndex::VREF_RESTORE)
|
||||
.value("VB_OPA_1ST", slsDetectorDefs::dacIndex::VB_OPA_1ST)
|
||||
.value("VREF_COMP_FE", slsDetectorDefs::dacIndex::VREF_COMP_FE)
|
||||
.value("VCOM_ADC1", slsDetectorDefs::dacIndex::VCOM_ADC1)
|
||||
.value("VREF_PRECH", slsDetectorDefs::dacIndex::VREF_PRECH)
|
||||
.value("VREF_L_ADC", slsDetectorDefs::dacIndex::VREF_L_ADC)
|
||||
.value("VREF_CDS", slsDetectorDefs::dacIndex::VREF_CDS)
|
||||
.value("VB_CS", slsDetectorDefs::dacIndex::VB_CS)
|
||||
.value("VB_OPA_FD", slsDetectorDefs::dacIndex::VB_OPA_FD)
|
||||
.value("VCOM_ADC2", slsDetectorDefs::dacIndex::VCOM_ADC2)
|
||||
.value("VB_DS", slsDetectorDefs::dacIndex::VB_DS)
|
||||
.value("VB_COMP", slsDetectorDefs::dacIndex::VB_COMP)
|
||||
.value("VB_PIXBUF", slsDetectorDefs::dacIndex::VB_PIXBUF)
|
||||
.value("VIN_COM", slsDetectorDefs::dacIndex::VIN_COM)
|
||||
.value("VDD_PROT", slsDetectorDefs::dacIndex::VDD_PROT)
|
||||
.value("V_POWER_A", slsDetectorDefs::dacIndex::V_POWER_A)
|
||||
.value("V_POWER_B", slsDetectorDefs::dacIndex::V_POWER_B)
|
||||
.value("V_POWER_C", slsDetectorDefs::dacIndex::V_POWER_C)
|
||||
.value("V_POWER_D", slsDetectorDefs::dacIndex::V_POWER_D)
|
||||
.value("V_POWER_IO", slsDetectorDefs::dacIndex::V_POWER_IO)
|
||||
.value("V_POWER_CHIP", slsDetectorDefs::dacIndex::V_POWER_CHIP)
|
||||
.value("I_POWER_A", slsDetectorDefs::dacIndex::I_POWER_A)
|
||||
.value("I_POWER_B", slsDetectorDefs::dacIndex::I_POWER_B)
|
||||
.value("I_POWER_C", slsDetectorDefs::dacIndex::I_POWER_C)
|
||||
.value("I_POWER_D", slsDetectorDefs::dacIndex::I_POWER_D)
|
||||
.value("I_POWER_IO", slsDetectorDefs::dacIndex::I_POWER_IO)
|
||||
.value("V_LIMIT", slsDetectorDefs::dacIndex::V_LIMIT)
|
||||
.value("SLOW_ADC0", slsDetectorDefs::dacIndex::SLOW_ADC0)
|
||||
.value("SLOW_ADC1", slsDetectorDefs::dacIndex::SLOW_ADC1)
|
||||
.value("SLOW_ADC2", slsDetectorDefs::dacIndex::SLOW_ADC2)
|
||||
.value("SLOW_ADC3", slsDetectorDefs::dacIndex::SLOW_ADC3)
|
||||
.value("SLOW_ADC4", slsDetectorDefs::dacIndex::SLOW_ADC4)
|
||||
.value("SLOW_ADC5", slsDetectorDefs::dacIndex::SLOW_ADC5)
|
||||
.value("SLOW_ADC6", slsDetectorDefs::dacIndex::SLOW_ADC6)
|
||||
.value("SLOW_ADC7", slsDetectorDefs::dacIndex::SLOW_ADC7)
|
||||
.value("SLOW_ADC_TEMP", slsDetectorDefs::dacIndex::SLOW_ADC_TEMP)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::detectorSettings>(Defs, "detectorSettings")
|
||||
.value("GET_SETTINGS", slsDetectorDefs::detectorSettings::GET_SETTINGS)
|
||||
.value("STANDARD", slsDetectorDefs::detectorSettings::STANDARD)
|
||||
.value("FAST", slsDetectorDefs::detectorSettings::FAST)
|
||||
.value("HIGHGAIN", slsDetectorDefs::detectorSettings::HIGHGAIN)
|
||||
.value("DYNAMICGAIN", slsDetectorDefs::detectorSettings::DYNAMICGAIN)
|
||||
.value("LOWGAIN", slsDetectorDefs::detectorSettings::LOWGAIN)
|
||||
.value("MEDIUMGAIN", slsDetectorDefs::detectorSettings::MEDIUMGAIN)
|
||||
.value("VERYHIGHGAIN", slsDetectorDefs::detectorSettings::VERYHIGHGAIN)
|
||||
.value("DYNAMICHG0", slsDetectorDefs::detectorSettings::DYNAMICHG0)
|
||||
.value("FIXGAIN1", slsDetectorDefs::detectorSettings::FIXGAIN1)
|
||||
.value("FIXGAIN2", slsDetectorDefs::detectorSettings::FIXGAIN2)
|
||||
.value("FORCESWITCHG1",
|
||||
slsDetectorDefs::detectorSettings::FORCESWITCHG1)
|
||||
.value("FORCESWITCHG2",
|
||||
slsDetectorDefs::detectorSettings::FORCESWITCHG2)
|
||||
.value("VERYLOWGAIN", slsDetectorDefs::detectorSettings::VERYLOWGAIN)
|
||||
.value("UNDEFINED", slsDetectorDefs::detectorSettings::UNDEFINED)
|
||||
.value("UNINITIALIZED",
|
||||
slsDetectorDefs::detectorSettings::UNINITIALIZED)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::clockIndex>(Defs, "clockIndex")
|
||||
.value("ADC_CLOCK", slsDetectorDefs::clockIndex::ADC_CLOCK)
|
||||
.value("DBIT_CLOCK", slsDetectorDefs::clockIndex::DBIT_CLOCK)
|
||||
.value("RUN_CLOCK", slsDetectorDefs::clockIndex::RUN_CLOCK)
|
||||
.value("SYNC_CLOCK", slsDetectorDefs::clockIndex::SYNC_CLOCK)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::readoutMode>(Defs, "readoutMode")
|
||||
.value("ANALOG_ONLY", slsDetectorDefs::readoutMode::ANALOG_ONLY)
|
||||
.value("DIGITAL_ONLY", slsDetectorDefs::readoutMode::DIGITAL_ONLY)
|
||||
.value("ANALOG_AND_DIGITAL",
|
||||
slsDetectorDefs::readoutMode::ANALOG_AND_DIGITAL)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::speedLevel>(Defs, "speedLevel")
|
||||
.value("FULL_SPEED", slsDetectorDefs::speedLevel::FULL_SPEED)
|
||||
.value("HALF_SPEED", slsDetectorDefs::speedLevel::HALF_SPEED)
|
||||
.value("QUARTER_SPEED", slsDetectorDefs::speedLevel::QUARTER_SPEED)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::portType>(Defs, "portType")
|
||||
.value("CONTROL_PORT", slsDetectorDefs::portType::CONTROL_PORT)
|
||||
.value("STOP_PORT", slsDetectorDefs::portType::STOP_PORT)
|
||||
.value("DATA_PORT", slsDetectorDefs::portType::DATA_PORT)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::masterFlags>(Defs, "masterFlags")
|
||||
.value("GET_MASTER", slsDetectorDefs::masterFlags::GET_MASTER)
|
||||
.value("NO_MASTER", slsDetectorDefs::masterFlags::NO_MASTER)
|
||||
.value("IS_MASTER", slsDetectorDefs::masterFlags::IS_MASTER)
|
||||
.value("IS_SLAVE", slsDetectorDefs::masterFlags::IS_SLAVE)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::frameModeType>(Defs, "frameModeType")
|
||||
.value("GET_FRAME_MODE", slsDetectorDefs::frameModeType::GET_FRAME_MODE)
|
||||
.value("PEDESTAL", slsDetectorDefs::frameModeType::PEDESTAL)
|
||||
.value("NEW_PEDESTAL", slsDetectorDefs::frameModeType::NEW_PEDESTAL)
|
||||
.value("FLATFIELD", slsDetectorDefs::frameModeType::FLATFIELD)
|
||||
.value("NEW_FLATFIELD", slsDetectorDefs::frameModeType::NEW_FLATFIELD)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::detectorModeType>(Defs, "detectorModeType")
|
||||
.value("GET_DETECTOR_MODE",
|
||||
slsDetectorDefs::detectorModeType::GET_DETECTOR_MODE)
|
||||
.value("COUNTING", slsDetectorDefs::detectorModeType::COUNTING)
|
||||
.value("INTERPOLATING",
|
||||
slsDetectorDefs::detectorModeType::INTERPOLATING)
|
||||
.value("ANALOG", slsDetectorDefs::detectorModeType::ANALOG)
|
||||
.export_values();
|
||||
}
|
||||
|
18
python/src/enums_in.cpp
Normal file
18
python/src/enums_in.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include <pybind11/chrono.h>
|
||||
#include <pybind11/operators.h>
|
||||
#include <pybind11/pybind11.h>
|
||||
#include <pybind11/stl.h>
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
namespace py = pybind11;
|
||||
void init_enums(py::module &m) {
|
||||
py::class_<slsDetectorDefs> Defs(m, "slsDetectorDefs");
|
||||
py::class_<slsDetectorDefs::xy> xy(m, "xy");
|
||||
xy.def(py::init());
|
||||
xy.def(py::init<int,int>());
|
||||
xy.def_readwrite("x", &slsDetectorDefs::xy::x);
|
||||
xy.def_readwrite("y", &slsDetectorDefs::xy::y);
|
||||
|
||||
[[ENUMS]]
|
||||
|
||||
}
|
@ -4,38 +4,112 @@
|
||||
#include <pybind11/stl.h>
|
||||
|
||||
#include "Detector.h"
|
||||
#include "ToString.h"
|
||||
#include "network_utils.h"
|
||||
#include "sls_detector_defs.h"
|
||||
#include "typecaster.h"
|
||||
namespace py = pybind11;
|
||||
void init_experimental(py::module &m) {
|
||||
// Experimental API to use the multi directly and inherit from to reduce
|
||||
// code duplication need to investigate how to handle documentation
|
||||
using sls::Detector;
|
||||
using sls::Positions;
|
||||
py::class_<Detector> multiDetectorApi(m, "multiDetectorApi");
|
||||
multiDetectorApi
|
||||
using defs = slsDetectorDefs;
|
||||
|
||||
py::class_<Detector> CppDetectorApi(m, "CppDetectorApi");
|
||||
CppDetectorApi
|
||||
.def(py::init<int>())
|
||||
|
||||
// Acq related
|
||||
// Configuration
|
||||
.def("freeSharedMemory", (void (Detector::*)()) &Detector::freeSharedMemory)
|
||||
.def("loadConfig", &Detector::loadConfig)
|
||||
.def("loadParameters", &Detector::loadParameters)
|
||||
.def("setHostname", &Detector::setHostname)
|
||||
.def("getHostname", &Detector::getHostname, py::arg() = Positions{})
|
||||
.def("getShmId", &Detector::getShmId)
|
||||
.def("getFirmwareVersion", &Detector::getFirmwareVersion,
|
||||
py::arg() = Positions{})
|
||||
.def("getDetectorServerVersion", &Detector::getDetectorServerVersion,
|
||||
py::arg() = Positions{})
|
||||
.def("getSerialNumber", &Detector::getSerialNumber,
|
||||
py::arg() = Positions{})
|
||||
.def("getClientVersion", &Detector::getClientVersion)
|
||||
.def("getReceiverVersion", &Detector::getReceiverVersion,
|
||||
py::arg() = Positions{})
|
||||
.def("getDetectorType", &Detector::getDetectorType,
|
||||
py::arg() = Positions{})
|
||||
.def("size", &Detector::size)
|
||||
.def("getModuleGeometry", &Detector::getModuleGeometry)
|
||||
.def("getModuleSize", &Detector::getModuleSize, py::arg() = Positions{})
|
||||
.def("getDetectorSize", &Detector::getDetectorSize)
|
||||
.def("setDetectorSize", &Detector::setDetectorSize)
|
||||
.def("getSettings", &Detector::getSettings, py::arg() = Positions{})
|
||||
.def("setSettings", &Detector::setSettings, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
// TODO! Python funcs for callbacks?
|
||||
|
||||
// Acquisition Parameters
|
||||
.def("getNumberOfFrames", &Detector::getNumberOfFrames)
|
||||
.def("setNumberOfFrames", &Detector::setNumberOfFrames)
|
||||
.def("getNumberOfTriggers", &Detector::getNumberOfTriggers)
|
||||
.def("setNumberOfTriggers", &Detector::setNumberOfTriggers)
|
||||
.def("setExptime", &Detector::setExptime, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getExptime", &Detector::getExptime, py::arg() = Positions{})
|
||||
.def("setPeriod", &Detector::setPeriod, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getPeriod", &Detector::getPeriod, py::arg() = Positions{})
|
||||
.def("getDelayAfterTrigger", &Detector::getDelayAfterTrigger,
|
||||
py::arg() = Positions{})
|
||||
.def("setDelayAfterTrigger", &Detector::setDelayAfterTrigger, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getNumberOfFramesLeft", &Detector::getNumberOfFramesLeft,
|
||||
py::arg() = Positions{})
|
||||
.def("getNumberOfTriggersLeft", &Detector::getNumberOfTriggersLeft,
|
||||
py::arg() = Positions{})
|
||||
.def("getDelayAfterTriggerLeft", &Detector::getDelayAfterTriggerLeft,
|
||||
py::arg() = Positions{})
|
||||
.def("getSpeed", &Detector::getSpeed, py::arg() = Positions{})
|
||||
.def("setSpeed", &Detector::setSpeed, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getADCPhase", &Detector::getADCPhase, py::arg() = Positions{})
|
||||
|
||||
.def("setADCPhase", &Detector::setADCPhase, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getADCPhaseInDegrees", &Detector::getADCPhaseInDegrees,
|
||||
py::arg() = Positions{})
|
||||
.def("setADCPhaseInDegrees", &Detector::setADCPhaseInDegrees, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getHighVoltage", &Detector::getHighVoltage,
|
||||
py::arg() = Positions{})
|
||||
.def("setHighVoltage", &Detector::setHighVoltage, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("getTemperature", &Detector::getTemperature, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("getDAC", &Detector::getDAC, py::arg(), py::arg() = false,
|
||||
py::arg() = Positions{})
|
||||
.def("setDAC", &Detector::setDAC, py::arg(), py::arg(), py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("getTimingMode", &Detector::getTimingMode, py::arg() = Positions{})
|
||||
|
||||
.def("setTimingMode", &Detector::setTimingMode, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
// ACQUISITION
|
||||
.def("acquire", &Detector::acquire)
|
||||
.def("startReceiver", &Detector::startReceiver, py::arg() = Positions{})
|
||||
.def("stopReceiver", &Detector::stopReceiver, py::arg() = Positions{})
|
||||
.def("getAcquiringFlag", &Detector::getAcquiringFlag)
|
||||
.def("setAcquiringFlag", &Detector::setAcquiringFlag)
|
||||
.def("startDetector", &Detector::startDetector)
|
||||
.def("stopDetector", &Detector::stopDetector)
|
||||
.def("startReceiver", &Detector::startReceiver)
|
||||
.def("stopReceiver", &Detector::stopReceiver)
|
||||
.def("clearAcquiringFlag", &Detector::clearAcquiringFlag)
|
||||
.def("getDetectorStatus", &Detector::getDetectorStatus,
|
||||
py::arg() = Positions{})
|
||||
.def("getReceiverStatus", &Detector::getReceiverStatus,
|
||||
py::arg() = Positions{})
|
||||
|
||||
// Configuration
|
||||
.def("free", &Detector::freeSharedMemory)
|
||||
.def("setConfig", &Detector::setConfig)
|
||||
.def("getHostname", &Detector::getHostname, py::arg() = Positions{})
|
||||
|
||||
// Bits and registers
|
||||
.def("setBit", &Detector::setBit, py::arg(), py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("clearBit", &Detector::clearBit, py::arg(), py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getRegister", &Detector::getRegister, py::arg(),
|
||||
.def("getFramesCaught", &Detector::getFramesCaught,
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("getStartingFrameNumber", &Detector::getStartingFrameNumber,
|
||||
@ -43,11 +117,233 @@ void init_experimental(py::module &m) {
|
||||
.def("setStartingFrameNumber", &Detector::setStartingFrameNumber,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
|
||||
// File
|
||||
.def("getFileName", &Detector::getFileName)
|
||||
.def("setFileName", &Detector::setFileName, py::arg())
|
||||
.def("sendSoftwareTrigger", &Detector::sendSoftwareTrigger,
|
||||
py::arg() = Positions{})
|
||||
|
||||
// Network Configuration (Detector<->Receiver)
|
||||
.def("getNumberofUDPInterfaces", &Detector::getNumberofUDPInterfaces,
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("setNumberofUDPInterfaces", &Detector::setNumberofUDPInterfaces,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getSelectedUDPInterface", &Detector::getSelectedUDPInterface,
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("selectUDPInterface", &Detector::selectUDPInterface, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
// Using lambda to allow for conversion from IpAddr
|
||||
.def("getSourceUDPIP",
|
||||
[](const Detector &d, Positions pos) {
|
||||
std::vector<std::string> res;
|
||||
for (const auto &s : d.getSourceUDPIP(pos))
|
||||
res.push_back(s.str());
|
||||
return res;
|
||||
},
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("setSourceUDPIP",
|
||||
[](Detector &d, std::string ip, Positions pos) {
|
||||
d.setSourceUDPIP(sls::IpAddr(ip), pos);
|
||||
},
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getSourceUDPIP2",
|
||||
[](const Detector &d, Positions pos) {
|
||||
std::vector<std::string> res;
|
||||
for (const auto &s : d.getSourceUDPIP2(pos))
|
||||
res.push_back(s.str());
|
||||
return res;
|
||||
},
|
||||
py::arg() = Positions{})
|
||||
.def("setSourceUDPIP2",
|
||||
[](Detector &d, std::string ip, Positions pos) {
|
||||
d.setSourceUDPIP2(sls::IpAddr(ip), pos);
|
||||
},
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getSourceUDPMAC",
|
||||
[](const Detector &d, Positions pos) {
|
||||
std::vector<std::string> res;
|
||||
for (const auto &s : d.getSourceUDPMAC(pos))
|
||||
res.push_back(s.str());
|
||||
return res;
|
||||
},
|
||||
py::arg() = Positions{})
|
||||
.def("setSourceUDPMAC",
|
||||
[](Detector &d, std::string mac, Positions pos) {
|
||||
d.setSourceUDPMAC(sls::MacAddr(mac), pos);
|
||||
},
|
||||
py::arg(), py::arg() = Positions{})
|
||||
|
||||
.def("getSourceUDPMAC2",
|
||||
[](const Detector &d, Positions pos) {
|
||||
std::vector<std::string> res;
|
||||
for (const auto &s : d.getSourceUDPMAC2(pos))
|
||||
res.push_back(s.str());
|
||||
return res;
|
||||
},
|
||||
py::arg() = Positions{})
|
||||
.def("setSourceUDPMAC2",
|
||||
[](Detector &d, std::string mac, Positions pos) {
|
||||
d.setSourceUDPMAC2(sls::MacAddr(mac), pos);
|
||||
},
|
||||
py::arg(), py::arg() = Positions{})
|
||||
|
||||
.def("getDestinationUDPIP",
|
||||
[](const Detector &d, Positions pos) {
|
||||
std::vector<std::string> res;
|
||||
for (const auto &s : d.getDestinationUDPIP(pos))
|
||||
res.push_back(s.str());
|
||||
return res;
|
||||
},
|
||||
py::arg() = Positions{})
|
||||
.def("setDestinationUDPIP",
|
||||
[](Detector &d, std::string ip, Positions pos) {
|
||||
d.setDestinationUDPIP(sls::IpAddr(ip), pos);
|
||||
},
|
||||
py::arg(), py::arg() = Positions{})
|
||||
|
||||
.def("getDestinationUDPIP2",
|
||||
[](const Detector &d, Positions pos) {
|
||||
std::vector<std::string> res;
|
||||
for (const auto &s : d.getDestinationUDPIP2(pos))
|
||||
res.push_back(s.str());
|
||||
return res;
|
||||
},
|
||||
py::arg() = Positions{})
|
||||
.def("setDestinationUDPIP2",
|
||||
[](Detector &d, std::string ip, Positions pos) {
|
||||
d.setDestinationUDPIP2(sls::IpAddr(ip), pos);
|
||||
},
|
||||
py::arg(), py::arg() = Positions{})
|
||||
|
||||
.def("getDestinationUDPMAC",
|
||||
[](const Detector &d, Positions pos) {
|
||||
std::vector<std::string> res;
|
||||
for (const auto &s : d.getDestinationUDPMAC(pos))
|
||||
res.push_back(s.str());
|
||||
return res;
|
||||
},
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("setDestinationUDPMAC",
|
||||
[](Detector &d, std::string mac, Positions pos) {
|
||||
d.setDestinationUDPMAC(sls::MacAddr(mac), pos);
|
||||
},
|
||||
py::arg(), py::arg() = Positions{})
|
||||
|
||||
.def("getDestinationUDPMAC2",
|
||||
[](const Detector &d, Positions pos) {
|
||||
std::vector<std::string> res;
|
||||
for (const auto &s : d.getDestinationUDPMAC2(pos))
|
||||
res.push_back(s.str());
|
||||
return res;
|
||||
},
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("setDestinationUDPMAC2",
|
||||
[](Detector &d, std::string mac, Positions pos) {
|
||||
d.setDestinationUDPMAC2(sls::MacAddr(mac), pos);
|
||||
},
|
||||
py::arg(), py::arg() = Positions{})
|
||||
|
||||
.def("getDestinationUDPPort", &Detector::getDestinationUDPPort,
|
||||
py::arg() = Positions{})
|
||||
.def("setDestinationUDPPort", &Detector::setDestinationUDPPort,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getDestinationUDPPort2", &Detector::getDestinationUDPPort2,
|
||||
py::arg() = Positions{})
|
||||
.def("setDestinationUDPPort2", &Detector::setDestinationUDPPort2,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
|
||||
.def("printRxConfiguration", &Detector::printRxConfiguration,
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("getTenGiga", &Detector::getTenGiga, py::arg() = Positions{})
|
||||
.def("setTenGiga", &Detector::setTenGiga, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getTenGigaFlowControl", &Detector::getTenGigaFlowControl,
|
||||
py::arg() = Positions{})
|
||||
.def("setTenGigaFlowControl", &Detector::setTenGigaFlowControl,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getTransmissionDelayFrame", &Detector::getTransmissionDelayFrame,
|
||||
py::arg() = Positions{})
|
||||
.def("setTransmissionDelayFrame", &Detector::setTransmissionDelayFrame,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
|
||||
.def("getTransmissionDelayLeft", &Detector::getTransmissionDelayLeft,
|
||||
py::arg() = Positions{})
|
||||
.def("setTransmissionDelayLeft", &Detector::setTransmissionDelayLeft,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getTransmissionDelayRight", &Detector::getTransmissionDelayRight,
|
||||
py::arg() = Positions{})
|
||||
.def("setTransmissionDelayRight", &Detector::setTransmissionDelayRight,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* RECEIVER CONFIG *
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
.def("getUseReceiverFlag", &Detector::getUseReceiverFlag,
|
||||
py::arg() = Positions{})
|
||||
.def("getRxHostname", &Detector::getRxHostname, py::arg() = Positions{})
|
||||
.def("setRxHostname", &Detector::setRxHostname, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getRxPort", &Detector::getRxPort, py::arg() = Positions{})
|
||||
.def("setRxPort", &Detector::setRxPort, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getRxFifoDepth", &Detector::getRxFifoDepth,
|
||||
py::arg() = Positions{})
|
||||
.def("setRxFifoDepth", &Detector::setRxFifoDepth, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getRxSilentMode", &Detector::getRxSilentMode,
|
||||
py::arg() = Positions{})
|
||||
.def("setRxSilentMode", &Detector::setRxSilentMode, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getRxFrameDiscardPolicy", &Detector::getRxFrameDiscardPolicy,
|
||||
py::arg() = Positions{})
|
||||
.def("setRxFrameDiscardPolicy", &Detector::setRxFrameDiscardPolicy,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getPartialFramesPadding", &Detector::getPartialFramesPadding,
|
||||
py::arg() = Positions{})
|
||||
.def("setPartialFramesPadding", &Detector::setPartialFramesPadding,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getRxUDPSocketBufferSize", &Detector::getRxUDPSocketBufferSize,
|
||||
py::arg() = Positions{})
|
||||
.def("setRxUDPSocketBufferSize", &Detector::setRxUDPSocketBufferSize,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getRxRealUDPSocketBufferSize",
|
||||
&Detector::getRxRealUDPSocketBufferSize, py::arg() = Positions{})
|
||||
.def("getRxLock", &Detector::getRxLock, py::arg() = Positions{})
|
||||
.def("setRxLock", &Detector::setRxLock, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getRxLastClientIP", &Detector::getRxLastClientIP,
|
||||
py::arg() = Positions{})
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* FILE *
|
||||
* *
|
||||
* ************************************************/
|
||||
.def("getFileFormat", &Detector::getFileFormat, py::arg() = Positions{})
|
||||
.def("setFileFormat", &Detector::setFileFormat, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getFilePath", &Detector::getFilePath, py::arg() = Positions{})
|
||||
.def("setFilePath", &Detector::setFilePath, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getFileNamePrefix", &Detector::getFileNamePrefix,
|
||||
py::arg() = Positions{})
|
||||
.def("setFileNamePrefix", &Detector::setFileNamePrefix, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getFilePath", &Detector::getFilePath)
|
||||
.def("setFilePath", &Detector::setFilePath, py::arg())
|
||||
.def("setFilePath", &Detector::setFilePath, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("getAcquisitionIndex", &Detector::getAcquisitionIndex,
|
||||
py::arg() = Positions{})
|
||||
.def("setAcquisitionIndex", &Detector::setAcquisitionIndex, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setFileWrite", &Detector::setFileWrite, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getFileWrite", &Detector::getFileWrite, py::arg() = Positions{})
|
||||
@ -55,14 +351,264 @@ void init_experimental(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("getFileOverWrite", &Detector::getFileOverWrite,
|
||||
py::arg() = Positions{})
|
||||
.def("setMasterFileWrite", &Detector::setMasterFileWrite, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getMasterFileWrite", &Detector::getMasterFileWrite,
|
||||
py::arg() = Positions{})
|
||||
.def("setFramesPerFile", &Detector::setFramesPerFile, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getFramesPerFile", &Detector::getFramesPerFile,
|
||||
py::arg() = Positions{})
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* ZMQ Streaming Parameters (Receiver<->Client)*
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
.def("getRxZmqDataStream", &Detector::getRxZmqDataStream,
|
||||
py::arg() = Positions{})
|
||||
.def("setRxZmqDataStream", &Detector::setRxZmqDataStream, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getRxZmqFrequency", &Detector::getRxZmqFrequency,
|
||||
py::arg() = Positions{})
|
||||
.def("setRxZmqFrequency", &Detector::setRxZmqFrequency, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getRxZmqTimer", &Detector::getRxZmqTimer, py::arg() = Positions{})
|
||||
.def("setRxZmqTimer", &Detector::setRxZmqTimer, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getRxZmqPort", &Detector::getRxZmqPort, py::arg() = Positions{})
|
||||
.def("setRxZmqPort", &Detector::setRxZmqPort, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getRxZmqIP", &Detector::getRxZmqIP, py::arg() = Positions{})
|
||||
.def("setRxZmqIP", &Detector::setRxZmqIP, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getClientZmqPort", &Detector::getClientZmqPort,
|
||||
py::arg() = Positions{})
|
||||
.def("setClientZmqPort", &Detector::setClientZmqPort, py::arg(),
|
||||
py::arg() = -1)
|
||||
.def("getClientZmqIp", &Detector::getClientZmqIp,
|
||||
py::arg() = Positions{})
|
||||
.def("setClientZmqIp", &Detector::setClientZmqIp, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Eiger Specific *
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
.def("getDynamicRange", &Detector::getDynamicRange,
|
||||
py::arg() = Positions{})
|
||||
.def("setDynamicRange", &Detector::setDynamicRange)
|
||||
.def("getSubExptime", &Detector::getSubExptime, py::arg() = Positions{})
|
||||
.def("setSubExptime", &Detector::setSubExptime, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getSubDeadTime", &Detector::getSubDeadTime,
|
||||
py::arg() = Positions{})
|
||||
.def("setSubDeadTime", &Detector::setSubDeadTime, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("getThresholdEnergy", &Detector::getThresholdEnergy,
|
||||
py::arg() = Positions{})
|
||||
.def("setThresholdEnergy", &Detector::setThresholdEnergy, py::arg(),
|
||||
py::arg() = defs::STANDARD, py::arg() = true,
|
||||
py::arg() = Positions{})
|
||||
.def("getSettingsPath", &Detector::getSettingsPath,
|
||||
py::arg() = Positions{})
|
||||
.def("setSettingsPath", &Detector::setSettingsPath, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("loadTrimbits", &Detector::loadTrimbits, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getRxAddGapPixels", &Detector::getRxAddGapPixels,
|
||||
py::arg() = Positions{})
|
||||
.def("setRxAddGapPixels", &Detector::setRxAddGapPixels)
|
||||
.def("getParallelMode", &Detector::getParallelMode,
|
||||
py::arg() = Positions{})
|
||||
.def("setParallelMode", &Detector::setParallelMode, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getOverFlowMode", &Detector::getOverFlowMode,
|
||||
py::arg() = Positions{})
|
||||
.def("setOverFlowMode", &Detector::setOverFlowMode, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getStoreInRamMode", &Detector::getStoreInRamMode,
|
||||
py::arg() = Positions{})
|
||||
.def("setStoreInRamMode", &Detector::setStoreInRamMode, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getBottom", &Detector::getBottom, py::arg() = Positions{})
|
||||
.def("setBottom", &Detector::setBottom, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getAllTrimbits", &Detector::getAllTrimbits,
|
||||
py::arg() = Positions{})
|
||||
.def("setAllTrimbits", &Detector::setAllTrimbits, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getTrimEnergies", &Detector::getTrimEnergies,
|
||||
py::arg() = Positions{})
|
||||
.def("setTrimEnergies", &Detector::setTrimEnergies, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getRateCorrection", &Detector::getRateCorrection,
|
||||
py::arg() = Positions{})
|
||||
.def("setRateCorrection", &Detector::setRateCorrection, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setDefaultRateCorrection", &Detector::setDefaultRateCorrection,
|
||||
py::arg() = Positions{})
|
||||
.def("getPartialReadout", &Detector::getPartialReadout,
|
||||
py::arg() = Positions{})
|
||||
.def("setPartialReadout", &Detector::setPartialReadout, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getInterruptSubframe", &Detector::getInterruptSubframe,
|
||||
py::arg() = Positions{})
|
||||
.def("setInterruptSubframe", &Detector::setInterruptSubframe, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("getMeasuredPeriod", &Detector::getMeasuredPeriod,
|
||||
py::arg() = Positions{})
|
||||
.def("getMeasuredSubFramePeriod", &Detector::getMeasuredSubFramePeriod,
|
||||
py::arg() = Positions{})
|
||||
.def("getActive", &Detector::getActive, py::arg() = Positions{})
|
||||
.def("setActive", &Detector::setActive, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getRxPadDeactivatedMode", &Detector::getRxPadDeactivatedMode,
|
||||
py::arg() = Positions{})
|
||||
.def("setRxPadDeactivatedMode", &Detector::setRxPadDeactivatedMode,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getPartialReset", &Detector::getPartialReset,
|
||||
py::arg() = Positions{})
|
||||
.def("setPartialReset", &Detector::setPartialReset, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("pulsePixel", &Detector::pulsePixel, py::arg(), py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("pulsePixelNMove", &Detector::pulsePixelNMove, py::arg(),
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("pulseChip", &Detector::pulseChip, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getQuad", &Detector::getQuad, py::arg() = Positions{})
|
||||
.def("setQuad", &Detector::setQuad)
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Jungfrau Specific *
|
||||
* *
|
||||
* ************************************************/
|
||||
.def("getThresholdTemperature", &Detector::getThresholdTemperature,
|
||||
py::arg() = Positions{})
|
||||
.def("setThresholdTemperature", &Detector::setThresholdTemperature,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getTemperatureControl", &Detector::getTemperatureControl,
|
||||
py::arg() = Positions{})
|
||||
.def("setTemperatureControl", &Detector::setTemperatureControl,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getTemperatureEvent", &Detector::getTemperatureEvent,
|
||||
py::arg() = Positions{})
|
||||
.def("resetTemperatureEvent", &Detector::resetTemperatureEvent,
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("getPowerChip", &Detector::getPowerChip, py::arg() = Positions{})
|
||||
.def("setPowerChip", &Detector::setPowerChip, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getAutoCompDisable", &Detector::getAutoCompDisable,
|
||||
py::arg() = Positions{})
|
||||
.def("setAutoCompDisable", &Detector::setAutoCompDisable, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("getNumberOfAdditionalStorageCells",
|
||||
&Detector::getNumberOfAdditionalStorageCells)
|
||||
.def("setNumberOfAdditionalStorageCells",
|
||||
&Detector::setNumberOfAdditionalStorageCells)
|
||||
.def("getStorageCellStart", &Detector::getStorageCellStart,
|
||||
py::arg() = Positions{})
|
||||
.def("setStoragecellStart", &Detector::setStoragecellStart, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("setStorageCellDelay", &Detector::setStorageCellDelay, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
// Bits and registers
|
||||
.def("setBit", &Detector::setBit, py::arg(), py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("clearBit", &Detector::clearBit, py::arg(), py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("readRegister", &Detector::readRegister, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("writeRegister", &Detector::writeRegister, py::arg(), py::arg(),
|
||||
py::arg() = Positions{})
|
||||
|
||||
.def("getStartingFrameNumber", &Detector::getStartingFrameNumber,
|
||||
py::arg() = Positions{})
|
||||
.def("setStartingFrameNumber", &Detector::setStartingFrameNumber,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Insignificant *
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
.def("getControlPort", &Detector::getControlPort,
|
||||
py::arg() = Positions{})
|
||||
.def("setControlPort", &Detector::setControlPort, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getStopPort", &Detector::getStopPort, py::arg() = Positions{})
|
||||
.def("setStopPort", &Detector::setStopPort, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getDetectorLock", &Detector::getDetectorLock,
|
||||
py::arg() = Positions{})
|
||||
.def("setDetectorLock", &Detector::setDetectorLock, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getLastClientIP", &Detector::getLastClientIP,
|
||||
py::arg() = Positions{})
|
||||
.def("executeCommand", &Detector::executeCommand, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getNumberOfFramesFromStart",
|
||||
&Detector::getNumberOfFramesFromStart, py::arg() = Positions{})
|
||||
.def("getActualTime", &Detector::getActualTime, py::arg() = Positions{})
|
||||
.def("getMeasurementTime", &Detector::getMeasurementTime,
|
||||
py::arg() = Positions{})
|
||||
.def("getUserDetails", &Detector::getUserDetails)
|
||||
.def("getRxCurrentFrameIndex", &Detector::getRxCurrentFrameIndex,
|
||||
py::arg() = Positions{})
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* CTB Specific *
|
||||
* *
|
||||
* ************************************************/
|
||||
.def("getNumberOfAnalogSamples", &Detector::getNumberOfAnalogSamples,
|
||||
py::arg() = Positions{})
|
||||
.def("setNumberOfAnalogSamples", &Detector::setNumberOfAnalogSamples,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getNumberOfDigitalSamples", &Detector::getNumberOfDigitalSamples,
|
||||
py::arg() = Positions{})
|
||||
.def("setNumberOfDigitalSamples", &Detector::setNumberOfDigitalSamples,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getReadoutMode", &Detector::getReadoutMode,
|
||||
py::arg() = Positions{})
|
||||
.def("setReadoutMode", &Detector::setReadoutMode, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getDBITPhase", &Detector::getDBITPhase, py::arg() = Positions{})
|
||||
.def("setDBITPhase", &Detector::setDBITPhase, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getMaxDBITPhaseShift", &Detector::getMaxDBITPhaseShift,
|
||||
py::arg() = Positions{})
|
||||
.def("getDBITPhaseInDegrees", &Detector::getDBITPhaseInDegrees,
|
||||
py::arg() = Positions{})
|
||||
.def("setDBITPhaseInDegrees", &Detector::setDBITPhaseInDegrees,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getADCClock", &Detector::getADCClock, py::arg() = Positions{})
|
||||
.def("setADCClock", &Detector::setADCClock, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getDBITClock", &Detector::getDBITClock, py::arg() = Positions{})
|
||||
.def("setDBITClock", &Detector::setDBITClock, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getRUNClock", &Detector::getRUNClock, py::arg() = Positions{})
|
||||
.def("setRUNClock", &Detector::setRUNClock, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getSYNCClock", &Detector::getSYNCClock, py::arg() = Positions{})
|
||||
|
||||
// Time
|
||||
.def("setExptime", &Detector::setExptime, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getExptime", &Detector::getExptime, py::arg() = Positions{})
|
||||
.def("setPeriod", &Detector::setPeriod, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getPeriod", &Detector::getPeriod, py::arg() = Positions{})
|
||||
|
||||
.def("setSubExptime", &Detector::setSubExptime, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getSubExptime", &Detector::getSubExptime,
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <pybind11/stl.h>
|
||||
|
||||
#include "Detector.h"
|
||||
#include "DetectorPythonInterface.h"
|
||||
#include "Result.h"
|
||||
#include "mythenFileIO.h"
|
||||
#include <chrono>
|
||||
@ -12,14 +11,6 @@
|
||||
|
||||
#include "typecaster.h"
|
||||
|
||||
// // Add type_typecaster to pybind for our wrapper type
|
||||
// namespace pybind11 {
|
||||
// namespace detail {
|
||||
// template <typename Type, typename Alloc>
|
||||
// struct type_caster<sls::Result<Type, Alloc>>
|
||||
// : list_caster<sls::Result<Type, Alloc>, Type> {};
|
||||
// } // namespace detail
|
||||
// } // namespace pybind11
|
||||
|
||||
using ds = std::chrono::duration<double>;
|
||||
|
||||
@ -40,308 +31,6 @@ PYBIND11_MODULE(_sls_detector, m) {
|
||||
init_enums(m);
|
||||
init_experimental(m);
|
||||
|
||||
py::class_<DetectorPythonInterface> DetectorApi(m, "DetectorApi", R"pbdoc(
|
||||
Interface to the multiSlsDetector class through Detector.h These functions
|
||||
are used by the python classes Eiger and Jungfrau and normally it is better
|
||||
to use them than to directly access functions here.
|
||||
|
||||
However it is possible to access these functions...
|
||||
|
||||
::
|
||||
|
||||
#Using the python class
|
||||
from sls_detector import Eiger
|
||||
d = Eiger()
|
||||
d._api.getThresholdEnergy()
|
||||
|
||||
from _sls_detector import DetectorApi
|
||||
api = DetectorApi(0)
|
||||
api.getNumberOfFrames()
|
||||
|
||||
#But the Pythonic way is almost alway simpler
|
||||
d = Eiger()
|
||||
d.n_frames
|
||||
>> 10
|
||||
|
||||
)pbdoc");
|
||||
DetectorApi.def(py::init<int>())
|
||||
.def("freeSharedMemory", &DetectorPythonInterface::freeSharedMemory)
|
||||
.def("getMultiDetectorId", &DetectorPythonInterface::getMultiDetectorId)
|
||||
.def("acq", &DetectorPythonInterface::acquire)
|
||||
.def("getAcquiringFlag", &DetectorPythonInterface::getAcquiringFlag)
|
||||
.def("setAcquiringFlag", &DetectorPythonInterface::setAcquiringFlag)
|
||||
|
||||
.def("setAllTrimbits", &DetectorPythonInterface::setAllTrimbits)
|
||||
.def("getAllTrimbits", &DetectorPythonInterface::getAllTrimbits)
|
||||
.def("setCounterBit", &DetectorPythonInterface::setCounterBit)
|
||||
.def("getCounterBit", &DetectorPythonInterface::getCounterBit)
|
||||
|
||||
.def("getAdc", &DetectorPythonInterface::getAdc)
|
||||
.def("getDac", &DetectorPythonInterface::getDac)
|
||||
.def("getDac_mV", &DetectorPythonInterface::getDac_mV)
|
||||
.def("setDac", &DetectorPythonInterface::setDac)
|
||||
.def("setDac_mV", &DetectorPythonInterface::setDac_mV)
|
||||
.def("getDacFromIndex", &DetectorPythonInterface::getDacFromIndex)
|
||||
.def("setDacFromIndex", &DetectorPythonInterface::setDacFromIndex)
|
||||
|
||||
.def("getDbitPipeline", &DetectorPythonInterface::getDbitPipeline)
|
||||
.def("setDbitPipeline", &DetectorPythonInterface::setDbitPipeline)
|
||||
.def("getDbitPhase", &DetectorPythonInterface::getDbitPhase)
|
||||
.def("setDbitPhase", &DetectorPythonInterface::setDbitPhase)
|
||||
.def("getDbitClock", &DetectorPythonInterface::getDbitClock)
|
||||
.def("setDbitClock", &DetectorPythonInterface::setDbitClock)
|
||||
|
||||
.def("setThresholdEnergy", &DetectorPythonInterface::setThresholdEnergy)
|
||||
.def("getThresholdEnergy", &DetectorPythonInterface::getThresholdEnergy)
|
||||
|
||||
.def("getSettings", &DetectorPythonInterface::getSettings)
|
||||
.def("setSettings", &DetectorPythonInterface::setSettings)
|
||||
.def("getSettingsDir", &DetectorPythonInterface::getSettingsDir)
|
||||
.def("setSettingsDir", &DetectorPythonInterface::setSettingsDir)
|
||||
|
||||
.def("loadTrimbitFile", &DetectorPythonInterface::loadTrimbitFile)
|
||||
.def("setTrimEnergies", &DetectorPythonInterface::setTrimEnergies)
|
||||
.def("getTrimEnergies", &DetectorPythonInterface::getTrimEnergies)
|
||||
|
||||
.def("pulseChip", &DetectorPythonInterface::pulseChip)
|
||||
.def("pulseAllPixels", &DetectorPythonInterface::pulseAllPixels)
|
||||
.def("pulseDiagonal", &DetectorPythonInterface::pulseDiagonal)
|
||||
.def("getRunStatus", &DetectorPythonInterface::getRunStatus)
|
||||
.def("readConfigurationFile",
|
||||
&DetectorPythonInterface::readConfigurationFile)
|
||||
.def("readParametersFile", &DetectorPythonInterface::readParametersFile)
|
||||
.def("checkOnline", &DetectorPythonInterface::checkOnline)
|
||||
.def("setReadoutClockSpeed",
|
||||
&DetectorPythonInterface::setReadoutClockSpeed)
|
||||
.def("getReadoutClockSpeed",
|
||||
&DetectorPythonInterface::getReadoutClockSpeed)
|
||||
.def("getSyncClkSpeed", &DetectorPythonInterface::getSyncClkSpeed)
|
||||
.def("getHostname", &DetectorPythonInterface::getHostname)
|
||||
.def("setHostname", &DetectorPythonInterface::setHostname)
|
||||
|
||||
.def("getReceiverPort", &DetectorPythonInterface::getReceiverPort)
|
||||
.def("setReceiverPort", &DetectorPythonInterface::setReceiverPort)
|
||||
|
||||
.def("isChipPowered", &DetectorPythonInterface::isChipPowered)
|
||||
.def("powerChip", &DetectorPythonInterface::powerChip)
|
||||
|
||||
.def("readRegister", &DetectorPythonInterface::readRegister)
|
||||
.def("writeRegister", &DetectorPythonInterface::writeRegister)
|
||||
.def("writeAdcRegister", &DetectorPythonInterface::writeAdcRegister)
|
||||
.def("setBitInRegister", &DetectorPythonInterface::setBitInRegister)
|
||||
.def("clearBitInRegister", &DetectorPythonInterface::clearBitInRegister)
|
||||
|
||||
.def("setDynamicRange", &DetectorPythonInterface::setDynamicRange)
|
||||
.def("getDynamicRange", &DetectorPythonInterface::getDynamicRange)
|
||||
.def("getFirmwareVersion", &DetectorPythonInterface::getFirmwareVersion)
|
||||
.def("getServerVersion", &DetectorPythonInterface::getServerVersion)
|
||||
.def("getClientVersion", &DetectorPythonInterface::getClientVersion)
|
||||
.def("getReceiverVersion", &DetectorPythonInterface::getReceiverVersion)
|
||||
.def("getDetectorNumber", &DetectorPythonInterface::getDetectorNumber)
|
||||
.def("getRateCorrection", &DetectorPythonInterface::getRateCorrection)
|
||||
.def("setRateCorrection", &DetectorPythonInterface::setRateCorrection)
|
||||
|
||||
.def("startAcquisition", &DetectorPythonInterface::startAcquisition)
|
||||
.def("stopAcquisition", &DetectorPythonInterface::stopAcquisition)
|
||||
.def("startReceiver", &DetectorPythonInterface::startReceiver)
|
||||
.def("stopReceiver", &DetectorPythonInterface::stopReceiver)
|
||||
|
||||
.def("getFilePath",
|
||||
(std::string(DetectorPythonInterface::*)()) &
|
||||
DetectorPythonInterface::getFilePath,
|
||||
"Using multiSlsDetector")
|
||||
.def("getFilePath",
|
||||
(std::string(DetectorPythonInterface::*)(int)) &
|
||||
DetectorPythonInterface::getFilePath,
|
||||
"File path for individual detector")
|
||||
.def("setFilePath", (void (DetectorPythonInterface::*)(std::string)) &
|
||||
DetectorPythonInterface::setFilePath)
|
||||
|
||||
.def("setFileName", &DetectorPythonInterface::setFileName)
|
||||
.def("getFileName", &DetectorPythonInterface::getFileName)
|
||||
.def("setFileIndex", &DetectorPythonInterface::setFileIndex)
|
||||
.def("getFileIndex", &DetectorPythonInterface::getFileIndex)
|
||||
|
||||
.def("setExposureTime", &DetectorPythonInterface::setExposureTime)
|
||||
.def("getExposureTime", &DetectorPythonInterface::getExposureTime)
|
||||
.def("setSubExposureTime", &DetectorPythonInterface::setSubExposureTime)
|
||||
.def("getSubExposureTime", &DetectorPythonInterface::getSubExposureTime)
|
||||
.def("setPeriod", &DetectorPythonInterface::setPeriod)
|
||||
.def("getPeriod", &DetectorPythonInterface::getPeriod)
|
||||
.def("setSubExposureDeadTime", &DetectorPythonInterface::setSubExposureDeadTime)
|
||||
.def("getSubExposureDeadTime", &DetectorPythonInterface::getSubExposureDeadTime)
|
||||
|
||||
.def("getCycles", &DetectorPythonInterface::getCycles)
|
||||
.def("setCycles", &DetectorPythonInterface::setCycles)
|
||||
.def("getNumberOfGates", &DetectorPythonInterface::getNumberOfGates)
|
||||
.def("setNumberOfGates", &DetectorPythonInterface::setNumberOfGates)
|
||||
.def("getDelay", &DetectorPythonInterface::getDelay)
|
||||
.def("setDelay", &DetectorPythonInterface::setDelay)
|
||||
|
||||
.def("setStoragecellStart", &DetectorPythonInterface::setStoragecellStart)
|
||||
.def("getStoragecellStart", &DetectorPythonInterface::getStoragecellStart)
|
||||
.def("setNumberOfStorageCells", &DetectorPythonInterface::setNumberOfStorageCells)
|
||||
.def("getNumberOfStorageCells", &DetectorPythonInterface::getNumberOfStorageCells)
|
||||
|
||||
.def("getTimingMode", &DetectorPythonInterface::getTimingMode)
|
||||
.def("setTimingMode", &DetectorPythonInterface::setTimingMode)
|
||||
|
||||
.def("getDetectorType", &DetectorPythonInterface::getDetectorType)
|
||||
|
||||
.def("setThresholdTemperature", &DetectorPythonInterface::setThresholdTemperature)
|
||||
.def("getThresholdTemperature", &DetectorPythonInterface::getThresholdTemperature)
|
||||
.def("setTemperatureControl", &DetectorPythonInterface::setTemperatureControl)
|
||||
.def("getTemperatureControl", &DetectorPythonInterface::getTemperatureControl)
|
||||
.def("getTemperatureEvent", &DetectorPythonInterface::getTemperatureEvent)
|
||||
.def("resetTemperatureEvent", &DetectorPythonInterface::resetTemperatureEvent)
|
||||
|
||||
.def("getRxDataStreamStatus", &DetectorPythonInterface::getRxDataStreamStatus)
|
||||
.def("setRxDataStreamStatus", &DetectorPythonInterface::setRxDataStreamStatus)
|
||||
|
||||
// Network stuff
|
||||
.def("getReceiverHostname",
|
||||
&DetectorPythonInterface::getReceiverHostname,
|
||||
py::arg("det_id") = -1)
|
||||
.def("setReceiverHostname",
|
||||
&DetectorPythonInterface::setReceiverHostname, py::arg("hostname"),
|
||||
py::arg("det_id") = -1)
|
||||
.def("getReceiverStreamingPort",
|
||||
&DetectorPythonInterface::getReceiverStreamingPort)
|
||||
.def("setReceiverStreamingPort",
|
||||
&DetectorPythonInterface::setReceiverStreamingPort)
|
||||
.def("getReceiverUDPPort", &DetectorPythonInterface::getReceiverUDPPort)
|
||||
.def("getReceiverUDPPort2",
|
||||
&DetectorPythonInterface::getReceiverUDPPort2)
|
||||
.def("setReceiverUDPPort", &DetectorPythonInterface::setReceiverUDPPort)
|
||||
.def("setReceiverUDPPort2",
|
||||
&DetectorPythonInterface::setReceiverUDPPort2)
|
||||
.def("setReceiverUDPIP", &DetectorPythonInterface::setReceiverUDPIP)
|
||||
.def("getReceiverUDPIP", &DetectorPythonInterface::getReceiverUDPIP)
|
||||
.def("getReceiverUDPMAC", &DetectorPythonInterface::getReceiverUDPMAC)
|
||||
.def("setReceiverUDPMAC", &DetectorPythonInterface::setReceiverUDPMAC)
|
||||
|
||||
.def("getReceiverPort", &DetectorPythonInterface::getReceiverPort)
|
||||
.def("setReceiverPort", &DetectorPythonInterface::setReceiverPort)
|
||||
|
||||
.def("configureNetworkParameters",
|
||||
&DetectorPythonInterface::configureNetworkParameters)
|
||||
.def("getDelayFrame", &DetectorPythonInterface::getDelayFrame)
|
||||
.def("setDelayFrame", &DetectorPythonInterface::setDelayFrame)
|
||||
.def("getDelayLeft", &DetectorPythonInterface::getDelayLeft)
|
||||
.def("setDelayLeft", &DetectorPythonInterface::setDelayLeft)
|
||||
.def("getDelayRight", &DetectorPythonInterface::getDelayRight)
|
||||
.def("setDelayRight", &DetectorPythonInterface::setDelayRight)
|
||||
.def("getLastClientIP", &DetectorPythonInterface::getLastClientIP)
|
||||
.def("getReceiverLastClientIP",
|
||||
&DetectorPythonInterface::getReceiverLastClientIP)
|
||||
|
||||
.def("setFramesPerFile", &DetectorPythonInterface::setFramesPerFile)
|
||||
.def("getFramesPerFile", &DetectorPythonInterface::getFramesPerFile)
|
||||
.def("setReceiverFifoDepth",
|
||||
&DetectorPythonInterface::setReceiverFifoDepth)
|
||||
.def("getReceiverFifoDepth",
|
||||
&DetectorPythonInterface::getReceiverFifoDepth)
|
||||
|
||||
.def("getReceiverFrameDiscardPolicy",
|
||||
&DetectorPythonInterface::getReceiverFrameDiscardPolicy)
|
||||
.def("setReceiverFramesDiscardPolicy",
|
||||
&DetectorPythonInterface::setReceiverFramesDiscardPolicy)
|
||||
.def("setPartialFramesPadding",
|
||||
&DetectorPythonInterface::setPartialFramesPadding)
|
||||
.def("getPartialFramesPadding",
|
||||
&DetectorPythonInterface::getPartialFramesPadding)
|
||||
|
||||
.def("getUserDetails", &DetectorPythonInterface::getUserDetails)
|
||||
.def("checkDetectorVersionCompatibility",
|
||||
&DetectorPythonInterface::checkDetectorVersionCompatibility)
|
||||
.def("checkReceiverVersionCompatibility",
|
||||
&DetectorPythonInterface::checkReceiverVersionCompatibility)
|
||||
.def("getMeasuredPeriod", &DetectorPythonInterface::getMeasuredPeriod)
|
||||
.def("getMeasuredSubPeriod",
|
||||
&DetectorPythonInterface::getMeasuredSubPeriod)
|
||||
|
||||
.def("setFileWrite", &DetectorPythonInterface::setFileWrite)
|
||||
.def("getFileWrite", &DetectorPythonInterface::getFileWrite)
|
||||
.def("setFileOverWrite", &DetectorPythonInterface::setFileOverWrite)
|
||||
.def("getFileOverWrite", &DetectorPythonInterface::getFileOverWrite)
|
||||
.def("getDacVthreshold", &DetectorPythonInterface::getDacVthreshold)
|
||||
.def("setDacVthreshold", &DetectorPythonInterface::setDacVthreshold)
|
||||
.def("setNumberOfFrames", &DetectorPythonInterface::setNumberOfFrames)
|
||||
.def("getNumberOfFrames", &DetectorPythonInterface::getNumberOfFrames)
|
||||
|
||||
// Overloaded calls
|
||||
.def("getFramesCaughtByReceiver",
|
||||
(int (DetectorPythonInterface::*)()) &
|
||||
DetectorPythonInterface::getFramesCaughtByReceiver)
|
||||
.def("getFramesCaughtByReceiver",
|
||||
(int (DetectorPythonInterface::*)(int)) &
|
||||
DetectorPythonInterface::getFramesCaughtByReceiver)
|
||||
|
||||
.def("resetFramesCaught", &DetectorPythonInterface::resetFramesCaught)
|
||||
.def("getReceiverCurrentFrameIndex",
|
||||
&DetectorPythonInterface::getReceiverCurrentFrameIndex)
|
||||
.def("getGapPixels", &DetectorPythonInterface::getGapPixels)
|
||||
.def("setGapPixels", &DetectorPythonInterface::setGapPixels)
|
||||
.def("getFlippedDataX", &DetectorPythonInterface::getFlippedDataX)
|
||||
.def("getFlippedDataY", &DetectorPythonInterface::getFlippedDataY)
|
||||
.def("setFlippedDataX", &DetectorPythonInterface::setFlippedDataX)
|
||||
.def("setFlippedDataY", &DetectorPythonInterface::setFlippedDataY)
|
||||
|
||||
.def("getServerLock", &DetectorPythonInterface::getServerLock)
|
||||
.def("setServerLock", &DetectorPythonInterface::setServerLock)
|
||||
.def("getReceiverLock", &DetectorPythonInterface::getReceiverLock)
|
||||
.def("setReceiverLock", &DetectorPythonInterface::setReceiverLock)
|
||||
|
||||
.def("getReadoutFlags", &DetectorPythonInterface::getReadoutFlags)
|
||||
.def("setReadoutFlag", &DetectorPythonInterface::setReadoutFlag)
|
||||
|
||||
.def("setFileFormat", &DetectorPythonInterface::setFileFormat)
|
||||
.def("getFileFormat", &DetectorPythonInterface::getFileFormat)
|
||||
|
||||
.def("getActive", &DetectorPythonInterface::getActive)
|
||||
.def("setActive", &DetectorPythonInterface::setActive)
|
||||
|
||||
.def("getTenGigabitEthernet",
|
||||
&DetectorPythonInterface::getTenGigabitEthernet)
|
||||
.def("setTenGigabitEthernet",
|
||||
&DetectorPythonInterface::setTenGigabitEthernet)
|
||||
|
||||
.def("getPatternLoops", &DetectorPythonInterface::getPatternLoops,
|
||||
py::arg("level"), py::arg("det_id") = -1)
|
||||
.def("setPatternLoops", &DetectorPythonInterface::setPatternLoops,
|
||||
py::arg("level"), py::arg("start"), py::arg("stop"), py::arg("n"),
|
||||
py::arg("det_id") = -1)
|
||||
.def("setPatternWord", &DetectorPythonInterface::setPatternWord,
|
||||
py::arg("addr"), py::arg("word"), py::arg("det_id") = -1)
|
||||
.def("getPatternWord", &DetectorPythonInterface::getPatternWord,
|
||||
py::arg("addr"), py::arg("det_id") = -1)
|
||||
|
||||
.def("setPatternIOControl",
|
||||
&DetectorPythonInterface::setPatternIOControl, py::arg("word"),
|
||||
py::arg("det_id") = -1)
|
||||
.def("setPatternClockControl",
|
||||
&DetectorPythonInterface::setPatternClockControl, py::arg("word"),
|
||||
py::arg("det_id") = -1)
|
||||
|
||||
.def("setPatternWaitAddr", &DetectorPythonInterface::setPatternWaitAddr,
|
||||
py::arg("level"), py::arg("addr"), py::arg("det_id") = -1)
|
||||
.def("getPatternWaitAddr", &DetectorPythonInterface::getPatternWaitAddr,
|
||||
py::arg("level"), py::arg("det_id") = -1)
|
||||
|
||||
.def("setPatternWaitTime", &DetectorPythonInterface::setPatternWaitTime,
|
||||
py::arg("level"), py::arg("duration"), py::arg("det_id") = -1)
|
||||
|
||||
.def("getPatternWaitTime", &DetectorPythonInterface::getPatternWaitTime,
|
||||
py::arg("level"), py::arg("det_id") = -1)
|
||||
|
||||
.def("getImageSize", &DetectorPythonInterface::getImageSize)
|
||||
.def("setImageSize", &DetectorPythonInterface::setImageSize)
|
||||
.def("getNumberOfDetectors",
|
||||
&DetectorPythonInterface::getNumberOfDetectors)
|
||||
.def("getDetectorGeometry",
|
||||
&DetectorPythonInterface::getDetectorGeometry);
|
||||
|
||||
|
||||
|
||||
py::module io = m.def_submodule("io", "Submodule for io");
|
||||
io.def("read_my302_file", &read_my302_file, "some");
|
||||
|
@ -47,7 +47,7 @@ using std::chrono::seconds;
|
||||
|
||||
int main() {
|
||||
Detector d;
|
||||
d.setConfig("/home/l_frojdh/virtual.config");
|
||||
// d.setConfig("/home/l_frojdh/virtual.config");
|
||||
|
||||
// d.setExptime(nanoseconds(500)); // set exptime of all modules
|
||||
// auto t0 = d.getExptime();
|
||||
|
46
sample/time.cpp
Normal file
46
sample/time.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
#include "Result.h"
|
||||
#include "Detector.h"
|
||||
#include "container_utils.h"
|
||||
#include "ToString.h"
|
||||
#include <algorithm>
|
||||
|
||||
std::chrono::nanoseconds to_nano(double val, const std::string &unit) {
|
||||
if (unit == "us")
|
||||
return std::chrono::duration_cast<std::chrono::nanoseconds>(
|
||||
std::chrono::duration<double, std::micro>(val));
|
||||
else if (unit == "ms")
|
||||
return std::chrono::duration_cast<std::chrono::nanoseconds>(
|
||||
std::chrono::duration<double, std::milli>(val));
|
||||
else if (unit == "s")
|
||||
return std::chrono::duration_cast<std::chrono::nanoseconds>(
|
||||
std::chrono::duration<double>(val));
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
||||
// std::cout << "5.8 us is " << to_nano(5.8, "us").count() << " ns\n";
|
||||
// std::cout << "7 ms is " << to_nano(7, "ms").count() << " ns\n";
|
||||
// std::cout << "3.123 s is " << to_nano(3.123, "s").count() << " ns\n";
|
||||
|
||||
// sls::Result<int> res{1,0,6,4,0,4};
|
||||
|
||||
|
||||
// std::unique_ptr<sls::Detector>
|
||||
auto d = sls::make_unique<sls::Detector>(0);
|
||||
|
||||
std::cout << d->getHostname() << "\n";
|
||||
|
||||
auto s= sls::ToString(d->getHostname());
|
||||
std::cout << s << "\n";
|
||||
|
||||
std::string str;
|
||||
for (const auto& s : d->getHostname())
|
||||
str += s;
|
||||
std::cout << str << "\n";
|
||||
|
||||
}
|
@ -1,38 +1,43 @@
|
||||
/** Examples on how to use Result<T> */
|
||||
|
||||
#include "Result.h"
|
||||
#include "ToString.h"
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
auto main() -> int {
|
||||
using sls::Result;
|
||||
using sls::ToString;
|
||||
|
||||
using sls::Result; // declared in namespace sls
|
||||
using sls::ToString;
|
||||
auto main() -> int {
|
||||
|
||||
std::cout << "Examples on usage of Result<T>\n";
|
||||
|
||||
// Result exposes the underlying constructors of std::vector
|
||||
/** Constructing Result<T> can be done in the same way as vectors */
|
||||
Result<int> res{1, 2, 3, 4, 5};
|
||||
std::cout << "res: " << res << '\n';
|
||||
|
||||
Result<double> res2(5, 3.7);
|
||||
std::cout << "res2: " << res2 << '\n';
|
||||
|
||||
// and can be converted to and from a vector. However, the
|
||||
// conversion to a vector is not efficient since a copy is made
|
||||
// and should only be done when a vector is needed for further use
|
||||
// in most sense and in standard algorithms Result<T> behaves as a
|
||||
// vector.
|
||||
/** and Result can be converted to and from a vector. However, the
|
||||
* conversion to a vector is not efficient since a copy is made
|
||||
* and should only be done when a vector is needed for further use
|
||||
* in most cases Result behaved as a vector, for example with standard
|
||||
* algorithms */
|
||||
|
||||
|
||||
std::vector<int> vec(5, 5);
|
||||
std::cout << "vec: " << ToString(vec) << "\n";
|
||||
|
||||
//Result from vector
|
||||
Result<int> res3 = vec;
|
||||
std::cout << "res3: " << res3 << '\n';
|
||||
|
||||
// Vector from Result
|
||||
std::vector<int> vec2 = res3;
|
||||
std::cout << "vec2: " << ToString(vec2) << "\n";
|
||||
|
||||
|
||||
// Using squash we can also convert to a single value
|
||||
// Using squash we can convert to a single value
|
||||
std::cout << "res.squash(): " << res.squash() << '\n';
|
||||
std::cout << "res3.squash(): " << res3.squash() << '\n';
|
||||
|
||||
@ -40,11 +45,17 @@ auto main() -> int {
|
||||
std::cout << "res.squash(-1): " << res.squash(-1) << '\n';
|
||||
std::cout << "res3.squash(-1): " << res3.squash(-1) << '\n';
|
||||
|
||||
std::vector<int> ivec{1, 3, 5};
|
||||
Result<int> ivec{1, 3, 5};
|
||||
|
||||
Result<sls::time::ns> nres(ivec);
|
||||
// for (const auto& i : ivec)
|
||||
// nres.push_back(sls::time::ns(i));
|
||||
std::cout << "nres: " << sls::ToString(nres) << '\n';
|
||||
//
|
||||
|
||||
/* Convert from Result<int> to Result<bool> */
|
||||
Result<int> int_result{0, 1, 0, 3, -5};
|
||||
Result<bool> bool_result{int_result};
|
||||
std::cout << bool_result << '\n';
|
||||
|
||||
// Result can be printed using <<
|
||||
Result<std::string> string_res{"ein", "zwei", "drei"};
|
||||
std::cout << string_res << '\n';
|
||||
}
|
@ -31,8 +31,9 @@ class MovingStat
|
||||
*/
|
||||
void Set(double val, double rms=0, int m=-1)
|
||||
{
|
||||
if (m>=0) m_n = m; else m_n = n;
|
||||
if (m>0) m_n = m; else m_n = n;
|
||||
m_newM=val*m_n;
|
||||
// cout << "set " << val << " " << m << " " << m_n << " " << m_newM << endl;
|
||||
SetRMS(rms);
|
||||
}
|
||||
/**
|
||||
@ -42,7 +43,7 @@ class MovingStat
|
||||
{
|
||||
if (rms<=0) {
|
||||
m_newM2=m_newM*m_newM/n;
|
||||
m_n=0;
|
||||
//m_n=0;
|
||||
} else {
|
||||
if (m_n>0)
|
||||
m_newM2=(m_n*rms*rms+m_newM*m_newM/m_n);
|
||||
@ -120,6 +121,7 @@ class MovingStat
|
||||
*/
|
||||
inline double Mean() const
|
||||
{
|
||||
// cout << "get " << m_n << " " << m_newM << " " << m_newM/m_n << endl;
|
||||
return (m_n > 0) ? m_newM/m_n : 0.0;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ template <class dataType> class analogDetector {
|
||||
|
||||
|
||||
analogDetector(slsDetectorData<dataType> *d, int sign=1,
|
||||
commonModeSubtraction *cm=NULL, int nped=1000, int nnx=-1, int nny=-1, double *gm=NULL, ghostSummation<dataType> *gs=NULL) : det(d), nx(nnx), ny(nny), stat(NULL), cmSub(cm), iframe(-1), dataSign(sign), gmap(gm), ghSum(gs), id(0) {
|
||||
commonModeSubtraction *cm=NULL, int nped=1000, int nnx=-1, int nny=-1, double *gm=NULL, ghostSummation<dataType> *gs=NULL) : det(d), nx(nnx), ny(nny), stat(NULL), cmSub(cm), dataSign(sign), iframe(-1), gmap(gm), ghSum(gs), id(0) {
|
||||
|
||||
if (det)
|
||||
det->getDetectorSize(nx,ny);
|
||||
@ -154,8 +154,15 @@ template <class dataType> class analogDetector {
|
||||
hs9=(TH2F*)(orig->hs9)->Clone();//new TH2F("hs","hs",(orig->hs)-getNbins,-500,9500,nx*ny,-0.5,nx*ny-0.5);
|
||||
#endif
|
||||
#endif
|
||||
if (orig->cmSub) cmSub=(orig->cmSub)->Clone();
|
||||
if (orig->ghSum) ghSum=(orig->ghSum)->Clone();
|
||||
if (orig->cmSub) {
|
||||
cmSub=(orig->cmSub)->Clone();
|
||||
cout <<"cloning cm" << endl;
|
||||
}
|
||||
else cmSub=NULL;
|
||||
if (orig->ghSum) {
|
||||
ghSum=(orig->ghSum)->Clone();
|
||||
cout <<"cloning gs" << endl;
|
||||
}
|
||||
else ghSum=NULL;
|
||||
}
|
||||
|
||||
@ -227,6 +234,7 @@ template <class dataType> class analogDetector {
|
||||
for (int iy=0; iy<nny; iy++) {
|
||||
for (int ix=0; ix<nnx; ix++) {
|
||||
gmap[iy*nnx+ix]=gm[iy*nnx+ix];
|
||||
// cout << gmap[iy*nnx+ix] << " " ;
|
||||
}
|
||||
}
|
||||
return gmap;
|
||||
@ -280,7 +288,12 @@ template <class dataType> class analogDetector {
|
||||
virtual void newFrame(){iframe++; if (cmSub) cmSub->newFrame();};
|
||||
|
||||
/** resets the commonModeSubtraction and increases the frame index */
|
||||
virtual void newFrame(char *data){iframe++; if (cmSub) cmSub->newFrame(); calcGhost(data);};
|
||||
virtual void newFrame(char *data){
|
||||
iframe++;
|
||||
if (cmSub) cmSub->newFrame();
|
||||
calcGhost(data);
|
||||
// cout << getId() << " Calc ghost " << getGhost(15,15) << endl;
|
||||
};
|
||||
|
||||
|
||||
/** sets the commonModeSubtraction algorithm to be used
|
||||
@ -315,7 +328,7 @@ template <class dataType> class analogDetector {
|
||||
\param iy pixel y coordinate
|
||||
\param cm 1 adds the value to common mod, 0 skips it. Defaults to 0. - not properly implemented
|
||||
*/
|
||||
virtual void addToPedestal(double val, int ix, int iy=0, int cm=0){
|
||||
virtual void addToPedestal(double val, int ix, int iy, int cm=0){
|
||||
if (ix>=0 && ix<nx && iy>=0 && iy<ny) {
|
||||
|
||||
// cout << val << " " ;
|
||||
@ -335,15 +348,17 @@ template <class dataType> class analogDetector {
|
||||
}
|
||||
|
||||
double getCommonMode(int ix, int iy) {
|
||||
if (cmSub) return cmSub->getCommonMode(ix, iy);
|
||||
else return 0;
|
||||
if (cmSub) {
|
||||
return cmSub->getCommonMode(ix, iy);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
virtual void addToCommonMode(char *data){
|
||||
// cout << "+"<< endl;
|
||||
// cout << "+"<< getId() << endl;
|
||||
if (cmSub) {
|
||||
// cout << "*" << endl;
|
||||
//cout << "*" << endl;
|
||||
for (int iy=ymin; iy<ymax; iy++) {
|
||||
for (int ix=xmin; ix<xmax; ix++) {
|
||||
// if (getNumpedestals(ix,iy)>0)
|
||||
@ -358,12 +373,22 @@ template <class dataType> class analogDetector {
|
||||
}
|
||||
|
||||
virtual void addToCommonMode(char *data, int ix, int iy=0){
|
||||
// cout <<".";
|
||||
if (cmSub) {
|
||||
//cout <<":";
|
||||
if (det) if (det->isGood(ix, iy)==0) return;
|
||||
if (getNumpedestals(ix,iy)>0){
|
||||
cmSub->addToCommonMode(subtractPedestal(data,ix,iy,0), ix, iy);
|
||||
// cout << ":";
|
||||
// cout << ix << " " <<" " << iy << subtractPedestal(data,ix,iy,0) << endl;
|
||||
double val;
|
||||
if (det) {
|
||||
/* if (det->getChannel(data, ix, iy)>=0x3fff) */
|
||||
/* cout << ix << " " << iy << " " << det->getChannel(data, ix, iy) <<endl; */
|
||||
val= (dataSign*det->getValue(data, ix, iy)-getPedestal(ix,iy,0));
|
||||
} else
|
||||
val= (((double*)data)[iy*nx+ix]-getPedestal(ix,iy));
|
||||
val+=getGhost(ix,iy);
|
||||
|
||||
cmSub->addToCommonMode(val, ix, iy);
|
||||
//cout << ":";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -375,11 +400,12 @@ template <class dataType> class analogDetector {
|
||||
\returns pedestal value
|
||||
*/
|
||||
virtual double getPedestal (int ix, int iy, int cm=0){
|
||||
if (ix>=0 && ix<nx && iy>=0 && iy<ny)
|
||||
if (cmSub && cm>0)
|
||||
if (ix>=0 && ix<nx && iy>=0 && iy<ny) {
|
||||
if (cmSub && cm>0) {
|
||||
return stat[iy][ix].getPedestal()+getCommonMode(ix,iy);
|
||||
else return stat[iy][ix].getPedestal();
|
||||
else return -1;
|
||||
|
||||
} else return stat[iy][ix].getPedestal();
|
||||
} else return -1;
|
||||
};
|
||||
|
||||
|
||||
@ -390,15 +416,22 @@ template <class dataType> class analogDetector {
|
||||
\returns pedestal rms
|
||||
*/
|
||||
virtual double getPedestalRMS(int ix, int iy){
|
||||
if (ix>=0 && ix<nx && iy>=0 && iy<ny)
|
||||
return stat[iy][ix].getPedestalRMS();
|
||||
else return -1;
|
||||
double g=1;
|
||||
if (ix>=0 && ix<nx && iy>=0 && iy<ny) {
|
||||
if (gmap) {
|
||||
g=gmap[iy*nx+ix];
|
||||
if (g==0) g=-1.;
|
||||
}
|
||||
|
||||
return stat[iy][ix].getPedestalRMS()/g;//divide by gain?
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
|
||||
virtual int getNumpedestals(int ix, int iy){
|
||||
if (ix>=0 && ix<nx && iy>=0 && iy<ny)
|
||||
return stat[iy][ix].getNumpedestals();
|
||||
else return -1;
|
||||
return -1;
|
||||
};
|
||||
/**
|
||||
gets pedestal (and common mode)
|
||||
@ -472,6 +505,7 @@ template <class dataType> class analogDetector {
|
||||
for (int ix=xmin; ix<xmax; ix++) {
|
||||
if (rms) rr=rms[iy*nx+ix];
|
||||
stat[iy][ix].setPedestal(ped[iy*nx+ix],rr, m);
|
||||
// cout << ix << " " << iy << " " << ped[iy*nx+ix] << " " << stat[iy][ix].getPedestal() << endl;
|
||||
};
|
||||
};
|
||||
|
||||
@ -505,9 +539,23 @@ template <class dataType> class analogDetector {
|
||||
|
||||
}
|
||||
|
||||
virtual void calcGhost(char *data, int ix, int iy=1) {if (ghSum) ghSum->calcGhost(data, ix, iy);};
|
||||
virtual void calcGhost(char *data, int ix, int iy=1) {
|
||||
if (ghSum) {
|
||||
ghSum->calcGhost(data, ix, iy);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
virtual void calcGhost(char *data){if (ghSum) {
|
||||
ghSum->calcGhost(data);
|
||||
|
||||
// cout << getId() << " @ " << ghSum->getXTalk() << " " << ghSum->getGhost(15,15) << endl;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
virtual void calcGhost(char *data){if (ghSum) ghSum->calcGhost(data);};
|
||||
virtual double getGhost(int ix, int iy) {if (ghSum) return ghSum->getGhost(ix, iy); return 0;};
|
||||
|
||||
/**
|
||||
@ -723,6 +771,7 @@ template <class dataType> class analogDetector {
|
||||
|
||||
|
||||
if (cmSub && cm) {
|
||||
// cout <<",";
|
||||
addToCommonMode(data);
|
||||
}
|
||||
|
||||
@ -812,7 +861,7 @@ template <class dataType> class analogDetector {
|
||||
*/
|
||||
|
||||
|
||||
virtual void addToPedestal(char *data, int ix, int iy=0, int cm=0) {
|
||||
virtual void addToPedestal(char *data, int ix, int iy, int cm=0) {
|
||||
|
||||
|
||||
double val;
|
||||
@ -880,7 +929,7 @@ template <class dataType> class analogDetector {
|
||||
|
||||
virtual double subtractPedestal(char *data, int ix, int iy=0, int cm=0) {
|
||||
double g=1.;
|
||||
double val;
|
||||
double val =0;
|
||||
if (ix>=0 && ix<nx && iy>=0 && iy<ny) {
|
||||
if (gmap) {
|
||||
g=gmap[iy*nx+ix];
|
||||
@ -894,6 +943,9 @@ template <class dataType> class analogDetector {
|
||||
} else
|
||||
val= (((double*)data)[iy*nx+ix]-getPedestal(ix,iy))/g;
|
||||
|
||||
//if (val>=0.5*thr)
|
||||
// cout << val << " " << (dataSign*det->getValue(data, ix, iy)-getPedestal(ix,iy,cm)) << " " << g << " ";
|
||||
|
||||
val+=getGhost(ix,iy)/g;
|
||||
|
||||
#ifdef ROOTSPECTRUM
|
||||
@ -927,6 +979,7 @@ template <class dataType> class analogDetector {
|
||||
#endif
|
||||
return val;
|
||||
}
|
||||
return val;
|
||||
};
|
||||
|
||||
|
||||
@ -954,8 +1007,7 @@ template <class dataType> class analogDetector {
|
||||
int nph=0;
|
||||
double v;
|
||||
if (ix>=0 && ix<nx && iy>=0 && iy<ny) {
|
||||
v=subtractPedestal(data,ix,iy);
|
||||
|
||||
v=subtractPedestal(data,ix,iy,1);
|
||||
/* // cout << v << " " ; */
|
||||
/* #ifdef ROOTSPECTRUM */
|
||||
/* // cout << (iy-ymin)*(xmax-xmin)+(ix-xmin) << endl; */
|
||||
@ -964,8 +1016,14 @@ template <class dataType> class analogDetector {
|
||||
if (thr>0) {
|
||||
v+=0.5*thr;
|
||||
nph=v/thr;
|
||||
if (nph>0)
|
||||
|
||||
/* if (ix ==10 && iy<20) */
|
||||
/* cout << det->getValue(data,ix,iy) << " " << stat[iy][ix].getPedestal() << " " << getCommonMode(ix,iy) << " " << getPedestal(ix,iy,0)<< " " << getPedestal(ix,iy,1) << endl; */
|
||||
// cout << subtractPedestal(data,ix,iy,0) << " " << subtractPedestal(data,ix,iy,1) << " " << nph << endl;
|
||||
if (nph>0) {
|
||||
//cout << " " << nph << endl;
|
||||
return nph;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return v;
|
||||
@ -981,9 +1039,10 @@ template <class dataType> class analogDetector {
|
||||
*/
|
||||
int *getNPhotons(char *data, int *nph=NULL) {
|
||||
|
||||
double val;
|
||||
//double val;
|
||||
if (nph==NULL)
|
||||
nph=image;
|
||||
|
||||
newFrame(data);
|
||||
|
||||
//calcGhost(data);
|
||||
@ -1094,7 +1153,7 @@ template <class dataType> class analogDetector {
|
||||
switch(fMode) {
|
||||
case ePedestal:
|
||||
//cout << "analog ped " << endl;
|
||||
addToPedestal(data);
|
||||
addToPedestal(data,1);
|
||||
break;
|
||||
default:
|
||||
// cout << "analog " << endl;
|
||||
|
@ -14,7 +14,7 @@ class commonModeSubtraction {
|
||||
\param iroi number of regions on which one can calculate the common mode separately. Defaults to 1 i.e. whole detector
|
||||
|
||||
*/
|
||||
commonModeSubtraction(int iroi=1, int ns=3) : nROI(iroi), nsigma(ns) {
|
||||
commonModeSubtraction(int iroi=1, int ns=3) : nsigma(ns), nROI(iroi) {
|
||||
mean=new double[nROI];
|
||||
mean2=new double[nROI];
|
||||
nCm=new double[nROI];
|
||||
@ -28,7 +28,7 @@ class commonModeSubtraction {
|
||||
/* } */
|
||||
|
||||
virtual commonModeSubtraction *Clone() {
|
||||
new commonModeSubtraction(this->nROI, this->nsigma);
|
||||
return new commonModeSubtraction(this->nROI, this->nsigma);
|
||||
}
|
||||
|
||||
/** clears the moving average and the sum of pedestals calculation - virtual func*/
|
||||
@ -41,6 +41,7 @@ class commonModeSubtraction {
|
||||
|
||||
/** adds the average of pedestals to the moving average and reinitializes the calculation of the sum of pedestals for all ROIs. - virtual func*/
|
||||
virtual void newFrame(){
|
||||
//cout << "Reset CM" << endl;
|
||||
for (int i=0; i<nROI; i++) {
|
||||
// if (nCm[i]>0) cmStat[i].Calc(cmPed[i]/nCm[i]);
|
||||
nCm[i]=0;
|
||||
@ -60,6 +61,7 @@ class commonModeSubtraction {
|
||||
// else val=-100;
|
||||
// if (isc>=0 && isc<nROI) {
|
||||
// cout << ix << " " << iy << " " << iroi << endl;
|
||||
//if (ix==15 && iy==15) cout << "=" << val << endl;
|
||||
if (iroi>=0 && iroi<nROI) {
|
||||
// cout << ix << " " << iy << " " << iroi << endl;
|
||||
mean[iroi]+=val;
|
||||
@ -80,6 +82,7 @@ class commonModeSubtraction {
|
||||
/* else */
|
||||
/* return -100; */
|
||||
// cout << "*" << ix << " " << iy << " " << iroi << " " << mean[iroi] << " " << nCm[iroi]<< endl;
|
||||
// if (ix==15 && iy==15) cout << "-" << mean[iroi]/nCm[iroi] << endl;
|
||||
if (iroi>=0 && iroi<nROI) {
|
||||
if (nCm[iroi]>0)
|
||||
return mean[iroi]/nCm[iroi];
|
||||
|
@ -45,7 +45,7 @@ class mythen3_01_jctbData : public slsDetectorData<short unsigned int> {
|
||||
|
||||
virtual short unsigned int* mythen03_frame(char *ptr, int dr=24, int nch=64*3, int off=5) {
|
||||
// off=0;
|
||||
int iarg;
|
||||
//int iarg;
|
||||
int64_t word, *wp;
|
||||
short unsigned int* val=new short unsigned int[nch];
|
||||
int bit[64];
|
||||
|
@ -49,7 +49,7 @@ 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) {
|
||||
// off=0;
|
||||
int iarg;
|
||||
//int iarg;
|
||||
int64_t word, *wp;
|
||||
short unsigned int* val=new short unsigned int[nch];
|
||||
int bit[64];
|
||||
@ -57,7 +57,7 @@ class mythen3_02_jctbData : public mythen3_01_jctbData {
|
||||
int ioff=0;
|
||||
int idr=0;
|
||||
int ib=0;
|
||||
int ich=0;
|
||||
//int ich=0;
|
||||
int ii=0;
|
||||
int iw=0;
|
||||
bit[0]=17;//19;
|
||||
|
@ -8,9 +8,9 @@ class deserializer : public slsDetectorData<int> {
|
||||
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), dbitlist(dbl), dynamicRange(dr), serialOffset(off), frameNumber(0), numberOfCounters(nch) {};
|
||||
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), dbitlist(dbl), dynamicRange(dr), serialOffset(off), frameNumber(0), numberOfCounters(nch) {};
|
||||
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;};
|
||||
|
||||
@ -51,7 +51,7 @@ class deserializer : public slsDetectorData<int> {
|
||||
|
||||
static int* deserializeAll(char *ptr, std::vector <int> dbl, int dr=24, int nch=64*3, int off=5) {
|
||||
// off=0;
|
||||
int iarg;
|
||||
//int iarg;
|
||||
int64_t word, *wp;
|
||||
int* val=new int[nch];
|
||||
int ioff=0;
|
||||
@ -107,10 +107,10 @@ class deserializer : public slsDetectorData<int> {
|
||||
|
||||
static int* deserializeList(char *ptr, std::vector <int> dbl, int dr=24, int nch=64*3, int off=5) {
|
||||
// off=0;
|
||||
int iarg;
|
||||
int64_t word;
|
||||
//int iarg;
|
||||
// int64_t word;
|
||||
int* val=new int[nch];
|
||||
int ioff=0;
|
||||
//int ioff=0;
|
||||
int idr=0;
|
||||
int ib=0;
|
||||
int iw=0;
|
||||
@ -129,7 +129,7 @@ class deserializer : public slsDetectorData<int> {
|
||||
ib=0;
|
||||
ich=0;
|
||||
for (const auto &bit : dbl) {
|
||||
ioff=off;
|
||||
//ioff=off;
|
||||
idr=0;
|
||||
for (iw=0; iw<(nch*dr/nb)/8; iw++) {
|
||||
val[ich]|=(*dval)<<idr;
|
||||
|
@ -101,6 +101,9 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
||||
row=200+i/sc_width;
|
||||
}
|
||||
dataMap[row][col]=sizeof(sls_detector_header)+(nadc*i+iadc)*2;//+16*(ip+1);
|
||||
#ifdef HIGHZ
|
||||
dataMask[row][col]=0x3fff; //invert data
|
||||
#endif
|
||||
if (dataMap[row][col]<0 || dataMap[row][col]>=nSamples*2*32)
|
||||
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
|
||||
}
|
||||
|
268
slsDetectorCalibration/dataStructures/moench03T1ZmqData.h
Normal file
268
slsDetectorCalibration/dataStructures/moench03T1ZmqData.h
Normal file
@ -0,0 +1,268 @@
|
||||
#ifndef MOENCH03T1ZMQDATA_H
|
||||
#define MOENCH03T1ZMQDATA_H
|
||||
#include "slsDetectorData.h"
|
||||
|
||||
|
||||
|
||||
class moench03T1ZmqData : public slsDetectorData<uint16_t> {
|
||||
|
||||
private:
|
||||
|
||||
int iframe;
|
||||
int nadc;
|
||||
int sc_width;
|
||||
int sc_height;
|
||||
const int nPackets; /**<number of UDP packets constituting one frame */
|
||||
const int packetSize; /**< size of a udp packet */
|
||||
|
||||
|
||||
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
|
||||
|
||||
*/
|
||||
moench03T1ZmqData(int npackets=40, int ps=8192): slsDetectorData<uint16_t>(400, 400, ps*npackets), packetSize(ps), nPackets(npackets) {
|
||||
|
||||
int nadc=32;
|
||||
int sc_width=25;
|
||||
int sc_height=200;
|
||||
|
||||
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 isample;
|
||||
int iadc;
|
||||
int ix, iy;
|
||||
|
||||
// int npackets=40;
|
||||
int i;
|
||||
int adc4(0);
|
||||
|
||||
for (int ip=0; ip<npackets; ip++) {
|
||||
for (int is=0; is<128; is++) {
|
||||
|
||||
for (iadc=0; iadc<nadc; iadc++) {
|
||||
i=128*ip+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]+(i%sc_width);
|
||||
if (adc4%2==0) {
|
||||
row=199-i/sc_width;
|
||||
} else {
|
||||
row=200+i/sc_width;
|
||||
}
|
||||
dataMap[row][col]=(nadc*i+iadc)*2;//+16*(ip+1);
|
||||
if (dataMap[row][col]<0 || dataMap[row][col]>=8192*40)
|
||||
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ipacket;
|
||||
int ibyte;
|
||||
int ii=0;
|
||||
for (int ipacket=0; ipacket<npackets; ipacket++) {
|
||||
for (int ibyte=0; ibyte< 8192/2; ibyte++) {
|
||||
i=ipacket*8208/2+ibyte;
|
||||
/* if (ibyte<8) { */
|
||||
/* //header! */
|
||||
/* xmap[i]=-1; */
|
||||
/* ymap[i]=-1; */
|
||||
/* } else { */
|
||||
// ii=ibyte+128*32*ipacket;
|
||||
isample=ii/nadc;
|
||||
iadc=ii%nadc;
|
||||
adc4 = (int)iadc/4;
|
||||
ix=isample%sc_width;
|
||||
iy=isample/sc_width;
|
||||
if (adc4%2==0) {
|
||||
xmap[i]=adc_nr[iadc]+ix;
|
||||
ymap[i]=ny/2-1-iy;
|
||||
} else {
|
||||
xmap[i]=adc_nr[iadc]+ix;
|
||||
ymap[i]=ny/2+iy;
|
||||
}
|
||||
|
||||
ii++;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
iframe=0;
|
||||
// cout << "data struct created" << endl;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Returns the frame number for the given dataset. Purely virtual func.
|
||||
\param buff pointer to the dataset
|
||||
\returns frame number
|
||||
|
||||
*/
|
||||
|
||||
/* class jfrau_packet_header_t { */
|
||||
/* public: */
|
||||
/* unsigned char reserved[4]; */
|
||||
/* unsigned char packetNumber[1]; */
|
||||
/* unsigned char frameNumber[3]; */
|
||||
/* unsigned char bunchid[8]; */
|
||||
/* }; */
|
||||
|
||||
|
||||
|
||||
int getFrameNumber(char *buff){return iframe;};//*((int*)(buff+5))&0xffffff;};
|
||||
|
||||
/**
|
||||
|
||||
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;}//((*(((int*)(buff+4))))&0xff)+1;};
|
||||
|
||||
/* /\** */
|
||||
|
||||
/* 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;
|
||||
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[packetSize*nPackets];
|
||||
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;
|
||||
|
||||
|
||||
if (ff>=0)
|
||||
fnum=ff;
|
||||
|
||||
if (filebin.is_open()) {
|
||||
if (filebin.read(data, packetSize*nPackets) ){
|
||||
iframe++;
|
||||
ff=iframe;
|
||||
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<packetSize*nPackets) ndata=dsize;
|
||||
else ndata=packetSize*nPackets;
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -276,15 +276,15 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
|
||||
|
||||
|
||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
||||
char *retval=0;
|
||||
int nd;
|
||||
int fnum = -1;
|
||||
//char *retval=0;
|
||||
// int nd;
|
||||
//int fnum = -1;
|
||||
np=0;
|
||||
int pn;
|
||||
// int pn;
|
||||
|
||||
|
||||
if (ff>=0)
|
||||
fnum=ff;
|
||||
// if (ff>=0)
|
||||
// fnum=ff;
|
||||
|
||||
if (filebin.is_open()) {
|
||||
if (filebin.read(data, 32*2*nSamples) ){
|
||||
|
@ -0,0 +1,294 @@
|
||||
#ifndef MOENCH04REC10GBDATA_H
|
||||
#define MOENCH04REC10GBDATA_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 */
|
||||
uint64_t packetCaught[8]; /**< is the version number of this structure format */
|
||||
|
||||
} sls_detector_header;
|
||||
|
||||
|
||||
|
||||
|
||||
class moench04CtbReceiver10GbData : public slsDetectorData<uint16_t> {
|
||||
|
||||
private:
|
||||
|
||||
int iframe;
|
||||
int nadc;
|
||||
int sc_width;
|
||||
int sc_height;
|
||||
const int aSamples;
|
||||
const int dSamples;
|
||||
|
||||
|
||||
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
|
||||
|
||||
*/
|
||||
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) {
|
||||
|
||||
int nadc=32;
|
||||
int sc_width=25;
|
||||
int sc_height=200;
|
||||
|
||||
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 };
|
||||
|
||||
int row, col;
|
||||
|
||||
int isample;
|
||||
int iadc;
|
||||
int ix, iy;
|
||||
|
||||
int npackets=40;
|
||||
int i;
|
||||
int adc4(0);
|
||||
|
||||
for (int ip=0; ip<npackets; ip++) {
|
||||
for (int is=0; is<128; is++) {
|
||||
|
||||
for (iadc=0; iadc<nadc; iadc++) {
|
||||
i=128*ip+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>0) {
|
||||
row=199-i/sc_width;
|
||||
} else {
|
||||
row=200+i/sc_width;
|
||||
}
|
||||
if (nds>0)
|
||||
dataMap[row][col]=sizeof(sls_detector_header)+((nadc+4)*i+iadc)*2;//+16*(ip+1);
|
||||
else
|
||||
dataMap[row][col]=sizeof(sls_detector_header)+(nadc*i+iadc)*2;//+16*(ip+1);
|
||||
if (dataMap[row][col]<0 || dataMap[row][col]>=aSamples*2*32)
|
||||
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ipacket;
|
||||
int ibyte;
|
||||
int ii=0;
|
||||
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;
|
||||
// cout << "data struct created" << endl;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Returns the frame number for the given dataset. Purely virtual func.
|
||||
\param buff pointer to the dataset
|
||||
\returns frame number
|
||||
|
||||
*/
|
||||
|
||||
/* class jfrau_packet_header_t { */
|
||||
/* 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;};
|
||||
|
||||
/**
|
||||
|
||||
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 ((sls_detector_header*)buff)->packetNumber;}//((*(((int*)(buff+4))))&0xff)+1;};
|
||||
|
||||
/* /\** */
|
||||
|
||||
/* 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;
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
290
slsDetectorCalibration/dataStructures/moench04CtbZmq10GbData.h
Normal file
290
slsDetectorCalibration/dataStructures/moench04CtbZmq10GbData.h
Normal file
@ -0,0 +1,290 @@
|
||||
#ifndef MOENCH04ZMQ10GBDATA_H
|
||||
#define MOENCH04ZMQ10GBDATA_H
|
||||
#include "slsDetectorData.h"
|
||||
|
||||
|
||||
|
||||
|
||||
class moench04CtbZmq10GbData : public slsDetectorData<uint16_t> {
|
||||
|
||||
private:
|
||||
|
||||
int iframe;
|
||||
int nadc;
|
||||
int sc_width;
|
||||
int sc_height;
|
||||
const int aSamples;
|
||||
const int dSamples;
|
||||
|
||||
|
||||
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
|
||||
|
||||
*/
|
||||
//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) {
|
||||
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) {
|
||||
|
||||
/* int ds; */
|
||||
/* if (nas && nds) */
|
||||
/* if (nds>nas) */
|
||||
/* ds=nds*(32*2+8); */
|
||||
/* else */
|
||||
/* ds=nas*(32*2+8); */
|
||||
/* else */
|
||||
/* ds=nas*32*2+nds*8; */
|
||||
|
||||
/* new slsDetectorData<uint16_t>(400, 400, ds); */
|
||||
|
||||
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 };
|
||||
|
||||
int row, col;
|
||||
|
||||
//int isample;
|
||||
int iadc;
|
||||
// int ix, iy;
|
||||
|
||||
// int npackets=40;
|
||||
int i;
|
||||
//int adc4(0);
|
||||
|
||||
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;//+16*(ip+1);
|
||||
else
|
||||
dataMap[row][col]=(nadc*i+iadc)*2;//+16*(ip+1);
|
||||
if (dataMap[row][col]<0 || dataMap[row][col]>=aSamples*2*32)
|
||||
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;
|
||||
// cout << "data struct created" << endl;
|
||||
}
|
||||
|
||||
int getGain(char *data, int x, int y) {
|
||||
// int aoff=aSamples*2*32;
|
||||
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 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};
|
||||
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);
|
||||
cout << isc << " " << ibit[isc] << " " << isample << hex << sample << dec << endl;
|
||||
if (sample & (1<<ibit[isc]))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Returns the frame number for the given dataset. Purely virtual func.
|
||||
\param buff pointer to the dataset
|
||||
\returns frame number
|
||||
|
||||
*/
|
||||
|
||||
/* class jfrau_packet_header_t { */
|
||||
/* public: */
|
||||
/* unsigned char reserved[4]; */
|
||||
/* unsigned char packetNumber[1]; */
|
||||
/* unsigned char frameNumber[3]; */
|
||||
/* unsigned char bunchid[8]; */
|
||||
/* }; */
|
||||
|
||||
|
||||
|
||||
int getFrameNumber(char *buff){return iframe;};//((sls_detector_header*)buff)->frameNumber;};//*((int*)(buff+5))&0xffffff;};
|
||||
|
||||
/**
|
||||
|
||||
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 ((sls_detector_header*)buff)->packetNumber;}//((*(((int*)(buff+4))))&0xff)+1;};
|
||||
|
||||
/* /\** */
|
||||
|
||||
/* 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;
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -28,20 +28,20 @@ class moench04CtbZmqData : public slsDetectorData<uint16_t> {
|
||||
\param c crosstalk parameter for the output buffer
|
||||
|
||||
*/
|
||||
moench04CtbZmqData(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) {
|
||||
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) {
|
||||
|
||||
|
||||
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 };
|
||||
|
||||
int row, col;
|
||||
|
||||
int isample;
|
||||
//int isample;
|
||||
int iadc;
|
||||
int ix, iy;
|
||||
//int ix, iy;
|
||||
|
||||
int npackets=40;
|
||||
// int npackets=40;
|
||||
int i;
|
||||
int adc4(0);
|
||||
//int adc4(0);
|
||||
|
||||
for (int is=0; is<aSamples; is++) {
|
||||
|
||||
@ -223,15 +223,15 @@ class moench04CtbZmqData : public slsDetectorData<uint16_t> {
|
||||
|
||||
|
||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
||||
char *retval=0;
|
||||
int nd;
|
||||
int fnum = -1;
|
||||
// char *retval=0;
|
||||
//int nd;
|
||||
//int fnum = -1;
|
||||
np=0;
|
||||
int pn;
|
||||
//int pn;
|
||||
|
||||
// cout << dataSize << endl;
|
||||
if (ff>=0)
|
||||
fnum=ff;
|
||||
// fnum=ff;
|
||||
|
||||
if (filebin.is_open()) {
|
||||
if (filebin.read(data, dataSize) ){
|
||||
|
@ -28,19 +28,20 @@ template <class dataType> class ghostSummation {
|
||||
~ghostSummation() {delete [] ghost;};
|
||||
|
||||
virtual ghostSummation *Clone() {
|
||||
new ghostSummation(this);
|
||||
return new ghostSummation(this);
|
||||
}
|
||||
|
||||
double getXTalk(){return xtalk;};
|
||||
void setXTalk(double g) {xtalk=g;};
|
||||
|
||||
virtual double calcGhost(char *data, int ix, int iy=1){ghost[iy*nx+ix]=0;};
|
||||
virtual double calcGhost(char *data, int ix, int iy=1){ghost[iy*nx+ix]=0; return 0;};
|
||||
|
||||
virtual void calcGhost(char *data){
|
||||
for (int iy=0; iy<ny; iy++)
|
||||
for (int ix=0; ix<nx; ix++)
|
||||
ghost[iy*nx+ix]=calcGhost(data, ix, iy);
|
||||
}
|
||||
|
||||
virtual double getGhost(int ix, int iy) {
|
||||
if (ix<0 || ix>=nx || iy<0 || iy>=ny) return 0;
|
||||
return ghost[iy*nx+ix];
|
||||
|
@ -139,8 +139,8 @@ class interpolatingDetector : public singlePhotonDetector {
|
||||
nph=addFrame(data,val,0);
|
||||
if (interp)
|
||||
return interp->getInterpolatedImage();
|
||||
else
|
||||
singlePhotonDetector::getImage();
|
||||
//else
|
||||
return singlePhotonDetector::getImage();
|
||||
//return NULL;
|
||||
};
|
||||
|
||||
@ -233,7 +233,7 @@ int addFrame(char *data, int *ph=NULL, int ff=0) {
|
||||
};
|
||||
|
||||
virtual slsInterpolation *setInterpolation(slsInterpolation *ii){
|
||||
int ok;
|
||||
// int ok;
|
||||
interp=ii;
|
||||
/* pthread_mutex_lock(fi);
|
||||
if (interp)
|
||||
|
@ -33,7 +33,7 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
|
||||
{
|
||||
double sDum[2][2];
|
||||
double tot, totquad;
|
||||
double etax,etay;
|
||||
double etax=0,etay=0;
|
||||
|
||||
int corner;
|
||||
corner=calcQuad(data, tot, totquad, sDum);
|
||||
@ -49,7 +49,7 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
|
||||
{
|
||||
double sDum[2][2];
|
||||
double tot, totquad;
|
||||
double etax,etay;
|
||||
double etax=0,etay=0;
|
||||
|
||||
int corner;
|
||||
corner=calcQuad(data, tot, totquad, sDum);
|
||||
@ -71,7 +71,7 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
|
||||
virtual void getInterpolatedPosition(int x, int y, double totquad,int quad,double *cl,double &int_x, double &int_y) {
|
||||
|
||||
double cc[2][2];
|
||||
int xoff, yoff;
|
||||
int xoff=0, yoff=0;
|
||||
switch (quad) {
|
||||
case BOTTOM_LEFT:
|
||||
xoff=0;
|
||||
@ -92,7 +92,7 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
|
||||
default:
|
||||
;
|
||||
}
|
||||
double etax, etay;
|
||||
double etax=0, etay=0;
|
||||
if (nSubPixels>2) {
|
||||
cc[0][0]=cl[xoff+3*yoff];
|
||||
cc[1][0]=cl[xoff+3*(yoff+1)];
|
||||
@ -100,6 +100,7 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
|
||||
cc[1][1]=cl[xoff+1+3*(yoff+1)];
|
||||
calcEta(totquad,cc,etax,etay);
|
||||
}
|
||||
|
||||
return getInterpolatedPosition(x,y,etax, etay,quad,int_x,int_y);
|
||||
|
||||
}
|
||||
@ -109,7 +110,7 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
|
||||
virtual void getInterpolatedPosition(int x, int y, double totquad,int quad,int *cl,double &int_x, double &int_y) {
|
||||
|
||||
double cc[2][2];
|
||||
int xoff, yoff;
|
||||
int xoff=0, yoff=0;
|
||||
|
||||
switch (quad) {
|
||||
case BOTTOM_LEFT:
|
||||
@ -131,7 +132,7 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
|
||||
default:
|
||||
;
|
||||
}
|
||||
double etax, etay;
|
||||
double etax=0, etay=0;
|
||||
if (nSubPixels>2) {
|
||||
cc[0][0]=cl[xoff+3*yoff];
|
||||
cc[1][0]=cl[xoff+3*(yoff+1)];
|
||||
@ -222,7 +223,7 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
|
||||
|
||||
virtual int addToFlatField(double totquad,int quad,int *cl,double &etax, double &etay) {
|
||||
double cc[2][2];
|
||||
int xoff, yoff;
|
||||
int xoff=0, yoff=0;
|
||||
|
||||
switch (quad) {
|
||||
case BOTTOM_LEFT:
|
||||
@ -260,7 +261,7 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
|
||||
|
||||
virtual int addToFlatField(double totquad,int quad,double *cl,double &etax, double &etay) {
|
||||
double cc[2][2];
|
||||
int xoff, yoff;
|
||||
int xoff=0, yoff=0;
|
||||
|
||||
switch (quad) {
|
||||
case BOTTOM_LEFT:
|
||||
@ -308,11 +309,12 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
|
||||
virtual int addToFlatField(double *cluster, double &etax, double &etay){
|
||||
double sDum[2][2];
|
||||
double tot, totquad;
|
||||
int corner;
|
||||
corner=calcQuad(cluster, tot, totquad, sDum);
|
||||
// int corner;
|
||||
//corner=
|
||||
calcQuad(cluster, tot, totquad, sDum);
|
||||
|
||||
double xpos_eta,ypos_eta;
|
||||
double dX,dY;
|
||||
//double xpos_eta,ypos_eta;
|
||||
//double dX,dY;
|
||||
|
||||
|
||||
calcEta(totquad, sDum, etax, etay);
|
||||
@ -324,11 +326,12 @@ class eta2InterpolationBase : public virtual etaInterpolationBase {
|
||||
virtual int addToFlatField(int *cluster, double &etax, double &etay){
|
||||
double sDum[2][2];
|
||||
double tot, totquad;
|
||||
int corner;
|
||||
corner=calcQuad(cluster, tot, totquad, sDum);
|
||||
//int corner;
|
||||
//corner=
|
||||
calcQuad(cluster, tot, totquad, sDum);
|
||||
|
||||
double xpos_eta,ypos_eta;
|
||||
double dX,dY;
|
||||
// double xpos_eta,ypos_eta;
|
||||
//double dX,dY;
|
||||
|
||||
|
||||
calcEta(totquad, sDum, etax, etay);
|
||||
|
@ -59,10 +59,10 @@ class eta3InterpolationBase : public virtual etaInterpolationBase {
|
||||
//////////// /*It return position hit for the event in input */ //////////////
|
||||
virtual void getInterpolatedPosition(int x, int y, int *data, double &int_x, double &int_y)
|
||||
{
|
||||
double tot, totquad;
|
||||
double tot;
|
||||
double etax,etay;
|
||||
|
||||
int corner=calcEta3(data,etax,etay, totquad);
|
||||
int corner=calcEta3(data,etax,etay, tot);
|
||||
|
||||
getInterpolatedPosition(x,y,etax,etay,corner,int_x,int_y);
|
||||
|
||||
@ -72,11 +72,11 @@ class eta3InterpolationBase : public virtual etaInterpolationBase {
|
||||
|
||||
virtual void getInterpolatedPosition(int x, int y, double *data, double &int_x, double &int_y)
|
||||
{
|
||||
double sDum[2][2];
|
||||
double tot, totquad;
|
||||
//double sDum[2][2];
|
||||
double tot;
|
||||
double etax,etay;
|
||||
|
||||
int corner=calcEta3(data,etax,etay, totquad);
|
||||
int corner=calcEta3(data,etax,etay, tot);
|
||||
|
||||
getInterpolatedPosition(x,y,etax,etay,corner,int_x,int_y);
|
||||
|
||||
|
@ -190,7 +190,7 @@ float *gethhx()
|
||||
|
||||
|
||||
void debugSaveAll(int ind=0) {
|
||||
int ib, ibx, iby;
|
||||
int ibx, iby;
|
||||
char tit[10000];
|
||||
|
||||
float tot_eta=0;
|
||||
@ -204,7 +204,7 @@ float *gethhx()
|
||||
etah[ii]=heta[ii];
|
||||
tot_eta+=heta[ii];
|
||||
}
|
||||
sprintf(tit,"/scratch/eta.tiff",ind);
|
||||
sprintf(tit,"/scratch/eta_%d.tiff",ind);
|
||||
WriteToTiff(etah, tit, etabins, etabins);
|
||||
|
||||
|
||||
@ -284,7 +284,7 @@ float *gethhx()
|
||||
double calcDiff(double avg, float *hx, float *hy) {
|
||||
//double p_tot=0;
|
||||
double diff=0, d;
|
||||
double bsize=1./nSubPixels;
|
||||
//double bsize=1./nSubPixels;
|
||||
int nbad=0;
|
||||
double p_tot_x[nSubPixels], p_tot_y[nSubPixels], p_tot[nSubPixels*nSubPixels];
|
||||
double maxdiff=0, mindiff=avg*nSubPixels*nSubPixels;
|
||||
@ -351,9 +351,9 @@ float *gethhx()
|
||||
return sqrt(diff);
|
||||
}
|
||||
|
||||
int *heta;
|
||||
float *hhx;
|
||||
float *hhy;
|
||||
int *heta;
|
||||
int nbeta;
|
||||
double etamin, etamax, etastep;
|
||||
double rangeMin, rangeMax;
|
||||
|
@ -35,7 +35,7 @@ class etaInterpolationPosXY : public virtual etaInterpolationBase{
|
||||
|
||||
|
||||
///*Eta Distribution Rebinning*///
|
||||
double bsize=1./nSubPixels; //precision
|
||||
// double bsize=1./nSubPixels; //precision
|
||||
// cout<<"nPixelsX = "<<nPixelsX<<" nPixelsY = "<<nPixelsY<<" nSubPixels = "<<nSubPixels<<endl;
|
||||
double tot_eta=0;
|
||||
double tot_eta_x=0;
|
||||
@ -50,8 +50,8 @@ class etaInterpolationPosXY : public virtual etaInterpolationBase{
|
||||
double hy[nbeta]; //profile y
|
||||
double hix[nbeta]; //integral of projection x
|
||||
double hiy[nbeta]; //integral of projection y
|
||||
int ii=0;
|
||||
double etax, etay;
|
||||
// int ii=0;
|
||||
double etax;//, etay;
|
||||
for (int ib=0; ib<nbeta; ib++) {
|
||||
|
||||
tot_eta_x=0;
|
||||
@ -81,7 +81,7 @@ class etaInterpolationPosXY : public virtual etaInterpolationBase{
|
||||
hiy[iby]=hiy[iby-1]+hy[iby];
|
||||
}
|
||||
|
||||
ii=0;
|
||||
// ii=0;
|
||||
tot_eta_x=hix[nbeta-1]+1;
|
||||
tot_eta_y=hiy[nbeta-1]+1;
|
||||
|
||||
@ -98,7 +98,7 @@ class etaInterpolationPosXY : public virtual etaInterpolationBase{
|
||||
/* if (ii!=(nSubPixels-1)) */
|
||||
/* cout << ib << " x " << tot_eta_x << " " << (ii+1)*tot_eta_x*bsize << " " << ii << " " << hix[nbeta-1]<< endl; */
|
||||
|
||||
ii=0;
|
||||
//ii=0;
|
||||
|
||||
for (int ibx=0; ibx<nbeta; ibx++) {
|
||||
if (tot_eta_y<=0) {
|
||||
|
@ -9,16 +9,24 @@ public:
|
||||
virtual int getROI(int ix, int iy){return ix+(iy/200)*400;};
|
||||
|
||||
virtual void addToCommonMode(double val, int ix=0, int iy=0) {
|
||||
if (ix<rows || ix>399-rows) {
|
||||
if (iy<rows || iy>399-rows) {
|
||||
int iroi=getROI(ix,iy);
|
||||
// cout << iy << " " << ix << " " << iroi ;
|
||||
if (iroi>=0 && iroi<nROI) {
|
||||
mean[iroi]+=val;
|
||||
mean2[iroi]+=val*val;
|
||||
nCm[iroi]++;
|
||||
if (nCm[iroi]>rows) cout << "Too many pixels added " << nCm[iroi] << endl;
|
||||
/* if (ix==10 && iy<20) */
|
||||
/* cout << " ** "<<val << " " << mean[iroi] << " " << nCm[iroi] << " " << getCommonMode(ix, iy) << endl; */
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
virtual commonModeSubtractionColumn *Clone() {
|
||||
return new commonModeSubtractionColumn(this->rows);
|
||||
}
|
||||
|
||||
private:
|
||||
int rows;
|
||||
};
|
||||
@ -47,7 +55,6 @@ class moench03CommonMode : public commonModeSubtractionColumn {
|
||||
moench03CommonMode(int nr=20) : commonModeSubtractionColumn(nr){} ;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -22,6 +22,12 @@ class moench03GhostSummation : public ghostSummation<uint16_t> {
|
||||
}
|
||||
};
|
||||
|
||||
moench03GhostSummation(moench03GhostSummation *orig) : ghostSummation(orig) {
|
||||
}
|
||||
|
||||
virtual moench03GhostSummation *Clone() {
|
||||
return new moench03GhostSummation(this);
|
||||
}
|
||||
|
||||
virtual double calcGhost(char *data, int x, int y=0){
|
||||
int ix=x%25;
|
||||
@ -37,6 +43,7 @@ class moench03GhostSummation : public ghostSummation<uint16_t> {
|
||||
// cout << val << " " ;
|
||||
}
|
||||
ghost[iy*nx+ix]=xtalk*val;
|
||||
// if (ix==15 && iy==15) cout << ":" << ghost[iy*nx+ix] << " " << val << endl;
|
||||
return ghost[iy*nx+ix];
|
||||
};
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef MOENCHCOMMONMODE_H
|
||||
#define MOENCHCOMMONMODE_H
|
||||
|
||||
#include "commonModeSubtraction.h"
|
||||
#include "commonModeSubtractionNew.h"
|
||||
|
||||
class moenchCommonMode : public commonModeSubtraction {
|
||||
/** @short class to calculate the common mode noise for moench02 i.e. on 4 supercolumns separately */
|
||||
@ -9,35 +9,36 @@ class moenchCommonMode : public commonModeSubtraction {
|
||||
/** constructor - initalizes a commonModeSubtraction with 4 different regions of interest
|
||||
\param nn number of samples for the moving average
|
||||
*/
|
||||
moenchCommonMode(int nn=1000) : commonModeSubtraction(nn,4){} ;
|
||||
|
||||
moenchCommonMode(int nn=0) : commonModeSubtraction(0){} ;
|
||||
|
||||
|
||||
/** add value to common mode as a function of the pixel value, subdividing the region of interest in the 4 supercolumns of 40 columns each;
|
||||
\param val value to add to the common mode
|
||||
\param ix pixel coordinate in the x direction
|
||||
\param iy pixel coordinate in the y direction
|
||||
*/
|
||||
virtual void addToCommonMode(double val, int ix=0, int iy=0) {
|
||||
(void) iy;
|
||||
int isc=ix/40;
|
||||
if (isc>=0 && isc<nROI) {
|
||||
cmPed[isc]+=val;
|
||||
nCm[isc]++;
|
||||
}
|
||||
};
|
||||
/**returns common mode value as a function of the pixel value, subdividing the region of interest in the 4 supercolumns of 40 columns each;
|
||||
\param ix pixel coordinate in the x direction
|
||||
\param iy pixel coordinate in the y direction
|
||||
\returns common mode value
|
||||
*/
|
||||
virtual double getCommonMode(int ix=0, int iy=0) {
|
||||
(void) iy;
|
||||
int isc=ix/40;
|
||||
if (isc>=0 && isc<nROI) {
|
||||
if (nCm[isc]>0) return cmPed[isc]/nCm[isc]-cmStat[isc].Mean();
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
/* /\** add value to common mode as a function of the pixel value, subdividing the region of interest in the 4 supercolumns of 40 columns each; */
|
||||
/* \param val value to add to the common mode */
|
||||
/* \param ix pixel coordinate in the x direction */
|
||||
/* \param iy pixel coordinate in the y direction */
|
||||
/* *\/ */
|
||||
/* virtual void addToCommonMode(double val, int ix=0, int iy=0) { */
|
||||
/* (void) iy; */
|
||||
/* int isc=ix/40; */
|
||||
/* if (isc>=0 && isc<nROI) { */
|
||||
/* cmPed[isc]+=val; */
|
||||
/* nCm[isc]++; */
|
||||
/* } */
|
||||
/* }; */
|
||||
/* /\**returns common mode value as a function of the pixel value, subdividing the region of interest in the 4 supercolumns of 40 columns each; */
|
||||
/* \param ix pixel coordinate in the x direction */
|
||||
/* \param iy pixel coordinate in the y direction */
|
||||
/* \returns common mode value */
|
||||
/* *\/ */
|
||||
/* virtual double getCommonMode(int ix=0, int iy=0) { */
|
||||
/* (void) iy; */
|
||||
/* int isc=ix/40; */
|
||||
/* if (isc>=0 && isc<nROI) { */
|
||||
/* if (nCm[isc]>0) return cmPed[isc]/nCm[isc]-cmStat[isc].Mean(); */
|
||||
/* } */
|
||||
/* return 0; */
|
||||
/* }; */
|
||||
|
||||
};
|
||||
|
||||
|
@ -13,6 +13,13 @@ all: moenchClusterFinder moenchMakeEta moenchInterpolation moenchNoInterpolation
|
||||
moenchClusterFinder: moench03ClusterFinder.cpp $(INCS) clean
|
||||
g++ -o moenchClusterFinder moench03ClusterFinder.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DNEWRECEIVER
|
||||
|
||||
|
||||
moenchClusterFinderHighZ: moench03ClusterFinder.cpp $(INCS) clean
|
||||
g++ -o moenchClusterFinderHighZ moench03ClusterFinder.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DNEWRECEIVER -DHIGHZ
|
||||
|
||||
|
||||
|
||||
|
||||
moenchMakeEta: moench03Interpolation.cpp $(INCS) clean
|
||||
g++ -o moenchMakeEta moench03Interpolation.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DFF
|
||||
|
||||
@ -28,6 +35,12 @@ moenchPhotonCounter: moenchPhotonCounter.cpp $(INCS) clean
|
||||
moenchAnalog: moenchPhotonCounter.cpp $(INCS) clean
|
||||
g++ -o moenchAnalog moenchPhotonCounter.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWRECEIVER -DANALOG
|
||||
|
||||
moenchPhotonCounterHighZ: moenchPhotonCounter.cpp $(INCS) clean
|
||||
g++ -o moenchPhotonCounterHighZ moenchPhotonCounter.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWRECEIVER -DHIGHZ
|
||||
|
||||
moenchAnalogHighZ: moenchPhotonCounter.cpp $(INCS) clean
|
||||
g++ -o moenchAnalogHighZ moenchPhotonCounter.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWRECEIVER -DANALOG -DHIGHZ
|
||||
|
||||
clean:
|
||||
rm -f moenchClusterFinder moenchMakeEta moenchInterpolation moenchNoInterpolation moenchPhotonCounter moenchAnalog
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
INCDIR= -I. -I../dataStructures ../tiffIO.cpp -I../ -I../interpolations/ -I../../slsSupportLib/include/ -I../../slsReceiverSoftware/include/
|
||||
LDFLAG= -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -O3 -g -std=c++11
|
||||
LDFLAG= -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -O3 -g -std=c++11 -Wall
|
||||
#-L../../bin -lhdf5 -L.
|
||||
|
||||
#DESTDIR?=../bin
|
||||
|
@ -2,6 +2,10 @@
|
||||
#include <iostream>
|
||||
#define CORR
|
||||
|
||||
#define C_GHOST 0.0004
|
||||
|
||||
#define CM_ROWS 50
|
||||
|
||||
//#define VERSION_V1
|
||||
|
||||
//#include "moench03T1ZmqData.h"
|
||||
@ -48,7 +52,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
|
||||
if (argc<4) {
|
||||
cout << "Usage is " << argv[0] << "indir outdir fname [runmin] [runmax] [pedfile] [threshold] [nframes] [xmin xmax ymin ymax]" << endl;
|
||||
cout << "Usage is " << argv[0] << "indir outdir fname [runmin] [runmax] [pedfile] [threshold] [nframes] [xmin xmax ymin ymax] [gainmap]" << endl;
|
||||
cout << "threshold <0 means analog; threshold=0 means cluster finder; threshold>0 means photon counting" << endl;
|
||||
cout << "nframes <0 means sum everything; nframes=0 means one file per run; nframes>0 means one file every nframes" << endl;
|
||||
return 1;
|
||||
@ -56,7 +60,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
int p=10000;
|
||||
int fifosize=1000;
|
||||
int nthreads=1;
|
||||
int nthreads=10;
|
||||
int nsubpix=25;
|
||||
int etabins=nsubpix*10;
|
||||
double etamin=-1, etamax=2;
|
||||
@ -92,32 +96,24 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
decoder->getDetectorSize(nx,ny);
|
||||
|
||||
int ncol_cm=20;
|
||||
double xt_ghost=0.0004;
|
||||
int ncol_cm=CM_ROWS;
|
||||
double xt_ghost=C_GHOST;
|
||||
moench03CommonMode *cm=NULL;
|
||||
moench03GhostSummation *gs;
|
||||
double *gainmap=NULL;
|
||||
#ifdef CORR
|
||||
cout << "Applying common mode and ghost correction " << endl;
|
||||
cm=new moench03CommonMode(ncol_cm);
|
||||
gs=new moench03GhostSummation(decoder, xt_ghost);
|
||||
#endif
|
||||
float *gm;
|
||||
|
||||
|
||||
singlePhotonDetector *filter=new singlePhotonDetector(decoder,csize, nsigma, 1, cm, nped, 200, -1, -1, gainmap, gs);
|
||||
|
||||
int size = 327680;////atoi(argv[3]);
|
||||
|
||||
int* image;
|
||||
//int* image =new int[327680/sizeof(int)];
|
||||
filter->newDataSet();
|
||||
|
||||
|
||||
int ff, np;
|
||||
int dsize=decoder->getDataSize();
|
||||
//cout << " data size is " << dsize;
|
||||
|
||||
|
||||
char data[dsize];
|
||||
|
||||
ifstream filebin;
|
||||
char *indir=argv[1];
|
||||
@ -144,7 +140,7 @@ int main(int argc, char *argv[]) {
|
||||
double thr1=1;
|
||||
|
||||
if (argc>=8) {
|
||||
thr=atoi(argv[7]);
|
||||
thr=atof(argv[7]);
|
||||
}
|
||||
|
||||
|
||||
@ -162,6 +158,12 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
|
||||
char *gainfname=NULL;
|
||||
if (argc>13) {
|
||||
gainfname=argv[13];
|
||||
cout << "Gain map file name is: " << gainfname << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -181,13 +183,59 @@ int main(int argc, char *argv[]) {
|
||||
cout << "runmax is " << runmax << endl;
|
||||
if (pedfile)
|
||||
cout << "pedestal file is " << pedfile << endl;
|
||||
if (thr>0)
|
||||
cout << "threshold is " << thr << endl;
|
||||
|
||||
uint32 nnx, nny;
|
||||
double *gmap;
|
||||
|
||||
// if (gainfname) {
|
||||
// gm=ReadFromTiff(gainfname, nny, nnx);
|
||||
// if (gm && nnx==nx && nny==ny) {
|
||||
// gmap=new double[nx*ny];
|
||||
// for (int i=0; i<nx*ny; i++) {
|
||||
// gmap[i]=gm[i];
|
||||
// }
|
||||
// delete gm;
|
||||
// } else
|
||||
// cout << "Could not open gain map " << gainfname << endl;
|
||||
// }
|
||||
|
||||
#ifdef CORR
|
||||
cout << "Applying common mode " << ncol_cm << endl;
|
||||
cm=new moench03CommonMode(ncol_cm);
|
||||
|
||||
|
||||
cout << "Applying ghost corrections " << xt_ghost << endl;
|
||||
gs=new moench03GhostSummation(decoder, xt_ghost);
|
||||
#endif
|
||||
|
||||
singlePhotonDetector *filter=new singlePhotonDetector(decoder,csize, nsigma, 1, cm, nped, 200, -1, -1, gainmap, gs);
|
||||
|
||||
if (gainfname) {
|
||||
|
||||
if (filter->readGainMap(gainfname))
|
||||
cout << "using gain map " << gainfname << endl;
|
||||
else
|
||||
cout << "Could not open gain map " << gainfname << endl;
|
||||
} else
|
||||
thr=0.15*thr;
|
||||
filter->newDataSet();
|
||||
int dsize=decoder->getDataSize();
|
||||
|
||||
|
||||
char data[dsize];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//#ifndef ANALOG
|
||||
if (thr>0) {
|
||||
cout << "threshold is " << thr << endl;
|
||||
|
||||
#ifndef ANALOG
|
||||
//#ifndef ANALOG
|
||||
filter->setThreshold(thr);
|
||||
#endif
|
||||
//#endif
|
||||
cf=0;
|
||||
|
||||
} else
|
||||
@ -215,7 +263,7 @@ int main(int argc, char *argv[]) {
|
||||
mt->setDetectorMode(eAnalog);
|
||||
cout << "Analog!" << endl;
|
||||
cf=0;
|
||||
thr1=thr;
|
||||
//thr1=thr;
|
||||
#endif
|
||||
// }
|
||||
|
||||
@ -227,14 +275,17 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
int ifr=0;
|
||||
|
||||
|
||||
double ped[nx*ny], *ped1;
|
||||
|
||||
|
||||
if (pedfile) {
|
||||
cout << "PEDESTAL " ;
|
||||
|
||||
cout << "PEDESTAL " << endl;
|
||||
sprintf(imgfname,"%s/pedestals.tiff",outdir);
|
||||
|
||||
if (string(pedfile).find(".tif")==std::string::npos){
|
||||
sprintf(fname,"%s.raw",pedfile);
|
||||
cout << fname << endl ;
|
||||
sprintf(imgfname,"%s/pedestals.tiff",outdir,fformat);
|
||||
std::time(&end_time);
|
||||
cout << "aaa" << std::ctime(&end_time) << endl;
|
||||
|
||||
@ -259,12 +310,31 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
filebin.close();
|
||||
while (mt->isBusy()) {;}
|
||||
mt->writePedestal(imgfname);
|
||||
std::time(&end_time);
|
||||
cout << std::ctime(&end_time) << endl;
|
||||
|
||||
} else
|
||||
cout << "Could not open pedestal file "<< fname << " for reading " << endl;
|
||||
} else {
|
||||
float *pp=ReadFromTiff(pedfile, nny, nnx);
|
||||
if (pp && nnx==nx && nny==ny) {
|
||||
for (int i=0; i<nx*ny; i++) {
|
||||
ped[i]=pp[i];
|
||||
}
|
||||
delete [] pp;
|
||||
mt->setPedestal(ped);
|
||||
// ped1=mt->getPedestal();
|
||||
|
||||
// for (int i=0; i<nx*ny; i++) {
|
||||
|
||||
// cout << ped[i]<<"/"<<ped1[i] << " " ;
|
||||
// }
|
||||
cout << "Pedestal set from tiff file " << pedfile << endl;
|
||||
} else {
|
||||
cout << "Could not open pedestal tiff file "<< pedfile << " for reading " << endl;
|
||||
}
|
||||
}
|
||||
mt->writePedestal(imgfname);
|
||||
std::time(&end_time);
|
||||
cout << std::ctime(&end_time) << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -318,6 +388,10 @@ int main(int argc, char *argv[]) {
|
||||
mt->nextThread();
|
||||
// // // cout << " " << (void*)buff;
|
||||
mt->popFree(buff);
|
||||
|
||||
|
||||
|
||||
|
||||
ifr++;
|
||||
if (ifr%100==0) cout << ifr << " " << ff << endl;
|
||||
if (nframes>0) {
|
||||
|
@ -1,4 +1,9 @@
|
||||
#define WRITE_QUAD
|
||||
#define DEVELOPER
|
||||
|
||||
#define C_GHOST 0.0004
|
||||
|
||||
#define CM_ROWS 20
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
#include "ZmqSocket.h"
|
||||
@ -46,9 +51,11 @@ int main(int argc, char *argv[]) {
|
||||
int fifosize=5000;
|
||||
int etabins=1000;//nsubpix*2*100;
|
||||
double etamin=-1, etamax=2;
|
||||
int nSubPixels=2;
|
||||
// int emin, emax;
|
||||
// help
|
||||
if (argc < 3 ) {
|
||||
cprintf(RED, "Help: ./trial [receive socket ip] [receive starting port number] [send_socket ip] [send starting port number] [nthreads] [nsubpix] [etafile]\n");
|
||||
cprintf(RED, "Help: ./trial [receive socket ip] [receive starting port number] [send_socket ip] [send starting port number] [nthreads] [nsubpix] [gainmap] [etafile]\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@ -60,6 +67,7 @@ int main(int argc, char *argv[]) {
|
||||
char* socketip2 = 0;
|
||||
uint32_t portnum2 = 0;
|
||||
|
||||
uint32_t nSigma=5;
|
||||
|
||||
int ok;
|
||||
|
||||
@ -85,17 +93,22 @@ int main(int argc, char *argv[]) {
|
||||
nthreads=atoi(argv[5]);
|
||||
|
||||
cout << "Number of threads is: " << nthreads << endl;
|
||||
int nSubPixels=2;
|
||||
if (argc>6)
|
||||
nSubPixels=atoi(argv[6]);
|
||||
cout << "Number of subpixels is: " << nSubPixels << endl;
|
||||
|
||||
char *etafname=NULL;
|
||||
|
||||
char *gainfname=NULL;
|
||||
if (argc>7) {
|
||||
etafname=argv[7];
|
||||
cout << "Eta file name is: " << etafname << endl;
|
||||
gainfname=argv[7];
|
||||
cout << "Gain map file name is: " << gainfname << endl;
|
||||
}
|
||||
|
||||
char *etafname=NULL;
|
||||
if (argc>8) {
|
||||
etafname=argv[8];
|
||||
cout << "Eta file name is: " << etafname << endl;
|
||||
}
|
||||
|
||||
//slsDetectorData *det=new moench03T1ZmqDataNew();
|
||||
moench03T1ZmqDataNew *det=new moench03T1ZmqDataNew();
|
||||
@ -108,20 +121,44 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
int maxSize = npx*npy*2;//32*2*8192;//5000;//atoi(argv[3]);
|
||||
int size= maxSize;//32*2*5000;
|
||||
int multisize=size;
|
||||
int dataSize=size;
|
||||
//int multisize=size;
|
||||
//int dataSize=size;
|
||||
|
||||
char dummybuff[size];
|
||||
|
||||
int ncol_cm=20;
|
||||
double xt_ghost=0.00045;
|
||||
|
||||
int ncol_cm=CM_ROWS;
|
||||
double xt_ghost=C_GHOST;
|
||||
moench03CommonMode *cm=new moench03CommonMode(ncol_cm);
|
||||
moench03GhostSummation *gs=new moench03GhostSummation(det, xt_ghost);
|
||||
double *gainmap=NULL;
|
||||
float *gm;
|
||||
double *gmap=NULL;
|
||||
|
||||
uint32_t nnnx, nnny;
|
||||
if (gainfname) {
|
||||
gm=ReadFromTiff(gainfname, nnny, nnnx);
|
||||
if (gm && nnnx==(uint)npx && nnny==(uint)npy) {
|
||||
gmap=new double[npx*npy];
|
||||
for (int i=0; i<npx*npy; i++) {
|
||||
gmap[i]=gm[i];
|
||||
}
|
||||
delete [] gm;
|
||||
} else
|
||||
cout << "Could not open gain map " << gainfname << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//analogDetector<uint16_t> *filter=new analogDetector<uint16_t>(det,1,NULL,1000);
|
||||
#ifndef INTERP
|
||||
singlePhotonDetector *filter=new singlePhotonDetector(det,3, 5, 1, cm, 1000, 10, -1, -1, gainmap, gs);
|
||||
singlePhotonDetector *filter=new singlePhotonDetector(det,3, nSigma, 1, cm, 1000, 10, -1, -1, gainmap, gs);
|
||||
|
||||
multiThreadedCountingDetector *mt=new multiThreadedCountingDetector(filter,nthreads,fifosize);
|
||||
|
||||
@ -132,7 +169,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
if (etafname) interp->readFlatField(etafname);
|
||||
|
||||
interpolatingDetector *filter=new interpolatingDetector(det,interp, 5, 1, cm, 1000, 10, -1, -1, gainmap, gs);
|
||||
interpolatingDetector *filter=new interpolatingDetector(det,interp, nSigma, 1, cm, 1000, 10, -1, -1, gainmap, gs);
|
||||
multiThreadedInterpolatingDetector *mt=new multiThreadedInterpolatingDetector(filter,nthreads,fifosize);
|
||||
#endif
|
||||
|
||||
@ -223,21 +260,22 @@ int main(int argc, char *argv[]) {
|
||||
// header variables
|
||||
uint64_t acqIndex = -1;
|
||||
uint64_t frameIndex = -1;
|
||||
uint32_t subFrameIndex = -1;
|
||||
//uint32_t subFrameIndex = -1;
|
||||
uint64_t fileindex = -1;
|
||||
string filename = "";
|
||||
// char* image = new char[size];
|
||||
//int* image = new int[(size/sizeof(int))]();
|
||||
uint32_t flippedDataX = -1;
|
||||
int *nph;
|
||||
//uint32_t flippedDataX = -1;
|
||||
//int *nph;
|
||||
int iframe=0;
|
||||
char ofname[10000];
|
||||
|
||||
char fname[10000];
|
||||
int length;
|
||||
// int length;
|
||||
int *detimage;
|
||||
int nnx, nny,nns;
|
||||
uint32_t imageSize = 0, nPixelsX = 0, nPixelsY = 0, dynamicRange = 0;
|
||||
//uint32_t imageSize = 0, nPixelsX = 0, nPixelsY = 0,
|
||||
//uint32_t dynamicRange = 0;
|
||||
// infinite loop
|
||||
uint32_t packetNumber = 0;
|
||||
uint64_t bunchId = 0;
|
||||
@ -251,11 +289,10 @@ int main(int argc, char *argv[]) {
|
||||
//int16_t *dout;//=new int16_t [nnx*nny];
|
||||
uint32_t dr = 32;
|
||||
int32_t *dout=NULL;//=new int32_t [nnx*nny];
|
||||
uint32_t nSigma=5;
|
||||
uint16_t roundRNumber = 0;
|
||||
uint8_t detType = 0;
|
||||
uint8_t version = 0;
|
||||
int* flippedData = 0;
|
||||
// int* flippedData = 0;
|
||||
char* additionalJsonHeader = 0;
|
||||
|
||||
int32_t threshold=0;
|
||||
@ -264,15 +301,14 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
string frameMode_s, detectorMode_s, intMode_s;
|
||||
|
||||
int emin, emax;
|
||||
int resetFlat=0;
|
||||
int resetPed=0;
|
||||
int nsubPixels=1;
|
||||
int isPedestal;
|
||||
int isFlat=0;
|
||||
// int resetFlat=0;
|
||||
//int resetPed=0;
|
||||
// int nsubPixels=1;
|
||||
//int isPedestal=0;
|
||||
//int isFlat=0;
|
||||
int newFrame=1;
|
||||
detectorMode dMode;
|
||||
frameMode fMode;
|
||||
detectorMode dMode=eAnalog;
|
||||
frameMode fMode=eFrame;
|
||||
double *ped;
|
||||
|
||||
filter->getImageSize(nnx, nny,nns);
|
||||
@ -317,20 +353,20 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
} else {
|
||||
if (fMode==ePedestal) {
|
||||
sprintf(ofname,"%s_%d_ped.tiff",fname,fileindex);
|
||||
sprintf(ofname,"%s_%ld_ped.tiff",fname,fileindex);
|
||||
mt->writePedestal(ofname);
|
||||
cout << "Writing pedestal to " << ofname << endl;
|
||||
}
|
||||
#ifdef INTERP
|
||||
else if (fMode==eFlat) {
|
||||
mt->prepareInterpolation(ok);
|
||||
sprintf(ofname,"%s_%d_eta.tiff",fname,fileindex);
|
||||
sprintf(ofname,"%s_%ld_eta.tiff",fname,fileindex);
|
||||
mt->writeFlatField(ofname);
|
||||
cout << "Writing eta to " << ofname << endl;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
sprintf(ofname,"%s_%d.tiff",fname,fileindex);
|
||||
sprintf(ofname,"%s_%ld.tiff",fname,fileindex);
|
||||
mt->writeImage(ofname);
|
||||
cout << "Writing image to " << ofname << endl;
|
||||
}
|
||||
@ -359,7 +395,7 @@ int main(int argc, char *argv[]) {
|
||||
#ifdef INTERP
|
||||
else if (fMode==eFlat) {
|
||||
int nb;
|
||||
double emi, ema;
|
||||
double emi=0, ema=1;
|
||||
int *ff=mt->getFlatField(nb, emi, ema);
|
||||
nnx=nb;
|
||||
nny=nb;
|
||||
@ -409,8 +445,47 @@ int main(int argc, char *argv[]) {
|
||||
// char* additionalJsonHeader = 0) {
|
||||
|
||||
|
||||
|
||||
// cout << "Sending image size " << nnx << " " << nny << endl;
|
||||
|
||||
#ifndef DEVELOPER
|
||||
#ifndef MOENCH_BRANCH
|
||||
zmqsocket2->SendHeaderData (0, false, SLS_DETECTOR_JSON_HEADER_VERSION, dr, fileindex, 0,0, nnx, nny, nnx*nny*dr/8,acqIndex, frameIndex, fname, acqIndex,0 , packetNumber,bunchId, timestamp, modId, xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, additionalJsonHeader);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef DEVELOPER
|
||||
zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 0,0,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, 0,additionalJsonHeader);
|
||||
#endif
|
||||
#ifdef MOENCH_BRANCH
|
||||
/*
|
||||
int SendHeaderData ( int index, bool dummy, uint32_t jsonversion, uint32_t dynamicrange = 0, uint64_t fileIndex = 0,
|
||||
uint32_t npixelsx = 0, uint32_t npixelsy = 0, uint32_t imageSize = 0,
|
||||
uint64_t acqIndex = 0, uint64_t fIndex = 0, char* fname = NULL,
|
||||
uint64_t frameNumber = 0, uint32_t expLength = 0, uint32_t packetNumber = 0,
|
||||
uint64_t bunchId = 0, uint64_t timestamp = 0,
|
||||
uint16_t modId = 0, uint16_t row = 0, uint16_t column = 0, uint16_t reserved = 0,
|
||||
uint32_t debug = 0, uint16_t roundRNumber = 0,
|
||||
uint8_t detType = 0, uint8_t version = 0, int* flippedData = 0,
|
||||
char* additionalJsonHeader = 0) {
|
||||
int ZmqSocket::SendHeaderData(int 0, bool false, uint32_t SLS_DETECTOR_JSON_HEADER_VERSION , uint32_t dr, uint64_t fileindex, uint32_t 0, uint32_t 0, uint32_t, uint64_t, uint64_t, char*, uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t, int*, char*)
|
||||
|
||||
*/
|
||||
//zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 0,0,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version);//, 0,additionalJsonHeader);
|
||||
zmqsocket2->SendHeaderData (0, false, SLS_DETECTOR_JSON_HEADER_VERSION, dr, fileindex, nnx, nny, nnx*nny*dr/8,acqIndex, frameIndex, fname, acqIndex, subFrameIndex, packetNumber,bunchId, timestamp, modId, xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, flippedData, additionalJsonHeader);
|
||||
|
||||
/* old
|
||||
zmqsocket2->SendHeaderData (0, false, SLS_DETECTOR_JSON_HEADER_VERSION, dr, fileindex, nnx, nny, nnx*nny*dr/8,acqIndex, frameIndex, fname, acqIndex, subFrameIndex, packetNumber,bunchId, timestamp, modId, xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, flippedData, additionalJsonHeader);
|
||||
*/
|
||||
/*
|
||||
|
||||
|
||||
new
|
||||
zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 0,0,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,additionalJsonHeader);
|
||||
*/
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
zmqsocket2->SendData((char*)dout,nnx*nny*dr/8);
|
||||
cprintf(GREEN, "Sent Data\n");
|
||||
@ -449,7 +524,7 @@ int main(int argc, char *argv[]) {
|
||||
// acqIndex, frameIndex, subframeIndex, filename, fileindex
|
||||
size = doc["size"].GetUint();
|
||||
// multisize = size;// * zmqsocket->size();
|
||||
dynamicRange = doc["bitmode"].GetUint();
|
||||
// dynamicRange = doc["bitmode"].GetUint();
|
||||
// nPixelsX = doc["shape"][0].GetUint();
|
||||
// nPixelsY = doc["shape"][1].GetUint();
|
||||
filename = doc["fname"].GetString();
|
||||
@ -466,7 +541,7 @@ int main(int argc, char *argv[]) {
|
||||
//detType=doc["detType"].GetUint();
|
||||
//version=doc["version"].GetUint();
|
||||
|
||||
dataSize=size;
|
||||
//dataSize=size;
|
||||
|
||||
strcpy(fname,filename.c_str());
|
||||
|
||||
@ -500,8 +575,8 @@ int main(int argc, char *argv[]) {
|
||||
// flippedDataX, packetNumber, bunchId, timestamp, modId, debug, roundRNumber, detType, version);
|
||||
|
||||
/* Analog detector commands */
|
||||
isPedestal=0;
|
||||
isFlat=0;
|
||||
//isPedestal=0;
|
||||
//isFlat=0;
|
||||
fMode=eFrame;
|
||||
frameMode_s="frame";
|
||||
cprintf(MAGENTA, "Frame mode: ");
|
||||
@ -510,28 +585,28 @@ int main(int argc, char *argv[]) {
|
||||
frameMode_s=doc["frameMode"].GetString();
|
||||
if (frameMode_s == "pedestal"){
|
||||
fMode=ePedestal;
|
||||
isPedestal=1;
|
||||
//isPedestal=1;
|
||||
} else if (frameMode_s == "newPedestal"){
|
||||
mt->newDataSet(); //resets pedestal
|
||||
// cprintf(MAGENTA, "Resetting pedestal\n");
|
||||
fMode=ePedestal;
|
||||
isPedestal=1;
|
||||
//isPedestal=1;
|
||||
}
|
||||
#ifdef INTERP
|
||||
else if (frameMode_s == "flatfield") {
|
||||
fMode=eFlat;
|
||||
isFlat=1;
|
||||
//isFlat=1;
|
||||
} else if (frameMode_s == "newFlatfield") {
|
||||
mt->resetFlatField();
|
||||
isFlat=1;
|
||||
//isFlat=1;
|
||||
cprintf(MAGENTA, "Resetting flatfield\n");
|
||||
fMode=eFlat;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
fMode=eFrame;
|
||||
isPedestal=0;
|
||||
isFlat=0;
|
||||
//isPedestal=0;
|
||||
//isFlat=0;
|
||||
fMode=eFrame;
|
||||
frameMode_s="frame";
|
||||
}
|
||||
@ -664,10 +739,10 @@ int main(int argc, char *argv[]) {
|
||||
// cout << "data " << endl;
|
||||
if (of==NULL) {
|
||||
#ifdef WRITE_QUAD
|
||||
sprintf(ofname,"%s_%d.clust2",filename.c_str(),fileindex);
|
||||
sprintf(ofname,"%s_%ld.clust2",filename.c_str(),fileindex);
|
||||
#endif
|
||||
#ifndef WRITE_QUAD
|
||||
sprintf(ofname,"%s_%d.clust",filename.c_str(),fileindex);
|
||||
sprintf(ofname,"%s_%ld.clust",filename.c_str(),fileindex);
|
||||
#endif
|
||||
of=fopen(ofname,"w");
|
||||
if (of) {
|
||||
@ -692,13 +767,15 @@ int main(int argc, char *argv[]) {
|
||||
if (packetNumber>=40) {
|
||||
//*((int*)buff)=frameIndex;
|
||||
memcpy(buff,&frameIndex,sizeof(int));
|
||||
length = zmqsocket->ReceiveData(0, buff+sizeof(int), size);
|
||||
//length =
|
||||
zmqsocket->ReceiveData(0, buff+sizeof(int), size);
|
||||
mt->pushData(buff);
|
||||
mt->nextThread();
|
||||
mt->popFree(buff);
|
||||
} else {
|
||||
cprintf(RED, "Incomplete frame: received only %d packet\n", packetNumber);
|
||||
length = zmqsocket->ReceiveData(0, dummybuff, size);
|
||||
//length =
|
||||
zmqsocket->ReceiveData(0, dummybuff, size);
|
||||
|
||||
}
|
||||
|
||||
|
@ -32,11 +32,11 @@ class threadedAnalogDetector
|
||||
{
|
||||
public:
|
||||
threadedAnalogDetector(analogDetector<uint16_t> *d, int fs=10000) {
|
||||
char *mem, *mm;
|
||||
char *mm;//*mem,
|
||||
det=d;
|
||||
fifoFree=new CircularFifo<char>(fs);
|
||||
fifoData=new CircularFifo<char>(fs);
|
||||
|
||||
// mem==NULL;
|
||||
/* mem=(char*)calloc(fs, det->getDataSize()); */
|
||||
/* if (mem) */
|
||||
/* memset(mem,0, fs*det->getDataSize()); */
|
||||
@ -46,6 +46,7 @@ public:
|
||||
// mm=mem+i*det->getDataSize();
|
||||
// cout << i << endl;
|
||||
mm=(char*)calloc(1, det->getDataSize());
|
||||
|
||||
if (mm) {
|
||||
//memset(mm,0, det->getDataSize());
|
||||
fifoFree->push(mm);
|
||||
@ -62,6 +63,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
|
||||
virtual int setFrameMode(int fm) {
|
||||
if (fm>=0) {
|
||||
det->setFrameMode((frameMode)fm);
|
||||
@ -96,11 +98,14 @@ public:
|
||||
virtual int getImageSize(int &nnx, int &nny, int &ns) {return det->getImageSize(nnx, nny, ns);};
|
||||
virtual int getDetectorSize(int &nnx, int &nny) {return det->getDetectorSize(nnx, nny);};
|
||||
|
||||
~threadedAnalogDetector() {StopThread(); free(mem); delete fifoFree; delete fifoData;}
|
||||
virtual ~threadedAnalogDetector() {StopThread(); delete fifoFree; delete fifoData;}
|
||||
|
||||
/** Returns true if the thread was successfully started, false if there was an error starting the thread */
|
||||
virtual bool StartThread()
|
||||
{ stop=0;
|
||||
cout << "Detector number " << det->getId() << endl;
|
||||
cout << "common mode is " << det->getCommonModeSubtraction()<< endl;
|
||||
cout << "ghos summation is " << det->getGhostSummation()<< endl;
|
||||
return (pthread_create(&_thread, NULL, processData, this) == 0);
|
||||
}
|
||||
|
||||
@ -111,11 +116,11 @@ public:
|
||||
|
||||
|
||||
virtual bool pushData(char* &ptr) {
|
||||
fifoData->push(ptr);
|
||||
return fifoData->push(ptr);
|
||||
}
|
||||
|
||||
virtual bool popFree(char* &ptr) {
|
||||
fifoFree->pop(ptr);
|
||||
return fifoFree->pop(ptr);
|
||||
}
|
||||
|
||||
virtual int isBusy() {return busy;}
|
||||
@ -182,16 +187,19 @@ FILE *getFilePointer(){return det->getFilePointer();};
|
||||
|
||||
void *writeFlatField(const char * imgname) {
|
||||
slsInterpolation *interp=(det)->getInterpolation();
|
||||
cout << "interp " << interp << endl;
|
||||
//cout << "interp " << interp << endl;
|
||||
if (interp) {
|
||||
cout << imgname << endl;
|
||||
interp->writeFlatField(imgname);
|
||||
return interp->writeFlatField(imgname);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *readFlatField(const char * imgname, int nb=-1, double emin=1, double emax=0){
|
||||
slsInterpolation *interp=(det)->getInterpolation();
|
||||
if (interp)
|
||||
interp->readFlatField(imgname, nb, emin, emax);
|
||||
return interp->readFlatField(imgname, nb, emin, emax);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
virtual int *getFlatField(int &nb, double emi, double ema){
|
||||
@ -228,7 +236,6 @@ protected:
|
||||
int dMode;
|
||||
int *dataSize;
|
||||
pthread_t _thread;
|
||||
char *mem;
|
||||
CircularFifo<char> *fifoFree;
|
||||
CircularFifo<char> *fifoData;
|
||||
int stop;
|
||||
@ -292,15 +299,15 @@ public:
|
||||
StopThreads();
|
||||
for (int i=0; i<nThreads; i++)
|
||||
delete dets[i];
|
||||
for (int i=1; i<nThreads; i++)
|
||||
delete dd[i];
|
||||
/* for (int i=1; i<nThreads; i++) */
|
||||
/* delete dd[i]; */
|
||||
//delete [] image;
|
||||
}
|
||||
|
||||
|
||||
virtual int setFrameMode(int fm) { int ret; for (int i=0; i<nThreads; i++) { ret=dets[i]->setFrameMode(fm);} return ret;};
|
||||
virtual double setThreshold(int fm) { double ret; for (int i=0; i<nThreads; i++) ret=dets[i]->setThreshold(fm); return ret;};
|
||||
virtual int setDetectorMode(int dm) { int ret; for (int i=0; i<nThreads; i++) ret=dets[i]->setDetectorMode(dm); return ret;};
|
||||
virtual int setFrameMode(int fm) { int ret=dets[0]->setFrameMode(fm); for (int i=1; i<nThreads; i++) { dets[i]->setFrameMode(fm);} return ret;};
|
||||
virtual double setThreshold(int fm) { double ret=dets[0]->setThreshold(fm); for (int i=1; i<nThreads; i++) dets[i]->setThreshold(fm); return ret;};
|
||||
virtual int setDetectorMode(int dm) { int ret=dets[0]->setDetectorMode(dm);; for (int i=1; i<nThreads; i++) dets[i]->setDetectorMode(dm); return ret;};
|
||||
virtual void setROI(int xmin, int xmax, int ymin, int ymax) { for (int i=0; i<nThreads; i++) dets[i]->setROI(xmin, xmax,ymin,ymax);};
|
||||
|
||||
|
||||
@ -408,12 +415,12 @@ public:
|
||||
|
||||
|
||||
virtual bool pushData(char* &ptr) {
|
||||
dets[ithread]->pushData(ptr);
|
||||
return dets[ithread]->pushData(ptr);
|
||||
}
|
||||
|
||||
virtual bool popFree(char* &ptr) {
|
||||
// cout << ithread << endl;
|
||||
dets[ithread]->popFree(ptr);
|
||||
return dets[ithread]->popFree(ptr);
|
||||
}
|
||||
|
||||
virtual int nextThread() {
|
||||
@ -499,14 +506,15 @@ public:
|
||||
uint32 nny;
|
||||
float *gm=ReadFromTiff(imgname, nnx, nny);
|
||||
if (ped) delete [] ped;
|
||||
if (nnx>nx) nx=nnx;
|
||||
if (nny>ny) ny=nny;
|
||||
if (nnx>(uint)nx) nx=nnx;
|
||||
if (nny>(uint)ny) ny=nny;
|
||||
ped=new double[nx*ny];
|
||||
|
||||
for (int ix=0; ix<nx*ny; ix++) {
|
||||
ped[ix]=gm[ix];
|
||||
}
|
||||
delete [] gm;
|
||||
|
||||
return setPedestal();
|
||||
|
||||
};
|
||||
|
@ -25,7 +25,7 @@ class multiThreadedCountingDetector : public multiThreadedAnalogDetector
|
||||
public:
|
||||
multiThreadedCountingDetector(singlePhotonDetector *d, int n, int fs=1000) : multiThreadedAnalogDetector(d,n,fs) { };
|
||||
|
||||
virtual double setNSigma(double n) {double ret; for (int i=0; i<nThreads; i++) ret=(dets[i])->setNSigma(n); return ret;};
|
||||
virtual double setNSigma(double n) {double ret=(dets[0])->setNSigma(n); for (int i=1; i<nThreads; i++) (dets[i])->setNSigma(n); return ret;};
|
||||
virtual void setEnergyRange(double emi, double ema) {for (int i=0; i<nThreads; i++) (dets[i])->setEnergyRange(emi,ema);};
|
||||
|
||||
};
|
||||
|
@ -37,12 +37,12 @@ public:
|
||||
};
|
||||
|
||||
void *writeFlatField(const char * imgname){
|
||||
dets[0]->writeFlatField(imgname);
|
||||
return dets[0]->writeFlatField(imgname);
|
||||
};
|
||||
|
||||
|
||||
void *readFlatField(const char * imgname, int nb=-1, double emin=1, double emax=0){
|
||||
(dets[0])->readFlatField(imgname, nb, emin, emax);
|
||||
return (dets[0])->readFlatField(imgname, nb, emin, emax);
|
||||
};
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ public:
|
||||
\returns current file pointer
|
||||
*/
|
||||
virtual slsInterpolation *setInterpolation(slsInterpolation *f){
|
||||
int ok;
|
||||
//int ok;
|
||||
for (int i=0; i<nThreads; i++)
|
||||
(dets[i])->setInterpolation(f);
|
||||
return (dets[0])->getInterpolation();
|
||||
|
@ -58,7 +58,7 @@ public analogDetector<uint16_t> {
|
||||
int sign=1,
|
||||
commonModeSubtraction *cm=NULL,
|
||||
int nped=1000,
|
||||
int nd=100, int nnx=-1, int nny=-1, double *gm=NULL, ghostSummation<uint16_t> *gs=NULL) : analogDetector<uint16_t>(d, sign, cm, nped, nnx, nny, gm, gs), nDark(nd), eventMask(NULL),nSigma (nsigma), clusterSize(csize), clusterSizeY(csize), clusters(NULL), quad(UNDEFINED_QUADRANT), tot(0), quadTot(0), eMin(-1), eMax(-1) {
|
||||
int nd=100, int nnx=-1, int nny=-1, double *gm=NULL, ghostSummation<uint16_t> *gs=NULL) : analogDetector<uint16_t>(d, sign, cm, nped, nnx, nny, gm, gs), nDark(nd), eventMask(NULL),nSigma (nsigma), eMin(-1), eMax(-1), clusterSize(csize), clusterSizeY(csize), clusters(NULL), quad(UNDEFINED_QUADRANT), tot(0), quadTot(0) {
|
||||
|
||||
|
||||
|
||||
@ -183,13 +183,13 @@ public analogDetector<uint16_t> {
|
||||
//nph=new int[nx*ny];
|
||||
|
||||
double rest[ny][nx];
|
||||
int cy=(clusterSizeY+1)/2; //quad size
|
||||
int cs=(clusterSize+1)/2; //quad size
|
||||
//int cy=(clusterSizeY+1)/2; //quad size
|
||||
//int cs=(clusterSize+1)/2; //quad size
|
||||
|
||||
int ccs=clusterSize; //cluster size
|
||||
int ccy=clusterSizeY; //cluster size
|
||||
//int ccs=clusterSize; //cluster size
|
||||
//int ccy=clusterSizeY; //cluster size
|
||||
|
||||
double g=1.;
|
||||
//double g=1.;
|
||||
|
||||
|
||||
double tthr=thr, tthr1, tthr2;
|
||||
@ -201,10 +201,10 @@ public analogDetector<uint16_t> {
|
||||
if (cmSub) cm=1;
|
||||
|
||||
if (thr>0) {
|
||||
cy=1;
|
||||
cs=1;
|
||||
ccs=1;
|
||||
ccy=1;
|
||||
//cy=1;
|
||||
//cs=1;
|
||||
//ccs=1;
|
||||
//ccy=1;
|
||||
}
|
||||
if (iframe<nDark) {
|
||||
// cout << "ped " << iframe << endl;
|
||||
@ -349,9 +349,9 @@ int *getClusters(char *data, int *ph=NULL) {
|
||||
double val[ny][nx];
|
||||
int cy=(clusterSizeY+1)/2;
|
||||
int cs=(clusterSize+1)/2;
|
||||
int ir, ic;
|
||||
//int ir, ic;
|
||||
|
||||
double max=0, tl=0, tr=0, bl=0,br=0, *v, vv;
|
||||
double max=0, tl=0, tr=0, bl=0,br=0, *v;
|
||||
int cm=0;
|
||||
int good=1;
|
||||
if (cmSub) cm=1;
|
||||
@ -592,7 +592,7 @@ int *getClusters(char *data, int *ph=NULL) {
|
||||
switch(fMode) {
|
||||
case ePedestal:
|
||||
//cout <<"spc add to ped " << endl;
|
||||
addToPedestal(data);
|
||||
addToPedestal(data,1);
|
||||
break;
|
||||
default:
|
||||
switch (dMode) {
|
||||
|
@ -119,7 +119,7 @@ class single_photon_hit {
|
||||
if (fread((void*)qq, 1, 4*sizeof(int), myFile)) {
|
||||
|
||||
quad=TOP_RIGHT;
|
||||
int mm=qq[0];
|
||||
/* int mm=qq[0]; */
|
||||
/* for (int i=1; i<4; i++) { */
|
||||
/* if (qq[i]>mm) { */
|
||||
/* switch (i) { */
|
||||
@ -211,7 +211,7 @@ class single_photon_hit {
|
||||
|
||||
void print() {
|
||||
|
||||
int ix, iy;
|
||||
// int ix, iy;
|
||||
|
||||
for (int iy=0; iy<dy; iy++) {
|
||||
for (int ix=0; ix<dx; ix++) {
|
||||
|
@ -4,20 +4,20 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
// #undef cbf_failnez
|
||||
// #define cbf_failnez(x) \
|
||||
// { \
|
||||
// int err; \
|
||||
// err = (x); \
|
||||
// if (err) { \
|
||||
// fprintf(stderr,"\nCBFlib fatal error %x \n",err); \
|
||||
// exit(-1); \
|
||||
// } \
|
||||
// #define cbf_failnez(x)
|
||||
// {
|
||||
// int err;
|
||||
// err = (x);
|
||||
// if (err) {
|
||||
// fprintf(stderr,"\nCBFlib fatal error %x \n",err);
|
||||
// exit(-1);
|
||||
// }
|
||||
// }
|
||||
|
||||
void *WriteToTiff(float * imgData, const char * imgname, int nrow, int ncol){
|
||||
int sampleperpixel=1;
|
||||
// unsigned char * buff=NULL;
|
||||
tsize_t linebytes;
|
||||
//tsize_t linebytes;
|
||||
// cout << "--" <<endl;
|
||||
TIFF * tif = TIFFOpen(imgname,"w");
|
||||
if (tif) {
|
||||
@ -30,7 +30,7 @@ void *WriteToTiff(float * imgData, const char * imgname, int nrow, int ncol){
|
||||
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
|
||||
TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP);
|
||||
|
||||
linebytes = sampleperpixel*ncol;
|
||||
//linebytes = sampleperpixel*ncol;
|
||||
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, TIFFDefaultStripSize(tif, ncol*sampleperpixel));
|
||||
for(int irow=0; irow<nrow; irow++){
|
||||
TIFFWriteScanline(tif,&imgData[irow*ncol],irow,0);
|
||||
@ -50,7 +50,7 @@ float *ReadFromTiff( const char * imgname, uint32 &nrow, uint32 &ncol){
|
||||
if (tif){
|
||||
uint32 bps;
|
||||
uint32 sampleperpixel=1;
|
||||
tsize_t linebytes;
|
||||
//tsize_t linebytes;
|
||||
|
||||
uint32 imagelength;
|
||||
|
||||
@ -61,9 +61,9 @@ float *ReadFromTiff( const char * imgname, uint32 &nrow, uint32 &ncol){
|
||||
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &imagelength);
|
||||
|
||||
float * imgData=new float[ncol*nrow];
|
||||
linebytes = sampleperpixel*ncol;
|
||||
//linebytes = sampleperpixel*ncol;
|
||||
// TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, TIFFDefaultStripSize(tif, ncol*sampleperpixel));
|
||||
for(int irow=0; irow<nrow; irow++){
|
||||
for(uint32 irow=0; irow<nrow; irow++){
|
||||
//tiffreadscanline(tif, buf, row);
|
||||
TIFFReadScanline(tif,&imgData[irow*ncol],irow);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user