merge from developer (without the additional json header implementations)

This commit is contained in:
maliakal_d 2019-02-12 09:35:24 +01:00
parent 985b2eba4d
commit a64b34610a
28 changed files with 903 additions and 176 deletions

View File

@ -5,11 +5,18 @@ project(slsDetectorPackage)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
set (CALIBRATE OFF)
option (USE_HDF5 "HDF5 File format" OFF)
option (USE_TEXTCLIENT "Text Client" OFF)
option (USE_RECEIVER "Receiver" OFF)
option (USE_GUI "GUI" OFF)
option (USE_TESTS "TESTS" ON)
# Check if project is being used directly or via add_subdirectory
set(SLS_MASTER_PROJECT OFF)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(SLS_MASTER_PROJECT ON)
endif()
option (SLS_USE_HDF5 "HDF5 File format" OFF)
option (SLS_USE_TEXTCLIENT "Text Client" OFF)
option (SLS_USE_RECEIVER "Receiver" OFF)
option (SLS_USE_GUI "GUI" OFF)
option (SLS_USE_TESTS "TESTS" ON)
#Testing for minimum version for compilers
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
@ -24,7 +31,7 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-misleading-indentation")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -std=c++11 ")
# set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=thread")
# set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=thread")
@ -46,9 +53,9 @@ endif(USE_TESTS)
# detector and receiver
add_subdirectory(slsSupportLib)
if (USE_HDF5)
if (SLS_USE_HDF5)
find_package(HDF5 1.10 COMPONENTS CXX)
endif (USE_HDF5)
endif (SLS_USE_HDF5)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
@ -62,22 +69,25 @@ set_target_properties(zmq PROPERTIES
IMPORTED_LOCATION ${ZMQ_STATIC_ARCHIVE}
)
if (USE_TEXTCLIENT)
if (SLS_USE_TEXTCLIENT)
add_subdirectory(slsDetectorSoftware)
endif (USE_TEXTCLIENT)
endif (SLS_USE_TEXTCLIENT)
if (USE_RECEIVER)
if (SLS_USE_RECEIVER)
add_subdirectory(slsReceiverSoftware)
add_subdirectory(manual/manual-api)
endif (USE_RECEIVER)
endif (SLS_USE_RECEIVER)
if (USE_GUI)
if (SLS_USE_GUI)
if (QT4_FOUND AND QWT_FOUND)
add_subdirectory(slsDetectorGui)
endif()
endif (USE_GUI)
endif (SLS_USE_GUI)
if (SLS_MASTER_PROJECT)
# Set targets export name (otherwise set by upstream project)
set(TARGETS_EXPORT_NAME "slsdetector-targets")
endif (SLS_MASTER_PROJECT)
add_subdirectory(integrationTests)

View File

@ -75,13 +75,13 @@ Use cmake to create out-of-source builds, by creating a build folder parallel to
$ cd ..
$ mkdir slsDetectorPackage-build
$ cd slsDetectorPackage-build
$ cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DUSE_HDF5=OFF
$ cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_HDF5=OFF
$ make
```
Use the following as an example to compile statically and using specific hdf5 folder
```
$ HDF5_ROOT=/opt/hdf5v1.10.0 cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DUSE_HDF5=ON
$ HDF5_ROOT=/opt/hdf5v1.10.0 cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_HDF5=ON
```
After compiling, the libraries and executables will be found at `bin` directory
```

14
cmk.sh
View File

@ -116,21 +116,21 @@ done
if [ $TEXTCLIENT -eq 0 ] && [ $RECEIVER -eq 0 ] && [ $GUI -eq 0 ]; then
# CMAKE_POST+=" -DUSE_TEXTCLIENT=ON -DUSE_RECEIVER=ON -DUSE_GUI=ON "
CMAKE_POST+=" -DUSE_TEXTCLIENT=ON -DUSE_RECEIVER=ON "
# CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON -DSLS_USE_RECEIVER=ON -DSLS_USE_GUI=ON "
CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON -DSLS_USE_RECEIVER=ON "
echo "Compile Option: TextClient, Receiver and GUI"
else
if [ $TEXTCLIENT -eq 1 ]; then
CMAKE_POST+=" -DUSE_TEXTCLIENT=ON "
CMAKE_POST+=" -DSLS_USE_TEXTCLIENT=ON "
echo "Compile Option: TextClient"
fi
if [ $RECEIVER -eq 1 ]; then
CMAKE_POST+=" -DUSE_RECEIVER=ON "
CMAKE_POST+=" -DSLS_USE_RECEIVER=ON "
echo "Compile Option: Receiver"
fi
if [ $GUI -eq 1 ]; then
CMAKE_POST+=" -DUSE_GUI=ON "
CMAKE_POST+=" -DSLS_USE_GUI=ON "
echo "Compile Option: GUI"
fi
fi
@ -162,10 +162,10 @@ fi
#hdf5 rebuild
if [ $HDF5 -eq 1 ]; then
CMAKE_PRE+="HDF5_ROOT="$HDF5DIR
CMAKE_POST+=" -DUSE_HDF5=ON "
CMAKE_POST+=" -DSLS_USE_HDF5=ON "
#normal mode rebuild
else
CMAKE_POST+=" -DUSE_HDF5=OFF "
CMAKE_POST+=" -DSLS_USE_HDF5=OFF "
fi

View File

@ -0,0 +1,57 @@
detsizechan 2560 1
hostname bchip074+bchip075+
0:extsig:0 trigger_in_rising_edge
0:rx_tcpport 1954
0:rx_udpport 50001
0:vhighvoltage 0
1:extsig:0 trigger_in_rising_edge
1:rx_tcpport 1955
1:rx_udpport 50002
1:vhighvoltage 0
##############################################################################
#########
######### Uncomment this part to use the gotthard25umZmq process
#########
##############################################################################
# #replace my_receiver_hostname with the hostname of IP of the machine where the receiver runs
#0:rx_zmqip my_receiver_hostname
#0:rx_zmqport 30003
# #replace my_client_hostname with the hostname of IP of the machine where the client/GUI or softIOC runs
#0:zmqip my_client_hostname
#0:zmqport 40003
# #replace my_receiver_hostname with the hostname of IP of the machine where the receiver runs
#1:rx_zmqip my_receiver_hostname
#1:rx_zmqport 30004
# #replace my_client_hostname with the hostname of IP of the machine where the client/GUI or softIOC runs
#1:zmqip my_client_hostname
#1:zmqport 40004
##############################################################################
#########
######### until here
#########
##############################################################################
r_readfreq 1
rx_datastream 1
#replace my_receiver_hostname with the hostname of 1Gb IP of the machine where the receiver runs
rx_hostname my_receiver_hostname
rx_datastream 1
outdir /tmp/
settings veryhighgain
exptime 0.000005
period 0.0001
vhighvoltage 90

View File

@ -0,0 +1,13 @@
Turn on the two receivers:
slsReceiver -t1954 &
slsReceiver -t1955 &
Switch on the photon conversion on the receiver machine (replace my_receiver_hostname):
gotthard25umZmq my_receiver_hostname 30003 my_receiver_hostname 40003 &
Run the configuration file:
sls_detector_put config bchip2modules.config
Start your measurements using the command line, the slsDetectorGui or the EPICS driver

View File

@ -0,0 +1,491 @@
hostname bchip085+
patword 0000 0000000000000000
patword 0001 0000000000000000
patword 0002 0008000900080000
patword 0003 0008000900080000
patword 0004 0008000900080000
patword 0005 0008000900080000
patword 0006 0008000900080000
patword 0007 0008000900080000
patword 0008 0008000900080000
patword 0009 0008000900080000
patword 000a 0008000900080000
patword 000b 0008000900080000
patword 000c 0008000900080000
patword 000d 0008000900080000
patword 000e 0008000900080000
patword 000f 0008000900080000
patword 0010 0008000900080000
patword 0011 0008000900080000
patword 0012 0008000900080000
patword 0013 0008000900080000
patword 0014 0008000900080000
patword 0015 0008000900080000
patword 0016 0008400900080020
patword 0017 0008400900080020
patword 0018 0008599f0418503a
patword 0019 0008599f0418503a
patword 001a 0108599f0418503a
patword 001b 0108599f0418503a
patword 001c 0108599f0418503a
patword 001d 0108599f0418503a
patword 001e 0108599f0418503a
patword 001f 0108599f0418503a
patword 0020 0108599f0418503a
patword 0021 0108599f0418503a
patword 0022 0108599f0418503a
patword 0023 0108599f0418503a
patword 0024 0108599f0418503a
patword 0025 0108599f0418503a
patword 0026 0108599f0418503a
patword 0027 0108599f0418503a
patword 0028 0108599f0418503a
patword 0029 0108599f0418503a
patword 002a 0108599f0418503a
patword 002b 0108599f0418503a
patword 002c 0108599f0418503a
patword 002d 0108599f0418503a
patword 002e 0108599f0418503a
patword 002f 0108599f0418503a
patword 0030 0108599f0418503a
patword 0031 0108599f0418503a
patword 0032 0108599f0418503a
patword 0033 0108599f0418503a
patword 0034 0108599f0418503a
patword 0035 0108599f0418503a
patword 0036 0108599f0418503a
patword 0037 0108599f0418503a
patword 0038 0108599f0418503a
patword 0039 0108599f0418503a
patword 003a 0108599f0418503a
patword 003b 0108599f0418503a
patword 003c 0108599f0418503a
patword 003d 0108599f0418503a
patword 003e 0108599f0418503a
patword 003f 0108599f0418503a
patword 0040 0108599f0418503a
patword 0041 0108599f0418503a
patword 0042 0108599f0418503a
patword 0043 0108599f0418503a
patword 0044 0108599f0418503a
patword 0045 0108599f0418503a
patword 0046 0108599f0418503a
patword 0047 0108599f0418503a
patword 0048 0108599f0418503a
patword 0049 0108599f0418503a
patword 004a 0108599f0418503a
patword 004b 0108599f0418503a
patword 004c 0108599f0418503a
patword 004d 0108599f0418503a
patword 004e 0108599f0418503a
patword 004f 0108599f0418503a
patword 0050 0108599f0418503a
patword 0051 0108599f0418503a
patword 0052 0108599f0418503a
patword 0053 0108599f0418503a
patword 0054 0108599f0418503a
patword 0055 0108599f0418503a
patword 0056 0108599f0418503a
patword 0057 0108599f0418503a
patword 0058 0108599f0418503a
patword 0059 0108599f0418503a
patword 005a 0108599f0418503a
patword 005b 0108599f0418503a
patword 005c 0108599f0418503a
patword 005d 0108599f0418503a
patword 005e 0108599f0418503a
patword 005f 0108599f0418503a
patword 0060 0108599f0418503a
patword 0061 0108599f0418503a
patword 0062 0108599f0418503a
patword 0063 0108599f0418503a
patword 0064 0108599f0418503a
patword 0065 0108599f0418503a
patword 0066 0108599f0418503a
patword 0067 0108599f0418503a
patword 0068 0108599f0418503a
patword 0069 0108599f0418503a
patword 006a 0108599f0418503a
patword 006b 0108599f0418503a
patword 006c 0108599f0418503a
patword 006d 0108599f0418503a
patword 006e 0108599f0418503a
patword 006f 0108599f0418503a
patword 0070 0108599f0418503a
patword 0071 0108599f0418503a
patword 0072 0108599f0418503a
patword 0073 0108599f0418503a
patword 0074 0108599f0418503a
patword 0075 0108599f0418503a
patword 0076 0108599f0418503a
patword 0077 0108599f0418503a
patword 0078 0108599f0418503a
patword 0079 0108599f0418503a
patword 007a 0108599f0418503a
patword 007b 0108599f0418503a
patword 007c 0108599f0418503a
patword 007d 0108599f0418503a
patword 007e 010859960418503a
patword 007f 010859960418503a
patword 0080 010859960418503a
patword 0081 010859960418503a
patword 0082 010859960418503a
patword 0083 010859960418503a
patword 0084 010859960418503a
patword 0085 010859960418503a
patword 0086 010859960418503a
patword 0087 010859960418503a
patword 0088 010859960418503a
patword 0089 010859960418503a
patword 008a 010859960418503a
patword 008b 010859960418503a
patword 008c 010859960418503a
patword 008d 010859960418503a
patword 008e 010859960418503a
patword 008f 010859960418503a
patword 0090 010859960418503a
patword 0091 010859960418503a
patword 0092 010819960418501a
patword 0093 010819960418501a
patword 0094 010819960418501a
patword 0095 010819960418501a
patword 0096 030819960418501a
patword 0097 030819960418501a
patword 0098 030819960418501a
patword 0099 030819960418501a
patword 009a 030819960418501a
patword 009b 030819960418501a
patword 009c 030819960418501a
patword 009d 030819960418501a
patword 009e 030819960418501a
patword 009f 030819960418501a
patword 00a0 030819960418501a
patword 00a1 030819960418501a
patword 00a2 030819960418501a
patword 00a3 030819960418501a
patword 00a4 030819960418501a
patword 00a5 030819960418501a
patword 00a6 030819960418501a
patword 00a7 030819960418501a
patword 00a8 030819960418501a
patword 00a9 030819960418501a
patword 00aa 030819960418501a
patword 00ab 030819960418501a
patword 00ac 030819960008501a
patword 00ad 030819960008501a
patword 00ae 030819960008501a
patword 00af 030819960008501a
patword 00b0 030819960008501a
patword 00b1 030819960008501a
patword 00b2 030819960008501a
patword 00b3 030819960008501a
patword 00b4 030819960008501a
patword 00b5 030819960008501a
patword 00b6 030819960008501a
patword 00b7 030819960008501a
patword 00b8 030819960008501a
patword 00b9 030819960008501a
patword 00ba 030819960008501a
patword 00bb 030819960008501a
patword 00bc 030819960008501a
patword 00bd 030819960008501a
patword 00be 030819960008501a
patword 00bf 030819960008501a
patword 00c0 0308199f0008501a
patword 00c1 0308199f0008501a
patword 00c2 0308199f0008501a
patword 00c3 0308199f0008501a
patword 00c4 0308199f0008501a
patword 00c5 0308199f0008501a
patword 00c6 0308199f0008501a
patword 00c7 0308199f0008501a
patword 00c8 0308199f0008501a
patword 00c9 0308199f0008501a
patword 00ca 0308199f0008501a
patword 00cb 0308199f0008501a
patword 00cc 0308199f0008501a
patword 00cd 0308199f0008501a
patword 00ce 0308199f0008501a
patword 00cf 0308199f0008501a
patword 00d0 0308199f0008501a
patword 00d1 0308199f0008501a
patword 00d2 0308199f0008501a
patword 00d3 0308199f0008501a
patword 00d4 0308599f0008503a
patword 00d5 0308599f0008503a
patword 00d6 030c599f000850ba
patword 00d7 030c599f000850ba
patword 00d8 030c599f000850ba
patword 00d9 030c599f000850ba
patword 00da 030c599f000850ba
patword 00db 030c599f000850ba
patword 00dc 030c599f000850ba
patword 00dd 030c599f000850ba
patword 00de 030c599f000850ba
patword 00df 030c599f000850ba
patword 00e0 030c599f000850ba
patword 00e1 030c599f000850ba
patword 00e2 030c599f000850ba
patword 00e3 030c599f000850ba
patword 00e4 030c599f000850ba
patword 00e5 030c599f000850ba
patword 00e6 030c599f000850ba
patword 00e7 030c599f000850ba
patword 00e8 030c599f000850ba
patword 00e9 030c599f000850ba
patword 00ea 030c799f010858ba
patword 00eb 030c799f010858ba
patword 00ec 030c599f000850ba
patword 00ed 030c599f000850ba
patword 00ee 030c599f000850ba
patword 00ef 030c599f000850ba
patword 00f0 030c599f000850ba
patword 00f1 030c599f000850ba
patword 00f2 030c599f000850ba
patword 00f3 030c599f000850ba
patword 00f4 030c599f000850ba
patword 00f5 030c599f000850ba
patword 00f6 030c599f000850ba
patword 00f7 030c599f000850ba
patword 00f8 030c599f000850ba
patword 00f9 030c599f000850ba
patword 00fa 030c599f000850ba
patword 00fb 030c599f000850ba
patword 00fc 030c599f000850ba
patword 00fd 030c599f000850ba
patword 00fe 030c599f000850ba
patword 00ff 030c599f000850ba
patword 0100 030c599f000850ba
patword 0101 030c599f000850ba
patword 0102 030c599f400850ba
patword 0103 030c599f400850ba
patword 0104 030c599f600850ba
patword 0105 030c599f400850ba
patword 0106 030c599f400850ba
patword 0107 030c599f400850ba
patword 0108 870c599f682e50ba
patword 0109 870c599f482850ba
patword 010a 870c599f000e50ba
patword 010b 870c599f000850ba
patword 010c 870c599f000e50ba
patword 010d 870c599f000850ba
patword 010e 870c599f000e50ba
patword 010f 870c599f000850ba
patword 0110 870c599f000e50ba
patword 0111 870c599f000850ba
patword 0112 870c599f000e50ba
patword 0113 870c599f000850ba
patword 0114 870c599f000e50ba
patword 0115 870c599f000850ba
patword 0116 870c599f000e50ba
patword 0117 870c599f000850ba
patword 0118 870c599f000e50ba
patword 0119 870c599f000850ba
patword 011a 870c599f000e50ba
patword 011b 870c599f000850ba
patword 011c 870c599f000e50ba
patword 011d 870c599f000850ba
patword 011e 870c599f000e50ba
patword 011f 870c599f000850ba
patword 0120 870c599f000e50ba
patword 0121 870c599f000850ba
patword 0122 870c599f200e50ba
patword 0123 870c599f000850ba
patword 0124 870c599f000e50ba
patword 0125 870c599f000850ba
patword 0126 870c599f000e50ba
patword 0127 870c599f000850ba
patword 0128 870c599f000e50ba
patword 0129 870c599f000850ba
patword 012a 870c599f000e50ba
patword 012b 870c599f000850ba
patword 012c 870c599f000e50ba
patword 012d 870c599f000850ba
patword 012e 870c599f000e50ba
patword 012f 870c599f000850ba
patword 0130 870c599f000e50ba
patword 0131 870c599f000850ba
patword 0132 870c599f000e50ba
patword 0133 870c599f000850ba
patword 0134 870c599f000e50ba
patword 0135 870c599f000850ba
patword 0136 870c599f000e50ba
patword 0137 870c599f000850ba
patword 0138 870c599f000e50ba
patword 0139 870c599f000850ba
patword 013a 870c599f282e50ba
patword 013b 870c599f082850ba
patword 013c 870c599f000e50ba
patword 013d 870c599f000850ba
patword 013e 870c599f000e50ba
patword 013f 870c599f000850ba
patword 0140 870c599f000e50ba
patword 0141 870c599f000850ba
patword 0142 870c599f000e50ba
patword 0143 870c599f000850ba
patword 0144 870c599f000e50ba
patword 0145 870c599f000850ba
patword 0146 870c599f000e50ba
patword 0147 870c599f000850ba
patword 0148 870c599f000e50ba
patword 0149 870c599f000850ba
patword 014a 870c599f000e50ba
patword 014b 870c599f000850ba
patword 014c 870c599f000e50ba
patword 014d 870c599f000850ba
patword 014e 870c599f000e50ba
patword 014f 870c599f000850ba
patword 0150 870c599f000e50ba
patword 0151 870c599f000850ba
patword 0152 870c599f000e50ba
patword 0153 870c599f000850ba
patword 0154 870c599f200e50ba
patword 0155 870c599f000850ba
patword 0156 870c599f000e50ba
patword 0157 870c599f000850ba
patword 0158 870c599f000e50ba
patword 0159 870c599f000850ba
patword 015a 870c599f000e50ba
patword 015b 870c599f000850ba
patword 015c 870c599f000e50ba
patword 015d 870c599f000850ba
patword 015e 870c599f000e50ba
patword 015f 870c599f000850ba
patword 0160 870c599f000e50ba
patword 0161 870c599f000850ba
patword 0162 870c599f000e50ba
patword 0163 870c599f000850ba
patword 0164 870c599f000e50ba
patword 0165 870c599f000850ba
patword 0166 870c599f000e50ba
patword 0167 870c599f000850ba
patword 0168 870c599f000e50ba
patword 0169 870c599f000850ba
patword 016a 870c599f000e50ba
patword 016b 870c599f000850ba
patword 016c 070c599f000850ba
patword 016d 070c599f000850ba
patword 016e 000c599f000850ba
patword 016f 000c599f000850ba
patword 0170 0008599f200e503a
patword 0171 0008599f0008503a
patword 0172 0008599f200e503a
patword 0173 0008599f0008503a
patword 0174 0008599f0008503a
patword 0175 0008599f0008503a
patword 0176 0008599f0008503a
patword 0177 0008599f0008503a
patword 0178 0008599f0008503a
patword 0179 0008599f0008503a
patword 017a 0008599f0008503a
patword 017b 0008599f0008503a
patword 017c 0008599f0008503a
patword 017d 0008599f0008503a
patword 017e 0008599f0008503a
patword 017f 0008599f0008503a
patword 0180 0008599f0008503a
patword 0181 0008599f0008503a
patword 0182 0008599f0008503a
patword 0183 0008599f0008503a
patword 0184 0008599f0008503a
patword 0185 0008599f0008503a
patword 0186 0008599f0008503a
patword 0187 0008599f0008503a
patword 0188 0008599f0008503a
patword 0189 0008599f0008503a
patword 018a 0008599f0008503a
patword 018b 0008599f0008503a
patword 018c 0008599f0008503a
patword 018d 0008599f0008503a
patioctrl 8f0effff6dbffdbf
patclkctrl 0000000000000000
patlimits 0000 018c
patloop0 013a 016b
patnloop0 199
patloop1 0400 0400
patnloop1 0
patloop2 0400 0400
patnloop2 0
patwait0 00aa
patwaittime0 40000
patwait1 0400
patwaittime1 0
patwait2 0400
patwaittime2 0
####mcp2011
#0:rx_udpip 10.1.1.102
#0:detectorip 10.1.1.19
#0:rx_udpport 32410
####gui listening to
#zmqip 129.129.202.131
#zmqport 30001
####data streaming out of
#rx_zmqip 10.1.2.103
#rx_zmqport 30003
#0:rx_hostname mpc2011
####mx-test-1
0:rx_udpip 10.1.1.100
0:detectorip 10.1.1.19
0:rx_udpport 32410
####gui listening to (on receiver pc)
zmqip 129.129.202.92
zmqport 30001
####data streaming out of
rx_zmqip 10.1.1.100
rx_zmqport 30003
0:rx_hostname pcmoench01
#turn on datastream from commandline
rx_datastream 1
r_readfreq 1
#0:configuremac -1
rx_datastream 1
r_readfreq 1
dac:6 800
dac:0 1300
dac:4 1428
dac:1 1000
dac:7 900
dac:3 680
dac:2 1400
dac:5 1200
adcinvert 4a342593
samples 5000
adcphase 90
adcpipeline 15
adcreg 14 40
powerchip 1
vhighvoltage 90
period 0.005
frames 100
period 0.1
outdir /scratch/
enablefwrite 0

View File

@ -1,5 +1,5 @@
PKGDIR = ../..
LIBDIR = $(PKGDIR)/build/bin
LIBDIR = $(PKGDIR)/bin
INCLUDES = -I . -I$(PKGDIR)/slsSupportLib/include -I$(LIBDIR) -I$(PKGDIR)/slsDetectorSoftware/slsDetector -I$(PKGDIR)/slsReceiversoftware/include
SRC_DET = mainClient.cpp
SRC_REC = mainReceiver.cpp

View File

@ -64,6 +64,8 @@ The directory contains some executables that are needed to make your detector to
\begin{verbatim}
./on #to switch modules on
./off #to switch modules off
./state #tells you if is ON or OFF
cat /var/log/pcu.log #displays the log if there are problem
./hvget #gets the current HV value
./waterflow #returns the current waterflow returned by the flowmeter
./temp #returns the water temperature returned by the flowmeter

View File

@ -369,7 +369,7 @@ source directory.
$ cd ..
$ mkdir slsDetectorPackage-build
$ cd slsDetectorPackage-build
$ cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DUSE_HDF5=OFF
$ cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_HDF5=OFF
$ make
\end{verbatim}

View File

@ -4,11 +4,11 @@ cd build
cmake .. \
-DCMAKE_PREFIX_PATH=$CONDA_PREFIX \
-DCMAKE_INSTALL_PREFIX=install \
-DUSE_TEXTCLIENT=ON \
-DUSE_RECEIVER=ON \
-DUSE_GUI=OFF \
-DSLS_USE_TEXTCLIENT=ON \
-DSLS_USE_RECEIVER=ON \
-DSLS_USE_GUI=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DUSE_HDF5=OFF\
-DSLS_USE_HDF5=OFF\
cmake --build . -- -j10

View File

@ -2118,8 +2118,8 @@ void readSample() {
// keep reading till the value is the same
while (*((uint16_t*)now_ptr) != bus_r16(fifoAddr)) {
FILE_LOG(logDEBUG1, ("%d ", ich));
*((uint16_t*)now_ptr) = bus_r16(fifoAddr);
FILE_LOG(logDEBUG1, (""))
}
// increment pointer to data out destination

View File

@ -1978,7 +1978,7 @@ int64_t Feb_Control_GetMeasuredPeriod() {
unsigned int value = 0;
Feb_Interface_ReadRegister(sub_num,MEAS_PERIOD_REG, &value);
return value*10;
return (int64_t)value*10;
}
int64_t Feb_Control_GetSubMeasuredPeriod() {
@ -1988,7 +1988,7 @@ int64_t Feb_Control_GetSubMeasuredPeriod() {
unsigned int value = 0;
Feb_Interface_ReadRegister(sub_num,MEAS_SUBPERIOD_REG, &value);
return value*10;
return (int64_t)value*10;
}
@ -2022,14 +2022,22 @@ uint32_t Feb_Control_WriteRegister(uint32_t offset, uint32_t data) {
uint32_t value=0;
if (Module_TopAddressIsValid(&modules[1])) {
if (!Feb_Interface_WriteRegister(Module_GetTopRightAddress (&modules[1]),offset, data,0, 0)) {
FILE_LOG(logERROR, ("Could not read value. Value read:%d\n", value));
FILE_LOG(logERROR, ("Could not read tr value. Value read:%d\n", value));
value = 0;
}
if(!Feb_Interface_WriteRegister(Module_GetTopLeftAddress (&modules[1]),offset, data,0, 0)) {
cprintf(RED,"Could not read tl value. Value read:%d\n", value);
value = 0;
}
} else {
if (!Feb_Interface_WriteRegister(Module_GetBottomRightAddress (&modules[1]),offset, data,0, 0)) {
FILE_LOG(logERROR, ("Could not read value. Value read:%d\n", value));
FILE_LOG(logERROR, ("Could not read br value. Value read:%d\n", value));
value = 0;
}
if(!Feb_Interface_WriteRegister(Module_GetBottomLeftAddress (&modules[1]),offset, data,0, 0)) {
cprintf(RED,"Could not read bl value. Value read:%d\n", value);
value = 0;
}
}
return Feb_Control_ReadRegister(offset);
}
@ -2037,16 +2045,33 @@ uint32_t Feb_Control_WriteRegister(uint32_t offset, uint32_t data) {
uint32_t Feb_Control_ReadRegister(uint32_t offset) {
uint32_t value=0;
uint32_t value1=0;
if (Module_TopAddressIsValid(&modules[1])) {
if (!Feb_Interface_ReadRegister(Module_GetTopRightAddress (&modules[1]),offset, &value)) {
FILE_LOG(logERROR, ("Could not read value. Value read:%d\n", value));
value = 0;
}
printf("Read top right addr: 0x%08x\n", value);
if(!Feb_Interface_ReadRegister(Module_GetTopLeftAddress (&modules[1]),offset, &value1)) {
cprintf(RED,"Could not read value. Value read:%d\n", value1);
value1 = 0;
}
printf("Read top left addr: 0x%08x\n", value1);
if (value != value1)
value = -1;
} else {
if (!Feb_Interface_ReadRegister(Module_GetBottomRightAddress (&modules[1]),offset, &value)) {
FILE_LOG(logERROR, ("Could not read value. Value read:%d\n", value));
value = 0;
}
printf("Read bottom right addr: 0x%08x\n", value);
if(!Feb_Interface_ReadRegister(Module_GetBottomLeftAddress (&modules[1]),offset, &value1)) {
cprintf(RED,"Could not read value. Value read:%d\n", value1);
value1 = 0;
}
printf("Read bottom left addr: 0x%08x\n", value1);
if (value != value1)
value = -1;
}
return value;
}

View File

@ -61,7 +61,7 @@
#define DAQ_TKN_TMNG_OFST (0)
#define DAQ_TKN_TMNG_MSK (0x0000FFFF << DAQ_TKN_TMNG_OFST)
#define DAQ_TKN_TMNG_BRD_RVSN_1_VAL ((0x1f16 << DAQ_TKN_TMNG_OFST) & DAQ_TKN_TMNG_MSK)
#define DAQ_TKN_TMNG_BRD_RVSN_2_VAL ((0x1f0f << DAQ_TKN_TMNG_OFST) & DAQ_TKN_TMNG_MSK)
#define DAQ_TKN_TMNG_BRD_RVSN_2_VAL ((0x1f10 << DAQ_TKN_TMNG_OFST) & DAQ_TKN_TMNG_MSK)
#define DAQ_PCKT_LNGTH_OFST (16)
#define DAQ_PCKT_LNGTH_MSK (0x0000FFFF << DAQ_PCKT_LNGTH_OFST)
#define DAQ_PCKT_LNGTH_NO_ROI_VAL ((0x0013f << DAQ_PCKT_LNGTH_OFST) & DAQ_PCKT_LNGTH_MSK)

View File

@ -1480,6 +1480,64 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
usleep(1000 * 1000);
FILE_LOG(logDEBUG1, ("\tConfigure Mac Done\n"));
{
/** send out first image as first packet does not give 0xcacacaca (needed to know if first image
* when switching back and forth between roi and no roi
*/
FILE_LOG(logINFOBLUE, ("Sending an image to counter the packet numbers\n"));
// remember old parameters
enum externalCommunicationMode oldtiming = getTiming();
uint64_t oldframes = setTimer(FRAME_NUMBER, -1);
uint64_t oldcycles = setTimer(CYCLES_NUMBER, -1);
uint64_t oldPeriod = setTimer(FRAME_PERIOD, -1);
uint64_t oldExptime = setTimer(ACQUISITION_TIME, -1);
// set to basic parameters
FILE_LOG(logINFO, ("\tSetting basic parameters\n"
"\tTiming: auto\n"
"\tframes: 1\n"
"\tcycles: 1\n"
"\tperiod: 1s\n"
"\texptime: 900ms\n"));
setTiming(AUTO_TIMING);
setTimer(FRAME_NUMBER, 1);
setTimer(CYCLES_NUMBER, 1);
setTimer(FRAME_PERIOD, 1e9); // important to keep this until we have to wait for acquisition to start
setTimer(ACQUISITION_TIME, 900 * 1000);
// take an image
if (masterflags == IS_MASTER)
usleep(1 * 1000 * 1000); // required to ensure master starts acquisition only after slave has changed to basic parameters and is waiting
int loop = 0;
startStateMachine();
// wait for acquisition to start (trigger from master)
FILE_LOG(logINFO, ("\tWaiting for acquisition to start\n"));
while(!runBusy()) {
usleep(0);
++loop;
}
FILE_LOG(logINFO, ("\twaited %d loops to start\n", loop));
FILE_LOG(logINFO, ("\tWaiting for acquisition to end (frames left: %lld)\n", (long long int)getTimeLeft(FRAME_NUMBER)));
waitForAcquisitionFinish();
// set to previous parameters
FILE_LOG(logINFO, ("\tSetting previous parameters:\n"
"\tTiming: %d\n"
"\tframes: %lld\n"
"\tcycles: %lld\n"
"\tperiod: %lld ns\n"
"\texptime:%lld ns\n",
(int)oldtiming, (long long int)oldframes, (long long int)oldcycles,
(long long int)oldPeriod, (long long int)oldExptime));
setTiming(oldtiming);
setTimer(FRAME_NUMBER, oldframes);
setTimer(CYCLES_NUMBER, oldcycles);
setTimer(FRAME_PERIOD, oldPeriod);
setTimer(ACQUISITION_TIME, oldExptime);
FILE_LOG(logINFOBLUE, ("Done sending a frame at configuration\n"));
}
return OK;
}
@ -1604,6 +1662,7 @@ int startStateMachine(){
return OK;
#endif
FILE_LOG(logINFOBLUE, ("Starting State Machine\n"));
FILE_LOG(logINFO, ("#frames to acquire:%lld\n", (long long int)setTimer(FRAME_NUMBER, -1)));
cleanFifos();

View File

@ -1359,6 +1359,7 @@ int start_acquisition(int file_des) {
FILE_LOG(logDEBUG1, ("Starting Acquisition\n"));
// only set
if (Server_VerifyLock() == OK) {
nframes = 0;
ret = startStateMachine();
if (ret == FAIL) {
sprintf(mess, "Could not start acquisition\n");
@ -1443,6 +1444,7 @@ int start_and_read_all(int file_des) {
FILE_LOG(logDEBUG1, ("Stopping Acquisition\n"));
// only set
if (Server_VerifyLock() == OK) {
nframes = 0;
ret = startStateMachine();
if (ret == FAIL) {
sprintf(mess, "Could not start acquisition\n");
@ -1473,7 +1475,6 @@ int read_all(int file_des) {
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
// read from fifo enabled
if (!sendUDP(-1)) {
nframes = 0;
// keep reading frames
while(readFrameFromFifo() == OK) {

View File

@ -56,6 +56,7 @@ endif()
install(TARGETS slsDetectorShared
EXPORT "${TARGETS_EXPORT_NAME}"
LIBRARY DESTINATION lib
PUBLIC_HEADER DESTINATION include
ARCHIVE DESTINATION lib

View File

@ -668,7 +668,9 @@ void multiSlsDetector::updateOffsets() {
numY += detectors[idet]->getTotalNumberOfChannels(Y);
numY_gp +=
detectors[idet]->getTotalNumberOfChannelsInclGapPixels(Y);
++thisMultiDetector->numberOfDetector[Y];
// increment in y again only in the first column (else you double increment)
if (thisMultiDetector->numberOfDetector[X] == 1)
++thisMultiDetector->numberOfDetector[Y];
FILE_LOG(logDEBUG1) << "incrementing in y direction";
}
@ -2121,77 +2123,89 @@ int multiSlsDetector::setROI(int n, ROI roiLimits[], int detPos) {
ymin = roiLimits[i].ymin;
ymax = roiLimits[i].ymax;
// check roi max values
idet = decodeNChannel(xmax, ymax, channelX, channelY);
FILE_LOG(logDEBUG1) << "Decoded Channel max vals: " << std::endl
<< "det:" << idet << "\t" << xmax << "\t" << ymax << "\t" << channelX << "\t" << channelY;
if (idet == -1) {
FILE_LOG(logERROR) << "invalid roi";
continue;
}
if (getDetectorsType() != JUNGFRAUCTB || getNumberOfDetectors() > 1) {
// check roi max values
idet = decodeNChannel(xmax, ymax, channelX, channelY);
FILE_LOG(logDEBUG1) << "Decoded Channel max vals: " << std::endl
<< "det:" << idet << "\t" << xmax << "\t" << ymax << "\t" << channelX << "\t" << channelY;
if (idet == -1) {
FILE_LOG(logERROR) << "invalid roi";
continue;
}
// split in x dir
while (xmin <= xmax) {
invalidroi = false;
ymin = roiLimits[i].ymin;
// split in y dir
while (ymin <= ymax) {
// get offset for each detector
idet = decodeNChannel(xmin, ymin, channelX, channelY);
FILE_LOG(logDEBUG1) << "Decoded Channel min vals: " << std::endl
<< "det:" << idet << "\t" << xmin << "\t" << ymin << "\t" << channelX << "\t" << channelY;
if (idet < 0 || idet >= (int)detectors.size()) {
FILE_LOG(logDEBUG1) << "invalid roi";
invalidroi = true;
// split in x dir
while (xmin <= xmax) {
invalidroi = false;
ymin = roiLimits[i].ymin;
// split in y dir
while (ymin <= ymax) {
// get offset for each detector
idet = decodeNChannel(xmin, ymin, channelX, channelY);
FILE_LOG(logDEBUG1) << "Decoded Channel min vals: " << std::endl
<< "det:" << idet << "\t" << xmin << "\t" << ymin << "\t" << channelX << "\t" << channelY;
if (idet < 0 || idet >= (int)detectors.size()) {
FILE_LOG(logDEBUG1) << "invalid roi";
invalidroi = true;
break;
}
// get last channel for each det in x and y dir
lastChannelX =
(detectors[idet]->getTotalNumberOfChannelsInclGapPixels(
X)) -
1;
lastChannelY =
(detectors[idet]->getTotalNumberOfChannelsInclGapPixels(
Y)) -
1;
offsetX = detectors[idet]->getDetectorOffset(X);
offsetY = detectors[idet]->getDetectorOffset(Y);
// at the end in x dir
if ((offsetX + lastChannelX) >= xmax) {
lastChannelX = xmax - offsetX;
}
// at the end in y dir
if ((offsetY + lastChannelY) >= ymax) {
lastChannelY = ymax - offsetY;
}
FILE_LOG(logDEBUG1) << "lastChannelX:" << lastChannelX << "\t"
<< "lastChannelY:" << lastChannelY;
// creating the list of roi for corresponding detector
index = nroi[idet];
allroi[idet][index].xmin = channelX;
allroi[idet][index].xmax = lastChannelX;
allroi[idet][index].ymin = channelY;
allroi[idet][index].ymax = lastChannelY;
nroi[idet] = nroi[idet] + 1;
ymin = lastChannelY + offsetY + 1;
if ((lastChannelY + offsetY) == ymax) {
ymin = ymax + 1;
}
FILE_LOG(logDEBUG1) << "nroi[idet]:" << nroi[idet] << "\tymin:" << ymin;
}
if (invalidroi) {
break;
}
// get last channel for each det in x and y dir
lastChannelX =
(detectors[idet]->getTotalNumberOfChannelsInclGapPixels(
X)) -
1;
lastChannelY =
(detectors[idet]->getTotalNumberOfChannelsInclGapPixels(
Y)) -
1;
offsetX = detectors[idet]->getDetectorOffset(X);
offsetY = detectors[idet]->getDetectorOffset(Y);
// at the end in x dir
if ((offsetX + lastChannelX) >= xmax) {
lastChannelX = xmax - offsetX;
xmin = lastChannelX + offsetX + 1;
if ((lastChannelX + offsetX) == xmax) {
xmin = xmax + 1;
}
// at the end in y dir
if ((offsetY + lastChannelY) >= ymax) {
lastChannelY = ymax - offsetY;
}
FILE_LOG(logDEBUG1) << "lastChannelX:" << lastChannelX << "\t"
<< "lastChannelY:" << lastChannelY;
// creating the list of roi for corresponding detector
index = nroi[idet];
allroi[idet][index].xmin = channelX;
allroi[idet][index].xmax = lastChannelX;
allroi[idet][index].ymin = channelY;
allroi[idet][index].ymax = lastChannelY;
nroi[idet] = nroi[idet] + 1;
ymin = lastChannelY + offsetY + 1;
if ((lastChannelY + offsetY) == ymax) {
ymin = ymax + 1;
}
FILE_LOG(logDEBUG1) << "nroi[idet]:" << nroi[idet] << "\tymin:" << ymin;
}
if (invalidroi) {
break;
}
} else {// FIXME: check if xmax is greater? or reduce logic above?
idet=0;
nroi[idet]=n;
index = 0;
allroi[idet][index].xmin = xmin;
allroi[idet][index].xmax = xmax;
allroi[idet][index].ymin = ymin;
allroi[idet][index].ymax = ymax;
// nroi[idet] = nroi[idet] + 1;
xmin = lastChannelX + offsetX + 1;
if ((lastChannelX + offsetX) == xmax) {
xmin = xmax + 1;
}
}
}

View File

@ -2753,7 +2753,11 @@ int slsDetector::setUDPConnection() {
setReceiverOnline(OFFLINE_FLAG); //FIXME: Needed??
}
}
} else {
ret=FAIL;
setErrorMask((getErrorMask())|(COULD_NOT_CONFIGURE_MAC));
}
printReceiverConfiguration(logDEBUG1);
return ret;
}
@ -2926,6 +2930,8 @@ int slsDetector::setROI(int n, ROI roiLimits[]) {
}
int ret = sendROI(n, roiLimits);
if(ret==FAIL)
setErrorMask((getErrorMask())|(COULDNOT_SET_ROI));
if (thisDetector->myDetectorType == CHIPTESTBOARD) {
getTotalNumberOfChannels();
}
@ -2996,7 +3002,7 @@ int slsDetector::sendROI(int n, ROI roiLimits[]) {
ret = updateDetector();
}
// old firmware requires configuremac after setting roi
if (thisDetector->myDetectorType == GOTTHARD) {
if (thisDetector->myDetectorType == GOTTHARD && n != -1) {
ret = configureMAC();
}

View File

@ -3226,7 +3226,9 @@ std::string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int acti
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
ret = myDet->setDynamicRange(val, detPos);
} else if (cmd == "roi") {
myDet->getROI(ret, detPos);
ROI* r = myDet->getROI(ret, detPos);
if (r != NULL)
delete [] r;
} else if (cmd == "detsizechan") {
sprintf(ans, "%d %d", myDet->getMaxNumberOfChannelsPerDetector(X), myDet->getMaxNumberOfChannelsPerDetector(Y));
return std::string(ans);
@ -5341,7 +5343,8 @@ std::string slsDetectorCommand::cmdPattern(int narg, char *args[], int action, i
}
}
os << std::hex << reg << std::dec ;
if (aa != NULL)
delete [] aa;
//os <<" "<< std::hex << myDet->readRegister(120, detPos) << std::dec ;
}

View File

@ -1,7 +1,7 @@
#include "slsDetectorUsers.h"
#include "detectorData.h"
#include "multiSlsDetector.h"
#include "multiSlsDetectorClient.h"
@ -57,7 +57,7 @@ int slsDetectorUsers::dumpDetectorSetup(const std::string& fname){
}
int64_t slsDetectorUsers::getDetectorFirmwareVersion(int detPos){
return detector.getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION);
return detector.getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION, detPos);
}
int64_t slsDetectorUsers::getDetectorSerialNumber(int detPos){
@ -234,6 +234,13 @@ int slsDetectorUsers::setFlowControl10G(int i, int detPos) {
return detector.setFlowControl10G(i, detPos);
}
int slsDetectorUsers::setROI(int n, slsDetectorDefs::ROI roiLimits[], int detPos) {
return myDetector->setROI(n, roiLimits, detPos);
}
slsDetectorDefs::ROI* slsDetectorUsers::getROI(int &n, int detPos) {
return myDetector->getROI(n, detPos);
}
/************************************************************************

View File

@ -14,9 +14,8 @@
class detectorData;
class multiSlsDetector;
#include "multiSlsDetector.h"
#include <cstdint>
#include <string>
@ -530,6 +529,24 @@ public:
*/
int setFlowControl10G(int enable = -1, int detPos = -1);
/**
* Set ROI (Gotthard) (>= 1 roi, but max 1 roi per module)
* At the moment only one set allowed
* @param n number of rois
* @param roiLimits array of roi
* @param detPos -1 for all detectors in list or specific detector position
* @returns OK or FAIL
*/
int setROI(int n=-1, slsDetectorDefs::ROI roiLimits[]=NULL, int detPos = -1);
/**
* Get ROI from each detector and convert it to the multi detector scale (Gotthard)
* >= 1 roi, but max 1 roi per module
* @param n number of rois
* @param detPos -1 for all detectors in list or specific detector position
* @returns pointer to array of ROI structure
*/
slsDetectorDefs::ROI* getROI(int &n, int detPos = -1);
@ -825,6 +842,7 @@ public:
case 3: return std::string("finished"); \
case 4: return std::string("data"); \
case 5: return std::string("running"); \
case 6: return std::string("stopped"); \
default: return std::string("unknown"); \
}};

View File

@ -14,7 +14,7 @@ set(SOURCES
# HDF5
if (USE_HDF5)
if (SLS_USE_HDF5)
if (HDF5_FOUND)
include_directories(
${HDF5_INCLUDE_DIRS}
@ -26,7 +26,7 @@ if (USE_HDF5)
src/HDF5File.cpp
)
endif ()
endif (USE_HDF5)
endif (SLS_USE_HDF5)
# include_directories(
@ -75,6 +75,7 @@ endif ()
install(TARGETS slsReceiverShared slsReceiver
EXPORT "${TARGETS_EXPORT_NAME}"
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib

View File

@ -188,7 +188,6 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
/** additional json header */
char* additionJsonHeader;
/** Aquisition Started flag */
bool acquisitionStartedFlag;

View File

@ -120,32 +120,18 @@ public:
/** Destructor */
virtual ~GeneralData(){};
/**
* Get Header Infomation (frame number, packet number)
* @param index thread index for debugging purposes
* @param packetData pointer to data
* @param frameNumber frame number
* @param packetNumber packet number
*/
virtual void GetHeaderInfo(int index, char* packetData, uint64_t& frameNumber, uint32_t& packetNumber) const
{
frameNumber = ((uint32_t)(*((uint32_t*)(packetData))));
frameNumber++;
packetNumber = frameNumber&packetIndexMask;
frameNumber = (frameNumber & frameIndexMask) >> frameIndexOffset;
}
/**
* Get Header Infomation (frame number, packet number)
* @param index thread index for debugging purposes
* @param packetData pointer to data
* @param dynamicRange dynamic range to assign subframenumber if 32 bit mode
* @param oddStartingPacket odd starting packet (gotthard)
* @param frameNumber frame number
* @param packetNumber packet number
* @param subFrameNumber sub frame number if applicable
* @param bunchId bunch id
*/
virtual void GetHeaderInfo(int index, char* packetData, uint32_t dynamicRange,
virtual void GetHeaderInfo(int index, char* packetData, uint32_t dynamicRange, bool oddStartingPacket,
uint64_t& frameNumber, uint32_t& packetNumber, uint32_t& subFrameNumber, uint64_t& bunchId) const
{
subFrameNumber = -1;
@ -170,7 +156,7 @@ public:
* @param i pointer to a vector of ROI pointers
* @returns adc configured
*/
virtual const int GetAdcConfigured(int index, std::vector<slsDetectorDefs::ROI>* i) const{
virtual int GetAdcConfigured(int index, std::vector<slsDetectorDefs::ROI>* i) const{
FILE_LOG(logERROR) << "This is a generic function that should be overloaded by a derived class";
return 0;
};
@ -210,6 +196,16 @@ public:
FILE_LOG(logERROR) << "This is a generic function that should be overloaded by a derived class";
};
/**
* Set odd starting packet (gotthard)
* @param index thread index for debugging purposes
* @param packetData pointer to data
* @returns true or false for odd starting packet number
*/
virtual bool SetOddStartingPacket(int index, char* packetData) {
cprintf(RED,"This is a generic function that should be overloaded by a derived class\n");
return false;
};
/**
* Print all variables
@ -270,44 +266,26 @@ private:
};
/**
* Get Header Infomation (frame number, packet number)
* @param index thread index for debugging purposes
* @param packetData pointer to data
* @param frameNumber frame number
* @param packetNumber packet number
*/
virtual void GetHeaderInfo(int index, char* packetData, uint64_t& frameNumber, uint32_t& packetNumber) const
{
if (nPixelsX == 1280) {
frameNumber = ((uint32_t)(*((uint32_t*)(packetData))));
frameNumber++;
packetNumber = frameNumber&packetIndexMask;
frameNumber = (frameNumber & frameIndexMask) >> frameIndexOffset;
} else {
frameNumber = ((uint32_t)(*((uint32_t*)(packetData))));
packetNumber = 0;
}
}
/**
* Get Header Infomation (frame number, packet number)
* @param index thread index for debugging purposes
* @param packetData pointer to data
* @param dynamicRange dynamic range to assign subframenumber if 32 bit mode
* @param oddStartingPacket odd starting packet (gotthard)
* @param frameNumber frame number
* @param packetNumber packet number
* @param subFrameNumber sub frame number if applicable
* @param bunchId bunch id
*/
virtual void GetHeaderInfo(int index, char* packetData, uint32_t dynamicRange,
void GetHeaderInfo(int index, char* packetData, uint32_t dynamicRange, bool oddStartingPacket,
uint64_t& frameNumber, uint32_t& packetNumber, uint32_t& subFrameNumber, uint64_t& bunchId) const
{
if (nPixelsX == 1280) {
subFrameNumber = -1;
bunchId = -1;
frameNumber = ((uint32_t)(*((uint32_t*)(packetData))));
frameNumber++;
if (oddStartingPacket)
frameNumber++;
packetNumber = frameNumber&packetIndexMask;
frameNumber = (frameNumber & frameIndexMask) >> frameIndexOffset;
} else {
@ -323,7 +301,7 @@ private:
* Set ROI
* @param i ROI
*/
virtual void SetROI(std::vector<slsDetectorDefs::ROI> i) {
void SetROI(std::vector<slsDetectorDefs::ROI> i) {
// all adcs
if(!i.size()) {
nPixelsX = 1280;
@ -367,7 +345,7 @@ private:
* @param i pointer to a vector of ROI
* @returns adc configured
*/
virtual const int GetAdcConfigured(int index, std::vector<slsDetectorDefs::ROI>* i) const{
int GetAdcConfigured(int index, std::vector<slsDetectorDefs::ROI>* i) const{
int adc = -1;
// single adc
if(i->size()) {
@ -392,6 +370,39 @@ private:
return adc;
};
/**
* Set odd starting packet (gotthard)
* @param index thread index for debugging purposes
* @param packetData pointer to data
* @returns true or false for odd starting packet number
*/
bool SetOddStartingPacket(int index, char* packetData) {
bool oddStartingPacket = true;
// care only if no roi
if (nPixelsX == 1280) {
uint32_t fnum = ((uint32_t)(*((uint32_t*)(packetData))));
uint32_t firstData = ((uint32_t)(*((uint32_t*)(packetData + 4))));
// first packet
if (firstData == 0xCACACACA) {
// packet number should be 0, but is 1 => so odd starting packet
if (fnum & packetIndexMask) {
oddStartingPacket = true;
} else {
oddStartingPacket = false;
}
}
// second packet
else {
// packet number should be 1, but is 0 => so odd starting packet
if (!(fnum & packetIndexMask)) {
oddStartingPacket = true;
} else {
oddStartingPacket = false;
}
}
}
return oddStartingPacket;
};
};
@ -435,29 +446,17 @@ private:
defaultFifoDepth = 2500;
};
/**
* Get Header Infomation (frame number, packet number)
* @param index thread index for debugging purposes
* @param packetData pointer to data
* @param frameNumber frame number
* @param packetNumber packet number
*/
virtual void GetHeaderInfo(int index, char* packetData, uint64_t& frameNumber, uint32_t& packetNumber) const {
jfrauctb_packet_header_t* header = (jfrauctb_packet_header_t*)(packetData);
frameNumber = (uint64_t)((*( (uint32_t*) header->frameNumber)) & frameIndexMask);
packetNumber = (uint32_t)(*( (uint8_t*) header->packetNumber));
}
/**
* Get Header Infomation (frame number, packet number)
* @param index thread index for debugging purposes
* @param packetData pointer to data
* @param dynamicRange dynamic range to assign subframenumber if 32 bit mode
* @param oddStartingPacket odd starting packet (gotthard)
* @param frameNumber frame number * @param packetNumber packet number
* @param subFrameNumber sub frame number if applicable
* @param bunchId bunch id
*/
void GetHeaderInfo(int index, char* packetData, uint32_t dynamicRange,
void GetHeaderInfo(int index, char* packetData, uint32_t dynamicRange, bool oddStartingPacket,
uint64_t& frameNumber, uint32_t& packetNumber, uint32_t& subFrameNumber, uint64_t& bunchId) const {
subFrameNumber = -1;
jfrauctb_packet_header_t* header = (jfrauctb_packet_header_t*)(packetData);

View File

@ -202,7 +202,7 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
bool runningFlag;
/** GeneralData (Detector Data) object */
const GeneralData* generalData;
GeneralData* generalData;
/** Fifo structure */
Fifo* fifo;
@ -311,5 +311,11 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
/** number of images for statistic */
uint32_t numFramesStatistic;
/**
* starting packet number is odd or evern, accordingly increment frame number
* to get first packet number as 0
* (pecific to gotthard, can vary between modules, hence defined here) */
bool oddStartingPacket;
};

View File

@ -344,10 +344,12 @@ void DataProcessor::ProcessAnImage(char* buf) {
*dynamicRange);
// deactivated and padding enabled
if ((!(*activated) && *deactivatedPaddingEnable) ||
// frame padding
(*framePadding && nump < generalData->packetsPerFrame))
// frame padding
if (*activated && *framePadding && nump < generalData->packetsPerFrame)
PadMissingPackets(buf);
// deactivated and padding enabled
else if (!(*activated) && *deactivatedPaddingEnable)
PadMissingPackets(buf);
// normal call back

View File

@ -54,7 +54,8 @@ Listener::Listener(int ind, detectorType dtype, Fifo* f, runStatus* s,
listeningPacket(nullptr),
udpSocketAlive(0),
numPacketsStatistic(0),
numFramesStatistic(0)
numFramesStatistic(0),
oddStartingPacket(true)
{
if(ThreadObject::CreateThread() == FAIL)
throw std::exception();
@ -428,7 +429,7 @@ uint32_t Listener::ListenToAnImage(char* buf) {
// -------------------old header -----------------------------------------------------------------------------
else {
generalData->GetHeaderInfo(index, carryOverPacket + esize,
*dynamicRange, fnum, pnum, snum, bid);
*dynamicRange, oddStartingPacket, fnum, pnum, snum, bid);
}
//------------------------------------------------------------------------------------------------------------
if (fnum != currentFrameIndex) {
@ -544,8 +545,13 @@ uint32_t Listener::ListenToAnImage(char* buf) {
}
// -------------------old header -----------------------------------------------------------------------------
else {
// set first packet to be odd or even (check required when switching from roi to no roi)
if (myDetectorType == GOTTHARD && !measurementStartedFlag) {
oddStartingPacket = generalData->SetOddStartingPacket(index, listeningPacket + esize);
}
generalData->GetHeaderInfo(index, listeningPacket + esize,
*dynamicRange, fnum, pnum, snum, bid);
*dynamicRange, oddStartingPacket, fnum, pnum, snum, bid);
}
//------------------------------------------------------------------------------------------------------------
@ -565,6 +571,13 @@ uint32_t Listener::ListenToAnImage(char* buf) {
if (!measurementStartedFlag)
RecordFirstIndices(fnum);
if (pnum >= pperFrame ) {
FILE_LOG(logERROR, ("Bad packet %d (fnum:%lld), throwing away. "
"Packets caught so far: %d\n",
pnum, (long long int)fnum, numpackets));
return 0; // bad packet
}
//future packet by looking at image number (all other detectors)
if (fnum != currentFrameIndex) {
carryOverFlag = true;

View File

@ -84,7 +84,7 @@ inline std::string NowTime()
const int buffer_len = sizeof(buffer);
time_t t;
time(&t);
tm r = {0};
tm r;
strftime(buffer, buffer_len, "%X", localtime_r(&t, &r));
buffer[buffer_len - 1] = 0;
struct timeval tv;