Compare commits

...

153 Commits

Author SHA1 Message Date
8bdfe7527f Merge pull request #170 from slsdetectorgroup/m3parallel
M3parallel
2020-09-09 13:44:40 +02:00
b33fdf4462 merge conflict fixed and merged with developer 2020-09-09 12:31:36 +02:00
70386633f6 Merge pull request #168 from slsdetectorgroup/serverargs
Server arguments
2020-09-09 12:29:44 +02:00
6c8443f09e binaries in 2020-09-09 12:14:38 +02:00
bf52ec10da help printed neutral 2020-09-09 11:06:47 +02:00
bdac4d133e conflict solved and merged with developer 2020-09-09 10:27:14 +02:00
e8156d412e G2: continuous internal mode (#167) 2020-09-09 10:13:15 +02:00
8e09b50c5e python and gui fix for parallel, gui: clkdivider also for jungfrau and parallel also for m3 2020-09-08 16:53:42 +02:00
aecde086a0 binaries in 2020-09-08 12:16:41 +02:00
311cebcd00 m3:added parallel mode 2020-09-08 12:16:02 +02:00
8496f5715f binaries in 2020-09-08 11:55:17 +02:00
f26d8e514b merged with g2continuous 2020-09-08 08:46:37 +02:00
0b9ff70244 binaries in 2020-09-08 08:25:24 +02:00
e82e531fb1 server arguments like linux 2020-09-08 08:18:48 +02:00
503f83e8e3 Merge branch 'developer' into g2continuous 2020-09-07 17:07:09 +02:00
1a90c58d9e Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-09-07 16:52:07 +02:00
c467bd677e missing file 2020-09-07 16:52:03 +02:00
f280d033b9 binarie sin 2020-09-07 16:44:48 +02:00
c9cf845c9a WIP 2020-09-07 16:44:26 +02:00
63bbbfb438 Merge pull request #166 from slsdetectorgroup/rxrmetadata
Rxrmetadata
2020-09-07 16:37:55 +02:00
5540f16116 Merge branch 'developer' into g2continuous 2020-09-07 16:36:42 +02:00
a77833b4c7 Merge branch 'developer' into g2continuous 2020-09-07 16:36:00 +02:00
9ee67f2cfa python rx_jsonpara 2020-09-07 16:23:28 +02:00
cf3758f155 Merge branch 'developer' into rxrmetadata 2020-09-07 16:15:56 +02:00
b20720686e gotthard2: changed order of burst mode enums, added a 4th burst mode cw internal burst mode 2020-09-07 16:13:33 +02:00
1edb1e8816 GUI: adding 1D detectors by default in x direction, others in y dir (#164) 2020-09-07 13:03:15 +02:00
30e06c6386 Merge branch 'developer' into rxrmetadata 2020-09-07 11:53:41 +02:00
ea601fe1f7 lock to ensure json add header can be updated on the fly 2020-09-07 11:52:51 +02:00
f0c576c779 WIP 2020-09-07 11:15:51 +02:00
fb8842e048 build and libname 2020-09-07 09:14:47 +02:00
5b182469a1 rxr: fixed all updates from rxParameters, connected them in masterAttributes, added json header and scan parametes in metadata 2020-09-04 13:49:30 +02:00
a1b88d3a62 fix 2020-09-04 11:20:33 +02:00
514346c3ba static support lib 2020-09-04 11:00:34 +02:00
9218ef5a95 Merge branch 'developer' into rxrmetadata 2020-09-03 18:02:05 +02:00
b124cea67b Merge branch 'developer' into rxrmetadata 2020-09-03 17:48:03 +02:00
497eff6f04 Merge pull request #163 from slsdetectorgroup/guitrimval
gui: enable trimming for m3
2020-09-03 17:38:04 +02:00
92635c5bd3 mythen3 gui: trimbit files feature enabled 2020-09-03 17:36:23 +02:00
a00231dab6 m3 gui: enabled trimval feature 2020-09-03 17:21:37 +02:00
35c7e46d60 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-09-03 17:20:48 +02:00
47da2540af json 2020-09-03 17:20:38 +02:00
891b8dbd2c mythen3: wrong hardware version number, so it didnt reboot after programfpga 2020-09-03 17:04:58 +02:00
89f0479318 txndelay in python 2020-09-03 16:30:13 +02:00
7048a75808 triggersl and print fix for acq 2020-09-03 16:21:15 +02:00
a081fbbdaa Merge branch 'developer' into rxrmetadata 2020-09-03 15:52:01 +02:00
22f14cacb0 virtual and vetofile 2020-09-03 15:33:12 +02:00
6b7dee2631 added versions and parallel to python 2020-09-03 11:49:08 +02:00
6d1856daa2 gui: added burstmode (#159)
Added burst mode in the GUI. Visible only for detectors that supports it.
2020-09-03 10:47:02 +02:00
7bb9696151 Merge branch 'developer' into rxrmetadata 2020-09-02 18:07:22 +02:00
44335f9cf4 Merge pull request #157 from slsdetectorgroup/g2printout
G2printout
2020-09-02 17:04:15 +02:00
d62d5ef804 binaries in 2020-09-02 17:03:19 +02:00
dbaab61ea2 g2: print ns in server before converting to freq 2020-09-02 17:02:12 +02:00
180c7b7191 Gui slot call focus fix (#150)
* fix for editingFinished for qlineedit using isModified()

* spinbox disable keyboard tracking to use valuechanged so slot called only after editing finished, focus fix

* return pressed forces qtextfield to be set (slot for tab checks for modification flag due to avoid unnecessary set when focus). This is to remove inconsistencies from command line. A return should set even if it looks like no modification in gui

Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
2020-09-02 16:56:57 +02:00
050f0ff8a0 Merge pull request #156 from slsdetectorgroup/g2clkchange
gotthard2: change default clock divider of readout clocks 1 and 2 fro…
2020-09-02 16:50:32 +02:00
658a804cca gotthard2: change default clock divider of readout clocks 1 and 2 from 8 to 6 2020-09-02 16:48:58 +02:00
73530ddd6f python udp_srcmac 2020-09-02 16:48:51 +02:00
abe34d573c WIP 2020-09-02 16:15:33 +02:00
05d5652532 exptime example 2020-09-02 12:32:14 +02:00
38e0351068 zmqports work like command line 2020-09-02 12:20:08 +02:00
e192cad1f2 zmqport fix 2020-09-02 12:07:47 +02:00
b8350b070e rx_zmqip fix 2020-09-02 11:55:27 +02:00
3ddeea3c2b minor fix docs 2020-09-02 11:44:13 +02:00
42b5ff3a62 WIP, doc 2020-09-02 10:25:36 +02:00
00978a52c8 added smp_clk, changed rdo vco freq from 1.25GHz to 1GHz, changed rdo clock dividers 2020-09-01 12:06:39 +02:00
8400c686b5 binaries in 2020-08-31 18:22:41 +02:00
adb6171e35 eiger server: more checks for feb interface reg readouts 2020-08-31 18:22:16 +02:00
973b8f7106 eiger server: more checks for feb interface reg readouts 2020-08-31 18:19:56 +02:00
2f81c233f5 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-08-31 14:17:14 +02:00
e4274e3f95 WIP, doc 2020-08-31 14:17:09 +02:00
b92f9af025 hex example 2020-08-31 10:14:01 +02:00
7ca1609c58 minor doc 2020-08-31 09:50:42 +02:00
4cd81437ab pyver 2020-08-31 09:49:25 +02:00
7e202b6c26 getting started 2020-08-31 09:32:48 +02:00
e0df9fcd99 wip, doc 2020-08-28 19:47:19 +02:00
30307220e3 QIP, doc 2020-08-28 18:12:08 +02:00
6a74851e0c enums 2020-08-28 12:21:07 +02:00
ac30717083 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-08-28 12:08:21 +02:00
bfed02b41e getting started 2020-08-28 12:08:13 +02:00
b5669dc921 WIP, doc 2020-08-28 10:57:21 +02:00
97ee2d269d Merge pull request #149 from slsdetectorgroup/stopfix
stopping in virtual server needs a usleep before acquiring lock to ge…
2020-08-27 18:22:51 +02:00
bc5cc3fa29 stopping in virtual server needs a usleep before acquiring lock to get status 2020-08-27 18:21:46 +02:00
abd2808924 WIP, doc 2020-08-27 18:00:19 +02:00
786b14e88b Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-08-27 17:58:21 +02:00
f19799343e WIP, doc 2020-08-27 17:58:15 +02:00
2e4783f296 sort and remove duplicates before sending rxdbitlist 2020-08-27 17:08:53 +02:00
3954913661 fixed ratecorr 0 in python 2020-08-27 16:45:14 +02:00
7eafceb0f9 Exposing vector of strings for loading parameters (#147) 2020-08-27 16:17:56 +02:00
a1e06ca7a9 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-08-26 17:45:17 +02:00
27c1916d63 WIP, doc 2020-08-26 17:45:12 +02:00
64075c0e75 added tempvalues 2020-08-26 12:21:33 +02:00
9505c51404 merge conflict 2020-08-26 11:13:34 +02:00
6d8168722a WIP, doc 2020-08-26 11:11:51 +02:00
f9261c0f32 return ratecorr in s 2020-08-26 11:00:56 +02:00
d44388a44e mv to mV 2020-08-25 17:27:29 +02:00
6a18a214ba Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-08-25 17:18:22 +02:00
83baf18490 WIP, doc 2020-08-25 17:18:18 +02:00
ddf2085b4b exptime for mythen3 2020-08-25 16:55:58 +02:00
508ec150f5 added Gotthard and Moench 2020-08-25 15:48:56 +02:00
5eda75ebdd added patsetbit 2020-08-25 14:59:57 +02:00
0253933271 newline in command docs 2020-08-25 14:46:06 +02:00
0f80079d16 enum example 2020-08-25 09:05:02 +02:00
fd601128b7 enum helper 2020-08-25 09:02:31 +02:00
bc09b8bfb9 WIP doc 2020-08-21 17:13:43 +02:00
e85326d415 WIP doc 2020-08-21 16:00:33 +02:00
396685e6a9 WIP doc 2020-08-21 15:25:47 +02:00
cf6a48d7a9 WIP doc 2020-08-21 13:20:32 +02:00
4f45110cda WIP doc 2020-08-21 13:05:33 +02:00
3aa75ce167 WIP doc 2020-08-20 17:11:15 +02:00
5b364b9ad8 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-08-20 16:59:45 +02:00
550ab51f34 wip doc 2020-08-20 16:59:38 +02:00
e782fcce62 added gotthard2 2020-08-20 16:49:55 +02:00
a2ec86006d inherited-members in doc 2020-08-20 15:45:06 +02:00
6399d1bdfb added dacvalues to python 2020-08-20 15:34:06 +02:00
6cd8bbcb12 python templist 2020-08-20 15:23:15 +02:00
678967bfe1 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-08-20 15:16:36 +02:00
ffd694eda1 temlist and tempvalues added 2020-08-20 15:16:28 +02:00
ab2f929e83 dac example 2020-08-20 15:15:09 +02:00
4540eddd68 added timinglist and settingslist to python 2020-08-20 14:55:05 +02:00
534c7105f4 dac example 2020-08-20 14:52:47 +02:00
c8a39d1d9e temperature example 2020-08-20 14:13:27 +02:00
bd6d212f99 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-08-20 13:46:33 +02:00
c4f0052ac9 WIP 2020-08-20 13:46:25 +02:00
5bfbc83a04 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-08-20 12:58:23 +02:00
429eb8da53 doc wip 2020-08-20 12:58:17 +02:00
f6cde374c4 WIP 2020-08-20 12:27:30 +02:00
1f811dfabd added examples 2020-08-20 12:22:49 +02:00
8ef6f32be6 example and updated python bindings 2020-08-20 12:19:35 +02:00
a7cc2b38d8 temperature reading for eiger 2020-08-20 11:46:35 +02:00
9b26f5a6c8 added python examples in source 2020-08-20 09:21:59 +02:00
c4fde7f7bc Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-08-19 18:45:47 +02:00
5f23a664fa wip doc 2020-08-19 18:45:39 +02:00
209c97f44c vthrehsold 2020-08-19 18:01:27 +02:00
d631fda2c7 updated non-blocking example 2020-08-19 17:48:22 +02:00
caff89a040 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-08-19 17:27:09 +02:00
42067b3de3 WIP doc 2020-08-19 17:27:04 +02:00
a287ce46b1 WIP doc 2020-08-19 17:13:39 +02:00
7212a0d433 added start, rx_start etc 2020-08-19 17:06:54 +02:00
9bae97ec4c doc update, 1st trial 2020-08-19 16:37:21 +02:00
096b0c424d spaces in percentage printout for python 2020-08-19 12:56:22 +02:00
39c2ab4743 rxr:minor removed unused function in general data for m3 to change size depending on dr 2020-08-19 12:27:40 +02:00
57e0fd805e added support for ~ expansion 2020-08-19 12:03:32 +02:00
071a1c9f98 python docs 2020-08-19 07:44:53 +02:00
0cb418a89b Merge pull request #141 from slsdetectorgroup/m3txndelay
M3txndelay
2020-08-18 15:58:41 +02:00
4e9c99d65d Merge branch 'developer' into m3txndelay 2020-08-18 15:58:32 +02:00
dd918fb326 eiger deactivate beb functions (#140)
eiger: some deactivated beb functions should return a value instead of accessng  beb
2020-08-18 15:52:52 +02:00
7ea86dec43 m3 binaries in 2020-08-18 15:28:30 +02:00
eeb386fef5 mythen3: txndelay frame added 2020-08-18 15:27:30 +02:00
afabc9a503 Fixed file cluster closing and cprintf warning in moenchZmqProcess 2020-08-18 10:56:21 +02:00
1d8f9a5aed more detail in packet loss statistic percentage 2020-08-14 17:21:35 +02:00
d4e11e56ea added drlist and timinglist, moved daclist and settingslist from cmdprozy.cpp to .h 2020-08-14 15:47:39 +02:00
de69e666a9 progress changed to double 2020-08-14 12:16:35 +02:00
28ffad223d update comment on api, move updaterxratecorrection to the right setexptime 2020-08-14 11:22:41 +02:00
f0d0e9ab1f Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-08-13 10:15:52 +02:00
854d8d4ae2 alternate sphinx name 2020-08-13 10:15:45 +02:00
121 changed files with 4836 additions and 1861 deletions

View File

@ -63,17 +63,18 @@ find_package(ClangFormat)
check_ipo_supported(RESULT SLS_LTO_AVAILABLE) check_ipo_supported(RESULT SLS_LTO_AVAILABLE)
# Use ld.gold if it is available and isn't disabled explicitly # # Use ld.gold if it is available and isn't disabled explicitly
option(SLS_USE_LD_GOLD "Use GNU gold linker" ON) # option(SLS_USE_LD_GOLD "Use GNU gold linker" ON)
if (SLS_USE_LD_GOLD) # if (SLS_USE_LD_GOLD)
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION) # execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
if ("${LD_VERSION}" MATCHES "GNU gold") # if ("${LD_VERSION}" MATCHES "GNU gold")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=gold") # set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold") # set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
else () # set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
message(WARNING "GNU gold linker isn't available, using the default system linker.") # else ()
endif () # message(WARNING "GNU gold linker isn't available, using the default system linker.")
endif () # endif ()
# endif ()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
@ -240,7 +241,7 @@ if(SLS_MASTER_PROJECT)
# Set install dir CMake packages # Set install dir CMake packages
set(CMAKE_INSTALL_DIR "share/cmake/${PROJECT_NAME}") set(CMAKE_INSTALL_DIR "share/cmake/${PROJECT_NAME}")
# Set the list of exported targets # Set the list of exported targets
set(PROJECT_LIBRARIES slsSupportLib slsDetectorShared slsReceiverShared) set(PROJECT_LIBRARIES slsSupportShared slsDetectorShared slsReceiverShared)
# Generate and install package config file and version # Generate and install package config file and version
include(cmake/package_config.cmake) include(cmake/package_config.cmake)
endif() endif()

View File

@ -1,6 +1,6 @@
#Look for an executable called sphinx-build #Look for an executable called sphinx-build
find_program(SPHINX_EXECUTABLE find_program(SPHINX_EXECUTABLE
NAMES sphinx-build NAMES sphinx-build sphinx-build-3.6
DOC "Path to sphinx-build executable") DOC "Path to sphinx-build executable")
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)

View File

@ -33,6 +33,7 @@ requirements:
- {{ cdt('libselinux') }} # [linux] - {{ cdt('libselinux') }} # [linux]
- {{ cdt('libxdamage') }} # [linux] - {{ cdt('libxdamage') }} # [linux]
- {{ cdt('libxxf86vm') }} # [linux] - {{ cdt('libxxf86vm') }} # [linux]
- expat
host: host:
- libstdcxx-ng - libstdcxx-ng
@ -45,6 +46,7 @@ requirements:
- xorg-libxau - xorg-libxau
- xorg-libxrender - xorg-libxrender
- xorg-libxfixes - xorg-libxfixes
- expat
run: run:
- zeromq - zeromq
@ -96,3 +98,4 @@ outputs:
- {{ pin_subpackage('slsdetlib', exact=True) }} - {{ pin_subpackage('slsdetlib', exact=True) }}
- qwt 6.* - qwt 6.*
- qt 4.8.* - qt 4.8.*
- expat

View File

@ -59,14 +59,13 @@ set( HEADERS
#set(ROOT_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) #set(ROOT_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
# ROOT dictionary generation # ROOT dictionary generation
include("${ROOT_DIR}/modules/RootNewMacros.cmake") include("${ROOT_DIR}/RootMacros.cmake")
root_generate_dictionary(ctbDict ${HEADERS} LINKDEF ctbLinkDef.h) root_generate_dictionary(ctbDict ${HEADERS} LINKDEF ctbLinkDef.h)
add_library(ctbRootLib SHARED ctbDict.cxx) add_library(ctbRootLib SHARED ctbDict.cxx)
target_include_directories(ctbRootLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(ctbRootLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(ctbRootLib PUBLIC target_link_libraries(ctbRootLib PUBLIC
ROOT::Core ROOT::Core
slsDetectorShared slsDetectorShared
slsSupportLib
${ROOT_LIBRARIES} ${ROOT_LIBRARIES}
${ROOT_EXE_LINKER_FLAGS} ${ROOT_EXE_LINKER_FLAGS}
) )
@ -78,7 +77,6 @@ set_target_properties(
target_link_libraries(ctbGui PUBLIC target_link_libraries(ctbGui PUBLIC
slsDetectorShared slsDetectorShared
slsSupportLib
ctbRootLib ctbRootLib
${TIFF_LIBRARIES} ${TIFF_LIBRARIES}
) )

View File

@ -43,6 +43,7 @@ set(SPHINX_SOURCE_FILES
src/type_traits.rst src/type_traits.rst
src/ToString.rst src/ToString.rst
src/examples.rst src/examples.rst
src/pygettingstarted.rst
) )

View File

@ -48,7 +48,7 @@ int main() {
auto tmp = os.str().erase(0, cmd.size()); auto tmp = os.str().erase(0, cmd.size());
auto usage = tmp.substr(0, tmp.find_first_of('\n')); auto usage = tmp.substr(0, tmp.find_first_of('\n'));
tmp.erase(0, usage.size()); tmp.erase(0, usage.size());
auto help = replace_all(tmp, "\n\t", "\n\t\t"); auto help = replace_all(tmp, "\n\t", "\n\t\t| ");
fs << '\t' << cmd << usage << help << "\n"; fs << '\t' << cmd << usage << help << "\n";
} }
} }

View File

@ -32,6 +32,7 @@ Welcome to slsDetectorPackage's documentation!
:caption: Python API :caption: Python API
:maxdepth: 2 :maxdepth: 2
pygettingstarted
pydetector pydetector
pyenums pyenums
pyexamples pyexamples

View File

@ -7,3 +7,4 @@ Detector
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
:inherited-members:

View File

@ -4,6 +4,31 @@ Enums
These enums are defined in slsDetectorDefs in the C++ package and These enums are defined in slsDetectorDefs in the C++ package and
exposed to Python through pybind11. exposed to Python through pybind11.
::
# Most settings are represented as enums that can be
# explicitly imported
from slsdet import Detector, fileFormat
d = Detector()
d.fformat = fileFormat.BINARY
# Altough not recommended for convenience all enums
# and some other things can be impored using *
from slsdet import *
d.speed = speedLevel.FULL_SPEED
# To list the available enums, use dir()
import slsdet.enums
for enum in dir(slsdet.enums):
# filter out special memebers
if not enum.startswith('_'):
print(enum)
.. py:currentmodule:: slsdet .. py:currentmodule:: slsdet
.. autoclass:: runStatus .. autoclass:: runStatus

View File

@ -1,7 +1,73 @@
Examples Examples
================ ================
Some short hints on how to use the detector Some short examples on how to use slsdet. If something is missing don't hesitate to
open an issue in our our `github repo
<https://github.com/slsdetectorgroup/slsDetectorPackage>`_.
------------------------------------
Setting exposure time
------------------------------------
Setting and reading back exposure time can be done either using a Python datetime.timedelta
or by setting the time in seconds.
::
# Set exposure time to 1.2 seconds
>>> d.exptime = 1.2
# Setting exposure time using timedelta
import datetime as dt
>>> d.exptime = dt.timedelta(seconds = 1.2)
# With timedelta any arbitrary combination of units can be used
>>> t = dt.timedelta(microseconds = 100, seconds = 5.3, minutes = .3)
# To set exposure time for individual detector one have to resort
# to the C++ style API.
# Sets exposure time to 1.2 seconds for module 0, 6 and 12
>>> d.setExptime(1.2, [0, 6, 12])
>>> d.setExptime(dt.timedelta(seconds = 1.2), [0, 6, 12])
------------------------------------
Converting numbers to hex
------------------------------------
Python support entering numbers in format by using the 0x prefix. However, when reading
back you will get a normal integer. This can then be converted to a hex string representation
using the built in hex() function.
.. code-block :: python
from slsdet import Detector
>>> d = Detector()
>>> d.patwait0 = 0xaa
>>> d.patwait0
170
# Convert to string
>>> hex(d.patwait0)
'0xaa'
For multiple values one can use a list comprehension to loop over the values.
.. code-block :: python
>>> values = [1,2,3,4,5]
>>> [(v) for v in values]
['0x1', '0x2', '0x3', '0x4', '0x5']
# or to a single string by passing the list to .join
>>> ', '.join([hex(v) for v in values])
'0x1, 0x2, 0x3, 0x4, 0x5'
------------------------ ------------------------
Simple threshold scan Simple threshold scan
@ -74,37 +140,39 @@ But lets start looking at the at the manual way:
:: ::
import time import time
from slsdet import Eiger from slsdet import Detector, runStatus
d = Eiger()
n = 10
t = 1
d.exposure_time = t n_frames = 10
d.n_frames = n t_exp = 1
d.reset_frames_caught()
# Set exposure time and number of frames
d = Detector()
d.exptime = t_exp
d.frames = n_frames
# Start the measurement # Start the measurement
t0 = time.time() t0 = time.time()
d.start_receiver() d.startDetector()
d.start_detector() d.startReceiver()
# Wait for the detector to be ready or do other important stuff # Wait for the detector to be ready or do other important stuff
time.sleep(t*n) time.sleep(t_exp * n_frames)
# check if the detector is ready otherwise wait a bit longer # check if the detector is ready otherwise wait a bit longer
while d.status != 'idle': while d.status != runStatus.IDLE:
time.sleep(0.1) time.sleep(0.1)
# Stop the receiver after we got the frames # Stop the receiver after we got the frames
# Detector is already idle so we don't need to stop it # Detector is already idle so we don't need to stop it
d.stop_receiver() d.stopReceiver()
lost = d.rx_framescaught - n_frames
print(
f"{n_frames} frames of {t_exp}s took {time.time()-t0:{.3}}s with {lost} frames lost "
)
lost = d.frames_caught - n
print(f'{n} frames of {t}s took {time.time()-t0:{.3}}s with {lost} frames lost ')
#Reset to not interfere with a potential next measurement
d.reset_frames_caught()
Instead launching d.acq() from a different process is a bit easier since the control of receiver and detector Instead launching d.acq() from a different process is a bit easier since the control of receiver and detector
is handled in the acq call. However, you need to join the process used otherwise a lot of zombie processes would is handled in the acq call. However, you need to join the process used otherwise a lot of zombie processes would
@ -114,30 +182,104 @@ hang around until the main process exits.
import time import time
from multiprocessing import Process from multiprocessing import Process
from slsdet import Eiger from slsdet import Detector, runStatus
def acquire():
"""
Create a new Eiger object that still referes to the same actual detector
and same shared memory. Then launch acq.
"""
detector = Eiger()
detector.acq()
#This is the detector we use throughout the session d = Detector()
d = Eiger()
#Process to run acquire #Create a separate process to run acquire in
p = Process(target=acquire) p = Process(target=d.acquire)
#Start the thread and short sleep to allow the acq to start #Start the thread and short sleep to allow the acq to start
p.start() p.start()
time.sleep(0.01) time.sleep(0.01)
#Do some other work #Do some other work
while d.busy is True: while d.status != runStatus.IDLE:
print(d.busy) print("Working")
time.sleep(0.1) time.sleep(0.1)
#Join the process #Join the process
p.join() p.join()
------------------------------
Setting and getting times
------------------------------
::
import datetime as dt
from slsdet import Detector
from slsdet.utils import element_if_equal
d = Detector()
# The simplest way is to set the exposure time in
# seconds by using the exptime property
# This sets the exposure time for all modules
d.exptime = 0.5
# exptime also accepts a python datetime.timedelta
# which can be used to set the time in almost any unit
t = dt.timedelta(milliseconds = 2.3)
d.exptime = t
# or combination of units
t = dt.timedelta(minutes = 3, seconds = 1.23)
d.exptime = t
# exptime however always returns the time in seconds
>>> d.exptime
181.23
# To get back the exposure time for each module
# it's possible to use getExptime, this also returns
# the values as datetime.timedelta
>>> d.getExptime()
[datetime.timedelta(seconds=181, microseconds=230000), datetime.timedelta(seconds=181, microseconds=230000)]
# In case the values are the same it's possible to use the
# element_if_equal function to reduce the values to a single
# value
>>> t = d.getExptime()
>>> element_if_equal(t)
datetime.timedelta(seconds=1)
--------------
Reading dacs
--------------
::
from slsdet import Detector, Eiger, dacIndex
#using the specialized class
e = Eiger()
>>> e.dacs
========== DACS =========
vsvp : 0 0
vtrim : 2480 2480
vrpreamp : 3300 3300
vrshaper : 1400 1400
vsvn : 4000 4000
vtgstv : 2556 2556
vcmp_ll : 1000 1000
vcmp_lr : 1000 1000
vcal : 0 0
vcmp_rl : 1000 1000
rxb_rb : 1100 1100
rxb_lb : 1100 1100
vcmp_rr : 1000 1000
vcp : 1000 1000
vcn : 2000 2000
vishaper : 1550 1550
iodelay : 650 650
# or using the general class and the list
d = Detector()
for dac in d.daclist:
r = d.getDAC(dac, False)
print(f'{dac.name:10s} {r}')

View File

@ -0,0 +1,228 @@
Getting Started
==================
--------------------
Which Python?
--------------------
We require at lest Python 3.6 and strongly recommended that you don't use the system
Python installation. The examples in this documentation uses `conda
<https://docs.conda.io/en/latest/miniconda.html>`_ since it provides good support
also for non Python packages but there are also other alternatives like, pyenv.
Using something like conda also allows you to quickly switch beteen different Python
environments.
.. warning ::
If you use conda avoid also installing packages with pip.
---------------------
PYTHONPATH
---------------------
If you install slsdet using conda everything is set up and you can
directly start using the Python bindings. However, if you build
from source you need to tell Python where to find slsdet. This
is be done by adding your build/bin directory to PYTHONPATH.
.. code-block:: bash
export PYTHONPATH = /path/to/your/build/bin:$PYTHONPATH
.. note ::
Don't forget to compile with the option SLS_USE_PYTHON=ON to enable
the Python bindings or if you use the cmk.sh script -p.
--------------------------------------
Which detector class should I use?
--------------------------------------
We provide a generic class called Detector and detector specific
versions like, Eiger, Jungfrau etc. The most or all functionality
is there in the base class except the convenient access to dacs
and temperatures.
::
from slsdet import Detector, Eiger
d = Detector()
e = Eiger()
# Both classes can be used to control an Eiger detector
d.exptime = 0.5
e.period = 1
# But Eiger gives a simpler interface to the dacs
>>> e.dacs
========== DACS =========
vsvp : 0
vtrim : 2480
vrpreamp : 3300
vrshaper : 1400
vsvn : 4000
vtgstv : 2556
vcmp_ll : 1000
vcmp_lr : 1000
vcal : 0
vcmp_rl : 1000
rxb_rb : 1100
rxb_lb : 1100
vcmp_rr : 1000
vcp : 1000
vcn : 2000
vishaper : 1550
iodelay : 650
.. note ::
Depending on user feedback we might move some detector specific
functionality to the specialized classes.
----------------------------------
Hey, there seems to be two APIs?
----------------------------------
To make the Python API approachable, both if you come from the command line
or are using the C++ API, we provide two interfaces to the detector.
One is property based and tries to stay as close to the command line syntax
as is possible, and the other one directly maps the C++ API found in Detector.h.
There is also an underlying design reason for the two APIs since we auto
generate the bindings to the C++ code using a mix of pybind11 and clang-tools.
The property based API covers most of the functionality but in some cases
you have to reach for the C++ like interface.
::
d = Detector()
# C++ like API
d.setExptime(0.1)
# or a bit more pythonic
d.exptime = 0.1
The c++ style API offers more control over access to individual modules
in a large detector.
::
# Set exposure time for module 1, 5 and 7
d.setExptime(0.1, [1,5,7])
--------------------
Finding functions
--------------------
To find out which properties and methods that a Python object have you
can use dir()
::
>>> from slsdet import Detector
>>> d = Detector()
>>> dir(d)
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__',
'__eq__', '__format__', '__ge__', '__getattribute__', '__gt__',
'__hash__', '__init__', '__init_subclass__', '__le__', '__len__',
'__lt__', '__module__', '__ne__', '__new__', '__reduce__',
'__reduce_ex__', '__repr__', '__setattr__', '__sizeof__',
'__str__', '__subclasshook__', '_adc_register', '_frozen',
'_register', 'acquire', 'adcclk', 'adcphase', 'adcpipeline',
'adcreg', 'asamples', 'auto_comp_disable', 'clearAcquiringFlag',
'clearBit', 'clearROI', 'client_version', 'config', 'copyDetectorServer',
'counters', 'daclist', 'dacvalues', 'dbitclk', 'dbitphase' ...
Since the list for Detector is rather long it's an good idea to filter it.
The following example gives you properties and methods containing time in
their name.
::
>>> [item for item in dir(d) if 'time' in item]
['exptime', 'getExptime', 'getExptimeForAllGates', 'getExptimeLeft',
'getSubExptime', 'patwaittime0', 'patwaittime1', 'patwaittime2',
'setExptime', 'setSubExptime', 'subdeadtime', 'subexptime']
The above method works on any Python object but for convenience we also
included two functions to find names. View prints the names one per line
while find returns a list of names.
::
from slsdet.lookup import view, find
>>> view('exptime')
exptime
getExptime
getExptimeForAllGates
getExptimeLeft
getSubExptime
setExptime
setSubExptime
subexptime
>>> find('exptime')
['exptime', 'getExptime', 'getExptimeForAllGates', 'getExptimeLeft',
'getSubExptime', 'setExptime', 'setSubExptime', 'subexptime']
------------------------------------
Finding out what the function does
------------------------------------
To access the documentation of a function directly from the Python prompt use help().
.. code-block :: python
>>> help(Detector.period)
Help on property:
Period between frames, accepts either a value in seconds or datetime.timedelta
Note
-----
:getter: always returns in seconds. To get in datetime.delta, use getPeriod
Examples
-----------
>>> d.period = 1.05
>>> d.period = datetime.timedelta(minutes = 3, seconds = 1.23)
>>> d.period
181.23
>>> d.getPeriod()
[datetime.timedelta(seconds=181, microseconds=230000)]
----------------------
Where are the ENUMs?
----------------------
To set some of the detector settings like file format you have
to pass in an enum.
::
>>> d.setFileFormat(fileFormat.BINARY)
The enums can be found in slsdet.enums
::
import slsdet
>>> [e for e in dir(slsdet.enums) if not e.startswith('_')]
['burstMode', 'clockIndex', 'dacIndex', 'detectorModeType',
'detectorSettings', 'detectorType', 'dimension', 'externalSignalFlag',
'fileFormat', 'frameDiscardPolicy', 'frameModeType', 'masterFlags',
'readoutMode', 'runStatus', 'speedLevel', 'timingMode',
'timingSourceType']
# Even though importing using * is not recommended one could
# get all the enums like this:
>>> from slsdet.enums import *

View File

@ -11,7 +11,7 @@ pybind11_add_module(_slsdet
target_link_libraries(_slsdet PUBLIC target_link_libraries(_slsdet PUBLIC
slsDetectorShared slsDetectorShared
slsReceiverShared slsReceiverShared
slsSupportLib slsSupportShared
${ZeroMQ_LIBRARIES} ${ZeroMQ_LIBRARIES}
) )
@ -30,11 +30,17 @@ set( PYTHON_FILES
detector_property.py detector_property.py
detector.py detector.py
eiger.py eiger.py
enums.py
errors.py errors.py
gotthard.py
gotthard2.py
moench.py
jsonproxy.py
ctb.py ctb.py
jungfrau.py jungfrau.py
mythen3.py mythen3.py
registers.py registers.py
temperature.py
lookup.py lookup.py
utils.py utils.py

View File

@ -0,0 +1,42 @@
"""
Example showing how to set and get exposure times
"""
import datetime as dt
from slsdet import Detector
from slsdet.utils import element_if_equal
d = Detector()
# The simplest way is to set the exposure time in
# seconds by using the exptime property
# This sets the exposure time for all modules
d.exptime = 0.5
# exptime also accepts a python datetime.timedelta
# which can be used to set the time in almost any unit
t = dt.timedelta(milliseconds = 2.3)
d.exptime = t
# or combination of units
t = dt.timedelta(minutes = 3, seconds = 1.23)
d.exptime = t
#exptime however always returns the time in seconds
# >>> d.exptime
# 181.23
# To get back the exposure time for each module
# it's possible to use getExptime, this also returns
# the values as datetime.timedelta
# >>> d.getExptime()
# [datetime.timedelta(seconds=181, microseconds=230000), datetime.timedelta(seconds=181, microseconds=230000)]
# In case the values are the same it's possible to use the
# element_if_equal function to reduce the values to a single
# value
# >>> t = d.getExptime()
# >>> element_if_equal(t)
# datetime.timedelta(seconds=1)

View File

@ -0,0 +1,21 @@
import time
from multiprocessing import Process
from slsdet import Detector, runStatus
d = Detector()
#Create a separate process to run acquire in
p = Process(target=d.acquire)
#Start the thread and short sleep to allow the acq to start
p.start()
time.sleep(0.01)
#Do some other work
while d.status != runStatus.IDLE:
print("Working")
time.sleep(0.1)
#Join the process
p.join()

View File

@ -0,0 +1,33 @@
import time
from slsdet import Detector, runStatus
n_frames = 10
t_exp = 1
# Set exposure time and number of frames
d = Detector()
d.exptime = t_exp
d.frames = n_frames
# Start the measurement
t0 = time.time()
d.startDetector()
d.startReceiver()
# Wait for the detector to be ready or do other important stuff
time.sleep(t_exp * n_frames)
# check if the detector is ready otherwise wait a bit longer
while d.status != runStatus.IDLE:
time.sleep(0.1)
# Stop the receiver after we got the frames
# Detector is already idle so we don't need to stop it
d.stopReceiver()
lost = d.rx_framescaught - n_frames
print(
f"{n_frames} frames of {t_exp}s took {time.time()-t0:{.3}}s with {lost} frames lost "
)

View File

@ -0,0 +1,32 @@
from slsdet import Detector, Eiger, dacIndex
#using the specialized class
e = Eiger()
e.dacs
# >>> e.dacs
# ========== DACS =========
# vsvp : 0 0
# vtrim : 2480 2480
# vrpreamp : 3300 3300
# vrshaper : 1400 1400
# vsvn : 4000 4000
# vtgstv : 2556 2556
# vcmp_ll : 1000 1000
# vcmp_lr : 1000 1000
# vcal : 0 0
# vcmp_rl : 1000 1000
# rxb_rb : 1100 1100
# rxb_lb : 1100 1100
# vcmp_rr : 1000 1000
# vcp : 1000 1000
# vcn : 2000 2000
# vishaper : 1550 1550
# iodelay : 650 650
# or using the general class and the list
d = Detector()
for dac in d.daclist:
r = d.getDAC(dac, False)
print(f'{dac.name:10s} {r}')

View File

@ -0,0 +1,45 @@
from slsdet import Detector, Eiger, dacIndex
#Using the general detector class and calling with an index
d = Detector()
fpga_temp = d.getTemperature(dacIndex.TEMPERATURE_FPGA)
print(f'fpga_temp: {fpga_temp}\n')
#Using the specialized detector class
e = Eiger()
print("All temperatures for Eiger\n")
print(e.temp)
# >>> e.temp
# temp_fpga : 54°C 60°C
# temp_fpgaext : 49°C 52°C
# temp_10ge : 47°C 45°C
# temp_dcdc : 52°C 53°C
# temp_sodl : 51°C 53°C
# temp_sodl : 51°C 51°C
# temp_fpgafl : 45°C 49°C
# temp_fpgafr : 39°C 42°C
# The temperatures can also be returned in a dictionary
t = e.temp.to_dict()
print(t)
# >>> e.temp.to_dict()
# {'fpga': array([55, 60]), 'fpgaext': array([49, 52]),
# 't10ge': array([47, 45]), 'dcdc': array([52, 53]),
# 'sodl': array([51, 53]), 'sodr': array([51, 51]), '
# temp_fpgafl': array([45, 49]),
# 'temp_fpgafr': array([39, 42])}
# or in a numpy array
t = e.temp.to_array()
print(t)
# >>> e.temp.to_array()
# array([[55, 60],
# [49, 52],
# [47, 45],
# [52, 53],
# [51, 53],
# [51, 51],
# [45, 49],
# [40, 43]])

View File

@ -0,0 +1,8 @@
from slsdet import Eiger
d = Eiger()
threshold = range(0, 2000, 200)
for th in threshold:
print(f'{th=}')
d.vthreshold = th
d.acquire()

View File

@ -0,0 +1,20 @@
# Most settings are represented as enums that can be
# explicitly imported
from slsdet import Detector, fileFormat
d = Detector()
d.fformat = fileFormat.BINARY
# Altough not recommended for convenience all enums
# and some other things can be impored using *
from slsdet import *
d.speed = speedLevel.FULL_SPEED
# To list the available enums, use dir()
import slsdet.enums
for enum in dir(slsdet.enums):
# filter out special memebers
if not enum.startswith('_'):
print(enum)

View File

@ -3,13 +3,15 @@ import sys
import numpy as np import numpy as np
sys.path.append(os.path.join(os.getcwd(), 'bin')) sys.path.append(os.path.join(os.getcwd(), 'bin'))
from slsdet import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb from slsdet import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb, Gotthard2, Moench
from slsdet import dacIndex, readoutMode from slsdet import dacIndex, readoutMode
from slsdet.lookup import view, find from slsdet.lookup import view, find
d = Detector() d = Detector()
# e = Eiger() e = Eiger()
c = Ctb() c = Ctb()
g = Gotthard2()
# j = Jungfrau() # j = Jungfrau()
# m = Mythen3() # m = Mythen3()
m = Moench()

View File

@ -15,8 +15,80 @@ pycmd += ['vrf', 'vtr', 'vrs', 'vtgstv', 'vsvn', 'vtrim',
'vpreamp', 'vref_comp', 'vref_comp_fe vref_ds', 'vref_h_adc', 'vpreamp', 'vref_comp', 'vref_comp_fe vref_ds', 'vref_h_adc',
'vref_l_adc', 'iodelay', 'list', 'vref_ds', 'vis', 'vpl', 'vref_l_adc', 'iodelay', 'list', 'vref_ds', 'vis', 'vpl',
'vref_comp_fe', 'vph', 'vout_cm', 'vcp', 'vcn', 'vcmp_ll', 'vcmp_lr' 'vref_comp_fe', 'vph', 'vout_cm', 'vcp', 'vcn', 'vcmp_ll', 'vcmp_lr'
, 'vcmp_rl', 'vcmp_rr', 'daclist', 'dacvalues', 'vcal', 'vcas']
]
# dacs are in general not included in the python commands and we expect to
# set them from the specialized class or using an enum
dacs = [
'vicin',
'vcassh',
'vcal_n',
'vcal_p'
'vipre_out',
'vipre_cds',
'vdd_prot',
'vcmp_rl',
'vcmp_rr',
'vcal', 'vcas',
'vipre',
'vin_com',
'vin_cm',
'vrshaper',
'vrshaper_n',
'vrpreamp',
'vishaper',
'vipre_out',
'vcom_adc1',
'vcom_adc2',
'vcom_cds',
'vdcsh',
'v_chip',
'vb_comp',
'vb_comp_adc',
'vb_comp_fe',
'vb_cs',
'vb_ds',
'vb_opa_1st',
'vb_opa_fd',
'vb_pixbuf',
'vb_sda',
'vbp_colbuf',
'vcal_p',
'vcasc_out',
'vcasc_sfp',
'vcascn_pb',
'vcascp_pb',
'vchip_comp_adc',
'vchip_comp_fe',
'vchip_cs',
'vchip_opa_1st',
'vchip_opa_fd',
'vchip_ref_comp_fe',
]
intentionally_missing = [
'temp_10ge', #temperatures already available from enum or specialized class
'temp_adc',
'temp_dcdc',
'temp_fpga',
'temp_fpgaext',
'temp_fpgafl',
'temp_fpgafr',
'temp_slowadc',
'temp_sodl',
'temp_sodr',
'trigger', #use sendSoftwareTrigger
'update', #use updateServerAndFirmare
'udp_validate', #use validateUdpConfiguration
'udp_reconfigure', #use reconfigureUdpDestination
'emin', #use rx_jsonpara
]
pycmd += intentionally_missing
pycmd += dacs
missing = [] missing = []
for c in cmd: for c in cmd:
if c not in pycmd: if c not in pycmd:

View File

@ -5,32 +5,34 @@ from .dacs import DetectorDacs, Dac
from .detector import Detector from .detector import Detector
from .jungfrau import Jungfrau from .jungfrau import Jungfrau
from .mythen3 import Mythen3 from .mythen3 import Mythen3
from .gotthard2 import Gotthard2
from .gotthard import Gotthard
from .moench import Moench
# from .jungfrau_ctb import JungfrauCTB # from .jungfrau_ctb import JungfrauCTB
# from _slsdet import DetectorApi # from _slsdet import DetectorApi
import _slsdet import _slsdet
defs = _slsdet.slsDetectorDefs defs = _slsdet.slsDetectorDefs
runStatus = _slsdet.slsDetectorDefs.runStatus
speedLevel = _slsdet.slsDetectorDefs.speedLevel
from .enums import *
detectorType = _slsdet.slsDetectorDefs.detectorType # runStatus = _slsdet.slsDetectorDefs.runStatus
frameDiscardPolicy = _slsdet.slsDetectorDefs.frameDiscardPolicy # speedLevel = _slsdet.slsDetectorDefs.speedLevel
fileFormat = _slsdet.slsDetectorDefs.fileFormat # detectorType = _slsdet.slsDetectorDefs.detectorType
dimension = _slsdet.slsDetectorDefs.dimension # frameDiscardPolicy = _slsdet.slsDetectorDefs.frameDiscardPolicy
externalSignalFlag = _slsdet.slsDetectorDefs.externalSignalFlag # fileFormat = _slsdet.slsDetectorDefs.fileFormat
timingMode = _slsdet.slsDetectorDefs.timingMode # dimension = _slsdet.slsDetectorDefs.dimension
dacIndex = _slsdet.slsDetectorDefs.dacIndex # externalSignalFlag = _slsdet.slsDetectorDefs.externalSignalFlag
detectorSettings = _slsdet.slsDetectorDefs.detectorSettings # timingMode = _slsdet.slsDetectorDefs.timingMode
clockIndex = _slsdet.slsDetectorDefs.clockIndex # dacIndex = _slsdet.slsDetectorDefs.dacIndex
readoutMode = _slsdet.slsDetectorDefs.readoutMode # detectorSettings = _slsdet.slsDetectorDefs.detectorSettings
masterFlags = _slsdet.slsDetectorDefs.masterFlags # clockIndex = _slsdet.slsDetectorDefs.clockIndex
# readoutMode = _slsdet.slsDetectorDefs.readoutMode
frameModeType = _slsdet.slsDetectorDefs.frameModeType # masterFlags = _slsdet.slsDetectorDefs.masterFlags
detectorModeType = _slsdet.slsDetectorDefs.detectorModeType # frameModeType = _slsdet.slsDetectorDefs.frameModeType
burstMode = _slsdet.slsDetectorDefs.burstMode # detectorModeType = _slsdet.slsDetectorDefs.detectorModeType
timingSourceType = _slsdet.slsDetectorDefs.timingSourceType # burstMode = _slsdet.slsDetectorDefs.burstMode
# timingSourceType = _slsdet.slsDetectorDefs.timingSourceType
IpAddr = _slsdet.IpAddr IpAddr = _slsdet.IpAddr

View File

@ -1,23 +1,33 @@
from functools import partial from functools import partial
class Adc: class Adc:
def __init__(self, name, detector): def __init__(self, name, enum, detector):
self.name = name self.name = name
self.enum = enum
self._detector = detector self._detector = detector
self.get_nmod = self._detector._api.getNumberOfDetectors self.get_nmod = self._detector.size
# Bind functions to get and set the dac # Bind functions to get and set the dac
self.get = partial(self._detector._api.getAdc, self.name) self.get = partial(self._detector.getAdc, self.enum)
def __getitem__(self, key): def __getitem__(self, key):
"""
Get dacs either by slice, key or list
"""
if key == slice(None, None, None): if key == slice(None, None, None):
return [self.get(i) / 1000 for i in range(self.get_nmod())] return self.get()
elif isinstance(key, Iterable): elif isinstance(key, Iterable):
return [self.get(k) / 1000 for k in key] return self.get(list(key))
else: else:
return self.get(key) / 1000 return self.get([key])[0] #No list for single value
# def __getitem__(self, key):
# """
# Get dacs either by slice, key or list
# """
# if key == slice(None, None, None):
# return [self.get(i) / 1000 for i in range(self.get_nmod())]
# elif isinstance(key, Iterable):
# return [self.get(k) / 1000 for k in key]
# else:
# return self.get(key) / 1000
def __repr__(self): def __repr__(self):
"""String representation for a single adc in all modules""" """String representation for a single adc in all modules"""

View File

@ -32,10 +32,9 @@ class Dac(DetectorProperty):
def __repr__(self): def __repr__(self):
"""String representation for a single dac in all modules""" """String representation for a single dac in all modules"""
dacstr = ''.join([f'{item:5d}' for item in self.get()]) dacstr = ''.join([f'{item:5d}' for item in self.get()])
return f'{self.__name__:10s}:{dacstr}' return f'{self.__name__:15s}:{dacstr}'
# a = Dac('vrf', dacIndex.VRF, 0, 4000, 2500, d )
# @freeze
class DetectorDacs: class DetectorDacs:
_dacs = [] _dacs = []
_dacnames = [_d[0] for _d in _dacs] _dacnames = [_d[0] for _d in _dacs]
@ -93,6 +92,9 @@ class DetectorDacs:
dac_array[i,:] = _d[:] dac_array[i,:] = _d[:]
return dac_array return dac_array
def to_array(self):
return self.get_asarray()
def set_from_array(self, dac_array): def set_from_array(self, dac_array):
""" """
Set the dacs from an numpy array with dac values. [ndacs, nmodules] Set the dacs from an numpy array with dac values. [ndacs, nmodules]
@ -101,6 +103,9 @@ class DetectorDacs:
for i, _d in enumerate(self): for i, _d in enumerate(self):
_d[:] = dac_array[i] _d[:] = dac_array[i]
def from_array(self, dac_array):
self.set_from_array(dac_array)
def set_default(self): def set_default(self):
""" """
Set all dacs to their default values Set all dacs to their default values

File diff suppressed because it is too large Load Diff

View File

@ -6,22 +6,17 @@ Created on Wed Dec 6 11:51:18 2017
@author: l_frojdh @author: l_frojdh
""" """
from .detector import Detector from .detector import Detector
from .temperature import Temperature, DetectorTemperature
# from .adcs import Adc, DetectorAdcs
from .dacs import DetectorDacs from .dacs import DetectorDacs
import _slsdet import _slsdet
dacIndex = _slsdet.slsDetectorDefs.dacIndex dacIndex = _slsdet.slsDetectorDefs.dacIndex
from .detector_property import DetectorProperty from .detector_property import DetectorProperty
# from .utils import element_if_equal
# from sls_detector.errors import DetectorValueError, DetectorError
class EigerVcmp: class EigerVcmp:
""" """
Convenience class to be able to loop over vcmp for Eiger Convenience class to be able to loop over vcmp for Eiger
.. todo:: .. todo::
Support single assignment and perhaps unify with Dac class Support single assignment and perhaps unify with Dac class
@ -79,58 +74,6 @@ class EigerDacs(DetectorDacs):
('iodelay', dacIndex.IO_DELAY,0, 4000, 660)] ('iodelay', dacIndex.IO_DELAY,0, 4000, 660)]
_dacnames = [_d[0] for _d in _dacs] _dacnames = [_d[0] for _d in _dacs]
# # noinspection PyProtectedMember
# class DetectorDelays:
# _delaynames = ['frame', 'left', 'right']
# def __init__(self, detector):
# # We need to at least initially know which detector we are connected to
# self._detector = detector
# setattr(self, '_frame', DetectorProperty(detector._api.getDelayFrame,
# detector._api.setDelayFrame,
# detector._api.getNumberOfDetectors,
# 'frame'))
# setattr(self, '_left', DetectorProperty(detector._api.getDelayLeft,
# detector._api.setDelayLeft,
# detector._api.getNumberOfDetectors,
# 'left'))
# setattr(self, '_right', DetectorProperty(detector._api.getDelayRight,
# detector._api.setDelayRight,
# detector._api.getNumberOfDetectors,
# 'right'))
# # Index to support iteration
# self._current = 0
# def __getattr__(self, name):
# return self.__getattribute__('_' + name)
# def __setattr__(self, name, value):
# if name in self._delaynames:
# return self.__getattribute__('_' + name).__setitem__(slice(None, None, None), value)
# else:
# super().__setattr__(name, value)
# def __next__(self):
# if self._current >= len(self._delaynames):
# self._current = 0
# raise StopIteration
# else:
# self._current += 1
# return self.__getattr__(self._delaynames[self._current-1])
# def __iter__(self):
# return self
# def __repr__(self):
# hn = self._detector.hostname
# r_str = ['Transmission delay [ns]\n'
# '{:11s}{:>8s}{:>8s}{:>8s}'.format('', 'left', 'right', 'frame')]
# for i in range(self._detector.n_modules):
# r_str.append('{:2d}:{:8s}{:>8d}{:>8d}{:>8d}'.format(i, hn[i], self.left[i], self.right[i], self.frame[i]))
# return '\n'.join(r_str)
from .detector import freeze from .detector import freeze
@ -152,76 +95,18 @@ class Eiger(Detector):
self._dacs = EigerDacs(self) self._dacs = EigerDacs(self)
self._vcmp = EigerVcmp(self) self._vcmp = EigerVcmp(self)
# self._active = DetectorProperty(self.getActive, # Eiger specific adcs
# self.setActive, self._temp = DetectorTemperature()
# self.size, self._temp.fpga = Temperature('temp_fpga', dacIndex.TEMPERATURE_FPGA, self)
# 'active') self._temp.fpgaext = Temperature('temp_fpgaext', dacIndex.TEMPERATURE_FPGAEXT, self)
self._temp.t10ge = Temperature('temp_10ge', dacIndex.TEMPERATURE_10GE, self)
self._temp.dcdc = Temperature('temp_dcdc', dacIndex.TEMPERATURE_DCDC, self)
self._temp.sodl = Temperature('temp_sodl', dacIndex.TEMPERATURE_SODL, self)
self._temp.sodr = Temperature('temp_sodl', dacIndex.TEMPERATURE_SODR, self)
self._temp.temp_fpgafl = Temperature('temp_fpgafl', dacIndex.TEMPERATURE_FPGA2, self)
self._temp.temp_fpgafr = Temperature('temp_fpgafr', dacIndex.TEMPERATURE_FPGA3, self)
# self._trimbit_limits = namedtuple('trimbit_limits', ['min', 'max'])(0, 63)
# self._delay = DetectorDelays(self)
# # Eiger specific adcs
# self._temp = DetectorAdcs()
# self._temp.fpga = Adc('temp_fpga', self)
# self._temp.fpgaext = Adc('temp_fpgaext', self)
# self._temp.t10ge = Adc('temp_10ge', self)
# self._temp.dcdc = Adc('temp_dcdc', self)
# self._temp.sodl = Adc('temp_sodl', self)
# self._temp.sodr = Adc('temp_sodr', self)
# self._temp.fpgafl = Adc('temp_fpgafl', self)
# self._temp.fpgafr = Adc('temp_fpgafr', self)
# @property
# def active(self):
# """
# Is the detector active? Can be used to enable or disable a detector
# module
# Examples
# ----------
# ::
# d.active
# >> active: [True, True]
# d.active[1] = False
# >> active: [True, False]
# """
# return self._active
# @active.setter
# def active(self, value):
# self._active[:] = value
# @property
# def measured_period(self):
# return self._api.getMeasuredPeriod()
# @property
# def measured_subperiod(self):
# return self._api.getMeasuredSubPeriod()
# @property
# def add_gappixels(self):
# """Enable or disable the (virual) pixels between ASICs
# Examples
# ----------
# ::
# d.add_gappixels = True
# d.add_gappixels
# >> True
# """
# return self._api.getGapPixels()
# @add_gappixels.setter
# def add_gappixels(self, value):
# self._api.setGapPixels(value)
@property @property
def dacs(self): def dacs(self):
@ -284,68 +169,6 @@ class Eiger(Detector):
""" """
return self._dacs return self._dacs
# @property
# def tx_delay(self):
# """
# Transmission delay of the modules to allow running the detector
# in a network not supporting the full speed of the detector.
# ::
# d.tx_delay
# >>
# Transmission delay [ns]
# left right frame
# 0:beb048 0 15000 0
# 1:beb049 100 190000 100
# d.tx_delay.left = [2000,5000]
# """
# return self._delay
# def pulse_all_pixels(self, n):
# """
# Pulse each pixel of the chip **n** times using the analog test pulses.
# The pulse height is set using d.dacs.vcall with 4000 being 0 and 0 being
# the highest pulse.
# ::
# #Pulse all pixels ten times
# d.pulse_all_pixels(10)
# #Avoid resetting before acq
# d.eiger_matrix_reset = False
# d.acq() #take frame
# #Restore normal behaviour
# d.eiger_matrix_reset = True
# """
# self._api.pulseAllPixels(n)
# def pulse_diagonal(self, n):
# """
# Pulse pixels in super colums in a diagonal fashion. Used for calibration
# of vcall. Saves time compared to pulsing all pixels.
# """
# self._api.pulseDiagonal(n)
# def pulse_chip(self, n):
# """
# Advance the counter by toggling enable. Gives 2*n+2 int the counter
# """
# n = int(n)
# if n >= -1:
# self._api.pulseChip(n)
# else:
# raise ValueError('n must be equal or larger than -1')
@property @property
def vcmp(self): def vcmp(self):
@ -437,40 +260,33 @@ class Eiger(Detector):
# else: # else:
# self._api.setReceiverStreamingPort(port, -1) # self._api.setReceiverStreamingPort(port, -1)
# @property @property
# def temp(self): def temp(self):
# """ """
# An instance of DetectorAdcs used to read the temperature An instance of DetectorAdcs used to read the temperature
# of different components of different components
# Examples Examples
# ----------- -----------
# :: ::
# detector.temp detector.temp
# >> >>
# temp_fpga : 36.90°C, 45.60°C temp_fpga : 36.90°C, 45.60°C
# temp_fpgaext : 31.50°C, 32.50°C temp_fpgaext : 31.50°C, 32.50°C
# temp_10ge : 0.00°C, 0.00°C temp_10ge : 0.00°C, 0.00°C
# temp_dcdc : 36.00°C, 36.00°C temp_dcdc : 36.00°C, 36.00°C
# temp_sodl : 33.00°C, 34.50°C temp_sodl : 33.00°C, 34.50°C
# temp_sodr : 33.50°C, 34.00°C temp_sodr : 33.50°C, 34.00°C
# temp_fpgafl : 33.81°C, 30.93°C temp_fpgafl : 33.81°C, 30.93°C
# temp_fpgafr : 27.88°C, 29.15°C temp_fpgafr : 27.88°C, 29.15°C
# a = detector.temp.fpga[:] a = detector.temp.fpga[:]
# a a
# >> [36.568, 45.542] >> [36.568, 45.542]
# """ """
# return self._temp return self._temp
# def set_delays(self, delta):
# self.tx_delay.left = [delta*(i*2) for i in range(self.n_modules)]
# self.tx_delay.right = [delta*(i*2+1) for i in range(self.n_modules)]

19
python/slsdet/enums.py Normal file
View File

@ -0,0 +1,19 @@
import _slsdet
runStatus = _slsdet.slsDetectorDefs.runStatus
speedLevel = _slsdet.slsDetectorDefs.speedLevel
detectorType = _slsdet.slsDetectorDefs.detectorType
frameDiscardPolicy = _slsdet.slsDetectorDefs.frameDiscardPolicy
fileFormat = _slsdet.slsDetectorDefs.fileFormat
dimension = _slsdet.slsDetectorDefs.dimension
externalSignalFlag = _slsdet.slsDetectorDefs.externalSignalFlag
timingMode = _slsdet.slsDetectorDefs.timingMode
dacIndex = _slsdet.slsDetectorDefs.dacIndex
detectorSettings = _slsdet.slsDetectorDefs.detectorSettings
clockIndex = _slsdet.slsDetectorDefs.clockIndex
readoutMode = _slsdet.slsDetectorDefs.readoutMode
masterFlags = _slsdet.slsDetectorDefs.masterFlags
frameModeType = _slsdet.slsDetectorDefs.frameModeType
detectorModeType = _slsdet.slsDetectorDefs.detectorModeType
burstMode = _slsdet.slsDetectorDefs.burstMode
timingSourceType = _slsdet.slsDetectorDefs.timingSourceType

51
python/slsdet/gotthard.py Normal file
View File

@ -0,0 +1,51 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This file contains the specialization for the Moench detector
"""
from .detector import Detector, freeze
from .dacs import DetectorDacs
import _slsdet
dacIndex = _slsdet.slsDetectorDefs.dacIndex
from .detector_property import DetectorProperty
# @freeze
# vref_ds, vcascn_pb, vcascp_pb, vout_cm, vcasc_out, vin_cm, vref_comp, ib_test_c
class GotthardDacs(DetectorDacs):
_dacs = [('vref_ds', dacIndex.VREF_DS, 0, 4000, 660),
('vcascn_pb', dacIndex.VCASCN_PB, 0, 4000, 650),
('vcascp_pb,', dacIndex.VCASCP_PB, 0, 4000, 1480),
('vout_cm', dacIndex.VOUT_CM, 0, 4000, 1520),
('vcasc_out', dacIndex.VCASC_OUT, 0, 4000, 1320),
('vin_cm', dacIndex.VIN_CM, 0, 4000, 1350),
('vref_comp', dacIndex.VREF_COMP, 0, 4000, 350),
('ib_test_c', dacIndex.IB_TESTC, 0, 4000, 2001),
]
_dacnames = [_d[0] for _d in _dacs]
#vthreshold??
@freeze
class Gotthard(Detector):
"""
Subclassing Detector to set up correct dacs and detector specific
functions.
"""
_detector_dynamic_range = [16]
_settings = ['standard', 'highgain', 'lowgain', 'veryhighgain', 'verylowgain']
"""available settings for Eiger, note almost always standard"""
def __init__(self, id=0):
super().__init__(id)
self._frozen = False
self._dacs = GotthardDacs(self)
@property
def dacs(self):
return self._dacs

View File

@ -0,0 +1,61 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This file contains the specialization for the Jungfrau detector
"""
from .detector import Detector, freeze
# from .adcs import Adc, DetectorAdcs
from .dacs import DetectorDacs
import _slsdet
dacIndex = _slsdet.slsDetectorDefs.dacIndex
from .detector_property import DetectorProperty
# @freeze
class Gotthard2Dacs(DetectorDacs):
"""
Gotthard2 specific DACs
"""
_dacs = [('vref_h_adc', dacIndex.VREF_H_ADC, 0, 4000, 2116),
('vb_comp_fe', dacIndex.VB_COMP_FE, 0, 4000, 0),
('vb_comp_adc', dacIndex.VB_COMP_ADC, 0, 4000, 0),
('vcom_cds', dacIndex.VCOM_CDS, 0, 4000, 705),
('vref_rstore', dacIndex.VREF_RSTORE, 0, 4000, 205),
('vb_opa_1st', dacIndex.VB_OPA_1ST, 0, 4000, 0),
('vref_comp_fe', dacIndex.VREF_COMP_FE, 0, 4000, 0),
('vcom_adc1', dacIndex.VCOM_ADC1, 0, 4000, 705),
('vref_prech', dacIndex.VREF_PRECH, 0, 4000, 900),
('vref_l_adc', dacIndex.VREF_L_ADC, 0, 4000, 700),
('vref_cds', dacIndex.VREF_CDS, 0, 4000, 600),
('vb_cs', dacIndex.VB_CS, 0, 4000, 2799),
('vb_opa_fd', dacIndex.VB_OPA_FD, 0, 4000, 0),
('vcom_adc2', dacIndex.VCOM_ADC2, 0, 4000, 704),
]
_dacnames = [_d[0] for _d in _dacs]
@freeze
class Gotthard2(Detector):
"""
Subclassing Detector to set up correct dacs and detector specific
functions.
"""
_detector_dynamic_range = [16]
_settings = ['standard', 'highgain', 'lowgain', 'veryhighgain', 'verylowgain']
"""available settings for Eiger, note almost always standard"""
def __init__(self, id=0):
super().__init__(id)
self._frozen = False
self._dacs = Gotthard2Dacs(self)
@property
def dacs(self):
return self._dacs

View File

@ -0,0 +1,30 @@
from .utils import element_if_equal
class JsonProxy:
"""
Proxy class to allow for intuitive setting and getting of rx_jsonpara
This class is returned by Detectr.rx_jsonpara
"""
def __init__(self, det):
self.det = det
def __getitem__(self, key):
return element_if_equal(self.det.getAdditionalJsonParameter(key))
def __setitem__(self, key, value):
self.det.setAdditionalJsonParameter(key, str(value))
def __repr__(self):
r = element_if_equal(self.det.getAdditionalJsonHeader())
if isinstance(r, list):
rstr = ''
for i, list_item in enumerate(r):
list_item = dict(list_item)
rstr += ''.join([f'{i}:{key}: {value}\n' for key, value in list_item.items()])
return rstr.strip('\n')
else:
r = dict(r)
return '\n'.join([f'{key}: {value}' for key, value in r.items()])

52
python/slsdet/moench.py Normal file
View File

@ -0,0 +1,52 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This file contains the specialization for the Moench detector
"""
from .detector import Detector, freeze
from .dacs import DetectorDacs
import _slsdet
dacIndex = _slsdet.slsDetectorDefs.dacIndex
from .detector_property import DetectorProperty
# @freeze
class MoenchDacs(DetectorDacs):
"""
Jungfrau specific DACs
"""
_dacs = [('vbp_colbuf', dacIndex.VBP_COLBUF, 0, 4000, 1300),
('vipre', dacIndex.VIPRE, 0, 4000, 1000),
('vin_cm,', dacIndex.VIN_CM, 0, 4000, 1400),
('vb_sda', dacIndex.VB_SDA, 0, 4000, 680),
('vcasc_sfp', dacIndex.VCASC_SFP, 0, 4000, 1428),
('vout_cm', dacIndex.VOUT_CM, 0, 4000, 1200),
('vipre_cds', dacIndex.VIPRE_CDS, 0, 4000, 800),
('ibias_sfp', dacIndex.IBIAS_SFP, 0, 4000, 900),
]
_dacnames = [_d[0] for _d in _dacs]
#vthreshold??
@freeze
class Moench(Detector):
"""
Subclassing Detector to set up correct dacs and detector specific
functions.
"""
_detector_dynamic_range = [16]
_settings = ['standard', 'highgain', 'lowgain', 'veryhighgain', 'verylowgain']
"""available settings for Eiger, note almost always standard"""
def __init__(self, id=0):
super().__init__(id)
self._frozen = False
self._dacs = MoenchDacs(self)
@property
def dacs(self):
return self._dacs

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
This file contains the specialization for the Jungfrau detector This file contains the specialization for the Mythen3 detector
""" """

View File

@ -0,0 +1,50 @@
from functools import partial
from collections.abc import Iterable
import numpy as np
class Temperature:
degree_sign = u"\N{DEGREE SIGN}"
def __init__(self, name, enum, detector):
self.name = name
self.enum = enum
self._detector = detector
self.get_nmod = self._detector.size
# Bind functions to get and set the dac
self.get = partial(self._detector.getTemperature, self.enum)
def __getitem__(self, key):
if key == slice(None, None, None):
return self.get()
elif isinstance(key, Iterable):
return self.get(list(key))
else:
return self.get([key])[0] # No list for single value
def __repr__(self):
"""String representation for a single temperature in all modules"""
tempstr = ''.join([f'{item:5d}{self.degree_sign}C' for item in self.get()])
return f'{self.name:15s}:{tempstr}'
class DetectorTemperature:
"""
Interface to temperatures on the readout board
"""
def __iter__(self):
for attr, value in self.__dict__.items():
yield value
def __repr__(self):
"""String representation of all temps all mods"""
r_str = '\n'.join([repr(temp) for temp in self])
return r_str
def to_dict(self):
"""Get temperatures as a dictionary with numpy arrays"""
return {attr:np.array(value.get()) for attr, value in self.__dict__.items()}
def to_array(self):
"""Get all temperatures as a numpy array"""
t = self.to_dict()
return np.vstack([value for key, value in t.items()])

View File

@ -8,6 +8,8 @@ from collections import namedtuple
import _slsdet #C++ lib import _slsdet #C++ lib
import functools import functools
import datetime as dt import datetime as dt
import pathlib
import os
Geometry = namedtuple('Geometry', ['x', 'y']) Geometry = namedtuple('Geometry', ['x', 'y'])
@ -77,6 +79,7 @@ def element(func):
return element_if_equal(func(self, *args, **kwargs)) return element_if_equal(func(self, *args, **kwargs))
return wrapper return wrapper
def eiger_register_to_time(register): def eiger_register_to_time(register):
""" """
Decode register value and return time in s. Values are stored in Decode register value and return time in s. Values are stored in
@ -93,3 +96,34 @@ def make_timedelta(t):
return t return t
else: else:
return dt.timedelta(seconds=t) return dt.timedelta(seconds=t)
def make_string_path(path):
"""
Accepts either a pathlib.Path or a string, expands ~ to user and convert
Path to str
"""
if isinstance(path, pathlib.Path):
return path.expanduser().as_posix()
elif isinstance(path, str):
return os.path.expanduser(path)
else:
raise ValueError("Cannot convert argument to posix path")
def set_using_dict(func, args):
if isinstance(args, dict):
for key, value in args.items():
func(value, [key])
else:
func(args)
def set_time_using_dict(func, args):
if isinstance(args, dict):
for key, value in args.items():
if isinstance(value, int):
value = float(value)
func(value, [key])
else:
if isinstance(args, int):
args = float(args)
func(args)

View File

@ -36,6 +36,10 @@ void init_det(py::module &m) {
(void (Detector::*)(const std::string &)) & (void (Detector::*)(const std::string &)) &
Detector::loadParameters, Detector::loadParameters,
py::arg()) py::arg())
.def("loadParameters",
(void (Detector::*)(const std::vector<std::string> &)) &
Detector::loadParameters,
py::arg())
.def("getHostname", .def("getHostname",
(Result<std::string>(Detector::*)(sls::Positions) const) & (Result<std::string>(Detector::*)(sls::Positions) const) &
Detector::getHostname, Detector::getHostname,
@ -180,6 +184,14 @@ void init_det(py::module &m) {
(Result<sls::ns>(Detector::*)(sls::Positions) const) & (Result<sls::ns>(Detector::*)(sls::Positions) const) &
Detector::getDelayAfterTriggerLeft, Detector::getDelayAfterTriggerLeft,
py::arg() = Positions{}) py::arg() = Positions{})
.def("getDynamicRange",
(Result<int>(Detector::*)(sls::Positions) const) &
Detector::getDynamicRange,
py::arg() = Positions{})
.def("setDynamicRange",
(void (Detector::*)(int)) & Detector::setDynamicRange, py::arg())
.def("getDynamicRangeList", (std::vector<int>(Detector::*)() const) &
Detector::getDynamicRangeList)
.def("getTimingMode", .def("getTimingMode",
(Result<defs::timingMode>(Detector::*)(sls::Positions) const) & (Result<defs::timingMode>(Detector::*)(sls::Positions) const) &
Detector::getTimingMode, Detector::getTimingMode,
@ -188,6 +200,9 @@ void init_det(py::module &m) {
(void (Detector::*)(defs::timingMode, sls::Positions)) & (void (Detector::*)(defs::timingMode, sls::Positions)) &
Detector::setTimingMode, Detector::setTimingMode,
py::arg(), py::arg() = Positions{}) py::arg(), py::arg() = Positions{})
.def("getTimingModeList",
(std::vector<defs::timingMode>(Detector::*)() const) &
Detector::getTimingModeList)
.def("getSpeed", .def("getSpeed",
(Result<defs::speedLevel>(Detector::*)(sls::Positions) const) & (Result<defs::speedLevel>(Detector::*)(sls::Positions) const) &
Detector::getSpeed, Detector::getSpeed,
@ -294,6 +309,9 @@ void init_det(py::module &m) {
(void (Detector::*)(const int, sls::Positions)) & (void (Detector::*)(const int, sls::Positions)) &
Detector::setImageTestMode, Detector::setImageTestMode,
py::arg(), py::arg() = Positions{}) py::arg(), py::arg() = Positions{})
.def("getTemperatureList",
(std::vector<defs::dacIndex>(Detector::*)() const) &
Detector::getTemperatureList)
.def("getTemperature", .def("getTemperature",
(Result<int>(Detector::*)(defs::dacIndex, sls::Positions) const) & (Result<int>(Detector::*)(defs::dacIndex, sls::Positions) const) &
Detector::getTemperature, Detector::getTemperature,
@ -364,6 +382,18 @@ void init_det(py::module &m) {
(void (Detector::*)(sls::Positions)) & (void (Detector::*)(sls::Positions)) &
Detector::sendSoftwareTrigger, Detector::sendSoftwareTrigger,
py::arg() = Positions{}) py::arg() = Positions{})
.def("getScan",
(Result<defs::scanParameters>(Detector::*)(sls::Positions) const) &
Detector::getScan,
py::arg() = Positions{})
.def("setScan",
(void (Detector::*)(const defs::scanParameters)) &
Detector::setScan,
py::arg())
.def("getScanErrorMessage",
(Result<std::string>(Detector::*)(sls::Positions) const) &
Detector::getScanErrorMessage,
py::arg() = Positions{})
.def("getNumberofUDPInterfaces", .def("getNumberofUDPInterfaces",
(Result<int>(Detector::*)(sls::Positions) const) & (Result<int>(Detector::*)(sls::Positions) const) &
Detector::getNumberofUDPInterfaces, Detector::getNumberofUDPInterfaces,
@ -458,6 +488,14 @@ void init_det(py::module &m) {
.def("setDestinationUDPPort2", .def("setDestinationUDPPort2",
(void (Detector::*)(int, int)) & Detector::setDestinationUDPPort2, (void (Detector::*)(int, int)) & Detector::setDestinationUDPPort2,
py::arg(), py::arg()) py::arg(), py::arg())
.def("reconfigureUDPDestination",
(void (Detector::*)(sls::Positions)) &
Detector::reconfigureUDPDestination,
py::arg() = Positions{})
.def("validateUDPConfiguration",
(void (Detector::*)(sls::Positions)) &
Detector::validateUDPConfiguration,
py::arg() = Positions{})
.def("printRxConfiguration", .def("printRxConfiguration",
(Result<std::string>(Detector::*)(sls::Positions) const) & (Result<std::string>(Detector::*)(sls::Positions) const) &
Detector::printRxConfiguration, Detector::printRxConfiguration,
@ -670,6 +708,14 @@ void init_det(py::module &m) {
(void (Detector::*)(int, sls::Positions)) & (void (Detector::*)(int, sls::Positions)) &
Detector::setRxZmqTimer, Detector::setRxZmqTimer,
py::arg(), py::arg() = Positions{}) py::arg(), py::arg() = Positions{})
.def("getRxZmqStartingFrame",
(Result<int>(Detector::*)(sls::Positions) const) &
Detector::getRxZmqStartingFrame,
py::arg() = Positions{})
.def("setRxZmqStartingFrame",
(void (Detector::*)(int, sls::Positions)) &
Detector::setRxZmqStartingFrame,
py::arg(), py::arg() = Positions{})
.def("getRxZmqPort", .def("getRxZmqPort",
(Result<int>(Detector::*)(sls::Positions) const) & (Result<int>(Detector::*)(sls::Positions) const) &
Detector::getRxZmqPort, Detector::getRxZmqPort,
@ -700,12 +746,6 @@ void init_det(py::module &m) {
(void (Detector::*)(const sls::IpAddr, sls::Positions)) & (void (Detector::*)(const sls::IpAddr, sls::Positions)) &
Detector::setClientZmqIp, Detector::setClientZmqIp,
py::arg(), py::arg() = Positions{}) py::arg(), py::arg() = Positions{})
.def("getDynamicRange",
(Result<int>(Detector::*)(sls::Positions) const) &
Detector::getDynamicRange,
py::arg() = Positions{})
.def("setDynamicRange",
(void (Detector::*)(int)) & Detector::setDynamicRange, py::arg())
.def("getSubExptime", .def("getSubExptime",
(Result<sls::ns>(Detector::*)(sls::Positions) const) & (Result<sls::ns>(Detector::*)(sls::Positions) const) &
Detector::getSubExptime, Detector::getSubExptime,
@ -939,11 +979,11 @@ void init_det(py::module &m) {
(void (Detector::*)(const int, const int, sls::Positions)) & (void (Detector::*)(const int, const int, sls::Positions)) &
Detector::setInjectChannel, Detector::setInjectChannel,
py::arg(), py::arg(), py::arg() = Positions{}) py::arg(), py::arg(), py::arg() = Positions{})
.def( .def("getVetoPhoton",
"getVetoPhoton", (void (Detector::*)(const int, const std::string &,
(Result<std::vector<int>>(Detector::*)(const int, sls::Positions)) & sls::Positions)) &
Detector::getVetoPhoton, Detector::getVetoPhoton,
py::arg(), py::arg() = Positions{}) py::arg(), py::arg(), py::arg() = Positions{})
.def("setVetoPhoton", .def("setVetoPhoton",
(void (Detector::*)(const int, const int, const int, (void (Detector::*)(const int, const int, const int,
const std::string &, sls::Positions)) & const std::string &, sls::Positions)) &
@ -954,6 +994,11 @@ void init_det(py::module &m) {
(void (Detector::*)(const int, const int, sls::Positions)) & (void (Detector::*)(const int, const int, sls::Positions)) &
Detector::setVetoReference, Detector::setVetoReference,
py::arg(), py::arg(), py::arg() = Positions{}) py::arg(), py::arg(), py::arg() = Positions{})
.def("setVetoFile",
(void (Detector::*)(const int, const std::string &,
sls::Positions)) &
Detector::setVetoFile,
py::arg(), py::arg(), py::arg() = Positions{})
.def("getBurstMode", .def("getBurstMode",
(Result<defs::burstMode>(Detector::*)(sls::Positions)) & (Result<defs::burstMode>(Detector::*)(sls::Positions)) &
Detector::getBurstMode, Detector::getBurstMode,
@ -962,6 +1007,20 @@ void init_det(py::module &m) {
(void (Detector::*)(defs::burstMode, sls::Positions)) & (void (Detector::*)(defs::burstMode, sls::Positions)) &
Detector::setBurstMode, Detector::setBurstMode,
py::arg(), py::arg() = Positions{}) py::arg(), py::arg() = Positions{})
.def("getCDSGain",
(Result<bool>(Detector::*)(sls::Positions) const) &
Detector::getCDSGain,
py::arg() = Positions{})
.def("setCDSGain",
(void (Detector::*)(bool, sls::Positions)) & Detector::setCDSGain,
py::arg(), py::arg() = Positions{})
.def("getFilter",
(Result<int>(Detector::*)(sls::Positions) const) &
Detector::getFilter,
py::arg() = Positions{})
.def("setFilter",
(void (Detector::*)(int, sls::Positions)) & Detector::setFilter,
py::arg(), py::arg() = Positions{})
.def("getCurrentSource", .def("getCurrentSource",
(Result<bool>(Detector::*)(sls::Positions) const) & (Result<bool>(Detector::*)(sls::Positions) const) &
Detector::getCurrentSource, Detector::getCurrentSource,
@ -987,6 +1046,24 @@ void init_det(py::module &m) {
(void (Detector::*)(const bool, sls::Positions)) & (void (Detector::*)(const bool, sls::Positions)) &
Detector::setVeto, Detector::setVeto,
py::arg(), py::arg() = Positions{}) py::arg(), py::arg() = Positions{})
.def("getADCConfiguration",
(Result<int>(Detector::*)(const int, const int, sls::Positions)
const) &
Detector::getADCConfiguration,
py::arg(), py::arg(), py::arg() = Positions{})
.def("setADCConfiguration",
(void (Detector::*)(const int, const int, const int,
sls::Positions)) &
Detector::setADCConfiguration,
py::arg(), py::arg(), py::arg(), py::arg() = Positions{})
.def("getBadChannels",
(void (Detector::*)(const std::string &, sls::Positions) const) &
Detector::getBadChannels,
py::arg(), py::arg() = Positions{})
.def("setBadChannels",
(void (Detector::*)(const std::string &, sls::Positions)) &
Detector::setBadChannels,
py::arg(), py::arg() = Positions{})
.def("getCounterMask", .def("getCounterMask",
(Result<uint32_t>(Detector::*)(sls::Positions) const) & (Result<uint32_t>(Detector::*)(sls::Positions) const) &
Detector::getCounterMask, Detector::getCounterMask,

View File

@ -274,9 +274,12 @@ void init_enums(py::module &m) {
.export_values(); .export_values();
py::enum_<slsDetectorDefs::burstMode>(Defs, "burstMode") py::enum_<slsDetectorDefs::burstMode>(Defs, "burstMode")
.value("BURST_OFF", slsDetectorDefs::burstMode::BURST_OFF)
.value("BURST_INTERNAL", slsDetectorDefs::burstMode::BURST_INTERNAL) .value("BURST_INTERNAL", slsDetectorDefs::burstMode::BURST_INTERNAL)
.value("BURST_EXTERNAL", slsDetectorDefs::burstMode::BURST_EXTERNAL) .value("BURST_EXTERNAL", slsDetectorDefs::burstMode::BURST_EXTERNAL)
.value("CONTINUOUS_INTERNAL",
slsDetectorDefs::burstMode::CONTINUOUS_INTERNAL)
.value("CONTINUOUS_EXTERNAL",
slsDetectorDefs::burstMode::CONTINUOUS_EXTERNAL)
.value("NUM_BURST_MODES", slsDetectorDefs::burstMode::NUM_BURST_MODES) .value("NUM_BURST_MODES", slsDetectorDefs::burstMode::NUM_BURST_MODES)
.export_values(); .export_values();

View File

@ -7,6 +7,7 @@ Testing functions from utils.py
import pytest import pytest
from slsdet.utils import * from slsdet.utils import *
import datetime as dt import datetime as dt
import pathlib
def test_iterable(): def test_iterable():
assert is_iterable(5) == False assert is_iterable(5) == False
@ -94,3 +95,22 @@ def test_make_timedelta_from_timedelta():
r = make_timedelta(t) r = make_timedelta(t)
assert 60 == r.total_seconds() assert 60 == r.total_seconds()
assert r == dt.timedelta(minutes=1) assert r == dt.timedelta(minutes=1)
def test_make_string_path_from_Path():
pathstr = "/some/temp/path"
p = pathlib.Path(pathstr)
r = make_string_path(p)
assert isinstance(r, str)
assert r == p.as_posix()
assert r == pathstr
def test_make_string_path_expand_user():
pathstr = "~/tmp/virtual.config"
home = pathlib.Path.home()
expanded_str = pathstr.replace('~', home.as_posix())
p = pathlib.Path(pathstr)
rp = make_string_path(p)
rs = make_string_path(pathstr)
assert rp == expanded_str
assert rs == expanded_str

View File

@ -1,6 +1,6 @@
add_executable(using_logger using_logger.cpp) add_executable(using_logger using_logger.cpp)
target_link_libraries(using_logger target_link_libraries(using_logger
slsSupportLib slsSupportShared
pthread pthread
rt rt
) )
@ -22,7 +22,7 @@ set_target_properties(using_logger PROPERTIES
# add_executable(udp udp.cpp) # add_executable(udp udp.cpp)
# target_link_libraries(udp # target_link_libraries(udp
# slsDetectorShared # slsDetectorShared
# slsSupportLib # slsSupportShared
# pthread # pthread
# rt # rt
# fmt # fmt

View File

@ -23,7 +23,7 @@ foreach(exe ${MOENCH_EXECUTABLES})
target_link_libraries(${exe} target_link_libraries(${exe}
PUBLIC PUBLIC
slsSupportLib slsSupportShared
${ZeroMQ_LIBRARIES} ${ZeroMQ_LIBRARIES}
pthread pthread
tiff tiff

View File

@ -241,7 +241,7 @@ int main(int argc, char *argv[]) {
#endif #endif
if (zmqsocket->Connect()) { if (zmqsocket->Connect()) {
cprintf(RED, "Error: Could not connect to socket %s\n", cprintf(RED, "Error: Could not connect to socket %s\n",
zmqsocket->GetZmqServerAddress()); (zmqsocket->GetZmqServerAddress()).c_str());
delete zmqsocket; delete zmqsocket;
return EXIT_FAILURE; return EXIT_FAILURE;
} else } else
@ -281,12 +281,12 @@ int main(int argc, char *argv[]) {
#endif #endif
if (zmqsocket2->Connect()) { if (zmqsocket2->Connect()) {
cprintf(RED, "BBB Error: Could not connect to socket %s\n", cprintf(RED, "BBB Error: Could not connect to socket %s\n",
zmqsocket2->GetZmqServerAddress()); zmqsocket2->GetZmqServerAddress().c_str());
// delete zmqsocket2; // delete zmqsocket2;
send = false; send = false;
// return EXIT_FAILURE; // return EXIT_FAILURE;
} else } else
printf("Zmq Client at %s\n", zmqsocket2->GetZmqServerAddress()); printf("Zmq Client at %s\n", zmqsocket2->GetZmqServerAddress().c_str());
} }
@ -388,6 +388,7 @@ int main(int argc, char *argv[]) {
while (mt->isBusy()) {;}//wait until all data are processed from the queues while (mt->isBusy()) {;}//wait until all data are processed from the queues
if (of) { if (of) {
mt->setFilePointer(NULL);
fclose(of); fclose(of);
of=NULL; of=NULL;
} }

View File

@ -602,6 +602,7 @@ int *getClusters(char *data, int *ph=NULL) {
*/ */
static void writeClusters(FILE *f, single_photon_hit *cl, int nph, int fn=0){ static void writeClusters(FILE *f, single_photon_hit *cl, int nph, int fn=0){
if (f) {
if (nph>0) { if (nph>0) {
#ifndef OLDFORMAT #ifndef OLDFORMAT
if (fwrite((void*)&fn, 1, sizeof(int), f)) if (fwrite((void*)&fn, 1, sizeof(int), f))
@ -609,6 +610,7 @@ int *getClusters(char *data, int *ph=NULL) {
#endif #endif
for (int i=0; i<nph; i++) (cl+i)->write(f); for (int i=0; i<nph; i++) (cl+i)->write(f);
} }
}
}; };

View File

@ -88,6 +88,7 @@ target_include_directories(slsDetectorGui PUBLIC
) )
target_link_libraries(slsDetectorGui PUBLIC target_link_libraries(slsDetectorGui PUBLIC
slsProjectOptions
slsProjectWarnings slsProjectWarnings
slsDetectorShared slsDetectorShared
${QT_QTCORE_LIBRARIES} ${QT_QTCORE_LIBRARIES}
@ -97,6 +98,7 @@ target_link_libraries(slsDetectorGui PUBLIC
ZLIB::ZLIB ZLIB::ZLIB
Qt4::QtOpenGL Qt4::QtOpenGL
Qt4::QtSvg Qt4::QtSvg
expat
) )
set_target_properties(slsDetectorGui PROPERTIES set_target_properties(slsDetectorGui PROPERTIES
@ -104,10 +106,10 @@ set_target_properties(slsDetectorGui PROPERTIES
) )
install(TARGETS slsDetectorGui install(TARGETS slsDetectorGui
# EXPORT "${TARGETS_EXPORT_NAME}" EXPORT "${TARGETS_EXPORT_NAME}"
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
# ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
# PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} # PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
) )

View File

@ -52,6 +52,9 @@
<height>25</height> <height>25</height>
</size> </size>
</property> </property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="minimum"> <property name="minimum">
<double>-1.000000000000000</double> <double>-1.000000000000000</double>
</property> </property>

View File

@ -98,6 +98,9 @@
<height>25</height> <height>25</height>
</size> </size>
</property> </property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="minimum"> <property name="minimum">
<number>-1</number> <number>-1</number>
</property> </property>

View File

@ -413,129 +413,47 @@ Directory where one saves the data.
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="2" column="0">
<widget class="QGroupBox" name="boxCorrection_2">
<property name="title">
<string>Options</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
<widget class="QRadioButton" name="radioDefaultDeadtime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Default Dead Time</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="chkTenGiga">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Compression using Root. Available only for Gotthard in Expert Mode.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
#r_compression#
&lt;/nobr&gt;</string>
</property>
<property name="text">
<string>10GbE</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QSpinBox" name="spinCustomDeadTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="suffix">
<string>ns</string>
</property>
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>200000000</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QCheckBox" name="chkRate"> <spacer name="verticalSpacer">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Rate:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeType"> <property name="sizeType">
<enum>QSizePolicy::Fixed</enum> <enum>QSizePolicy::Fixed</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>10</width> <width>20</width>
<height>20</height> <height>10</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="1" column="3"> <item row="2" column="0">
<widget class="QRadioButton" name="radioCustomDeadtime"> <widget class="QGroupBox" name="boxCorrection_2">
<property name="title">
<string>Options</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="lblClkDivider">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="maximumSize">
<size>
<width>105</width>
<height>16777215</height>
</size>
</property>
<property name="text"> <property name="text">
<string>Custom Dead Time:</string> <string>Clock Divider:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="5"> <item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0" colspan="6">
<widget class="QWidget" name="widgetEiger" native="true">
<property name="enabled">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridEiger">
<item row="0" column="1">
<spacer name="horizontalSpacer_4"> <spacer name="horizontalSpacer_4">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -551,8 +469,11 @@ Compression using Root. Available only for Gotthard in Expert Mode.
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="0" column="2"> <item>
<widget class="QComboBox" name="comboEigerClkDivider"> <widget class="QComboBox" name="comboClkDivider">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
@ -582,8 +503,8 @@ Compression using Root. Available only for Gotthard in Expert Mode.
</item> </item>
</widget> </widget>
</item> </item>
<item row="1" column="4"> <item>
<spacer name="horizontalSpacer_6"> <spacer name="horizontalSpacer_8">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -598,80 +519,142 @@ Compression using Root. Available only for Gotthard in Expert Mode.
</property> </property>
</spacer> </spacer>
</item> </item>
</layout>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="lblEigerFlags"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="maximumSize">
<size>
<width>105</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Flags:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblClkDivider">
<property name="maximumSize">
<size>
<width>105</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Clock Divider:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QComboBox" name="comboEigerParallelFlag">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<item> <item>
<property name="text"> <widget class="QCheckBox" name="chkParallel">
<string>Parallel</string> <property name="enabled">
<bool>false</bool>
</property> </property>
</item>
<item>
<property name="text"> <property name="text">
<string>Non Parallel</string> <string>Parallel Readout</string>
</property> </property>
</item>
</widget> </widget>
</item> </item>
</layout> </layout>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="chkTenGiga">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Compression using Root. Available only for Gotthard in Expert Mode.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
#r_compression#
&lt;/nobr&gt;</string>
</property>
<property name="text">
<string>10GbE</string>
</property>
</widget> </widget>
</item> </item>
</layout> <item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="chkRate">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Rate:</string>
</property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item>
<spacer name="verticalSpacer"> <widget class="QRadioButton" name="radioDefaultDeadtime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Default Dead Time</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeType"> <property name="sizeType">
<enum>QSizePolicy::Fixed</enum> <enum>QSizePolicy::Fixed</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>10</width>
<height>10</height> <height>20</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<widget class="QRadioButton" name="radioCustomDeadtime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Custom Dead Time:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinCustomDeadTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="suffix">
<string>ns</string>
</property>
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>200000000</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<tabstops> <tabstops>
@ -680,12 +663,6 @@ Compression using Root. Available only for Gotthard in Expert Mode.
<tabstop>btnOutputBrowse</tabstop> <tabstop>btnOutputBrowse</tabstop>
<tabstop>comboFileFormat</tabstop> <tabstop>comboFileFormat</tabstop>
<tabstop>chkOverwriteEnable</tabstop> <tabstop>chkOverwriteEnable</tabstop>
<tabstop>chkTenGiga</tabstop>
<tabstop>chkRate</tabstop>
<tabstop>radioDefaultDeadtime</tabstop>
<tabstop>radioCustomDeadtime</tabstop>
<tabstop>spinCustomDeadTime</tabstop>
<tabstop>comboEigerClkDivider</tabstop>
</tabstops> </tabstops>
<resources> <resources>
<include location="../include/icons.qrc"/> <include location="../include/icons.qrc"/>

View File

@ -180,6 +180,9 @@
<property name="toolTip"> <property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.&lt;/p&gt;&lt;p&gt;-1 corresponds to different values from detectors.&lt;/p&gt;&lt;p&gt;#highvoltage#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.&lt;/p&gt;&lt;p&gt;-1 corresponds to different values from detectors.&lt;/p&gt;&lt;p&gt;#highvoltage#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="minimum"> <property name="minimum">
<number>-1</number> <number>-1</number>
</property> </property>

View File

@ -432,7 +432,7 @@
<property name="verticalSpacing"> <property name="verticalSpacing">
<number>4</number> <number>4</number>
</property> </property>
<item row="5" column="0"> <item row="6" column="0">
<widget class="QStackedWidget" name="stackedLblTriggerBurst"> <widget class="QStackedWidget" name="stackedLblTriggerBurst">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -503,7 +503,7 @@
</widget> </widget>
</widget> </widget>
</item> </item>
<item row="4" column="3"> <item row="5" column="3">
<widget class="QComboBox" name="comboPeriodUnit"> <widget class="QComboBox" name="comboPeriodUnit">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -572,7 +572,7 @@ Frame period between exposures.
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="2" colspan="2"> <item row="2" column="2" colspan="2">
<widget class="QSpinBox" name="spinNumMeasurements"> <widget class="QSpinBox" name="spinNumMeasurements">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -616,7 +616,7 @@ Frame period between exposures.
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
@ -674,7 +674,7 @@ Frame period between exposures.
</item> </item>
</widget> </widget>
</item> </item>
<item row="3" column="2"> <item row="4" column="2">
<widget class="QDoubleSpinBox" name="spinExpTime"> <widget class="QDoubleSpinBox" name="spinExpTime">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
@ -718,7 +718,7 @@ Exposure Time of a frame.
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="5" column="0">
<widget class="QLabel" name="lblPeriod"> <widget class="QLabel" name="lblPeriod">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -735,7 +735,7 @@ Frame period between exposures.
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="3" column="0">
<widget class="QLabel" name="lblNumFrames"> <widget class="QLabel" name="lblNumFrames">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -745,7 +745,7 @@ Frame period between exposures.
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="4" column="0">
<widget class="QLabel" name="lblExpTime"> <widget class="QLabel" name="lblExpTime">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
@ -762,7 +762,7 @@ Exposure Time of a frame.
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="2" colspan="2"> <item row="3" column="2" colspan="2">
<widget class="QSpinBox" name="spinNumFrames"> <widget class="QSpinBox" name="spinNumFrames">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -809,7 +809,7 @@ Exposure Time of a frame.
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="3"> <item row="4" column="3">
<widget class="QComboBox" name="comboExpUnit"> <widget class="QComboBox" name="comboExpUnit">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
@ -871,7 +871,7 @@ Exposure Time of a frame.
</item> </item>
</widget> </widget>
</item> </item>
<item row="4" column="2"> <item row="5" column="2">
<widget class="QDoubleSpinBox" name="spinPeriod"> <widget class="QDoubleSpinBox" name="spinPeriod">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -931,7 +931,7 @@ Frame period between exposures.
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="5" column="2"> <item row="6" column="2">
<widget class="QStackedWidget" name="stackedSpinTriggerBurst"> <widget class="QStackedWidget" name="stackedSpinTriggerBurst">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -1070,7 +1070,7 @@ Frame period between exposures.
</widget> </widget>
</widget> </widget>
</item> </item>
<item row="6" column="0"> <item row="7" column="0">
<widget class="QStackedWidget" name="stackedLblDelayBurstPeriod"> <widget class="QStackedWidget" name="stackedLblDelayBurstPeriod">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -1141,7 +1141,7 @@ Frame period between exposures.
</widget> </widget>
</widget> </widget>
</item> </item>
<item row="6" column="2"> <item row="7" column="2">
<widget class="QStackedWidget" name="stackedSpinDelayBurstPeriod"> <widget class="QStackedWidget" name="stackedSpinDelayBurstPeriod">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -1268,7 +1268,7 @@ Frame period between exposures.
</widget> </widget>
</widget> </widget>
</item> </item>
<item row="6" column="3"> <item row="7" column="3">
<widget class="QStackedWidget" name="stackedComboDelayBurstPeriod"> <widget class="QStackedWidget" name="stackedComboDelayBurstPeriod">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -1431,7 +1431,7 @@ Frame period between exposures.
</widget> </widget>
</widget> </widget>
</item> </item>
<item row="7" column="0"> <item row="8" column="0">
<widget class="QStackedWidget" name="stackedLblSamplesGates"> <widget class="QStackedWidget" name="stackedLblSamplesGates">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -1502,7 +1502,7 @@ Frame period between exposures.
</widget> </widget>
</widget> </widget>
</item> </item>
<item row="7" column="2"> <item row="8" column="2">
<widget class="QStackedWidget" name="stackedSpinSamplesGates"> <widget class="QStackedWidget" name="stackedSpinSamplesGates">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -1639,6 +1639,53 @@ Frame period between exposures.
</widget> </widget>
</widget> </widget>
</item> </item>
<item row="1" column="0">
<widget class="QLabel" name="lblBurstMode">
<property name="text">
<string>Burst Mode:</string>
</property>
</widget>
</item>
<item row="1" column="2" colspan="2">
<widget class="QComboBox" name="comboBurstMode">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>Timing Mode of the detector.
#timing#</string>
</property>
<item>
<property name="text">
<string>Burst Internal</string>
</property>
</item>
<item>
<property name="text">
<string>Burst External</string>
</property>
</item>
<item>
<property name="text">
<string>Continuous Internal</string>
</property>
</item>
<item>
<property name="text">
<string>Continuous External</string>
</property>
</item>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -2169,7 +2169,7 @@ Displays minimum, maximum and sum of values for each plot.
<item row="0" column="2"> <item row="0" column="2">
<widget class="QStackedWidget" name="stackedTimeInterval"> <widget class="QStackedWidget" name="stackedTimeInterval">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="pageTimeGap"> <widget class="QWidget" name="pageTimeGap">
<layout class="QHBoxLayout" name="horizontalLayout_14"> <layout class="QHBoxLayout" name="horizontalLayout_14">
@ -2181,6 +2181,9 @@ Displays minimum, maximum and sum of values for each plot.
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="decimals"> <property name="decimals">
<number>3</number> <number>3</number>
</property> </property>
@ -2249,6 +2252,9 @@ Displays minimum, maximum and sum of values for each plot.
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="minimum"> <property name="minimum">
<number>1</number> <number>1</number>
</property> </property>

View File

@ -19,7 +19,7 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
~qDrawPlot(); ~qDrawPlot();
bool GetIsRunning(); bool GetIsRunning();
void SetRunning(bool enable); void SetRunning(bool enable);
int GetProgress(); double GetProgress();
int64_t GetCurrentFrameIndex(); int64_t GetCurrentFrameIndex();
void Select1dPlot(bool enable); void Select1dPlot(bool enable);
void SetPlotTitlePrefix(QString title); void SetPlotTitlePrefix(QString title);
@ -152,7 +152,7 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
bool disableZoom{false}; bool disableZoom{false};
int numDiscardBits{0}; int numDiscardBits{0};
int progress{0}; double progress{0};
int64_t currentFrame{0}; int64_t currentFrame{0};
mutable std::mutex mPlots; mutable std::mutex mPlots;
int64_t currentAcqIndex{0}; int64_t currentAcqIndex{0};

View File

@ -18,17 +18,24 @@ class qTabAdvanced : public QWidget, private Ui::TabAdvancedObject {
void SetDetector(); void SetDetector();
void SetControlPort(int port); void SetControlPort(int port);
void SetStopPort(int port); void SetStopPort(int port);
void SetDetectorUDPIP(); void SetDetectorUDPIP(bool force = false);
void SetDetectorUDPMAC(); void ForceSetDetectorUDPIP();
void SetDetectorUDPMAC(bool force = false);
void ForceSetDetectorUDPMAC();
void SetCltZMQPort(int port); void SetCltZMQPort(int port);
void SetCltZMQIP(); void SetCltZMQIP(bool force = false);
void SetRxrHostname(); void ForceSetCltZMQIP();
void SetRxrHostname(bool force = false);
void ForceSetRxrHostname();
void SetRxrTCPPort(int port); void SetRxrTCPPort(int port);
void SetRxrUDPPort(int port); void SetRxrUDPPort(int port);
void SetRxrUDPIP(); void SetRxrUDPIP(bool force = false);
void SetRxrUDPMAC(); void ForceSetRxrUDPIP();
void SetRxrUDPMAC(bool force = false);
void ForceSetRxrUDPMAC();
void SetRxrZMQPort(int port); void SetRxrZMQPort(int port);
void SetRxrZMQIP(); void SetRxrZMQIP(bool force = false);
void ForceSetRxrZMQIP();
void GetROI(); void GetROI();
void ClearROI(); void ClearROI();
void SetROI(); void SetROI();

View File

@ -13,14 +13,15 @@ class qTabDataOutput : public QWidget, private Ui::TabDataOutputObject {
private slots: private slots:
void GetOutputDir(); void GetOutputDir();
void BrowseOutputDir(); void BrowseOutputDir();
void SetOutputDir(); void SetOutputDir(bool force = false);
void ForceSetOutputDir();
void SetFileFormat(int format); void SetFileFormat(int format);
void SetOverwriteEnable(bool enable); void SetOverwriteEnable(bool enable);
void SetTenGigaEnable(bool enable); void SetTenGigaEnable(bool enable);
void EnableRateCorrection(); void EnableRateCorrection();
void SetRateCorrection(); void SetRateCorrection();
void SetSpeed(int speed); void SetSpeed(int speed);
void SetFlags(); void SetParallel(bool enable);
private: private:
void SetupWidgetWindow(); void SetupWidgetWindow();
@ -34,11 +35,9 @@ class qTabDataOutput : public QWidget, private Ui::TabDataOutputObject {
void GetTenGigaEnable(); void GetTenGigaEnable();
void GetRateCorrection(); void GetRateCorrection();
void GetSpeed(); void GetSpeed();
void GetFlags(); void GetParallel();
sls::Detector *det; sls::Detector *det;
// Button group for radiobuttons for rate // Button group for radiobuttons for rate
QButtonGroup *btnGroupRate; QButtonGroup *btnGroupRate;
// enum for the Eiger Parallel flag
enum { PARALLEL, NONPARALLEL };
}; };

View File

@ -20,6 +20,7 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
private slots: private slots:
void SetTimingMode(int val); void SetTimingMode(int val);
void SetBurstMode(int val);
void SetNumMeasurements(int val); void SetNumMeasurements(int val);
void SetNumFrames(int val); void SetNumFrames(int val);
void SetNumTriggers(int val); void SetNumTriggers(int val);
@ -31,7 +32,8 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
void SetDelay(); void SetDelay();
void SetBurstPeriod(); void SetBurstPeriod();
void SetFileWrite(bool val); void SetFileWrite(bool val);
void SetFileName(); void SetFileName(bool force = false);
void ForceSetFileName();
void SetRunIndex(int val); void SetRunIndex(int val);
void SetStartingFrameNumber(int val); void SetStartingFrameNumber(int val);
void UpdateProgress(); void UpdateProgress();
@ -51,6 +53,7 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
void EnableWidgetsforTimingMode(); void EnableWidgetsforTimingMode();
void GetTimingMode(); void GetTimingMode();
void GetBurstMode();
void GetNumFrames(); void GetNumFrames();
void GetNumTriggers(); void GetNumTriggers();
void GetNumBursts(); void GetNumBursts();

View File

@ -24,6 +24,12 @@ class qTabPlot : public QWidget, private Ui::TabPlotObject {
void SetBinary(); void SetBinary();
void SetGapPixels(bool enable); void SetGapPixels(bool enable);
void SetTitles(); void SetTitles();
void isXMinModified();
void isXMaxModified();
void isYMinModified();
void isYMaxModified();
void isZMinModified();
void isZMaxModified();
void SetXRange(); void SetXRange();
void SetYRange(); void SetYRange();
void CheckAspectRatio(); void CheckAspectRatio();

View File

@ -26,7 +26,7 @@ void qDacWidget::SetupWidgetWindow(std::string name) {
void qDacWidget::Initialization() { void qDacWidget::Initialization() {
if (isDac) { if (isDac) {
connect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac())); connect(spinDac, SIGNAL(valueChanged(double)), this, SLOT(SetDac()));
} }
} }
@ -38,7 +38,7 @@ void qDacWidget::SetDetectorIndex(int id) {
void qDacWidget::GetDac() { void qDacWidget::GetDac() {
LOG(logDEBUG) << "Getting Dac " << index; LOG(logDEBUG) << "Getting Dac " << index;
disconnect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac())); disconnect(spinDac, SIGNAL(valueChanged(double)), this, SLOT(SetDac()));
try { try {
// dac units // dac units
auto retval = det->getDAC(index, 0, {detectorIndex}).squash(-1); auto retval = det->getDAC(index, 0, {detectorIndex}).squash(-1);
@ -52,7 +52,7 @@ void qDacWidget::GetDac() {
CATCH_DISPLAY(std::string("Could not get dac ") + std::to_string(index), CATCH_DISPLAY(std::string("Could not get dac ") + std::to_string(index),
"qDacWidget::GetDac") "qDacWidget::GetDac")
connect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac())); connect(spinDac, SIGNAL(valueChanged(double)), this, SLOT(SetDac()));
} }
void qDacWidget::SetDac() { void qDacWidget::SetDac() {

View File

@ -222,12 +222,12 @@ void qDetectorMain::SetUpDetector(const std::string &config_file, int multiID) {
actionLoadTrimbits->setEnabled(false); actionLoadTrimbits->setEnabled(false);
switch (detType) { switch (detType) {
case slsDetectorDefs::EIGER: case slsDetectorDefs::EIGER:
case slsDetectorDefs::MYTHEN3:
actionLoadTrimbits->setEnabled(true); actionLoadTrimbits->setEnabled(true);
break; break;
case slsDetectorDefs::GOTTHARD: case slsDetectorDefs::GOTTHARD:
case slsDetectorDefs::JUNGFRAU: case slsDetectorDefs::JUNGFRAU:
case slsDetectorDefs::MOENCH: case slsDetectorDefs::MOENCH:
case slsDetectorDefs::MYTHEN3:
case slsDetectorDefs::GOTTHARD2: case slsDetectorDefs::GOTTHARD2:
break; break;
default: default:
@ -334,7 +334,8 @@ void qDetectorMain::EnableModes(QAction *action) {
tabs->setTabEnabled(ADVANCED, enable); tabs->setTabEnabled(ADVANCED, enable);
actionLoadTrimbits->setVisible(enable && actionLoadTrimbits->setVisible(enable &&
detType == slsDetectorDefs::EIGER); (detType == slsDetectorDefs::EIGER ||
detType == slsDetectorDefs::MYTHEN3));
LOG(logINFO) << "Expert Mode: " << qDefs::stringEnable(enable); LOG(logINFO) << "Expert Mode: " << qDefs::stringEnable(enable);
} }
@ -400,11 +401,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
this, tr("Load Detector Trimbits"), fName, this, tr("Load Detector Trimbits"), fName,
tr("Trimbit files (*.trim noise.sn*);;All Files(*)")); tr("Trimbit files (*.trim noise.sn*);;All Files(*)"));
fileDialog->setFileMode(QFileDialog::AnyFile); fileDialog->setFileMode(QFileDialog::AnyFile);
if (fileDialog->exec() == QDialog::Accepted) if (fileDialog->exec() == QDialog::Accepted) {
fName = fileDialog->selectedFiles()[0]; fName = fileDialog->selectedFiles()[0];
// Gets called when cancelled as well
if (!fName.isEmpty()) {
det->loadTrimbits(std::string(fName.toAscii().constData())); det->loadTrimbits(std::string(fName.toAscii().constData()));
qDefs::Message(qDefs::INFORMATION, qDefs::Message(qDefs::INFORMATION,
"The Trimbits have been loaded successfully.", "The Trimbits have been loaded successfully.",

View File

@ -248,7 +248,7 @@ bool qDrawPlot::GetIsRunning() { return isRunning; }
void qDrawPlot::SetRunning(bool enable) { isRunning = enable; } void qDrawPlot::SetRunning(bool enable) { isRunning = enable; }
int qDrawPlot::GetProgress() { return progress; } double qDrawPlot::GetProgress() { return progress; }
int64_t qDrawPlot::GetCurrentFrameIndex() { return currentFrame; } int64_t qDrawPlot::GetCurrentFrameIndex() { return currentFrame; }
@ -717,7 +717,7 @@ void qDrawPlot::AcquisitionFinished(double currentProgress,
LOG(logERROR) << "Acquisition finished [Status: ERROR]"; LOG(logERROR) << "Acquisition finished [Status: ERROR]";
} else { } else {
LOG(logINFO) << "Acquisition finished [ Status:" << status LOG(logINFO) << "Acquisition finished [ Status:" << status
<< ", Progress: " << currentProgress << " ]"; << ", Progress: " << currentProgress << "% ]";
} }
emit AcquireFinishedSignal(); emit AcquireFinishedSignal();
} }
@ -741,10 +741,10 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex,
<< " \t complete image: " << data->completeImage << std::endl << " \t complete image: " << data->completeImage << std::endl
<< " ]"; << " ]";
progress = (int)data->progressIndex; progress = data->progressIndex;
currentAcqIndex = data->fileIndex; currentAcqIndex = data->fileIndex;
currentFrame = frameIndex; currentFrame = frameIndex;
LOG(logDEBUG) << "[ Progress:" << progress << ", Frame:" << currentFrame LOG(logDEBUG) << "[ Progress:" << progress << "%, Frame:" << currentFrame
<< " ]"; << " ]";
// 1d check if npixelX has changed (m3 for different counters enabled) // 1d check if npixelX has changed (m3 for different counters enabled)

View File

@ -29,6 +29,7 @@ void qTabAdvanced::SetupWidgetWindow() {
tab_roi->setEnabled(true); tab_roi->setEnabled(true);
break; break;
case slsDetectorDefs::MYTHEN3: case slsDetectorDefs::MYTHEN3:
tab_trimming->setEnabled(true);
lblDiscardBits->setEnabled(true); lblDiscardBits->setEnabled(true);
spinDiscardBits->setEnabled(true); spinDiscardBits->setEnabled(true);
lblGateIndex->setEnabled(true); lblGateIndex->setEnabled(true);
@ -65,8 +66,7 @@ void qTabAdvanced::Initialization() {
// trimming // trimming
if (tab_trimming->isEnabled()) { if (tab_trimming->isEnabled()) {
// editingFinished to not set trimbits for every character input connect(spinSetAllTrimbits, SIGNAL(valueChanged(int)), this,
connect(spinSetAllTrimbits, SIGNAL(editingFinished()), this,
SLOT(SetAllTrimbits())); SLOT(SetAllTrimbits()));
} }
@ -79,23 +79,36 @@ void qTabAdvanced::Initialization() {
SLOT(SetStopPort(int))); SLOT(SetStopPort(int)));
connect(dispDetectorUDPIP, SIGNAL(editingFinished()), this, connect(dispDetectorUDPIP, SIGNAL(editingFinished()), this,
SLOT(SetDetectorUDPIP())); SLOT(SetDetectorUDPIP()));
connect(dispDetectorUDPIP, SIGNAL(returnPressed()), this,
SLOT(ForceSetDetectorUDPIP()));
connect(dispDetectorUDPMAC, SIGNAL(editingFinished()), this, connect(dispDetectorUDPMAC, SIGNAL(editingFinished()), this,
SLOT(SetDetectorUDPMAC())); SLOT(SetDetectorUDPMAC()));
connect(dispDetectorUDPMAC, SIGNAL(returnPressed()), this,
SLOT(ForceSetDetectorUDPMAC()));
connect(spinZMQPort, SIGNAL(valueChanged(int)), this, connect(spinZMQPort, SIGNAL(valueChanged(int)), this,
SLOT(SetCltZMQPort(int))); SLOT(SetCltZMQPort(int)));
connect(dispZMQIP, SIGNAL(editingFinished()), this, SLOT(SetCltZMQIP())); connect(dispZMQIP, SIGNAL(editingFinished()), this, SLOT(SetCltZMQIP()));
connect(dispZMQIP, SIGNAL(returnPressed()), this, SLOT(ForceSetCltZMQIP()));
connect(dispRxrHostname, SIGNAL(editingFinished()), this, connect(dispRxrHostname, SIGNAL(editingFinished()), this,
SLOT(SetRxrHostname())); SLOT(SetRxrHostname()));
connect(dispRxrHostname, SIGNAL(returnPressed()), this,
SLOT(ForceSetRxrHostname()));
connect(spinRxrTCPPort, SIGNAL(valueChanged(int)), this, connect(spinRxrTCPPort, SIGNAL(valueChanged(int)), this,
SLOT(SetRxrTCPPort(int))); SLOT(SetRxrTCPPort(int)));
connect(spinRxrUDPPort, SIGNAL(valueChanged(int)), this, connect(spinRxrUDPPort, SIGNAL(valueChanged(int)), this,
SLOT(SetRxrUDPPort(int))); SLOT(SetRxrUDPPort(int)));
connect(dispRxrUDPIP, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPIP())); connect(dispRxrUDPIP, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPIP()));
connect(dispRxrUDPIP, SIGNAL(returnPressed()), this,
SLOT(ForceSetRxrUDPIP()));
connect(dispRxrUDPMAC, SIGNAL(editingFinished()), this, connect(dispRxrUDPMAC, SIGNAL(editingFinished()), this,
SLOT(SetRxrUDPMAC())); SLOT(SetRxrUDPMAC()));
connect(dispRxrUDPMAC, SIGNAL(returnPressed()), this,
SLOT(ForceSetRxrUDPMAC()));
connect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this, connect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this,
SLOT(SetRxrZMQPort(int))); SLOT(SetRxrZMQPort(int)));
connect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP())); connect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP()));
connect(dispRxrZMQIP, SIGNAL(returnPressed()), this,
SLOT(ForceSetRxrZMQIP()));
// roi // roi
if (tab_roi->isEnabled()) { if (tab_roi->isEnabled()) {
@ -421,27 +434,41 @@ void qTabAdvanced::SetStopPort(int port) {
&qTabAdvanced::GetStopPort) &qTabAdvanced::GetStopPort)
} }
void qTabAdvanced::SetDetectorUDPIP() { void qTabAdvanced::SetDetectorUDPIP(bool force) {
// return forces modification (inconsistency from command line)
if (dispDetectorUDPIP->isModified() || force) {
dispDetectorUDPIP->setModified(false);
std::string s = dispDetectorUDPIP->text().toAscii().constData(); std::string s = dispDetectorUDPIP->text().toAscii().constData();
LOG(logINFO) << "Setting Detector UDP IP:" << s; LOG(logINFO) << "Setting Detector UDP IP:" << s;
try { try {
det->setSourceUDPIP(sls::IpAddr{s}, {comboDetector->currentIndex()}); det->setSourceUDPIP(sls::IpAddr{s},
{comboDetector->currentIndex()});
} }
CATCH_HANDLE("Could not set Detector UDP IP.", CATCH_HANDLE("Could not set Detector UDP IP.",
"qTabAdvanced::SetDetectorUDPIP", this, "qTabAdvanced::SetDetectorUDPIP", this,
&qTabAdvanced::GetDetectorUDPIP) &qTabAdvanced::GetDetectorUDPIP)
} }
}
void qTabAdvanced::SetDetectorUDPMAC() { void qTabAdvanced::ForceSetDetectorUDPIP() { SetDetectorUDPIP(true); };
void qTabAdvanced::SetDetectorUDPMAC(bool force) {
// return forces modification (inconsistency from command line)
if (dispDetectorUDPMAC->isModified() || force) {
dispDetectorUDPMAC->setModified(false);
std::string s = dispDetectorUDPMAC->text().toAscii().constData(); std::string s = dispDetectorUDPMAC->text().toAscii().constData();
LOG(logINFO) << "Setting Detector UDP MAC:" << s; LOG(logINFO) << "Setting Detector UDP MAC:" << s;
try { try {
det->setSourceUDPMAC(sls::MacAddr{s}, {comboDetector->currentIndex()}); det->setSourceUDPMAC(sls::MacAddr{s},
{comboDetector->currentIndex()});
} }
CATCH_HANDLE("Could not set Detector UDP MAC.", CATCH_HANDLE("Could not set Detector UDP MAC.",
"qTabAdvanced::SetDetectorUDPMAC", this, "qTabAdvanced::SetDetectorUDPMAC", this,
&qTabAdvanced::GetDetectorUDPMAC) &qTabAdvanced::GetDetectorUDPMAC)
} }
}
void qTabAdvanced::ForceSetDetectorUDPMAC() { SetDetectorUDPMAC(true); }
void qTabAdvanced::SetCltZMQPort(int port) { void qTabAdvanced::SetCltZMQPort(int port) {
LOG(logINFO) << "Setting Client ZMQ Port:" << port; LOG(logINFO) << "Setting Client ZMQ Port:" << port;
@ -453,28 +480,43 @@ void qTabAdvanced::SetCltZMQPort(int port) {
&qTabAdvanced::GetCltZMQPort) &qTabAdvanced::GetCltZMQPort)
} }
void qTabAdvanced::SetCltZMQIP() { void qTabAdvanced::SetCltZMQIP(bool force) {
// return forces modification (inconsistency from command line)
if (dispZMQIP->isModified() || force) {
dispZMQIP->setModified(false);
std::string s = dispZMQIP->text().toAscii().constData(); std::string s = dispZMQIP->text().toAscii().constData();
LOG(logINFO) << "Setting Client ZMQ IP:" << s; LOG(logINFO) << "Setting Client ZMQ IP:" << s;
try { try {
det->setClientZmqIp(sls::IpAddr{s}, {comboDetector->currentIndex()}); det->setClientZmqIp(sls::IpAddr{s},
{comboDetector->currentIndex()});
}
CATCH_HANDLE("Could not set Client ZMQ IP.",
"qTabAdvanced::SetCltZMQIP", this,
&qTabAdvanced::GetCltZMQIP)
} }
CATCH_HANDLE("Could not set Client ZMQ IP.", "qTabAdvanced::SetCltZMQIP",
this, &qTabAdvanced::GetCltZMQIP)
} }
void qTabAdvanced::SetRxrHostname() { void qTabAdvanced::ForceSetCltZMQIP() { SetCltZMQIP(true); }
std::string s = dispZMQIP->text().toAscii().constData();
void qTabAdvanced::SetRxrHostname(bool force) {
// return forces modification (inconsistency from command line)
if (dispRxrHostname->isModified() || force) {
dispRxrHostname->setModified(false);
std::string s = dispRxrHostname->text().toAscii().constData();
LOG(logINFO) << "Setting Receiver Hostname:" << s; LOG(logINFO) << "Setting Receiver Hostname:" << s;
try { try {
det->setRxHostname(s, {comboDetector->currentIndex()}); det->setRxHostname(s, {comboDetector->currentIndex()});
} }
CATCH_HANDLE("Could not set Client ZMQ IP.", "qTabAdvanced::SetRxrHostname", CATCH_HANDLE("Could not set Client ZMQ IP.",
this, &qTabAdvanced::GetRxrHostname) "qTabAdvanced::SetRxrHostname", this,
&qTabAdvanced::GetRxrHostname)
// update all network widgets (receiver mainly) // update all network widgets (receiver mainly)
SetDetector(); SetDetector();
} }
}
void qTabAdvanced::ForceSetRxrHostname() { SetRxrHostname(true); }
void qTabAdvanced::SetRxrTCPPort(int port) { void qTabAdvanced::SetRxrTCPPort(int port) {
LOG(logINFO) << "Setting Receiver TCP Port:" << port; LOG(logINFO) << "Setting Receiver TCP Port:" << port;
@ -496,18 +538,28 @@ void qTabAdvanced::SetRxrUDPPort(int port) {
&qTabAdvanced::GetRxrUDPPort) &qTabAdvanced::GetRxrUDPPort)
} }
void qTabAdvanced::SetRxrUDPIP() { void qTabAdvanced::SetRxrUDPIP(bool force) {
// return forces modification (inconsistency from command line)
if (dispRxrUDPIP->isModified() || force) {
dispRxrUDPIP->setModified(false);
std::string s = dispRxrUDPIP->text().toAscii().constData(); std::string s = dispRxrUDPIP->text().toAscii().constData();
LOG(logINFO) << "Setting Receiver UDP IP:" << s; LOG(logINFO) << "Setting Receiver UDP IP:" << s;
try { try {
det->setDestinationUDPIP(sls::IpAddr{s}, det->setDestinationUDPIP(sls::IpAddr{s},
{comboDetector->currentIndex()}); {comboDetector->currentIndex()});
} }
CATCH_HANDLE("Could not set Receiver UDP IP.", "qTabAdvanced::SetRxrUDPIP", CATCH_HANDLE("Could not set Receiver UDP IP.",
this, &qTabAdvanced::GetRxrUDPIP) "qTabAdvanced::SetRxrUDPIP", this,
&qTabAdvanced::GetRxrUDPIP)
}
} }
void qTabAdvanced::SetRxrUDPMAC() { void qTabAdvanced::ForceSetRxrUDPIP() { SetRxrUDPIP(true); }
void qTabAdvanced::SetRxrUDPMAC(bool force) {
// return forces modification (inconsistency from command line)
if (dispRxrUDPMAC->isModified() || force) {
dispRxrUDPMAC->setModified(false);
std::string s = dispRxrUDPMAC->text().toAscii().constData(); std::string s = dispRxrUDPMAC->text().toAscii().constData();
LOG(logINFO) << "Setting Receiver UDP MAC:" << s; LOG(logINFO) << "Setting Receiver UDP MAC:" << s;
try { try {
@ -518,6 +570,9 @@ void qTabAdvanced::SetRxrUDPMAC() {
"qTabAdvanced::SetRxrUDPMAC", this, "qTabAdvanced::SetRxrUDPMAC", this,
&qTabAdvanced::GetRxrUDPMAC) &qTabAdvanced::GetRxrUDPMAC)
} }
}
void qTabAdvanced::ForceSetRxrUDPMAC() { SetRxrUDPMAC(true); }
void qTabAdvanced::SetRxrZMQPort(int port) { void qTabAdvanced::SetRxrZMQPort(int port) {
LOG(logINFO) << "Setting Receiver ZMQ Port:" << port; LOG(logINFO) << "Setting Receiver ZMQ Port:" << port;
@ -529,15 +584,22 @@ void qTabAdvanced::SetRxrZMQPort(int port) {
&qTabAdvanced::GetRxrZMQPort) &qTabAdvanced::GetRxrZMQPort)
} }
void qTabAdvanced::SetRxrZMQIP() { void qTabAdvanced::SetRxrZMQIP(bool force) {
// return forces modification (inconsistency from command line)
if (dispRxrZMQIP->isModified() || force) {
dispRxrZMQIP->setModified(false);
std::string s = dispRxrZMQIP->text().toAscii().constData(); std::string s = dispRxrZMQIP->text().toAscii().constData();
LOG(logINFO) << "Setting Receiver ZMQ IP:" << s; LOG(logINFO) << "Setting Receiver ZMQ IP:" << s;
try { try {
det->setRxZmqIP(sls::IpAddr{s}, {comboDetector->currentIndex()}); det->setRxZmqIP(sls::IpAddr{s}, {comboDetector->currentIndex()});
} }
CATCH_HANDLE("Could not set Receiver ZMQ IP.", "qTabAdvanced::SetRxrZMQIP", CATCH_HANDLE("Could not set Receiver ZMQ IP.",
this, &qTabAdvanced::GetRxrZMQIP) "qTabAdvanced::SetRxrZMQIP", this,
&qTabAdvanced::GetRxrZMQIP)
} }
}
void qTabAdvanced::ForceSetRxrZMQIP() { SetRxrZMQIP(true); }
void qTabAdvanced::GetROI() { void qTabAdvanced::GetROI() {
LOG(logDEBUG) << "Getting ROI"; LOG(logDEBUG) << "Getting ROI";
@ -575,7 +637,7 @@ void qTabAdvanced::SetROI() {
void qTabAdvanced::GetAllTrimbits() { void qTabAdvanced::GetAllTrimbits() {
LOG(logDEBUG) << "Getting all trimbits value"; LOG(logDEBUG) << "Getting all trimbits value";
disconnect(spinSetAllTrimbits, SIGNAL(editingFinished()), this, disconnect(spinSetAllTrimbits, SIGNAL(valueChanged(int)), this,
SLOT(SetAllTrimbits())); SLOT(SetAllTrimbits()));
try { try {
@ -584,7 +646,7 @@ void qTabAdvanced::GetAllTrimbits() {
} }
CATCH_DISPLAY("Could not get all trimbits.", "qTabAdvanced::GetAllTrimbits") CATCH_DISPLAY("Could not get all trimbits.", "qTabAdvanced::GetAllTrimbits")
connect(spinSetAllTrimbits, SIGNAL(editingFinished()), this, connect(spinSetAllTrimbits, SIGNAL(valueChanged(int)), this,
SLOT(SetAllTrimbits())); SLOT(SetAllTrimbits()));
} }

View File

@ -32,12 +32,20 @@ void qTabDataOutput::SetupWidgetWindow() {
radioDefaultDeadtime->setEnabled(true); radioDefaultDeadtime->setEnabled(true);
radioCustomDeadtime->setEnabled(true); radioCustomDeadtime->setEnabled(true);
// flags and speed // flags and speed
widgetEiger->setVisible(true); lblClkDivider->setEnabled(true);
widgetEiger->setEnabled(true); comboClkDivider->setEnabled(true);
chkParallel->setEnabled(true);
break; break;
case slsDetectorDefs::MOENCH: case slsDetectorDefs::MOENCH:
chkTenGiga->setEnabled(true); chkTenGiga->setEnabled(true);
break; break;
case slsDetectorDefs::MYTHEN3:
chkParallel->setEnabled(true);
break;
case slsDetectorDefs::JUNGFRAU:
lblClkDivider->setEnabled(true);
comboClkDivider->setEnabled(true);
break;
default: default:
break; break;
} }
@ -54,6 +62,8 @@ void qTabDataOutput::Initialization() {
SLOT(GetOutputDir())); SLOT(GetOutputDir()));
connect(dispOutputDir, SIGNAL(editingFinished()), this, connect(dispOutputDir, SIGNAL(editingFinished()), this,
SLOT(SetOutputDir())); SLOT(SetOutputDir()));
connect(dispOutputDir, SIGNAL(returnPressed()), this,
SLOT(ForceSetOutputDir()));
connect(btnOutputBrowse, SIGNAL(clicked()), this, SLOT(BrowseOutputDir())); connect(btnOutputBrowse, SIGNAL(clicked()), this, SLOT(BrowseOutputDir()));
connect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, connect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetFileFormat(int))); SLOT(SetFileFormat(int)));
@ -69,15 +79,18 @@ void qTabDataOutput::Initialization() {
SLOT(EnableRateCorrection())); SLOT(EnableRateCorrection()));
connect(btnGroupRate, SIGNAL(buttonClicked(int)), this, connect(btnGroupRate, SIGNAL(buttonClicked(int)), this,
SLOT(SetRateCorrection())); SLOT(SetRateCorrection()));
connect(spinCustomDeadTime, SIGNAL(editingFinished()), this, connect(spinCustomDeadTime, SIGNAL(valueChanged(int)), this,
SLOT(SetRateCorrection())); SLOT(SetRateCorrection()));
} }
// flags, speed // parallel
if (widgetEiger->isEnabled()) { if (chkParallel->isEnabled()) {
connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, connect(chkParallel, SIGNAL(toggled(bool)), this,
SLOT(SetParallel(bool)));
}
// speed
if (comboClkDivider->isEnabled()) {
connect(comboClkDivider, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetSpeed(int))); SLOT(SetSpeed(int)));
connect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetFlags()));
} }
} }
@ -169,7 +182,10 @@ void qTabDataOutput::BrowseOutputDir() {
dispOutputDir->setText(directory); dispOutputDir->setText(directory);
} }
void qTabDataOutput::SetOutputDir() { void qTabDataOutput::SetOutputDir(bool force) {
// return forces modification (inconsistency from command line)
if (dispOutputDir->isModified() || force) {
dispOutputDir->setModified(false);
QString path = dispOutputDir->text(); QString path = dispOutputDir->text();
LOG(logDEBUG) << "Setting output directory to " LOG(logDEBUG) << "Setting output directory to "
<< path.toAscii().constData(); << path.toAscii().constData();
@ -197,6 +213,9 @@ void qTabDataOutput::SetOutputDir() {
&qTabDataOutput::GetOutputDir) &qTabDataOutput::GetOutputDir)
} }
} }
}
void qTabDataOutput::ForceSetOutputDir() { SetOutputDir(true); };
void qTabDataOutput::GetFileFormat() { void qTabDataOutput::GetFileFormat() {
LOG(logDEBUG) << "Getting File Format"; LOG(logDEBUG) << "Getting File Format";
@ -288,7 +307,7 @@ void qTabDataOutput::GetRateCorrection() {
SLOT(EnableRateCorrection())); SLOT(EnableRateCorrection()));
disconnect(btnGroupRate, SIGNAL(buttonClicked(int)), this, disconnect(btnGroupRate, SIGNAL(buttonClicked(int)), this,
SLOT(SetRateCorrection())); SLOT(SetRateCorrection()));
disconnect(spinCustomDeadTime, SIGNAL(editingFinished()), this, disconnect(spinCustomDeadTime, SIGNAL(valueChanged(int)), this,
SLOT(SetRateCorrection())); SLOT(SetRateCorrection()));
try { try {
spinCustomDeadTime->setValue(-1); spinCustomDeadTime->setValue(-1);
@ -305,7 +324,7 @@ void qTabDataOutput::GetRateCorrection() {
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection())); connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection()));
connect(btnGroupRate, SIGNAL(buttonClicked(int)), this, connect(btnGroupRate, SIGNAL(buttonClicked(int)), this,
SLOT(SetRateCorrection())); SLOT(SetRateCorrection()));
connect(spinCustomDeadTime, SIGNAL(editingFinished()), this, connect(spinCustomDeadTime, SIGNAL(valueChanged(int)), this,
SLOT(SetRateCorrection())); SLOT(SetRateCorrection()));
} }
@ -351,22 +370,21 @@ void qTabDataOutput::SetRateCorrection() {
void qTabDataOutput::GetSpeed() { void qTabDataOutput::GetSpeed() {
LOG(logDEBUG) << "Getting Speed"; LOG(logDEBUG) << "Getting Speed";
disconnect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, disconnect(comboClkDivider, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetSpeed(int))); SLOT(SetSpeed(int)));
try { try {
auto retval = auto retval =
det->getSpeed().tsquash("Speed is inconsistent for all detectors."); det->getSpeed().tsquash("Speed is inconsistent for all detectors.");
comboEigerClkDivider->setCurrentIndex(static_cast<int>(retval)); comboClkDivider->setCurrentIndex(static_cast<int>(retval));
} }
CATCH_DISPLAY("Could not get speed.", "qTabDataOutput::GetSpeed") CATCH_DISPLAY("Could not get speed.", "qTabDataOutput::GetSpeed")
connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, connect(comboClkDivider, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetSpeed(int))); SLOT(SetSpeed(int)));
} }
void qTabDataOutput::SetSpeed(int speed) { void qTabDataOutput::SetSpeed(int speed) {
LOG(logINFO) << "Setting Speed to " LOG(logINFO) << "Setting Speed to "
<< comboEigerClkDivider->currentText().toAscii().data(); << comboClkDivider->currentText().toAscii().data();
;
try { try {
det->setSpeed(static_cast<slsDetectorDefs::speedLevel>(speed)); det->setSpeed(static_cast<slsDetectorDefs::speedLevel>(speed));
} }
@ -374,34 +392,28 @@ void qTabDataOutput::SetSpeed(int speed) {
&qTabDataOutput::GetSpeed) &qTabDataOutput::GetSpeed)
} }
void qTabDataOutput::GetFlags() { void qTabDataOutput::GetParallel() {
LOG(logDEBUG) << "Getting readout flags"; LOG(logDEBUG) << "Getting parallel readout";
disconnect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this, disconnect(chkParallel, SIGNAL(toggled(bool)), this,
SLOT(SetFlags())); SLOT(SetParallel(bool)));
try { try {
auto retval = det->getParallelMode().tsquash( auto retval = det->getParallelMode().tsquash(
"Parallel Flag is inconsistent for all detectors."); "Parallel Flag is inconsistent for all detectors.");
// parallel or non parallel chkParallel->setChecked(retval);
if (retval)
comboEigerParallelFlag->setCurrentIndex(PARALLEL);
else
comboEigerParallelFlag->setCurrentIndex(NONPARALLEL);
} }
CATCH_DISPLAY("Could not get flags.", "qTabDataOutput::GetFlags") CATCH_DISPLAY("Could not get parallel readout.",
connect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this, "qTabDataOutput::GetParallel")
SLOT(SetFlags())); connect(chkParallel, SIGNAL(toggled(bool)), this, SLOT(SetParallel(bool)));
} }
void qTabDataOutput::SetFlags() { void qTabDataOutput::SetParallel(bool enable) {
auto mode = LOG(logINFO) << "Setting PArallel readout to " << enable;
comboEigerParallelFlag->currentIndex() == PARALLEL ? true : false;
try { try {
LOG(logINFO) << "Setting Readout Flags to " det->setParallelMode(enable);
<< comboEigerParallelFlag->currentText().toAscii().data();
det->setParallelMode(mode);
} }
CATCH_HANDLE("Could not set readout flags.", "qTabDataOutput::SetFlags", CATCH_HANDLE("Could not set parallel readout.",
this, &qTabDataOutput::GetFlags) "qTabDataOutput::SetParallel", this,
&qTabDataOutput::GetParallel)
} }
void qTabDataOutput::Refresh() { void qTabDataOutput::Refresh() {
@ -419,9 +431,11 @@ void qTabDataOutput::Refresh() {
if (chkTenGiga->isEnabled()) { if (chkTenGiga->isEnabled()) {
GetTenGigaEnable(); GetTenGigaEnable();
} }
if (widgetEiger->isEnabled()) { if (chkParallel->isEnabled()) {
GetParallel();
}
if (comboClkDivider->isEnabled()) {
GetSpeed(); GetSpeed();
GetFlags();
} }
LOG(logDEBUG) << "**Updated DataOutput Tab"; LOG(logDEBUG) << "**Updated DataOutput Tab";

View File

@ -290,7 +290,7 @@ void qTabDeveloper::Initialization() {
SLOT(Refresh())); SLOT(Refresh()));
connect(comboHV, SIGNAL(currentIndexChanged(int)), this, connect(comboHV, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetHighVoltage())); SLOT(SetHighVoltage()));
connect(spinHV, SIGNAL(editingFinished()), this, SLOT(SetHighVoltage())); connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
} }
void qTabDeveloper::PopulateDetectors() { void qTabDeveloper::PopulateDetectors() {
@ -312,7 +312,7 @@ void qTabDeveloper::GetHighVoltage() {
if (!comboHV->isVisible() && !spinHV->isVisible()) if (!comboHV->isVisible() && !spinHV->isVisible())
return; return;
LOG(logDEBUG) << "Getting High Voltage"; LOG(logDEBUG) << "Getting High Voltage";
disconnect(spinHV, SIGNAL(editingFinished()), this, SLOT(SetHighVoltage())); disconnect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
disconnect(comboHV, SIGNAL(currentIndexChanged(int)), this, disconnect(comboHV, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetHighVoltage())); SLOT(SetHighVoltage()));
try { try {
@ -359,7 +359,7 @@ void qTabDeveloper::GetHighVoltage() {
} }
CATCH_DISPLAY("Could not get high voltage.", CATCH_DISPLAY("Could not get high voltage.",
"qTabDeveloper::GetHighVoltage") "qTabDeveloper::GetHighVoltage")
connect(spinHV, SIGNAL(editingFinished()), this, SLOT(SetHighVoltage())); connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
connect(comboHV, SIGNAL(currentIndexChanged(int)), this, connect(comboHV, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetHighVoltage())); SLOT(SetHighVoltage()));
} }

View File

@ -46,6 +46,8 @@ void qTabMeasurement::SetupWidgetWindow() {
ShowGates(); ShowGates();
// enabling according to det type // enabling according to det type
lblBurstMode->hide();
comboBurstMode->hide();
switch (det->getDetectorType().squash()) { switch (det->getDetectorType().squash()) {
case slsDetectorDefs::MOENCH: case slsDetectorDefs::MOENCH:
lblNumSamples->setEnabled(true); lblNumSamples->setEnabled(true);
@ -64,6 +66,8 @@ void qTabMeasurement::SetupWidgetWindow() {
startingFnumImplemented = true; startingFnumImplemented = true;
break; break;
case slsDetectorDefs::GOTTHARD2: case slsDetectorDefs::GOTTHARD2:
lblBurstMode->show();
comboBurstMode->show();
lblNumBursts->setEnabled(true); lblNumBursts->setEnabled(true);
spinNumBursts->setEnabled(true); spinNumBursts->setEnabled(true);
lblBurstPeriod->setEnabled(true); lblBurstPeriod->setEnabled(true);
@ -89,6 +93,10 @@ void qTabMeasurement::SetupWidgetWindow() {
void qTabMeasurement::Initialization() { void qTabMeasurement::Initialization() {
connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetTimingMode(int))); SLOT(SetTimingMode(int)));
if (comboBurstMode->isVisible()) {
connect(comboBurstMode, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetBurstMode(int)));
}
connect(spinNumMeasurements, SIGNAL(valueChanged(int)), this, connect(spinNumMeasurements, SIGNAL(valueChanged(int)), this,
SLOT(SetNumMeasurements(int))); SLOT(SetNumMeasurements(int)));
connect(spinNumFrames, SIGNAL(valueChanged(int)), this, connect(spinNumFrames, SIGNAL(valueChanged(int)), this,
@ -129,6 +137,8 @@ void qTabMeasurement::Initialization() {
} }
connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool))); connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool)));
connect(dispFileName, SIGNAL(editingFinished()), this, SLOT(SetFileName())); connect(dispFileName, SIGNAL(editingFinished()), this, SLOT(SetFileName()));
connect(dispFileName, SIGNAL(returnPressed()), this,
SLOT(ForceSetFileName()));
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(SetRunIndex(int))); connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(SetRunIndex(int)));
if (startingFnumImplemented) { if (startingFnumImplemented) {
connect(spinStartingFrameNumber, SIGNAL(valueChanged(int)), this, connect(spinStartingFrameNumber, SIGNAL(valueChanged(int)), this,
@ -142,19 +152,16 @@ void qTabMeasurement::Initialization() {
void qTabMeasurement::ShowTriggerDelay() { void qTabMeasurement::ShowTriggerDelay() {
bool showTrigger = true; bool showTrigger = true;
if (det->getDetectorType().squash() == slsDetectorDefs::GOTTHARD2) { if (det->getDetectorType().squash() == slsDetectorDefs::GOTTHARD2) {
try { // burst and auto
LOG(logDEBUG) << "Getting burst mode"; if ((comboBurstMode->currentIndex() ==
auto retval = det->getBurstMode().tsquash( slsDetectorDefs::BURST_INTERNAL ||
"Inconsistent burst mode for all detectors."); comboBurstMode->currentIndex() ==
// burst mode and auto timing mode slsDetectorDefs::BURST_EXTERNAL) &&
if (retval != slsDetectorDefs::BURST_OFF && (comboTimingMode->currentIndex() == AUTO)) {
comboTimingMode->currentIndex() == AUTO) { // show burst, burstperiod, not trigger or delay
showTrigger = false; showTrigger = false;
} }
} }
CATCH_DISPLAY("Could not get burst mode.",
"qTabMeasurement::ShowTriggerDelay")
}
if (showTrigger) { if (showTrigger) {
stackedLblTriggerBurst->setCurrentWidget(pageLblTrigger); stackedLblTriggerBurst->setCurrentWidget(pageLblTrigger);
@ -246,7 +253,7 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
spinPeriod->setEnabled(true); spinPeriod->setEnabled(true);
comboPeriodUnit->setEnabled(true); comboPeriodUnit->setEnabled(true);
if (det->getDetectorType().squash() == slsDetectorDefs::GOTTHARD2) { if (det->getDetectorType().squash() == slsDetectorDefs::GOTTHARD2) {
ShowTriggerDelay(); GetBurstMode(); // also decides to show trigger or burst mode
} }
break; break;
case TRIGGER: case TRIGGER:
@ -270,7 +277,7 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
spinDelay->setEnabled(true); spinDelay->setEnabled(true);
comboDelayUnit->setEnabled(true); comboDelayUnit->setEnabled(true);
if (det->getDetectorType().squash() == slsDetectorDefs::GOTTHARD2) { if (det->getDetectorType().squash() == slsDetectorDefs::GOTTHARD2) {
ShowTriggerDelay(); GetBurstMode(); // also decides to show trigger or burst mode
} }
} }
break; break;
@ -357,6 +364,42 @@ void qTabMeasurement::SetTimingMode(int val) {
this, &qTabMeasurement::GetTimingMode) this, &qTabMeasurement::GetTimingMode)
} }
void qTabMeasurement::GetBurstMode() {
LOG(logDEBUG) << "Getting burst mode";
disconnect(comboBurstMode, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetBurstMode(int)));
try {
auto retval = det->getBurstMode().tsquash(
"Inconsistent burst mode for all detectors.");
switch (retval) {
case slsDetectorDefs::BURST_INTERNAL:
case slsDetectorDefs::BURST_EXTERNAL:
case slsDetectorDefs::CONTINUOUS_INTERNAL:
case slsDetectorDefs::CONTINUOUS_EXTERNAL:
comboBurstMode->setCurrentIndex((int)retval);
ShowTriggerDelay();
break;
default:
throw sls::RuntimeError(std::string("Unknown burst mode: ") +
std::to_string(retval));
}
}
CATCH_DISPLAY("Could not get burst mode.", "qTabMeasurement::GetBurstMode")
connect(comboBurstMode, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetBurstMode(int)));
}
void qTabMeasurement::SetBurstMode(int val) {
LOG(logINFO) << "Setting burst mode:"
<< comboBurstMode->currentText().toAscii().data();
try {
det->setBurstMode(static_cast<slsDetectorDefs::burstMode>(val));
ShowTriggerDelay();
}
CATCH_HANDLE("Could not set burst mode.", "qTabMeasurement::SetBurstMode",
this, &qTabMeasurement::GetBurstMode)
}
void qTabMeasurement::SetNumMeasurements(int val) { void qTabMeasurement::SetNumMeasurements(int val) {
LOG(logINFO) << "Setting Number of Measurements to " << val; LOG(logINFO) << "Setting Number of Measurements to " << val;
numMeasurements = val; numMeasurements = val;
@ -723,8 +766,12 @@ void qTabMeasurement::GetFileName() {
connect(dispFileName, SIGNAL(editingFinished()), this, SLOT(SetFileName())); connect(dispFileName, SIGNAL(editingFinished()), this, SLOT(SetFileName()));
} }
void qTabMeasurement::SetFileName() { void qTabMeasurement::SetFileName(bool force) {
std::string val = std::string(dispFileName->text().toAscii().constData()); // return forces modification (inconsistency from command line)
if (dispFileName->isModified() || force) {
dispFileName->setModified(false);
std::string val =
std::string(dispFileName->text().toAscii().constData());
LOG(logINFO) << "Setting File Name Prefix:" << val; LOG(logINFO) << "Setting File Name Prefix:" << val;
try { try {
det->setFileNamePrefix(val); det->setFileNamePrefix(val);
@ -735,6 +782,9 @@ void qTabMeasurement::SetFileName() {
emit FileNameChangedSignal(dispFileName->text()); emit FileNameChangedSignal(dispFileName->text());
} }
}
void qTabMeasurement::ForceSetFileName() { SetFileName(true); }
void qTabMeasurement::GetRunIndex() { void qTabMeasurement::GetRunIndex() {
LOG(logDEBUG) << "Getting Acquisition File index"; LOG(logDEBUG) << "Getting Acquisition File index";
@ -904,6 +954,9 @@ void qTabMeasurement::Refresh() {
if (!plot->GetIsRunning()) { if (!plot->GetIsRunning()) {
GetTimingMode(); GetTimingMode();
if (comboBurstMode->isVisible()) {
GetBurstMode();
}
GetNumFrames(); GetNumFrames();
GetExposureTime(); GetExposureTime();
GetAcquisitionPeriod(); GetAcquisitionPeriod();

View File

@ -87,9 +87,9 @@ void qTabPlot::Initialization() {
SLOT(SetStreamingFrequency())); SLOT(SetStreamingFrequency()));
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetStreamingFrequency())); SLOT(SetStreamingFrequency()));
connect(spinTimeGap, SIGNAL(editingFinished()), this, connect(spinTimeGap, SIGNAL(valueChanged(double)), this,
SLOT(SetStreamingFrequency())); SLOT(SetStreamingFrequency()));
connect(spinNthFrame, SIGNAL(editingFinished()), this, connect(spinNthFrame, SIGNAL(valueChanged(int)), this,
SLOT(SetStreamingFrequency())); SLOT(SetStreamingFrequency()));
// navigation buttons for options // navigation buttons for options
@ -174,17 +174,17 @@ void qTabPlot::Initialization() {
connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange())); connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
connect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(SetYRange())); connect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(SetYRange())); connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXRange())); connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(isXMinModified()));
connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXRange())); connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(isXMaxModified()));
connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange())); connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(isYMinModified()));
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange())); connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(isYMaxModified()));
connect(chkAspectRatio, SIGNAL(toggled(bool)), this, connect(chkAspectRatio, SIGNAL(toggled(bool)), this,
SLOT(CheckAspectRatio())); SLOT(CheckAspectRatio()));
connect(chkZMin, SIGNAL(toggled(bool)), this, SLOT(SetZRange())); connect(chkZMin, SIGNAL(toggled(bool)), this, SLOT(SetZRange()));
connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(SetZRange())); connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(SetZRange()));
connect(dispZMin, SIGNAL(editingFinished()), this, SLOT(SetZRange())); connect(dispZMin, SIGNAL(editingFinished()), this, SLOT(isZMinModified()));
connect(dispZMax, SIGNAL(editingFinished()), this, SLOT(SetZRange())); connect(dispZMax, SIGNAL(editingFinished()), this, SLOT(isZMaxModified()));
} }
void qTabPlot::Select1DPlot(bool enable) { void qTabPlot::Select1DPlot(bool enable) {
@ -389,6 +389,48 @@ void qTabPlot::SetTitles() {
SLOT(SetTitles())); SLOT(SetTitles()));
} }
void qTabPlot::isXMinModified() {
if (dispXMin->isModified()) {
dispXMin->setModified(false);
SetXRange();
}
}
void qTabPlot::isXMaxModified() {
if (dispXMax->isModified()) {
dispXMax->setModified(false);
SetXRange();
}
}
void qTabPlot::isYMinModified() {
if (dispYMin->isModified()) {
dispYMin->setModified(false);
SetYRange();
}
}
void qTabPlot::isYMaxModified() {
if (dispYMax->isModified()) {
dispYMax->setModified(false);
SetYRange();
}
}
void qTabPlot::isZMinModified() {
if (dispZMin->isModified()) {
dispZMin->setModified(false);
SetZRange();
}
}
void qTabPlot::isZMaxModified() {
if (dispZMax->isModified()) {
dispZMax->setModified(false);
SetZRange();
}
}
void qTabPlot::SetXRange() { void qTabPlot::SetXRange() {
LOG(logDEBUG) << "Enable X axis range"; LOG(logDEBUG) << "Enable X axis range";
@ -452,10 +494,14 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
disconnect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange())); disconnect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
disconnect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(SetYRange())); disconnect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
disconnect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(SetYRange())); disconnect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
disconnect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXRange())); disconnect(dispXMin, SIGNAL(editingFinished()), this,
disconnect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXRange())); SLOT(isXMinModified()));
disconnect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange())); disconnect(dispXMax, SIGNAL(editingFinished()), this,
disconnect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange())); SLOT(isXMaxModified()));
disconnect(dispYMin, SIGNAL(editingFinished()), this,
SLOT(isYMinModified()));
disconnect(dispYMax, SIGNAL(editingFinished()), this,
SLOT(isYMaxModified()));
// check all, fill all // check all, fill all
chkXMin->setChecked(true); chkXMin->setChecked(true);
@ -550,10 +596,10 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange())); connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
connect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(SetYRange())); connect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(SetYRange())); connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXRange())); connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(isXMinModified()));
connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXRange())); connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(isXMaxModified()));
connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange())); connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(isYMinModified()));
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange())); connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(isYMaxModified()));
bool isRange[4]{true, true, true, true}; bool isRange[4]{true, true, true, true};
plot->SetXYRangeChanged(true, ranges, isRange); plot->SetXYRangeChanged(true, ranges, isRange);
@ -583,9 +629,9 @@ void qTabPlot::GetStreamingFrequency() {
SLOT(SetStreamingFrequency())); SLOT(SetStreamingFrequency()));
disconnect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, disconnect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetStreamingFrequency())); SLOT(SetStreamingFrequency()));
disconnect(spinTimeGap, SIGNAL(editingFinished()), this, disconnect(spinTimeGap, SIGNAL(valueChanged(double)), this,
SLOT(SetStreamingFrequency())); SLOT(SetStreamingFrequency()));
disconnect(spinNthFrame, SIGNAL(editingFinished()), this, disconnect(spinNthFrame, SIGNAL(valueChanged(int)), this,
SLOT(SetStreamingFrequency())); SLOT(SetStreamingFrequency()));
try { try {
int freq = det->getRxZmqFrequency().tsquash( int freq = det->getRxZmqFrequency().tsquash(
@ -621,9 +667,9 @@ void qTabPlot::GetStreamingFrequency() {
SLOT(SetStreamingFrequency())); SLOT(SetStreamingFrequency()));
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetStreamingFrequency())); SLOT(SetStreamingFrequency()));
connect(spinTimeGap, SIGNAL(editingFinished()), this, connect(spinTimeGap, SIGNAL(valueChanged(double)), this,
SLOT(SetStreamingFrequency())); SLOT(SetStreamingFrequency()));
connect(spinNthFrame, SIGNAL(editingFinished()), this, connect(spinNthFrame, SIGNAL(valueChanged(int)), this,
SLOT(SetStreamingFrequency())); SLOT(SetStreamingFrequency()));
} }

View File

@ -2347,7 +2347,7 @@ int stopStateMachine() {
sharedMemory_setStop(1); sharedMemory_setStop(1);
// read till status is idle // read till status is idle
while (sharedMemory_getStatus() == RUNNING) while (sharedMemory_getStatus() == RUNNING)
; usleep(500);
sharedMemory_setStop(0); sharedMemory_setStop(0);
LOG(logINFO, ("Stopped State Machine\n")); LOG(logINFO, ("Stopped State Machine\n"));
return OK; return OK;

View File

@ -39,6 +39,10 @@ uint64_t Beb_deactivatedStartFrameNumber = 0;
int Beb_quadEnable = 0; int Beb_quadEnable = 0;
int Beb_positions[2] = {0, 0}; int Beb_positions[2] = {0, 0};
int Beb_readNLines = MAX_ROWS_PER_READOUT; int Beb_readNLines = MAX_ROWS_PER_READOUT;
int Beb_deactivated_transmission_flowcontrol_10g = 0;
int Beb_deactivated_transmission_delay_frame = 0;
int Beb_deactivated_transmission_delay_left = 0;
int Beb_deactivated_transmission_delay_right = 0;
void BebInfo_BebInfo(struct BebInfo *bebInfo, unsigned int beb_num) { void BebInfo_BebInfo(struct BebInfo *bebInfo, unsigned int beb_num) {
bebInfo->beb_number = beb_num; bebInfo->beb_number = beb_num;
@ -180,6 +184,11 @@ void Beb_GetModuleConfiguration(int *master, int *top, int *normal) {
} }
int Beb_IsTransmitting(int *retval, int tengiga, int waitForDelay) { int Beb_IsTransmitting(int *retval, int tengiga, int waitForDelay) {
if (!Beb_activated) {
// not transmitting
*retval = 0;
return OK;
}
// mapping new memory // mapping new memory
u_int32_t *csp0base = 0; u_int32_t *csp0base = 0;
int addr_l_txndelaycounter = 0, addr_l_framedelaycounter = 0; int addr_l_txndelaycounter = 0, addr_l_framedelaycounter = 0;
@ -482,6 +491,9 @@ int Beb_Set32bitOverflow(int val) {
} }
int Beb_GetTenGigaFlowControl() { int Beb_GetTenGigaFlowControl() {
if (!Beb_activated)
return Beb_deactivated_transmission_flowcontrol_10g;
u_int32_t offset = FLOW_REG_OFFSET; u_int32_t offset = FLOW_REG_OFFSET;
u_int32_t *csp0base = 0; u_int32_t *csp0base = 0;
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR); int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
@ -501,6 +513,11 @@ int Beb_GetTenGigaFlowControl() {
int Beb_SetTenGigaFlowControl(int value) { int Beb_SetTenGigaFlowControl(int value) {
LOG(logINFO, ("Setting ten giga flow control to %d\n", value)); LOG(logINFO, ("Setting ten giga flow control to %d\n", value));
if (!Beb_activated) {
Beb_deactivated_transmission_flowcontrol_10g = value;
return 1;
}
value = value == 0 ? 0 : 1; value = value == 0 ? 0 : 1;
u_int32_t offset = FLOW_REG_OFFSET; u_int32_t offset = FLOW_REG_OFFSET;
u_int32_t *csp0base = 0; u_int32_t *csp0base = 0;
@ -521,12 +538,17 @@ int Beb_SetTenGigaFlowControl(int value) {
retval | ((value << FLOW_REG_TXM_FLOW_CNTRL_10G_OFST) & retval | ((value << FLOW_REG_TXM_FLOW_CNTRL_10G_OFST) &
FLOW_REG_TXM_FLOW_CNTRL_10G_MSK)); FLOW_REG_TXM_FLOW_CNTRL_10G_MSK));
Beb_deactivated_transmission_flowcontrol_10g = value;
Beb_close(fd, csp0base); Beb_close(fd, csp0base);
return 1; return 1;
} }
} }
int Beb_GetTransmissionDelayFrame() { int Beb_GetTransmissionDelayFrame() {
if (!Beb_activated) {
return Beb_deactivated_transmission_delay_frame;
}
u_int32_t offset = TXM_DELAY_FRAME_OFFSET; u_int32_t offset = TXM_DELAY_FRAME_OFFSET;
u_int32_t *csp0base = 0; u_int32_t *csp0base = 0;
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR); int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
@ -547,6 +569,10 @@ int Beb_SetTransmissionDelayFrame(int value) {
LOG(logERROR, ("Invalid transmission delay frame value %d\n", value)); LOG(logERROR, ("Invalid transmission delay frame value %d\n", value));
return 0; return 0;
} }
if (!Beb_activated) {
Beb_deactivated_transmission_delay_frame = value;
return 1;
}
u_int32_t offset = TXM_DELAY_FRAME_OFFSET; u_int32_t offset = TXM_DELAY_FRAME_OFFSET;
u_int32_t *csp0base = 0; u_int32_t *csp0base = 0;
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR); int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
@ -556,12 +582,16 @@ int Beb_SetTransmissionDelayFrame(int value) {
return 0; return 0;
} else { } else {
Beb_Write32(csp0base, offset, value); Beb_Write32(csp0base, offset, value);
Beb_deactivated_transmission_delay_frame = value;
Beb_close(fd, csp0base); Beb_close(fd, csp0base);
return 1; return 1;
} }
} }
int Beb_GetTransmissionDelayLeft() { int Beb_GetTransmissionDelayLeft() {
if (!Beb_activated) {
return Beb_deactivated_transmission_delay_left;
}
u_int32_t offset = TXM_DELAY_LEFT_OFFSET; u_int32_t offset = TXM_DELAY_LEFT_OFFSET;
u_int32_t *csp0base = 0; u_int32_t *csp0base = 0;
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR); int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
@ -582,6 +612,10 @@ int Beb_SetTransmissionDelayLeft(int value) {
LOG(logERROR, ("Invalid transmission delay left value %d\n", value)); LOG(logERROR, ("Invalid transmission delay left value %d\n", value));
return 0; return 0;
} }
if (!Beb_activated) {
Beb_deactivated_transmission_delay_left = value;
return 1;
}
u_int32_t offset = TXM_DELAY_LEFT_OFFSET; u_int32_t offset = TXM_DELAY_LEFT_OFFSET;
u_int32_t *csp0base = 0; u_int32_t *csp0base = 0;
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR); int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
@ -591,12 +625,17 @@ int Beb_SetTransmissionDelayLeft(int value) {
return 0; return 0;
} else { } else {
Beb_Write32(csp0base, offset, value); Beb_Write32(csp0base, offset, value);
Beb_deactivated_transmission_delay_left = value;
Beb_close(fd, csp0base); Beb_close(fd, csp0base);
return 1; return 1;
} }
} }
int Beb_GetTransmissionDelayRight() { int Beb_GetTransmissionDelayRight() {
if (!Beb_activated) {
return Beb_deactivated_transmission_delay_right;
}
u_int32_t offset = TXM_DELAY_RIGHT_OFFSET; u_int32_t offset = TXM_DELAY_RIGHT_OFFSET;
u_int32_t *csp0base = 0; u_int32_t *csp0base = 0;
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR); int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
@ -617,6 +656,10 @@ int Beb_SetTransmissionDelayRight(int value) {
LOG(logERROR, ("Invalid transmission delay right value %d\n", value)); LOG(logERROR, ("Invalid transmission delay right value %d\n", value));
return 0; return 0;
} }
if (!Beb_activated) {
Beb_deactivated_transmission_delay_right = value;
return 1;
}
u_int32_t offset = TXM_DELAY_RIGHT_OFFSET; u_int32_t offset = TXM_DELAY_RIGHT_OFFSET;
u_int32_t *csp0base = 0; u_int32_t *csp0base = 0;
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR); int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
@ -626,57 +669,12 @@ int Beb_SetTransmissionDelayRight(int value) {
return 0; return 0;
} else { } else {
Beb_Write32(csp0base, offset, value); Beb_Write32(csp0base, offset, value);
Beb_deactivated_transmission_delay_right = value;
Beb_close(fd, csp0base); Beb_close(fd, csp0base);
return 1; return 1;
} }
} }
int Beb_SetNetworkParameter(enum NETWORKINDEX mode, int val) {
if (!Beb_activated)
return val;
// mapping new memory
u_int32_t *csp0base = 0;
u_int32_t valueread = 0;
u_int32_t offset = TXM_DELAY_LEFT_OFFSET;
char modename[100] = "";
switch (mode) {
case TXN_LEFT:
offset = TXM_DELAY_LEFT_OFFSET;
strcpy(modename, "Transmission Delay Left");
break;
case TXN_RIGHT:
offset = TXM_DELAY_RIGHT_OFFSET;
strcpy(modename, "Transmission Delay Right");
break;
default:
LOG(logERROR, ("Unrecognized mode in network parameter: %d\n", mode));
return -1;
}
// open file pointer
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
if (fd < 0) {
LOG(logERROR,
("Could not read register to set network parameter. FAIL\n"));
return -1;
} else {
if (val > -1) {
valueread = Beb_Read32(csp0base, offset);
Beb_Write32(csp0base, offset, val);
}
valueread = Beb_Read32(csp0base, offset);
}
// close file pointer
if (fd > 0)
Beb_close(fd, csp0base);
return valueread;
}
u_int32_t Beb_GetFirmwareRevision() { u_int32_t Beb_GetFirmwareRevision() {
// mapping new memory // mapping new memory
u_int32_t *csp0base = 0; u_int32_t *csp0base = 0;

View File

@ -986,11 +986,16 @@ int Feb_Control_StartAcquisition() {
int Feb_Control_StopAcquisition() { return Feb_Control_Reset(); } int Feb_Control_StopAcquisition() { return Feb_Control_Reset(); }
int Feb_Control_SoftwareTrigger() { int Feb_Control_SoftwareTrigger() {
unsigned int orig_value = 0;
Feb_Interface_ReadRegister(Feb_Control_AddressToAll(), DAQ_REG_CHIP_CMDS,
&orig_value);
unsigned int cmd = orig_value | DAQ_REG_CHIP_CMDS_INT_TRIGGER;
if (Feb_Control_activated) { if (Feb_Control_activated) {
unsigned int orig_value = 0;
if (!Feb_Interface_ReadRegister(Feb_Control_AddressToAll(),
DAQ_REG_CHIP_CMDS, &orig_value)) {
LOG(logERROR, ("Could not read DAQ_REG_CHIP_CMDS to send software "
"trigger\n"));
return 0;
}
unsigned int cmd = orig_value | DAQ_REG_CHIP_CMDS_INT_TRIGGER;
// set trigger bit // set trigger bit
LOG(logDEBUG1, ("Setting Trigger, Register:0x%x\n", cmd)); LOG(logDEBUG1, ("Setting Trigger, Register:0x%x\n", cmd));
if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(), if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),
@ -1862,9 +1867,16 @@ int Feb_Control_PrintCorrectedValues() {
// So if software says now 40.00 you neeed to convert to mdegrees 40000(call it // So if software says now 40.00 you neeed to convert to mdegrees 40000(call it
// A1) and then A1/65536/0.00198421639-273.15 // A1) and then A1/65536/0.00198421639-273.15
int Feb_Control_GetLeftFPGATemp() { int Feb_Control_GetLeftFPGATemp() {
if (!Feb_Control_activated) {
return 0;
}
unsigned int temperature = 0; unsigned int temperature = 0;
Feb_Interface_ReadRegister(Feb_Control_leftAddress, FEB_REG_STATUS, if (!Feb_Interface_ReadRegister(Feb_Control_leftAddress, FEB_REG_STATUS,
&temperature); &temperature)) {
LOG(logERROR, ("Trouble reading FEB_REG_STATUS reg to get left feb "
"temperature\n"));
return 0;
}
temperature = temperature >> 16; temperature = temperature >> 16;
temperature = temperature =
@ -1875,9 +1887,16 @@ int Feb_Control_GetLeftFPGATemp() {
} }
int Feb_Control_GetRightFPGATemp() { int Feb_Control_GetRightFPGATemp() {
if (!Feb_Control_activated) {
return 0;
}
unsigned int temperature = 0; unsigned int temperature = 0;
Feb_Interface_ReadRegister(Feb_Control_rightAddress, FEB_REG_STATUS, if (!Feb_Interface_ReadRegister(Feb_Control_rightAddress, FEB_REG_STATUS,
&temperature); &temperature)) {
LOG(logERROR, ("Trouble reading FEB_REG_STATUS reg to get right feb "
"temperature\n"));
return 0;
}
temperature = temperature >> 16; temperature = temperature >> 16;
temperature = temperature =
((((float)(temperature) / 65536.0f) / 0.00198421639f) - 273.15f) * ((((float)(temperature) / 65536.0f) / 0.00198421639f) - 273.15f) *
@ -1887,15 +1906,29 @@ int Feb_Control_GetRightFPGATemp() {
} }
int64_t Feb_Control_GetMeasuredPeriod() { int64_t Feb_Control_GetMeasuredPeriod() {
if (!Feb_Control_activated) {
return 0;
}
unsigned int value = 0; unsigned int value = 0;
Feb_Interface_ReadRegister(Feb_Control_leftAddress, MEAS_PERIOD_REG, if (!Feb_Interface_ReadRegister(Feb_Control_leftAddress, MEAS_PERIOD_REG,
&value); &value)) {
LOG(logERROR,
("Trouble reading MEAS_PERIOD_REG reg to get measured period\n"));
return 0;
}
return (int64_t)value * 10; return (int64_t)value * 10;
} }
int64_t Feb_Control_GetSubMeasuredPeriod() { int64_t Feb_Control_GetSubMeasuredPeriod() {
if (!Feb_Control_activated) {
return 0;
}
unsigned int value = 0; unsigned int value = 0;
Feb_Interface_ReadRegister(Feb_Control_leftAddress, MEAS_SUBPERIOD_REG, if (!Feb_Interface_ReadRegister(Feb_Control_leftAddress, MEAS_SUBPERIOD_REG,
&value); &value)) {
LOG(logERROR, ("Trouble reading MEAS_SUBPERIOD_REG reg to get measured "
"sub period\n"));
return 0;
}
return (int64_t)value * 10; return (int64_t)value * 10;
} }

View File

@ -2217,7 +2217,7 @@ int stopStateMachine() {
sharedMemory_setStop(1); sharedMemory_setStop(1);
// read till status is idle // read till status is idle
while (sharedMemory_getStatus() == RUNNING) while (sharedMemory_getStatus() == RUNNING)
; usleep(500);
sharedMemory_setStop(0); sharedMemory_setStop(0);
LOG(logINFO, ("Stopped State Machine\n")); LOG(logINFO, ("Stopped State Machine\n"));
return OK; return OK;

View File

@ -121,9 +121,10 @@
#define ASIC_CONFIG_RUN_MODE_OFST (0) #define ASIC_CONFIG_RUN_MODE_OFST (0)
#define ASIC_CONFIG_RUN_MODE_MSK (0x00000003 << ASIC_CONFIG_RUN_MODE_OFST) #define ASIC_CONFIG_RUN_MODE_MSK (0x00000003 << ASIC_CONFIG_RUN_MODE_OFST)
#define ASIC_CONFIG_RUN_MODE_INT_BURST_VAL ((0x1 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK) #define ASIC_CONFIG_RUN_MODE_INT_BURST_VAL ((0x0 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
#define ASIC_CONFIG_RUN_MODE_CONT_VAL ((0x2 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK) #define ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL ((0x1 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
#define ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL ((0x3 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK) #define ASIC_CONFIG_RUN_MODE_INT_CONT_VAL ((0x2 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
#define ASIC_CONFIG_RUN_MODE_EXT_CONT_VAL ((0x3 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
#define ASIC_CONFIG_GAIN_OFST (4) #define ASIC_CONFIG_GAIN_OFST (4)
#define ASIC_CONFIG_GAIN_MSK (0x00000003 << ASIC_CONFIG_GAIN_OFST) #define ASIC_CONFIG_GAIN_MSK (0x00000003 << ASIC_CONFIG_GAIN_OFST)
#define ASIC_CONFIG_DYNAMIC_GAIN_VAL ((0x0 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK) #define ASIC_CONFIG_DYNAMIC_GAIN_VAL ((0x0 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)

View File

@ -809,11 +809,15 @@ int setDynamicRange(int dr) { return DYNAMIC_RANGE; }
/* parameters - timer */ /* parameters - timer */
void setNumFrames(int64_t val) { void setNumFrames(int64_t val) {
if (val > 0) { if (val > 0) {
if (burstMode == BURST_OFF) { // continuous
if (burstMode == CONTINUOUS_INTERNAL ||
burstMode == CONTINUOUS_EXTERNAL) {
LOG(logINFO, LOG(logINFO,
("Setting number of frames %lld [Continuous mode]\n", val)); ("Setting number of frames %lld [Continuous mode]\n", val));
set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG); set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
} else { }
// burst
else {
LOG(logINFO, LOG(logINFO,
("Setting number of frames %d [Burst mode]\n", (int)val)); ("Setting number of frames %d [Burst mode]\n", (int)val));
bus_w(ASIC_INT_FRAMES_REG, bus_w(ASIC_INT_FRAMES_REG,
@ -826,9 +830,12 @@ void setNumFrames(int64_t val) {
} }
int64_t getNumFrames() { int64_t getNumFrames() {
if (burstMode == BURST_OFF) { // continuous
if (burstMode == CONTINUOUS_INTERNAL || burstMode == CONTINUOUS_EXTERNAL) {
return get64BitReg(SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG); return get64BitReg(SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
} else { }
// burst
else {
return ((bus_r(ASIC_INT_FRAMES_REG) & ASIC_INT_FRAMES_MSK) >> return ((bus_r(ASIC_INT_FRAMES_REG) & ASIC_INT_FRAMES_MSK) >>
ASIC_INT_FRAMES_OFST); ASIC_INT_FRAMES_OFST);
} }
@ -856,9 +863,13 @@ int64_t getNumTriggers() {
void setNumBursts(int64_t val) { void setNumBursts(int64_t val) {
if (val > 0) { if (val > 0) {
LOG(logINFO, ("Setting number of bursts %lld\n", val)); LOG(logINFO, ("Setting number of bursts %lld\n", val));
if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) { // burst and auto
if ((burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) &&
getTiming() == AUTO_TIMING) {
set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG); set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
} else { }
// burst-trigger or continuous
else {
LOG(logINFO, LOG(logINFO,
("\tNot (Burst and Auto mode): not writing to register\n")); ("\tNot (Burst and Auto mode): not writing to register\n"));
numBurstsReg = val; numBurstsReg = val;
@ -867,9 +878,12 @@ void setNumBursts(int64_t val) {
} }
int64_t getNumBursts() { int64_t getNumBursts() {
if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) { // burst and auto
if ((burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) &&
getTiming() == AUTO_TIMING) {
return get64BitReg(SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG); return get64BitReg(SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
} }
// burst-trigger or continuous
return numBurstsReg; return numBurstsReg;
} }
@ -901,12 +915,16 @@ int setPeriod(int64_t val) {
LOG(logERROR, ("Invalid period: %lld ns\n", val)); LOG(logERROR, ("Invalid period: %lld ns\n", val));
return FAIL; return FAIL;
} }
val *= (1E-9 * systemFrequency); // continuous
if (burstMode == BURST_OFF) { if (burstMode == CONTINUOUS_INTERNAL || burstMode == CONTINUOUS_EXTERNAL) {
LOG(logINFO, ("Setting period %lld ns [Continuous mode]\n", val)); LOG(logINFO, ("Setting period %lld ns [Continuous mode]\n", val));
val *= (1E-9 * systemFrequency);
set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG); set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
} else { }
// burst
else {
LOG(logINFO, ("Setting period %lld ns [Burst mode]\n", val)); LOG(logINFO, ("Setting period %lld ns [Burst mode]\n", val));
val *= (1E-9 * systemFrequency);
set64BitReg(val, ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG); set64BitReg(val, ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG);
} }
// validate for tolerance // validate for tolerance
@ -919,10 +937,13 @@ int setPeriod(int64_t val) {
} }
int64_t getPeriod() { int64_t getPeriod() {
if (burstMode == BURST_OFF) { // continuous
if (burstMode == CONTINUOUS_INTERNAL || burstMode == CONTINUOUS_EXTERNAL) {
return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG) / return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG) /
(1E-9 * systemFrequency); (1E-9 * systemFrequency);
} else { }
// burst
else {
return get64BitReg(ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG) / return get64BitReg(ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG) /
(1E-9 * systemFrequency); (1E-9 * systemFrequency);
} }
@ -965,9 +986,13 @@ int setBurstPeriod(int64_t val) {
} }
LOG(logINFO, ("Setting burst period %lld ns\n", val)); LOG(logINFO, ("Setting burst period %lld ns\n", val));
val *= (1E-9 * systemFrequency); val *= (1E-9 * systemFrequency);
if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) { // burst and auto
if ((burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) &&
getTiming() == AUTO_TIMING) {
set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG); set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
} else { }
// burst-trigger, continuous
else {
LOG(logINFO, LOG(logINFO,
("\tNot (Burst and Auto mode): not writing to register\n")); ("\tNot (Burst and Auto mode): not writing to register\n"));
burstPeriodReg = val; burstPeriodReg = val;
@ -983,10 +1008,13 @@ int setBurstPeriod(int64_t val) {
} }
int64_t getBurstPeriod() { int64_t getBurstPeriod() {
if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) { // burst and auto
if ((burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) &&
getTiming() == AUTO_TIMING) {
return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG) / return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG) /
(1E-9 * systemFrequency); (1E-9 * systemFrequency);
} }
// burst-trigger, continuous
return burstPeriodReg / (1E-9 * systemFrequency); return burstPeriodReg / (1E-9 * systemFrequency);
} }
@ -1210,7 +1238,7 @@ void setTiming(enum timingMode arg) {
get64BitReg(SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG); get64BitReg(SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG);
} }
// auto and burst // auto and burst
else if (burstMode != BURST_OFF) { else if (burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) {
numBurstsReg = get64BitReg(SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG); numBurstsReg = get64BitReg(SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
burstPeriodReg = get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG); burstPeriodReg = get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
} }
@ -1237,7 +1265,7 @@ void setTiming(enum timingMode arg) {
LOG(logINFO, ("\tTriggers reg: %lld, Delay reg: %lldns\n", LOG(logINFO, ("\tTriggers reg: %lld, Delay reg: %lldns\n",
getNumTriggers(), getDelayAfterTrigger())); getNumTriggers(), getDelayAfterTrigger()));
// burst // burst
if (burstMode != BURST_OFF) { if (burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) {
LOG(logINFO, ("\tFrame reg: 1, Period reg: 0\n")) LOG(logINFO, ("\tFrame reg: 1, Period reg: 0\n"))
set64BitReg(1, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG); set64BitReg(1, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
set64BitReg(0, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG); set64BitReg(0, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
@ -1249,7 +1277,7 @@ void setTiming(enum timingMode arg) {
set64BitReg(1, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG); set64BitReg(1, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
set64BitReg(0, SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG); set64BitReg(0, SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG);
// burst // burst
if (burstMode != BURST_OFF) { if (burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) {
set64BitReg(numBurstsReg, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG); set64BitReg(numBurstsReg, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
set64BitReg(burstPeriodReg, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG); set64BitReg(burstPeriodReg, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
LOG(logINFO, ("\tFrames reg (bursts): %lld, Period reg(burst " LOG(logINFO, ("\tFrames reg (bursts): %lld, Period reg(burst "
@ -2052,15 +2080,18 @@ int setBurstModeinFPGA(enum burstMode value) {
uint32_t addr = ASIC_CONFIG_REG; uint32_t addr = ASIC_CONFIG_REG;
uint32_t runmode = 0; uint32_t runmode = 0;
switch (value) { switch (value) {
case BURST_OFF:
runmode = ASIC_CONFIG_RUN_MODE_CONT_VAL;
break;
case BURST_INTERNAL: case BURST_INTERNAL:
runmode = ASIC_CONFIG_RUN_MODE_INT_BURST_VAL; runmode = ASIC_CONFIG_RUN_MODE_INT_BURST_VAL;
break; break;
case BURST_EXTERNAL: case BURST_EXTERNAL:
runmode = ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL; runmode = ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL;
break; break;
case CONTINUOUS_INTERNAL:
runmode = ASIC_CONFIG_RUN_MODE_INT_CONT_VAL;
break;
case CONTINUOUS_EXTERNAL:
runmode = ASIC_CONFIG_RUN_MODE_EXT_CONT_VAL;
break;
default: default:
LOG(logERROR, ("Unknown burst mode %d\n", value)); LOG(logERROR, ("Unknown burst mode %d\n", value));
return FAIL; return FAIL;
@ -2074,16 +2105,20 @@ int setBurstModeinFPGA(enum burstMode value) {
} }
int setBurstMode(enum burstMode burst) { int setBurstMode(enum burstMode burst) {
LOG(logINFO, ("Setting burst mode to %s\n", LOG(logINFO,
burst == BURST_OFF ("Setting burst mode to %s\n",
? "off" (burst == BURST_INTERNAL
: (burst == BURST_INTERNAL ? "internal" : "external"))); ? "burst_internal"
: (burst == BURST_EXTERNAL ? "burst external"
: (burst == CONTINUOUS_INTERNAL
? "continuous internal"
: "continuous external")))));
// update // update
int64_t framesReg = 0; int64_t framesReg = 0;
int64_t periodReg = 0; int64_t periodReg = 0;
// burst // burst
if (burstMode != BURST_OFF) { if (burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) {
framesReg = ((bus_r(ASIC_INT_FRAMES_REG) & ASIC_INT_FRAMES_MSK) >> framesReg = ((bus_r(ASIC_INT_FRAMES_REG) & ASIC_INT_FRAMES_MSK) >>
ASIC_INT_FRAMES_OFST); ASIC_INT_FRAMES_OFST);
periodReg = periodReg =
@ -2107,7 +2142,7 @@ int setBurstMode(enum burstMode burst) {
LOG(logINFO, ("\tUpdating registers\n")); LOG(logINFO, ("\tUpdating registers\n"));
// continuous // continuous
if (burstMode == BURST_OFF) { if (burstMode == CONTINUOUS_INTERNAL || burstMode == CONTINUOUS_EXTERNAL) {
set64BitReg(framesReg, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG); set64BitReg(framesReg, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
set64BitReg(periodReg, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG); set64BitReg(periodReg, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
LOG(logINFO, ("\tFrames reg: %lld, Period reg: %lldns\n", LOG(logINFO, ("\tFrames reg: %lld, Period reg: %lldns\n",
@ -2157,14 +2192,17 @@ int configureASICGlobalSettings() {
int value = ((filter << ASIC_FILTER_OFST) & ASIC_FILTER_MSK) | int value = ((filter << ASIC_FILTER_OFST) & ASIC_FILTER_MSK) |
((cdsGain << ASIC_CDS_GAIN_OFST) & ASIC_CDS_GAIN_MSK); ((cdsGain << ASIC_CDS_GAIN_OFST) & ASIC_CDS_GAIN_MSK);
switch (burstMode) { switch (burstMode) {
case BURST_OFF:
value |= (ASIC_CONT_MODE_MSK | ASIC_EXT_TIMING_MSK);
break;
case BURST_INTERNAL: case BURST_INTERNAL:
break; break;
case BURST_EXTERNAL: case BURST_EXTERNAL:
value |= ASIC_EXT_TIMING_MSK; value |= ASIC_EXT_TIMING_MSK;
break; break;
case CONTINUOUS_INTERNAL:
value |= ASIC_CONT_MODE_MSK;
break;
case CONTINUOUS_EXTERNAL:
value |= (ASIC_CONT_MODE_MSK | ASIC_EXT_TIMING_MSK);
break;
} }
LOG(logINFO, ("\tSending Global Chip settings:0x%x (filter:%d, " LOG(logINFO, ("\tSending Global Chip settings:0x%x (filter:%d, "
"cdsgain:%d)\n", "cdsgain:%d)\n",
@ -2213,15 +2251,18 @@ enum burstMode getBurstMode() {
uint32_t addr = ASIC_CONFIG_REG; uint32_t addr = ASIC_CONFIG_REG;
int runmode = bus_r(addr) & ASIC_CONFIG_RUN_MODE_MSK; int runmode = bus_r(addr) & ASIC_CONFIG_RUN_MODE_MSK;
switch (runmode) { switch (runmode) {
case ASIC_CONFIG_RUN_MODE_CONT_VAL:
burstMode = BURST_OFF;
break;
case ASIC_CONFIG_RUN_MODE_INT_BURST_VAL: case ASIC_CONFIG_RUN_MODE_INT_BURST_VAL:
burstMode = BURST_INTERNAL; burstMode = BURST_INTERNAL;
break; break;
case ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL: case ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL:
burstMode = BURST_EXTERNAL; burstMode = BURST_EXTERNAL;
break; break;
case ASIC_CONFIG_RUN_MODE_INT_CONT_VAL:
burstMode = CONTINUOUS_INTERNAL;
break;
case ASIC_CONFIG_RUN_MODE_EXT_CONT_VAL:
burstMode = CONTINUOUS_EXTERNAL;
break;
default: default:
LOG(logERROR, ("Unknown run mode read from FPGA %d\n", runmode)); LOG(logERROR, ("Unknown run mode read from FPGA %d\n", runmode));
return -1; return -1;
@ -2430,9 +2471,13 @@ void *start_timer(void *arg) {
int numRepeats = getNumTriggers(); int numRepeats = getNumTriggers();
if (getTiming() == AUTO_TIMING) { if (getTiming() == AUTO_TIMING) {
if (burstMode == BURST_OFF) { // continuous
if (burstMode == CONTINUOUS_INTERNAL ||
burstMode == CONTINUOUS_EXTERNAL) {
numRepeats = 1; numRepeats = 1;
} else { }
// burst
else {
numRepeats = getNumBursts(); numRepeats = getNumBursts();
} }
} }
@ -2510,8 +2555,8 @@ void *start_timer(void *arg) {
sendUDPPacket(1, packetData2, vetopacketsize); sendUDPPacket(1, packetData2, vetopacketsize);
} }
LOG(logINFO, LOG(logINFO,
("Sent frame: %d (bursts: %d) [%lld]\n", frameNr, repeatNr, ("Sent frame: %d (bursts/ triggers: %d) [%lld]\n", frameNr,
(long long unsigned int)virtual_currentFrameNumber)); repeatNr, (long long unsigned int)virtual_currentFrameNumber));
clock_gettime(CLOCK_REALTIME, &end); clock_gettime(CLOCK_REALTIME, &end);
int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 + int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 +
(end.tv_nsec - begin.tv_nsec)); (end.tv_nsec - begin.tv_nsec));
@ -2556,7 +2601,7 @@ int stopStateMachine() {
#ifdef VIRTUAL #ifdef VIRTUAL
sharedMemory_setStop(1); sharedMemory_setStop(1);
while (sharedMemory_getStatus() == RUNNING) while (sharedMemory_getStatus() == RUNNING)
; usleep(500);
sharedMemory_setStop(0); sharedMemory_setStop(0);
LOG(logINFO, ("Stopped State Machine\n")); LOG(logINFO, ("Stopped State Machine\n"));
return OK; return OK;

View File

@ -46,8 +46,8 @@
#define DEFAULT_CURRENT_SOURCE (0) #define DEFAULT_CURRENT_SOURCE (0)
#define DEFAULT_TIMING_SOURCE (TIMING_INTERNAL) #define DEFAULT_TIMING_SOURCE (TIMING_INTERNAL)
#define DEFAULT_READOUT_C0 (8) //(108333336) // rdo_clk, 108 MHz #define DEFAULT_READOUT_C0 (6) //(144444448) // rdo_clk, 144 MHz
#define DEFAULT_READOUT_C1 (8) //(108333336) // rdo_x2_clk, 108 MHz #define DEFAULT_READOUT_C1 (6) //(144444448) // rdo_x2_clk, 144 MHz
#define DEFAULT_SYSTEM_C0 (5) //(144444448) // run_clk, 144 MHz #define DEFAULT_SYSTEM_C0 (5) //(144444448) // run_clk, 144 MHz
#define DEFAULT_SYSTEM_C1 (10) //(72222224) // chip_clk, 72 MHz #define DEFAULT_SYSTEM_C1 (10) //(72222224) // chip_clk, 72 MHz
#define DEFAULT_SYSTEM_C2 (5) //(144444448) // sync_clk, 144 MHz #define DEFAULT_SYSTEM_C2 (5) //(144444448) // sync_clk, 144 MHz

View File

@ -1630,7 +1630,7 @@ int stopStateMachine() {
sharedMemory_setStop(1); sharedMemory_setStop(1);
// read till status is idle // read till status is idle
while (sharedMemory_getStatus() == RUNNING) while (sharedMemory_getStatus() == RUNNING)
; usleep(500);
sharedMemory_setStop(0); sharedMemory_setStop(0);
LOG(logINFO, ("Stopped State Machine\n")); LOG(logINFO, ("Stopped State Machine\n"));
} }

View File

@ -1818,7 +1818,7 @@ int stopStateMachine() {
sharedMemory_setStop(1); sharedMemory_setStop(1);
// read till status is idle // read till status is idle
while (sharedMemory_getStatus() == RUNNING) while (sharedMemory_getStatus() == RUNNING)
; usleep(500);
sharedMemory_setStop(0); sharedMemory_setStop(0);
LOG(logINFO, ("Stopped State Machine\n")); LOG(logINFO, ("Stopped State Machine\n"));
return OK; return OK;

View File

@ -1980,7 +1980,7 @@ int stopStateMachine() {
sharedMemory_setStop(1); sharedMemory_setStop(1);
// read till status is idle // read till status is idle
while (sharedMemory_getStatus() == RUNNING) while (sharedMemory_getStatus() == RUNNING)
; usleep(500);
sharedMemory_setStop(0); sharedMemory_setStop(0);
LOG(logINFO, ("Stopped State Machine\n")); LOG(logINFO, ("Stopped State Machine\n"));
return OK; return OK;

View File

@ -49,6 +49,10 @@
#define BASE_ASIC_RDO (0x00500) // 0x1806_0500 - 0x1806_050F #define BASE_ASIC_RDO (0x00500) // 0x1806_0500 - 0x1806_050F
// https://git.psi.ch/sls_detectors_firmware/mythen_III_mcb/blob/master/code/hdl/asic_rdo/asic_rdo.vhd // https://git.psi.ch/sls_detectors_firmware/mythen_III_mcb/blob/master/code/hdl/asic_rdo/asic_rdo.vhd
/** Dead time Free Controller */
#define BASE_DEADTIME_FREE_CTRL (0x00580) // 0x1806_0580 - 0x1806_0587
// https://git.psi.ch/sls_detectors_firmware/mythen_III_mcb/blob/master/code/hdl/DeadTimeFreeController/DeadTimeFreeCtrl.vhd
/* UDP datagram generator */ /* UDP datagram generator */
#define BASE_UDP_RAM (0x01000) // 0x1806_1000 - 0x1806_1FFF #define BASE_UDP_RAM (0x01000) // 0x1806_1000 - 0x1806_1FFF
@ -140,6 +144,13 @@
#define DTA_OFFSET_REG (0x24 * REG_OFFSET + BASE_CONTROL) #define DTA_OFFSET_REG (0x24 * REG_OFFSET + BASE_CONTROL)
/* Formatting for data core -----------------------------------------------*/
#define FMT_CONFIG_REG (0x00 * REG_OFFSET + BASE_FMT)
#define FMT_CONFIG_TXN_DELAY_OFST (0)
#define FMT_CONFIG_TXN_DELAY_MSK (0x00FFFFFF << FMT_CONFIG_TXN_DELAY_OFST)
/* Packetizer -------------------------------------------------------------*/ /* Packetizer -------------------------------------------------------------*/
/* Packetizer Config Register */ /* Packetizer Config Register */
@ -460,4 +471,15 @@
#define ASICRDO_CNFG_RESSTRG_LNGTH_OFST (0) #define ASICRDO_CNFG_RESSTRG_LNGTH_OFST (0)
#define ASICRDO_CNFG_RESSTRG_LNGTH_MSK (0x000000FF << ASICRDO_CNFG_RESSTRG_LNGTH_OFST) #define ASICRDO_CNFG_RESSTRG_LNGTH_MSK (0x000000FF << ASICRDO_CNFG_RESSTRG_LNGTH_OFST)
/** Dead time Free Controller
* --------------------------------------------------*/
#define DEADTIME_CONFIG_REG (0x00 * REG_OFFSET + BASE_DEADTIME_FREE_CTRL)
#define DEADTIME_FREE_MODE_ENBL_OFST (0)
#define DEADTIME_FREE_MODE_ENBL_MSK (0x00000001 << DEADTIME_FREE_MODE_ENBL_OFST)
#define DEADTIME_EARLY_EXP_FIN_ERR_OFST (4)
#define DEADTIME_EARLY_EXP_FIN_ERR_MSK (0x00000001 << DEADTIME_EARLY_EXP_FIN_ERR_OFST)
// clang-format on // clang-format on

View File

@ -249,15 +249,15 @@ u_int16_t getHardwareVersionNumber() {
#ifdef VIRTUAL #ifdef VIRTUAL
return 0; return 0;
#endif #endif
return bus_r(MCB_SERIAL_NO_REG); return ((bus_r(MCB_SERIAL_NO_REG) & MCB_SERIAL_NO_VRSN_MSK) >>
MCB_SERIAL_NO_VRSN_OFST);
} }
u_int32_t getDetectorNumber() { u_int32_t getDetectorNumber() {
#ifdef VIRTUAL #ifdef VIRTUAL
return 0; return 0;
#endif #endif
return ((bus_r(MCB_SERIAL_NO_REG) & MCB_SERIAL_NO_VRSN_MSK) >> return bus_r(MCB_SERIAL_NO_REG);
MCB_SERIAL_NO_VRSN_OFST);
} }
u_int64_t getDetectorMAC() { u_int64_t getDetectorMAC() {
@ -378,6 +378,7 @@ void setupDetector() {
clkDivider[SYSTEM_C0] = DEFAULT_SYSTEM_C0; clkDivider[SYSTEM_C0] = DEFAULT_SYSTEM_C0;
clkDivider[SYSTEM_C1] = DEFAULT_SYSTEM_C1; clkDivider[SYSTEM_C1] = DEFAULT_SYSTEM_C1;
clkDivider[SYSTEM_C2] = DEFAULT_SYSTEM_C2; clkDivider[SYSTEM_C2] = DEFAULT_SYSTEM_C2;
clkDivider[SYSTEM_C3] = DEFAULT_SYSTEM_C3;
highvoltage = 0; highvoltage = 0;
trimmingPrint = logINFO; trimmingPrint = logINFO;
@ -572,239 +573,27 @@ int setDynamicRange(int dr) {
} }
} }
/* parameters - module, speed, readout */ /* set parameters - readout */
int setModule(sls_detector_module myMod, char *mess) { int setParallelMode(int mode) {
if (mode < 0)
LOG(logINFO, ("Setting module\n"));
/* future implementation
// settings (not yet implemented)
setSettings((enum detectorSettings)myMod.reg);
if (myMod.reg >= 0) {
detectorModules->reg = myMod.reg;
}
// threshold
if (myMod.eV >= 0)
setThresholdEnergy(myMod.eV);
else {
// (loading a random trim file) (dont return fail)
setSettings(UNDEFINED);
LOG(logERROR,
("Settings has been changed to undefined (random trim
file)\n"));
}
*/
// dacs
for (int i = 0; i < NDAC; ++i) {
// ignore dacs with -1
if (myMod.dacs[i] != -1) {
setDAC((enum DACINDEX)i, myMod.dacs[i], 0);
if (myMod.dacs[i] != detectorDacs[i]) {
sprintf(mess, "Could not set module. Could not set dac %d\n",
i);
LOG(logERROR, (mess));
// setSettings(UNDEFINED);
// LOG(logERROR, ("Settings has been changed to undefined\n"));
return FAIL; return FAIL;
} LOG(logINFO, ("Setting %s mode\n", (mode ? "Parallel" : "Non Parallel")));
} uint32_t addr = DEADTIME_CONFIG_REG;
} if (mode) {
bus_w(addr, bus_r(addr) | DEADTIME_FREE_MODE_ENBL_MSK);
// trimbits
if (myMod.nchan == 0) {
LOG(logINFO, ("Setting module without trimbits\n"));
} else { } else {
// set trimbits bus_w(addr, bus_r(addr) & ~DEADTIME_FREE_MODE_ENBL_MSK);
if (setTrimbits(myMod.chanregs) == FAIL) {
sprintf(mess, "Could not set module. Could not set trimbits\n");
LOG(logERROR, (mess));
// setSettings(UNDEFINED);
// LOG(logERROR, ("Settings has been changed to undefined (random "
// "trim file)\n"));
return FAIL;
} }
}
return OK; return OK;
} }
int setBit(int ibit, int patword) { return patword |= (1 << ibit); } int getParallelMode() {
return ((bus_r(DEADTIME_CONFIG_REG) & DEADTIME_FREE_MODE_ENBL_MSK) >>
int clearBit(int ibit, int patword) { return patword &= ~(1 << ibit); } DEADTIME_FREE_MODE_ENBL_OFST);
int setTrimbits(int *trimbits) {
LOG(logINFOBLUE, ("Setting trimbits\n"));
// validate
for (int ichan = 0; ichan < ((detectorModules)->nchan); ++ichan) {
if (trimbits[ichan] < 0 || trimbits[ichan] > 63) {
LOG(logERROR, ("Trimbit value (%d) for channel %d is invalid\n",
trimbits[ichan], ichan));
return FAIL;
}
}
LOG(logINFO, ("Trimbits validated\n"));
trimmingPrint = logDEBUG5;
uint64_t patword = 0;
int iaddr = 0;
for (int ichip = 0; ichip < NCHIP; ichip++) {
LOG(logDEBUG1, (" Chip %d\n", ichip));
iaddr = 0;
patword = 0;
writePatternWord(iaddr++, patword);
// chip select
patword = setBit(SIGNAL_TBLoad_1 + ichip, patword);
writePatternWord(iaddr++, patword);
// reset trimbits
patword = setBit(SIGNAL_resStorage, patword);
patword = setBit(SIGNAL_resCounter, patword);
writePatternWord(iaddr++, patword);
writePatternWord(iaddr++, patword);
patword = clearBit(SIGNAL_resStorage, patword);
patword = clearBit(SIGNAL_resCounter, patword);
writePatternWord(iaddr++, patword);
writePatternWord(iaddr++, patword);
// select first channel
patword = setBit(SIGNAL_CHSserialIN, patword);
writePatternWord(iaddr++, patword);
// 1 clk pulse
patword = setBit(SIGNAL_CHSclk, patword);
writePatternWord(iaddr++, patword);
patword = clearBit(SIGNAL_CHSclk, patword);
// clear 1st channel
writePatternWord(iaddr++, patword);
patword = clearBit(SIGNAL_CHSserialIN, patword);
// 2 clk pulses
for (int i = 0; i < 2; i++) {
patword = setBit(SIGNAL_CHSclk, patword);
writePatternWord(iaddr++, patword);
patword = clearBit(SIGNAL_CHSclk, patword);
writePatternWord(iaddr++, patword);
} }
// for each channel (all chips) /* parameters - timer */
for (int ich = 0; ich < NCHAN_1_COUNTER; ich++) {
LOG(logDEBUG1, (" Chip %d, Channel %d\n", ichip, ich));
int val = trimbits[ichip * NCHAN_1_COUNTER * NCOUNTERS +
NCOUNTERS * ich] +
trimbits[ichip * NCHAN_1_COUNTER * NCOUNTERS +
NCOUNTERS * ich + 1] *
64 +
trimbits[ichip * NCHAN_1_COUNTER * NCOUNTERS +
NCOUNTERS * ich + 2] *
64 * 64;
// push 6 0 bits
for (int i = 0; i < 6; i++) {
patword = clearBit(SIGNAL_serialIN, patword);
patword = clearBit(SIGNAL_clk, patword);
writePatternWord(iaddr++, patword);
patword = setBit(SIGNAL_clk, patword);
writePatternWord(iaddr++, patword);
}
// deserialize
for (int i = 0; i < 18; i++) {
if (val & (1 << i)) {
patword = setBit(SIGNAL_serialIN, patword);
} else {
patword = clearBit(SIGNAL_serialIN, patword);
}
patword = clearBit(SIGNAL_clk, patword);
writePatternWord(iaddr++, patword);
patword = setBit(SIGNAL_clk, patword);
writePatternWord(iaddr++, patword);
}
writePatternWord(iaddr++, patword);
writePatternWord(iaddr++, patword);
// move to next channel
for (int i = 0; i < 3; i++) {
patword = setBit(SIGNAL_CHSclk, patword);
writePatternWord(iaddr++, patword);
patword = clearBit(SIGNAL_CHSclk, patword);
writePatternWord(iaddr++, patword);
}
}
// chip unselect
patword = clearBit(SIGNAL_TBLoad_1 + ichip, patword);
writePatternWord(iaddr++, patword);
// last iaddr check
if (iaddr >= MAX_PATTERN_LENGTH) {
LOG(logERROR, ("Addr 0x%x is past max_address_length 0x%x!\n",
iaddr, MAX_PATTERN_LENGTH));
trimmingPrint = logINFO;
return FAIL;
}
// set pattern wait address
for (int i = 0; i <= 2; i++)
setPatternWaitAddress(i, MAX_PATTERN_LENGTH - 1);
// pattern loop
for (int i = 0; i <= 2; i++) {
int stop = MAX_PATTERN_LENGTH - 1, nloop = 0;
setPatternLoop(i, &stop, &stop, &nloop);
}
// pattern limits
{
int start = 0, nloop = 0;
setPatternLoop(-1, &start, &iaddr, &nloop);
}
// send pattern to the chips
startPattern();
}
// copy trimbits locally
for (int ichan = 0; ichan < ((detectorModules)->nchan); ++ichan) {
detectorChans[ichan] = trimbits[ichan];
}
trimmingPrint = logINFO;
LOG(logINFO, ("All trimbits have been loaded\n"));
return OK;
}
int setAllTrimbits(int val) {
int *trimbits = malloc(sizeof(int) * ((detectorModules)->nchan));
for (int ichan = 0; ichan < ((detectorModules)->nchan); ++ichan) {
trimbits[ichan] = val;
}
if (setTrimbits(trimbits) == FAIL) {
LOG(logERROR, ("Could not set all trimbits to %d\n", val));
free(trimbits);
return FAIL;
}
// setSettings(UNDEFINED);
// LOG(logERROR, ("Settings has been changed to undefined (random "
// "trim file)\n"));
LOG(logINFO, ("All trimbits have been set to %d\n", val));
free(trimbits);
return OK;
}
int getAllTrimbits() {
int value = detectorChans[0];
if (detectorModules) {
for (int ichan = 0; ichan < ((detectorModules)->nchan); ichan++) {
if (detectorChans[ichan] != value) {
value = -1;
break;
}
}
}
LOG(logINFO, ("Value of all Trimbits: %d\n", value));
return value;
}
void setNumFrames(int64_t val) { void setNumFrames(int64_t val) {
if (val > 0) { if (val > 0) {
@ -1147,6 +936,240 @@ int64_t getMeasurementTime() {
(1E-9 * FIXED_PLL_FREQUENCY); (1E-9 * FIXED_PLL_FREQUENCY);
} }
/* parameters - module, speed, readout */
int setModule(sls_detector_module myMod, char *mess) {
LOG(logINFO, ("Setting module\n"));
/* future implementation
// settings (not yet implemented)
setSettings((enum detectorSettings)myMod.reg);
if (myMod.reg >= 0) {
detectorModules->reg = myMod.reg;
}
// threshold
if (myMod.eV >= 0)
setThresholdEnergy(myMod.eV);
else {
// (loading a random trim file) (dont return fail)
setSettings(UNDEFINED);
LOG(logERROR,
("Settings has been changed to undefined (random trim
file)\n"));
}
*/
// dacs
for (int i = 0; i < NDAC; ++i) {
// ignore dacs with -1
if (myMod.dacs[i] != -1) {
setDAC((enum DACINDEX)i, myMod.dacs[i], 0);
if (myMod.dacs[i] != detectorDacs[i]) {
sprintf(mess, "Could not set module. Could not set dac %d\n",
i);
LOG(logERROR, (mess));
// setSettings(UNDEFINED);
// LOG(logERROR, ("Settings has been changed to undefined\n"));
return FAIL;
}
}
}
// trimbits
if (myMod.nchan == 0) {
LOG(logINFO, ("Setting module without trimbits\n"));
} else {
// set trimbits
if (setTrimbits(myMod.chanregs) == FAIL) {
sprintf(mess, "Could not set module. Could not set trimbits\n");
LOG(logERROR, (mess));
// setSettings(UNDEFINED);
// LOG(logERROR, ("Settings has been changed to undefined (random "
// "trim file)\n"));
return FAIL;
}
}
return OK;
}
int setBit(int ibit, int patword) { return patword |= (1 << ibit); }
int clearBit(int ibit, int patword) { return patword &= ~(1 << ibit); }
int setTrimbits(int *trimbits) {
LOG(logINFOBLUE, ("Setting trimbits\n"));
// validate
for (int ichan = 0; ichan < ((detectorModules)->nchan); ++ichan) {
if (trimbits[ichan] < 0 || trimbits[ichan] > 63) {
LOG(logERROR, ("Trimbit value (%d) for channel %d is invalid\n",
trimbits[ichan], ichan));
return FAIL;
}
}
LOG(logINFO, ("Trimbits validated\n"));
trimmingPrint = logDEBUG5;
uint64_t patword = 0;
int iaddr = 0;
for (int ichip = 0; ichip < NCHIP; ichip++) {
LOG(logDEBUG1, (" Chip %d\n", ichip));
iaddr = 0;
patword = 0;
writePatternWord(iaddr++, patword);
// chip select
patword = setBit(SIGNAL_TBLoad_1 + ichip, patword);
writePatternWord(iaddr++, patword);
// reset trimbits
patword = setBit(SIGNAL_resStorage, patword);
patword = setBit(SIGNAL_resCounter, patword);
writePatternWord(iaddr++, patword);
writePatternWord(iaddr++, patword);
patword = clearBit(SIGNAL_resStorage, patword);
patword = clearBit(SIGNAL_resCounter, patword);
writePatternWord(iaddr++, patword);
writePatternWord(iaddr++, patword);
// select first channel
patword = setBit(SIGNAL_CHSserialIN, patword);
writePatternWord(iaddr++, patword);
// 1 clk pulse
patword = setBit(SIGNAL_CHSclk, patword);
writePatternWord(iaddr++, patword);
patword = clearBit(SIGNAL_CHSclk, patword);
// clear 1st channel
writePatternWord(iaddr++, patword);
patword = clearBit(SIGNAL_CHSserialIN, patword);
// 2 clk pulses
for (int i = 0; i < 2; i++) {
patword = setBit(SIGNAL_CHSclk, patword);
writePatternWord(iaddr++, patword);
patword = clearBit(SIGNAL_CHSclk, patword);
writePatternWord(iaddr++, patword);
}
// for each channel (all chips)
for (int ich = 0; ich < NCHAN_1_COUNTER; ich++) {
LOG(logDEBUG1, (" Chip %d, Channel %d\n", ichip, ich));
int val = trimbits[ichip * NCHAN_1_COUNTER * NCOUNTERS +
NCOUNTERS * ich] +
trimbits[ichip * NCHAN_1_COUNTER * NCOUNTERS +
NCOUNTERS * ich + 1] *
64 +
trimbits[ichip * NCHAN_1_COUNTER * NCOUNTERS +
NCOUNTERS * ich + 2] *
64 * 64;
// push 6 0 bits
for (int i = 0; i < 6; i++) {
patword = clearBit(SIGNAL_serialIN, patword);
patword = clearBit(SIGNAL_clk, patword);
writePatternWord(iaddr++, patword);
patword = setBit(SIGNAL_clk, patword);
writePatternWord(iaddr++, patword);
}
// deserialize
for (int i = 0; i < 18; i++) {
if (val & (1 << i)) {
patword = setBit(SIGNAL_serialIN, patword);
} else {
patword = clearBit(SIGNAL_serialIN, patword);
}
patword = clearBit(SIGNAL_clk, patword);
writePatternWord(iaddr++, patword);
patword = setBit(SIGNAL_clk, patword);
writePatternWord(iaddr++, patword);
}
writePatternWord(iaddr++, patword);
writePatternWord(iaddr++, patword);
// move to next channel
for (int i = 0; i < 3; i++) {
patword = setBit(SIGNAL_CHSclk, patword);
writePatternWord(iaddr++, patword);
patword = clearBit(SIGNAL_CHSclk, patword);
writePatternWord(iaddr++, patword);
}
}
// chip unselect
patword = clearBit(SIGNAL_TBLoad_1 + ichip, patword);
writePatternWord(iaddr++, patword);
// last iaddr check
if (iaddr >= MAX_PATTERN_LENGTH) {
LOG(logERROR, ("Addr 0x%x is past max_address_length 0x%x!\n",
iaddr, MAX_PATTERN_LENGTH));
trimmingPrint = logINFO;
return FAIL;
}
// set pattern wait address
for (int i = 0; i <= 2; i++)
setPatternWaitAddress(i, MAX_PATTERN_LENGTH - 1);
// pattern loop
for (int i = 0; i <= 2; i++) {
int stop = MAX_PATTERN_LENGTH - 1, nloop = 0;
setPatternLoop(i, &stop, &stop, &nloop);
}
// pattern limits
{
int start = 0, nloop = 0;
setPatternLoop(-1, &start, &iaddr, &nloop);
}
// send pattern to the chips
startPattern();
}
// copy trimbits locally
for (int ichan = 0; ichan < ((detectorModules)->nchan); ++ichan) {
detectorChans[ichan] = trimbits[ichan];
}
trimmingPrint = logINFO;
LOG(logINFO, ("All trimbits have been loaded\n"));
return OK;
}
int setAllTrimbits(int val) {
int *trimbits = malloc(sizeof(int) * ((detectorModules)->nchan));
for (int ichan = 0; ichan < ((detectorModules)->nchan); ++ichan) {
trimbits[ichan] = val;
}
if (setTrimbits(trimbits) == FAIL) {
LOG(logERROR, ("Could not set all trimbits to %d\n", val));
free(trimbits);
return FAIL;
}
// setSettings(UNDEFINED);
// LOG(logERROR, ("Settings has been changed to undefined (random "
// "trim file)\n"));
LOG(logINFO, ("All trimbits have been set to %d\n", val));
free(trimbits);
return OK;
}
int getAllTrimbits() {
int value = detectorChans[0];
if (detectorModules) {
for (int ichan = 0; ichan < ((detectorModules)->nchan); ichan++) {
if (detectorChans[ichan] != value) {
value = -1;
break;
}
}
}
LOG(logINFO, ("Value of all Trimbits: %d\n", value));
return value;
}
/* parameters - dac, hv */ /* parameters - dac, hv */
void setDAC(enum DACINDEX ind, int val, int mV) { void setDAC(enum DACINDEX ind, int val, int mV) {
if (val < 0) { if (val < 0) {
@ -2044,6 +2067,7 @@ int setClockDivider(enum CLKINDEX ind, int val) {
clkPhase[SYSTEM_C0] = 0; clkPhase[SYSTEM_C0] = 0;
clkPhase[SYSTEM_C1] = 0; clkPhase[SYSTEM_C1] = 0;
clkPhase[SYSTEM_C2] = 0; clkPhase[SYSTEM_C2] = 0;
clkPhase[SYSTEM_C3] = 0;
} }
// set the phase in degrees (reset by pll) // set the phase in degrees (reset by pll)
@ -2067,6 +2091,28 @@ int getClockDivider(enum CLKINDEX ind) {
return clkDivider[ind]; return clkDivider[ind];
} }
int getTransmissionDelayFrame() {
return ((bus_r(FMT_CONFIG_REG) & FMT_CONFIG_TXN_DELAY_MSK) >>
FMT_CONFIG_TXN_DELAY_OFST);
}
int setTransmissionDelayFrame(int value) {
if (value < 0 || value > MAX_TIMESLOT_VAL) {
LOG(logERROR, ("Transmission delay %d should be in range: 0 - %d\n",
value, MAX_TIMESLOT_VAL));
return FAIL;
}
LOG(logINFO, ("Setting transmission delay: %d\n", value));
uint32_t addr = FMT_CONFIG_REG;
bus_w(addr, bus_r(addr) & ~FMT_CONFIG_TXN_DELAY_MSK);
bus_w(addr, (bus_r(addr) | ((value << FMT_CONFIG_TXN_DELAY_OFST) &
FMT_CONFIG_TXN_DELAY_MSK)));
LOG(logDEBUG1, ("Transmission delay read %d\n",
((bus_r(addr) & FMT_CONFIG_TXN_DELAY_MSK) >>
FMT_CONFIG_TXN_DELAY_OFST)));
return OK;
}
/* aquisition */ /* aquisition */
int startStateMachine() { int startStateMachine() {
@ -2239,7 +2285,7 @@ int stopStateMachine() {
sharedMemory_setStop(1); sharedMemory_setStop(1);
// read till status is idle // read till status is idle
while (sharedMemory_getStatus() == RUNNING) while (sharedMemory_getStatus() == RUNNING)
; usleep(500);
sharedMemory_setStop(0); sharedMemory_setStop(0);
LOG(logINFO, ("Stopped State Machine\n")); LOG(logINFO, ("Stopped State Machine\n"));
} }
@ -2294,8 +2340,17 @@ enum runStatus getRunStatus() {
// not running // not running
else { else {
// error from too short exptime in parallel mode
uint32_t deadtimeReg = bus_r(DEADTIME_CONFIG_REG);
if ((deadtimeReg & DEADTIME_EARLY_EXP_FIN_ERR_MSK) >>
DEADTIME_EARLY_EXP_FIN_ERR_OFST) {
LOG(logERROR,
("Status: ERROR in Dead Time Reg (too short exptime) %08x\n",
deadtimeReg));
s = ERROR;
}
// stopped or error // stopped or error
if (retval & FLOW_STATUS_FIFO_FULL_MSK) { else if (retval & FLOW_STATUS_FIFO_FULL_MSK) {
LOG(logINFOBLUE, ("Status: STOPPED\n")); // FIFO FULL?? LOG(logINFOBLUE, ("Status: STOPPED\n")); // FIFO FULL??
s = STOPPED; s = STOPPED;
} else if (retval & FLOW_STATUS_CSM_BUSY_MSK) { } else if (retval & FLOW_STATUS_CSM_BUSY_MSK) {

View File

@ -36,18 +36,20 @@
#define DEFAULT_DELAY_AFTER_TRIGGER (0) #define DEFAULT_DELAY_AFTER_TRIGGER (0)
#define DEFAULT_HIGH_VOLTAGE (0) #define DEFAULT_HIGH_VOLTAGE (0)
#define DEFAULT_TIMING_MODE (AUTO_TIMING) #define DEFAULT_TIMING_MODE (AUTO_TIMING)
#define DEFAULT_READOUT_C0 (10) //(125000000) // rdo_clk, 125 MHz #define DEFAULT_READOUT_C0 (8) //(125000000) // rdo_clk, 125 MHz
#define DEFAULT_READOUT_C1 (10) //(125000000) // rdo_x2_clk, 125 MHz #define DEFAULT_READOUT_C1 (8) //(125000000) // rdo_x2_clk, 125 MHz
#define DEFAULT_SYSTEM_C0 (4) //(250000000) // run_clk, 250 MHz #define DEFAULT_SYSTEM_C0 (4) //(250000000) // run_clk, 250 MHz
#define DEFAULT_SYSTEM_C1 (8) //(125000000) // chip_clk, 125 MHz #define DEFAULT_SYSTEM_C1 (8) //(125000000) // sync_clk, 125 MHz
#define DEFAULT_SYSTEM_C2 (8) //(125000000) // sync_clk, 125 MHz #define DEFAULT_SYSTEM_C2 (8) //(125000000) // str_clk, 125 MHz
#define DEFAULT_SYSTEM_C3 (5) //(200000000) // smp_clk, 200 MHz (only for timing receiver)
#define DEFAULT_ASIC_LATCHING_NUM_PULSES (10) #define DEFAULT_ASIC_LATCHING_NUM_PULSES (10)
#define DEFAULT_MSTR_OTPT_P1_NUM_PULSES (20) #define DEFAULT_MSTR_OTPT_P1_NUM_PULSES (20)
/* Firmware Definitions */ /* Firmware Definitions */
#define MAX_TIMESLOT_VAL (0xFFFFFF)
#define IP_HEADER_SIZE (20) #define IP_HEADER_SIZE (20)
#define FIXED_PLL_FREQUENCY (020000000) // 20MHz #define FIXED_PLL_FREQUENCY (020000000) // 20MHz
#define READOUT_PLL_VCO_FREQ_HZ (1250000000) // 1.25GHz #define READOUT_PLL_VCO_FREQ_HZ (1000000000) // 1GHz
#define SYSTEM_PLL_VCO_FREQ_HZ (1000000000) // 1GHz #define SYSTEM_PLL_VCO_FREQ_HZ (1000000000) // 1GHz
#define MAX_NUM_DESERIALIZERS (40) #define MAX_NUM_DESERIALIZERS (40)
@ -104,10 +106,11 @@ enum CLKINDEX {
SYSTEM_C0, SYSTEM_C0,
SYSTEM_C1, SYSTEM_C1,
SYSTEM_C2, SYSTEM_C2,
SYSTEM_C3,
NUM_CLOCKS NUM_CLOCKS
}; };
#define CLK_NAMES \ #define CLK_NAMES \
"READOUT_C0", "READOUT_C1", "SYSTEM_C0", "SYSTEM_C1", "SYSTEM_C2" "READOUT_C0", "READOUT_C1", "SYSTEM_C0", "SYSTEM_C1", "SYSTEM_C2", "SYSTEM_C3"
enum PLLINDEX { READOUT_PLL, SYSTEM_PLL }; enum PLLINDEX { READOUT_PLL, SYSTEM_PLL };
/* Struct Definitions */ /* Struct Definitions */

View File

@ -179,9 +179,11 @@ int setExternalSampling(int val);
#endif #endif
// parameters - readout // parameters - readout
#ifdef EIGERD #if defined(EIGERD) || defined(MYTHEN3D)
int setParallelMode(int mode); int setParallelMode(int mode);
int getParallelMode(); int getParallelMode();
#endif
#ifdef EIGERD
int setOverFlowMode(int mode); int setOverFlowMode(int mode);
int getOverFlowMode(); int getOverFlowMode();
#endif #endif
@ -277,9 +279,9 @@ int64_t getMeasurementTime();
int setModule(sls_detector_module myMod, char *mess); int setModule(sls_detector_module myMod, char *mess);
#endif #endif
#ifdef MYTHEN3D #ifdef MYTHEN3D
int setTrimbits(int *trimbits);
int setBit(int ibit, int patword); int setBit(int ibit, int patword);
int clearBit(int ibit, int patword); int clearBit(int ibit, int patword);
int setTrimbits(int *trimbits);
int setAllTrimbits(int val); int setAllTrimbits(int val);
int getAllTrimbits(); int getAllTrimbits();
#endif #endif
@ -531,6 +533,8 @@ int *getBadChannels(int *nch);
#if defined(JUNGFRAUD) || defined(EIGERD) #if defined(JUNGFRAUD) || defined(EIGERD)
int getTenGigaFlowControl(); int getTenGigaFlowControl();
int setTenGigaFlowControl(int value); int setTenGigaFlowControl(int value);
#endif
#if defined(JUNGFRAUD) || defined(EIGERD) || defined(MYTHEN3D)
int getTransmissionDelayFrame(); int getTransmissionDelayFrame();
int setTransmissionDelayFrame(int value); int setTransmissionDelayFrame(int value);
#endif #endif

View File

@ -9,6 +9,7 @@
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
#include "versionAPI.h" #include "versionAPI.h"
#include <getopt.h>
#include <signal.h> #include <signal.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
@ -36,9 +37,58 @@ void sigInterruptHandler(int p) {
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
// print version // options
if (argc > 1 && !strcasecmp(argv[1], "-version")) { int portno = DEFAULT_PORTNO;
isControlServer = 1;
debugflag = 0;
checkModuleFlag = 1;
int version = 0; int version = 0;
// help message
char helpMessage[MAX_STR_LENGTH];
memset(helpMessage, 0, MAX_STR_LENGTH);
sprintf(
helpMessage,
"Usage: %s [arguments]\n"
"Possible arguments are:\n"
"\t-v, --version : Software version\n"
"\t-p, --port <port> : TCP communication port with client. \n"
"\t-d, --devel : Developer mode. Skips firmware checks. \n"
"\t-g, --nomodule : [Mythen3][Gotthard2] Generic or No "
"Module mode. Skips detector type checks. \n"
"\t-f, --phaseshift <value> : [Gotthard] only. Sets phase shift. \n"
"\t-s, --stopserver : Stop server. Do not use as created by "
"control server \n\n",
argv[0]);
// parse command line for config
static struct option long_options[] = {
// These options set a flag.
// These options dont set a flag. We distinguish them by their indices.
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'v'},
{"port", required_argument, NULL, 'p'},
{"devel", no_argument, NULL, 'd'},
{"phaseshift", required_argument, NULL, 'f'},
{"nomodule", no_argument, NULL, 'g'}, // generic
{"stopserver", no_argument, NULL, 's'},
{NULL, 0, NULL, 0}};
optind = 1;
// getopt_long stores the option index here
int option_index = 0;
int c = 0;
while (c != -1) {
c = getopt_long(argc, argv, "hvp:df:gs", long_options, &option_index);
// Detect the end of the options
if (c == -1)
break;
switch (c) {
case 'v':
#ifdef GOTTHARDD #ifdef GOTTHARDD
version = APIGOTTHARD; version = APIGOTTHARD;
#elif EIGERD #elif EIGERD
@ -49,63 +99,67 @@ int main(int argc, char *argv[]) {
version = APICTB; version = APICTB;
#elif MOENCHD #elif MOENCHD
version = APIMOENCH; version = APIMOENCH;
#elif MYTHEN3D
version = APIMYTHEN3;
#elif GOTTHARD2D
version = APIGOTTHARD2;
#endif #endif
LOG(logINFO, ("SLS Detector Server %s (0x%x)\n", GITBRANCH, version)); LOG(logINFOBLUE, ("SLS Detector Server Version: %s (0x%x)\n",
} GITBRANCH, version));
exit(EXIT_SUCCESS);
int portno = DEFAULT_PORTNO; case 'p':
isControlServer = 1; if (sscanf(optarg, "%d", &portno) != 1) {
debugflag = 0; LOG(logERROR, ("Cannot scan port argument\n%s", helpMessage));
checkModuleFlag = 1; exit(EXIT_FAILURE);
// if socket crash, ignores SISPIPE, prevents global signal handler
// subsequent read/write to socket gives error - must handle locally
signal(SIGPIPE, SIG_IGN);
// circumvent the basic tests
for (int i = 1; i < argc; ++i) {
if (!strcasecmp(argv[i], "-stopserver")) {
LOG(logINFO, ("Detected stop server\n"));
isControlServer = 0;
} else if (!strcasecmp(argv[i], "-devel")) {
LOG(logINFO, ("Detected developer mode\n"));
debugflag = 1;
} else if (!strcasecmp(argv[i], "-nomodule")) {
LOG(logINFO, ("Detected No Module mode\n"));
checkModuleFlag = 0;
} else if (!strcasecmp(argv[i], "-port")) {
if ((i + 1) >= argc) {
LOG(logERROR, ("no port value given. Exiting.\n"));
return -1;
}
if (sscanf(argv[i + 1], "%d", &portno) == 0) {
LOG(logERROR,
("cannot decode port value %s. Exiting.\n", argv[i + 1]));
return -1;
} }
LOG(logINFO, ("Detected port: %d\n", portno)); LOG(logINFO, ("Detected port: %d\n", portno));
break;
case 'd':
LOG(logINFO, ("Detected developer mode\n"));
debugflag = 1;
break;
case 'f':
#ifndef GOTTHARDD
LOG(logERROR,
("Phase shift argument not implemented for this detector\n"));
exit(EXIT_FAILURE);
#else
if (sscanf(optarg, "%d", &phaseShift) != 1) {
LOG(logERROR,
("Cannot scan phase shift argument\n%s", helpMessage));
exit(EXIT_FAILURE);
} }
#ifdef GOTTHARDD LOG(logINFO, ("Detected phase shift: %d\n", phaseShift));
else if (!strcasecmp(argv[i], "-phaseshift")) {
if ((i + 1) >= argc) {
LOG(logERROR, ("no phase shift value given. Exiting.\n"));
return -1;
}
if (sscanf(argv[i + 1], "%d", &phaseShift) == 0) {
LOG(logERROR, ("cannot decode phase shift value %s. Exiting.\n",
argv[i + 1]));
return -1;
}
LOG(logINFO, ("Detected phase shift of %d\n", phaseShift));
}
#endif #endif
break;
case 'g':
LOG(logINFO, ("Detected generic mode (no module)\n"));
checkModuleFlag = 0;
break;
case 's':
LOG(logINFO, ("Detected stop server\n"));
isControlServer = 0;
break;
case 'h':
printf("%s", helpMessage);
exit(EXIT_SUCCESS);
default:
printf("\n%s", helpMessage);
exit(EXIT_FAILURE);
}
} }
// control server // control server
if (isControlServer) { if (isControlServer) {
LOG(logINFOBLUE, ("Control Server [%d]\n", portno)); LOG(logINFOBLUE, ("Control Server [%d]\n", portno));
// Catch signal SIGINT to destroy shm properly // Catch signal SIGINT (Ctrl + c) to destroy shm properly
struct sigaction sa; struct sigaction sa;
sa.sa_flags = 0; // no flags sa.sa_flags = 0; // no flags
sa.sa_handler = sigInterruptHandler; // handler function sa.sa_handler = sigInterruptHandler; // handler function
@ -122,9 +176,18 @@ int main(int argc, char *argv[]) {
// start stop server process // start stop server process
char cmd[MAX_STR_LENGTH]; char cmd[MAX_STR_LENGTH];
memset(cmd, 0, MAX_STR_LENGTH); memset(cmd, 0, MAX_STR_LENGTH);
char portCmd[256];
memset(portCmd, 0, 256);
sprintf(portCmd, "-p%d", portno);
for (int i = 0; i < argc; ++i) { for (int i = 0; i < argc; ++i) {
if (!strcasecmp(argv[i], "-port")) { LOG(logINFOBLUE, ("i:%d argv[i]:%s\n", i, argv[i]));
i += 2; // remove port argument (--port) and [value]
if (!strcasecmp(argv[i], "--port")) {
++i;
continue;
}
// remove port argument (-p[value])
if (!strcasecmp(argv[i], portCmd)) {
continue; continue;
} }
if (i > 0) { if (i > 0) {
@ -134,7 +197,7 @@ int main(int argc, char *argv[]) {
} }
char temp[50]; char temp[50];
memset(temp, 0, sizeof(temp)); memset(temp, 0, sizeof(temp));
sprintf(temp, " -stopserver -port %d &", portno + 1); sprintf(temp, " --stopserver --port %d &", portno + 1);
strcat(cmd, temp); strcat(cmd, temp);
LOG(logDEBUG1, ("Command to start stop server:%s\n", cmd)); LOG(logDEBUG1, ("Command to start stop server:%s\n", cmd));
@ -149,6 +212,10 @@ int main(int argc, char *argv[]) {
} }
} }
// if socket crash, ignores SISPIPE, prevents global signal handler
// subsequent read/write to socket gives error - must handle locally
signal(SIGPIPE, SIG_IGN);
init_detector(); init_detector();
// bind socket // bind socket
sockfd = bindSocket(portno); sockfd = bindSocket(portno);

View File

@ -1940,7 +1940,9 @@ int set_num_frames(int file_des) {
} else { } else {
#ifdef GOTTHARD2D #ifdef GOTTHARD2D
// validate #frames in burst mode // validate #frames in burst mode
if (getBurstMode() != BURST_OFF && arg > MAX_FRAMES_IN_BURST_MODE) { enum burstMode mode = getBurstMode();
if ((mode == BURST_INTERNAL || mode == BURST_EXTERNAL) &&
arg > MAX_FRAMES_IN_BURST_MODE) {
ret = FAIL; ret = FAIL;
sprintf(mess, sprintf(mess,
"Could not set number of frames %lld. Must be <= %d in " "Could not set number of frames %lld. Must be <= %d in "
@ -3489,12 +3491,12 @@ int set_transmission_delay_frame(int file_des) {
return printSocketReadError(); return printSocketReadError();
LOG(logINFO, ("Setting transmission delay frame: %d\n", arg)); LOG(logINFO, ("Setting transmission delay frame: %d\n", arg));
#if !defined(EIGERD) && !defined(JUNGFRAUD) #if !defined(EIGERD) && !defined(JUNGFRAUD) && !defined(MYTHEN3D)
functionNotImplemented(); functionNotImplemented();
#else #else
// only set // only set
if (Server_VerifyLock() == OK) { if (Server_VerifyLock() == OK) {
#ifdef JUNGFRAUD #if defined(JUNGFRAUD) || defined(MYTHEN3D)
if (arg > MAX_TIMESLOT_VAL) { if (arg > MAX_TIMESLOT_VAL) {
ret = FAIL; ret = FAIL;
sprintf(mess, "Transmission delay %d should be in range: 0 - %d\n", sprintf(mess, "Transmission delay %d should be in range: 0 - %d\n",
@ -3526,7 +3528,7 @@ int get_transmission_delay_frame(int file_des) {
LOG(logDEBUG1, ("Getting transmission delay frame\n")); LOG(logDEBUG1, ("Getting transmission delay frame\n"));
#if !defined(EIGERD) && !defined(JUNGFRAUD) #if !defined(EIGERD) && !defined(JUNGFRAUD) && !defined(MYTHEN3D)
functionNotImplemented(); functionNotImplemented();
#else #else
// get only // get only
@ -5425,7 +5427,7 @@ int set_parallel_mode(int file_des) {
return printSocketReadError(); return printSocketReadError();
LOG(logINFO, ("Setting parallel mode: %u\n", arg)); LOG(logINFO, ("Setting parallel mode: %u\n", arg));
#ifndef EIGERD #if !defined(EIGERD) && !defined(MYTHEN3D)
functionNotImplemented(); functionNotImplemented();
#else #else
// only set // only set
@ -5456,7 +5458,7 @@ int get_parallel_mode(int file_des) {
LOG(logDEBUG1, ("Getting parallel mode\n")); LOG(logDEBUG1, ("Getting parallel mode\n"));
#ifndef EIGERD #if !defined(EIGERD) && !defined(MYTHEN3D)
functionNotImplemented(); functionNotImplemented();
#else #else
// get only // get only
@ -6494,7 +6496,7 @@ int set_veto_reference(int file_des) {
int set_burst_mode(int file_des) { int set_burst_mode(int file_des) {
ret = OK; ret = OK;
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));
enum burstMode arg = BURST_OFF; enum burstMode arg = BURST_INTERNAL;
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
return printSocketReadError(); return printSocketReadError();
@ -6506,9 +6508,10 @@ int set_burst_mode(int file_des) {
// only set // only set
if (Server_VerifyLock() == OK) { if (Server_VerifyLock() == OK) {
switch (arg) { switch (arg) {
case BURST_OFF:
case BURST_INTERNAL: case BURST_INTERNAL:
case BURST_EXTERNAL: case BURST_EXTERNAL:
case CONTINUOUS_INTERNAL:
case CONTINUOUS_EXTERNAL:
break; break;
default: default:
modeNotImplemented("Burst mode", (int)arg); modeNotImplemented("Burst mode", (int)arg);
@ -6533,7 +6536,7 @@ int set_burst_mode(int file_des) {
int get_burst_mode(int file_des) { int get_burst_mode(int file_des) {
ret = OK; ret = OK;
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));
enum burstMode retval = BURST_OFF; enum burstMode retval = BURST_INTERNAL;
LOG(logDEBUG1, ("Getting burst mode\n")); LOG(logDEBUG1, ("Getting burst mode\n"));
@ -6938,6 +6941,16 @@ int get_receiver_parameters(int file_des) {
if (n < 0) if (n < 0)
return printSocketReadError(); return printSocketReadError();
// additional storage cells
#ifdef JUNGFRAUD
i32 = getNumAdditionalStorageCells();
#else
i32 = 0;
#endif
n += sendData(file_des, &i32, sizeof(i32), INT32);
if (n < 0)
return printSocketReadError();
// analog samples // analog samples
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) #if defined(CHIPTESTBOARDD) || defined(MOENCHD)
i32 = getNumAnalogSamples(); i32 = getNumAnalogSamples();
@ -7015,6 +7028,26 @@ int get_receiver_parameters(int file_des) {
if (n < 0) if (n < 0)
return printSocketReadError(); return printSocketReadError();
// readnlines
#ifdef EIGERD
i32 = getReadNLines();
#else
i32 = 0;
#endif
n += sendData(file_des, &i32, sizeof(i32), INT32);
if (n < 0)
return printSocketReadError();
// threshold ev
#ifdef EIGERD
i32 = getThresholdEnergy();
#else
i32 = 0;
#endif
n += sendData(file_des, &i32, sizeof(i32), INT32);
if (n < 0)
return printSocketReadError();
// dynamic range // dynamic range
i32 = setDynamicRange(GET_FLAG); i32 = setDynamicRange(GET_FLAG);
n += sendData(file_des, &i32, sizeof(i32), INT32); n += sendData(file_des, &i32, sizeof(i32), INT32);
@ -7175,6 +7208,26 @@ int get_receiver_parameters(int file_des) {
if (n < 0) if (n < 0)
return printSocketReadError(); return printSocketReadError();
// scan parameters
// scan enable, dac, start, stop, step
// scan dac settle time
int i32s[5] = {0, 0, 0, 0, 0};
i64 = 0;
i32s[0] = scan;
if (scan) {
i32s[1] = scanGlobalIndex;
i32s[2] = scanSteps[0];
i32s[3] = scanSteps[numScanSteps - 1];
i32s[4] = scanSteps[1] - scanSteps[0];
i64 = scanSettleTime_ns;
}
n += sendData(file_des, i32s, sizeof(i32s), INT32);
if (n < 0)
return printSocketReadError();
n += sendData(file_des, &i64, sizeof(i64), INT64);
if (n < 0)
return printSocketReadError();
LOG(logINFO, ("Sent %d bytes for receiver parameters\n", n)); LOG(logINFO, ("Sent %d bytes for receiver parameters\n", n));
return OK; return OK;

View File

@ -27,7 +27,7 @@ target_include_directories(slsDetectorShared PUBLIC
target_link_libraries(slsDetectorShared target_link_libraries(slsDetectorShared
PUBLIC PUBLIC
slsSupportLib slsSupportStatic
pthread pthread
rt rt
slsProjectOptions slsProjectOptions

View File

@ -46,14 +46,18 @@ class Detector {
* belonging to it */ * belonging to it */
void freeSharedMemory(); void freeSharedMemory();
/** Frees shared memory before loading configuration file. Set up once
* normally */
void loadConfig(const std::string &fname); void loadConfig(const std::string &fname);
/** Shared memory not freed prior. Set up per measurement. */
void loadParameters(const std::string &fname); void loadParameters(const std::string &fname);
void loadParameters(const std::vector<std::string> &parameters);
Result<std::string> getHostname(Positions pos = {}) const; Result<std::string> getHostname(Positions pos = {}) const;
/* Frees shared memory, adds detectors to the list /* Frees shared memory, adds detectors to the list */
* and updates local detector cache */
void setHostname(const std::vector<std::string> &hostname); void setHostname(const std::vector<std::string> &hostname);
/** connects to n servers at local host starting at specific control port */ /** connects to n servers at local host starting at specific control port */
@ -102,12 +106,14 @@ class Detector {
/** [Jungfrau][Gotthard][Gotthard2] */ /** [Jungfrau][Gotthard][Gotthard2] */
Result<defs::detectorSettings> getSettings(Positions pos = {}) const; Result<defs::detectorSettings> getSettings(Positions pos = {}) const;
/** [Jungfrau] Options:DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2, /** [Jungfrau] DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2,
* FORCESWITCHG1, FORCESWITCHG2 [Gotthard] Options: DYNAMICGAIN, HIGHGAIN, * FORCESWITCHG1, FORCESWITCHG2 [Gotthard] \n DYNAMICGAIN, HIGHGAIN,
* LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN [Gotthard2] Options: DYNAMICGAIN, * LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN [Gotthard2] \n DYNAMICGAIN,
* FIXGAIN1, FIXGAIN2 [Moench] Options: G1_HIGHGAIN, G1_LOWGAIN, * FIXGAIN1, FIXGAIN2 [Moench] \n G1_HIGHGAIN, G1_LOWGAIN,
* G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN, G2_LOWCAP_HIGHGAIN, * G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN, G2_LOWCAP_HIGHGAIN,
* G2_LOWCAP_LOWGAIN, G4_HIGHGAIN, G4_LOWGAIN * G2_LOWCAP_LOWGAIN, G4_HIGHGAIN, G4_LOWGAIN \n [Eiger] Use threshold
* command \n [Eiger settings loaded from file found in
* settingspath
*/ */
void setSettings(defs::detectorSettings value, Positions pos = {}); void setSettings(defs::detectorSettings value, Positions pos = {});
@ -125,8 +131,8 @@ class Detector {
/** /**
* [Eiger][Jungfrau] * [Eiger][Jungfrau]
* Only in client data call back * Include gap pixels in client data call back. Will not be in detector
* Fills in gap pixels in data * streaming, receiver file or streaming. Default is disabled.
*/ */
void setGapPixelsinCallback(const bool enable); void setGapPixelsinCallback(const bool enable);
@ -167,14 +173,21 @@ class Detector {
Result<int64_t> getNumberOfFrames(Positions pos = {}) const; Result<int64_t> getNumberOfFrames(Positions pos = {}) const;
/** In trigger mode, number of frames per trigger. In scan mode, number of
* frames is set to number of steps */
void setNumberOfFrames(int64_t value); void setNumberOfFrames(int64_t value);
Result<int64_t> getNumberOfTriggers(Positions pos = {}) const; Result<int64_t> getNumberOfTriggers(Positions pos = {}) const;
void setNumberOfTriggers(int64_t value); void setNumberOfTriggers(int64_t value);
/** [Gotthard][Jungfrau][Eiger][CTB][Moench][Gotthard2] \n
* [Mythen3] use function with gate index **/
Result<ns> getExptime(Positions pos = {}) const; Result<ns> getExptime(Positions pos = {}) const;
/** [Gotthard][Jungfrau][Eiger][CTB][Moench][Gotthard2] \n
* [Mythen3] sets exptime for all gate signals. To specify gate index, use
* function with gate index **/
void setExptime(ns t, Positions pos = {}); void setExptime(ns t, Positions pos = {});
Result<ns> getPeriod(Positions pos = {}) const; Result<ns> getPeriod(Positions pos = {}) const;
@ -206,13 +219,15 @@ class Detector {
Result<int> getDynamicRange(Positions pos = {}) const; Result<int> getDynamicRange(Positions pos = {}) const;
/** /**
* [Eiger] Options: 4, 8, 16, 32 * [Eiger] Options: 4, 8, 16, 32. If i is 32, also sets clkdivider to 2, if
* [Mythen3] Options: 8, 16, 32 * 16, sets clkdivider to 1 \n [Mythen3] Options: 8, 16, 32 \n
* [Eiger] If i is 32, also sets clkdivider to 2, if 16, sets clkdivider to * [Jungfrau][Gotthard][Ctb][Moench][Mythen3][Gotthard2] 16
* 1
*/ */
void setDynamicRange(int value); void setDynamicRange(int value);
/** list of possible dynamic ranges for this detector */
std::vector<int> getDynamicRangeList() const;
Result<defs::timingMode> getTimingMode(Positions pos = {}) const; Result<defs::timingMode> getTimingMode(Positions pos = {}) const;
/** /**
@ -223,17 +238,30 @@ class Detector {
*/ */
void setTimingMode(defs::timingMode value, Positions pos = {}); void setTimingMode(defs::timingMode value, Positions pos = {});
/** list of possible timing modes for this detector */
std::vector<defs::timingMode> getTimingModeList() const;
/** [Eiger][Jungfrau] */ /** [Eiger][Jungfrau] */
Result<defs::speedLevel> getSpeed(Positions pos = {}) const; Result<defs::speedLevel> getSpeed(Positions pos = {}) const;
/** [Eiger][Jungfrau] /** [Eiger][Jungfrau]
* Options: FULL_SPEED, HALF_SPEED, QUARTER_SPEED */ * Options: FULL_SPEED, HALF_SPEED, QUARTER_SPEED \n
* [Jungfrau] FULL_SPEED option only available from v2.0 boards and with
* setting number of interfaces to 2. \n Also overwrites adcphase to
* recommended default.
*/
void setSpeed(defs::speedLevel value, Positions pos = {}); void setSpeed(defs::speedLevel value, Positions pos = {});
/** [Gotthard][Jungfrau][CTB][Moench] */ /** [Jungfrau][CTB][Moench] */
Result<int> getADCPhase(Positions pos = {}) const; Result<int> getADCPhase(Positions pos = {}) const;
/** [Gotthard][Jungfrau][CTB][Moench] */ /** [Gotthard][Jungfrau][CTB][Moench]
* [Jungfrau] Absolute phase shift. Changing Speed also resets adcphase to
* recommended defaults. \n
* [Ctb][Moench] Absolute phase shift. Changing adcclk also resets adcphase
* and sets it to previous values. \n
* [Gotthard] Relative phase shift
*/
void setADCPhase(int value, Positions pos = {}); void setADCPhase(int value, Positions pos = {});
/** [Jungfrau][CTB][Moench] */ /** [Jungfrau][CTB][Moench] */
@ -242,13 +270,21 @@ class Detector {
/** [Gotthard][Jungfrau][CTB][Moench] */ /** [Gotthard][Jungfrau][CTB][Moench] */
Result<int> getADCPhaseInDegrees(Positions pos = {}) const; Result<int> getADCPhaseInDegrees(Positions pos = {}) const;
/** [Gotthard][Jungfrau][CTB][Moench] */ /** [Gotthard][Jungfrau][CTB][Moench]
* [Jungfrau] Absolute phase shift. Changing Speed also resets adcphase to
* recommended defaults. \n
* [Ctb][Moench] Absolute phase shift. Changing adcclk also resets adcphase
* and sets it to previous values. \n
* [Gotthard] Relative phase shift
*/
void setADCPhaseInDegrees(int value, Positions pos = {}); void setADCPhaseInDegrees(int value, Positions pos = {});
/** [CTB][Jungfrau] */ /** [CTB][Jungfrau] */
Result<int> getDBITPhase(Positions pos = {}) const; Result<int> getDBITPhase(Positions pos = {}) const;
/** [CTB][Jungfrau] */ /** [CTB][Jungfrau] Absolute phase shift \n
* [CTB] changing dbitclk also resets dbitphase and sets to previous values.
*/
void setDBITPhase(int value, Positions pos = {}); void setDBITPhase(int value, Positions pos = {});
/** [CTB][Jungfrau] */ /** [CTB][Jungfrau] */
@ -257,7 +293,9 @@ class Detector {
/** [CTB][Jungfrau] */ /** [CTB][Jungfrau] */
Result<int> getDBITPhaseInDegrees(Positions pos = {}) const; Result<int> getDBITPhaseInDegrees(Positions pos = {}) const;
/** [CTB][Jungfrau] */ /** [CTB][Jungfrau] Absolute phase shift \n
* [CTB] changing dbitclk also resets dbitphase and sets to previous values.
*/
void setDBITPhaseInDegrees(int value, Positions pos = {}); void setDBITPhaseInDegrees(int value, Positions pos = {});
/** [Mythen3][Gotthard2] Hz */ /** [Mythen3][Gotthard2] Hz */
@ -311,6 +349,9 @@ class Detector {
* Only for virtual servers */ * Only for virtual servers */
void setImageTestMode(const int value, Positions pos = {}); void setImageTestMode(const int value, Positions pos = {});
/** gets list of temperature indices for this detector */
std::vector<defs::dacIndex> getTemperatureList() const;
/** /**
* (Degrees) * (Degrees)
* [Gotthard] Options: TEMPERATURE_ADC, TEMPERATURE_FPGA * [Gotthard] Options: TEMPERATURE_ADC, TEMPERATURE_FPGA
@ -322,7 +363,7 @@ class Detector {
*/ */
Result<int> getTemperature(defs::dacIndex index, Positions pos = {}) const; Result<int> getTemperature(defs::dacIndex index, Positions pos = {}) const;
/** gets list of dac indices for this detector */ /** gets list of dac enums for this detector */
std::vector<defs::dacIndex> getDacList() const; std::vector<defs::dacIndex> getDacList() const;
Result<int> getDAC(defs::dacIndex index, bool mV, Positions pos = {}) const; Result<int> getDAC(defs::dacIndex index, bool mV, Positions pos = {}) const;
@ -352,6 +393,14 @@ class Detector {
void setExternalSignalFlags(int signalIndex, defs::externalSignalFlag value, void setExternalSignalFlags(int signalIndex, defs::externalSignalFlag value,
Positions pos = {}); Positions pos = {});
/** [Eiger][Mythen3] */
Result<bool> getParallelMode(Positions pos = {}) const;
/** [Eiger][Mythen3]
* [Mythen3] If exposure time is too short, acquisition will return with an
* ERROR and take fewer frames than expected */
void setParallelMode(bool value, Positions pos = {});
/************************************************** /**************************************************
* * * *
* Acquisition * * Acquisition *
@ -373,32 +422,39 @@ class Detector {
* acquisition */ * acquisition */
void clearAcquiringFlag(); void clearAcquiringFlag();
/** Non Blocking: Start receiver listener*/ /** Non Blocking: Start receiver listener and create data file if file write
* enabled */
void startReceiver(); void startReceiver();
/** Non Blocking: Stop receiver listener */ /** Non Blocking: Stops receiver listener for detector data packets and
closes current data file (if file write enabled). */
void stopReceiver(); void stopReceiver();
/** Non blocking: start detector acquisition /** Non blocking: start detector acquisition. Status changes to RUNNING or
* detector status changes from RUNNING to IDLE when finished */ * WAITING and automatically returns to idle at the end of acquisition. */
void startDetector(); void startDetector();
/** Non blocking: abort detector acquisition */ /** Non blocking: Abort detector acquisition. Status changes to IDLE or
* STOPPED */
void stopDetector(); void stopDetector();
/** IDLE, ERROR, WAITING, RUN_FINISHED, TRANSMITTING, RUNNING, STOPPED */
Result<defs::runStatus> getDetectorStatus(Positions pos = {}) const; Result<defs::runStatus> getDetectorStatus(Positions pos = {}) const;
/** Options: IDLE, TRANSMITTING, RUNNING */
Result<defs::runStatus> getReceiverStatus(Positions pos = {}) const; Result<defs::runStatus> getReceiverStatus(Positions pos = {}) const;
Result<int64_t> getFramesCaught(Positions pos = {}) const; Result<int64_t> getFramesCaught(Positions pos = {}) const;
/** Gets the number of missing packets for each port in receiver. */
Result<std::vector<uint64_t>> Result<std::vector<uint64_t>>
getNumMissingPackets(Positions pos = {}) const; getNumMissingPackets(Positions pos = {}) const;
/** [Eiger][Jungfrau] */ /** [Eiger][Jungfrau] */
Result<uint64_t> getStartingFrameNumber(Positions pos = {}) const; Result<uint64_t> getStartingFrameNumber(Positions pos = {}) const;
/** [Eiger][Jungfrau] */ /** [Eiger][Jungfrau] Stopping acquiistion might result in different frame
* numbers for different modules.*/
void setStartingFrameNumber(uint64_t value, Positions pos = {}); void setStartingFrameNumber(uint64_t value, Positions pos = {});
/** [Eiger] Sends an internal software trigger to the detector */ /** [Eiger] Sends an internal software trigger to the detector */
@ -424,10 +480,13 @@ class Detector {
/** [Jungfrau][Gotthard2] */ /** [Jungfrau][Gotthard2] */
Result<int> getNumberofUDPInterfaces(Positions pos = {}) const; Result<int> getNumberofUDPInterfaces(Positions pos = {}) const;
/** [Jungfrau][Gotthard2] Also restarts client and receiver zmq sockets /** [Jungfrau][Gotthard2] Number of udp interfaces to stream data from
* [Gotthard2] second interface enabled to send veto information via 10gbps * detector. Default is 1. \n Also enables second interface in receiver for
* for debugging. By default it is sent via 2.5gbps if veto enabled * listening (Writes a file per interface if writing enabled). \n Also
* n can be 1 or 2 */ * restarts client and receiver zmq sockets if zmq streaming enabled. \n
* [Gotthard2] second interface enabled to send veto information via 10Gbps
* for debugging. By default, if veto enabled, it is sent via 2.5 gbps
* interface. */
void setNumberofUDPInterfaces(int n, Positions pos = {}); void setNumberofUDPInterfaces(int n, Positions pos = {});
/** [Jungfrau] */ /** [Jungfrau] */
@ -521,13 +580,13 @@ class Detector {
/** [Eiger][CTB][Moench][Mythen3] */ /** [Eiger][CTB][Moench][Mythen3] */
void setTenGiga(bool value, Positions pos = {}); void setTenGiga(bool value, Positions pos = {});
/** [Eiger, Jungfrau] */ /** [Eiger][Jungfrau] */
Result<bool> getTenGigaFlowControl(Positions pos = {}) const; Result<bool> getTenGigaFlowControl(Positions pos = {}) const;
/** [Eiger, Jungfrau] */ /** [Eiger][Jungfrau] */
void setTenGigaFlowControl(bool enable, Positions pos = {}); void setTenGigaFlowControl(bool enable, Positions pos = {});
/** [Eiger, Jungfrau] */ /** [Eiger][Jungfrau][Mythen3] */
Result<int> getTransmissionDelayFrame(Positions pos = {}) const; Result<int> getTransmissionDelayFrame(Positions pos = {}) const;
/** /**
@ -535,6 +594,8 @@ class Detector {
* streamed out of the module. Options: 0 - 31, each value represenets 1 ms * streamed out of the module. Options: 0 - 31, each value represenets 1 ms
* [Eiger]: Sets the transmission delay of entire frame streamed out for * [Eiger]: Sets the transmission delay of entire frame streamed out for
* both left and right UDP ports. Options: //TODO possible values * both left and right UDP ports. Options: //TODO possible values
* [Mythen3] Options: [0-16777215] Each value represents 8 ns (125 MHz
* clock), max is 134 ms.
*/ */
void setTransmissionDelayFrame(int value, Positions pos = {}); void setTransmissionDelayFrame(int value, Positions pos = {});
@ -570,22 +631,24 @@ class Detector {
Result<std::string> getRxHostname(Positions pos = {}) const; Result<std::string> getRxHostname(Positions pos = {}) const;
/** /**
* Validates and sets the receiver. * Sets receiver hostname or IP address for each module. \n Used for TCP
* Updates local receiver cache parameters * control communication between client and receiver to configure receiver.
* Configures the detector to the receiver as UDP destination * Also updates receiver with detector parameters. \n Also resets any prior
* receiver is receiver hostname or IP address, can include tcp port eg. * receiver property (not on detector). \n receiver is receiver hostname or
* hostname:port * IP address, can include tcp port eg. hostname:port
*/ */
void setRxHostname(const std::string &receiver, Positions pos = {}); void setRxHostname(const std::string &receiver, Positions pos = {});
/** multiple rx hostnames (same as setRxHostname) */ /** multiple rx hostnames. Single element will set it for all */
void setRxHostname(const std::vector<std::string> &name); void setRxHostname(const std::vector<std::string> &name);
Result<int> getRxPort(Positions pos = {}) const; Result<int> getRxPort(Positions pos = {}) const;
/** Receiver TCP port (for client communication with Receiver) /** TCP port for client-receiver communication. \n
* module_id is -1 for all detectors, ports for each module is calculated * Default is 1954. \n Must be different if multiple receivers on same pc.
* (increments) */ * \n Must be first command to set a receiver parameter to be able to
* communicate. \n Multi command will automatically increment port for
* individual modules.*/
void setRxPort(int port, int module_id = -1); void setRxPort(int port, int module_id = -1);
Result<int> getRxFifoDepth(Positions pos = {}) const; Result<int> getRxFifoDepth(Positions pos = {}) const;
@ -595,15 +658,15 @@ class Detector {
Result<bool> getRxSilentMode(Positions pos = {}) const; Result<bool> getRxSilentMode(Positions pos = {}) const;
/** receiver prints hardly any information while acquiring */ /** Switch on or off receiver text output during acquisition */
void setRxSilentMode(bool value, Positions pos = {}); void setRxSilentMode(bool value, Positions pos = {});
Result<defs::frameDiscardPolicy> Result<defs::frameDiscardPolicy>
getRxFrameDiscardPolicy(Positions pos = {}) const; getRxFrameDiscardPolicy(Positions pos = {}) const;
/** /**
* default NO_DISCARD
* Options: NO_DISCARD, DISCARD_EMPTY_FRAMES, DISCARD_PARTIAL_FRAMES * Options: NO_DISCARD, DISCARD_EMPTY_FRAMES, DISCARD_PARTIAL_FRAMES
* Default: NO_DISCARD
* discard partial frames is the fastest * discard partial frames is the fastest
*/ */
void setRxFrameDiscardPolicy(defs::frameDiscardPolicy f, void setRxFrameDiscardPolicy(defs::frameDiscardPolicy f,
@ -611,22 +674,28 @@ class Detector {
Result<bool> getPartialFramesPadding(Positions pos = {}) const; Result<bool> getPartialFramesPadding(Positions pos = {}) const;
/** padding enabled. Disabling padding is the fastest */ /** Default: padding enabled. Disabling padding is the fastest */
void setPartialFramesPadding(bool value, Positions pos = {}); void setPartialFramesPadding(bool value, Positions pos = {});
Result<int64_t> getRxUDPSocketBufferSize(Positions pos = {}) const; Result<int64_t> getRxUDPSocketBufferSize(Positions pos = {}) const;
/** UDP socket buffer size in receiver. Tune rmem_default and rmem_max
* accordingly */
void setRxUDPSocketBufferSize(int64_t udpsockbufsize, Positions pos = {}); void setRxUDPSocketBufferSize(int64_t udpsockbufsize, Positions pos = {});
/** TODO: /** TODO:
* Linux kernel allocates twice the amount you set for bookkeeping purposes * Gets actual udp socket buffer size. Double the size of rx_udpsocksize due
* to kernel bookkeeping.
*/ */
Result<int64_t> getRxRealUDPSocketBufferSize(Positions pos = {}) const; Result<int64_t> getRxRealUDPSocketBufferSize(Positions pos = {}) const;
Result<bool> getRxLock(Positions pos = {}); Result<bool> getRxLock(Positions pos = {});
/** locks receiver server to client IP */ /** Lock receiver to one client IP, 1 locks, 0 unlocks. Default is unlocked.
*/
void setRxLock(bool value, Positions pos = {}); void setRxLock(bool value, Positions pos = {});
/** Client IP Address that last communicated with the receiver */
Result<sls::IpAddr> getRxLastClientIP(Positions pos = {}) const; Result<sls::IpAddr> getRxLastClientIP(Positions pos = {}) const;
Result<std::array<pid_t, NUM_RX_THREAD_IDS>> Result<std::array<pid_t, NUM_RX_THREAD_IDS>>
@ -645,6 +714,7 @@ class Detector {
Result<std::string> getFilePath(Positions pos = {}) const; Result<std::string> getFilePath(Positions pos = {}) const;
/** If path does not exist, it will try to create it */
void setFilePath(const std::string &fpath, Positions pos = {}); void setFilePath(const std::string &fpath, Positions pos = {});
Result<std::string> getFileNamePrefix(Positions pos = {}) const; Result<std::string> getFileNamePrefix(Positions pos = {}) const;
@ -657,16 +727,17 @@ class Detector {
Result<int64_t> getAcquisitionIndex(Positions pos = {}) const; Result<int64_t> getAcquisitionIndex(Positions pos = {}) const;
/** file or Acquisition index in receiver */
void setAcquisitionIndex(int64_t i, Positions pos = {}); void setAcquisitionIndex(int64_t i, Positions pos = {});
Result<bool> getFileWrite(Positions pos = {}) const; Result<bool> getFileWrite(Positions pos = {}) const;
/** default writes */ /** default enabled */
void setFileWrite(bool value, Positions pos = {}); void setFileWrite(bool value, Positions pos = {});
Result<bool> getMasterFileWrite(Positions pos = {}) const; Result<bool> getMasterFileWrite(Positions pos = {}) const;
/* default writes */ /* default enabled */
void setMasterFileWrite(bool value, Positions pos = {}); void setMasterFileWrite(bool value, Positions pos = {});
Result<bool> getFileOverWrite(Positions pos = {}) const; Result<bool> getFileOverWrite(Positions pos = {}) const;
@ -676,7 +747,8 @@ class Detector {
Result<int> getFramesPerFile(Positions pos = {}) const; Result<int> getFramesPerFile(Positions pos = {}) const;
/** 0 will set frames per file to unlimited */ /** Default depends on detector type. \n 0 will set frames per file to
* unlimited */
void setFramesPerFile(int n, Positions pos = {}); void setFramesPerFile(int n, Positions pos = {});
/************************************************** /**************************************************
@ -688,16 +760,22 @@ class Detector {
Result<bool> getRxZmqDataStream(Positions pos = {}) const; Result<bool> getRxZmqDataStream(Positions pos = {}) const;
/** Enable/ disable data streaming from receiver via zmq (eg. to GUI or to
* another process for further processing). \n This creates/ destroys zmq
* streamer threads in receiver. \n Switching to Gui automatically enables
* data streaming in receiver. \n Switching back to command line or API
* acquire will require disabling data streaming in receiver for fast
* applications (if not needed for client data call backs).
*/
void setRxZmqDataStream(bool value, Positions pos = {}); void setRxZmqDataStream(bool value, Positions pos = {});
Result<int> getRxZmqFrequency(Positions pos = {}) const; Result<int> getRxZmqFrequency(Positions pos = {}) const;
/** freq is nth frame streamed out of receiver. /** Frequency of frames streamed out from receiver via zmq. \n Default: 1,
* If 0, streaming timer is the timeout, * Means every frame is streamed out. \n If 2, every second frame is
* after which current frame sent out. Default is 0 at 200 ms. * streamed out. \n If 0, streaming timer is the timeout, after which
* Default is 1: send every frame. * current frame is sent out. (default timeout is 200 ms). Usually used for
* If you want just to see some frames for gui purposes, set to 0 (200ms * gui purposes.
* default timer).
*/ */
void setRxZmqFrequency(int freq, Positions pos = {}); void setRxZmqFrequency(int freq, Positions pos = {});
@ -720,14 +798,21 @@ class Detector {
Result<int> getRxZmqPort(Positions pos = {}) const; Result<int> getRxZmqPort(Positions pos = {}) const;
/** /** Zmq port for data to be streamed out of the receiver. \n
* module_id is -1 for all detectors, ports for each module is calculated * Also restarts receiver zmq streaming if enabled. \n Default is 30001. \n
* (increments) Restarts receiver zmq sockets only if it was already enabled * Modified only when using an intermediate process after receiver. \n Must
* be different for every detector (and udp port). \n module_id is -1 for
* all detectors, ports for each module is calculated (increments) Restarts
* receiver zmq sockets only if it was already enabled
*/ */
void setRxZmqPort(int port, int module_id = -1); void setRxZmqPort(int port, int module_id = -1);
Result<IpAddr> getRxZmqIP(Positions pos = {}) const; Result<IpAddr> getRxZmqIP(Positions pos = {}) const;
/** Zmq Ip Address from which data is to be streamed out of the receiver. \n
* Also restarts receiver zmq streaming if enabled. \n Default is from
* rx_hostname. \n Modified only when using an intermediate process between
* receiver. */
void setRxZmqIP(const IpAddr ip, Positions pos = {}); void setRxZmqIP(const IpAddr ip, Positions pos = {});
Result<int> getClientZmqPort(Positions pos = {}) const; Result<int> getClientZmqPort(Positions pos = {}) const;
@ -773,19 +858,13 @@ class Detector {
/** [Eiger] */ /** [Eiger] */
Result<std::string> getSettingsPath(Positions pos = {}) const; Result<std::string> getSettingsPath(Positions pos = {}) const;
/** [Eiger] */ /** [Eiger] Directory where settings files are loaded from/to */
void setSettingsPath(const std::string &value, Positions pos = {}); void setSettingsPath(const std::string &value, Positions pos = {});
/** [Eiger] */
Result<bool> getParallelMode(Positions pos = {}) const;
/** [Eiger] */
void setParallelMode(bool value, Positions pos = {});
/** [Eiger] */ /** [Eiger] */
Result<bool> getOverFlowMode(Positions pos = {}) const; Result<bool> getOverFlowMode(Positions pos = {}) const;
/** [Eiger] */ /** [Eiger] Overflow in 32 bit mode. Default is disabled.*/
void setOverFlowMode(bool value, Positions pos = {}); void setOverFlowMode(bool value, Positions pos = {});
/** [Eiger] */ /** [Eiger] */
@ -824,7 +903,9 @@ class Detector {
/** [Eiger] */ /** [Eiger] */
Result<bool> getInterruptSubframe(Positions pos = {}) const; Result<bool> getInterruptSubframe(Positions pos = {}) const;
/** [Eiger] when set, the last subframe is interrupted at end of acq */ /** [Eiger] Enable last subframe interrupt at required exposure time.
* Disabling will wait for last sub frame to finish exposing. Default is
* disabled. */
void setInterruptSubframe(const bool enable, Positions pos = {}); void setInterruptSubframe(const bool enable, Positions pos = {});
/** [Eiger] minimum two frames */ /** [Eiger] minimum two frames */
@ -848,8 +929,7 @@ class Detector {
/** [Eiger] Advanced */ /** [Eiger] Advanced */
Result<bool> getPartialReset(Positions pos = {}) const; Result<bool> getPartialReset(Positions pos = {}) const;
/** [Eiger] Advanced /** [Eiger] Advanced used for pulsing chips. Default is Complete reset */
* used for pulsing chips */
void setPartialReset(bool value, Positions pos = {}); void setPartialReset(bool value, Positions pos = {});
/** [Eiger] Advanced /** [Eiger] Advanced
@ -909,28 +989,33 @@ class Detector {
* //TODO naming * //TODO naming
* By default, the on-chip gain switching is active during the entire * By default, the on-chip gain switching is active during the entire
* exposure. This mode disables the on-chip gain switching comparator * exposure. This mode disables the on-chip gain switching comparator
* automatically after 93.75% of exposure time (only for longer than 100us). * automatically after 93.75% of exposure time (only for longer than
* 100us).\n
* Default is false or this mode disabled(comparator enabled throughout).
* true enables " "mode. 0 disables mode.
*/ */
void setAutoCompDisable(bool value, Positions pos = {}); void setAutoCompDisable(bool value, Positions pos = {});
/** [Jungfrau] Advanced TODO naming */ /** [Jungfrau] Advanced TODO naming */
Result<int> getNumberOfAdditionalStorageCells(Positions pos = {}) const; Result<int> getNumberOfAdditionalStorageCells(Positions pos = {}) const;
/** [Jungfrau] Advanced */ /** [Jungfrau] Advanced \n
* Options: 0 - 15. Default: 0. \n
* The #images = #frames x #triggers x (#storagecells + 1) */
void setNumberOfAdditionalStorageCells(int value); void setNumberOfAdditionalStorageCells(int value);
/** [Jungfrau] Advanced */ /** [Jungfrau] Advanced */
Result<int> getStorageCellStart(Positions pos = {}) const; Result<int> getStorageCellStart(Positions pos = {}) const;
/** [Jungfrau] Advanced. Sets the storage cell storing the first acquisition /** [Jungfrau] Advanced. Sets the storage cell storing the first acquisition
* of the series. Options: 0-15 * of the series. Options: 0-15. Default: 15.
*/ */
void setStorageCellStart(int cell, Positions pos = {}); void setStorageCellStart(int cell, Positions pos = {});
/** [Jungfrau] Advanced*/ /** [Jungfrau] Advanced*/
Result<ns> getStorageCellDelay(Positions pos = {}) const; Result<ns> getStorageCellDelay(Positions pos = {}) const;
/** [Jungfrau] Advanced /** [Jungfrau] Advanced \n
* Options: (0-1638375 ns (resolution of 25ns) */ * Options: (0-1638375 ns (resolution of 25ns) */
void setStorageCellDelay(ns value, Positions pos = {}); void setStorageCellDelay(ns value, Positions pos = {});
@ -1004,7 +1089,8 @@ class Detector {
/** [Gotthard2] */ /** [Gotthard2] */
Result<defs::burstMode> getBurstMode(Positions pos = {}); Result<defs::burstMode> getBurstMode(Positions pos = {});
/** [Gotthard2] BURST_OFF, BURST_INTERNAL (default), BURST_EXTERNAL */ /** [Gotthard2] BURST_INTERNAL (default), BURST_EXTERNAL,
* CONTINUOUS_INTERNAL, CONTINUOUS_EXTERNAL */
void setBurstMode(defs::burstMode value, Positions pos = {}); void setBurstMode(defs::burstMode value, Positions pos = {});
/** [Gotthard2] */ /** [Gotthard2] */
@ -1059,7 +1145,7 @@ class Detector {
/** [Mythen3] */ /** [Mythen3] */
Result<uint32_t> getCounterMask(Positions pos = {}) const; Result<uint32_t> getCounterMask(Positions pos = {}) const;
/** [Mythen3] countermask bit set for each counter enabled */ /** [Mythen3] countermask bit set for each counter index enabled */
void setCounterMask(uint32_t countermask, Positions pos = {}); void setCounterMask(uint32_t countermask, Positions pos = {});
Result<int> getNumberOfGates(Positions pos = {}) const; Result<int> getNumberOfGates(Positions pos = {}) const;
@ -1088,7 +1174,7 @@ class Detector {
* (internal gating). Gate index: 0-2, -1 for all */ * (internal gating). Gate index: 0-2, -1 for all */
void setGateDelay(int gateIndex, ns t, Positions pos = {}); void setGateDelay(int gateIndex, ns t, Positions pos = {});
/** [Mythen3] gate delay for each gate signal in auto or trigger timing mode /** [Mythen3] gate delay for all gates in auto or trigger timing mode
* (internal gating). Gate index: 0-2, -1 for all */ * (internal gating). Gate index: 0-2, -1 for all */
Result<std::array<ns, 3>> getGateDelayForAllGates(Positions pos = {}) const; Result<std::array<ns, 3>> getGateDelayForAllGates(Positions pos = {}) const;
@ -1162,7 +1248,7 @@ class Detector {
/** [CTB] */ /** [CTB] */
Result<defs::readoutMode> getReadoutMode(Positions pos = {}) const; Result<defs::readoutMode> getReadoutMode(Positions pos = {}) const;
/** [CTB] Options: ANALOG_ONLY = 0, DIGITAL_ONLY = 1, ANALOG_AND_DIGITAL */ /** [CTB] Options: ANALOG_ONLY, DIGITAL_ONLY, ANALOG_AND_DIGITAL */
void setReadoutMode(defs::readoutMode value, Positions pos = {}); void setReadoutMode(defs::readoutMode value, Positions pos = {});
/** [CTB] */ /** [CTB] */
@ -1207,7 +1293,8 @@ class Detector {
/** [CTB] */ /** [CTB] */
Result<std::vector<int>> getRxDbitList(Positions pos = {}) const; Result<std::vector<int>> getRxDbitList(Positions pos = {}) const;
/** [CTB] list contains the set of bits (0-63) to save */ /** [CTB] list contains the set of digital signal bits (0-63) to save, must
* be non repetitive */
void setRxDbitList(const std::vector<int> &list, Positions pos = {}); void setRxDbitList(const std::vector<int> &list, Positions pos = {});
/** [CTB] */ /** [CTB] */
@ -1227,7 +1314,7 @@ class Detector {
/** [CTB] */ /** [CTB] */
Result<bool> getLEDEnable(Positions pos = {}) const; Result<bool> getLEDEnable(Positions pos = {}) const;
/** [CTB] */ /** [CTB] Default is enabled. */
void setLEDEnable(bool enable, Positions pos = {}); void setLEDEnable(bool enable, Positions pos = {});
/************************************************** /**************************************************
@ -1294,15 +1381,14 @@ class Detector {
Result<uint64_t> getPatternMask(Positions pos = {}); Result<uint64_t> getPatternMask(Positions pos = {});
/** [CTB][Moench][Mythen3] Sets the mask applied to every pattern to the /** [CTB][Moench][Mythen3] Sets the mask applied to every pattern to the
* selected bit mask */ * selected bits */
void setPatternMask(uint64_t mask, Positions pos = {}); void setPatternMask(uint64_t mask, Positions pos = {});
/** [CTB][Moench][Mythen3] */ /** [CTB][Moench][Mythen3] */
Result<uint64_t> getPatternBitMask(Positions pos = {}) const; Result<uint64_t> getPatternBitMask(Positions pos = {}) const;
/** [CTB][Moench][Mythen3] Sets the bitmask that the mask will be applied to /** [CTB][Moench][Mythen3] Selects the bits that will have a pattern mask
* for every pattern * applied to the selected patmask for every pattern. */
*/
void setPatternBitMask(uint64_t mask, Positions pos = {}); void setPatternBitMask(uint64_t mask, Positions pos = {});
/** [Mythen3] */ /** [Mythen3] */
@ -1366,26 +1452,30 @@ class Detector {
* * * *
* ************************************************/ * ************************************************/
/** [Jungfrau][CTB][Moench] fname is a pof file /** Advanced user Function!
* [Jungfrau][CTB][Moench] fname is a pof file
* [Mythen3][Gotthard2] fname is an rbf file * [Mythen3][Gotthard2] fname is an rbf file
*/ */
void programFPGA(const std::string &fname, Positions pos = {}); void programFPGA(const std::string &fname, Positions pos = {});
/** [Jungfrau][CTB][Moench] */ /** [Jungfrau][CTB][Moench] Advanced user Function! */
void resetFPGA(Positions pos = {}); void resetFPGA(Positions pos = {});
/** [Jungfrau][Gotthard][CTB][Moench][Mythen3][Gotthard2] /** [Jungfrau][Gotthard][CTB][Moench][Mythen3][Gotthard2]
* Advanced user Function!
* Copy detector server fname from tftp folder of hostname to detector * Copy detector server fname from tftp folder of hostname to detector
* Also changes respawn server, which is effective after a reboot. * Also changes respawn server, which is effective after a reboot.
*/ */
void copyDetectorServer(const std::string &fname, void copyDetectorServer(const std::string &fname,
const std::string &hostname, Positions pos = {}); const std::string &hostname, Positions pos = {});
/** [Jungfrau][Gotthard][CTB][Moench][Mythen3][Gotthard2] */ /** [Jungfrau][Gotthard][CTB][Moench][Mythen3][Gotthard2] Advanced user
* Function! */
void rebootController(Positions pos = {}); void rebootController(Positions pos = {});
/** /**
* [Jungfrau][Gotthard][CTB][Moench] * [Jungfrau][Gotthard][CTB][Moench]
* Advanced user Function!
* Updates the firmware, detector server and then reboots detector * Updates the firmware, detector server and then reboots detector
* controller blackfin. * controller blackfin.
* sname is name of detector server binary found on tftp folder of host * sname is name of detector server binary found on tftp folder of host
@ -1397,33 +1487,43 @@ class Detector {
const std::string &hostname, const std::string &hostname,
const std::string &fname, Positions pos = {}); const std::string &fname, Positions pos = {});
/** Advanced user Function! \n
* [Eiger] Address is +0x100 for only left, +0x200 for only right. */
Result<uint32_t> readRegister(uint32_t addr, Positions pos = {}) const; Result<uint32_t> readRegister(uint32_t addr, Positions pos = {}) const;
/** Advanced user Function! \n
* [Eiger] Address is +0x100 for only left, +0x200 for only right. */
void writeRegister(uint32_t addr, uint32_t val, Positions pos = {}); void writeRegister(uint32_t addr, uint32_t val, Positions pos = {});
/** Advanced user Function! */
void setBit(uint32_t addr, int bitnr, Positions pos = {}); void setBit(uint32_t addr, int bitnr, Positions pos = {});
/** Advanced user Function! */
void clearBit(uint32_t addr, int bitnr, Positions pos = {}); void clearBit(uint32_t addr, int bitnr, Positions pos = {});
/** [Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] */ /** [Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] Advanced user
* Function! */
void executeFirmwareTest(Positions pos = {}); void executeFirmwareTest(Positions pos = {});
/** [Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] */ /** [Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] Advanced user
* Function! */
void executeBusTest(Positions pos = {}); void executeBusTest(Positions pos = {});
/** [Gotthard][Jungfrau][CTB][Moench] not possible to read back*/ /** [Gotthard][Jungfrau][CTB][Moench] Advanced user Function! not possible
* to read back */
void writeAdcRegister(uint32_t addr, uint32_t value, Positions pos = {}); void writeAdcRegister(uint32_t addr, uint32_t value, Positions pos = {});
/** Advanced user Function! */
bool getInitialChecks() const; bool getInitialChecks() const;
/** initial compaibility and other server start up checks /** initial compaibility and other server start up checks
* default enabled */ * default enabled Advanced user Function! */
void setInitialChecks(const bool value); void setInitialChecks(const bool value);
/** [CTB][Moench][Jungfrau] */ /** [CTB][Moench][Jungfrau] Advanced user Function! */
Result<uint32_t> getADCInvert(Positions pos = {}) const; Result<uint32_t> getADCInvert(Positions pos = {}) const;
/** [CTB][Moench][Jungfrau] */ /** [CTB][Moench][Jungfrau] Advanced user Function! */
void setADCInvert(uint32_t value, Positions pos = {}); void setADCInvert(uint32_t value, Positions pos = {});
/************************************************** /**************************************************
@ -1446,6 +1546,7 @@ class Detector {
Result<bool> getDetectorLock(Positions pos = {}) const; Result<bool> getDetectorLock(Positions pos = {}) const;
/** lock detector to one client IP. default is unlocked */
void setDetectorLock(bool lock, Positions pos = {}); void setDetectorLock(bool lock, Positions pos = {});
/** Get last client IP saved on detector server */ /** Get last client IP saved on detector server */

View File

@ -182,7 +182,7 @@ std::string CmdProxy::VirtualServer(int action) {
std::string CmdProxy::Acquire(int action) { std::string CmdProxy::Acquire(int action) {
std::ostringstream os; std::ostringstream os;
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << cmd << " - Acquire the number of frames set up.\n"; os << cmd << "\n\tAcquire the number of frames set up.\n";
} else { } else {
if (det->empty()) { if (det->empty()) {
throw sls::RuntimeError( throw sls::RuntimeError(
@ -203,7 +203,7 @@ std::string CmdProxy::Acquire(int action) {
return os.str(); return os.str();
} }
std::string CmdProxy::free(int action) { std::string CmdProxy::Free(int action) {
// This function is purely for help, actual functionality is in the caller // This function is purely for help, actual functionality is in the caller
return "free\n\tFree detector shared memory\n"; return "free\n\tFree detector shared memory\n";
} }
@ -332,31 +332,13 @@ std::string CmdProxy::DetectorSize(int action) {
return os.str(); return os.str();
} }
std::string CmdProxy::SettingsList(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "\n\tList of settings implemented for this detector" << '\n';
} else if (action == defs::GET_ACTION) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getSettingsList();
os << ToString(t) << "\n";
} else if (action == defs::PUT_ACTION) {
throw sls::RuntimeError("Cannot put");
} else {
throw sls::RuntimeError("Unknown action");
}
return os.str();
}
std::string CmdProxy::GapPixels(int action) { std::string CmdProxy::GapPixels(int action) {
std::ostringstream os; std::ostringstream os;
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[0, 1]\n\t[Eiger][Jungfrau] Include Gap pixels only in data " os << "[0, 1]\n\t[Eiger][Jungfrau] Include Gap pixels in client data "
"call back." "call back in Detecor api. Will not be in detector streaming, "
"receiver file or streaming. Default is 0. "
<< '\n'; << '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
if (det_id != -1) { if (det_id != -1) {
@ -406,25 +388,21 @@ std::string CmdProxy::Exptime(int action) {
os << "[duration] [(optional unit) " os << "[duration] [(optional unit) "
"ns|us|ms|s]\n\t[Eiger][Jungfrau][Gotthard][Gotthard2][" "ns|us|ms|s]\n\t[Eiger][Jungfrau][Gotthard][Gotthard2]["
"Moench][Ctb] Exposure time" "Moench][Ctb] Exposure time"
"\n\t[Gotthard2] Uploaded to detector just before "
"acquisition starts"
"\n\t[Mythen3] Exposure time of all gate signals in auto and " "\n\t[Mythen3] Exposure time of all gate signals in auto and "
"trigger mode (internal gating)." "trigger mode (internal gating). To specify gate index, use "
"exptime1, exptime2, exptime3."
<< '\n'; << '\n';
} else if (cmd == "exptime1") { } else if (cmd == "exptime1") {
os << "[n_value]\n\t[Mythen3] Exposure time of gate signal 1 in " os << "[n_value]\n\t[Mythen3] Exposure time of gate signal 1 in "
"auto and " "auto and trigger mode (internal gating)."
"trigger mode (internal gating)."
<< '\n'; << '\n';
} else if (cmd == "exptime2") { } else if (cmd == "exptime2") {
os << "[n_value]\n\t[Mythen3] Exposure time of gate signal 2 in " os << "[n_value]\n\t[Mythen3] Exposure time of gate signal 2 in "
"auto and " "auto and trigger mode (internal gating)."
"trigger mode (internal gating)."
<< '\n'; << '\n';
} else { } else {
os << "[n_value]\n\t[Mythen3] Exposure time of gate signal 3 in " os << "[n_value]\n\t[Mythen3] Exposure time of gate signal 3 in "
"auto and " "auto and trigger mode (internal gating)."
"trigger mode (internal gating)."
<< '\n'; << '\n';
} }
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
@ -495,7 +473,8 @@ std::string CmdProxy::DynamicRange(int action) {
os << "[value]\n\tDynamic Range or number of bits per " os << "[value]\n\tDynamic Range or number of bits per "
"pixel in detector.\n\t" "pixel in detector.\n\t"
"[Eiger] Options: 4, 8, 16, 32\n\t" "[Eiger] Options: 4, 8, 16, 32\n\t"
"[Mythen3] Options: 8, 16, 32" "[Mythen3] Options: 8, 16, 32\n\t"
"[Jungfrau][Gotthard][Ctb][Moench][Mythen3][Gotthard2] 16"
<< '\n'; << '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
if (!args.empty()) { if (!args.empty()) {
@ -525,8 +504,9 @@ std::string CmdProxy::Speed(int action) {
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[0 or full_speed|1 or half_speed|2 or " os << "[0 or full_speed|1 or half_speed|2 or "
"quarter_speed]\n\t[Eiger][Jungfrau] Readout speed of " "quarter_speed]\n\t[Eiger][Jungfrau] Readout speed of "
"chip.\n\tJungfrau also overwrites adcphase to recommended " "chip.\n\t[Jungfrau] FULL_SPEED option only available from v2.0 "
"default. " "boards and with setting number of interfaces to 2. Also "
"overwrites adcphase to recommended default. "
<< '\n'; << '\n';
} else { } else {
defs::detectorType type = det->getDetectorType().squash(); defs::detectorType type = det->getDetectorType().squash();
@ -582,15 +562,13 @@ std::string CmdProxy::Adcphase(int action) {
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[n_value] " os << "[n_value] "
"[(optional)deg]\n\t[Jungfrau][Ctb][Moench][Moench][Gotthard] " "[(optional)deg]\n\t[Jungfrau][Ctb][Moench][Gotthard] "
"Phase " "Phase shift of ADC clock. \n\t[Jungfrau] Absolute phase shift. "
"shift of ADC clock. \n\t[Jungfrau] Absolute phase shift. If deg " "If deg used, then shift in degrees. Changing Speed also resets "
"used, then shift in degrees. Changing Speed also resets "
"adcphase to recommended defaults.\n\t[Ctb][Moench] Absolute " "adcphase to recommended defaults.\n\t[Ctb][Moench] Absolute "
"phase " "phase shift. If deg used, then shift in degrees. Changing "
"shift. If deg used, then shift in degrees. Changing adcclk also " "adcclk also resets adcphase and sets it to previous "
"resets adcphase and sets it to previous values.\n\t[Gotthard] " "values.\n\t[Gotthard] Relative phase shift. Cannot get"
"Relative phase shift"
<< '\n'; << '\n';
} else { } else {
auto det_type = det->getDetectorType().squash(defs::GENERIC); auto det_type = det->getDetectorType().squash(defs::GENERIC);
@ -641,11 +619,9 @@ std::string CmdProxy::Dbitphase(int action) {
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[n_value] [(optional)deg]\n\t[Ctb][Jungfrau] Phase shift of " os << "[n_value] [(optional)deg]\n\t[Ctb][Jungfrau] Phase shift of "
"clock to " "clock to latch digital bits. Absolute phase shift. If deg used, "
"latch digital bits. Absolute phase shift. If deg used, then " "then shift in degrees. \n\t[Ctb]Changing dbitclk also resets "
"shift in degrees. \n\t[Ctb]Changing dbitclk also resets " "dbitphase and sets to previous values."
"dbitphase and "
"sets to previous values."
<< '\n'; << '\n';
} else { } else {
auto det_type = det->getDetectorType().squash(defs::GENERIC); auto det_type = det->getDetectorType().squash(defs::GENERIC);
@ -873,12 +849,42 @@ std::string CmdProxy::ExternalSignal(int action) {
} }
/** temperature */ /** temperature */
std::string CmdProxy::TemperatureValues(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "\n\tGets the values for every temperature for this detector."
<< '\n';
} else if (action == defs::GET_ACTION) {
if (args.size() != 0) {
WrongNumberOfParameters(0);
}
auto t = det->getTemperatureList();
os << '[';
if (t.size() > 0) {
auto it = t.cbegin();
os << ToString(*it) << ' ';
os << OutString(det->getTemperature(*it++, {det_id})) << " °C";
while (it != t.cend()) {
os << ", " << ToString(*it) << ' ';
os << OutString(det->getTemperature(*it++, {det_id})) << " °C";
}
}
os << "]\n";
} else if (action == defs::PUT_ACTION) {
throw sls::RuntimeError("Cannot put");
} else {
throw sls::RuntimeError("Unknown action");
}
return os.str();
}
/* dacs */ /* dacs */
std::string CmdProxy::Dac(int action) { std::string CmdProxy::Dac(int action) {
std::ostringstream os; std::ostringstream os;
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[dac index] [dac or mv value] [(optional unit) mv] " os << "[dac index] [dac or mV value] [(optional unit) mV] "
"\n\t[Ctb] Dac." "\n\t[Ctb] Dac."
<< '\n'; << '\n';
} else if (det->getDetectorType().squash(defs::GENERIC) != } else if (det->getDetectorType().squash(defs::GENERIC) !=
@ -889,9 +895,9 @@ std::string CmdProxy::Dac(int action) {
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
bool mv = false; bool mv = false;
if (args.size() == 2) { if (args.size() == 2) {
if (args[1] != "mv") { if ((args[1] != "mv") && (args[1] != "mV")) {
throw sls::RuntimeError("Unknown argument " + args[1] + throw sls::RuntimeError("Unknown argument " + args[1] +
". Did you mean mv?"); ". Did you mean mV?");
} }
mv = true; mv = true;
} else if (args.size() > 2) { } else if (args.size() > 2) {
@ -900,13 +906,13 @@ std::string CmdProxy::Dac(int action) {
auto t = det->getDAC( auto t = det->getDAC(
static_cast<defs::dacIndex>(StringTo<int>(args[0])), mv, {det_id}); static_cast<defs::dacIndex>(StringTo<int>(args[0])), mv, {det_id});
os << args[0] << ' ' << OutString(t) os << args[0] << ' ' << OutString(t)
<< (args.size() > 1 ? " mv\n" : "\n"); << (args.size() > 1 ? " mV\n" : "\n");
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
bool mv = false; bool mv = false;
if (args.size() == 3) { if (args.size() == 3) {
if (args[2] != "mv") { if ((args[2] != "mv") && (args[2] != "mV")) {
throw sls::RuntimeError("Unknown argument " + args[2] + throw sls::RuntimeError("Unknown argument " + args[2] +
". Did you mean mv?"); ". Did you mean mV?");
} }
mv = true; mv = true;
} else if (args.size() > 3 || args.size() < 2) { } else if (args.size() > 3 || args.size() < 2) {
@ -914,27 +920,7 @@ std::string CmdProxy::Dac(int action) {
} }
det->setDAC(static_cast<defs::dacIndex>(StringTo<int>(args[0])), det->setDAC(static_cast<defs::dacIndex>(StringTo<int>(args[0])),
StringTo<int>(args[1]), mv, {det_id}); StringTo<int>(args[1]), mv, {det_id});
os << args[0] << ' ' << args[1] << (args.size() > 2 ? " mv\n" : "\n"); os << args[0] << ' ' << args[1] << (args.size() > 2 ? " mV\n" : "\n");
} else {
throw sls::RuntimeError("Unknown action");
}
return os.str();
}
std::string CmdProxy::DacList(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "\n\tGets the list of commands for every dac for this detector."
<< '\n';
} else if (action == defs::GET_ACTION) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getDacList();
os << ToString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
throw sls::RuntimeError("Cannot put");
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
} }
@ -945,15 +931,15 @@ std::string CmdProxy::DacValues(int action) {
std::ostringstream os; std::ostringstream os;
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[(optional unit) mv] \n\tGets the list of commands for every " os << "[(optional unit) mV] \n\tGets the values for every "
"dac for this detector." "dac for this detector."
<< '\n'; << '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
bool mv = false; bool mv = false;
if (args.size() == 1) { if (args.size() == 1) {
if (args[0] != "mv") { if ((args[0] != "mv") && (args[0] != "mV")) {
throw sls::RuntimeError("Unknown argument " + args[0] + throw sls::RuntimeError("Unknown argument " + args[0] +
". Did you mean mv?"); ". Did you mean mV?");
} }
mv = true; mv = true;
} else if (args.size() > 1) { } else if (args.size() > 1) {
@ -964,11 +950,11 @@ std::string CmdProxy::DacValues(int action) {
auto it = t.cbegin(); auto it = t.cbegin();
os << ToString(*it) << ' '; os << ToString(*it) << ' ';
os << OutString(det->getDAC(*it++, mv, {det_id})) os << OutString(det->getDAC(*it++, mv, {det_id}))
<< (!args.empty() ? " mv" : ""); << (!args.empty() ? " mV" : "");
while (it != t.cend()) { while (it != t.cend()) {
os << ", " << ToString(*it) << ' '; os << ", " << ToString(*it) << ' ';
os << OutString(det->getDAC(*it++, mv, {det_id})) os << OutString(det->getDAC(*it++, mv, {det_id}))
<< (!args.empty() ? " mv" : ""); << (!args.empty() ? " mV" : "");
} }
os << "]\n"; os << "]\n";
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
@ -985,7 +971,8 @@ std::string CmdProxy::ReceiverStatus(int action) {
std::ostringstream os; std::ostringstream os;
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "running, idle]\n\tReceiver listener status." << '\n'; os << "running, idle, transmitting]\n\tReceiver listener status."
<< '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
@ -1164,7 +1151,7 @@ std::string CmdProxy::UDPDestinationIP2(int action) {
} }
/* Receiver Config */ /* Receiver Config */
std::string CmdProxy::ReceiveHostname(int action) { std::string CmdProxy::ReceiverHostname(int action) {
std::ostringstream os; std::ostringstream os;
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
@ -1175,7 +1162,8 @@ std::string CmdProxy::ReceiveHostname(int action) {
"tcp port.\n\t" "tcp port.\n\t"
"Used for TCP control communication between client and receiver " "Used for TCP control communication between client and receiver "
"to configure receiver. Also updates receiver with detector " "to configure receiver. Also updates receiver with detector "
"parameters." "parameters. Also resets any prior receiver property (not on "
"detector). "
<< '\n'; << '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
if (!args.empty()) { if (!args.empty()) {
@ -1327,8 +1315,8 @@ std::string CmdProxy::RateCorrection(int action) {
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[n_rate (in ns)]\n\t[Eiger] Dead time correction constant in " os << "[n_rate (in ns)]\n\t[Eiger] Dead time correction constant in "
"ns. -1 will set to default tau of settings. 0 will unset rate " "ns. -1 will set to default tau of settings from trimbit file. 0 "
"correction." "will unset rate correction."
<< '\n'; << '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
if (!args.empty()) { if (!args.empty()) {
@ -1627,7 +1615,7 @@ std::string CmdProxy::VetoPhoton(int action) {
os << "[ichip] [#photons] [energy in keV] [reference " os << "[ichip] [#photons] [energy in keV] [reference "
"file]\n\t[Gotthard2] Set veto reference for 128 channels for " "file]\n\t[Gotthard2] Set veto reference for 128 channels for "
"chip ichip according to reference file and #photons and energy " "chip ichip according to reference file and #photons and energy "
"in keV.\n" "in keV.\n\t"
<< "[ichip] [output file]\n\t Get gain indices and veto reference " << "[ichip] [output file]\n\t Get gain indices and veto reference "
"for 128 channels for chip ichip, saved to file." "for 128 channels for chip ichip, saved to file."
<< '\n'; << '\n';
@ -1699,8 +1687,8 @@ std::string CmdProxy::BurstMode(int action) {
std::ostringstream os; std::ostringstream os;
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[off or 0, internal or 1, external or 2]\n\t[Gotthard2] Default " os << "[burst_internal or 0, burst_external or 1, cw_internal or 2, "
"is burst internal type" "cw_external or 3]\n\t[Gotthard2] Default is burst_internal type"
<< '\n'; << '\n';
} else { } else {
if (action == defs::GET_ACTION) { if (action == defs::GET_ACTION) {
@ -1718,14 +1706,17 @@ std::string CmdProxy::BurstMode(int action) {
int ival = StringTo<int>(args[0]); int ival = StringTo<int>(args[0]);
switch (ival) { switch (ival) {
case 0: case 0:
t = defs::BURST_OFF;
break;
case 1:
t = defs::BURST_INTERNAL; t = defs::BURST_INTERNAL;
break; break;
case 2: case 1:
t = defs::BURST_EXTERNAL; t = defs::BURST_EXTERNAL;
break; break;
case 2:
t = defs::CONTINUOUS_INTERNAL;
break;
case 3:
t = defs::CONTINUOUS_EXTERNAL;
break;
default: default:
throw sls::RuntimeError("Unknown burst mode " + args[0]); throw sls::RuntimeError("Unknown burst mode " + args[0]);
} }
@ -1803,8 +1794,9 @@ std::string CmdProxy::Counters(int action) {
std::ostringstream os; std::ostringstream os;
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[i0] [i1] [i2]... \n\t[Mythen3] List of counters enabled. Each " os << "[i0] [i1] [i2]... \n\t[Mythen3] List of counters indices "
"element in list can be 0 - 2 and must be non repetitive." "enabled. Each element in list can be 0 - 2 and must be non "
"repetitive."
<< '\n'; << '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
if (!args.empty()) { if (!args.empty()) {
@ -1857,23 +1849,19 @@ std::string CmdProxy::GateDelay(int action) {
if (cmd == "gatedelay") { if (cmd == "gatedelay") {
os << "[duration] [(optional unit) " os << "[duration] [(optional unit) "
"ns|us|ms|s]\n\t[Mythen3] Gate Delay of all gate signals in " "ns|us|ms|s]\n\t[Mythen3] Gate Delay of all gate signals in "
"auto and " "auto and trigger mode (internal gating)."
"trigger mode (internal gating)."
<< '\n'; << '\n';
} else if (cmd == "gatedelay1") { } else if (cmd == "gatedelay1") {
os << "[n_value]\n\t[Mythen3] Gate Delay of gate signal 1 in " os << "[n_value]\n\t[Mythen3] Gate Delay of gate signal 1 in auto "
"auto and " "and trigger mode (internal gating)."
"trigger mode (internal gating)."
<< '\n'; << '\n';
} else if (cmd == "gatedelay2") { } else if (cmd == "gatedelay2") {
os << "[n_value]\n\t[Mythen3] Gate Delay of gate signal 2 in " os << "[n_value]\n\t[Mythen3] Gate Delay of gate signal 2 in auto "
"auto and " "and trigger mode (internal gating)."
"trigger mode (internal gating)."
<< '\n'; << '\n';
} else { } else {
os << "[n_value]\n\t[Mythen3] Gate Delay of gate signal 3 in " os << "[n_value]\n\t[Mythen3] Gate Delay of gate signal 3 in auto "
"auto and " "and trigger mode (internal gating)."
"trigger mode (internal gating)."
<< '\n'; << '\n';
} }
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
@ -2007,8 +1995,7 @@ std::string CmdProxy::ReceiverDbitList(int action) {
os << "[all] or [i0] [i1] [i2]... \n\t[Ctb] List of digital signal " os << "[all] or [i0] [i1] [i2]... \n\t[Ctb] List of digital signal "
"bits read out. If all is used instead of a list, all digital " "bits read out. If all is used instead of a list, all digital "
"bits (64) enabled. Each element in list can be 0 - 63 and must " "bits (64) enabled. Each element in list can be 0 - 63 and must "
"be non " "be non repetitive."
"repetitive."
<< '\n'; << '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
if (!args.empty()) { if (!args.empty()) {
@ -2124,8 +2111,7 @@ std::string CmdProxy::PatternLoopAddresses(int action) {
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
if (cmd == "patlimits") { if (cmd == "patlimits") {
os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits " os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits "
"of complete " "of complete pattern."
"pattern."
<< '\n'; << '\n';
} else if (cmd == "patloop0") { } else if (cmd == "patloop0") {
os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits " os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits "
@ -2528,7 +2514,8 @@ std::string CmdProxy::Register(int action) {
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[address] [32 bit value]\n\tReads/writes to a 32 bit register " os << "[address] [32 bit value]\n\tReads/writes to a 32 bit register "
"in hex.\n\t[Eiger] +0x100 for only left, +0x200 for only right" "in hex. Advanced Function!\n\t[Eiger] +0x100 for only left, "
"+0x200 for only right."
<< '\n'; << '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
if (args.size() != 1) { if (args.size() != 1) {
@ -2555,7 +2542,7 @@ std::string CmdProxy::AdcRegister(int action) {
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[address] [value]\n\t[Jungfrau][Ctb][Moench][Gotthard] Writes " os << "[address] [value]\n\t[Jungfrau][Ctb][Moench][Gotthard] Writes "
"to an adc " "to an adc "
"register in hex." "register in hex. Advanced user Function!"
<< '\n'; << '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
throw sls::RuntimeError("Cannot get."); throw sls::RuntimeError("Cannot get.");

View File

@ -274,29 +274,29 @@
else if (action == slsDetectorDefs::GET_ACTION) { \ else if (action == slsDetectorDefs::GET_ACTION) { \
bool mv = false; \ bool mv = false; \
if (args.size() == 1) { \ if (args.size() == 1) { \
if (args[0] != "mv") { \ if ((args[0] != "mv") && (args[0] != "mV")) { \
throw sls::RuntimeError("Unknown argument " + args[0] + \ throw sls::RuntimeError("Unknown argument " + args[0] + \
". Did you mean mv?"); \ ". Did you mean mV?"); \
} \ } \
mv = true; \ mv = true; \
} else if (args.size() > 1) { \ } else if (args.size() > 1) { \
WrongNumberOfParameters(0); \ WrongNumberOfParameters(0); \
} \ } \
auto t = det->GETFCN(DAC_INDEX, mv, {det_id}); \ auto t = det->GETFCN(DAC_INDEX, mv, {det_id}); \
os << OutString(t) << (!args.empty() ? " mv\n" : "\n"); \ os << OutString(t) << (!args.empty() ? " mV\n" : "\n"); \
} else if (action == slsDetectorDefs::PUT_ACTION) { \ } else if (action == slsDetectorDefs::PUT_ACTION) { \
bool mv = false; \ bool mv = false; \
if (args.size() == 2) { \ if (args.size() == 2) { \
if (args[1] != "mv") { \ if ((args[1] != "mv") && (args[1] != "mV")) { \
throw sls::RuntimeError("Unknown argument " + args[1] + \ throw sls::RuntimeError("Unknown argument " + args[1] + \
". Did you mean mv?"); \ ". Did you mean mV?"); \
} \ } \
mv = true; \ mv = true; \
} else if (args.size() > 2 || args.empty()) { \ } else if (args.size() > 2 || args.empty()) { \
WrongNumberOfParameters(1); \ WrongNumberOfParameters(1); \
} \ } \
det->SETFCN(DAC_INDEX, StringTo<int>(args[0]), mv, {det_id}); \ det->SETFCN(DAC_INDEX, StringTo<int>(args[0]), mv, {det_id}); \
os << args.front() << (args.size() > 1 ? " mv\n" : "\n"); \ os << args.front() << (args.size() > 1 ? " mV\n" : "\n"); \
} else { \ } else { \
throw sls::RuntimeError("Unknown action"); \ throw sls::RuntimeError("Unknown action"); \
} \ } \
@ -414,6 +414,27 @@
return os.str(); \ return os.str(); \
} }
/** get only no id (vector, not result) */
#define GET_COMMAND_NOID(CMDNAME, GETFCN, HLPSTR) \
std::string CMDNAME(const int action) { \
std::ostringstream os; \
os << cmd << ' '; \
if (action == slsDetectorDefs::HELP_ACTION) \
os << HLPSTR << '\n'; \
else if (action == slsDetectorDefs::GET_ACTION) { \
if (!args.empty()) { \
WrongNumberOfParameters(0); \
} \
auto t = det->GETFCN(); \
os << sls::ToString(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
throw sls::RuntimeError("Cannot put"); \
} else { \
throw sls::RuntimeError("Unknown action"); \
} \
return os.str(); \
}
/** get only hex*/ /** get only hex*/
#define GET_COMMAND_HEX(CMDNAME, GETFCN, HLPSTR) \ #define GET_COMMAND_HEX(CMDNAME, GETFCN, HLPSTR) \
std::string CMDNAME(const int action) { \ std::string CMDNAME(const int action) { \
@ -614,7 +635,7 @@ class CmdProxy {
/* configuration */ /* configuration */
{"config", &CmdProxy::config}, {"config", &CmdProxy::config},
{"free", &CmdProxy::free}, {"free", &CmdProxy::Free},
{"parameters", &CmdProxy::parameters}, {"parameters", &CmdProxy::parameters},
{"hostname", &CmdProxy::Hostname}, {"hostname", &CmdProxy::Hostname},
{"virtual", &CmdProxy::VirtualServer}, {"virtual", &CmdProxy::VirtualServer},
@ -627,7 +648,7 @@ class CmdProxy {
{"detectornumber", &CmdProxy::detectornumber}, {"detectornumber", &CmdProxy::detectornumber},
{"type", &CmdProxy::type}, {"type", &CmdProxy::type},
{"detsize", &CmdProxy::DetectorSize}, {"detsize", &CmdProxy::DetectorSize},
{"settingslist", &CmdProxy::SettingsList}, {"settingslist", &CmdProxy::settingslist},
{"settings", &CmdProxy::settings}, {"settings", &CmdProxy::settings},
{"trimbits", &CmdProxy::trimbits}, {"trimbits", &CmdProxy::trimbits},
{"trimval", &CmdProxy::trimval}, {"trimval", &CmdProxy::trimval},
@ -645,7 +666,9 @@ class CmdProxy {
{"delayl", &CmdProxy::delayl}, {"delayl", &CmdProxy::delayl},
{"periodl", &CmdProxy::periodl}, {"periodl", &CmdProxy::periodl},
{"dr", &CmdProxy::DynamicRange}, {"dr", &CmdProxy::DynamicRange},
{"drlist", &CmdProxy::drlist},
{"timing", &CmdProxy::timing}, {"timing", &CmdProxy::timing},
{"timinglist", &CmdProxy::timinglist},
{"speed", &CmdProxy::Speed}, {"speed", &CmdProxy::Speed},
{"adcphase", &CmdProxy::Adcphase}, {"adcphase", &CmdProxy::Adcphase},
{"maxadcphaseshift", &CmdProxy::maxadcphaseshift}, {"maxadcphaseshift", &CmdProxy::maxadcphaseshift},
@ -659,8 +682,11 @@ class CmdProxy {
{"powerchip", &CmdProxy::powerchip}, {"powerchip", &CmdProxy::powerchip},
{"imagetest", &CmdProxy::imagetest}, {"imagetest", &CmdProxy::imagetest},
{"extsig", &CmdProxy::ExternalSignal}, {"extsig", &CmdProxy::ExternalSignal},
{"parallel", &CmdProxy::parallel},
/** temperature */ /** temperature */
{"templist", &CmdProxy::templist},
{"tempvalues", &CmdProxy::TemperatureValues},
{"temp_adc", &CmdProxy::temp_adc}, {"temp_adc", &CmdProxy::temp_adc},
{"temp_fpga", &CmdProxy::temp_fpga}, {"temp_fpga", &CmdProxy::temp_fpga},
{"temp_fpgaext", &CmdProxy::temp_fpgaext}, {"temp_fpgaext", &CmdProxy::temp_fpgaext},
@ -670,6 +696,7 @@ class CmdProxy {
{"temp_sodr", &CmdProxy::temp_sodr}, {"temp_sodr", &CmdProxy::temp_sodr},
{"temp_fpgafl", &CmdProxy::temp_fpgafl}, {"temp_fpgafl", &CmdProxy::temp_fpgafl},
{"temp_fpgafr", &CmdProxy::temp_fpgafr}, {"temp_fpgafr", &CmdProxy::temp_fpgafr},
{"temp_slowadc", &CmdProxy::temp_slowadc},
/* dacs */ /* dacs */
{"vthreshold", &CmdProxy::vthreshold}, {"vthreshold", &CmdProxy::vthreshold},
@ -737,7 +764,7 @@ class CmdProxy {
{"ibias_sfp", &CmdProxy::ibias_sfp}, {"ibias_sfp", &CmdProxy::ibias_sfp},
{"dac", &CmdProxy::Dac}, {"dac", &CmdProxy::Dac},
{"daclist", &CmdProxy::DacList}, {"daclist", &CmdProxy::daclist},
{"dacvalues", &CmdProxy::DacValues}, {"dacvalues", &CmdProxy::DacValues},
/* on chip dacs */ /* on chip dacs */
@ -786,7 +813,7 @@ class CmdProxy {
{"txndelay_right", &CmdProxy::txndelay_right}, {"txndelay_right", &CmdProxy::txndelay_right},
/* Receiver Config */ /* Receiver Config */
{"rx_hostname", &CmdProxy::ReceiveHostname}, {"rx_hostname", &CmdProxy::ReceiverHostname},
{"rx_tcpport", &CmdProxy::rx_tcpport}, {"rx_tcpport", &CmdProxy::rx_tcpport},
{"rx_fifodepth", &CmdProxy::rx_fifodepth}, {"rx_fifodepth", &CmdProxy::rx_fifodepth},
{"rx_silent", &CmdProxy::rx_silent}, {"rx_silent", &CmdProxy::rx_silent},
@ -823,7 +850,6 @@ class CmdProxy {
{"threshold", &CmdProxy::Threshold}, {"threshold", &CmdProxy::Threshold},
{"thresholdnotb", &CmdProxy::ThresholdNoTb}, {"thresholdnotb", &CmdProxy::ThresholdNoTb},
{"settingspath", &CmdProxy::settingspath}, {"settingspath", &CmdProxy::settingspath},
{"parallel", &CmdProxy::parallel},
{"overflow", &CmdProxy::overflow}, {"overflow", &CmdProxy::overflow},
{"flippeddatax", &CmdProxy::flippeddatax}, {"flippeddatax", &CmdProxy::flippeddatax},
{"trimen", &CmdProxy::TrimEnergies}, {"trimen", &CmdProxy::TrimEnergies},
@ -985,7 +1011,7 @@ class CmdProxy {
/* Commands */ /* Commands */
std::string ListCommands(int action); std::string ListCommands(int action);
/* configuration */ /* configuration */
std::string free(int action); std::string Free(int action);
// std::string config2(int action); // std::string config2(int action);
std::string Hostname(int action); std::string Hostname(int action);
std::string VirtualServer(int action); std::string VirtualServer(int action);
@ -994,7 +1020,6 @@ class CmdProxy {
std::string PackageVersion(int action); std::string PackageVersion(int action);
std::string ClientVersion(int action); std::string ClientVersion(int action);
std::string DetectorSize(int action); std::string DetectorSize(int action);
std::string SettingsList(int action);
std::string GapPixels(int action); std::string GapPixels(int action);
/* acquisition parameters */ /* acquisition parameters */
std::string Acquire(int action); std::string Acquire(int action);
@ -1009,9 +1034,9 @@ class CmdProxy {
std::string ClockDivider(int action); std::string ClockDivider(int action);
std::string ExternalSignal(int action); std::string ExternalSignal(int action);
/** temperature */ /** temperature */
std::string TemperatureValues(int action);
/* dacs */ /* dacs */
std::string Dac(int action); std::string Dac(int action);
std::string DacList(int action);
std::string DacValues(int action); std::string DacValues(int action);
/* acquisition */ /* acquisition */
std::string ReceiverStatus(int action); std::string ReceiverStatus(int action);
@ -1021,7 +1046,7 @@ class CmdProxy {
std::string UDPDestinationIP(int action); std::string UDPDestinationIP(int action);
std::string UDPDestinationIP2(int action); std::string UDPDestinationIP2(int action);
/* Receiver Config */ /* Receiver Config */
std::string ReceiveHostname(int action); std::string ReceiverHostname(int action);
/* File */ /* File */
/* ZMQ Streaming Parameters (Receiver<->Client) */ /* ZMQ Streaming Parameters (Receiver<->Client) */
/* Eiger Specific */ /* Eiger Specific */
@ -1082,7 +1107,7 @@ class CmdProxy {
/* configuration */ /* configuration */
EXECUTE_SET_COMMAND_NOID_1ARG( EXECUTE_SET_COMMAND_NOID_1ARG(
config, loadConfig, config, loadConfig,
"[fname]\n\tConfigures detector to configuration contained in fname. " "[fname]\n\tFrees shared memory before loading configuration file. "
"Set up once."); "Set up once.");
EXECUTE_SET_COMMAND_NOID_1ARG( EXECUTE_SET_COMMAND_NOID_1ARG(
@ -1103,6 +1128,9 @@ class CmdProxy {
GET_COMMAND(type, getDetectorType, GET_COMMAND(type, getDetectorType,
"\n\tSerial number or MAC of detector (hex)."); "\n\tSerial number or MAC of detector (hex).");
GET_COMMAND_NOID(settingslist, getSettingsList,
"\n\tList of settings implemented for this detector.");
INTEGER_COMMAND(settings, getSettings, setSettings, INTEGER_COMMAND(settings, getSettings, setSettings,
sls::StringTo<slsDetectorDefs::detectorSettings>, sls::StringTo<slsDetectorDefs::detectorSettings>,
"[standard, fast, highgain, dynamicgain, lowgain, " "[standard, fast, highgain, dynamicgain, lowgain, "
@ -1118,7 +1146,8 @@ class CmdProxy {
"\n\t[Gotthard2] - [dynamicgain | fixgain1 | fixgain2]" "\n\t[Gotthard2] - [dynamicgain | fixgain1 | fixgain2]"
"\n\t[Moench] - [g1_hg | g1_lg | g2_hc_hg | g2_hc_lg | " "\n\t[Moench] - [g1_hg | g1_lg | g2_hc_hg | g2_hc_lg | "
"g2_lc_hg | g2_lc_lg | g4_hg | g4_lg]" "g2_lc_hg | g2_lc_lg | g4_hg | g4_lg]"
"\n\t[Eiger] Use threshold or thresholdnotb."); "\n\t[Eiger] Use threshold or thresholdnotb. \n\t[Eiger] "
"settings loaded from file found in settingspath.");
EXECUTE_SET_COMMAND_1ARG( EXECUTE_SET_COMMAND_1ARG(
trimbits, loadTrimbits, trimbits, loadTrimbits,
@ -1133,9 +1162,10 @@ class CmdProxy {
INTEGER_COMMAND_NOID( INTEGER_COMMAND_NOID(
frames, getNumberOfFrames, setNumberOfFrames, StringTo<int64_t>, frames, getNumberOfFrames, setNumberOfFrames, StringTo<int64_t>,
"[n_frames]\n\tNumber of frames per aquire. In trigger mode, number of " "[n_frames]\n\tNumber of frames per acquisition. In "
"frames per trigger." "trigger mode, number of frames per trigger. Cannot be set in modular "
"\n\t[Gotthard2] Burst mode has a maximum of 2720 frames."); "level. In scan mode, number of frames is set to number of "
"steps.\n\t[Gotthard2] Burst mode has a maximum of 2720 frames.");
INTEGER_COMMAND_NOID(triggers, getNumberOfTriggers, setNumberOfTriggers, INTEGER_COMMAND_NOID(triggers, getNumberOfTriggers, setNumberOfTriggers,
StringTo<int64_t>, StringTo<int64_t>,
@ -1144,8 +1174,7 @@ class CmdProxy {
TIME_COMMAND( TIME_COMMAND(
period, getPeriod, setPeriod, period, getPeriod, setPeriod,
"[duration] [(optional unit) ns|us|ms|s]\n\tPeriod between frames" "[duration] [(optional unit) ns|us|ms|s]\n\tPeriod between frames");
"\n\t[Gotthard2] Uploaded to detector just before acquisition starts");
TIME_COMMAND(delay, getDelayAfterTrigger, setDelayAfterTrigger, TIME_COMMAND(delay, getDelayAfterTrigger, setDelayAfterTrigger,
"[duration] [(optional unit) " "[duration] [(optional unit) "
@ -1172,6 +1201,9 @@ class CmdProxy {
" Period left for current frame." " Period left for current frame."
"\n\t[Gotthard2] only in continuous mode."); "\n\t[Gotthard2] only in continuous mode.");
GET_COMMAND_NOID(drlist, getDynamicRangeList,
"\n\tGets the list of dynamic ranges for this detector.");
INTEGER_COMMAND(timing, getTimingMode, setTimingMode, INTEGER_COMMAND(timing, getTimingMode, setTimingMode,
sls::StringTo<slsDetectorDefs::timingMode>, sls::StringTo<slsDetectorDefs::timingMode>,
"[auto|trigger|gating|burst_trigger]\n\tTiming Mode of " "[auto|trigger|gating|burst_trigger]\n\tTiming Mode of "
@ -1180,6 +1212,9 @@ class CmdProxy {
"[auto|trigger|gating|trigger_gating]\n\t[Eiger] " "[auto|trigger|gating|trigger_gating]\n\t[Eiger] "
"[auto|trigger|gating|burst_trigger]"); "[auto|trigger|gating|burst_trigger]");
GET_COMMAND_NOID(timinglist, getTimingModeList,
"\n\tGets the list of timing modes for this detector.");
GET_COMMAND(maxadcphaseshift, getMaxADCPhaseShift, GET_COMMAND(maxadcphaseshift, getMaxADCPhaseShift,
"\n\t[Jungfrau][CTB][Moench] Absolute maximum Phase shift of " "\n\t[Jungfrau][CTB][Moench] Absolute maximum Phase shift of "
"ADC clock."); "ADC clock.");
@ -1212,7 +1247,16 @@ class CmdProxy {
"\n\t[Eiger][Jungfrau] Only for Virtual servers. If 0, each pixel " "\n\t[Eiger][Jungfrau] Only for Virtual servers. If 0, each pixel "
"intensity incremented by 1. If 1, all pixels almost saturated."); "intensity incremented by 1. If 1, all pixels almost saturated.");
INTEGER_COMMAND(parallel, getParallelMode, setParallelMode, StringTo<int>,
"[0, 1]\n\t[Eiger][Mythen3] Enable or disable parallel "
"mode.\n\t[Mythen3] If exptime is too short, the "
"acquisition will return ERROR status and take fewer "
"frames than expected.");
/** temperature */ /** temperature */
GET_COMMAND_NOID(
templist, getTemperatureList,
"\n\tList of temperature commands implemented for this detector.");
GET_IND_COMMAND(temp_adc, getTemperature, slsDetectorDefs::TEMPERATURE_ADC, GET_IND_COMMAND(temp_adc, getTemperature, slsDetectorDefs::TEMPERATURE_ADC,
" °C", "[n_value]\n\t[Jungfrau][Gotthard] ADC Temperature"); " °C", "[n_value]\n\t[Jungfrau][Gotthard] ADC Temperature");
@ -1249,266 +1293,274 @@ class CmdProxy {
temp_fpgafr, getTemperature, slsDetectorDefs::TEMPERATURE_FPGA3, " °C", temp_fpgafr, getTemperature, slsDetectorDefs::TEMPERATURE_FPGA3, " °C",
"[n_value]\n\t[Eiger]Temperature of the left front end board fpga"); "[n_value]\n\t[Eiger]Temperature of the left front end board fpga");
GET_IND_COMMAND(temp_slowadc, getTemperature,
slsDetectorDefs::SLOW_ADC_TEMP, " °C",
"[n_value]\n\t[Ctb]Temperature of the slow adc");
/* dacs */ /* dacs */
DAC_COMMAND(vthreshold, getDAC, setDAC, defs::VTHRESHOLD, DAC_COMMAND(vthreshold, getDAC, setDAC, defs::VTHRESHOLD,
"[dac or mv value][(optional unit) mv] \n\t[Eiger][Mythen3] " "[dac or mV value][(optional unit) mV] \n\t[Eiger][Mythen3] "
"Detector threshold voltage for single photon counters."); "Detector threshold voltage for single photon counters.");
DAC_COMMAND(vsvp, getDAC, setDAC, defs::VSVP, DAC_COMMAND(vsvp, getDAC, setDAC, defs::VSVP,
"[dac or mv value][(optional unit) mv] \n\t[Eiger] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO "?? "); // TODO
DAC_COMMAND(vsvn, getDAC, setDAC, defs::VSVN, DAC_COMMAND(vsvn, getDAC, setDAC, defs::VSVN,
"[dac or mv value][(optional unit) mv] \n\t[Eiger] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? \n\t[Mythen3] voltage " "?? \n\t[Mythen3] voltage "
"to define feedback resistance of the first shaper"); // TODO "to define feedback resistance of the first shaper"); // TODO
DAC_COMMAND(vtrim, getDAC, setDAC, defs::VTRIM, DAC_COMMAND(vtrim, getDAC, setDAC, defs::VTRIM,
"[dac or mv value][(optional unit) mv] \n\t[Eiger] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? \n\t[Mythen3] Dac for " "?? \n\t[Mythen3] Dac for "
"the voltage defining the trim bit size."); // TODO "the voltage defining the trim bit size."); // TODO
DAC_COMMAND(vrpreamp, getDAC, setDAC, defs::VRPREAMP, DAC_COMMAND(vrpreamp, getDAC, setDAC, defs::VRPREAMP,
"[dac or mv value][(optional unit) mv] \n\t[Eiger] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? \n\t[Mythen3] voltage " "?? \n\t[Mythen3] voltage "
"to define the preamplifier feedback resistance."); // TODO "to define the preamplifier feedback resistance."); // TODO
DAC_COMMAND(vrshaper, getDAC, setDAC, defs::VRSHAPER, DAC_COMMAND(vrshaper, getDAC, setDAC, defs::VRSHAPER,
"[dac or mv value][(optional unit) mv] \n\t[Eiger] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? \n\t[Mythen3] voltage to define feedback resistance of " "?? \n\t[Mythen3] voltage to define feedback resistance of "
"the first shaper"); // TODO "the first shaper"); // TODO
DAC_COMMAND(vtgstv, getDAC, setDAC, defs::VTGSTV, DAC_COMMAND(vtgstv, getDAC, setDAC, defs::VTGSTV,
"[dac or mv value][(optional unit) mv] \n\t[Eiger] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO "?? "); // TODO
DAC_COMMAND(vcmp_ll, getDAC, setDAC, defs::VCMP_LL, DAC_COMMAND(vcmp_ll, getDAC, setDAC, defs::VCMP_LL,
"[dac or mv value][(optional unit) mv] \n\t[Eiger] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO "?? "); // TODO
DAC_COMMAND(vcmp_lr, getDAC, setDAC, defs::VCMP_LR, DAC_COMMAND(vcmp_lr, getDAC, setDAC, defs::VCMP_LR,
"[dac or mv value][(optional unit) mv] \n\t[Eiger] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO "?? "); // TODO
DAC_COMMAND(vcal, getDAC, setDAC, defs::VCAL, DAC_COMMAND(vcal, getDAC, setDAC, defs::VCAL,
"[dac or mv value][(optional unit) mv] \n\t[Eiger] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO "?? "); // TODO
DAC_COMMAND(vcmp_rl, getDAC, setDAC, defs::VCMP_RL, DAC_COMMAND(vcmp_rl, getDAC, setDAC, defs::VCMP_RL,
"[dac or mv value][(optional unit) mv] \n\t[Eiger] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO "?? "); // TODO
DAC_COMMAND(vcmp_rr, getDAC, setDAC, defs::VCMP_RR, DAC_COMMAND(vcmp_rr, getDAC, setDAC, defs::VCMP_RR,
"[dac or mv value][(optional unit) mv] \n\t[Eiger] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO "?? "); // TODO
DAC_COMMAND(rxb_rb, getDAC, setDAC, defs::RXB_RB, DAC_COMMAND(rxb_rb, getDAC, setDAC, defs::RXB_RB,
"[dac or mv value][(optional unit) mv] \n\t[Eiger] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO "?? "); // TODO
DAC_COMMAND(rxb_lb, getDAC, setDAC, defs::RXB_LB, DAC_COMMAND(rxb_lb, getDAC, setDAC, defs::RXB_LB,
"[dac or mv value][(optional unit) mv] \n\t[Eiger] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO "?? "); // TODO
DAC_COMMAND(vcp, getDAC, setDAC, defs::VCP, DAC_COMMAND(vcp, getDAC, setDAC, defs::VCP,
"[dac or mv value][(optional unit) mv] \n\t[Eiger] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO "?? "); // TODO
DAC_COMMAND(vcn, getDAC, setDAC, defs::VCN, DAC_COMMAND(vcn, getDAC, setDAC, defs::VCN,
"[dac or mv value][(optional unit) mv] \n\t[Eiger] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO "?? "); // TODO
DAC_COMMAND(vishaper, getDAC, setDAC, defs::VISHAPER, DAC_COMMAND(vishaper, getDAC, setDAC, defs::VISHAPER,
"[dac or mv value][(optional unit) mv] \n\t[Eiger] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? \n\t[Mythen3] Dac for " "?? \n\t[Mythen3] Dac for "
"the bias current for the shaper."); // TODO "the bias current for the shaper."); // TODO
DAC_COMMAND(iodelay, getDAC, setDAC, defs::IO_DELAY, DAC_COMMAND(iodelay, getDAC, setDAC, defs::IO_DELAY,
"[dac or mv value][(optional unit) mv] \n\t[Eiger] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
"?? "); // TODO "?? "); // TODO
DAC_COMMAND(vref_ds, getDAC, setDAC, defs::VREF_DS, DAC_COMMAND(vref_ds, getDAC, setDAC, defs::VREF_DS,
"[dac or mv value][(optional unit) mv] " "[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard][Jungfrau] Dac for ?? "); // TODO "\n\t[Gotthard][Jungfrau] Dac for ?? "); // TODO
DAC_COMMAND(vcascn_pb, getDAC, setDAC, defs::VCASCN_PB, DAC_COMMAND(vcascn_pb, getDAC, setDAC, defs::VCASCN_PB,
"[dac or mv value][(optional unit) mv] \n\t[Gotthard] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for "
"?? "); // TODO "?? "); // TODO
DAC_COMMAND(vcascp_pb, getDAC, setDAC, defs::VCASCP_PB, DAC_COMMAND(vcascp_pb, getDAC, setDAC, defs::VCASCP_PB,
"[dac or mv value][(optional unit) mv] \n\t[Gotthard] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for "
"?? "); // TODO "?? "); // TODO
DAC_COMMAND(vout_cm, getDAC, setDAC, defs::VOUT_CM, DAC_COMMAND(vout_cm, getDAC, setDAC, defs::VOUT_CM,
"[dac or mv value][(optional unit) mv] \n\t[Gotthard] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for "
"?? \n\t[Moench] Dac for 5"); // TODO "?? \n\t[Moench] Dac for 5"); // TODO
DAC_COMMAND(vcasc_out, getDAC, setDAC, defs::VCASC_OUT, DAC_COMMAND(vcasc_out, getDAC, setDAC, defs::VCASC_OUT,
"[dac or mv value][(optional unit) mv] \n\t[Gotthard] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for "
"?? "); // TODO "?? "); // TODO
DAC_COMMAND(vin_cm, getDAC, setDAC, defs::VIN_CM, DAC_COMMAND(vin_cm, getDAC, setDAC, defs::VIN_CM,
"[dac or mv value][(optional unit) mv] \n\t[Gotthard] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for "
"?? \n\t[Moench] Dac for 2"); // TODO "?? \n\t[Moench] Dac for 2"); // TODO
DAC_COMMAND(vref_comp, getDAC, setDAC, defs::VREF_COMP, DAC_COMMAND(vref_comp, getDAC, setDAC, defs::VREF_COMP,
"[dac or mv value][(optional unit) mv] " "[dac or mV value][(optional unit) mV] "
"\n\t[Gotthard][Jungfrau] Dac for ?? "); // TODO "\n\t[Gotthard][Jungfrau] Dac for ?? "); // TODO
DAC_COMMAND(ib_test_c, getDAC, setDAC, defs::IB_TESTC, DAC_COMMAND(ib_test_c, getDAC, setDAC, defs::IB_TESTC,
"[dac or mv value][(optional unit) mv] \n\t[Gotthard] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for "
"?? "); // TODO "?? "); // TODO
DAC_COMMAND(vrshaper_n, getDAC, setDAC, defs::VRSHAPER_N, DAC_COMMAND(vrshaper_n, getDAC, setDAC, defs::VRSHAPER_N,
"[dac or mv value][(optional unit) mv] \n\t[Mythen3] voltage " "[dac or mV value][(optional unit) mV] \n\t[Mythen3] voltage "
"to define feedback resistance of the second shaper."); "to define feedback resistance of the second shaper.");
DAC_COMMAND( DAC_COMMAND(
vipre, getDAC, setDAC, defs::VIPRE, vipre, getDAC, setDAC, defs::VIPRE,
"[dac or mv value][(optional unit) mv] \n\t[Mythen3] Dac for the " "[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
"preamplifier's input transistor current.\n\t[Moench] Dac for 1"); "preamplifier's input transistor current.\n\t[Moench] Dac for 1");
DAC_COMMAND(vdcsh, getDAC, setDAC, defs::VDCSH, DAC_COMMAND(vdcsh, getDAC, setDAC, defs::VDCSH,
"[dac or mv value][(optional unit) mv] \n\t[Mythen3] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"the reference (DC) voltage for the shaper."); "the reference (DC) voltage for the shaper.");
DAC_COMMAND(vth1, getDAC, setDAC, defs::VTH1, DAC_COMMAND(vth1, getDAC, setDAC, defs::VTH1,
"[dac or mv value][(optional unit) mv] \n\t[Mythen3] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"first detector threshold voltage."); "first detector threshold voltage.");
DAC_COMMAND(vth2, getDAC, setDAC, defs::VTH2, DAC_COMMAND(vth2, getDAC, setDAC, defs::VTH2,
"[dac or mv value][(optional unit) mv] \n\t[Mythen3] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"second detector threshold voltage."); "second detector threshold voltage.");
DAC_COMMAND(vth3, getDAC, setDAC, defs::VTH3, DAC_COMMAND(vth3, getDAC, setDAC, defs::VTH3,
"[dac or mv value][(optional unit) mv] \n\t[Mythen3] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"third detector threshold voltage."); "third detector threshold voltage.");
DAC_COMMAND(vcal_n, getDAC, setDAC, defs::VCAL_N, DAC_COMMAND(vcal_n, getDAC, setDAC, defs::VCAL_N,
"[dac or mv value][(optional unit) mv] \n\t[Mythen3] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"the low voltage for analog pulsing."); "the low voltage for analog pulsing.");
DAC_COMMAND(vcal_p, getDAC, setDAC, defs::VCAL_P, DAC_COMMAND(vcal_p, getDAC, setDAC, defs::VCAL_P,
"[dac or mv value][(optional unit) mv] \n\t[Mythen3] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"the high voltage for analog pulsing."); "the high voltage for analog pulsing.");
DAC_COMMAND(vcassh, getDAC, setDAC, defs::VCASSH, DAC_COMMAND(vcassh, getDAC, setDAC, defs::VCASSH,
"[dac or mv value][(optional unit) mv] \n\t[Mythen3] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"the shaper's cascode voltage."); "the shaper's cascode voltage.");
DAC_COMMAND(vcas, getDAC, setDAC, defs::VCAS, DAC_COMMAND(vcas, getDAC, setDAC, defs::VCAS,
"[dac or mv value][(optional unit) mv] \n\t[Mythen3] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"the preamplifier's cascode voltage."); "the preamplifier's cascode voltage.");
DAC_COMMAND(vicin, getDAC, setDAC, defs::VICIN, DAC_COMMAND(vicin, getDAC, setDAC, defs::VICIN,
"[dac or mv value][(optional unit) mv] \n\t[Mythen3] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"the bias current for the comparator."); "the bias current for the comparator.");
DAC_COMMAND(vipre_out, getDAC, setDAC, defs::VIPRE_OUT, DAC_COMMAND(vipre_out, getDAC, setDAC, defs::VIPRE_OUT,
"[dac or mv value][(optional unit) mv] \n\t[Mythen3] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
"preamplifier's output transistor current."); // TODO "preamplifier's output transistor current."); // TODO
DAC_COMMAND(vref_h_adc, getDAC, setDAC, defs::VREF_H_ADC, DAC_COMMAND(vref_h_adc, getDAC, setDAC, defs::VREF_H_ADC,
"[dac or mv value][(optional unit) mv] \n\t[Gotthard2] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference voltage high of ADC."); "reference voltage high of ADC.");
DAC_COMMAND(vb_comp_fe, getDAC, setDAC, defs::VB_COMP_FE, DAC_COMMAND(vb_comp_fe, getDAC, setDAC, defs::VB_COMP_FE,
"[dac or mv value][(optional unit) mv] \n\t[Gotthard2] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"comparator current of analogue front end."); "comparator current of analogue front end.");
DAC_COMMAND(vb_comp_adc, getDAC, setDAC, defs::VB_COMP_ADC, DAC_COMMAND(vb_comp_adc, getDAC, setDAC, defs::VB_COMP_ADC,
"[dac or mv value][(optional unit) mv] \n\t[Gotthard2] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"comparator current of ADC."); "comparator current of ADC.");
DAC_COMMAND(vcom_cds, getDAC, setDAC, defs::VCOM_CDS, DAC_COMMAND(vcom_cds, getDAC, setDAC, defs::VCOM_CDS,
"[dac or mv value][(optional unit) mv] \n\t[Gotthard2] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"common mode voltage of CDS stage."); "common mode voltage of CDS stage.");
DAC_COMMAND( DAC_COMMAND(
vref_rstore, getDAC, setDAC, defs::VREF_RSTORE, vref_rstore, getDAC, setDAC, defs::VREF_RSTORE,
"[dac or mv value][(optional unit) mv] \n\t[Gotthard2] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference charging voltage of temparory storage cell in high gain."); "reference charging voltage of temparory storage cell in high gain.");
DAC_COMMAND(vb_opa_1st, getDAC, setDAC, defs::VB_OPA_1ST, DAC_COMMAND(vb_opa_1st, getDAC, setDAC, defs::VB_OPA_1ST,
"[dac or mv value][(optional unit) mv] \n\t[Gotthard2] dac dac " "[dac or mV value][(optional unit) mV] \n\t[Gotthard2] dac dac "
"for opa current for driving the other DACs in chip."); "for opa current for driving the other DACs in chip.");
DAC_COMMAND(vref_comp_fe, getDAC, setDAC, defs::VREF_COMP_FE, DAC_COMMAND(vref_comp_fe, getDAC, setDAC, defs::VREF_COMP_FE,
"[dac or mv value][(optional unit) mv] \n\t[Gotthard2] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference voltage of the comparator of analogue front end."); "reference voltage of the comparator of analogue front end.");
DAC_COMMAND(vcom_adc1, getDAC, setDAC, defs::VCOM_ADC1, DAC_COMMAND(vcom_adc1, getDAC, setDAC, defs::VCOM_ADC1,
"[dac or mv value][(optional unit) mv] \n\t[Gotthard2] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"common mode voltage of ADC DAC bank 1."); "common mode voltage of ADC DAC bank 1.");
DAC_COMMAND( DAC_COMMAND(
vref_prech, getDAC, setDAC, defs::VREF_PRECH, vref_prech, getDAC, setDAC, defs::VREF_PRECH,
"[dac or mv value][(optional unit) mv] \n\t[Gotthard2][Jungfrau] Dac " "[dac or mV value][(optional unit) mV] \n\t[Gotthard2][Jungfrau] Dac "
"for reference votlage for precharing the preamplifier."); // TODO also "for reference votlage for precharing the preamplifier."); // TODO also
// for // for
// jungfrau? // jungfrau?
DAC_COMMAND(vref_l_adc, getDAC, setDAC, defs::VREF_L_ADC, DAC_COMMAND(vref_l_adc, getDAC, setDAC, defs::VREF_L_ADC,
"[dac or mv value][(optional unit) mv] \n\t[Gotthard2] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference voltage low for ADC."); "reference voltage low for ADC.");
DAC_COMMAND(vref_cds, getDAC, setDAC, defs::VREF_CDS, DAC_COMMAND(vref_cds, getDAC, setDAC, defs::VREF_CDS,
"[dac or mv value][(optional unit) mv] \n\t[Gotthard2] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"reference voltage of CDS applied to the temporary storage " "reference voltage of CDS applied to the temporary storage "
"cell in medium and low gain."); "cell in medium and low gain.");
DAC_COMMAND(vb_cs, getDAC, setDAC, defs::VB_CS, DAC_COMMAND(vb_cs, getDAC, setDAC, defs::VB_CS,
"[dac or mv value][(optional unit) mv] \n\t[Gotthard2] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"current injection into preamplifier."); "current injection into preamplifier.");
DAC_COMMAND(vb_opa_fd, getDAC, setDAC, defs::VB_OPA_FD, DAC_COMMAND(vb_opa_fd, getDAC, setDAC, defs::VB_OPA_FD,
"[dac or mv value][(optional unit) mv] \n\t[Gotthard2] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"current for CDS opa stage."); "current for CDS opa stage.");
DAC_COMMAND(vcom_adc2, getDAC, setDAC, defs::VCOM_ADC2, DAC_COMMAND(vcom_adc2, getDAC, setDAC, defs::VCOM_ADC2,
"[dac or mv value][(optional unit) mv] \n\t[Gotthard2] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"common mode voltage of ADC DAC bank 2."); "common mode voltage of ADC DAC bank 2.");
DAC_COMMAND( DAC_COMMAND(
adcvpp, getDAC, setDAC, defs::ADC_VPP, adcvpp, getDAC, setDAC, defs::ADC_VPP,
"[dac or mv value][(optional unit) mv] \n\t[Ctb][Moench] Vpp of " "[dac or mV value][(optional unit) mV] \n\t[Ctb][Moench] Vpp of "
"ADC.\n\t 0 -> 1V ; 1 -> 1.14V ; 2 -> 1.33V ; 3 -> 1.6V ; 4 -> 2V."); "ADC.\n\t 0 -> 1V ; 1 -> 1.14V ; 2 -> 1.33V ; 3 -> 1.6V ; 4 -> 2V.");
DAC_COMMAND(vb_ds, getDAC, setDAC, defs::VB_DS, DAC_COMMAND(vb_ds, getDAC, setDAC, defs::VB_DS,
"[dac or mv value][(optional unit) mv] \n\t[Jungfrau] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for "
"??"); // TODO "??"); // TODO
DAC_COMMAND(vb_comp, getDAC, setDAC, defs::VB_COMP, DAC_COMMAND(vb_comp, getDAC, setDAC, defs::VB_COMP,
"[dac or mv value][(optional unit) mv] \n\t[Jungfrau] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for "
"??"); // TODO "??"); // TODO
DAC_COMMAND(vb_pixbuf, getDAC, setDAC, defs::VB_PIXBUF, DAC_COMMAND(vb_pixbuf, getDAC, setDAC, defs::VB_PIXBUF,
"[dac or mv value][(optional unit) mv] \n\t[Jungfrau] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for "
"??"); // TODO "??"); // TODO
DAC_COMMAND(vin_com, getDAC, setDAC, defs::VIN_COM, DAC_COMMAND(vin_com, getDAC, setDAC, defs::VIN_COM,
"[dac or mv value][(optional unit) mv] \n\t[Jungfrau] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for "
"??"); // TODO "??"); // TODO
DAC_COMMAND(vdd_prot, getDAC, setDAC, defs::VDD_PROT, DAC_COMMAND(vdd_prot, getDAC, setDAC, defs::VDD_PROT,
"[dac or mv value][(optional unit) mv] \n\t[Jungfrau] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for "
"??"); // TODO "??"); // TODO
DAC_COMMAND(vbp_colbuf, getDAC, setDAC, defs::VBP_COLBUF, DAC_COMMAND(vbp_colbuf, getDAC, setDAC, defs::VBP_COLBUF,
"[dac or mv value][(optional unit) mv] \n\t[Moench] Dac for 0"); "[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 0");
DAC_COMMAND(vb_sda, getDAC, setDAC, defs::VB_SDA, DAC_COMMAND(vb_sda, getDAC, setDAC, defs::VB_SDA,
"[dac or mv value][(optional unit) mv] \n\t[Moench] Dac for 3"); "[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 3");
DAC_COMMAND(vcasc_sfp, getDAC, setDAC, defs::VCASC_SFP, DAC_COMMAND(vcasc_sfp, getDAC, setDAC, defs::VCASC_SFP,
"[dac or mv value][(optional unit) mv] \n\t[Moench] Dac for 4"); "[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 4");
DAC_COMMAND(vipre_cds, getDAC, setDAC, defs::VIPRE_CDS, DAC_COMMAND(vipre_cds, getDAC, setDAC, defs::VIPRE_CDS,
"[dac or mv value][(optional unit) mv] \n\t[Moench] Dac for 6"); "[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 6");
DAC_COMMAND(ibias_sfp, getDAC, setDAC, defs::IBIAS_SFP, DAC_COMMAND(ibias_sfp, getDAC, setDAC, defs::IBIAS_SFP,
"[dac or mv value][(optional unit) mv] \n\t[Moench] Dac for 7"); "[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 7");
GET_COMMAND_NOID(
daclist, getDacList,
"\n\tGets the list of commands for every dac for this detector.");
/* on chip dacs */ /* on chip dacs */
INTEGER_USER_IND_COMMAND( INTEGER_USER_IND_COMMAND(
@ -1563,11 +1615,14 @@ class CmdProxy {
"\n\tStops receiver listener for detector data packets and closes " "\n\tStops receiver listener for detector data packets and closes "
"current data file (if file write enabled)."); "current data file (if file write enabled).");
EXECUTE_SET_COMMAND_NOID(start, startDetector, EXECUTE_SET_COMMAND_NOID(
"\n\tStarts detector state machine."); start, startDetector,
"\n\tStarts detector acquisition. Status changes to RUNNING or WAITING "
"and automatically returns to idle at the end of acquisition.");
EXECUTE_SET_COMMAND_NOID(stop, stopDetector, EXECUTE_SET_COMMAND_NOID(
"\n\tStops detector state machine."); stop, stopDetector,
"\n\tAbort detector acquisition. Status changes to IDLE or STOPPED.");
GET_COMMAND(rx_framescaught, getFramesCaught, GET_COMMAND(rx_framescaught, getFramesCaught,
"\n\tNumber of frames caught by receiver."); "\n\tNumber of frames caught by receiver.");
@ -1577,8 +1632,9 @@ class CmdProxy {
INTEGER_COMMAND(startingfnum, getStartingFrameNumber, INTEGER_COMMAND(startingfnum, getStartingFrameNumber,
setStartingFrameNumber, StringTo<uint64_t>, setStartingFrameNumber, StringTo<uint64_t>,
"[n_value]\n\t[Eiger[Jungfrau] Starting frame number for " "[n_value]\n\t[Eiger][Jungfrau] Starting frame number for "
"next acquisition."); "next acquisition. Stopping acquiistion might result in "
"different frame numbers for different modules.");
EXECUTE_SET_COMMAND( EXECUTE_SET_COMMAND(
trigger, sendSoftwareTrigger, trigger, sendSoftwareTrigger,
@ -1594,11 +1650,12 @@ class CmdProxy {
numinterfaces, getNumberofUDPInterfaces, setNumberofUDPInterfaces, numinterfaces, getNumberofUDPInterfaces, setNumberofUDPInterfaces,
StringTo<int>, StringTo<int>,
"[1, 2]\n\t[Jungfrau][Gotthard2] Number of udp interfaces to stream " "[1, 2]\n\t[Jungfrau][Gotthard2] Number of udp interfaces to stream "
"data from detector. Default: 1.\n\t" "data from detector. Default: 1.\n\tAlso enables second interface in "
"[Gotthard2] 2 will select 10gbps as channel for veto data streaming " "receiver for listening (Writes a file per interface if writing "
"in detector and also enable second interface in receiver to listen to " "enabled).\n\tAlso restarts client and receiver zmq sockets if zmq "
"it. This is mainly for debugging purposes. By default, numinterfaces " "streaming enabled.\n\t[Gotthard2] second interface enabled to send "
"is 1 and if veto enabled, it is sent via 2.5 gbps interface"); "veto information via 10Gbps for debugging. By default, if veto "
"enabled, it is sent via 2.5 gbps interface.");
INTEGER_COMMAND( INTEGER_COMMAND(
selinterface, getSelectedUDPInterface, selectUDPInterface, selinterface, getSelectedUDPInterface, selectUDPInterface,
@ -1644,7 +1701,7 @@ class CmdProxy {
StringTo<int>, StringTo<int>,
"[n]\n\tDefault is 50002.\n\t[Jungfrau] Port number of the receiver " "[n]\n\tDefault is 50002.\n\t[Jungfrau] Port number of the receiver "
"(destination) udp interface where the second half of detector data is " "(destination) udp interface where the second half of detector data is "
"sent to. \n[Eiger] Port number of the reciever (desintation) udp " "sent to. \n\t[Eiger] Port number of the reciever (desintation) udp "
"interface where the right half of the detector data is sent to."); "interface where the right half of the detector data is sent to.");
EXECUTE_SET_COMMAND( EXECUTE_SET_COMMAND(
@ -1672,10 +1729,13 @@ class CmdProxy {
INTEGER_COMMAND( INTEGER_COMMAND(
txndelay_frame, getTransmissionDelayFrame, setTransmissionDelayFrame, txndelay_frame, getTransmissionDelayFrame, setTransmissionDelayFrame,
StringTo<int>, StringTo<int>,
"[n_delay]\n\t[Eiger][Jungfrau] Transmission delay of each image being " "[n_delay]\n\t[Eiger][Jungfrau][Mythen3] Transmission delay of each "
"image being "
"streamed out of the module.\n\t[Jungfrau] [0-31] Each value " "streamed out of the module.\n\t[Jungfrau] [0-31] Each value "
"represents 1 ms\n\t[Eiger] Additional delay to txndelay_left and " "represents 1 ms\n\t[Eiger] Additional delay to txndelay_left and "
"txndelay_right. Each value represents 10ns. Typical value is 50000."); "txndelay_right. Each value represents 10ns. Typical value is "
"50000.\n\t[Mythen3] [0-16777215] Each value represents 8 ns (125 MHz "
"clock), max is 134 ms.");
INTEGER_COMMAND( INTEGER_COMMAND(
txndelay_left, getTransmissionDelayLeft, setTransmissionDelayLeft, txndelay_left, getTransmissionDelayLeft, setTransmissionDelayLeft,
@ -1702,7 +1762,7 @@ class CmdProxy {
INTEGER_COMMAND(rx_fifodepth, getRxFifoDepth, setRxFifoDepth, StringTo<int>, INTEGER_COMMAND(rx_fifodepth, getRxFifoDepth, setRxFifoDepth, StringTo<int>,
"[n_frames]\n\tSet the number of frames in the receiver " "[n_frames]\n\tSet the number of frames in the receiver "
"fifo (buffer between listener and writer threads)."); "fifo depth (buffer between listener and writer threads).");
INTEGER_COMMAND( INTEGER_COMMAND(
rx_silent, getRxSilentMode, setRxSilentMode, StringTo<int>, rx_silent, getRxSilentMode, setRxSilentMode, StringTo<int>,
@ -1719,21 +1779,21 @@ class CmdProxy {
INTEGER_COMMAND(rx_padding, getPartialFramesPadding, INTEGER_COMMAND(rx_padding, getPartialFramesPadding,
setPartialFramesPadding, StringTo<int>, setPartialFramesPadding, StringTo<int>,
"[0, 1]\n\tPartial frames padding enable in the " "[0, 1]\n\tPartial frames padding enable in the "
"receiver. 0 does not pad partial frames(fastest), 1 " "receiver. Default: enabled. Disabling is fastest.");
"(default) pads partial frames");
INTEGER_COMMAND( INTEGER_COMMAND(
rx_udpsocksize, getRxUDPSocketBufferSize, setRxUDPSocketBufferSize, rx_udpsocksize, getRxUDPSocketBufferSize, setRxUDPSocketBufferSize,
StringTo<int64_t>, StringTo<int64_t>,
"[n_size]\n\tUDP socket buffer size in receiver. Tune rmem_default and " "[n_size]\n\tUDP socket buffer size in receiver. Tune rmem_default and "
"rmem_max accordingly. rx_hostname sets it to defaults."); "rmem_max accordingly.");
GET_COMMAND(rx_realudpsocksize, getRxRealUDPSocketBufferSize, GET_COMMAND(rx_realudpsocksize, getRxRealUDPSocketBufferSize,
"\n\tActual udp socket buffer size. Double the size of " "\n\tActual udp socket buffer size. Double the size of "
"rx_udpsocksize due to kernel bookkeeping."); "rx_udpsocksize due to kernel bookkeeping.");
INTEGER_COMMAND(rx_lock, getRxLock, setRxLock, StringTo<int>, INTEGER_COMMAND(rx_lock, getRxLock, setRxLock, StringTo<int>,
"[0, 1]\n\tLock receiver to one IP, 1: locks"); "[0, 1]\n\tLock receiver to one client IP, 1 locks, 0 "
"unlocks. Default is unlocked. 1: locks");
GET_COMMAND( GET_COMMAND(
rx_lastclient, getRxLastClientIP, rx_lastclient, getRxLastClientIP,
@ -1757,15 +1817,17 @@ class CmdProxy {
STRING_COMMAND( STRING_COMMAND(
fpath, getFilePath, setFilePath, fpath, getFilePath, setFilePath,
"[path]\n\tDirectory where output data files are written in receiver."); "[path]\n\tDirectory where output data files are written in receiver. "
"If path does not exist, it will try to create it.");
STRING_COMMAND(fname, getFileNamePrefix, setFileNamePrefix, STRING_COMMAND(fname, getFileNamePrefix, setFileNamePrefix,
"[path]\n\tFile name prefix for output data file. Default " "[name]\n\tFile name prefix for output data file. Default "
"is run. File name: [file name prefix]_d[detector " "is run. File name: [file name prefix]_d[detector "
"index]_f[sub file index]_[acquisition/file index].raw."); "index]_f[sub file index]_[acquisition/file index].raw.");
INTEGER_COMMAND(findex, getAcquisitionIndex, setAcquisitionIndex, INTEGER_COMMAND(findex, getAcquisitionIndex, setAcquisitionIndex,
StringTo<int64_t>, "[0, 1]\n\tFile or Acquisition index."); StringTo<int64_t>,
"[n_value]\n\tFile or Acquisition index.");
INTEGER_COMMAND( INTEGER_COMMAND(
fwrite, getFileWrite, setFileWrite, StringTo<int>, fwrite, getFileWrite, setFileWrite, StringTo<int>,
@ -1788,17 +1850,20 @@ class CmdProxy {
INTEGER_COMMAND( INTEGER_COMMAND(
rx_datastream, getRxZmqDataStream, setRxZmqDataStream, StringTo<int>, rx_datastream, getRxZmqDataStream, setRxZmqDataStream, StringTo<int>,
"[0, 1]\n\tData streaming from receiver enable (eg. to GUI ot another " "[0, 1]\n\tEnable/ disable data streaming from receiver via zmq (eg. "
"process for further processing). 1 enables zmq data stream (creates " "to GUI or to another process for further processing). This creates/ "
"zmq streamer threads), 0 disables (destroys streamer threads). " "destroys zmq streamer threads in receiver. \n\tSwitching to Gui "
"Switching to Gui automatically enables data streaming in receiver. " "automatically enables data streaming in receiver. \n\tSwitching back "
"Switching back to command line acquire will require disabling data " "to command line acquire will require disabling data streaming in "
"streaming in receiver for fast applications."); "receiver for fast applications. ");
INTEGER_COMMAND( INTEGER_COMMAND(
rx_readfreq, getRxZmqFrequency, setRxZmqFrequency, StringTo<int>, rx_readfreq, getRxZmqFrequency, setRxZmqFrequency, StringTo<int>,
"[nth frame]\n\tStream out every nth frame. Default is 1. 0 means " "[nth frame]\n\tFrequency of frames streamed out from receiver via "
"streaming every 200 ms and discarding frames in this interval."); "zmq\n\tDefault: 1, Means every frame is streamed out. \n\tIf 2, every "
"second frame is streamed out. \n\tIf 0, streaming timer is the "
"timeout, after which current frame is sent out. (default timeout is "
"200 ms). Usually used for gui purposes.");
INTEGER_COMMAND(rx_zmqstartfnum, getRxZmqStartingFrame, INTEGER_COMMAND(rx_zmqstartfnum, getRxZmqStartingFrame,
setRxZmqStartingFrame, StringTo<int>, setRxZmqStartingFrame, StringTo<int>,
@ -1829,7 +1894,7 @@ class CmdProxy {
"[x.x.x.x]\n\tZmq Ip Address from which data is to be streamed out of " "[x.x.x.x]\n\tZmq Ip Address from which data is to be streamed out of "
"the receiver. Also restarts receiver zmq streaming if enabled. " "the receiver. Also restarts receiver zmq streaming if enabled. "
"Default is from rx_hostname. Modified only when using an intermediate " "Default is from rx_hostname. Modified only when using an intermediate "
"process between receiver and client(gui)."); "process between receiver.");
INTEGER_COMMAND( INTEGER_COMMAND(
zmqip, getClientZmqIp, setClientZmqIp, IpAddr, zmqip, getClientZmqIp, setClientZmqIp, IpAddr,
@ -1843,22 +1908,20 @@ class CmdProxy {
TIME_COMMAND(subexptime, getSubExptime, setSubExptime, TIME_COMMAND(subexptime, getSubExptime, setSubExptime,
"[duration] [(optional unit) ns|us|ms|s]\n\t[Eiger] Exposure " "[duration] [(optional unit) ns|us|ms|s]\n\t[Eiger] Exposure "
"time of EIGER subframes"); "time of EIGER subframes in 32 bit mode.");
TIME_COMMAND(subdeadtime, getSubDeadTime, setSubDeadTime, TIME_COMMAND(subdeadtime, getSubDeadTime, setSubDeadTime,
"[duration] [(optional unit) ns|us|ms|s]\n\t[Eiger] Dead time " "[duration] [(optional unit) ns|us|ms|s]\n\t[Eiger] Dead time "
"of EIGER subframes. Subperiod = subexptime + subdeadtime."); "of EIGER subframes in 32 bit mode. Subperiod = subexptime + "
"subdeadtime.");
STRING_COMMAND( STRING_COMMAND(
settingspath, getSettingsPath, setSettingsPath, settingspath, getSettingsPath, setSettingsPath,
"[path]\n\t[Eiger] Directory where settings files are loaded from/to."); "[path]\n\t[Eiger] Directory where settings files are loaded from/to.");
INTEGER_COMMAND(parallel, getParallelMode, setParallelMode, StringTo<int>,
"[0, 1]\n\t[Eiger] Enable or disable parallel mode.");
INTEGER_COMMAND(overflow, getOverFlowMode, setOverFlowMode, StringTo<int>, INTEGER_COMMAND(overflow, getOverFlowMode, setOverFlowMode, StringTo<int>,
"[0, 1]\n\t[Eiger] Enable or disable show overflow flag in " "[0, 1]\n\t[Eiger] Enable or disable show overflow flag in "
"32 bit mode."); "32 bit mode. Default is disabled.");
INTEGER_COMMAND( INTEGER_COMMAND(
flippeddatax, getBottom, setBottom, StringTo<int>, flippeddatax, getBottom, setBottom, StringTo<int>,
@ -1880,8 +1943,8 @@ class CmdProxy {
TIME_GET_COMMAND(measuredperiod, getMeasuredPeriod, TIME_GET_COMMAND(measuredperiod, getMeasuredPeriod,
"[(optional unit) ns|us|ms|s]\n\t[Eiger] Measured frame " "[(optional unit) ns|us|ms|s]\n\t[Eiger] Measured frame "
"period between last frame and previous one. Useful data " "period between last frame and previous one. Can be "
"only for acquisitions with more than 1 frame."); "measured with minimum 2 frames in an acquisition.");
TIME_GET_COMMAND(measuredsubperiod, getMeasuredSubFramePeriod, TIME_GET_COMMAND(measuredsubperiod, getMeasuredSubFramePeriod,
"[(optional unit) ns|us|ms|s]\n\t[Eiger] Measured sub " "[(optional unit) ns|us|ms|s]\n\t[Eiger] Measured sub "
@ -1890,7 +1953,8 @@ class CmdProxy {
INTEGER_COMMAND( INTEGER_COMMAND(
partialreset, getPartialReset, setPartialReset, StringTo<int>, partialreset, getPartialReset, setPartialReset, StringTo<int>,
"[0, 1]\n\t[Eiger] Sets up detector to do partial or complete reset at " "[0, 1]\n\t[Eiger] Sets up detector to do partial or complete reset at "
"start of acquisition. 0 complete reset, 1 partial reset."); "start of acquisition. 0 complete reset, 1 partial reset. Default is "
"complete reset. Advanced function!");
/* Jungfrau Specific */ /* Jungfrau Specific */
@ -1916,11 +1980,12 @@ class CmdProxy {
INTEGER_COMMAND( INTEGER_COMMAND(
auto_comp_disable, getAutoCompDisable, setAutoCompDisable, auto_comp_disable, getAutoCompDisable, setAutoCompDisable,
StringTo<int>, StringTo<int>,
"[0, 1]\n\t[Jungfrau] Auto comparator disable mode. Default 0 or this " "[0, 1]\n\t[Jungfrau] Auto comparator disable mode. By default, the "
"mode disabled(comparator enabled throughout). 1 enables mode. 0 " "on-chip gain switching is active during the entire exposure.This mode "
"disables mode. This mode disables the on-chip gain switching " "disables the on - chip gain switching comparator automatically after "
"comparator automatically after 93.75% of exposure time (only for " "93.75% of exposure time (only for longer than 100us). \n\tDefault is "
"longer than 100us)."); "0 or this mode disabled(comparator enabled throughout). 1 enables "
"mode. 0 disables mode. ");
INTEGER_COMMAND_NOID( INTEGER_COMMAND_NOID(
storagecells, getNumberOfAdditionalStorageCells, storagecells, getNumberOfAdditionalStorageCells,
@ -1939,7 +2004,7 @@ class CmdProxy {
storagecell_delay, getStorageCellDelay, setStorageCellDelay, storagecell_delay, getStorageCellDelay, setStorageCellDelay,
"[duration (0-1638375 ns)] [(optional unit) ns|us|ms|s]\n\t[Jungfrau] " "[duration (0-1638375 ns)] [(optional unit) ns|us|ms|s]\n\t[Jungfrau] "
"Additional time delay between 2 consecutive exposures in burst mode " "Additional time delay between 2 consecutive exposures in burst mode "
"(total time gap = (ET + 1 + 86) * 25ns). For advanced users only."); "(resolution of 25ns). For advanced users only.");
/* Gotthard Specific */ /* Gotthard Specific */
TIME_GET_COMMAND(exptimel, getExptimeLeft, TIME_GET_COMMAND(exptimel, getExptimeLeft,
@ -1991,7 +2056,7 @@ class CmdProxy {
INTEGER_COMMAND( INTEGER_COMMAND(
asamples, getNumberOfAnalogSamples, setNumberOfAnalogSamples, asamples, getNumberOfAnalogSamples, setNumberOfAnalogSamples,
StringTo<int>, StringTo<int>,
"[0, 1]\n\t[CTB][Moench] Number of analog samples expected."); "[n_samples]\n\t[CTB][Moench] Number of analog samples expected.");
INTEGER_COMMAND( INTEGER_COMMAND(
adcclk, getADCClock, setADCClock, StringTo<int>, adcclk, getADCClock, setADCClock, StringTo<int>,
@ -2027,7 +2092,7 @@ class CmdProxy {
INTEGER_COMMAND(dsamples, getNumberOfDigitalSamples, INTEGER_COMMAND(dsamples, getNumberOfDigitalSamples,
setNumberOfDigitalSamples, StringTo<int>, setNumberOfDigitalSamples, StringTo<int>,
"[0, 1]\n\t[CTB] Number of digital samples expected."); "[n_value]\n\t[CTB] Number of digital samples expected.");
INTEGER_COMMAND(romode, getReadoutMode, setReadoutMode, INTEGER_COMMAND(romode, getReadoutMode, setReadoutMode,
sls::StringTo<slsDetectorDefs::readoutMode>, sls::StringTo<slsDetectorDefs::readoutMode>,
@ -2109,9 +2174,10 @@ class CmdProxy {
"[0-63]\n\t[Ctb] Sampling source signal for digital data. " "[0-63]\n\t[Ctb] Sampling source signal for digital data. "
"For advanced users only."); "For advanced users only.");
INTEGER_COMMAND( INTEGER_COMMAND(rx_dbitoffset, getRxDbitOffset, setRxDbitOffset,
rx_dbitoffset, getRxDbitOffset, setRxDbitOffset, StringTo<int>, StringTo<int>,
"[n_bytes]\n\t[Ctb] Offset in bytes in digital data in receiver."); "[n_bytes]\n\t[Ctb] Offset in bytes in digital data to "
"skip in receiver.");
INTEGER_COMMAND(led, getLEDEnable, setLEDEnable, StringTo<int>, INTEGER_COMMAND(led, getLEDEnable, setLEDEnable, StringTo<int>,
"[0, 1]\n\t[Ctb] Switches on/off all LEDs."); "[0, 1]\n\t[Ctb] Switches on/off all LEDs.");
@ -2130,13 +2196,14 @@ class CmdProxy {
INTEGER_COMMAND_HEX_WIDTH16( INTEGER_COMMAND_HEX_WIDTH16(
patmask, getPatternMask, setPatternMask, StringTo<uint64_t>, patmask, getPatternMask, setPatternMask, StringTo<uint64_t>,
"[64 bit mask]\n\t[Ctb][Moench][Mythen3] 64 bit mask applied to every " "[64 bit mask]\n\t[Ctb][Moench][Mythen3] Sets the mask applied to "
"pattern. Only these bits for each pattern will be masked against."); "every pattern to the selected bits.");
INTEGER_COMMAND_HEX_WIDTH16( INTEGER_COMMAND_HEX_WIDTH16(
patsetbit, getPatternBitMask, setPatternBitMask, StringTo<uint64_t>, patsetbit, getPatternBitMask, setPatternBitMask, StringTo<uint64_t>,
"[64 bit mask]\n\t[Ctb][Moench][Mythen3] 64 bit values " "[64 bit mask]\n\t[Ctb][Moench][Mythen3] Selects the bits that will "
"applied to the selected patmask for every pattern."); "have a pattern mask applied to the selected patmask for every "
"pattern.");
EXECUTE_SET_COMMAND(patternstart, startPattern, EXECUTE_SET_COMMAND(patternstart, startPattern,
"\n\t[Mythen3] Starts Pattern"); "\n\t[Mythen3] Starts Pattern");
@ -2213,8 +2280,9 @@ class CmdProxy {
"CTB] Timestamp at a frame start." "CTB] Timestamp at a frame start."
"\n\t[Gotthard2] only in continuous mode."); "\n\t[Gotthard2] only in continuous mode.");
GET_COMMAND(rx_frameindex, getRxCurrentFrameIndex, GET_COMMAND(
"\n\tCurrent frame index received in receiver."); rx_frameindex, getRxCurrentFrameIndex,
"\n\tCurrent frame index received in receiver during acquisition.");
}; };
} // namespace sls } // namespace sls

View File

@ -60,30 +60,32 @@ void Detector::loadConfig(const std::string &fname) {
} }
void Detector::loadParameters(const std::string &fname) { void Detector::loadParameters(const std::string &fname) {
CmdProxy proxy(this); std::ifstream input_file(fname);
CmdParser parser; if (!input_file) {
std::ifstream input_file;
input_file.open(fname.c_str(), std::ios_base::in);
if (!input_file.is_open()) {
throw RuntimeError("Could not open configuration file " + fname + throw RuntimeError("Could not open configuration file " + fname +
" for reading"); " for reading");
} }
std::string current_line; std::vector<std::string> parameters;
while (input_file.good()) { for (std::string line; std::getline(input_file, line);) {
getline(input_file, current_line); if (line.find('#') != std::string::npos) {
if (current_line.find('#') != std::string::npos) { line.erase(line.find('#'));
current_line.erase(current_line.find('#'));
} }
LOG(logDEBUG1) << "current_line after removing comments:\n\t" if (line.length() > 1) {
<< current_line; parameters.push_back(line);
if (current_line.length() > 1) { }
}
loadParameters(parameters);
}
void Detector::loadParameters(const std::vector<std::string> &parameters) {
CmdProxy proxy(this);
CmdParser parser;
for (const auto &current_line : parameters) {
parser.Parse(current_line); parser.Parse(current_line);
proxy.Call(parser.command(), parser.arguments(), proxy.Call(parser.command(), parser.arguments(), parser.detector_id(),
parser.detector_id(), defs::PUT_ACTION); defs::PUT_ACTION);
} }
} }
input_file.close();
}
Result<std::string> Detector::getHostname(Positions pos) const { Result<std::string> Detector::getHostname(Positions pos) const {
return pimpl->Parallel(&Module::getHostname, pos); return pimpl->Parallel(&Module::getHostname, pos);
@ -241,6 +243,7 @@ Result<ns> Detector::getExptime(Positions pos) const {
void Detector::setExptime(ns t, Positions pos) { void Detector::setExptime(ns t, Positions pos) {
pimpl->Parallel(&Module::setExptime, pos, -1, t.count()); pimpl->Parallel(&Module::setExptime, pos, -1, t.count());
updateRxRateCorrections();
} }
Result<ns> Detector::getPeriod(Positions pos) const { Result<ns> Detector::getPeriod(Positions pos) const {
@ -284,6 +287,17 @@ void Detector::setDynamicRange(int value) {
updateRxRateCorrections(); updateRxRateCorrections();
} }
std::vector<int> Detector::getDynamicRangeList() const {
switch (getDetectorType().squash()) {
case defs::EIGER:
return std::vector<int>{4, 8, 16, 32};
case defs::MYTHEN3:
return std::vector<int>{8, 16, 32};
default:
return std::vector<int>{16};
}
}
Result<defs::timingMode> Detector::getTimingMode(Positions pos) const { Result<defs::timingMode> Detector::getTimingMode(Positions pos) const {
return pimpl->Parallel(&Module::getTimingMode, pos); return pimpl->Parallel(&Module::getTimingMode, pos);
} }
@ -292,6 +306,22 @@ void Detector::setTimingMode(defs::timingMode value, Positions pos) {
pimpl->Parallel(&Module::setTimingMode, pos, value); pimpl->Parallel(&Module::setTimingMode, pos, value);
} }
std::vector<defs::timingMode> Detector::getTimingModeList() const {
switch (getDetectorType().squash()) {
case defs::EIGER:
return std::vector<defs::timingMode>{defs::AUTO_TIMING,
defs::TRIGGER_EXPOSURE,
defs::GATED, defs::BURST_TRIGGER};
case defs::MYTHEN3:
return std::vector<defs::timingMode>{defs::AUTO_TIMING,
defs::TRIGGER_EXPOSURE,
defs::GATED, defs::TRIGGER_GATED};
default:
return std::vector<defs::timingMode>{defs::AUTO_TIMING,
defs::TRIGGER_EXPOSURE};
}
}
Result<defs::speedLevel> Detector::getSpeed(Positions pos) const { Result<defs::speedLevel> Detector::getSpeed(Positions pos) const {
auto res = pimpl->Parallel(&Module::getClockDivider, pos, defs::RUN_CLOCK); auto res = pimpl->Parallel(&Module::getClockDivider, pos, defs::RUN_CLOCK);
Result<defs::speedLevel> speedResult(res.size()); Result<defs::speedLevel> speedResult(res.size());
@ -417,6 +447,26 @@ void Detector::setImageTestMode(int value, Positions pos) {
pimpl->Parallel(&Module::setImageTestMode, pos, value); pimpl->Parallel(&Module::setImageTestMode, pos, value);
} }
std::vector<defs::dacIndex> Detector::getTemperatureList() const {
std::vector<defs::dacIndex> retval;
switch (getDetectorType().squash()) {
case defs::CHIPTESTBOARD:
return std::vector<defs::dacIndex>{defs::SLOW_ADC_TEMP};
case defs::JUNGFRAU:
case defs::GOTTHARD:
return std::vector<defs::dacIndex>{defs::TEMPERATURE_ADC,
defs::TEMPERATURE_FPGA};
case defs::EIGER:
return std::vector<defs::dacIndex>{
defs::TEMPERATURE_FPGA, defs::TEMPERATURE_FPGAEXT,
defs::TEMPERATURE_10GE, defs::TEMPERATURE_DCDC,
defs::TEMPERATURE_SODL, defs::TEMPERATURE_SODR,
defs::TEMPERATURE_FPGA2, defs::TEMPERATURE_FPGA3};
default:
return std::vector<defs::dacIndex>{};
}
}
Result<int> Detector::getTemperature(defs::dacIndex index, Result<int> Detector::getTemperature(defs::dacIndex index,
Positions pos) const { Positions pos) const {
switch (index) { switch (index) {
@ -525,6 +575,14 @@ void Detector::setExternalSignalFlags(int signalIndex,
pimpl->Parallel(&Module::setExternalSignalFlags, pos, signalIndex, value); pimpl->Parallel(&Module::setExternalSignalFlags, pos, signalIndex, value);
} }
Result<bool> Detector::getParallelMode(Positions pos) const {
return pimpl->Parallel(&Module::getParallelMode, pos);
}
void Detector::setParallelMode(bool value, Positions pos) {
pimpl->Parallel(&Module::setParallelMode, pos, value);
}
// Acquisition // Acquisition
void Detector::acquire() { pimpl->acquire(); } void Detector::acquire() { pimpl->acquire(); }
@ -1079,14 +1137,6 @@ void Detector::setSettingsPath(const std::string &value, Positions pos) {
pimpl->Parallel(&Module::setSettingsDir, pos, value); pimpl->Parallel(&Module::setSettingsDir, pos, value);
} }
Result<bool> Detector::getParallelMode(Positions pos) const {
return pimpl->Parallel(&Module::getParallelMode, pos);
}
void Detector::setParallelMode(bool value, Positions pos) {
pimpl->Parallel(&Module::setParallelMode, pos, value);
}
Result<bool> Detector::getOverFlowMode(Positions pos) const { Result<bool> Detector::getOverFlowMode(Positions pos) const {
return pimpl->Parallel(&Module::getOverFlowMode, pos); return pimpl->Parallel(&Module::getOverFlowMode, pos);
} }
@ -1432,7 +1482,6 @@ Result<ns> Detector::getExptime(int gateIndex, Positions pos) const {
void Detector::setExptime(int gateIndex, ns t, Positions pos) { void Detector::setExptime(int gateIndex, ns t, Positions pos) {
pimpl->Parallel(&Module::setExptime, pos, gateIndex, t.count()); pimpl->Parallel(&Module::setExptime, pos, gateIndex, t.count());
updateRxRateCorrections();
} }
Result<std::array<ns, 3>> Detector::getExptimeForAllGates(Positions pos) const { Result<std::array<ns, 3>> Detector::getExptimeForAllGates(Positions pos) const {
@ -1558,6 +1607,8 @@ Result<defs::readoutMode> Detector::getReadoutMode(Positions pos) const {
return pimpl->Parallel(&Module::getReadoutMode, pos); return pimpl->Parallel(&Module::getReadoutMode, pos);
} }
/** Options: ANALOG_ONLY, DIGITAL_ONLY, ANALOG_AND_DIGITAL \n
* Default: ANALOG_ONLY */
void Detector::setReadoutMode(defs::readoutMode value, Positions pos) { void Detector::setReadoutMode(defs::readoutMode value, Positions pos) {
pimpl->Parallel(&Module::setReadoutMode, pos, value); pimpl->Parallel(&Module::setReadoutMode, pos, value);
} }

View File

@ -288,17 +288,31 @@ void DetectorImpl::updateDetectorSize() {
LOG(logDEBUG) << "Updating Multi-Detector Size: " << size(); LOG(logDEBUG) << "Updating Multi-Detector Size: " << size();
const slsDetectorDefs::xy det_size = detectors[0]->getNumberOfChannels(); const slsDetectorDefs::xy det_size = detectors[0]->getNumberOfChannels();
int maxx = multi_shm()->numberOfChannels.x;
int maxy = multi_shm()->numberOfChannels.y; int maxy = multi_shm()->numberOfChannels.y;
int ndetx = 0, ndety = 0;
// 1d, add detectors along x axis
if (det_size.y == 1) {
if (maxx == 0) {
maxx = det_size.x * size();
}
ndetx = maxx / det_size.x;
ndety = size() / ndetx;
if ((maxx % det_size.x) > 0) {
++ndety;
}
}
// 2d, add detectors along y axis (due to eiger top/bottom)
else {
if (maxy == 0) { if (maxy == 0) {
maxy = det_size.y * size(); maxy = det_size.y * size();
} }
ndety = maxy / det_size.y;
int ndety = maxy / det_size.y; ndetx = size() / ndety;
int ndetx = size() / ndety;
if ((maxy % det_size.y) > 0) { if ((maxy % det_size.y) > 0) {
++ndetx; ++ndetx;
} }
}
multi_shm()->numberOfDetector.x = ndetx; multi_shm()->numberOfDetector.x = ndetx;
multi_shm()->numberOfDetector.y = ndety; multi_shm()->numberOfDetector.y = ndety;
@ -464,7 +478,7 @@ void DetectorImpl::readFrameFromReceiver() {
std::string currentFileName; std::string currentFileName;
uint64_t currentAcquisitionIndex = -1, currentFrameIndex = -1, uint64_t currentAcquisitionIndex = -1, currentFrameIndex = -1,
currentFileIndex = -1; currentFileIndex = -1;
int currentProgress = -1; double currentProgress = 0.00;
uint32_t currentSubFrameIndex = -1, coordX = -1, coordY = -1, uint32_t currentSubFrameIndex = -1, coordX = -1, coordY = -1,
flippedDataX = -1; flippedDataX = -1;
@ -1074,8 +1088,8 @@ int DetectorImpl::acquire() {
if (acquisition_finished != nullptr) { if (acquisition_finished != nullptr) {
int status = Parallel(&Module::getRunStatus, {}).squash(ERROR); int status = Parallel(&Module::getRunStatus, {}).squash(ERROR);
auto a = Parallel(&Module::getReceiverProgress, {}); auto a = Parallel(&Module::getReceiverProgress, {});
int progress = (*std::min_element(a.begin(), a.end())); double progress = (*std::min_element(a.begin(), a.end()));
acquisition_finished((double)progress, status, acqFinished_p); acquisition_finished(progress, status, acqFinished_p);
} }
sem_destroy(&sem_newRTAcquisition); sem_destroy(&sem_newRTAcquisition);
@ -1095,8 +1109,9 @@ int DetectorImpl::acquire() {
} }
void DetectorImpl::printProgress(double progress) { void DetectorImpl::printProgress(double progress) {
std::cout << std::fixed << std::setprecision(2) << std::setw(6) << progress // spaces for python printout
<< " \%"; std::cout << " " << std::fixed << std::setprecision(2) << std::setw(6)
<< progress << " \%";
std::cout << '\r' << std::flush; std::cout << '\r' << std::flush;
} }

View File

@ -382,6 +382,14 @@ void Module::setExternalSignalFlags(int signalIndex, externalSignalFlag type) {
sendToDetector(F_SET_EXTERNAL_SIGNAL_FLAG, args, nullptr); sendToDetector(F_SET_EXTERNAL_SIGNAL_FLAG, args, nullptr);
} }
bool Module::getParallelMode() const {
return sendToDetector<int>(F_GET_PARALLEL_MODE);
}
void Module::setParallelMode(const bool enable) {
sendToDetector(F_SET_PARALLEL_MODE, static_cast<int>(enable), nullptr);
}
// Acquisition // Acquisition
void Module::startReceiver() { void Module::startReceiver() {
@ -429,8 +437,8 @@ slsDetectorDefs::runStatus Module::getReceiverStatus() const {
return sendToReceiver<runStatus>(F_GET_RECEIVER_STATUS); return sendToReceiver<runStatus>(F_GET_RECEIVER_STATUS);
} }
int Module::getReceiverProgress() const { double Module::getReceiverProgress() const {
return sendToReceiver<int>(F_GET_RECEIVER_PROGRESS); return sendToReceiver<double>(F_GET_RECEIVER_PROGRESS);
} }
int64_t Module::getFramesCaughtByReceiver() const { int64_t Module::getFramesCaughtByReceiver() const {
@ -474,6 +482,9 @@ defs::scanParameters Module::getScan() const {
void Module::setScan(const defs::scanParameters t) { void Module::setScan(const defs::scanParameters t) {
auto retval = sendToDetector<int64_t>(F_SET_SCAN, t); auto retval = sendToDetector<int64_t>(F_SET_SCAN, t);
if (shm()->useReceiverFlag) {
sendToReceiver(F_SET_RECEIVER_SCAN, t, nullptr);
}
// if disabled, retval is 1, else its number of steps // if disabled, retval is 1, else its number of steps
setNumberOfFrames(retval); setNumberOfFrames(retval);
} }
@ -1083,6 +1094,9 @@ void Module::setThresholdEnergy(int e_eV, detectorSettings isettings,
// check as there is client processing // check as there is client processing
if (shm()->myDetectorType == EIGER) { if (shm()->myDetectorType == EIGER) {
setThresholdEnergyAndSettings(e_eV, isettings, trimbits); setThresholdEnergyAndSettings(e_eV, isettings, trimbits);
if (shm()->useReceiverFlag) {
sendToReceiver(F_RECEIVER_SET_THRESHOLD, e_eV, nullptr);
}
} }
// moench - send threshold energy to processor // moench - send threshold energy to processor
else if (shm()->myDetectorType == MOENCH) { else if (shm()->myDetectorType == MOENCH) {
@ -1102,14 +1116,6 @@ std::string Module::setSettingsDir(const std::string &dir) {
return shm()->settingsDir; return shm()->settingsDir;
} }
bool Module::getParallelMode() const {
return sendToDetector<int>(F_GET_PARALLEL_MODE);
}
void Module::setParallelMode(const bool enable) {
sendToDetector(F_SET_PARALLEL_MODE, static_cast<int>(enable), nullptr);
}
bool Module::getOverFlowMode() const { bool Module::getOverFlowMode() const {
return sendToDetector<int>(F_GET_OVERFLOW_MODE); return sendToDetector<int>(F_GET_OVERFLOW_MODE);
} }
@ -1863,7 +1869,7 @@ std::vector<int> Module::getReceiverDbitList() const {
F_GET_RECEIVER_DBIT_LIST); F_GET_RECEIVER_DBIT_LIST);
} }
void Module::setReceiverDbitList(const std::vector<int> &list) { void Module::setReceiverDbitList(std::vector<int> list) {
LOG(logDEBUG1) << "Setting Receiver Dbit List"; LOG(logDEBUG1) << "Setting Receiver Dbit List";
if (list.size() > 64) { if (list.size() > 64) {
throw sls::RuntimeError("Dbit list size cannot be greater than 64\n"); throw sls::RuntimeError("Dbit list size cannot be greater than 64\n");
@ -1874,6 +1880,10 @@ void Module::setReceiverDbitList(const std::vector<int> &list) {
"Dbit list value must be between 0 and 63\n"); "Dbit list value must be between 0 and 63\n");
} }
} }
std::sort(begin(list), end(list));
auto last = std::unique(begin(list), end(list));
list.erase(last, list.end());
sls::StaticVector<int, MAX_RX_DBIT> arg = list; sls::StaticVector<int, MAX_RX_DBIT> arg = list;
sendToReceiver(F_SET_RECEIVER_DBIT_LIST, arg, nullptr); sendToReceiver(F_SET_RECEIVER_DBIT_LIST, arg, nullptr);
} }

View File

@ -149,6 +149,8 @@ class Module : public virtual slsDetectorDefs {
int value); int value);
externalSignalFlag getExternalSignalFlags(int signalIndex) const; externalSignalFlag getExternalSignalFlags(int signalIndex) const;
void setExternalSignalFlags(int signalIndex, externalSignalFlag type); void setExternalSignalFlags(int signalIndex, externalSignalFlag type);
bool getParallelMode() const;
void setParallelMode(const bool enable);
/************************************************** /**************************************************
* * * *
@ -162,7 +164,7 @@ class Module : public virtual slsDetectorDefs {
void startAndReadAll(); void startAndReadAll();
runStatus getRunStatus() const; runStatus getRunStatus() const;
runStatus getReceiverStatus() const; runStatus getReceiverStatus() const;
int getReceiverProgress() const; double getReceiverProgress() const;
int64_t getFramesCaughtByReceiver() const; int64_t getFramesCaughtByReceiver() const;
std::vector<uint64_t> getNumMissingPackets() const; std::vector<uint64_t> getNumMissingPackets() const;
uint64_t getStartingFrameNumber() const; uint64_t getStartingFrameNumber() const;
@ -303,8 +305,6 @@ class Module : public virtual slsDetectorDefs {
bool trimbits); bool trimbits);
std::string getSettingsDir() const; std::string getSettingsDir() const;
std::string setSettingsDir(const std::string &dir); std::string setSettingsDir(const std::string &dir);
bool getParallelMode() const;
void setParallelMode(const bool enable);
bool getOverFlowMode() const; bool getOverFlowMode() const;
void setOverFlowMode(const bool enable); void setOverFlowMode(const bool enable);
bool getFlippedDataX() const; bool getFlippedDataX() const;
@ -442,7 +442,7 @@ class Module : public virtual slsDetectorDefs {
bool getExternalSampling() const; bool getExternalSampling() const;
void setExternalSampling(bool value); void setExternalSampling(bool value);
std::vector<int> getReceiverDbitList() const; std::vector<int> getReceiverDbitList() const;
void setReceiverDbitList(const std::vector<int> &list); void setReceiverDbitList(std::vector<int> list);
int getReceiverDbitOffset() const; int getReceiverDbitOffset() const;
void setReceiverDbitOffset(int value); void setReceiverDbitOffset(int value);
void setDigitalIODelay(uint64_t pinMask, int delay); void setDigitalIODelay(uint64_t pinMask, int delay);

Some files were not shown because too many files have changed in this diff Show More