Merge branch 'developer' into jf_h5reader

This commit is contained in:
2024-11-21 16:34:08 +01:00
61 changed files with 1884 additions and 636 deletions

View File

@@ -2,7 +2,15 @@
# Copyright (C) 2021 Contributors to the SLS Detector Package # Copyright (C) 2021 Contributors to the SLS Detector Package
cmake_minimum_required(VERSION 3.14) cmake_minimum_required(VERSION 3.14)
project(slsDetectorPackage) project(slsDetectorPackage)
set(PROJECT_VERSION 9.0.0)
# Read VERSION file into project version
set(VERSION_FILE "${CMAKE_SOURCE_DIR}/VERSION")
file(READ "${VERSION_FILE}" VERSION_CONTENT)
string(STRIP "${VERSION_CONTENT}" PROJECT_VERSION_STRING)
set(PROJECT_VERSION ${PROJECT_VERSION_STRING})
# Pass it to the compiler
add_compile_definitions(SLS_DET_VERSION="${PROJECT_VERSION}")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG") set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
@@ -347,3 +355,5 @@ if(SLS_MASTER_PROJECT)
set(PROJECT_LIBRARIES slsSupportShared slsDetectorShared slsReceiverShared) set(PROJECT_LIBRARIES slsSupportShared slsDetectorShared slsReceiverShared)
include(cmake/package_config.cmake) include(cmake/package_config.cmake)
endif() endif()
install(FILES ${CMAKE_SOURCE_DIR}/VERSION DESTINATION ${CMAKE_INSTALL_PREFIX})

View File

@@ -211,4 +211,4 @@ This document describes the differences between vx.x.x and vx.0.2
------- -------
dhanya.thattil@psi.ch dhanya.thattil@psi.ch
erik.frojdh@psi.ch erik.frojdh@psi.ch

1
VERSION Normal file
View File

@@ -0,0 +1 @@
0.0.0

View File

@@ -1,6 +0,0 @@
# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package
echo "|<-------- starting python build"
cd python
${PYTHON} setup.py install

View File

@@ -1,8 +1,12 @@
# SPDX-License-Identifier: LGPL-3.0-or-other # SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package # Copyright (C) 2021 Contributors to the SLS Detector Package
mkdir build if [ ! -d "build" ]; then
mkdir install mkdir build
fi
if [ ! -d "install" ]; then
mkdir install
fi
cd build cd build
cmake .. \ cmake .. \
-DCMAKE_PREFIX_PATH=$CONDA_PREFIX \ -DCMAKE_PREFIX_PATH=$CONDA_PREFIX \

14
conda-recipe/build_pylib.sh Executable file
View File

@@ -0,0 +1,14 @@
# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package
echo "|<-------- starting python build"
cd python
# copy VERSION into slsdet for installation
cp ../VERSION slsdet/VERSION
# to be used to get project version in meta.yaml
export SLS_DET_VERSION=$(cat python/slsdet/VERSION)
${PYTHON} setup.py install

View File

@@ -4,4 +4,5 @@ python:
- 3.10 - 3.10
- 3.11 - 3.11
- 3.12 - 3.12
- 3.13

View File

@@ -1,15 +1,19 @@
{% set version = environ.get('SLS_DET_VERSION', '0.0.0') %}
package: package:
name: sls_detector_software name: sls_detector_software
version: {{ environ.get('GIT_DESCRIBE_TAG', '') }} version: "{{ version }}"
source: source:
- path: .. path: ..
build: build:
number: 0 number: 0
binary_relocation: True binary_relocation: True
rpaths: rpaths:
- lib/ - lib/
requirements: requirements:
@@ -61,13 +65,11 @@ outputs:
- libstdcxx-ng - libstdcxx-ng
- libgcc-ng - libgcc-ng
run: run:
- libstdcxx-ng - libstdcxx-ng
- libgcc-ng - libgcc-ng
- name: slsdet - name: slsdet
script: build_pylib.sh script: build_pylib.sh
requirements: requirements:
@@ -92,11 +94,11 @@ outputs:
- numpy - numpy
- {{ pin_subpackage('slsdetlib', exact=True) }} - {{ pin_subpackage('slsdetlib', exact=True) }}
test: test:
imports: imports:
- slsdet - slsdet
- name: slsdetgui - name: slsdetgui
script: copy_gui.sh script: copy_gui.sh
requirements: requirements:

View File

@@ -58,6 +58,13 @@ set(SPHINX_SOURCE_FILES
src/udpheader.rst src/udpheader.rst
src/udpconfig.rst src/udpconfig.rst
src/udpdetspec.rst src/udpdetspec.rst
src/fileformat.rst
src/slsreceiverheaderformat.rst
src/masterfileattributes.rst
src/binaryfileformat.rst
src/hdf5fileformat.rst
src/zmqjsonheaderformat.rst
src/ctbframeformat.rst
) )
foreach(filename ${SPHINX_SOURCE_FILES}) foreach(filename ${SPHINX_SOURCE_FILES})

View File

@@ -0,0 +1,438 @@
Binary File Format
====================
This is the default file format that can be configured using command `fformat <commandline.html#term-fformat-binary-hdf5>`_.
.. code-block:: bash
sls_detector_put fformat binary
Master File
--------------
* File Name: [fpath]/[fname]_master_[findex].json :ref:`Details here<file name format>`
* It is in json format and created for every acquisition.
* It contains :ref:`attributes<master file attributes>` relevant to the acquisition. This can vary with detector type shown in :ref:`master json file examples <json master file examples>` here.
* It shows the :ref:`**SLS Receiver Header** <sls receiver header format>` format used in data files.
* Enabled/disabled using command `fmaster <commandline.html#term-fmaster-0-1>`_.
Data File
----------
* File Name: [fpath]/[fname]_dx_fy_[findex].raw :ref:`Details here<file name format>`
* It store multiple frames sequentially, with total number of frames determined by `rx_framesperfile <commandline.html#term-rx_framesperfile-n_frames>`_ parameter.
* Each frame includes a :ref:`**sls_receiver_header** <sls receiver header format>` structure, followed by the actual frame data.
.. _json master file examples:
JSON Master File Examples
---------------------------------------------------
Eiger
^^^^^
.. code-block:: text
{
"Version": 7.2,
"Timestamp": "Wed Nov 13 15:46:30 2024",
"Detector Type": "Eiger",
"Timing Mode": "auto",
"Geometry": {
"x": 2,
"y": 1
},
"Image Size in bytes": 262144,
"Pixels": {
"x": 512,
"y": 256
},
"Max Frames Per File": 10000,
"Frame Discard Policy": "nodiscard",
"Frame Padding": 1,
"Scan Parameters": "[disabled]",
"Total Frames": 1,
"Receiver Roi": {
"xmin": 4294967295,
"xmax": 4294967295,
"ymin": 4294967295,
"ymax": 4294967295
},
"Dynamic Range": 16,
"Ten Giga": 0,
"Exptime": "1s",
"Period": "1s",
"Threshold Energy": -1,
"Sub Exptime": "2.62144ms",
"Sub Period": "2.62144ms",
"Quad": 0,
"Number of rows": 256,
"Rate Corrections": "[0]",
"Frames in File": 1,
"Frame Header Format": {
"Frame Number": "8 bytes",
"SubFrame Number/ExpLength": "4 bytes",
"Packet Number": "4 bytes",
"Bunch ID": "8 bytes",
"Timestamp": "8 bytes",
"Module Id": "2 bytes",
"Row": "2 bytes",
"Column": "2 bytes",
"Reserved": "2 bytes",
"Debug": "4 bytes",
"Round Robin Number": "2 bytes",
"Detector Type": "1 byte",
"Header Version": "1 byte",
"Packets Caught Mask": "64 bytes"
}
}
Jungfrau
^^^^^^^^
.. code-block:: text
{
"Version": 7.2,
"Timestamp": "Wed Nov 13 13:03:53 2024",
"Detector Type": "Jungfrau",
"Timing Mode": "auto",
"Geometry": {
"x": 1,
"y": 1
},
"Image Size in bytes": 1048576,
"Pixels": {
"x": 1024,
"y": 512
},
"Max Frames Per File": 10000,
"Frame Discard Policy": "nodiscard",
"Frame Padding": 1,
"Scan Parameters": "[disabled]",
"Total Frames": 1000,
"Receiver Roi": {
"xmin": 4294967295,
"xmax": 4294967295,
"ymin": 4294967295,
"ymax": 4294967295
},
"Exptime": "10us",
"Period": "2ms",
"Number of UDP Interfaces": 1,
"Number of rows": 512,
"Frames in File": 10,
"Frame Header Format": {
"Frame Number": "8 bytes",
"SubFrame Number/ExpLength": "4 bytes",
"Packet Number": "4 bytes",
"Bunch ID": "8 bytes",
"Timestamp": "8 bytes",
"Module Id": "2 bytes",
"Row": "2 bytes",
"Column": "2 bytes",
"Reserved": "2 bytes",
"Debug": "4 bytes",
"Round Robin Number": "2 bytes",
"Detector Type": "1 byte",
"Header Version": "1 byte",
"Packets Caught Mask": "64 bytes"
}
}
Gotthard2
^^^^^^^^^^^^
.. code-block:: text
{
"Version": 7.2,
"Timestamp": "Wed Nov 13 14:18:17 2024",
"Detector Type": "Gotthard2",
"Timing Mode": "auto",
"Geometry": {
"x": 1,
"y": 1
},
"Image Size in bytes": 2560,
"Pixels": {
"x": 1280,
"y": 1
},
"Max Frames Per File": 20000,
"Frame Discard Policy": "nodiscard",
"Frame Padding": 1,
"Scan Parameters": "[disabled]",
"Total Frames": 10,
"Receiver Roi": {
"xmin": 4294967295,
"xmax": 4294967295,
"ymin": 4294967295,
"ymax": 4294967295
},
"Exptime": "0ns",
"Period": "0ns",
"Burst Mode": "burst_internal",
"Frames in File": 10,
"Frame Header Format": {
"Frame Number": "8 bytes",
"SubFrame Number/ExpLength": "4 bytes",
"Packet Number": "4 bytes",
"Bunch ID": "8 bytes",
"Timestamp": "8 bytes",
"Module Id": "2 bytes",
"Row": "2 bytes",
"Column": "2 bytes",
"Reserved": "2 bytes",
"Debug": "4 bytes",
"Round Robin Number": "2 bytes",
"Detector Type": "1 byte",
"Header Version": "1 byte",
"Packets Caught Mask": "64 bytes"
}
}
Mythen3
^^^^^^^
.. code-block:: text
{
"Version": 7.2,
"Timestamp": "Wed Nov 13 14:39:14 2024",
"Detector Type": "Mythen3",
"Timing Mode": "auto",
"Geometry": {
"x": 1,
"y": 1
},
"Image Size in bytes": 15360,
"Pixels": {
"x": 3840,
"y": 1
},
"Max Frames Per File": 10000,
"Frame Discard Policy": "nodiscard",
"Frame Padding": 1,
"Scan Parameters": "[disabled]",
"Total Frames": 1,
"Receiver Roi": {
"xmin": 4294967295,
"xmax": 4294967295,
"ymin": 4294967295,
"ymax": 4294967295
},
"Dynamic Range": 32,
"Ten Giga": 1,
"Period": "2ms",
"Counter Mask": "0x7",
"Exptime1": "0.1s",
"Exptime2": "0.1s",
"Exptime3": "0.1s",
"GateDelay1": "0ns",
"GateDelay2": "0ns",
"GateDelay3": "0ns",
"Gates": 1,
"Threshold Energies": "[-1, -1, -1]",
"Frames in File": 1,
"Frame Header Format": {
"Frame Number": "8 bytes",
"SubFrame Number/ExpLength": "4 bytes",
"Packet Number": "4 bytes",
"Bunch ID": "8 bytes",
"Timestamp": "8 bytes",
"Module Id": "2 bytes",
"Row": "2 bytes",
"Column": "2 bytes",
"Reserved": "2 bytes",
"Debug": "4 bytes",
"Round Robin Number": "2 bytes",
"Detector Type": "1 byte",
"Header Version": "1 byte",
"Packets Caught Mask": "64 bytes"
}
}
Moench
^^^^^^
.. code-block:: text
{
"Version": 7.2,
"Timestamp": "Wed Nov 13 14:41:32 2024",
"Detector Type": "Moench",
"Timing Mode": "auto",
"Geometry": {
"x": 1,
"y": 1
},
"Image Size in bytes": 320000,
"Pixels": {
"x": 400,
"y": 400
},
"Max Frames Per File": 100000,
"Frame Discard Policy": "discardpartial",
"Frame Padding": 1,
"Scan Parameters": "[disabled]",
"Total Frames": 1,
"Receiver Roi": {
"xmin": 4294967295,
"xmax": 4294967295,
"ymin": 4294967295,
"ymax": 4294967295
},
"Exptime": "10us",
"Period": "2ms",
"Number of UDP Interfaces": 1,
"Number of rows": 400,
"Frames in File": 1,
"Frame Header Format": {
"Frame Number": "8 bytes",
"SubFrame Number/ExpLength": "4 bytes",
"Packet Number": "4 bytes",
"Bunch ID": "8 bytes",
"Timestamp": "8 bytes",
"Module Id": "2 bytes",
"Row": "2 bytes",
"Column": "2 bytes",
"Reserved": "2 bytes",
"Debug": "4 bytes",
"Round Robin Number": "2 bytes",
"Detector Type": "1 byte",
"Header Version": "1 byte",
"Packets Caught Mask": "64 bytes"
}
}
Gotthard I
^^^^^^^^^^^
.. code-block:: text
{
"Version": 7.2,
"Timestamp": "Wed Nov 13 15:16:19 2024",
"Detector Type": "Gotthard",
"Timing Mode": "auto",
"Geometry": {
"x": 1,
"y": 1
},
"Image Size in bytes": 2560,
"Pixels": {
"x": 1280,
"y": 1
},
"Max Frames Per File": 20000,
"Frame Discard Policy": "nodiscard",
"Frame Padding": 1,
"Scan Parameters": "[disabled]",
"Total Frames": 1,
"Receiver Roi": {
"xmin": 4294967295,
"xmax": 4294967295,
"ymin": 4294967295,
"ymax": 4294967295
},
"Exptime": "1.00001ms",
"Period": "1s",
"Detector Roi": {
"xmin": 4294967295,
"xmax": 4294967295
},
"Frames in File": 1,
"Frame Header Format": {
"Frame Number": "8 bytes",
"SubFrame Number/ExpLength": "4 bytes",
"Packet Number": "4 bytes",
"Bunch ID": "8 bytes",
"Timestamp": "8 bytes",
"Module Id": "2 bytes",
"Row": "2 bytes",
"Column": "2 bytes",
"Reserved": "2 bytes",
"Debug": "4 bytes",
"Round Robin Number": "2 bytes",
"Detector Type": "1 byte",
"Header Version": "1 byte",
"Packets Caught Mask": "64 bytes"
}
}
Chip Test Board
^^^^^^^^^^^^^^^
.. code-block:: text
{
"Version": 7.2,
"Timestamp": "Wed Nov 13 15:32:59 2024",
"Detector Type": "ChipTestBoard",
"Timing Mode": "auto",
"Geometry": {
"x": 1,
"y": 1
},
"Image Size in bytes": 48018,
"Pixels": {
"x": 3,
"y": 1
},
"Max Frames Per File": 20000,
"Frame Discard Policy": "nodiscard",
"Frame Padding": 1,
"Scan Parameters": "[disabled]",
"Total Frames": 1,
"Receiver Roi": {
"xmin": 4294967295,
"xmax": 4294967295,
"ymin": 4294967295,
"ymax": 4294967295
},
"Exptime": "0ns",
"Period": "0.18s",
"Ten Giga": 0,
"ADC Mask": "0x2202",
"Analog Flag": 1,
"Analog Samples": 8003,
"Digital Flag": 0,
"Digital Samples": 1000,
"Dbit Offset": 0,
"Dbit Bitset": 0,
"Transceiver Mask": "0x3",
"Transceiver Flag": 0,
"Transceiver Samples": 1,
"Frames in File": 1,
"Frame Header Format": {
"Frame Number": "8 bytes",
"SubFrame Number/ExpLength": "4 bytes",
"Packet Number": "4 bytes",
"Bunch ID": "8 bytes",
"Timestamp": "8 bytes",
"Module Id": "2 bytes",
"Row": "2 bytes",
"Column": "2 bytes",
"Reserved": "2 bytes",
"Debug": "4 bytes",
"Round Robin Number": "2 bytes",
"Detector Type": "1 byte",
"Header Version": "1 byte",
"Packets Caught Mask": "64 bytes"
}
}

View File

@@ -0,0 +1,81 @@
Chip Test Board Frame Format
================================
Contents of a frame
--------------------
Each frame consists of 3 types of data in the following order:
.. code-block:: text
# only data from enabled modes are included
[ Analog Data ]
[ Digital Data ]
[ Transceiver Data ]
Each Data type is further divided into:
.. code-block:: text
[ Sample 0 for all enabled Channels ]
[ Sample 1 for all enabled Channels ]
...
[ Sample N for all enabled Channels ]
Digital data
-------------------
The chip test board sends out all digital data.
Only the receiver can filter them using the command `rx_dbitlist <commandline.html#term-rx_dbitlist-all-or-i0-i1-i2-...>`_.
.. code-block:: text
# filtered and reordered digital data from receiver
# Any signal that is not a byte is filled with 0's to make up a byte
[all samples of list signal 0]
[all samples of list signal 1]
...
[all samples of list signal N]
Parameters of readout modes
---------------------------------
.. list-table::
:widths: 25 40 20 30
:header-rows: 1
* - Readout mode
- Enable Channels
- Number of samples
- Number of bytes
* - Analog
- 1G: `adcenable <commandline.htmlterm-adcenable-bitmask>`_
10G: `adcenable10g <commandline.htmlterm-adcenable10g-bitmask>`_
- `asamples <commandline.html#term-asamples-n_samples>`_
- 2 bytes per channel,
max 32 channels
* - Digital
- `rx_dbitlist <commandline.html#term-rx_dbitlist-all-or-i0-i1-i2-...>`_
[filtered only by receiver, module sends out all digital data]
- `dsamples <commandline.html#term-dsamples-n_value>`_
- 1 bit per signal,
max 64 signals
* - Transceiver
- `transceiverenable <commandline.html#term-transceiverenable-bitmask>`_
- `tsamples <commandline.html#term-tsamples-n_value>`_
- 8 bytes per channel,
max 4 channels

62
docs/src/fileformat.rst Normal file
View File

@@ -0,0 +1,62 @@
File format
================================
If `fwrite <commandline.html#term-fwrite-0-1>`_ is enabled, the receiver will write data to files.
Number of Files
----------------
Every acquisition will create a master file and data files.
An acquisition can have multiple data files for a single frame. The number of files is determined by the number of UDP ports per module and the number of modules.
* Every modules has its own receiver process. Every receiver process can have 1 or 2 UDP ports.
* Each UDP port will create its own file. Therefore, each receiver can write 1 or 2 files.
* So, for example a detector with 4 modules with 2 UDP ports each will create a total of 8 files with file names containing UDP port index **'_d0'** to **'_d7'**.
A new file containing **'_f[file_index]'** in file name is also created when reaching the maximum frames per file. Configured using `rx_framesperfile <commandline.html#term-rx_framesperfile-n_frames>`_.
.. _file name format:
Naming
-------
| Master File Name: [fpath]/[fname]_master_[findex].[ext]
| Data File Name: [fpath]/[fname]_dx_fy_[findex].[ext]
* fpath: file path set using command `fpath <commandline.html#term-fpath-path>`_. Default: '/'
* fname: file name prefix using command `fname <commandline.html#term-fname-name>`_. Default: "run"
* findex: acquisition index using command `findex <commandline.html#term-findex-n_value>`_. Automatically incremented for every acquisition with `sls_detector_acquire <commandline.html#term-acquire>`_ (if `fwrite <commandline.html#term-fwrite-0-1>`_ enabled).
* x: unique udp port index. New file per UDP port.
* y: file index. New file created after reaching max frames per file.
* ext: file extension. Default: "raw"(data file) or "json"(master file)
Some file name examples:
.. code-block:: bash
# first file
path-to-file/run_d0_f0_0.raw
# first file for second UDP port
path-to-file/run_d1_f0_0.raw
# second file after reaching max frames in first file
path-to-file/run_d0_f1_0.raw
# second acquisition, first file
path-to-file/run_d0_f0_1.raw
Formats
--------
There are 2 file formats supported by the receiver:
* Binary - extension .json (master file) or .raw (data files)
* HDF5 - extension .h5
The default is binary. HDF5 can be enabled by compiling the package with HDF5 option enabled. The file format is set using the command `fformat <commandline.html#term-fformat-binary-hdf5>`_.

View File

@@ -98,7 +98,7 @@ Upgrade
* 6.1.2 server has a fix for seamless fpga programming * 6.1.2 server has a fix for seamless fpga programming
* We recommend first updating the on-board detector server to 6.1.2 (with client 6.1.x) using command 'updatedetectorserver' or 'copydetectorserver'. * We recommend first updating the on-board detector server to 6.1.2 (with client 6.1.x) using command `updatedetectorserver <commandline.html#term-updatedetectorserver-server_name-with-full-path>`_.
* Then use command 'programfpga' to only update firmware or use command 'update' to update firmware and server to the latest release. * Then use command 'programfpga' to only update firmware or use command 'update' to update firmware and server to the latest release.
@@ -257,7 +257,7 @@ Upgrade
* 6.1.2 server has a fix for seamless fpga programming * 6.1.2 server has a fix for seamless fpga programming
* We recommend first updating the on-board detector server to 6.1.2 (with client 6.1.x) using command 'updatedetectorserver' or 'copydetectorserver'. * We recommend first updating the on-board detector server to 6.1.2 (with client 6.1.x) using command `updatedetectorserver <commandline.html#term-updatedetectorserver-server_name-with-full-path>`_.
* Then use command 'programfpga' to only update firmware or use command 'update' to update firmware and server to the latest release. * Then use command 'programfpga' to only update firmware or use command 'update' to update firmware and server to the latest release.

View File

@@ -0,0 +1,89 @@
HDF5 File Format
================================
Compilation
-------------
#. Compile the package with HDF5 option enabled
#. Using cmk script: ./cmk.sh -hj9 -d [path of hdf5 dir] (-d is optional and for custom installation folder)
#. Enable using cmake option **-DSLS_USE_HDF5=ON** and **-DCMAKE_INSTALL_PREFIX=/path/to/custom/hdf/installation** (optional).
Setup
-------
#. Start Receiver process
#. Load config file
#. Set file format using command `fformat <commandline.html#term-fformat-binary-hdf5>`_.
.. code-block:: bash
sls_detector_put fformat hdf5
Master File
-------------
* File Name: [fpath]/[fname]_master_[findex].h5 :ref:`Details here<file name format>`
* It contains :ref:`attributes<master file attributes>` relevant to the acquisition. This can vary with detector type.
.. code-block:: text
/ # Root level
|---> entry # entry group
| |---> data # data group
| |---> column # dataset of each sls_receiver_header member
| |---> data
| |---> detector header version
| |---> detector specific 1
| |---> detector specific 2
| |---> detector specific 3
| |---> detector specific 4
| |---> detector type
| |---> exp length or sub exposure time
| |---> frame number
| |---> mod id
| |---> packets caught
| |---> packets caught bit mask
| |---> row
| |---> timestamp
| |---> instrument # instrument group
| |---> beam # beam group
| |---> detector # detector group
| |---> Master File Attribute 1 # dataset of each master file attribute
| |---> Master File Attribute 2
| |---> Master File Attribute 3
| |---> Master File Attribute ..
| |---> sample # sample group
If more than 1 data file per frame:
* The dataset of each :ref:`**SLS Receiver Header** <sls receiver header format>` member is a virtual dataset.
* **data** dataset is a virtual dataset.
More details regarding master file attributes can be found :ref:`here<master file attributes>`.
Data File
-----------
* File Name: [fpath]/[fname]_dx_fy_[findex].h5 :ref:`Details here<file name format>`
Virtual Data File
------------------
* File Name: [fpath]/[fname]_virtual_[findex].h5 :ref:`Details here<file name format>`
* For multiple modules, a virtual file linking data from all the modules is created. The individual files are expected to be present.
* It is linked in the master file.

View File

@@ -82,6 +82,23 @@ Welcome to slsDetectorPackage's documentation!
receivers receivers
slsreceiver slsreceiver
.. toctree::
:caption: Receiver Files
:maxdepth: 3
fileformat
slsreceiverheaderformat
ctbframeformat
masterfileattributes
binaryfileformat
hdf5fileformat
.. toctree::
:caption: Receiver ZMQ Stream
:maxdepth: 2
zmqjsonheaderformat
.. toctree:: .. toctree::
:caption: Troubleshooting :caption: Troubleshooting

View File

@@ -201,6 +201,7 @@ Build slsDetectorGui (Qt5)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1. Using pre-built binary on conda 1. Using pre-built binary on conda
.. code-block:: bash .. code-block:: bash
conda create -n myenv slsdetgui=7.0.0 conda create -n myenv slsdetgui=7.0.0
@@ -208,13 +209,22 @@ Build slsDetectorGui (Qt5)
2. Using system installation on RHEL7 2. Using system installation on RHEL7
.. code-block:: bash .. code-block:: bash
yum install qt5-qtbase-devel.x86_64 yum install qt5-qtbase-devel.x86_64
yum install qt5-qtsvg-devel.x86_64 yum install qt5-qtsvg-devel.x86_64
3. Using system installation on RHEL8
.. code-block:: bash
yum install qt5-qtbase-devel.x86_64
yum install qt5-qtsvg-devel.x86_64
yum install expat-devel.x86_64
4. Using conda
3. Using conda
.. code-block:: bash .. code-block:: bash
#Add channels for dependencies and our library #Add channels for dependencies and our library
@@ -312,7 +322,7 @@ Pybind and Zeromq
| * or use advanced 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-devel 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' dependency added when installing using conda | * 'zeromq' dependency added when installing using conda

View File

@@ -0,0 +1,408 @@
.. _master file attributes:
Master File Attributes
=======================
These attributes are the same in binary and HDF5 file, but vary depending on detector type.
Eiger
^^^^^
+-----------------------+-------------------------------------------------+
| **Key** | **Description** |
+-----------------------+-------------------------------------------------+
| Version | Version of the master file |
| | Current value:8.0 |
+-----------------------+-------------------------------------------------+
| Timestamp | Timestamp of creation of master file |
+-----------------------+-------------------------------------------------+
| Detector Type | Detector type |
+-----------------------+-------------------------------------------------+
| Timing Mode | Timing Mode |
+-----------------------+-------------------------------------------------+
| Geometry | Number of UDP ports in x and y dimension for |
| | complete detector |
+-----------------------+-------------------------------------------------+
| Image Size in bytes | Image size in bytes per UDP port |
+-----------------------+-------------------------------------------------+
| Pixels | Number of pixels in x and y dimension |
| | per UDP port |
+-----------------------+-------------------------------------------------+
| Max Frames Per File | Maximum frames per file |
+-----------------------+-------------------------------------------------+
| Frame Discard Policy | Receiever Frame discard policy |
| | for partial frames |
+-----------------------+-------------------------------------------------+
| Frame Padding | Receiver Frame padding enable |
| | for partial frames |
+-----------------------+-------------------------------------------------+
| Scan Parameters | Scanning mode on detector |
+-----------------------+-------------------------------------------------+
| Total Frames | Total number of frames and triggers expected |
+-----------------------+-------------------------------------------------+
| Receiver Roi | Receiver ROI in file including xmax and ymax |
+-----------------------+-------------------------------------------------+
| Dynamic Range | Bits per pixel |
+-----------------------+-------------------------------------------------+
| Ten Giga | 10GbE enable for data |
+-----------------------+-------------------------------------------------+
| Exptime | Exposure time |
+-----------------------+-------------------------------------------------+
| Period | Period between frames |
+-----------------------+-------------------------------------------------+
| Threshold Energy | Threshold energy |
+-----------------------+-------------------------------------------------+
| Sub Exptime | Sub exposure time in 32 bit mode |
+-----------------------+-------------------------------------------------+
| Sub Period | Sub period between frames in 32 bit mode |
+-----------------------+-------------------------------------------------+
| Quad | Quad enable (hardware) |
+-----------------------+-------------------------------------------------+
| Number of rows | Number of rows enabled for readout |
+-----------------------+-------------------------------------------------+
| Rate Corrections | Rate Corrections |
+-----------------------+-------------------------------------------------+
| Frames in File | Number of frames written to file by Receiver 0 |
+-----------------------+-------------------------------------------------+
| Frame Header Format | Expected frame header format for the data files |
+-----------------------+-------------------------------------------------+
Jungfrau
^^^^^^^^
+-----------------------+-------------------------------------------------+
| **Key** | **Description** |
+-----------------------+-------------------------------------------------+
| Version | Version of the master file |
| | Current value:8.0 |
+-----------------------+-------------------------------------------------+
| Timestamp | Timestamp of creation of master file |
+-----------------------+-------------------------------------------------+
| Detector Type | Detector type |
+-----------------------+-------------------------------------------------+
| Timing Mode | Timing Mode |
+-----------------------+-------------------------------------------------+
| Geometry | Number of UDP ports in x and y dimension for |
| | complete detector |
+-----------------------+-------------------------------------------------+
| Image Size in bytes | Image size in bytes per UDP port |
+-----------------------+-------------------------------------------------+
| Pixels | Number of pixels in x and y dimension |
| | per UDP port |
+-----------------------+-------------------------------------------------+
| Max Frames Per File | Maximum frames per file |
+-----------------------+-------------------------------------------------+
| Frame Discard Policy | Receiever Frame discard policy |
| | for partial frames |
+-----------------------+-------------------------------------------------+
| Frame Padding | Receiver Frame padding enable |
| | for partial frames |
+-----------------------+-------------------------------------------------+
| Scan Parameters | Scanning mode on detector |
+-----------------------+-------------------------------------------------+
| Total Frames | Total number of frames and triggers expected |
+-----------------------+-------------------------------------------------+
| Receiver Roi | Receiver ROI in file including xmax and ymax |
+-----------------------+-------------------------------------------------+
| Exptime | Exposure time |
+-----------------------+-------------------------------------------------+
| Period | Period between frames |
+-----------------------+-------------------------------------------------+
| Number of UDP | Number of UDP Interfaces enabled per module |
| Interfaces | |
+-----------------------+-------------------------------------------------+
| Number of rows | Number of rows enabled for readout |
+-----------------------+-------------------------------------------------+
| Frames in File | Number of frames written to file by Receiver 0 |
+-----------------------+-------------------------------------------------+
| Frame Header Format | Expected frame header format for the data files |
+-----------------------+-------------------------------------------------+
Gotthard II
^^^^^^^^^^^^
+-----------------------+-------------------------------------------------+
| **Key** | **Description** |
+-----------------------+-------------------------------------------------+
| Version | Version of the master file |
| | Current value:8.0 |
+-----------------------+-------------------------------------------------+
| Timestamp | Timestamp of creation of master file |
+-----------------------+-------------------------------------------------+
| Detector Type | Detector type |
+-----------------------+-------------------------------------------------+
| Timing Mode | Timing Mode |
+-----------------------+-------------------------------------------------+
| Geometry | Number of UDP ports in x and y dimension for |
| | complete detector |
+-----------------------+-------------------------------------------------+
| Image Size in bytes | Image size in bytes per UDP port |
+-----------------------+-------------------------------------------------+
| Pixels | Number of pixels in x and y dimension |
| | per UDP port |
+-----------------------+-------------------------------------------------+
| Max Frames Per File | Maximum frames per file |
+-----------------------+-------------------------------------------------+
| Frame Discard Policy | Receiever Frame discard policy |
| | for partial frames |
+-----------------------+-------------------------------------------------+
| Frame Padding | Receiver Frame padding enable |
| | for partial frames |
+-----------------------+-------------------------------------------------+
| Scan Parameters | Scanning mode on detector |
+-----------------------+-------------------------------------------------+
| Total Frames | Total number of frames and triggers expected |
+-----------------------+-------------------------------------------------+
| Receiver Roi | Receiver ROI in file including xmax and ymax |
+-----------------------+-------------------------------------------------+
| Exptime | Exposure time |
+-----------------------+-------------------------------------------------+
| Period | Period between frames |
+-----------------------+-------------------------------------------------+
| Burst Mode | Burst mode of detector |
+-----------------------+-------------------------------------------------+
| Frames in File | Number of frames written to file by Receiver 0 |
+-----------------------+-------------------------------------------------+
| Frame Header Format | Expected frame header format for the data files |
+-----------------------+-------------------------------------------------+
Mythen3
^^^^^^^
+-----------------------+-------------------------------------------------+
| **Key** | **Description** |
+-----------------------+-------------------------------------------------+
| Version | Version of the master file |
| | Current value:8.0 |
+-----------------------+-------------------------------------------------+
| Timestamp | Timestamp of creation of master file |
+-----------------------+-------------------------------------------------+
| Detector Type | Detector type |
+-----------------------+-------------------------------------------------+
| Timing Mode | Timing Mode |
+-----------------------+-------------------------------------------------+
| Geometry | Number of UDP ports in x and y dimension for |
| | complete detector |
+-----------------------+-------------------------------------------------+
| Image Size in bytes | Image size in bytes per UDP port |
+-----------------------+-------------------------------------------------+
| Pixels | Number of pixels in x and y dimension |
| | per UDP port |
+-----------------------+-------------------------------------------------+
| Max Frames Per File | Maximum frames per file |
+-----------------------+-------------------------------------------------+
| Frame Discard Policy | Receiever Frame discard policy |
| | for partial frames |
+-----------------------+-------------------------------------------------+
| Frame Padding | Receiver Frame padding enable |
| | for partial frames |
+-----------------------+-------------------------------------------------+
| Scan Parameters | Scanning mode on detector |
+-----------------------+-------------------------------------------------+
| Total Frames | Total number of frames and triggers expected |
+-----------------------+-------------------------------------------------+
| Receiver Roi | Receiver ROI in file including xmax and ymax |
+-----------------------+-------------------------------------------------+
| Dynamic Range | Bits per pixel |
+-----------------------+-------------------------------------------------+
| Ten Giga | 10GbE enable for data |
+-----------------------+-------------------------------------------------+
| Period | Period between frames |
+-----------------------+-------------------------------------------------+
| Counter Mask | Mask of counters enabled |
+-----------------------+-------------------------------------------------+
| Exptime1 | Exposure time of counter 1 |
+-----------------------+-------------------------------------------------+
| Exptime2 | Exposure time of counter 2 |
+-----------------------+-------------------------------------------------+
| Exptime3 | Exposure time of counter 3 |
+-----------------------+-------------------------------------------------+
| GateDelay1 | Gate delay of counter 1 |
+-----------------------+-------------------------------------------------+
| GateDelay2 | Gate delay of counter 2 |
+-----------------------+-------------------------------------------------+
| GateDelay3 | Gate delay of counter 3 |
+-----------------------+-------------------------------------------------+
| Gates | Number of gates |
+-----------------------+-------------------------------------------------+
| Threshold energies | Threshold energy of all 3 counters |
+-----------------------+-------------------------------------------------+
| Frames in File | Number of frames written to file by Receiver 0 |
+-----------------------+-------------------------------------------------+
| Frame Header Format | Expected frame header format for the data files |
+-----------------------+-------------------------------------------------+
Moench
^^^^^^
+-----------------------+-------------------------------------------------+
| **Key** | **Description** |
+-----------------------+-------------------------------------------------+
| Version | Version of the master file |
| | Current value:8.0 |
+-----------------------+-------------------------------------------------+
| Timestamp | Timestamp of creation of master file |
+-----------------------+-------------------------------------------------+
| Detector Type | Detector type |
+-----------------------+-------------------------------------------------+
| Timing Mode | Timing Mode |
+-----------------------+-------------------------------------------------+
| Geometry | Number of UDP ports in x and y dimension for |
| | complete detector |
+-----------------------+-------------------------------------------------+
| Image Size in bytes | Image size in bytes per UDP port |
+-----------------------+-------------------------------------------------+
| Pixels | Number of pixels in x and y dimension |
| | per UDP port |
+-----------------------+-------------------------------------------------+
| Max Frames Per File | Maximum frames per file |
+-----------------------+-------------------------------------------------+
| Frame Discard Policy | Receiever Frame discard policy |
| | for partial frames |
+-----------------------+-------------------------------------------------+
| Frame Padding | Receiver Frame padding enable |
| | for partial frames |
+-----------------------+-------------------------------------------------+
| Scan Parameters | Scanning mode on detector |
+-----------------------+-------------------------------------------------+
| Total Frames | Total number of frames and triggers expected |
+-----------------------+-------------------------------------------------+
| Receiver Roi | Receiver ROI in file including xmax and ymax |
+-----------------------+-------------------------------------------------+
| Exptime | Exposure time |
+-----------------------+-------------------------------------------------+
| Period | Period between frames |
+-----------------------+-------------------------------------------------+
| Number of UDP | Number of UDP Interfaces enabled per module |
| Interfaces | |
+-----------------------+-------------------------------------------------+
| Number of rows | Number of rows enabled for readout |
+-----------------------+-------------------------------------------------+
| Frames in File | Number of frames written to file by Receiver 0 |
+-----------------------+-------------------------------------------------+
| Frame Header Format | Expected frame header format for the data files |
+-----------------------+-------------------------------------------------+
Gotthard I
^^^^^^^^^^^
+-----------------------+-------------------------------------------------+
| **Key** | **Description** |
+-----------------------+-------------------------------------------------+
| Version | Version of the master file |
| | Current value:8.0 |
+-----------------------+-------------------------------------------------+
| Timestamp | Timestamp of creation of master file |
+-----------------------+-------------------------------------------------+
| Detector Type | Detector type |
+-----------------------+-------------------------------------------------+
| Timing Mode | Timing Mode |
+-----------------------+-------------------------------------------------+
| Geometry | Number of UDP ports in x and y dimension for |
| | complete detector |
+-----------------------+-------------------------------------------------+
| Image Size in bytes | Image size in bytes per UDP port |
+-----------------------+-------------------------------------------------+
| Pixels | Number of pixels in x and y dimension |
| | per UDP port |
+-----------------------+-------------------------------------------------+
| Max Frames Per File | Maximum frames per file |
+-----------------------+-------------------------------------------------+
| Frame Discard Policy | Receiever Frame discard policy |
| | for partial frames |
+-----------------------+-------------------------------------------------+
| Frame Padding | Receiver Frame padding enable |
| | for partial frames |
+-----------------------+-------------------------------------------------+
| Scan Parameters | Scanning mode on detector |
+-----------------------+-------------------------------------------------+
| Total Frames | Total number of frames and triggers expected |
+-----------------------+-------------------------------------------------+
| Receiver Roi | Receiver ROI in file including xmax and ymax |
+-----------------------+-------------------------------------------------+
| Exptime | Exposure time |
+-----------------------+-------------------------------------------------+
| Period | Period between frames |
+-----------------------+-------------------------------------------------+
| Detector Roi | Roi in detector restricted to an ADC. |
| | Includes xmax |
+-----------------------+-------------------------------------------------+
| Burst Mode | Burst mode of detector |
+-----------------------+-------------------------------------------------+
| Frames in File | Number of frames written to file by Receiver 0 |
+-----------------------+-------------------------------------------------+
| Frame Header Format | Expected frame header format for the data files |
+-----------------------+-------------------------------------------------+
Chip Test Board
^^^^^^^^^^^^^^^
+-----------------------+-------------------------------------------------+
| **Key** | **Description** |
+-----------------------+-------------------------------------------------+
| Version | Version of the master file |
| | Current value:8.0 |
+-----------------------+-------------------------------------------------+
| Timestamp | Timestamp of creation of master file |
+-----------------------+-------------------------------------------------+
| Detector Type | Detector type |
+-----------------------+-------------------------------------------------+
| Timing Mode | Timing Mode |
+-----------------------+-------------------------------------------------+
| Geometry | Number of UDP ports in x and y dimension for |
| | complete detector |
+-----------------------+-------------------------------------------------+
| Image Size in bytes | Image size in bytes per UDP port |
+-----------------------+-------------------------------------------------+
| Pixels | Number of pixels in x and y dimension |
| | per UDP port |
+-----------------------+-------------------------------------------------+
| Max Frames Per File | Maximum frames per file |
+-----------------------+-------------------------------------------------+
| Frame Discard Policy | Receiever Frame discard policy |
| | for partial frames |
+-----------------------+-------------------------------------------------+
| Frame Padding | Receiver Frame padding enable |
| | for partial frames |
+-----------------------+-------------------------------------------------+
| Scan Parameters | Scanning mode on detector |
+-----------------------+-------------------------------------------------+
| Total Frames | Total number of frames and triggers expected |
+-----------------------+-------------------------------------------------+
| Receiver Roi | Receiver ROI in file including xmax and ymax |
+-----------------------+-------------------------------------------------+
| Exptime | Exposure time |
+-----------------------+-------------------------------------------------+
| Period | Period between frames |
+-----------------------+-------------------------------------------------+
| Ten Giga | Ten giga enable |
+-----------------------+-------------------------------------------------+
| ADC Mask | Mask of channels enabled in ADC |
+-----------------------+-------------------------------------------------+
| Analog Flag | Analog readout enable |
+-----------------------+-------------------------------------------------+
| Analog Samples | Number of analog samples |
+-----------------------+-------------------------------------------------+
| Digital Flag | Digital readout enable |
+-----------------------+-------------------------------------------------+
| Digital Samples | Number of digital samples |
+-----------------------+-------------------------------------------------+
| Dbit Offset | Digital offset of valid data in bytes |
+-----------------------+-------------------------------------------------+
| Dbit Bitset | Digital 64 bit mask of bits enabled in receiver |
+-----------------------+-------------------------------------------------+
| Transceiver Mask | Mask of channels enabled in Transceiver |
+-----------------------+-------------------------------------------------+
| Transceiver Flag | Transceiver readout enable |
+-----------------------+-------------------------------------------------+
| Transceiver Samples | Number of transceiver samples |
+-----------------------+-------------------------------------------------+
| Frames in File | Number of frames written to file by Receiver 0 |
+-----------------------+-------------------------------------------------+
| Frame Header Format | Expected frame header format for the data files |
+-----------------------+-------------------------------------------------+

View File

@@ -91,245 +91,6 @@ Client Commands
sls_detector_get -h rx_framescaught sls_detector_get -h rx_framescaught
ZMQ: Json Header Format
------------------------
**Change in field names from slsDetectorPackage v6.x.x to v7.0.0**
* detSpec1 <- bunchId
* detSpec2 <- reserved
* detSpec3 <- debug
* detSpec4 <- roundRNumber
**Format**
.. code-block:: bash
{
"jsonversion": unsigned int,
"bitmode": unsigned int,
"fileIndex": unsigned long int,
"detshape": [
unsigned int,
unsigned int
],
"shape": [
unsigned int,
unsigned int
],
"size": unsigned int,
"acqIndex": unsigned long int,
"frameIndex": unsigned long int,
"progress": double,
"fname": string,
"data": unsigned int,
"completeImage": unsigned int,
"frameNumber": unsigned long long int,
"expLength": unsigned int,
"packetNumber": unsigned int,
"detSpec1": unsigned long int,
"timestamp": unsigned long int,
"modId": unsigned int,
"row": unsigned int,
"column": unsigned int,
"detSpec2": unsigned int,
"detSpec3": unsigned int,
"detSpec4": unsigned int,
"detType": unsigned int,
"version": unsigned int,
"flipRows": unsigned int,
"quad": unsigned int,
"addJsonHeader": {
string : string
}
}
+--------------+----------------------------------------------+
| Field | Description |
+--------------+----------------------------------------------+
| jsonversion | Version of the json header. |
| | Value at 4 for v6.x.x and v7.x.x |
+--------------+----------------------------------------------+
| bitmode | Bits per pixel [4|8|16|32] |
+--------------+----------------------------------------------+
| fileIndex | Current file acquisition index |
+--------------+----------------------------------------------+
| detshape | Geometry of the entire detector |
+--------------+----------------------------------------------+
| shape | Geometry of the current port streamed out |
+--------------+----------------------------------------------+
| size | Size of image of current port in bytesout |
+--------------+----------------------------------------------+
| acqIndex | Frame number from the detector (redundant) |
+--------------+----------------------------------------------+
| frameIndex | Frame number of current acquisition |
| | (Starting at 0) |
+--------------+----------------------------------------------+
| progress | Progress of current acquisition in % |
+--------------+----------------------------------------------+
| fname | Current file name |
+--------------+----------------------------------------------+
| data | 1 if there is data following |
| | 0 if dummy header |
+--------------+----------------------------------------------+
| completeImage| 1 if no missing packets for this frame |
| | in this port, else 0 |
+--------------+----------------------------------------------+
| frameNumber | Frame number |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| expLength | subframe number (32 bit eiger) |
| | or real time exposure time in 100ns (others) |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| packetNumber | Number of packets caught for that frame |
+--------------+----------------------------------------------+
| detSpec1 | See :ref:`here<Detector Specific Fields>` |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| timestamp | Timestamp with 10 MHz clock |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| modId | Module Id |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| row | Row number in detector |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| column | Column number in detector |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| detSpec2 | See :ref:`here<Detector Specific Fields>` |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| detSpec3 | See :ref:`here<Detector Specific Fields>` |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| detSpec4 | See :ref:`here<Detector Specific Fields>` |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| detType | Detector type enum |
| detSpec3 | See :ref:`Detector enum<detector enum>` |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| version | Detector header version. At 2 |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| flipRows | 1 if rows should be flipped. |
| | Usually for Eiger bottom. |
+--------------+----------------------------------------------+
| quad | 1 if its an Eiger quad. |
+--------------+----------------------------------------------+
| addJsonHeader| Optional custom parameters that is required |
| | for processing code. |
+--------------+----------------------------------------------+
SLS Receiver Header Format
--------------------------
It is 112 bytes and consists of:
* 48 bytes of the SLS Detector Header (described in :ref:`the current detector header <detector udp header>`)
* 64 bytes of packet mask
.. code-block:: cpp
typedef struct {
uint64_t frameNumber;
uint32_t expLength;
uint32_t packetNumber;
uint64_t detSpec1;
uint64_t timestamp;
uint16_t modId;
uint16_t row;
uint16_t column;
uint16_t detSpec2;
uint32_t detSpec3;
uint16_t detSpec4;
uint8_t detType;
uint8_t version;
} sls_detector_header;
struct sls_receiver_header {
sls_detector_header detHeader; /**< is the detector header */
sls_bitset packetsMask; /**< is the packets caught bit mask */
};
.. note ::
| The packetNumber in the SLS Receiver Header will be modified to number of packets caught by receiver for that frame. For eg. Jungfrau will have 128 packets per frame. If it is less, then this is a partial frame due to missing packets.
| Furthermore, the bit mask will specify which packets have been received.
File format
--------------
Master file is in json format.
The file name format is [fpath]/[fname]_dx_fy_[findex].raw, where x is module index and y is file index. **fname** is file name prefix and by default "run". **fpath** is '/' by default.
Each acquisition will have an increasing acquisition index or findex (if file write enabled). This can be retrieved by using **findex** command.
Each acquisition can have multiple files (the file index number **y**), with **rx_framesperfile** being the maximum number of frames per file. The default varies for each detector type.
Some file name examples:
.. code-block:: bash
# first file
path-to-file/run_d0_f0_0.raw
# second file after reaching max frames in first file
path-to-file/run_d0_f1_0.raw
# second acquisition, first file
path-to-file/run_d0_f0_1.raw
Each acquisition will create a master file that can be enabled/disabled using **fmaster**. This should have parameters relevant to the acquisition.
**Binary file format**
This is the default file format.
Each data file will consist of frames, each consisting of slsReceiver Header followed by data for 1 frame.
Master file is of ASCII format and will also include the format of the slsReceiver Header.
**HDF5 file formats**
#. Compile the package with HDF5 option enabled
#. Using cmk script: ./cmk.sh -hj9 -d [path of hdf5 dir]
#. Enable using cmake **-DCMAKE_INSTALL_PREFIX=/path/to/hdf/installation** and **-DSLS_USE_HDF5=ON**
#. Start Receiver process
#. Load config file
#. Set file format from client or in config file
.. code-block:: bash
sls_detector_put fformat hdf5
| For multiple, modules, a virtual file linking all the modules is created. Both the data files and virtual files are linked in the master file.
Performance Performance

View File

@@ -0,0 +1,40 @@
.. _sls receiver header format:
SLS Receiver Header Format
====================================================
It is 112 bytes and consists of:
* 48 bytes of the SLS Detector Header
* 64 bytes of packet mask
.. code-block:: cpp
typedef struct {
uint64_t frameNumber;
uint32_t expLength;
uint32_t packetNumber;
uint64_t detSpec1;
uint64_t timestamp;
uint16_t modId;
uint16_t row;
uint16_t column;
uint16_t detSpec2;
uint32_t detSpec3;
uint16_t detSpec4;
uint8_t detType;
uint8_t version;
} sls_detector_header;
struct sls_receiver_header {
sls_detector_header detHeader; /**< is the detector header */
sls_bitset packetsMask; /**< is the packets caught bit mask */
};
| **sls_detector_header** (described in :ref:`the current detector header <detector udp header>`)
| The **packetNumber** from detector UDP header is modified in **sls_receiver_header** to number of packets caught by receiver for that frame and the bit mask for each packet caught is the **packetsMask**. The packetsMask is a total of 512 bits due to the largest number of packets per frame among our detectors.
| For eg. Jungfrau has 128 packets per frame. If **packetNumeber** is 128, then this frame is complete. If it is 127 or less, it is a partial frame due to missing packets. If one would still like to use it, the **packetsMask** will specify which packet has been received or is missing.

View File

@@ -3,7 +3,7 @@
Format Format
======= =======
The UDP data format for the packets consist of a common header for all detectors, followed by the data for that one packet. The UDP data format for the packets consist of a common header of 48 bytes for all detectors, followed by the data for that one packet.
Current Version Current Version
@@ -11,6 +11,25 @@ Current Version
**v2.0 (slsDetectorPackage v7.0.0+)** **v2.0 (slsDetectorPackage v7.0.0+)**
.. code-block:: cpp
typedef struct {
uint64_t frameNumber;
uint32_t expLength;
uint32_t packetNumber;
uint64_t detSpec1;
uint64_t timestamp;
uint16_t modId;
uint16_t row;
uint16_t column;
uint16_t detSpec2;
uint32_t detSpec3;
uint16_t detSpec4;
uint8_t detType;
uint8_t version;
} sls_detector_header;
.. table:: <---------------------------------------------------- 8 bytes per row ---------------------------------------------> .. table:: <---------------------------------------------------- 8 bytes per row --------------------------------------------->
:align: center :align: center
:widths: 30,30,30,15,15 :widths: 30,30,30,15,15

View File

@@ -0,0 +1,137 @@
ZMQ: Json Header Format
========================
**Change in field names from slsDetectorPackage v6.x.x to v7.0.0**
* detSpec1 <- bunchId
* detSpec2 <- reserved
* detSpec3 <- debug
* detSpec4 <- roundRNumber
**Format**
.. code-block:: bash
{
"jsonversion": unsigned int,
"bitmode": unsigned int,
"fileIndex": unsigned long int,
"detshape": [
unsigned int,
unsigned int
],
"shape": [
unsigned int,
unsigned int
],
"size": unsigned int,
"acqIndex": unsigned long int,
"frameIndex": unsigned long int,
"progress": double,
"fname": string,
"data": unsigned int,
"completeImage": unsigned int,
"frameNumber": unsigned long long int,
"expLength": unsigned int,
"packetNumber": unsigned int,
"detSpec1": unsigned long int,
"timestamp": unsigned long int,
"modId": unsigned int,
"row": unsigned int,
"column": unsigned int,
"detSpec2": unsigned int,
"detSpec3": unsigned int,
"detSpec4": unsigned int,
"detType": unsigned int,
"version": unsigned int,
"flipRows": unsigned int,
"quad": unsigned int,
"addJsonHeader": {
string : string
}
}
+--------------+----------------------------------------------+
| Field | Description |
+--------------+----------------------------------------------+
| jsonversion | Version of the json header. |
| | Value at 4 for v6.x.x and v7.x.x |
+--------------+----------------------------------------------+
| bitmode | Bits per pixel [4|8|16|32] |
+--------------+----------------------------------------------+
| fileIndex | Current file acquisition index |
+--------------+----------------------------------------------+
| detshape | Geometry of the entire detector |
+--------------+----------------------------------------------+
| shape | Geometry of the current port streamed out |
+--------------+----------------------------------------------+
| size | Size of image of current port in bytesout |
+--------------+----------------------------------------------+
| acqIndex | Frame number from the detector (redundant) |
+--------------+----------------------------------------------+
| frameIndex | Frame number of current acquisition |
| | (Starting at 0) |
+--------------+----------------------------------------------+
| progress | Progress of current acquisition in % |
+--------------+----------------------------------------------+
| fname | Current file name |
+--------------+----------------------------------------------+
| data | 1 if there is data following |
| | 0 if dummy header |
+--------------+----------------------------------------------+
| completeImage| 1 if no missing packets for this frame |
| | in this port, else 0 |
+--------------+----------------------------------------------+
| frameNumber | Frame number |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| expLength | subframe number (32 bit eiger) |
| | or real time exposure time in 100ns (others) |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| packetNumber | Number of packets caught for that frame |
+--------------+----------------------------------------------+
| detSpec1 | See :ref:`here<Detector Specific Fields>` |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| timestamp | Timestamp with 10 MHz clock |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| modId | Module Id |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| row | Row number in detector |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| column | Column number in detector |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| detSpec2 | See :ref:`here<Detector Specific Fields>` |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| detSpec3 | See :ref:`here<Detector Specific Fields>` |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| detSpec4 | See :ref:`here<Detector Specific Fields>` |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| detType | Detector type enum |
| detSpec3 | See :ref:`Detector enum<detector enum>` |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| version | Detector header version. At 2 |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| flipRows | 1 if rows should be flipped. |
| | Usually for Eiger bottom. |
+--------------+----------------------------------------------+
| quad | 1 if its an Eiger quad. |
+--------------+----------------------------------------------+
| addJsonHeader| Optional custom parameters that is required |
| | for processing code. |
+--------------+----------------------------------------------+

View File

@@ -49,7 +49,6 @@ set( PYTHON_FILES
slsdet/temperature.py slsdet/temperature.py
slsdet/lookup.py slsdet/lookup.py
slsdet/utils.py slsdet/utils.py
) )
foreach(FILE ${PYTHON_FILES}) foreach(FILE ${PYTHON_FILES})
@@ -58,7 +57,6 @@ foreach(FILE ${PYTHON_FILES})
endforeach(FILE ${PYTHON_FILES}) endforeach(FILE ${PYTHON_FILES})
configure_file( scripts/basic.py configure_file( scripts/basic.py
${CMAKE_BINARY_DIR}/basic.py ${CMAKE_BINARY_DIR}/basic.py
) )
@@ -66,6 +64,9 @@ configure_file( scripts/test_virtual.py
${CMAKE_BINARY_DIR}/test_virtual.py ${CMAKE_BINARY_DIR}/test_virtual.py
) )
configure_file( ${CMAKE_SOURCE_DIR}/VERSION
${CMAKE_BINARY_DIR}/bin/slsdet/VERSION
)
if(SLS_INSTALL_PYTHONEXT) if(SLS_INSTALL_PYTHONEXT)
install(TARGETS _slsdet install(TARGETS _slsdet
@@ -74,4 +75,5 @@ if(SLS_INSTALL_PYTHONEXT)
) )
install(FILES ${PYTHON_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/python/slsdet) install(FILES ${PYTHON_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/python/slsdet)
install(FILES ../VERSION DESTINATION ${CMAKE_INSTALL_PREFIX}/python/slsdet)
endif() endif()

View File

@@ -10,14 +10,15 @@ import sys
from setuptools import setup, find_packages from setuptools import setup, find_packages
from pybind11.setup_helpers import Pybind11Extension, build_ext from pybind11.setup_helpers import Pybind11Extension, build_ext
def read_version():
import subprocess
def get_git_tag():
try: try:
return subprocess.check_output(['git', 'describe', '--tags', '--abbrev=0']).strip().decode('utf-8') version_file = os.path.join(os.path.dirname(__file__), 'slsdet', 'VERSION')
except subprocess.CalledProcessError: with open(version_file, "r") as f:
return 'developer' return f.read().strip()
__version__ = get_git_tag() except:
raise RuntimeError("VERSION file not found in slsdet package from setup.py.")
__version__ = read_version()
def get_conda_path(): def get_conda_path():
@@ -67,6 +68,9 @@ setup(
description='Detector API for SLS Detector Group detectors', description='Detector API for SLS Detector Group detectors',
long_description='', long_description='',
packages=find_packages(exclude=['contrib', 'docs', 'tests']), packages=find_packages(exclude=['contrib', 'docs', 'tests']),
package_data={
'slsdet': ['VERSION'],
},
ext_modules=ext_modules, ext_modules=ext_modules,
cmdclass={"build_ext": build_ext}, cmdclass={"build_ext": build_ext},
zip_safe=False, zip_safe=False,

View File

@@ -22,6 +22,7 @@ defs = _slsdet.slsDetectorDefs
from .enums import * from .enums import *
from .defines import * from .defines import *
IpAddr = _slsdet.IpAddr IpAddr = _slsdet.IpAddr
MacAddr = _slsdet.MacAddr MacAddr = _slsdet.MacAddr
scanParameters = _slsdet.scanParameters scanParameters = _slsdet.scanParameters
@@ -29,12 +30,14 @@ currentSrcParameters = _slsdet.currentSrcParameters
DurationWrapper = _slsdet.DurationWrapper DurationWrapper = _slsdet.DurationWrapper
pedestalParameters = _slsdet.pedestalParameters pedestalParameters = _slsdet.pedestalParameters
import os
import subprocess def read_version():
def get_git_tag():
try: try:
return subprocess.check_output(['git', 'describe', '--tags', '--abbrev=0']).strip().decode('utf-8') version_file = os.path.join(os.path.dirname(__file__), 'VERSION')
except subprocess.CalledProcessError: with open(version_file, "r") as f:
return 'developer' return f.read().strip()
__version__ = get_git_tag() except:
raise RuntimeError("VERSION file not found in slsdet package from init.py")
__version__ = read_version()

View File

@@ -24,7 +24,7 @@ class JungfrauDacs(DetectorDacs):
('vdd_prot', dacIndex.VDD_PROT, 0, 4000, 3000), ('vdd_prot', dacIndex.VDD_PROT, 0, 4000, 3000),
('vin_com', dacIndex.VIN_COM, 0, 4000, 1053), ('vin_com', dacIndex.VIN_COM, 0, 4000, 1053),
('vref_prech', dacIndex.VREF_PRECH, 0, 4000, 1450), ('vref_prech', dacIndex.VREF_PRECH, 0, 4000, 1450),
('vb_pixbuff', dacIndex.VB_PIXBUF, 0, 4000, 750), ('vb_pixbuf', dacIndex.VB_PIXBUF, 0, 4000, 750),
('vb_ds', dacIndex.VB_DS, 0, 4000, 1000), ('vb_ds', dacIndex.VB_DS, 0, 4000, 1000),
('vref_ds', dacIndex.VREF_DS, 0, 4000, 480), ('vref_ds', dacIndex.VREF_DS, 0, 4000, 480),
('vref_comp', dacIndex.VREF_COMP, 0, 4000, 420), ('vref_comp', dacIndex.VREF_COMP, 0, 4000, 420),

View File

@@ -51,12 +51,12 @@ int dataBytes = 0;
int analogDataBytes = 0; int analogDataBytes = 0;
int digitalDataBytes = 0; int digitalDataBytes = 0;
int transceiverDataBytes = 0; int transceiverDataBytes = 0;
char *analogData = 0; char *analogData = NULL;
char *digitalData = 0; char *digitalData = NULL;
char *transceiverData = 0; char *transceiverData = NULL;
char volatile *analogDataPtr = 0; char volatile *analogDataPtr = NULL;
char volatile *digitalDataPtr = 0; char volatile *digitalDataPtr = NULL;
char volatile *transceiverDataPtr = 0; char volatile *transceiverDataPtr = NULL;
char udpPacketData[UDP_PACKET_DATA_BYTES + sizeof(sls_detector_header)]; char udpPacketData[UDP_PACKET_DATA_BYTES + sizeof(sls_detector_header)];
uint32_t adcEnableMask_1g = BIT32_MSK; uint32_t adcEnableMask_1g = BIT32_MSK;
// 10g readout // 10g readout
@@ -475,21 +475,15 @@ void setupDetector() {
analogDataBytes = 0; analogDataBytes = 0;
digitalDataBytes = 0; digitalDataBytes = 0;
transceiverDataBytes = 0; transceiverDataBytes = 0;
if (analogData) { free(analogData);
free(analogData); analogData = NULL;
analogData = 0; free(digitalData);
} digitalData = NULL;
if (digitalData) { free(transceiverData);
free(digitalData); transceiverData = NULL;
digitalData = 0; analogDataPtr = NULL;
} digitalDataPtr = NULL;
if (transceiverData) { transceiverData = NULL;
free(transceiverData);
transceiverData = 0;
}
analogDataPtr = 0;
digitalDataPtr = 0;
transceiverData = 0;
{ {
for (int i = 0; i < NUM_CLOCKS; ++i) { for (int i = 0; i < NUM_CLOCKS; ++i) {
clkPhase[i] = 0; clkPhase[i] = 0;
@@ -640,22 +634,15 @@ int updateDatabytesandAllocateRAM() {
return FAIL; return FAIL;
} }
// clear RAM // clear RAM
if (analogData) { free(analogData);
free(analogData); analogData = NULL;
analogData = 0; free(digitalData);
} digitalData = NULL;
if (digitalData) { free(transceiverData);
free(digitalData); transceiverData = NULL;
digitalData = 0;
}
if (transceiverData) {
free(transceiverData);
transceiverData = 0;
}
// allocate RAM // allocate RAM
if (analogDataBytes) { if (analogDataBytes) {
analogData = malloc(analogDataBytes); analogData = malloc(analogDataBytes);
// cannot malloc
if (analogData == NULL) { if (analogData == NULL) {
LOG(logERROR, ("Can not allocate analog data RAM for even 1 frame. " LOG(logERROR, ("Can not allocate analog data RAM for even 1 frame. "
"Probable cause: Memory Leak.\n")); "Probable cause: Memory Leak.\n"));
@@ -665,7 +652,6 @@ int updateDatabytesandAllocateRAM() {
} }
if (digitalDataBytes) { if (digitalDataBytes) {
digitalData = malloc(digitalDataBytes); digitalData = malloc(digitalDataBytes);
// cannot malloc
if (digitalData == NULL) { if (digitalData == NULL) {
LOG(logERROR, LOG(logERROR,
("Can not allocate digital data RAM for even 1 frame. " ("Can not allocate digital data RAM for even 1 frame. "
@@ -677,7 +663,6 @@ int updateDatabytesandAllocateRAM() {
} }
if (transceiverDataBytes) { if (transceiverDataBytes) {
transceiverData = malloc(transceiverDataBytes); transceiverData = malloc(transceiverDataBytes);
// cannot malloc
if (transceiverData == NULL) { if (transceiverData == NULL) {
LOG(logERROR, LOG(logERROR,
("Can not allocate transceiver data RAM for even 1 frame. " ("Can not allocate transceiver data RAM for even 1 frame. "

View File

@@ -46,17 +46,27 @@ int Beb_deactivated_left_datastream = 1;
int Beb_deactivated_right_datastream = 1; int Beb_deactivated_right_datastream = 1;
int Beb_deactivated_num_destinations = 1; int Beb_deactivated_num_destinations = 1;
void Beb_Beb() { int Beb_Beb() {
Beb_send_ndata = 0; Beb_send_ndata = 0;
Beb_send_buffer_size = 1026; Beb_send_buffer_size = 1026;
Beb_send_data_raw = Beb_send_data_raw =
malloc((Beb_send_buffer_size + 1) * sizeof(unsigned int)); malloc((Beb_send_buffer_size + 1) * sizeof(unsigned int));
if (Beb_send_data_raw == NULL) {
LOG(logERROR, ("Could not allocate memory for beb (send_data_raw)\n"));
return 0;
}
Beb_send_data = &Beb_send_data_raw[1]; Beb_send_data = &Beb_send_data_raw[1];
Beb_recv_ndata = 0; Beb_recv_ndata = 0;
Beb_recv_buffer_size = 1026; Beb_recv_buffer_size = 1026;
Beb_recv_data_raw = Beb_recv_data_raw =
malloc((Beb_recv_buffer_size + 1) * sizeof(unsigned int)); malloc((Beb_recv_buffer_size + 1) * sizeof(unsigned int));
if (Beb_recv_data_raw == NULL) {
LOG(logERROR, ("Could not allocate memory for beb (recv_data_raw)\n"));
return 0;
}
Beb_recv_data = &Beb_recv_data_raw[1]; Beb_recv_data = &Beb_recv_data_raw[1];
udp_header = (struct udp_header_type){ udp_header = (struct udp_header_type){
@@ -83,6 +93,7 @@ void Beb_Beb() {
Beb_ClearHeaderData(1); Beb_ClearHeaderData(1);
Beb_bit_mode = 4; Beb_bit_mode = 4;
return 1;
} }
void Beb_ClearHeaderData(int ten_gig) { void Beb_ClearHeaderData(int ten_gig) {

View File

@@ -6,7 +6,7 @@
#include "slsDetectorServer_defs.h" #include "slsDetectorServer_defs.h"
#include <stdlib.h> #include <stdlib.h>
void Beb_Beb(); int Beb_Beb();
void Beb_ClearHeaderData(int ten_gig); void Beb_ClearHeaderData(int ten_gig);
int Beb_SetUpUDPHeader(unsigned int header_number, int ten_gig, int Beb_SetUpUDPHeader(unsigned int header_number, int ten_gig,
uint64_t src_mac, uint32_t src_ip, uint16_t src_port, uint64_t src_mac, uint32_t src_ip, uint16_t src_port,

View File

@@ -57,11 +57,19 @@ int Feb_Control_FebControl(int normal) {
Feb_Control_externalEnableMode = 0; Feb_Control_externalEnableMode = 0;
Feb_Control_subFrameMode = 0; Feb_Control_subFrameMode = 0;
Feb_Control_trimbit_size = 263680; Feb_Control_trimbit_size = 263680;
Feb_Control_last_downloaded_trimbits = Feb_Control_last_downloaded_trimbits =
malloc(Feb_Control_trimbit_size * sizeof(int)); malloc(Feb_Control_trimbit_size * sizeof(int));
if (Feb_Control_last_downloaded_trimbits == NULL) {
LOG(logERROR,
("Could not allocate memory for last downloaded trimbits\n"));
return 0;
}
Feb_Control_normal = normal; Feb_Control_normal = normal;
Feb_Interface_SetAddress(Feb_Control_rightAddress, Feb_Control_leftAddress); if (!Feb_Interface_SetAddress(Feb_Control_rightAddress,
Feb_Control_leftAddress))
return 0;
if (Feb_Control_activated) { if (Feb_Control_activated) {
return Feb_Interface_SetByteOrder(); return Feb_Interface_SetByteOrder();
} }

View File

@@ -22,34 +22,57 @@ unsigned int Feb_Interface_recv_buffer_size;
unsigned int *Feb_Interface_recv_data_raw; unsigned int *Feb_Interface_recv_data_raw;
unsigned int *Feb_Interface_recv_data; unsigned int *Feb_Interface_recv_data;
void Feb_Interface_FebInterface() { int Feb_Interface_FebInterface() {
ll = &ll_local; ll = &ll_local;
Feb_Interface_nfebs = 0; Feb_Interface_nfebs = 0;
Feb_Interface_feb_numb = 0; Feb_Interface_feb_numb = 0;
Feb_Interface_send_ndata = 0; Feb_Interface_send_ndata = 0;
Feb_Interface_send_buffer_size = 1026; Feb_Interface_send_buffer_size = 1026;
Feb_Interface_send_data_raw = Feb_Interface_send_data_raw =
malloc((Feb_Interface_send_buffer_size + 1) * sizeof(unsigned int)); malloc((Feb_Interface_send_buffer_size + 1) * sizeof(unsigned int));
if (Feb_Interface_send_data_raw == NULL) {
LOG(logERROR,
("Could not allocate memory for feb interface (send_data_raw)\n"));
return 0;
}
Feb_Interface_send_data = &Feb_Interface_send_data_raw[1]; Feb_Interface_send_data = &Feb_Interface_send_data_raw[1];
Feb_Interface_recv_ndata = 0; Feb_Interface_recv_ndata = 0;
Feb_Interface_recv_buffer_size = 1026; Feb_Interface_recv_buffer_size = 1026;
Feb_Interface_recv_data_raw = Feb_Interface_recv_data_raw =
malloc((Feb_Interface_recv_buffer_size + 1) * sizeof(unsigned int)); malloc((Feb_Interface_recv_buffer_size + 1) * sizeof(unsigned int));
if (Feb_Interface_recv_data_raw == NULL) {
LOG(logERROR,
("Could not allocate memory for feb interface (recv_data_raw)\n"));
return 0;
}
Feb_Interface_recv_data = &Feb_Interface_recv_data_raw[1]; Feb_Interface_recv_data = &Feb_Interface_recv_data_raw[1];
Local_LocalLinkInterface( Local_LocalLinkInterface(
ll, XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_RIGHT_BASEADDR); ll, XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_RIGHT_BASEADDR);
return 1;
} }
void Feb_Interface_SetAddress(unsigned int leftAddr, unsigned int rightAddr) { int Feb_Interface_SetAddress(unsigned int leftAddr, unsigned int rightAddr) {
if (Feb_Interface_feb_numb) free(Feb_Interface_feb_numb);
free(Feb_Interface_feb_numb);
Feb_Interface_nfebs = 2; Feb_Interface_nfebs = 2;
Feb_Interface_feb_numb = malloc(2 * sizeof(unsigned int)); Feb_Interface_feb_numb = malloc(2 * sizeof(unsigned int));
if (Feb_Interface_feb_numb == NULL) {
LOG(logERROR,
("Could not allocate memory for feb interface (feb_numb)\n"));
Feb_Interface_nfebs = 0;
return 0;
}
Feb_Interface_feb_numb[0] = leftAddr; Feb_Interface_feb_numb[0] = leftAddr;
Feb_Interface_feb_numb[1] = rightAddr; Feb_Interface_feb_numb[1] = rightAddr;
return 1;
} }
int Feb_Interface_WriteTo(unsigned int ch) { int Feb_Interface_WriteTo(unsigned int ch) {

View File

@@ -4,8 +4,8 @@
int Feb_Interface_WriteTo(unsigned int ch); int Feb_Interface_WriteTo(unsigned int ch);
int Feb_Interface_ReadFrom(unsigned int ch, unsigned int ntrys); int Feb_Interface_ReadFrom(unsigned int ch, unsigned int ntrys);
void Feb_Interface_FebInterface(); int Feb_Interface_FebInterface();
void Feb_Interface_SetAddress(unsigned int leftAddr, unsigned int rightAddr); int Feb_Interface_SetAddress(unsigned int leftAddr, unsigned int rightAddr);
int Feb_Interface_SetByteOrder(); int Feb_Interface_SetByteOrder();
int Feb_Interface_ReadRegister(unsigned int sub_num, unsigned int reg_num, int Feb_Interface_ReadRegister(unsigned int sub_num, unsigned int reg_num,
unsigned int *value_read); unsigned int *value_read);

View File

@@ -662,7 +662,15 @@ int checkCommandLineConfiguration() {
#ifndef VIRTUAL #ifndef VIRTUAL
void setupFebBeb() { void setupFebBeb() {
sharedMemory_lockLocalLink(); sharedMemory_lockLocalLink();
Feb_Interface_FebInterface(); if (!Feb_Interface_FebInterface()) {
initError = FAIL;
sprintf(initErrorMessage,
"Could not intitalize eiger detector sever: feb interface\n");
LOG(logERROR, (initErrorMessage));
initCheckDone = 1;
sharedMemory_unlockLocalLink();
return;
}
if (!Feb_Control_FebControl(normal)) { if (!Feb_Control_FebControl(normal)) {
initError = FAIL; initError = FAIL;
sprintf(initErrorMessage, sprintf(initErrorMessage,
@@ -686,7 +694,14 @@ void setupFebBeb() {
LOG(logDEBUG1, ("%s server: FEB Initialization done\n", LOG(logDEBUG1, ("%s server: FEB Initialization done\n",
isControlServer ? "Control" : "Stop")); isControlServer ? "Control" : "Stop"));
Beb_SetTopVariable(top); Beb_SetTopVariable(top);
Beb_Beb(); if (!Beb_Beb()) {
initError = FAIL;
sprintf(initErrorMessage,
"Could not intitalize eiger detector sever: beb\n");
LOG(logERROR, (initErrorMessage));
initCheckDone = 1;
return;
}
LOG(logDEBUG1, ("%s server: BEB Initialization done\n", LOG(logDEBUG1, ("%s server: BEB Initialization done\n",
isControlServer ? "Control" : "Stop")); isControlServer ? "Control" : "Stop"));
@@ -724,17 +739,23 @@ void setupFebBeb() {
} }
#endif #endif
void allocateDetectorStructureMemory() { int allocateDetectorStructureMemory() {
LOG(logINFO, ("This Server is for 1 Eiger half module (250k)\n\n"));
// Allocation of memory
detectorModules = malloc(sizeof(sls_detector_module)); detectorModules = malloc(sizeof(sls_detector_module));
detectorChans = malloc(NCHIP * NCHAN * sizeof(int)); detectorChans = malloc(NCHIP * NCHAN * sizeof(int));
detectorDacs = malloc(NDAC * sizeof(int)); detectorDacs = malloc(NDAC * sizeof(int));
if (detectorModules == NULL || detectorChans == NULL ||
detectorDacs == NULL) {
initError = FAIL;
strcpy(initErrorMessage,
"Could not allocate memory for dacs or channels in detector\n");
LOG(logERROR, (initErrorMessage));
return FAIL;
}
LOG(logDEBUG1, LOG(logDEBUG1,
("modules from 0x%x to 0x%x\n", detectorModules, detectorModules)); ("modules from 0x%x to 0x%x\n", detectorModules, detectorModules));
LOG(logDEBUG1, ("chans from 0x%x to 0x%x\n", detectorChans, detectorChans)); LOG(logDEBUG1, ("chans from 0x%x to 0x%x\n", detectorChans, detectorChans));
LOG(logDEBUG1, ("dacs from 0x%x to 0x%x\n", detectorDacs, detectorDacs)); LOG(logDEBUG1, ("dacs from 0x%x to 0x%x\n", detectorDacs, detectorDacs));
detectorModules->dacs = detectorDacs; detectorModules->dacs = detectorDacs;
detectorModules->chanregs = detectorChans; detectorModules->chanregs = detectorChans;
detectorModules->ndac = NDAC; detectorModules->ndac = NDAC;
@@ -748,14 +769,21 @@ void allocateDetectorStructureMemory() {
detectorModules->eV[2] = -1; detectorModules->eV[2] = -1;
thisSettings = UNINITIALIZED; thisSettings = UNINITIALIZED;
// if trimval requested, should return -1 to acknowledge unknown // initialize (trimbits at -1 for unknown)
for (int idac = 0; idac < (detectorModules)->ndac; ++idac) {
detectorDacs[idac] = 0;
}
for (int ichan = 0; ichan < (detectorModules->nchan); ichan++) { for (int ichan = 0; ichan < (detectorModules->nchan); ichan++) {
*((detectorModules->chanregs) + ichan) = -1; *((detectorModules->chanregs) + ichan) = -1;
} }
return OK;
} }
void setupDetector() { void setupDetector() {
allocateDetectorStructureMemory(); LOG(logINFO, ("This Server is for 1 Eiger half module (250k)\n\n"));
if (allocateDetectorStructureMemory() == FAIL)
return;
// force top or master if in config file // force top or master if in config file
if (readConfigFile() == FAIL) if (readConfigFile() == FAIL)

View File

@@ -3326,11 +3326,12 @@ int *getBadChannels(int *numChannels) {
if (*numChannels > 0) { if (*numChannels > 0) {
// get list of bad channels // get list of bad channels
retvals = malloc(*numChannels * sizeof(int)); retvals = malloc(*numChannels * sizeof(int));
memset(retvals, 0, *numChannels * sizeof(int));
if (retvals == NULL) { if (retvals == NULL) {
LOG(logERROR, ("Could not allocate memory to get bad channels\n"));
*numChannels = -1; *numChannels = -1;
return NULL; return NULL;
} }
memset(retvals, 0, *numChannels * sizeof(int));
int chIndex = 0; int chIndex = 0;
int numAddr = MASK_STRIP_NUM_REGS; int numAddr = MASK_STRIP_NUM_REGS;
// loop through registers // loop through registers

View File

@@ -555,6 +555,7 @@ void setupDetector() {
setNextFrameNumber(DEFAULT_STARTING_FRAME_NUMBER); setNextFrameNumber(DEFAULT_STARTING_FRAME_NUMBER);
// temp threshold and reset event // temp threshold and reset event
setTemperatureControl(DEFAULT_TMP_CNTRL);
setThresholdTemperature(DEFAULT_TMP_THRSHLD); setThresholdTemperature(DEFAULT_TMP_THRSHLD);
setTemperatureEvent(0); setTemperatureEvent(0);
if (getChipVersion() == 11) { if (getChipVersion() == 11) {
@@ -2254,7 +2255,6 @@ int setThresholdTemperature(int val) {
double ftemp = (double)temp / 1000.00; double ftemp = (double)temp / 1000.00;
LOG(logDEBUG1, ("Threshold Temperature read %f °C\n", ftemp)); LOG(logDEBUG1, ("Threshold Temperature read %f °C\n", ftemp));
return temp; return temp;
} }
@@ -2791,9 +2791,9 @@ void *start_timer(void *arg) {
} }
if ((i % 1024) < 300) { if ((i % 1024) < 300) {
gainVal = 1; gainVal = 0;
} else if ((i % 1024) < 600) { } else if ((i % 1024) < 600) {
gainVal = 2; gainVal = 1;
} else { } else {
gainVal = 3; gainVal = 3;
} }
@@ -2830,17 +2830,29 @@ void *start_timer(void *arg) {
clock_gettime(CLOCK_REALTIME, &begin); clock_gettime(CLOCK_REALTIME, &begin);
usleep(expUs); usleep(expUs);
#ifdef TEST_CHANGE_GAIN_EVERY_FRAME
// change gain and data for every frame // change gain and data for every frame
{ {
const int npixels = (NCHAN * NCHIP); const int npixels = (NCHAN * NCHIP);
// random gain values, 2 becomes 3 as 2 is invalid
int randomGainValues[3] = {0};
srand(time(0));
for (int i = 0; i != 3; ++i) {
int r = rand() % 3;
if (r == 2)
r = 3;
randomGainValues[i] = r;
}
for (int i = 0; i < npixels; ++i) { for (int i = 0; i < npixels; ++i) {
int gainVal = 0; int gainVal = 0;
if ((i % 1024) < 300) { if ((i % 1024) < 300) {
gainVal = 1 + iframes; gainVal = randomGainValues[0];
} else if ((i % 1024) < 600) { } else if ((i % 1024) < 600) {
gainVal = 2 + iframes; gainVal = randomGainValues[1];
} else { } else {
gainVal = 3 + iframes; gainVal = randomGainValues[2];
} }
int dataVal = int dataVal =
*((uint16_t *)(imageData + i * sizeof(uint16_t))); *((uint16_t *)(imageData + i * sizeof(uint16_t)));
@@ -2851,7 +2863,7 @@ void *start_timer(void *arg) {
(uint16_t)pixelVal; (uint16_t)pixelVal;
} }
} }
#endif
int srcOffset = 0; int srcOffset = 0;
int srcOffset2 = DATA_BYTES / 2; int srcOffset2 = DATA_BYTES / 2;
int row0 = (numInterfaces == 1 ? detPos[1] : detPos[3]); int row0 = (numInterfaces == 1 ? detPos[1] : detPos[3]);

View File

@@ -48,6 +48,7 @@
#define DEFAULT_SETTINGS (GAIN0) #define DEFAULT_SETTINGS (GAIN0)
#define DEFAULT_GAINMODE (DYNAMIC) #define DEFAULT_GAINMODE (DYNAMIC)
#define DEFAULT_TX_UDP_PORT (0x7e9a) #define DEFAULT_TX_UDP_PORT (0x7e9a)
#define DEFAULT_TMP_CNTRL (1)
#define DEFAULT_TMP_THRSHLD (65 * 1000) // milli degree Celsius #define DEFAULT_TMP_THRSHLD (65 * 1000) // milli degree Celsius
#define DEFAULT_NUM_STRG_CLLS (0) #define DEFAULT_NUM_STRG_CLLS (0)
#define DEFAULT_STRG_CLL_STRT (0xf) #define DEFAULT_STRG_CLL_STRT (0xf)

View File

@@ -404,18 +404,24 @@ void initStopServer() {
/* set up detector */ /* set up detector */
void allocateDetectorStructureMemory() { int allocateDetectorStructureMemory() {
// Allocation of memory
detectorModules = malloc(sizeof(sls_detector_module)); detectorModules = malloc(sizeof(sls_detector_module));
detectorChans = malloc(NCHAN_PER_MODULE * sizeof(int)); detectorChans = malloc(NCHAN_PER_MODULE * sizeof(int));
badChannelMask = malloc(NCHAN_PER_MODULE * sizeof(char));
memset(badChannelMask, 0, NCHAN_PER_MODULE * sizeof(char));
detectorDacs = malloc(NDAC * sizeof(int)); detectorDacs = malloc(NDAC * sizeof(int));
badChannelMask = malloc(NCHAN_PER_MODULE * sizeof(char));
if (detectorModules == NULL || detectorChans == NULL ||
detectorDacs == NULL || badChannelMask == NULL) {
initError = FAIL;
strcpy(initErrorMessage, "Could not allocate memory for dacs, channels "
"or bad channel mask in detector\n");
LOG(logERROR, (initErrorMessage));
return FAIL;
}
LOG(logDEBUG1, LOG(logDEBUG1,
("modules from 0x%x to 0x%x\n", detectorModules, detectorModules)); ("modules from 0x%x to 0x%x\n", detectorModules, detectorModules));
LOG(logDEBUG1, ("chans from 0x%x to 0x%x\n", detectorChans, detectorChans)); LOG(logDEBUG1, ("chans from 0x%x to 0x%x\n", detectorChans, detectorChans));
LOG(logDEBUG1, ("dacs from 0x%x to 0x%x\n", detectorDacs, detectorDacs)); LOG(logDEBUG1, ("dacs from 0x%x to 0x%x\n", detectorDacs, detectorDacs));
(detectorModules)->dacs = detectorDacs; (detectorModules)->dacs = detectorDacs;
(detectorModules)->chanregs = detectorChans; (detectorModules)->chanregs = detectorChans;
(detectorModules)->ndac = NDAC; (detectorModules)->ndac = NDAC;
@@ -429,21 +435,22 @@ void allocateDetectorStructureMemory() {
(detectorModules)->eV[2] = 0; (detectorModules)->eV[2] = 0;
thisSettings = UNINITIALIZED; thisSettings = UNINITIALIZED;
// initialize dacs // initialize
for (int idac = 0; idac < (detectorModules)->ndac; ++idac) { for (int idac = 0; idac < (detectorModules)->ndac; ++idac) {
detectorDacs[idac] = 0; detectorDacs[idac] = 0;
} }
// trimbits start at 0
for (int ichan = 0; ichan < (detectorModules->nchan); ichan++) { for (int ichan = 0; ichan < (detectorModules->nchan); ichan++) {
*((detectorModules->chanregs) + ichan) = 0; *((detectorModules->chanregs) + ichan) = 0;
} }
memset(badChannelMask, 0, NCHAN_PER_MODULE * sizeof(char));
return OK;
} }
void setupDetector() { void setupDetector() {
LOG(logINFO, ("This Server is for 1 Mythen3 module \n")); LOG(logINFO, ("This Server is for 1 Mythen3 module \n"));
allocateDetectorStructureMemory(); if (allocateDetectorStructureMemory() == FAIL)
return;
if (checkCommandLineConfiguration() == FAIL) if (checkCommandLineConfiguration() == FAIL)
return; return;
@@ -1412,6 +1419,10 @@ int setTrimbits(int *trimbits) {
int setAllTrimbits(int val) { int setAllTrimbits(int val) {
LOG(logINFO, ("Setting all trimbits to %d\n", val)); LOG(logINFO, ("Setting all trimbits to %d\n", val));
int *trimbits = malloc(sizeof(int) * ((detectorModules)->nchan)); int *trimbits = malloc(sizeof(int) * ((detectorModules)->nchan));
if (trimbits == NULL) {
LOG(logERROR, ("Could not allocate memory to set all trimbits\n"));
return FAIL;
}
for (int ichan = 0; ichan < ((detectorModules)->nchan); ++ichan) { for (int ichan = 0; ichan < ((detectorModules)->nchan); ++ichan) {
trimbits[ichan] = val; trimbits[ichan] = val;
} }
@@ -2469,11 +2480,12 @@ int *getBadChannels(int *numChannels) {
} }
if (*numChannels > 0) { if (*numChannels > 0) {
retvals = malloc(*numChannels * sizeof(int)); retvals = malloc(*numChannels * sizeof(int));
memset(retvals, 0, *numChannels * sizeof(int));
if (retvals == NULL) { if (retvals == NULL) {
LOG(logERROR, ("Could not allocate memory to get bad channels\n"));
*numChannels = -1; *numChannels = -1;
return NULL; return NULL;
} }
memset(retvals, 0, *numChannels * sizeof(int));
// return only 1 channel for all counters // return only 1 channel for all counters
int ich = 0; int ich = 0;
for (int i = 0; i != NCHAN_PER_MODULE; i = i + NCOUNTERS) { for (int i = 0; i != NCHAN_PER_MODULE; i = i + NCOUNTERS) {

View File

@@ -3,7 +3,7 @@
#pragma once #pragma once
#include "sls/sls_detector_defs.h" #include "sls/sls_detector_defs.h"
#define REQRD_FRMWRE_VRSN (0x230124) #define REQRD_FRMWRE_VRSN (0x241113)
#define KERNEL_DATE_VRSN "Mon May 10 18:00:21 CEST 2021" #define KERNEL_DATE_VRSN "Mon May 10 18:00:21 CEST 2021"
#define ID_FILE "detid_mythen3.txt" #define ID_FILE "detid_mythen3.txt"

View File

@@ -140,7 +140,7 @@ void checkVirtual9MFlag();
void setupFebBeb(); void setupFebBeb();
#endif #endif
#if defined(EIGERD) || defined(MYTHEN3D) #if defined(EIGERD) || defined(MYTHEN3D)
void allocateDetectorStructureMemory(); int allocateDetectorStructureMemory();
#endif #endif
void setupDetector(); void setupDetector();
#if defined(CHIPTESTBOARDD) #if defined(CHIPTESTBOARDD)

View File

@@ -11,6 +11,8 @@
// initialization functions // initialization functions
int updateModeAllowedFunction(int file_des); int updateModeAllowedFunction(int file_des);
int printSocketReadError(); int printSocketReadError();
int sendError(int file_des);
void setMemoryAllocationErrorMessage();
void init_detector(); void init_detector();
int decode_function(int); int decode_function(int);
const char *getRetName(); const char *getRetName();

View File

@@ -590,13 +590,16 @@ int Server_SendResult(int fileDes, intType itype, void *retval,
sendData(fileDes, &ret1, sizeof(ret1), INT32); sendData(fileDes, &ret1, sizeof(ret1), INT32);
if (ret == FAIL) { if (ret == FAIL) {
// send error message // send error message
if (strlen(mess)) if (strlen(mess)) {
sendData(fileDes, mess, MAX_STR_LENGTH, OTHER); sendData(fileDes, mess, MAX_STR_LENGTH, OTHER);
usleep(0); // test
}
// debugging feature. should not happen. // debugging feature. should not happen.
else else {
LOG(logERROR, ("No error message provided for this failure in %s " LOG(logERROR, ("No error message provided for this failure in %s "
"server. Will mess up TCP.\n", "server. Will mess up TCP.\n",
(isControlServer ? "control" : "stop"))); (isControlServer ? "control" : "stop")));
}
} }
// send return value // send return value
sendData(fileDes, retval, retvalSize, itype); sendData(fileDes, retval, retvalSize, itype);

View File

@@ -115,6 +115,28 @@ int printSocketReadError() {
return FAIL; return FAIL;
} }
int sendError(int file_des) {
ret = FAIL;
LOG(logERROR, (mess));
Server_SendResult(file_des, INT32, NULL, 0);
return ret;
}
void setMemoryAllocationErrorMessage() {
struct sysinfo info;
sysinfo(&info);
sprintf(
mess,
"Memory allocation error (%s). Available space: %d MB. Please reboot",
getFunctionNameFromEnum((enum detFuncs)fnum),
(int)(info.freeram / (1024 * 1024)));
#ifdef EIGERD
strcat(mess, ".\n");
#else
strcat(mess, " using sls_detector_put rebootcontroller.\n");
#endif
}
void init_detector() { void init_detector() {
memset(udpDetails, 0, sizeof(udpDetails)); memset(udpDetails, 0, sizeof(udpDetails));
#ifdef VIRTUAL #ifdef VIRTUAL
@@ -1728,67 +1750,45 @@ int get_module(int file_des) {
ret = OK; ret = OK;
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));
sls_detector_module module;
int *myDac = NULL;
int *myChan = NULL;
module.dacs = NULL;
module.chanregs = NULL;
#if !defined(MYTHEN3D) && !defined(EIGERD) #if !defined(MYTHEN3D) && !defined(EIGERD)
functionNotImplemented(); functionNotImplemented();
return Server_SendResult(file_des, INT32, NULL, 0);
#else #else
int ndac = getNumberOfDACs();
// allocate to receive module structure int nchan = getTotalNumberOfChannels();
// allocate dacs if (ndac <= 0 || nchan <= 0) {
myDac = malloc(getNumberOfDACs() * sizeof(int)); strcpy(mess, "Invalid number of dacs/channels to set module\n");
// error return sendError(file_des);
if (getNumberOfDACs() > 0 && myDac == NULL) {
ret = FAIL;
sprintf(mess, "Could not allocate dacs\n");
LOG(logERROR, (mess));
} else
module.dacs = myDac;
// allocate chans
if (ret == OK) {
myChan = malloc(getTotalNumberOfChannels() * sizeof(int));
if (getTotalNumberOfChannels() > 0 && myChan == NULL) {
ret = FAIL;
strcpy(mess, "Could not allocate chans\n");
LOG(logERROR, (mess));
} else
module.chanregs = myChan;
} }
// receive module structure sls_detector_module module;
if (ret == OK) { module.dacs = NULL;
module.nchip = getNumberOfChips(); module.chanregs = NULL;
module.nchan = getTotalNumberOfChannels(); int *myDac = malloc(ndac * sizeof(int));
module.ndac = getNumberOfDACs(); int *myChan = malloc(nchan * sizeof(int));
if (myDac == NULL || myChan == NULL) {
// ensure nchan is not 0, else trimbits not copied
if (module.nchan == 0) {
strcpy(mess, "Could not get module as the number of channels to "
"copy is 0\n");
LOG(logERROR, (mess));
return FAIL;
}
getModule(&module);
}
#endif
Server_SendResult(file_des, INT32, NULL, 0);
if (ret != FAIL) {
if (sendModule(file_des, &module) < 0) {
ret = FAIL;
strcpy(mess, "Could not send module data\n");
LOG(logERROR, (mess));
}
}
if (myChan != NULL)
free(myChan);
if (myDac != NULL)
free(myDac); free(myDac);
free(myChan);
setMemoryAllocationErrorMessage();
return sendError(file_des);
}
module.dacs = myDac;
module.ndac = ndac;
module.chanregs = myChan;
module.nchan = nchan;
module.nchip = getNumberOfChips();
getModule(&module);
Server_SendResult(file_des, INT32, NULL, 0);
if (ret == OK && sendModule(file_des, &module) < 0) {
strcpy(mess, "Could not send module data\n");
ret = FAIL;
LOG(logERROR, (mess));
}
free(myChan);
free(myDac);
return ret; return ret;
#endif
} }
int set_module(int file_des) { int set_module(int file_des) {
@@ -1798,63 +1798,53 @@ int set_module(int file_des) {
#if !(defined(MYTHEN3D) || defined(EIGERD)) #if !(defined(MYTHEN3D) || defined(EIGERD))
functionNotImplemented(); functionNotImplemented();
#else #else
int ndac = getNumberOfDACs();
int nchan = getTotalNumberOfChannels();
if (ndac <= 0 || nchan <= 0) {
strcpy(mess, "Invalid number of dacs/channels to set module\n");
return sendError(file_des);
}
sls_detector_module module; sls_detector_module module;
int *myDac = NULL;
int *myChan = NULL;
module.dacs = NULL; module.dacs = NULL;
module.chanregs = NULL; module.chanregs = NULL;
int *myDac = malloc(ndac * sizeof(int));
// allocate to receive arguments int *myChan = malloc(nchan * sizeof(int));
// allocate dacs if (myDac == NULL || myChan == NULL) {
myDac = malloc(getNumberOfDACs() * sizeof(int)); free(myDac);
// error free(myChan);
if (getNumberOfDACs() > 0 && myDac == NULL) { setMemoryAllocationErrorMessage();
ret = FAIL; return sendError(file_des);
strcpy(mess, "Could not allocate dacs\n");
LOG(logERROR, (mess));
} else
module.dacs = myDac;
// allocate chans
if (ret == OK) {
myChan = malloc(getTotalNumberOfChannels() * sizeof(int));
if (getTotalNumberOfChannels() > 0 && myChan == NULL) {
ret = FAIL;
strcpy(mess, "Could not allocate chans\n");
LOG(logERROR, (mess));
} else
module.chanregs = myChan;
} }
// receive arguments module.dacs = myDac;
if (ret == OK) { module.ndac = ndac;
module.nchip = getNumberOfChips(); module.chanregs = myChan;
module.nchan = getTotalNumberOfChannels(); module.nchan = nchan;
module.ndac = getNumberOfDACs(); module.nchip = getNumberOfChips();
int ts = receiveModule(file_des, &module);
if (ts < 0) { int ts = receiveModule(file_des, &module);
free(myChan); if (ts < 0) {
free(myDac); free(myChan);
return printSocketReadError(); free(myDac);
} return printSocketReadError();
LOG(logDEBUG1, ("module register is %d, nchan %d, nchip %d, " }
"ndac %d, iodelay %d, tau %d, eV %d\n", LOG(logDEBUG1, ("module register is %d, nchan %d, nchip %d, "
module.reg, module.nchan, module.nchip, module.ndac, "ndac %d, iodelay %d, tau %d, eV %d\n",
module.iodelay, module.tau, module.eV[0])); module.reg, module.nchan, module.nchip, module.ndac,
// should at least have a dac module.iodelay, module.tau, module.eV[0]));
if (ts <= (int)sizeof(sls_detector_module)) { // should at least have a dac
ret = FAIL; if (ts <= (int)sizeof(sls_detector_module)) {
strcpy(mess, "Cannot set module. Received incorrect number of " strcpy(mess, "Cannot set module. Received incorrect number of "
"dacs or channels\n"); "dacs or channels\n");
LOG(logERROR, (mess)); free(myChan);
} free(myDac);
return sendError(file_des);
} }
// only set // only set
if (ret == OK && Server_VerifyLock() == OK) { if (Server_VerifyLock() == OK) {
// check index // check index
// setsettings
// setsettings
#ifndef MYTHEN3D #ifndef MYTHEN3D
// m3 uses reg for chip (not settings) // m3 uses reg for chip (not settings)
validate_settings((enum detectorSettings)(module.reg)); validate_settings((enum detectorSettings)(module.reg));
@@ -1867,10 +1857,8 @@ int set_module(int file_des) {
#endif #endif
LOG(logDEBUG1, ("Settings: %d\n", retval)); LOG(logDEBUG1, ("Settings: %d\n", retval));
} }
if (myChan != NULL) free(myChan);
free(myChan); free(myDac);
if (myDac != NULL)
free(myDac);
#endif #endif
return Server_SendResult(file_des, INT32, NULL, 0); return Server_SendResult(file_des, INT32, NULL, 0);
@@ -2957,6 +2945,7 @@ int get_frames_left(int file_des) {
retval = getNumFramesLeft(); retval = getNumFramesLeft();
LOG(logDEBUG1, ("retval num frames left %lld\n", (long long int)retval)); LOG(logDEBUG1, ("retval num frames left %lld\n", (long long int)retval));
#endif #endif
return Server_SendResult(file_des, INT64, &retval, sizeof(retval)); return Server_SendResult(file_des, INT64, &retval, sizeof(retval));
} }
@@ -6549,6 +6538,10 @@ int set_veto_photon(int file_des) {
ret = OK; ret = OK;
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));
#ifndef GOTTHARD2D
functionNotImplemented();
#else
int args[2] = {-1, -1}; int args[2] = {-1, -1};
if (receiveData(file_des, args, sizeof(args), INT32) < 0) if (receiveData(file_des, args, sizeof(args), INT32) < 0)
return printSocketReadError(); return printSocketReadError();
@@ -6556,14 +6549,17 @@ int set_veto_photon(int file_des) {
const int numChannels = args[1]; const int numChannels = args[1];
int *gainIndices = malloc(sizeof(int) * numChannels); int *gainIndices = malloc(sizeof(int) * numChannels);
if (receiveData(file_des, gainIndices, sizeof(int) * numChannels, INT32) < int *values = malloc(sizeof(int) * numChannels);
0) { if (gainIndices == NULL || values == NULL) {
free(gainIndices); free(gainIndices);
return printSocketReadError(); free(values);
setMemoryAllocationErrorMessage();
return sendError(file_des);
} }
int *values = malloc(sizeof(int) * numChannels); if ((receiveData(file_des, gainIndices, sizeof(int) * numChannels, INT32) <
if (receiveData(file_des, values, sizeof(int) * numChannels, INT32) < 0) { 0) ||
(receiveData(file_des, values, sizeof(int) * numChannels, INT32)) < 0) {
free(gainIndices); free(gainIndices);
free(values); free(values);
return printSocketReadError(); return printSocketReadError();
@@ -6572,9 +6568,6 @@ int set_veto_photon(int file_des) {
LOG(logINFO, ("Setting Veto Photon: [chipIndex:%d, nch:%d]\n", chipIndex, LOG(logINFO, ("Setting Veto Photon: [chipIndex:%d, nch:%d]\n", chipIndex,
numChannels)); numChannels));
#ifndef GOTTHARD2D
functionNotImplemented();
#else
// only set // only set
if (Server_VerifyLock() == OK) { if (Server_VerifyLock() == OK) {
if (numChannels != NCHAN) { if (numChannels != NCHAN) {
@@ -6621,66 +6614,60 @@ int set_veto_photon(int file_des) {
} }
} }
} }
free(gainIndices);
free(values);
#endif #endif
if (gainIndices != NULL) {
free(gainIndices);
}
if (values != NULL) {
free(values);
}
return Server_SendResult(file_des, INT32, NULL, 0); return Server_SendResult(file_des, INT32, NULL, 0);
} }
int get_veto_photon(int file_des) { int get_veto_photon(int file_des) {
ret = OK; ret = OK;
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));
int arg = -1;
int *retvals = NULL;
int *gainRetvals = NULL;
#ifndef GOTTHARD2D
functionNotImplemented();
return Server_SendResult(file_des, INT32, NULL, 0);
#else
int arg = -1;
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
return printSocketReadError(); return printSocketReadError();
LOG(logDEBUG1, ("Getting veto photon [chip Index:%d]\n", arg)); LOG(logDEBUG1, ("Getting veto photon [chip Index:%d]\n", arg));
#ifndef GOTTHARD2D int *retvals = malloc(sizeof(int) * NCHAN);
functionNotImplemented(); int *gainRetvals = malloc(sizeof(int) * NCHAN);
#else if (gainRetvals == NULL || retvals == NULL) {
retvals = malloc(sizeof(int) * NCHAN); free(gainRetvals);
gainRetvals = malloc(sizeof(int) * NCHAN); free(retvals);
setMemoryAllocationErrorMessage();
return sendError(file_des);
}
memset(retvals, 0, sizeof(int) * NCHAN); memset(retvals, 0, sizeof(int) * NCHAN);
memset(gainRetvals, 0, sizeof(int) * NCHAN); memset(gainRetvals, 0, sizeof(int) * NCHAN);
if (retvals == NULL || gainRetvals == NULL) { // get only
int chipIndex = arg;
if (chipIndex < -1 || chipIndex >= NCHIP) {
ret = FAIL; ret = FAIL;
strcpy( sprintf(mess, "Could not get veto photon. Invalid chip index %d\n",
mess, chipIndex);
"Could not get veto photon. Could not allocate memory in server\n");
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else { } else {
// get only ret = getVetoPhoton(chipIndex, retvals, gainRetvals);
int chipIndex = arg; if (ret == FAIL) {
if (chipIndex < -1 || chipIndex >= NCHIP) { strcpy(mess, "Could not get veto photon for chipIndex -1. Not the "
ret = FAIL; "same for all chips. Select specific chip index "
sprintf(mess, "Could not get veto photon. Invalid chip index %d\n", "instead.\n");
chipIndex);
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else { } else {
ret = getVetoPhoton(chipIndex, retvals, gainRetvals); for (int i = 0; i < NCHAN; ++i) {
if (ret == FAIL) { LOG(logDEBUG1,
strcpy(mess, ("%d:[%d, %d]\n", i, retvals[i], gainRetvals[i]));
"Could not get veto photon for chipIndex -1. Not the "
"same for all chips. Select specific chip index "
"instead.\n");
LOG(logERROR, (mess));
} else {
for (int i = 0; i < NCHAN; ++i) {
LOG(logDEBUG1,
("%d:[%d, %d]\n", i, retvals[i], gainRetvals[i]));
}
} }
} }
} }
#endif
Server_SendResult(file_des, INT32, NULL, 0); Server_SendResult(file_des, INT32, NULL, 0);
if (ret != FAIL) { if (ret != FAIL) {
int nch = NCHAN; int nch = NCHAN;
@@ -6688,13 +6675,10 @@ int get_veto_photon(int file_des) {
sendData(file_des, gainRetvals, sizeof(int) * NCHAN, INT32); sendData(file_des, gainRetvals, sizeof(int) * NCHAN, INT32);
sendData(file_des, retvals, sizeof(int) * NCHAN, INT32); sendData(file_des, retvals, sizeof(int) * NCHAN, INT32);
} }
if (retvals != NULL) { free(retvals);
free(retvals); free(gainRetvals);
}
if (gainRetvals != NULL) {
free(gainRetvals);
}
return ret; return ret;
#endif
} }
int set_veto_reference(int file_des) { int set_veto_reference(int file_des) {
@@ -7864,16 +7848,19 @@ int set_pattern(int file_des) {
functionNotImplemented(); functionNotImplemented();
#else #else
patternParameters *pat = malloc(sizeof(patternParameters)); patternParameters *pat = malloc(sizeof(patternParameters));
if (pat == NULL) {
setMemoryAllocationErrorMessage();
return sendError(file_des);
}
memset(pat, 0, sizeof(patternParameters)); memset(pat, 0, sizeof(patternParameters));
// ignoring endianness for eiger // ignoring endianness for eiger
if (receiveData(file_des, pat, sizeof(patternParameters), INT32) < 0) { if (receiveData(file_des, pat, sizeof(patternParameters), INT32) < 0) {
if (pat != NULL) free(pat);
free(pat);
return printSocketReadError(); return printSocketReadError();
} }
if (receiveData(file_des, args, MAX_STR_LENGTH, OTHER) < 0) { if (receiveData(file_des, args, MAX_STR_LENGTH, OTHER) < 0) {
if (pat != NULL) free(pat);
free(pat);
return printSocketReadError(); return printSocketReadError();
} }
@@ -7881,8 +7868,7 @@ int set_pattern(int file_des) {
LOG(logDEBUG1, ("Setting Pattern from structure\n")); LOG(logDEBUG1, ("Setting Pattern from structure\n"));
ret = loadPattern(mess, logINFO, pat, args); ret = loadPattern(mess, logINFO, pat, args);
} }
if (pat != NULL) free(pat);
free(pat);
#endif #endif
return Server_SendResult(file_des, INT32, NULL, 0); return Server_SendResult(file_des, INT32, NULL, 0);
@@ -7918,6 +7904,10 @@ int get_pattern(int file_des) {
#else #else
patternParameters *pat = malloc(sizeof(patternParameters)); patternParameters *pat = malloc(sizeof(patternParameters));
if (pat == NULL) {
setMemoryAllocationErrorMessage();
return sendError(file_des);
}
memset(pat, 0, sizeof(patternParameters)); memset(pat, 0, sizeof(patternParameters));
if (Server_VerifyLock() == OK) { if (Server_VerifyLock() == OK) {
@@ -7927,8 +7917,7 @@ int get_pattern(int file_des) {
// ignoring endianness for eiger // ignoring endianness for eiger
int ret = int ret =
Server_SendResult(file_des, INT32, pat, sizeof(patternParameters)); Server_SendResult(file_des, INT32, pat, sizeof(patternParameters));
if (pat != NULL) free(pat);
free(pat);
return ret; return ret;
#endif #endif
} }
@@ -8036,10 +8025,13 @@ int set_scan(int file_des) {
if (ret == OK) { if (ret == OK) {
scan = 1; scan = 1;
numScanSteps = (abs(stop - start) / abs(step)) + 1; numScanSteps = (abs(stop - start) / abs(step)) + 1;
if (scanSteps != NULL) { // freed only at startup of the next scan
free(scanSteps); free(scanSteps);
}
scanSteps = malloc(numScanSteps * sizeof(int)); scanSteps = malloc(numScanSteps * sizeof(int));
if (scanSteps == NULL) {
setMemoryAllocationErrorMessage();
return sendError(file_des);
}
for (int i = 0; i != numScanSteps; ++i) { for (int i = 0; i != numScanSteps; ++i) {
scanSteps[i] = start + i * step; scanSteps[i] = start + i * step;
LOG(logDEBUG1, ("scansteps[%d]:%d\n", i, scanSteps[i])); LOG(logDEBUG1, ("scansteps[%d]:%d\n", i, scanSteps[i]));
@@ -8313,55 +8305,54 @@ int set_adc_config(int file_des) {
int get_bad_channels(int file_des) { int get_bad_channels(int file_des) {
ret = OK; ret = OK;
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));
int nretvals = 0;
int *retvals = NULL;
LOG(logDEBUG1, ("Getting bad channels\n")); LOG(logDEBUG1, ("Getting bad channels\n"));
#if !defined(GOTTHARD2D) && !defined(MYTHEN3D) #if !defined(GOTTHARD2D) && !defined(MYTHEN3D)
functionNotImplemented(); functionNotImplemented();
return Server_SendResult(file_des, INT32, NULL, 0);
#else #else
// get only // get only
retvals = getBadChannels(&nretvals); int nretvals = 0;
int *retvals = getBadChannels(&nretvals);
if (nretvals == -1) { if (nretvals == -1) {
ret = FAIL; setMemoryAllocationErrorMessage();
strcpy(mess, "Could not get bad channels. Memory allcoation error\n"); return sendError(file_des);
LOG(logERROR, (mess));
} }
#endif
Server_SendResult(file_des, INT32, NULL, 0); Server_SendResult(file_des, INT32, NULL, 0);
if (ret != FAIL) { sendData(file_des, &nretvals, sizeof(nretvals), INT32);
sendData(file_des, &nretvals, sizeof(nretvals), INT32); if (nretvals > 0) {
if (nretvals > 0) { sendData(file_des, retvals, sizeof(int) * nretvals, INT32);
sendData(file_des, retvals, sizeof(int) * nretvals, INT32);
}
}
if (retvals != NULL) {
free(retvals);
} }
free(retvals);
return ret; return ret;
#endif
} }
int set_bad_channels(int file_des) { int set_bad_channels(int file_des) {
ret = OK; ret = OK;
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));
int nargs = 0;
int *args = NULL;
if (receiveData(file_des, &nargs, sizeof(nargs), INT32) < 0)
return printSocketReadError();
if (nargs > 0) {
args = malloc(nargs * sizeof(int));
if (receiveData(file_des, args, nargs * sizeof(int), INT32) < 0)
return printSocketReadError();
}
LOG(logDEBUG1, ("Setting %d bad channels\n", nargs));
#if !defined(GOTTHARD2D) && !defined(MYTHEN3D) #if !defined(GOTTHARD2D) && !defined(MYTHEN3D)
functionNotImplemented(); functionNotImplemented();
#else #else
int nargs = 0;
if (receiveData(file_des, &nargs, sizeof(nargs), INT32) < 0)
return printSocketReadError();
int *args = NULL;
if (nargs > 0) {
args = malloc(nargs * sizeof(int));
if (args == NULL) {
setMemoryAllocationErrorMessage();
return sendError(file_des);
}
if (receiveData(file_des, args, nargs * sizeof(int), INT32) < 0) {
free(args);
return printSocketReadError();
}
}
LOG(logDEBUG1, ("Setting %d bad channels\n", nargs));
// only set // only set
if (Server_VerifyLock() == OK) { if (Server_VerifyLock() == OK) {
// validate bad channel number // validate bad channel number
@@ -8390,11 +8381,11 @@ int set_bad_channels(int file_des) {
int nretvals = 0; int nretvals = 0;
int *retvals = getBadChannels(&nretvals); int *retvals = getBadChannels(&nretvals);
if (nretvals == -1) { if (nretvals == -1) {
ret = FAIL; free(args);
strcpy(mess, "Could not get bad channels. Memory " setMemoryAllocationErrorMessage();
"allcoation error\n"); return sendError(file_des);
LOG(logERROR, (mess)); }
} else if (nretvals != nargs) { if (nretvals != nargs) {
ret = FAIL; ret = FAIL;
sprintf(mess, sprintf(mess,
"Could not set bad channels. Set %d channels, but " "Could not set bad channels. Set %d channels, but "
@@ -8403,15 +8394,11 @@ int set_bad_channels(int file_des) {
nargs, nretvals); nargs, nretvals);
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} }
if (retvals != NULL) { free(retvals);
free(retvals);
}
} }
} }
} }
if (args != NULL) { free(args);
free(args);
}
#endif #endif
return Server_SendResult(file_des, INT32, NULL, 0); return Server_SendResult(file_des, INT32, NULL, 0);
} }
@@ -9940,14 +9927,9 @@ void receive_program_via_blackfin(int file_des, enum PROGRAM_INDEX index,
src = malloc(MAX_BLACKFIN_PROGRAM_SIZE); src = malloc(MAX_BLACKFIN_PROGRAM_SIZE);
if (src == NULL) { if (src == NULL) {
fclose(fd); fclose(fd);
struct sysinfo info; setMemoryAllocationErrorMessage();
sysinfo(&info);
sprintf(mess,
"Could not %s. Memory allocation failure. Free "
"space: %d MB\n",
functionType, (int)(info.freeram / (1024 * 1024)));
LOG(logERROR, (mess));
ret = FAIL; ret = FAIL;
LOG(logERROR, (mess));
} }
} }
Server_SendResult(file_des, INT32, NULL, 0); Server_SendResult(file_des, INT32, NULL, 0);
@@ -10090,6 +10072,7 @@ void receive_program_default(int file_des, enum PROGRAM_INDEX index,
} }
Server_SendResult(file_des, INT32, NULL, 0); Server_SendResult(file_des, INT32, NULL, 0);
if (ret == FAIL) { if (ret == FAIL) {
free(src);
return; return;
} }

View File

@@ -688,7 +688,7 @@ column:
function: setColumn function: setColumn
timing: timing:
help: "[auto|trigger|gating|burst_trigger]\n\tTiming Mode of detector.\n\t[Jungfrau][Moench][Gotthard][Ctb][Gotthard2][Xilinx Ctb] [auto|trigger]\n\t[Mythen3] [auto|trigger|gating|trigger_gating]\n\t[Eiger] [auto|trigger|gating|burst_trigger]" help: "[auto|trigger|gating|burst_trigger|trigger_gating]\n\tTiming Mode of detector.\n\t[Jungfrau][Moench][Gotthard][Ctb][Gotthard2][Xilinx Ctb] [auto|trigger]\n\t[Mythen3] [auto|trigger|gating|trigger_gating]\n\t[Eiger] [auto|trigger|gating|burst_trigger]"
inherit_actions: INTEGER_COMMAND_VEC_ID inherit_actions: INTEGER_COMMAND_VEC_ID
actions: actions:
GET: GET:
@@ -1736,7 +1736,7 @@ readout:
rx_clearroi: rx_clearroi:
inherit_actions: EXECUTE_SET_COMMAND_NOID inherit_actions: EXECUTE_SET_COMMAND_NOID
help: "Resets Region of interest in receiver. Default is all channels/pixels enabled." help: "\n\tResets Region of interest in receiver. Default is all channels/pixels enabled."
actions: actions:
PUT: PUT:
function: clearRxROI function: clearRxROI
@@ -3147,7 +3147,7 @@ maxclkphaseshift:
function: getMaxClockPhaseShift function: getMaxClockPhaseShift
clkdiv: clkdiv:
help: "[n_clock] [n_divider]\n\t[Gotthard2][Mythen3] Clock Divider of clock n_clock. Must be greater than 1.n\t[Gotthard2] Clock index range: 0-5\n\t[Mythen3] Clock index range: 0" help: "[n_clock] [n_divider]\n\t[Gotthard2][Mythen3] Clock Divider of clock n_clock. Must be greater than 1.\n\t[Gotthard2] Clock index range: 0-5\n\t[Mythen3] Clock index range: 0"
actions: actions:
GET: GET:
extra_variables: extra_variables:
@@ -3560,7 +3560,7 @@ temp_event:
output: [ '"cleared"' ] output: [ '"cleared"' ]
pedestalmode: pedestalmode:
help: " [frames<uint8_t>] [loops<uint16_t>]\n\t\t[Jungfrau] Enable pedestal mode. \n\t\tThe number of frames or triggers is overwritten by: \n\t\t(#pedestal_frames x #pedestal_loops x 2). \n\t\tIn auto timing mode or in trigger mode with #frames > 1, \n\t\t#frames is overwritten and #triggers = 1, \n\t\telse #triggers is overwritten and #frames = 1. \n\t\tOne cannot set #frames, #triggers or timing mode in pedestal mode (exception thrown).\n\npedestalmode [0]\n\t\t[Jungfrau] Disable pedestal mode.\n\t\tDisabling pedestal mode will set back the normal mode values of #frames and #triggers." help: " [frames<uint8_t>] [loops<uint16_t>]\n\t\t[Jungfrau] Enable pedestal mode. \n\t\tThe number of frames or triggers is overwritten by: \n\t\t(#pedestal_frames x #pedestal_loops x 2). \n\t\tIn auto timing mode or in trigger mode with #frames > 1, \n\t\t#frames is overwritten and #triggers = 1, \n\t\telse #triggers is overwritten and #frames = 1. \n\t\tOne cannot set #frames, #triggers or timing mode in pedestal mode (exception thrown).\n\tpedestalmode [0]\n\t\t[Jungfrau] Disable pedestal mode.\n\t\tDisabling pedestal mode will set back the normal mode values of #frames and #triggers."
actions: actions:
GET: GET:
argc: 0 argc: 0
@@ -3627,7 +3627,7 @@ inj_ch:
output: [ ToString(args) ] output: [ ToString(args) ]
vetophoton: vetophoton:
help: "[ichip] [#photons] [energy in keV] [reference file]\n\t[Gotthard2] Set veto reference for 128 channels for chip ichip according to reference file and #photons and energy in keV.\n[ichip] [output file]\n\t Get gain indices and veto reference for 128 channels for chip ichip, saved to file." help: "[ichip] [#photons] [energy in keV] [reference file]\n\t[Gotthard2] Set veto reference for 128 channels for chip ichip according to reference file and #photons and energy in keV.\n\t[ichip] [output file]\n\t Get gain indices and veto reference for 128 channels for chip ichip, saved to file."
actions: actions:
GET: GET:
argc: 2 argc: 2

View File

@@ -1292,7 +1292,7 @@ clkdiv:
command_name: clkdiv command_name: clkdiv
function_alias: clkdiv function_alias: clkdiv
help: "[n_clock] [n_divider]\n\t[Gotthard2][Mythen3] Clock Divider of clock n_clock.\ help: "[n_clock] [n_divider]\n\t[Gotthard2][Mythen3] Clock Divider of clock n_clock.\
\ Must be greater than 1.n\t[Gotthard2] Clock index range: 0-5\n\t[Mythen3] Clock\ \ Must be greater than 1.\n\t[Gotthard2] Clock index range: 0-5\n\t[Mythen3] Clock\
\ index range: 0" \ index range: 0"
infer_action: true infer_action: true
clkfreq: clkfreq:
@@ -7171,7 +7171,7 @@ pedestalmode:
\ x #pedestal_loops x 2). \n\t\tIn auto timing mode or in trigger mode with #frames\ \ x #pedestal_loops x 2). \n\t\tIn auto timing mode or in trigger mode with #frames\
\ > 1, \n\t\t#frames is overwritten and #triggers = 1, \n\t\telse #triggers is\ \ > 1, \n\t\t#frames is overwritten and #triggers = 1, \n\t\telse #triggers is\
\ overwritten and #frames = 1. \n\t\tOne cannot set #frames, #triggers or timing\ \ overwritten and #frames = 1. \n\t\tOne cannot set #frames, #triggers or timing\
\ mode in pedestal mode (exception thrown).\n\npedestalmode [0]\n\t\t[Jungfrau]\ \ mode in pedestal mode (exception thrown).\n\tpedestalmode [0]\n\t\t[Jungfrau]\
\ Disable pedestal mode.\n\t\tDisabling pedestal mode will set back the normal\ \ Disable pedestal mode.\n\t\tDisabling pedestal mode will set back the normal\
\ mode values of #frames and #triggers." \ mode values of #frames and #triggers."
infer_action: true infer_action: true
@@ -8441,7 +8441,8 @@ rx_clearroi:
store_result_in_t: false store_result_in_t: false
command_name: rx_clearroi command_name: rx_clearroi
function_alias: rx_clearroi function_alias: rx_clearroi
help: Resets Region of interest in receiver. Default is all channels/pixels enabled. help: "\n\tResets Region of interest in receiver. Default is all channels/pixels\
\ enabled."
infer_action: true infer_action: true
template: true template: true
rx_dbitlist: rx_dbitlist:
@@ -11445,9 +11446,9 @@ timing:
store_result_in_t: false store_result_in_t: false
command_name: timing command_name: timing
function_alias: timing function_alias: timing
help: "[auto|trigger|gating|burst_trigger]\n\tTiming Mode of detector.\n\t[Jungfrau][Moench][Gotthard][Ctb][Gotthard2][Xilinx\ help: "[auto|trigger|gating|burst_trigger|trigger_gating]\n\tTiming Mode of detector.\n\
\ Ctb] [auto|trigger]\n\t[Mythen3] [auto|trigger|gating|trigger_gating]\n\t[Eiger]\ \t[Jungfrau][Moench][Gotthard][Ctb][Gotthard2][Xilinx Ctb] [auto|trigger]\n\t\
\ [auto|trigger|gating|burst_trigger]" [Mythen3] [auto|trigger|gating|trigger_gating]\n\t[Eiger] [auto|trigger|gating|burst_trigger]"
infer_action: true infer_action: true
template: true template: true
timing_info_decoder: timing_info_decoder:
@@ -13710,7 +13711,7 @@ vetophoton:
function_alias: vetophoton function_alias: vetophoton
help: "[ichip] [#photons] [energy in keV] [reference file]\n\t[Gotthard2] Set veto\ help: "[ichip] [#photons] [energy in keV] [reference file]\n\t[Gotthard2] Set veto\
\ reference for 128 channels for chip ichip according to reference file and #photons\ \ reference for 128 channels for chip ichip according to reference file and #photons\
\ and energy in keV.\n[ichip] [output file]\n\t Get gain indices and veto reference\ \ and energy in keV.\n\t[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."
infer_action: true infer_action: true
vetoref: vetoref:

View File

@@ -1673,7 +1673,8 @@ std::string Caller::clkdiv(int action) {
// print help // print help
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << R"V0G0N([n_clock] [n_divider] os << R"V0G0N([n_clock] [n_divider]
[Gotthard2][Mythen3] Clock Divider of clock n_clock. Must be greater than 1.n [Gotthard2] Clock index range: 0-5 [Gotthard2][Mythen3] Clock Divider of clock n_clock. Must be greater than 1.
[Gotthard2] Clock index range: 0-5
[Mythen3] Clock index range: 0 )V0G0N" [Mythen3] Clock index range: 0 )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
@@ -9006,8 +9007,7 @@ std::string Caller::pedestalmode(int action) {
#frames is overwritten and #triggers = 1, #frames is overwritten and #triggers = 1,
else #triggers is overwritten and #frames = 1. else #triggers is overwritten and #frames = 1.
One cannot set #frames, #triggers or timing mode in pedestal mode (exception thrown). One cannot set #frames, #triggers or timing mode in pedestal mode (exception thrown).
pedestalmode [0]
pedestalmode [0]
[Jungfrau] Disable pedestal mode. [Jungfrau] Disable pedestal mode.
Disabling pedestal mode will set back the normal mode values of #frames and #triggers. )V0G0N" Disabling pedestal mode will set back the normal mode values of #frames and #triggers. )V0G0N"
<< std::endl; << std::endl;
@@ -10844,7 +10844,8 @@ std::string Caller::rx_clearroi(int action) {
std::ostringstream os; std::ostringstream os;
// print help // print help
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << R"V0G0N(Resets Region of interest in receiver. Default is all channels/pixels enabled. )V0G0N" os << R"V0G0N(
Resets Region of interest in receiver. Default is all channels/pixels enabled. )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
} }
@@ -14676,7 +14677,7 @@ std::string Caller::timing(int action) {
std::ostringstream os; std::ostringstream os;
// print help // print help
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << R"V0G0N([auto|trigger|gating|burst_trigger] os << R"V0G0N([auto|trigger|gating|burst_trigger|trigger_gating]
Timing Mode of detector. Timing Mode of detector.
[Jungfrau][Moench][Gotthard][Ctb][Gotthard2][Xilinx Ctb] [auto|trigger] [Jungfrau][Moench][Gotthard][Ctb][Gotthard2][Xilinx Ctb] [auto|trigger]
[Mythen3] [auto|trigger|gating|trigger_gating] [Mythen3] [auto|trigger|gating|trigger_gating]
@@ -17633,7 +17634,7 @@ std::string Caller::vetophoton(int action) {
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << R"V0G0N([ichip] [#photons] [energy in keV] [reference file] os << R"V0G0N([ichip] [#photons] [energy in keV] [reference file]
[Gotthard2] Set veto reference for 128 channels for chip ichip according to reference file and #photons and energy in keV. [Gotthard2] Set veto reference for 128 channels for chip ichip according to reference file and #photons and energy in keV.
[ichip] [output file] [ichip] [output file]
Get gain indices and veto reference for 128 channels for chip ichip, saved to file. )V0G0N" Get gain indices and veto reference for 128 channels for chip ichip, saved to file. )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();

View File

@@ -250,8 +250,7 @@ void Caller::EmptyDataCallBack(detectorData *data, uint64_t frameIndex,
std::string Caller::acquire(int action) { std::string Caller::acquire(int action) {
std::ostringstream os; std::ostringstream os;
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << cmd os << "\n\tAcquire the number of frames set up.\n\tBlocking command, "
<< "\n\tAcquire the number of frames set up.\n\tBlocking command, "
"where control server is blocked and cannot accept other " "where control server is blocked and cannot accept other "
"commands until acquisition is done. \n\t- sets acquiring " "commands until acquisition is done. \n\t- sets acquiring "
"flag\n\t- starts the receiver listener (if enabled)\n\t- starts " "flag\n\t- starts the receiver listener (if enabled)\n\t- starts "
@@ -371,7 +370,8 @@ std::string Caller::threshold(int action) {
if (cmd == "thresholdnotb") { if (cmd == "thresholdnotb") {
os << "Trimbits are not loaded."; os << "Trimbits are not loaded.";
} }
os << "\n\nthreshold [eV1] [eV2] [eV3] [(optional settings)]" os << "\n\t" << cmd
<< " [eV1] [eV2] [eV3] [(optional settings)]"
"\n\t[Mythen3] Threshold in eV for each counter. It loads trim " "\n\t[Mythen3] Threshold in eV for each counter. It loads trim "
"files from settingspath. An energy of -1 will pick up values " "files from settingspath. An energy of -1 will pick up values "
" from detector."; " from detector.";
@@ -447,10 +447,9 @@ std::string Caller::trimen(int action) {
std::ostringstream os; std::ostringstream os;
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[trim_ev1] [trim_Ev2 (optional)] [trim_ev3 (optional)] " os << "[trim_ev1] [trim_Ev2 (optional)] [trim_ev3 (optional)] "
"...\n\t[Eiger][Mythen3] Number of trim energies and list of " "...\n\t[Eiger][Mythen3] list of trim energies, where "
"trim " "corresponding default trim files exist in corresponding trim "
"energies, where corresponding default trim files exist in " "folders."
"corresponding trim folders."
<< '\n'; << '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
if (!args.empty()) { if (!args.empty()) {

View File

@@ -137,7 +137,7 @@ void Detector::setVirtualDetectorServers(int numServers,
int Detector::getShmId() const { return pimpl->getDetectorIndex(); } int Detector::getShmId() const { return pimpl->getDetectorIndex(); }
std::string Detector::getPackageVersion() const { return RELEASE; } std::string Detector::getPackageVersion() const { return SLS_DET_VERSION; }
std::string Detector::getClientVersion() const { std::string Detector::getClientVersion() const {
Version v(APILIB); Version v(APILIB);

View File

@@ -277,7 +277,19 @@ void DetectorImpl::updateDetectorSize() {
if (detSizeX > 1 && detSizeX <= maxChanX) { if (detSizeX > 1 && detSizeX <= maxChanX) {
maxChanX = detSizeX; maxChanX = detSizeX;
} }
if (maxChanX < modSize.x) {
std::stringstream os;
os << "The max det size in x dim (" << maxChanX
<< ") is less than the module size in x dim (" << modSize.x
<< "). Probably using shared memory of a different detector "
"type. Please free and try again.";
throw RuntimeError(os.str());
}
nModx = maxChanX / modSize.x; nModx = maxChanX / modSize.x;
if (nModx == 0) {
throw RuntimeError(
"number of modules in x dimension is 0. Unable to proceed.");
}
nMody = size() / nModx; nMody = size() / nModx;
if ((maxChanX % modSize.x) > 0) { if ((maxChanX % modSize.x) > 0) {
++nMody; ++nMody;
@@ -291,7 +303,18 @@ void DetectorImpl::updateDetectorSize() {
if (detSizeY > 1 && detSizeY <= maxChanY) { if (detSizeY > 1 && detSizeY <= maxChanY) {
maxChanY = detSizeY; maxChanY = detSizeY;
} }
if (maxChanY < modSize.y) {
std::stringstream os;
os << "The max det size in y dim (" << maxChanY
<< ") is less than the module size in y dim (" << modSize.y
<< "). Probably using shared memory of a different detector "
"type. Please free and try again.";
throw RuntimeError(os.str());
}
nMody = maxChanY / modSize.y; nMody = maxChanY / modSize.y;
if (nMody == 0)
throw RuntimeError(
"number of modules in y dimension is 0. Unable to proceed.");
nModx = size() / nMody; nModx = size() / nMody;
if ((maxChanY % modSize.y) > 0) { if ((maxChanY % modSize.y) > 0) {
++nModx; ++nModx;

View File

@@ -161,6 +161,7 @@ Module::getTypeFromDetector(const std::string &hostname, uint16_t cport) {
LOG(logDEBUG1) << "Getting Module type "; LOG(logDEBUG1) << "Getting Module type ";
ClientSocket socket("Detector", hostname, cport); ClientSocket socket("Detector", hostname, cport);
socket.Send(F_GET_DETECTOR_TYPE); socket.Send(F_GET_DETECTOR_TYPE);
socket.setFnum(F_GET_DETECTOR_TYPE);
if (socket.Receive<int>() == FAIL) { if (socket.Receive<int>() == FAIL) {
throw RuntimeError("Detector (" + hostname + ", " + throw RuntimeError("Detector (" + hostname + ", " +
std::to_string(cport) + std::to_string(cport) +
@@ -555,6 +556,7 @@ void Module::setSynchronization(const bool value) {
std::vector<int> Module::getBadChannels() const { std::vector<int> Module::getBadChannels() const {
auto client = DetectorSocket(shm()->hostname, shm()->controlPort); auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
client.Send(F_GET_BAD_CHANNELS); client.Send(F_GET_BAD_CHANNELS);
client.setFnum(F_GET_BAD_CHANNELS);
if (client.Receive<int>() == FAIL) { if (client.Receive<int>() == FAIL) {
throw DetectorError("Detector " + std::to_string(moduleIndex) + throw DetectorError("Detector " + std::to_string(moduleIndex) +
" returned error: " + client.readErrorMessage()); " returned error: " + client.readErrorMessage());
@@ -576,6 +578,7 @@ void Module::setBadChannels(std::vector<int> list) {
LOG(logDEBUG1) << "Sending bad channels to detector, nch:" << nch; LOG(logDEBUG1) << "Sending bad channels to detector, nch:" << nch;
auto client = DetectorSocket(shm()->hostname, shm()->controlPort); auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
client.Send(F_SET_BAD_CHANNELS); client.Send(F_SET_BAD_CHANNELS);
client.setFnum(F_SET_BAD_CHANNELS);
client.Send(nch); client.Send(nch);
if (nch > 0) { if (nch > 0) {
client.Send(list); client.Send(list);
@@ -966,6 +969,7 @@ std::vector<int64_t> Module::getFramesCaughtByReceiver() const {
if (shm()->useReceiverFlag) { if (shm()->useReceiverFlag) {
auto client = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort); auto client = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort);
client.Send(F_GET_RECEIVER_FRAMES_CAUGHT); client.Send(F_GET_RECEIVER_FRAMES_CAUGHT);
client.setFnum(F_GET_RECEIVER_FRAMES_CAUGHT);
if (client.Receive<int>() == FAIL) { if (client.Receive<int>() == FAIL) {
throw ReceiverError( throw ReceiverError(
"Receiver " + std::to_string(moduleIndex) + "Receiver " + std::to_string(moduleIndex) +
@@ -988,6 +992,7 @@ std::vector<int64_t> Module::getNumMissingPackets() const {
if (shm()->useReceiverFlag) { if (shm()->useReceiverFlag) {
auto client = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort); auto client = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort);
client.Send(F_GET_NUM_MISSING_PACKETS); client.Send(F_GET_NUM_MISSING_PACKETS);
client.setFnum(F_GET_NUM_MISSING_PACKETS);
if (client.Receive<int>() == FAIL) { if (client.Receive<int>() == FAIL) {
throw ReceiverError( throw ReceiverError(
"Receiver " + std::to_string(moduleIndex) + "Receiver " + std::to_string(moduleIndex) +
@@ -1010,6 +1015,7 @@ std::vector<int64_t> Module::getReceiverCurrentFrameIndex() const {
if (shm()->useReceiverFlag) { if (shm()->useReceiverFlag) {
auto client = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort); auto client = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort);
client.Send(F_GET_RECEIVER_FRAME_INDEX); client.Send(F_GET_RECEIVER_FRAME_INDEX);
client.setFnum(F_GET_RECEIVER_FRAME_INDEX);
if (client.Receive<int>() == FAIL) { if (client.Receive<int>() == FAIL) {
throw ReceiverError( throw ReceiverError(
"Receiver " + std::to_string(moduleIndex) + "Receiver " + std::to_string(moduleIndex) +
@@ -1726,6 +1732,7 @@ void Module::sendReceiverRateCorrections(const std::vector<int64_t> &t) {
<< ']'; << ']';
auto receiver = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort); auto receiver = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort);
receiver.Send(F_SET_RECEIVER_RATE_CORRECT); receiver.Send(F_SET_RECEIVER_RATE_CORRECT);
receiver.setFnum(F_SET_RECEIVER_RATE_CORRECT);
receiver.Send(static_cast<int>(t.size())); receiver.Send(static_cast<int>(t.size()));
receiver.Send(t); receiver.Send(t);
if (receiver.Receive<int>() == FAIL) { if (receiver.Receive<int>() == FAIL) {
@@ -2022,6 +2029,7 @@ void Module::sendVetoPhoton(const int chipIndex,
const int args[]{chipIndex, nch}; const int args[]{chipIndex, nch};
auto client = DetectorSocket(shm()->hostname, shm()->controlPort); auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
client.Send(F_SET_VETO_PHOTON); client.Send(F_SET_VETO_PHOTON);
client.setFnum(F_SET_VETO_PHOTON);
client.Send(args); client.Send(args);
client.Send(gainIndices); client.Send(gainIndices);
client.Send(values); client.Send(values);
@@ -2036,6 +2044,7 @@ void Module::getVetoPhoton(const int chipIndex,
LOG(logDEBUG1) << "Getting veto photon [" << chipIndex << "]\n"; LOG(logDEBUG1) << "Getting veto photon [" << chipIndex << "]\n";
auto client = DetectorSocket(shm()->hostname, shm()->controlPort); auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
client.Send(F_GET_VETO_PHOTON); client.Send(F_GET_VETO_PHOTON);
client.setFnum(F_GET_VETO_PHOTON);
client.Send(chipIndex); client.Send(chipIndex);
if (client.Receive<int>() == FAIL) { if (client.Receive<int>() == FAIL) {
throw DetectorError("Detector " + std::to_string(moduleIndex) + throw DetectorError("Detector " + std::to_string(moduleIndex) +
@@ -2376,7 +2385,6 @@ void Module::setNumberOfAnalogSamples(int value) {
// update #nchan, as it depends on #samples, adcmask // update #nchan, as it depends on #samples, adcmask
updateNumberOfChannels(); updateNumberOfChannels();
if (shm()->useReceiverFlag) { if (shm()->useReceiverFlag) {
LOG(logINFORED) << "receiver up!";
sendToReceiver(F_RECEIVER_SET_NUM_ANALOG_SAMPLES, value, nullptr); sendToReceiver(F_RECEIVER_SET_NUM_ANALOG_SAMPLES, value, nullptr);
} }
} }
@@ -2542,6 +2550,7 @@ std::string Module::getPatterFileName() const {
void Module::setPattern(const Pattern &pat, const std::string &fname) { void Module::setPattern(const Pattern &pat, const std::string &fname) {
auto client = DetectorSocket(shm()->hostname, shm()->controlPort); auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
client.Send(F_SET_PATTERN); client.Send(F_SET_PATTERN);
client.setFnum(F_SET_PATTERN);
client.Send(pat.data(), pat.size()); client.Send(pat.data(), pat.size());
char args[MAX_STR_LENGTH]{}; char args[MAX_STR_LENGTH]{};
strcpy_safe(args, fname.c_str()); strcpy_safe(args, fname.c_str());
@@ -2652,6 +2661,7 @@ std::map<std::string, std::string> Module::getAdditionalJsonHeader() const {
} }
auto client = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort); auto client = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort);
client.Send(F_GET_ADDITIONAL_JSON_HEADER); client.Send(F_GET_ADDITIONAL_JSON_HEADER);
client.setFnum(F_GET_ADDITIONAL_JSON_HEADER);
if (client.Receive<int>() == FAIL) { if (client.Receive<int>() == FAIL) {
throw ReceiverError("Receiver " + std::to_string(moduleIndex) + throw ReceiverError("Receiver " + std::to_string(moduleIndex) +
" returned error: " + client.readErrorMessage()); " returned error: " + client.readErrorMessage());
@@ -2697,6 +2707,7 @@ void Module::setAdditionalJsonHeader(
<< ToString(jsonHeader); << ToString(jsonHeader);
auto client = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort); auto client = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort);
client.Send(F_SET_ADDITIONAL_JSON_HEADER); client.Send(F_SET_ADDITIONAL_JSON_HEADER);
client.setFnum(F_SET_ADDITIONAL_JSON_HEADER);
client.Send(size); client.Send(size);
if (size > 0) if (size > 0)
client.Send(&buff[0], buff.size()); client.Send(&buff[0], buff.size());
@@ -2892,6 +2903,7 @@ std::string Module::executeCommand(const std::string &cmd) {
<< "): Sending command " << cmd; << "): Sending command " << cmd;
auto client = DetectorSocket(shm()->hostname, shm()->controlPort); auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
client.Send(F_EXEC_COMMAND); client.Send(F_EXEC_COMMAND);
client.setFnum(F_EXEC_COMMAND);
client.Send(arg); client.Send(arg);
if (client.Receive<int>() == FAIL) { if (client.Receive<int>() == FAIL) {
std::cout << '\n'; std::cout << '\n';
@@ -3504,6 +3516,7 @@ void Module::setModule(sls_detector_module &module, bool trimbits) {
} }
auto client = DetectorSocket(shm()->hostname, shm()->controlPort); auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
client.Send(F_SET_MODULE); client.Send(F_SET_MODULE);
client.setFnum(F_SET_MODULE);
sendModule(&module, client); sendModule(&module, client);
if (client.Receive<int>() == FAIL) { if (client.Receive<int>() == FAIL) {
throw DetectorError("Module " + std::to_string(moduleIndex) + throw DetectorError("Module " + std::to_string(moduleIndex) +
@@ -3516,6 +3529,7 @@ sls_detector_module Module::getModule() {
sls_detector_module module(shm()->detType); sls_detector_module module(shm()->detType);
auto client = DetectorSocket(shm()->hostname, shm()->controlPort); auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
client.Send(F_GET_MODULE); client.Send(F_GET_MODULE);
client.setFnum(F_GET_MODULE);
if (client.Receive<int>() == FAIL) { if (client.Receive<int>() == FAIL) {
throw DetectorError("Module " + std::to_string(moduleIndex) + throw DetectorError("Module " + std::to_string(moduleIndex) +
" returned error: " + client.readErrorMessage()); " returned error: " + client.readErrorMessage());

View File

@@ -992,7 +992,7 @@ void Implementation::StartMasterWriter() {
masterAttributes.dbitoffset = ctbDbitOffset; masterAttributes.dbitoffset = ctbDbitOffset;
masterAttributes.dbitlist = 0; masterAttributes.dbitlist = 0;
for (auto &i : ctbDbitList) { for (auto &i : ctbDbitList) {
masterAttributes.dbitlist |= (1 << i); masterAttributes.dbitlist |= (static_cast<uint64_t>(1) << i);
} }
masterAttributes.transceiverSamples = masterAttributes.transceiverSamples =
generalData->nTransceiverSamples; generalData->nTransceiverSamples;

View File

@@ -465,9 +465,9 @@ void Listener::CopyPacket(char *dst, char *src, uint32_t dataSize,
// 2nd packet: 4 bytes fnum, previous 1*2 bytes data + 640*2 bytes data // 2nd packet: 4 bytes fnum, previous 1*2 bytes data + 640*2 bytes data
case GOTTHARD: case GOTTHARD:
if (!pnum) if (!pnum)
memcpy(dst, &src[detHeaderSize + 4], dataSize - 2); memcpy(dst, &src[detHeaderSize + 2], dataSize - 2);
else else
memcpy(dst + dataSize - 2, &src[detHeaderSize], dataSize + 2); memcpy(dst + dataSize - 2, &src[detHeaderSize - 2], dataSize + 2);
break; break;
case CHIPTESTBOARD: case CHIPTESTBOARD:
case XILINX_CHIPTESTBOARD: case XILINX_CHIPTESTBOARD:

View File

@@ -38,11 +38,14 @@ void sigInterruptHandler(int p) { sem_post(&semaphore); }
* prints usage of this example program * prints usage of this example program
*/ */
std::string getHelpMessage() { std::string getHelpMessage() {
return std::string( std::ostringstream os;
"\n\nUsage:\n" os << "\nUsage:\n"
"./slsMultiReceiver(detReceiver) [start_tcp_port (non-zero and 16 " << "./slsMultiReceiver [start tcp port] [num recevers] [call back "
"bit)] [num_receivers] [optional: 1 for call back (print frame header " "option (optional)]\n"
"for debugging), 0 for none (default)]\n\n"); << "\t - tcp port has to be non-zero and 16 bit\n"
<< "\t - call back option is 0 (disabled) by default, 1 prints frame "
"header for debugging\n";
return os.str();
} }
/** /**
@@ -159,26 +162,40 @@ int main(int argc, char *argv[]) {
/** - set default values */ /** - set default values */
int numReceivers = 1; int numReceivers = 1;
uint16_t startTCPPort = 1954; uint16_t startTCPPort = DEFAULT_TCP_RX_PORTNO;
int withCallback = 0; int withCallback = 0;
sem_init(&semaphore, 1, 0); sem_init(&semaphore, 1, 0);
/** - get number of receivers and start tcp port from command line /** - get number of receivers and start tcp port from command line
* arguments */ * arguments */
try { if (argc > 1) {
if (argc == 3 || argc == 4) { try {
startTCPPort = sls::StringTo<uint16_t>(argv[1]); if (argc == 3 || argc == 4) {
if (startTCPPort == 0) { startTCPPort = sls::StringTo<uint16_t>(argv[1]);
throw; if (startTCPPort == 0) {
} throw std::runtime_error("Invalid start tcp port");
numReceivers = std::stoi(argv[2]); }
if (argc == 4) { numReceivers = std::stoi(argv[2]);
withCallback = std::stoi(argv[3]); if (numReceivers > 1024) {
} cprintf(RED,
} else "Did you mix up the order of the arguments?\n%s\n",
throw; getHelpMessage().c_str());
} catch (...) { return EXIT_FAILURE;
throw std::runtime_error(getHelpMessage()); }
if (numReceivers == 0) {
cprintf(RED, "Invalid number of receivers.\n%s\n",
getHelpMessage().c_str());
return EXIT_FAILURE;
}
if (argc == 4) {
withCallback = std::stoi(argv[3]);
}
} else
throw std::runtime_error("Invalid number of arguments");
} catch (const std::exception &e) {
cprintf(RED, "Error: %s\n%s\n", e.what(), getHelpMessage().c_str());
return EXIT_FAILURE;
}
} }
cprintf(BLUE, "Parent Process Created [ Tid: %ld ]\n", (long)gettid()); cprintf(BLUE, "Parent Process Created [ Tid: %ld ]\n", (long)gettid());

View File

@@ -1,14 +1,13 @@
// SPDX-License-Identifier: LGPL-3.0-or-other // SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package // Copyright (C) 2021 Contributors to the SLS Detector Package
/** API versions */ /** API versions */
#define RELEASE "developer"
#define APIRECEIVER "developer 0x241014" #define APIRECEIVER "developer 0x241014"
#define APILIB "developer 0x241021" #define APILIB "developer 0x241021"
#define APICTB "developer 0x241107" #define APICTB "developer 0x241107"
#define APIGOTTHARD "developer 0x241107" #define APIGOTTHARD "developer 0x241107"
#define APIGOTTHARD2 "developer 0x241107" #define APIGOTTHARD2 "developer 0x241107"
#define APIJUNGFRAU "developer 0x241107"
#define APIMYTHEN3 "developer 0x241107"
#define APIMOENCH "developer 0x241107" #define APIMOENCH "developer 0x241107"
#define APIXILINXCTB "developer 0x241107" #define APIXILINXCTB "developer 0x241107"
#define APIEIGER "developer 0x241107" #define APIEIGER "developer 0x241107"
#define APIJUNGFRAU "developer 0x241120"
#define APIMYTHEN3 "developer 0x241121"

View File

@@ -1,15 +0,0 @@
# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package
API_FILE=$PWD/slsSupportLib/include/sls/versionAPI.h
CURR_BRANCH=$(cat $API_FILE | grep RELEASE | awk '{print $3}' )
# default branch is developer
if [ $# -eq 0 ]; then
declare -a NEW_BRANCH="developer"
else
declare -a NEW_BRANCH=${1}
fi
# update branch
sed -i s/$CURR_BRANCH/\"$NEW_BRANCH\"/g $API_FILE

36
update_version.py Normal file
View File

@@ -0,0 +1,36 @@
# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package
"""
Script to update VERSION file with semantic versioning if provided as an argument, or with 0.0.0 if no argument is provided.
"""
import sys
import re
def get_version():
# Check at least one argument is passed
if len(sys.argv) < 2:
return "0.0.0"
version = sys.argv[1]
# Validate that the version argument matches semantic versioning format (X.Y.Z)
if not re.match(r'^\d+\.\d+\.\d+$', version):
print("Error: Version argument must be in semantic versioning format (X.Y.Z)")
sys.exit(1)
return version
def write_version_to_file(version):
with open("VERSION", "w") as version_file:
version_file.write(version)
print(f"Version {version} written to VERSION file.")
# Main script
if __name__ == "__main__":
version = get_version()
write_version_to_file(version)