documentation and examples

This commit is contained in:
maliakal_d 2023-11-12 15:11:36 +01:00
parent 9785a41048
commit 0aef8113dd
17 changed files with 111 additions and 81 deletions

View File

@ -19,7 +19,7 @@ A minimal CMakeLists.txt could look like this:
.. code-block:: cmake .. code-block:: cmake
project(myDetectorIntegration) project(myDetectorIntegration)
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.14)
add_subdirectory(slsDetectorPackage) add_subdirectory(slsDetectorPackage)
#Add your executable #Add your executable
@ -43,7 +43,7 @@ should be needed, otherwise specify cmake prefix path.
.. code-block:: cmake .. code-block:: cmake
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.14)
project(myintegration) project(myintegration)
find_package(slsDetectorPackage 5.0 REQUIRED) find_package(slsDetectorPackage 5.0 REQUIRED)

View File

@ -13,7 +13,7 @@ To use the basic building blocks, meaning sls_detector_get/put and
the shared libraries these are needed: the shared libraries these are needed:
* Linux, preferably recent kernel (currently no cross platform support) * Linux, preferably recent kernel (currently no cross platform support)
* CMake > 3.14 * CMake >= 3.14
* C++11 compatible compiler. (We test with gcc and clang) * C++11 compatible compiler. (We test with gcc and clang)
----------------------- -----------------------

View File

@ -1,16 +1,19 @@
Detector Detector
============================================== ==============================================
The sls::Detector is the new public API to control The sls::Detector is the public API to control
detectors from C++. This API is also used internally detectors from C++. This API is also used internally
for the Python bindings and the command line interface. for the Python bindings and the command line interface.
If a receiver has been configured this is also controlled If a receiver has been configured, this is also controlled
through this class. through this class.
Most, if not all, functions are called in parallel Most, if not all, functions are called in parallel
and the return value is a thin std::vector wrapper and the return value is a thin std::vector wrapper
containing results from all modules. (Result<T>) containing results from all modules. (:ref:`Result class<Result Class>`)
Here are some :ref:`examples <Cplusplus Api Examples>` on how to use the API.
.. _Cplusplus Api Examples:
.. doxygenclass:: sls::Detector .. doxygenclass:: sls::Detector
:members: :members:
:undoc-members: :undoc-members:

View File

@ -1,3 +1,4 @@
.. _Cplusplus Api Examples:
@ -53,8 +54,8 @@ then set up the detector.
jungfrauDetectorServer_virtual jungfrauDetectorServer_virtual
This launches a virtual Jungfrau detector server. As default is uses port 1952 and 1953 This launches a virtual Jungfrau detector server. As default it uses port 1952 and 1953
for communication over TCP. Most commands go on 1952 and only stop and status on 1953. for communication over TCP. Most commands go on 1952 and only a few such as stop and status on 1953.
**Run example to configure** **Run example to configure**
@ -90,7 +91,10 @@ std::vector.
sls::Result<int> res1{1, 1, 1}; sls::Result<int> res1{1, 1, 1};
std::cout << "res1: " << res1 << '\n'; std::cout << "res1: " << res1 << '\n';
res1.squash(); res1.squash();
# return -1 if different
res1.squash(-1); res1.squash(-1);
# throw exception with custom message if different
res1.tsquash("Values are different);

View File

@ -120,7 +120,7 @@ Program from console
# removes old server from respawn, sets up new lnked server to respawn # removes old server from respawn, sets up new lnked server to respawn
# programs fpga, reboots # programs fpga, reboots
# v5.0.0 - 6.0.0 (copies server from tftp folder of the pc) # older versions: v5.0.0 - 6.0.0 using tftp from tftp folder of pc
sls_detector_put update jungfrauDetectorServervxxx pcxxx xx.pof sls_detector_put update jungfrauDetectorServervxxx pcxxx xx.pof
# v6.1.1 - present (copies server from the full path provided) # v6.1.1 - present (copies server from the full path provided)
@ -190,7 +190,7 @@ Program from console
# removes old server from respawn, sets up new lnked server to respawn # removes old server from respawn, sets up new lnked server to respawn
# programs fpga, reboots # programs fpga, reboots
# v5.0.0 - 6.0.0 (copies server from tftp folder of the pc) # older versions: v5.0.0 - 6.0.0 using tftp from tftp folder of pc
sls_detector_put update mythen3DetectorServervxxx pcxxx xxx.rbf sls_detector_put update mythen3DetectorServervxxx pcxxx xxx.rbf
# v6.1.1 - present (copies server from the full path provided) # v6.1.1 - present (copies server from the full path provided)
@ -224,7 +224,7 @@ Program from console
# removes old server from respawn, sets up new lnked server to respawn # removes old server from respawn, sets up new lnked server to respawn
# programs fpga, reboots # programs fpga, reboots
# v5.0.0 - 6.0.0 (copies server from tftp folder of the pc) # older versions: v5.0.0 - 6.0.0 using tftp from tftp folder of pc
sls_detector_put update gotthard2DetectorServervxxx pcxxx xxx.rbf sls_detector_put update gotthard2DetectorServervxxx pcxxx xxx.rbf
# v6.1.1 - present (copies server from the full path provided) # v6.1.1 - present (copies server from the full path provided)
@ -275,7 +275,7 @@ Program from console
# removes old server from respawn, sets up new lnked server to respawn # removes old server from respawn, sets up new lnked server to respawn
# programs fpga, reboots # programs fpga, reboots
# v5.0.0 - 6.0.0 (copies server from tftp folder of the pc) # older versions: v5.0.0 - 6.0.0 using tftp from tftp folder of pc
sls_detector_put update moenchDetectorServervxxx pcxxx xx.pof sls_detector_put update moenchDetectorServervxxx pcxxx xx.pof
# v6.1.1 - present (copies server from the full path provided) # v6.1.1 - present (copies server from the full path provided)
@ -310,7 +310,7 @@ Program from console
# removes old server from respawn, sets up new lnked server to respawn # removes old server from respawn, sets up new lnked server to respawn
# programs fpga, reboots # programs fpga, reboots
# v5.0.0 - 6.0.0 (copies server from tftp folder of the pc) # older versions: v5.0.0 - 6.0.0 using tftp from tftp folder of pc
sls_detector_put update ctbDetectorServervxxx pcxxx xx.pof sls_detector_put update ctbDetectorServervxxx pcxxx xx.pof
# v6.1.1 - present (copies server from the full path provided) # v6.1.1 - present (copies server from the full path provided)

View File

@ -8,8 +8,8 @@ Welcome to slsDetectorPackage's documentation!
.. note :: .. note ::
This is the documentation for the latest development version of slsDetectorPackage This is the documentation for the latest development version of slsDetectorPackage.
For documentation on current and previous releases visit the official page: https://www.psi.ch/en/detectors/documentation For further documentation, visit the official page: https://www.psi.ch/en/detectors/documentation
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1

View File

@ -113,6 +113,8 @@ Example cmake options Comment
-DSLS_USE_PYTHON=ON Python -DSLS_USE_PYTHON=ON Python
-DPython_FIND_VIRTUALENV=ONLY Python from the conda env -DPython_FIND_VIRTUALENV=ONLY Python from the conda env
-DSLS_USE_GUI=ON GUI -DSLS_USE_GUI=ON GUI
-DSLS_USE_HDF5=ON HDF5
-DSLS_USE_SIMULATOR=ON Simulator
=============================== =============================== =============================== ===============================
.. note :: .. note ::
@ -255,7 +257,7 @@ is to use conda
.. code-block:: bash .. code-block:: bash
conda create -n myenv python sphinx_rtd_theme breathe conda create -n myenv python=3.12 sphinx sphinx_rtd_theme breathe doxygen numpy
.. code-block:: bash .. code-block:: bash
@ -279,7 +281,7 @@ Pybind and Zeromq
| v8.0.0+: | v8.0.0+:
| pybind11 (v2.11.0) is built | pybind11 (v2.11.0) is built
| * by default from tar file in repo (libs/pybind/v2.11.0.tar.gz) | * by default from tar file in repo (libs/pybind/v2.11.0.tar.gz)
| * or use option SLS_FETCH_PYBIND11_FROM_GITHUB `[link] <https://github.com/pybind/pybind11>`__. | * or use advanced option SLS_FETCH_PYBIND11_FROM_GITHUB [`link <https://github.com/pybind/pybind11>`__].
| |
| v7.x.x: | v7.x.x:
| pybind11 packaged into 'libs/pybind'. No longer a submodule. No need for "recursive" or "submodule update". | pybind11 packaged into 'libs/pybind'. No longer a submodule. No need for "recursive" or "submodule update".
@ -307,11 +309,11 @@ Pybind and Zeromq
| v8.0.0+: | v8.0.0+:
| zeromq (v4.3.4) is built | zeromq (v4.3.4) is built
| * by default from tar file in repo (libs/libzmq/libzmq-4.3.4.tar.gz) | * by default from tar file in repo (libs/libzmq/libzmq-4.3.4.tar.gz)
| * or use option SLS_FETCH_ZMQ_FROM_GITHUB `[link] <https://github.com/zeromq/libzmq.git>`__. | * or use advanced option SLS_FETCH_ZMQ_FROM_GITHUB [`link <https://github.com/zeromq/libzmq.git>`__].
| |
| v7.x.x and older: | v7.x.x and older:
| zeromq must be installed and one can hint its location using | zeromq must be installed and one can hint its location using
| * cmake option:'-DZeroMQ_HINT=/usr/lib64' or | * cmake option:'-DZeroMQ_HINT=/usr/lib64' or
| * option '-q' in cmk.sh script: : ./cmk.sh -cbj5 -q /usr/lib64 | * option '-q' in cmk.sh script: : ./cmk.sh -cbj5 -q /usr/lib64
| * 'zeromq' dependencies when installing using conda | * 'zeromq' dependency added when installing using conda

View File

@ -109,12 +109,14 @@ For Multiple Modules
# connects to mulitple modules # connects to mulitple modules
hostname bchipxxx+bchipyyy+ hostname bchipxxx+bchipyyy+
# connects to receivers at ports 2012 and 2014 # tcp port increases for each module (multi detector command)
rx_hostname mpc1922:2012+mpc1922:2013+ rx_tcpport 2012
# sets differernt destination udp ports # connects to receivers at ports 2012 and 2014
0:udp_dstport 50012 rx_hostname mpc1922
1:udp_dstport 50014
# increasing udp ports (multi detector command)
udp_dstport 50012
# source udp ips must be same subnet at destintaion udp ips # source udp ips must be same subnet at destintaion udp ips
0:udp_srcip 192.168.1.112 0:udp_srcip 192.168.1.112

View File

@ -1,3 +1,5 @@
.. _Result Class:
Result Result
============================================== ==============================================

View File

@ -53,7 +53,12 @@ Client Commands
# multi modules with custom ports # multi modules with custom ports
rx_hostname xxx:1955+xxx:1956+ rx_hostname xxx:1955+xxx:1956+
# multi modules with custom ports on same rxr pc
# multi modules using increasing tcp ports when using multi detector command
rx_tcpport 1955
rx_hostname xxx
# or specify multi modules with custom ports on same rxr pc
0:rx_tcpport 1954 0:rx_tcpport 1954
1:rx_tcpport 1955 1:rx_tcpport 1955
2:rx_tcpport 1956 2:rx_tcpport 1956

View File

@ -86,7 +86,8 @@ For a Single Module (With Options)
udp_dstport 50012 udp_dstport 50012
# source udp ips must be same subnet at destintaion udp ips # source udp ips must be same subnet at destintaion udp ips
udp_srcip 192.168.1.112 # takes the same ip as hostname
udp_srcip auto
# destination udp ip picked up from rx_hostname (if auto) # destination udp ip picked up from rx_hostname (if auto)
udp_dstip auto udp_dstip auto
@ -101,12 +102,14 @@ For Multiple Modules
virtual 2 1912 virtual 2 1912
# or hostname localhost:1912+localhost:1914+ # or hostname localhost:1912+localhost:1914+
# connects to receivers at ports 2012 and 2014 # increasing receiver tcp ports (multi detector command)
rx_hostname mpc1922:2012+mpc1922:2013+ rx_tcpport 2012
# sets differernt destination udp ports # connects to reciever at port 2012 and 2013
0:udp_dstport 50012 rx_hostname mpc1922
1:udp_dstport 50014
# sets increasing destination udp ports
udp_dstport 50012
# source udp ips must be same subnet at destintaion udp ips # source udp ips must be same subnet at destintaion udp ips
0:udp_srcip 192.168.1.112 0:udp_srcip 192.168.1.112

View File

@ -4,14 +4,26 @@ detsize 1024 512
# detector hostname for controls # detector hostname for controls
hostname beb059+beb058+ hostname beb059+beb058+
# 1Gb receiver pc hostname with tcp port to configure receiver # increasing receiver tcp port (multi detector command)
rx_hostname x12sa-vcons:1991+x12sa-vcons:1992 rx_tcpport 1991
# 1Gb receiver pc hostname to configure receiver
rx_hostname x12sa-vcons
# or 1Gb receiver pc hostname with tcp port to configure receiver
#rx_hostname x12sa-vcons:1991+x12sa-vcons:1992
# increasing udp destination ports for all half modules
udp_dstport 50011
# udp port first quadrant, first halfmodule # udp port first quadrant, first halfmodule
0:udp_dstport 50011 #0:udp_dstport 50011
# udp port second quadrant, first halfmodule # udp port second quadrant, first halfmodule
0:udp_dstport2 50012 #0:udp_dstport2 50012
# udp port first quadrant, second halfmodule
#1:udp_dstport 50013
# udp port second quadrant, second halfmodule
#1:udp_dstport2 50014
# udp IP of the receiver over 10Gb # udp IP of the receiver over 10Gb
0:udp_dstip 10.0.30.210 0:udp_dstip 10.0.30.210
@ -19,12 +31,6 @@ rx_hostname x12sa-vcons:1991+x12sa-vcons:1992
# first half module 10 Gb IP (same subnet as 0:udp_dstip) # first half module 10 Gb IP (same subnet as 0:udp_dstip)
0:udp_srcip 10.0.30.100 0:udp_srcip 10.0.30.100
# udp port first quadrant, second halfmodule
1:udp_dstport 50013
# udp port second quadrant, second halfmodule
1:udp_dstport2 50014
# udp IP of the receiver over 10Gb, # udp IP of the receiver over 10Gb,
1:udp_dstip 10.0.40.210 1:udp_dstip 10.0.40.210

View File

@ -4,18 +4,23 @@ detsize 1024 512
# detector hostname for controls # detector hostname for controls
hostname beb059+beb058+ hostname beb059+beb058+
# 1Gb receiver pc hostname with tcp port to configure receiver # increasing receiver tcp port (multi detector command)
rx_hostname x12sa-vcons:1991+x12sa-vcons:1992 rx_tcpport 1991
# 1Gb receiver pc hostname to configure receiver
rx_hostname x12sa-vcons
# increasing udp destination ports for all half modules
udp_dstport 50011
# udp port first quadrant, first halfmodule # udp port first quadrant, first halfmodule
0:udp_dstport 50011 #0:udp_dstport 50011
#udp port second quadrant, first halfmodule #udp port second quadrant, first halfmodule
0:udp_dstport2 50012 #0:udp_dstport2 50012
# udp port first quadrant, second halfmodule # udp port first quadrant, second halfmodule
1:udp_dstport 50013 #1:udp_dstport 50013
# udp port second quadrant, second halfmodule # udp port second quadrant, second halfmodule
1:udp_dstport2 50014 #1:udp_dstport2 50014
# output directory # output directory
fpath /sls/X12SA/data/x12saop/Data10/Eiger0.5M fpath /sls/X12SA/data/x12saop/Data10/Eiger0.5M

View File

@ -4,14 +4,18 @@ detsize 1024 1024
# detector hostname # detector hostname
hostname bchip048+bchip052+ hostname bchip048+bchip052+
# 1Gb receiver pc hostname (default tcpport: 1954) # increasing receiver ports 1954 and 1955 (multi detector command)
rx_hostname pcmoench01:1954+pcmoench01:1955+ rx_tcpport 1954
# 1Gb receiver pc hostname
rx_hostname pcmoench01
# increasing udp ports 50004 and 50005 (multi detector command)
udp_dstport 50004
# or custom udp destination port (receiver) for 1st module
#0:udp_dstport 50014
# udp configurations for 1st module
# udp destination port (receiver)
0:udp_dstport 50004
# udp destination ip (receiver) # udp destination ip (receiver)
0:udp_dstip 10.1.1.100 0:udp_dstip 10.1.1.100
@ -19,17 +23,11 @@ rx_hostname pcmoench01:1954+pcmoench01:1955+
# udp source ip (same subnet as 0:udp_dstip) # udp source ip (same subnet as 0:udp_dstip)
0:udp_srcip 10.1.1.10 0:udp_srcip 10.1.1.10
# udp configurations for 2nd module
# udp destination port (receiver)
1:udp_dstport 50005
# udp destination ip (receiver) # udp destination ip (receiver)
1:udp_dstip 10.1.1.100 1:udp_dstip 10.1.2.100
# udp source ip (same subnet as 1:udp_dstip) # udp source ip (same subnet as 1:udp_dstip)
1:udp_srcip 10.1.1.11 1:udp_srcip 10.1.2.11
@ -45,5 +43,5 @@ timing trigger
# output file directory # output file directory
fpath /external_pool/jungfrau_data/softwaretest fpath /external_pool/jungfrau_data/softwaretest
# disable file writing # disable file writing (default)
fwrite 0 fwrite 0

View File

@ -2,10 +2,8 @@
hostname localhost:1900+localhost:1902+ hostname localhost:1900+localhost:1902+
# udp destination ports # udp destination ports
0:udp_dstport 50000 udp_dstport 50000
0:udp_dstport2 50001 udp_dstport2 50001
1:udp_dstport 50002
1:udp_dstport2 50003
# receiver hostname # receiver hostname
rx_hostname mpc1922:2000+mpc1922:2001+ rx_hostname mpc1922:2000+mpc1922:2001+

View File

@ -5,24 +5,26 @@ detsize 2048 1024
virtual 4 1952 virtual 4 1952
# udp destination ports # udp destination ports
0:udp_dstport2 50001 udp_dstport 50001
0:udp_dstport2 50002 #0:udp_dstport2 50001
1:udp_dstport 50003 #0:udp_dstport2 50002
1:udp_dstport2 50004 #1:udp_dstport 50003
2:udp_dstport 50005 #1:udp_dstport2 50004
2:udp_dstport2 50006 #2:udp_dstport 50005
3:udp_dstport 50007 #2:udp_dstport2 50006
3:udp_dstport2 50008 #3:udp_dstport 50007
#3:udp_dstport2 50008
# udp source ip (same subnet as udp_dstip) # udp source ip (same subnet as udp_dstip)
udp_srcip 192.168.1.100 udp_srcip 192.168.1.100
udp_srcip2 192.168.1.100 udp_srcip2 192.168.1.100
# receiver hostname and tcpports # receiver hostname and tcpports
0:rx_tcpport 1970 rx_tcpport 1970
1:rx_tcpport 1971 #0:rx_tcpport 1970
2:rx_tcpport 1972 #1:rx_tcpport 1971
3:rx_tcpport 1973 #2:rx_tcpport 1972
#3:rx_tcpport 1973
rx_hostname mpc1922 rx_hostname mpc1922
# udp destination ip from rx_hostname # udp destination ip from rx_hostname

View File

@ -8,7 +8,7 @@
* from the detector. Since every module could have a different value, we need * from the detector. Since every module could have a different value, we need
* to return a vector instead of just a single value. * to return a vector instead of just a single value.
* *
* Easy conversions to single values are provided using the squash method. * Easy conversions to single values are provided using the squash and tsquash method.
*/ */
#include <algorithm> #include <algorithm>