Compare commits

...

22 Commits

Author SHA1 Message Date
d945f39142 removed unused variables 2020-09-17 14:39:20 +02:00
ac1e9569b5 removed unused fields and added popcount 2020-09-17 14:20:02 +02:00
ea1b41c84a fixed bool ini with nullptr 2020-09-17 14:07:19 +02:00
b0dd82c667 removing sem_wait in acquire (#182) 2020-09-17 13:55:20 +02:00
bf69951456 Merge pull request #183 from slsdetectorgroup/positions
Replacing initializer list with vector
2020-09-17 12:57:18 +02:00
2d2e80469c format 2020-09-17 12:18:34 +02:00
5d648443fa replaced remaning {} 2020-09-17 12:18:08 +02:00
1fb7352378 added missing unit in test 2020-09-17 12:13:09 +02:00
511c206787 replaced initializer list with vector for CmdProxy 2020-09-17 12:11:19 +02:00
74edb6a1c1 test for single mod exptime 2020-09-17 11:42:44 +02:00
3376f7fa37 wip, doc 2020-09-14 15:39:21 +02:00
bfe36085f2 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-09-14 15:18:55 +02:00
f061d2273a wip, doc 2020-09-14 15:18:48 +02:00
b12ae5d929 Merge pull request #180 from slsdetectorgroup/serverdoc
Adding auto generated server default #define in documentation
2020-09-14 10:44:01 +02:00
2285061623 column wrap for long attributes 2020-09-11 17:47:28 +02:00
e10ebe33d7 fixed cmake command 2020-09-11 17:25:27 +02:00
01921bc016 WIp, doc 2020-09-11 16:05:53 +02:00
aa10c4665f added ctb 2020-09-11 15:25:23 +02:00
f644cba244 wip, doc 2020-09-11 15:19:22 +02:00
884da7197e fixed command 2020-09-11 15:13:26 +02:00
8ae0659478 docs 2020-09-11 15:09:44 +02:00
ad95f729dc subheadings in Detector API doc 2020-09-11 12:15:51 +02:00
24 changed files with 1066 additions and 568 deletions

View File

@ -38,6 +38,7 @@ set(SPHINX_SOURCE_FILES
src/pydetector.rst src/pydetector.rst
src/pyenums.rst src/pyenums.rst
src/pyexamples.rst src/pyexamples.rst
src/servers.rst
src/receiver.rst src/receiver.rst
src/result.rst src/result.rst
src/type_traits.rst src/type_traits.rst
@ -57,8 +58,21 @@ configure_file(
"${SPHINX_BUILD}/conf.py" "${SPHINX_BUILD}/conf.py"
@ONLY) @ONLY)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/gen_server_doc.py.in"
"${SPHINX_BUILD}/gen_server_doc.py"
@ONLY)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/static/extra.css"
"${SPHINX_BUILD}/static/css/extra.css"
@ONLY)
add_custom_target(server_rst python gen_server_doc.py)
add_custom_target(docs add_custom_target(docs
gendoc gendoc
COMMAND python gen_server_doc.py
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT} COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
COMMAND ${SPHINX_EXECUTABLE} -a -b html COMMAND ${SPHINX_EXECUTABLE} -a -b html
-Dbreathe_projects.slsDetectorPackage=${CMAKE_CURRENT_BINARY_DIR}/xml -Dbreathe_projects.slsDetectorPackage=${CMAKE_CURRENT_BINARY_DIR}/xml
@ -74,3 +88,4 @@ add_custom_target(rst
${SPHINX_BUILD}/src ${SPHINX_BUILD}/src
${SPHINX_BUILD}/html ${SPHINX_BUILD}/html
COMMENT "Generating documentation with Sphinx") COMMENT "Generating documentation with Sphinx")

View File

@ -59,4 +59,8 @@ html_theme = "sphinx_rtd_theme"
# Add any paths that contain custom static files (such as style sheets) here, # Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files, # relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css". # so a file named "default.css" will overwrite the builtin "default.css".
#html_static_path = ['_static'] html_static_path = ['static']
def setup(app):
app.add_stylesheet('css/extra.css') # may also be an URL

53
docs/gen_server_doc.py.in Normal file
View File

@ -0,0 +1,53 @@
import os
import re
from pathlib import Path
# @CMAKE_CURRENT_BINARY_DIR@
print('\n\n\n\n SERVER CSV')
src = Path('@CMAKE_SOURCE_DIR@')/'slsDetectorServers/'
detectors = ['Mythen3', 'Gotthard2', 'Eiger',
'Jungfrau', 'Moench', 'Gotthard', 'Ctb']
for det in detectors:
in_fname = src/f'{det.lower()}DetectorServer/slsDetectorServer_defs.h'
print(f'Reading: {in_fname}')
with open(in_fname) as f:
lines = f.read().replace('\\\n', '')
lines = lines.splitlines(keepends = True)
lines = [l.strip('#define').strip(' ') for l in lines if l.startswith('#define')]
output = []
signals = []
fields = ['Name,', 'Value', 'Comment']
excluded = ['DAC_NAMES', 'DEFAULT_DAC_VALS', 'CLK_NAMES', 'ONCHIP_DAC_NAMES']
header = f'{fields[0]:35}{fields[1]:35}\n'
output.append(header)
signals.append(header)
for line in lines:
name, *parts = line.split()
arg = ' '.join(parts)
value, *comments = arg.split('//')
value = value.strip('() ')
# value = value.replace(', ', ' ')
value = value.replace('\"', '')
if name not in excluded:
name += ','
if name.startswith('SIGNAL_'):
signals.append(f'{name:35}{value}\n')
else:
output.append(f'{name:35}\"{value}\"\n')
rstpath = Path('@CMAKE_SOURCE_DIR@')/'docs/src/'
out_fname = Path.cwd()/f'src/{det.lower()}.csv'
print(f'Writing: {out_fname}')
with open(out_fname, 'w') as f:
f.writelines(output)
print('END\n\n\n\n')

View File

@ -50,6 +50,11 @@ Welcome to slsDetectorPackage's documentation!
type_traits type_traits
ToString ToString
.. toctree::
:caption: Servers
servers
.. Indices and tables .. Indices and tables
.. ================== .. ==================

60
docs/src/servers.rst Normal file
View File

@ -0,0 +1,60 @@
Default values
==============================================
Some general intro
Mythen3
-------------
.. csv-table:: Default values
:file: mythen3.csv
:widths: 35, 35
:header-rows: 1
Gotthard2
-------------
.. csv-table:: Default values
:file: gotthard2.csv
:widths: 35, 35
:header-rows: 1
Moench
-------------
.. csv-table:: Default values
:file: moench.csv
:widths: 35, 35
:header-rows: 1
Ctb
-------------
.. csv-table:: Default values
:file: ctb.csv
:widths: 35, 35
:header-rows: 1
Eiger
-------------
.. csv-table:: Default values
:file: eiger.csv
:widths: 35, 35
:header-rows: 1
Jungfrau
-------------
.. csv-table:: Default values
:file: jungfrau.csv
:widths: 35, 35
:header-rows: 1
Gotthard
-------------
.. csv-table:: Default values
:file: gotthard.csv
:widths: 35, 35
:header-rows: 1

4
docs/static/extra.css vendored Normal file
View File

@ -0,0 +1,4 @@
/* override table no-wrap */
.wy-table-responsive table td, .wy-table-responsive table th {
white-space: normal;
}

View File

@ -91,7 +91,7 @@ class Detector(CppDetectorApi):
:getter: Not implemented :getter: Not implemented
:setter: Loads config file :setter: Loads config file
Examples Example
----------- -----------
>>> d.config = "/path/to/config/file.config" >>> d.config = "/path/to/config/file.config"
@ -174,6 +174,7 @@ class Detector(CppDetectorApi):
@property @property
def clientversion(self): def clientversion(self):
"""Client software version in format [YYMMDD]"""
return self.getClientVersion() return self.getClientVersion()
@property @property
@ -219,7 +220,7 @@ class Detector(CppDetectorApi):
def settings(self): def settings(self):
""" """
Detector settings. Enum: detectorSettings Detector settings. Enum: detectorSettings
Notes Note
----- -----
[Eiger] Use threshold command to load settings [Eiger] Use threshold command to load settings
@ -239,7 +240,7 @@ class Detector(CppDetectorApi):
def frames(self): def frames(self):
"""Number of frames per acquisition. In trigger mode, number of frames per trigger. """Number of frames per acquisition. In trigger mode, number of frames per trigger.
Notes Note
----- -----
Cannot be set in modular level. ???? Cannot be set in modular level. ????
In scan mode, number of frames is set to number of steps. In scan mode, number of frames is set to number of steps.
@ -272,6 +273,7 @@ class Detector(CppDetectorApi):
@property @property
def triggers(self): def triggers(self):
"""Number of triggers per aquire. Set timing mode to use triggers."""
return element_if_equal(self.getNumberOfTriggers()) return element_if_equal(self.getNumberOfTriggers())
@triggers.setter @triggers.setter
@ -289,7 +291,7 @@ class Detector(CppDetectorApi):
:getter: always returns in seconds. To get in datetime.delta, use getExptime :getter: always returns in seconds. To get in datetime.delta, use getExptime
Examples Example
----------- -----------
>>> d.exptime = 1.05 >>> d.exptime = 1.05
>>> d.exptime = datetime.timedelta(minutes = 3, seconds = 1.23) >>> d.exptime = datetime.timedelta(minutes = 3, seconds = 1.23)
@ -326,7 +328,7 @@ class Detector(CppDetectorApi):
----- -----
:getter: always returns in seconds. To get in datetime.delta, use getPeriod :getter: always returns in seconds. To get in datetime.delta, use getPeriod
Examples Example
----------- -----------
>>> d.period = 1.05 >>> d.period = 1.05
>>> d.period = datetime.timedelta(minutes = 3, seconds = 1.23) >>> d.period = datetime.timedelta(minutes = 3, seconds = 1.23)
@ -352,7 +354,7 @@ class Detector(CppDetectorApi):
----- -----
:getter: always returns in seconds. To get in datetime.delta, use getDelayAfterTrigger :getter: always returns in seconds. To get in datetime.delta, use getDelayAfterTrigger
Examples Example
----------- -----------
>>> d.delay = 1.05 >>> d.delay = 1.05
>>> d.delay = datetime.timedelta(minutes = 3, seconds = 1.23) >>> d.delay = datetime.timedelta(minutes = 3, seconds = 1.23)
@ -378,7 +380,7 @@ class Detector(CppDetectorApi):
[Gotthard2] only in continuous mdoe. [Gotthard2] only in continuous mdoe.
:getter: always returns in seconds. To get in datetime.delta, use getDelayAfterTriggerLeft :getter: always returns in seconds. To get in datetime.delta, use getDelayAfterTriggerLeft
Examples Example
----------- -----------
>>> d.delay >>> d.delay
181.23 181.23
@ -454,7 +456,7 @@ class Detector(CppDetectorApi):
@property @property
def rx_hostname(self): def rx_hostname(self):
""" Sets receiver hostname or IP address. Used for TCP control communication between client and receiver to configure receiver. Also updates receiver with detector parameters. """ Sets receiver hostname or IP address. Used for TCP control communication between client and receiver to configure receiver. Also updates receiver with detector parameters.
Notes Note
----- -----
Also resets any prior receiver property (not on detector). \n Also resets any prior receiver property (not on detector). \n
Can concatenate receiver hostnames for every module. \n Can concatenate receiver hostnames for every module. \n
@ -481,7 +483,7 @@ class Detector(CppDetectorApi):
def rx_tcpport(self): def rx_tcpport(self):
""" """
TCP port for client-receiver communication. TCP port for client-receiver communication.
Notes Note
----- -----
Default is 1954. \n Default is 1954. \n
Must be different if multiple receivers on same pc. \n Must be different if multiple receivers on same pc. \n
@ -522,7 +524,7 @@ class Detector(CppDetectorApi):
def rx_discardpolicy(self): def rx_discardpolicy(self):
""" """
Frame discard policy of receiver. Enum: frameDiscardPolicy Frame discard policy of receiver. Enum: frameDiscardPolicy
Notes Note
----- -----
Options: NO_DISCARD, DISCARD_EMPTY_FRAMES, DISCARD_PARTIAL_FRAMES \n Options: NO_DISCARD, DISCARD_EMPTY_FRAMES, DISCARD_PARTIAL_FRAMES \n
Default: NO_DISCARD \n Default: NO_DISCARD \n
@ -543,7 +545,7 @@ class Detector(CppDetectorApi):
@property @property
def rx_padding(self): def rx_padding(self):
"""Partial frames padding enable in the receiver. """Partial frames padding enable in the receiver.
Notes Note
------ ------
Default: enabled \n Default: enabled \n
Disabling is fastest. Disabling is fastest.
@ -625,7 +627,7 @@ class Detector(CppDetectorApi):
----- -----
File name: [file name prefix]_d[detector index]_f[sub file index]_[acquisition/file index].[raw/h5]. File name: [file name prefix]_d[detector index]_f[sub file index]_[acquisition/file index].[raw/h5].
Examples Example
-------- --------
d.fname = 'run' d.fname = 'run'
eg. file name: run_d0_f0_5.raw eg. file name: run_d0_f0_5.raw
@ -644,7 +646,7 @@ class Detector(CppDetectorApi):
---- ----
If path does not exist, it will try to create it. If path does not exist, it will try to create it.
Examples Example
-------- --------
d.fpath = '/tmp/run_20201705' d.fpath = '/tmp/run_20201705'
""" """
@ -686,7 +688,7 @@ class Detector(CppDetectorApi):
def rx_framesperfile(self): def rx_framesperfile(self):
"""Sets the number of frames per file in receiver. """Sets the number of frames per file in receiver.
Notes Note
----- -----
Default: depends on detector type. \n Default: depends on detector type. \n
0 is infinite or all frames in single file. 0 is infinite or all frames in single file.
@ -717,7 +719,7 @@ class Detector(CppDetectorApi):
@property @property
def rx_zmqfreq(self): def rx_zmqfreq(self):
"""Frequency of frames streamed out from receiver via zmq. """Frequency of frames streamed out from receiver via zmq.
Notes Note
----- -----
Default: 1, Means every frame is streamed out. \n Default: 1, Means every frame is streamed out. \n
If 2, every second frame is streamed out. \n If 2, every second frame is streamed out. \n
@ -733,17 +735,15 @@ class Detector(CppDetectorApi):
def rx_zmqport(self): def rx_zmqport(self):
""" """
Zmq port for data to be streamed out of the receiver. Zmq port for data to be streamed out of the receiver.
Notes Note
----- -----
Also restarts receiver zmq streaming if enabled. \n Also restarts receiver zmq streaming if enabled. \n
Default is 30001. \n Default is 30001. \n
Modified only when using an intermediate process after receiver. \n
Must be different for every detector (and udp port). \n Must be different for every detector (and udp port). \n
Multi command will automatically increment for individual modules, use setRxZmqPort. Multi command will automatically increment for individual modules, use setRxZmqPort.
Examples Example
-------- --------
>>> d.rx_zmqport >>> d.rx_zmqport
[30001, 30002, 30003, 300004] [30001, 30002, 30003, 300004]
>>> d.rx_zmqport = 30001 >>> d.rx_zmqport = 30001
@ -764,6 +764,22 @@ class Detector(CppDetectorApi):
@property @property
def zmqport(self): def zmqport(self):
"""
Port number to listen to zmq data streamed out from receiver or intermediate process.
Note
-----
Also restarts client zmq streaming if enabled. \n
Default connects to receiver zmq streaming out port (30001). \n
Must be different for every detector (and udp port). \n
Multi command will automatically increment for individual modules, use setClientZmqPort. \n
Example
--------
>>> d.zmqport
[30001, 30003]
>>> d.zmqport = 30002
>>> d.zmqport = [30002, 30004] #Set ports for the two first detectors
"""
return element_if_equal(self.getClientZmqPort()) return element_if_equal(self.getClientZmqPort())
@zmqport.setter @zmqport.setter
@ -780,7 +796,7 @@ class Detector(CppDetectorApi):
def rx_zmqip(self): def rx_zmqip(self):
""" """
Zmq Ip Address from which data is to be streamed out of the receiver. Zmq Ip Address from which data is to be streamed out of the receiver.
Notes Note
----- -----
Also restarts receiver zmq streaming if enabled. \n Also restarts receiver zmq streaming if enabled. \n
Default is from rx_hostname. \n Default is from rx_hostname. \n
@ -790,7 +806,7 @@ class Detector(CppDetectorApi):
------- -------
>>> d.rx_zmqip >>> d.rx_zmqip
192.168.0.101 192.168.0.101
>>> d.rx_zmqip = ????? >>> d.rx_zmqip = '192.168.0.101'
""" """
return element_if_equal(self.getRxZmqIP()) return element_if_equal(self.getRxZmqIP())
@ -800,6 +816,20 @@ class Detector(CppDetectorApi):
@property @property
def zmqip(self): def zmqip(self):
"""
Ip Address to listen to zmq data streamed out from receiver or intermediate process.
Note
-----
Also restarts client zmq streaming if enabled. \n
Default is from rx_hostname. \n
Modified only when using an intermediate process after receiver.
Example
-------
>>> d.zmqip
192.168.0.101
>>> d.zmqip = '192.168.0.101'
"""
return element_if_equal(self.getClientZmqIp()) return element_if_equal(self.getClientZmqIp())
@zmqip.setter @zmqip.setter
@ -808,6 +838,18 @@ class Detector(CppDetectorApi):
@property @property
def udp_dstip(self): def udp_dstip(self):
"""
Ip address of the receiver (destination) udp interface.
Note
----
If 'auto' used, then ip is set to ip of rx_hostname. \n
To set IPs for individual modules, use setDestinationUDPIP.
Example
------
>>> d.udp_dstip = '192.168.1.110'
>>> d.udp_dstip
192.168.1.110
"""
return element_if_equal(self.getDestinationUDPIP()) return element_if_equal(self.getDestinationUDPIP())
@udp_dstip.setter @udp_dstip.setter
@ -818,6 +860,20 @@ class Detector(CppDetectorApi):
@property @property
def udp_dstip2(self): def udp_dstip2(self):
"""
[Jungfrau][Gotthard2] Ip address of the receiver (destination) udp interface 2.
Note
----
[Jungfrau] bottom half \n
[Gotthard2] veto debugging \n
If 'auto' used, then ip is set to ip of rx_hostname. \n
To set IPs for individual modules, use setDestinationUDPIP2.
Example
------
>>> d.udp_dstip2 = '10.1.1.185'
>>> d.udp_dstip2
10.1.1.185
"""
return element_if_equal(self.getDestinationUDPIP2()) return element_if_equal(self.getDestinationUDPIP2())
@udp_dstip2.setter @udp_dstip2.setter
@ -828,6 +884,18 @@ class Detector(CppDetectorApi):
@property @property
def udp_dstmac(self): def udp_dstmac(self):
"""
Mac address of the receiver (destination) udp interface.
Note
----
Not mandatory to set as udp_dstip retrieves it from slsReceiver process but must be set if you use a custom receiver (not slsReceiver). \n
To set MACs for individual modules, use setDestinationUDPMAC.
Example
-------
>>> d.udp_dstmac = '00:1b:31:01:8a:de'
d.udp_dstmac
00:1b:31:01:8a:de
"""
return element_if_equal(self.getDestinationUDPMAC()) return element_if_equal(self.getDestinationUDPMAC())
@udp_dstmac.setter @udp_dstmac.setter
@ -836,6 +904,20 @@ class Detector(CppDetectorApi):
@property @property
def udp_dstmac2(self): def udp_dstmac2(self):
"""
[Jungfrau][Gotthard2] Mac address of the receiver (destination) udp interface 2.
Note
----
Not mandatory to set as udp_dstip2 retrieves it from slsReceiver process but must be set if you use a custom receiver (not slsReceiver). \n
To set MACs for individual modules, use setDestinationUDPMAC2. \n
[Jungfrau] bottom half \n
[Gotthard2] veto debugging \n
Example
------
>>> d.udp_dstmac2 = '00:1b:31:01:8a:de'
d.udp_dstmac2
00:1b:31:01:8a:de
"""
return element_if_equal(self.getDestinationUDPMAC2()) return element_if_equal(self.getDestinationUDPMAC2())
@udp_dstmac2.setter @udp_dstmac2.setter
@ -844,6 +926,18 @@ class Detector(CppDetectorApi):
@property @property
def udp_srcmac(self): def udp_srcmac(self):
"""
Mac address of the receiver (source) udp interface.
Note
----
[Eiger] Do not set as detector will replace with its own DHCP Mac (1G) or DHCP Mac + 1 (10G). \n
To set MACs for individual modules, use setSourceUDPMAC.
Example
-------
>>> d.udp_srcmac = '00:1b:31:01:8a:de'
d.udp_srcmac
00:1b:31:01:8a:de
"""
return element_if_equal(self.getSourceUDPMAC()) return element_if_equal(self.getSourceUDPMAC())
@udp_srcmac.setter @udp_srcmac.setter
@ -856,6 +950,19 @@ class Detector(CppDetectorApi):
@property @property
def udp_srcmac2(self): def udp_srcmac2(self):
"""
[Jungfrau][Gotthard2] Mac address of the receiver (source) udp interface 2.
Note
----
[Jungfrau] bottom half \n
[Gotthard2] veto debugging \n
To set MACs for individual modules, use setSourceUDPMAC2.
Example
-------
>>> d.udp_srcmac2 = '00:1b:31:01:8a:de'
d.udp_srcmac2
00:1b:31:01:8a:de
"""
return element_if_equal(self.getSourceUDPMAC2()) return element_if_equal(self.getSourceUDPMAC2())
@udp_srcmac2.setter @udp_srcmac2.setter
@ -868,6 +975,19 @@ class Detector(CppDetectorApi):
@property @property
def udp_srcip(self): def udp_srcip(self):
"""
Ip address of the detector (source) udp interface.
Note
-----
Must be same subnet as destination udp ip.\n
[Eiger] Set only for 10G. For 1G, detector will replace with its own DHCP IP address. \n
To set IPs for individual modules, use setSourceUDPIP.
Example
-------
>>> d.udp_srcip = '192.168.1.127'
>>> d.udp_srcip
192.168.1.127
"""
return element_if_equal(self.getSourceUDPIP()) return element_if_equal(self.getSourceUDPIP())
@udp_srcip.setter @udp_srcip.setter
@ -876,6 +996,20 @@ class Detector(CppDetectorApi):
@property @property
def udp_srcip2(self): def udp_srcip2(self):
"""
[Jungfrau][Gotthard2] Ip address of the detector (source) udp interface 2.
Note
-----
[Jungfrau] bottom half \n
[Gotthard2] veto debugging \n
Must be same subnet as destination udp ip2.\n
To set IPs for individual modules, use setSourceUDPIP2.
Example
-------
>>> d.udp_srcip2 = '192.168.1.127'
>>> d.udp_srcip2
192.168.1.127
"""
return element_if_equal(self.getSourceUDPIP2()) return element_if_equal(self.getSourceUDPIP2())
@udp_srcip2.setter @udp_srcip2.setter
@ -884,6 +1018,14 @@ class Detector(CppDetectorApi):
@property @property
def udp_dstport(self): def udp_dstport(self):
"""
Port number of the receiver (destination) udp interface.
Note
----
Default is 50001. \n
Ports for each module is calculated (incremented by 1 if no 2nd interface) \n
To set ports for individual modules, use setDestinationUDPPort.
"""
return element_if_equal(self.getDestinationUDPPort()) return element_if_equal(self.getDestinationUDPPort())
@udp_dstport.setter @udp_dstport.setter
@ -892,6 +1034,17 @@ class Detector(CppDetectorApi):
@property @property
def udp_dstport2(self): def udp_dstport2(self):
"""
Port number of the receiver (destination) udp interface.
Note
----
Default is 50002. \n
[Eiger] right half \n
[Jungfrau] bottom half \n
[Gotthard2] veto debugging \n
Ports for each module is calculated (incremented by 2) \n
To set ports for individual modules, use setDestinationUDPPort2.
"""
return element_if_equal(self.getDestinationUDPPort2()) return element_if_equal(self.getDestinationUDPPort2())
@udp_dstport2.setter @udp_dstport2.setter
@ -916,6 +1069,9 @@ class Detector(CppDetectorApi):
@property @property
def user(self): def user(self):
"""
Retrieve user details from shared memory (hostname, type, PID, User, Date)
"""
return self.getUserDetails() return self.getUserDetails()
@property @property
@ -930,7 +1086,7 @@ class Detector(CppDetectorApi):
@property @property
def status(self): def status(self):
"""Gets detector status. Enum: runStatus """Gets detector status. Enum: runStatus
Notes Note
----- -----
Options: IDLE, ERROR, WAITING, RUN_FINISHED, TRANSMITTING, RUNNING, STOPPED Options: IDLE, ERROR, WAITING, RUN_FINISHED, TRANSMITTING, RUNNING, STOPPED
>>> d.status >>> d.status
@ -941,7 +1097,7 @@ class Detector(CppDetectorApi):
@property @property
def rx_status(self): def rx_status(self):
"""Gets receiver listener status. Enum: runStatus """Gets receiver listener status. Enum: runStatus
Notes Note
----- -----
Options: IDLE, TRANSMITTING, RUNNING Options: IDLE, TRANSMITTING, RUNNING
>>> d.rx_status >>> d.rx_status
@ -965,6 +1121,17 @@ class Detector(CppDetectorApi):
@property @property
def trimbits(self): def trimbits(self):
"""
[Eiger][Mythen3] Loads custom trimbit file to detector.
Note
-----
If no extension specified, serial number of each module is attached.
:getter: Not implemented
Example
-------
>>> d.trimbits = '/path_to_file/noise'
- 14:53:27.931 INFO: Settings file loaded: /path_to_file/noise.sn000
"""
return NotImplementedError("trimbits are set only") return NotImplementedError("trimbits are set only")
@trimbits.setter @trimbits.setter
@ -1090,6 +1257,16 @@ class Detector(CppDetectorApi):
def acquire(self): def acquire(self):
""" """
Run the configured measurement Run the configured measurement
Note
----
Blocking command, where control server is blocked and cannot accept other commands until acquisition is done. \n
- sets acquiring flag
- starts the receiver listener (if enabled)
- starts detector acquisition for number of frames set
- monitors detector status from running to idle
- stops the receiver listener (if enabled)
- increments file index if file write enabled
- resets acquiring flag
""" """
super().acquire() super().acquire()
print('\n', end = '') print('\n', end = '')
@ -1110,7 +1287,7 @@ class Detector(CppDetectorApi):
Setup with n virtual servers running on localhost Setup with n virtual servers running on localhost
starting with port p starting with port p
Examples Example
--------- ---------
>>> d.virtual = n, p >>> d.virtual = n, p
@ -1145,7 +1322,7 @@ class Detector(CppDetectorApi):
Or use setDefaultRateCorrection to set the default one from trimbit file Or use setDefaultRateCorrection to set the default one from trimbit file
Examples Example
----------- -----------
>>> d.ratecorr = 10e-9 >>> d.ratecorr = 10e-9
>>> d.setDefaultRateCorrection() >>> d.setDefaultRateCorrection()
@ -1163,7 +1340,7 @@ class Detector(CppDetectorApi):
def speed(self): def speed(self):
""" """
[Eiger][Jungfrau] Readout speed of chip. Enum: speedLevel [Eiger][Jungfrau] Readout speed of chip. Enum: speedLevel
Notes Note
----- -----
Options: FULL_SPEED, HALF_SPEED, QUARTER_SPEED \n Options: FULL_SPEED, HALF_SPEED, QUARTER_SPEED \n
[Jungfrau] FULL_SPEED option only available from v2.0 boards and with setting number of interfaces to 2. \n [Jungfrau] FULL_SPEED option only available from v2.0 boards and with setting number of interfaces to 2. \n
@ -1182,7 +1359,7 @@ class Detector(CppDetectorApi):
the modules a list of strings will be returned. On setting the value is automatically the modules a list of strings will be returned. On setting the value is automatically
converted to a string. converted to a string.
Examples: Example
----------- -----------
>>> d.rx_jsonpara['emin'] >>> d.rx_jsonpara['emin']
@ -1240,6 +1417,16 @@ class Detector(CppDetectorApi):
@property @property
def trimen(self): def trimen(self):
"""
[Eiger] List of trim energies, where corresponding default trim files exist in corresponding trim folders.
Example
------
>>> d.trimen
[]
>>> d.trimen = [4500, 5400, 6400]
>>> d.trimen
[4500, 5400, 6400]
"""
return element_if_equal(self.getTrimEnergies()) return element_if_equal(self.getTrimEnergies())
@trimen.setter @trimen.setter
@ -1248,6 +1435,13 @@ class Detector(CppDetectorApi):
@property @property
def vthreshold(self): def vthreshold(self):
"""
[Eiger][Mythen3] Detector threshold voltage for single photon counters in dac units.
Note
----
[Eiger] Sets vcmp_ll, vcmp_lr, vcmp_rl, vcmp_rr and vcp to the same value. \n
[Mythen3] Sets vth1, vth2 and vth3 to the same value.
"""
return element_if_equal(self.getDAC(dacIndex.VTHRESHOLD, False)) return element_if_equal(self.getDAC(dacIndex.VTHRESHOLD, False))
@vthreshold.setter @vthreshold.setter
@ -1256,6 +1450,12 @@ class Detector(CppDetectorApi):
@property @property
def type(self): def type(self):
""" Returns detector type. Enum: detectorType
Note
----
:setter: Not implemented
Values: EIGER, JUNGFRAU, GOTTHARD, MOENCH, MYTHEN3, GOTTHARD2, CHIPTESTBOARD
"""
return element_if_equal(self.getDetectorType()) return element_if_equal(self.getDetectorType())
@property @property
@ -1292,7 +1492,7 @@ class Detector(CppDetectorApi):
Subperiod = subexptime + subdeadtime. Subperiod = subexptime + subdeadtime.
:getter: always returns in seconds. To get in datetime.delta, use getSubExptime :getter: always returns in seconds. To get in datetime.delta, use getSubExptime
Examples Example
----------- -----------
>>> d.subexptime = 1.230203 >>> d.subexptime = 1.230203
>>> d.subexptime = datetime.timedelta(seconds = 1.23, microseconds = 203) >>> d.subexptime = datetime.timedelta(seconds = 1.23, microseconds = 203)
@ -1327,7 +1527,7 @@ class Detector(CppDetectorApi):
Subperiod = subexptime + subdeadtime. Subperiod = subexptime + subdeadtime.
:getter: always returns in seconds. To get in datetime.delta, use getSubDeadTime :getter: always returns in seconds. To get in datetime.delta, use getSubDeadTime
Examples Example
----------- -----------
>>> d.subdeadtime = 1.230203 >>> d.subdeadtime = 1.230203
>>> d.subdeadtime = datetime.timedelta(seconds = 1.23, microseconds = 203) >>> d.subdeadtime = datetime.timedelta(seconds = 1.23, microseconds = 203)
@ -1508,7 +1708,7 @@ class Detector(CppDetectorApi):
Value: 0-1638375 ns (resolution of 25ns) \n Value: 0-1638375 ns (resolution of 25ns) \n
:getter: always returns in seconds. To get in datetime.delta, use getStorageCellDelay :getter: always returns in seconds. To get in datetime.delta, use getStorageCellDelay
Examples Example
----------- -----------
>>> d.storagecell_delay = 0.00056 >>> d.storagecell_delay = 0.00056
>>> d.storagecell_delay = datetime.timedelta(microseconds = 45) >>> d.storagecell_delay = datetime.timedelta(microseconds = 45)
@ -1579,7 +1779,7 @@ class Detector(CppDetectorApi):
@element @element
def selinterface(self): def selinterface(self):
"""[Jungfrau] The udp interface to stream data from detector. """[Jungfrau] The udp interface to stream data from detector.
Notes Note
----- -----
Effective only when number of interfaces is 1. Default: 0 (outer). Inner is 1. Effective only when number of interfaces is 1. Default: 0 (outer). Inner is 1.
""" """
@ -1607,7 +1807,10 @@ class Detector(CppDetectorApi):
@element @element
def veto(self): def veto(self):
""" """
[Gotthard2] Enable or disable veto data streaming from detector. Default is 0. [Gotthard2] Enable or disable veto data streaming from detector.
Note
----
Default is 0.
""" """
return self.getVeto() return self.getVeto()
@ -1622,7 +1825,7 @@ class Detector(CppDetectorApi):
[Gotthard2] Set veto reference for each 128 channels for specific chip. [Gotthard2] Set veto reference for each 128 channels for specific chip.
The file should have 128 rows of gain index and 12 bit value in dec The file should have 128 rows of gain index and 12 bit value in dec
Examples Example
--------- ---------
d.vetofile = '/path/to/file.txt' #set for all chips d.vetofile = '/path/to/file.txt' #set for all chips
@ -1658,7 +1861,7 @@ class Detector(CppDetectorApi):
""" """
[Gotthard2] Set veto reference for all 128 channels for all chips. [Gotthard2] Set veto reference for all 128 channels for all chips.
Examples: Example
---------- ----------
>>> d.vetoref = chip, value >>> d.vetoref = chip, value
@ -1687,7 +1890,7 @@ class Detector(CppDetectorApi):
:getter: always returns in seconds. To get in datetime.delta, use getGateDelayForAllGates or getGateDelay(gateIndex) :getter: always returns in seconds. To get in datetime.delta, use getGateDelayForAllGates or getGateDelay(gateIndex)
Examples Example
----------- -----------
>>> d.gatedelay = 1.05 >>> d.gatedelay = 1.05
>>> d.gatedelay = datetime.timedelta(minutes = 3, seconds = 1.23) >>> d.gatedelay = datetime.timedelta(minutes = 3, seconds = 1.23)
@ -1722,7 +1925,7 @@ class Detector(CppDetectorApi):
----- -----
Each element in list can be 0 - 2 and must be non repetitive. Each element in list can be 0 - 2 and must be non repetitive.
Examples Example
----------- -----------
>>> d.counters = [0, 1] >>> d.counters = [0, 1]
@ -1765,12 +1968,12 @@ class Detector(CppDetectorApi):
""" """
[CTB] Readout mode of detector. Enum: readoutMode [CTB] Readout mode of detector. Enum: readoutMode
Notes Note
------ ------
Options: ANALOG_ONLY, DIGITAL_ONLY, ANALOG_AND_DIGITAL Options: ANALOG_ONLY, DIGITAL_ONLY, ANALOG_AND_DIGITAL
Default: ANALOG_ONLY Default: ANALOG_ONLY
Examples Example
-------- --------
>>> d.romode = readoutMode.ANALOG_ONLY >>> d.romode = readoutMode.ANALOG_ONLY
>>> d.romode >>> d.romode
@ -1846,11 +2049,11 @@ class Detector(CppDetectorApi):
""" """
[Ctb] List of digital signal bits read out. [Ctb] List of digital signal bits read out.
Notes Note
----- -----
Each element in list can be 0 - 63 and must be non repetitive. Each element in list can be 0 - 63 and must be non repetitive.
Examples Example
--------- ---------
>>> d.rxdbitlist = [0, 1, 61, 9] >>> d.rxdbitlist = [0, 1, 61, 9]
>>> d.rxdbitlist >>> d.rxdbitlist
@ -1933,7 +2136,7 @@ class Detector(CppDetectorApi):
def pattern(self): def pattern(self):
"""[Mythen3][Moench][Ctb] Loads ASCII pattern file directly to server (instead of executing line by line). """[Mythen3][Moench][Ctb] Loads ASCII pattern file directly to server (instead of executing line by line).
Examples Example
--------- ---------
>>> d.pattern = '/tmp/pat.txt' >>> d.pattern = '/tmp/pat.txt'
""" """
@ -1951,7 +2154,7 @@ class Detector(CppDetectorApi):
def patioctrl(self): def patioctrl(self):
"""[Ctb][Moench] 64 bit mask defining input (0) and output (1) signals. """[Ctb][Moench] 64 bit mask defining input (0) and output (1) signals.
Examples Example
-------- --------
>>> d.patioctrl = 0x8f0effff6dbffdbf >>> d.patioctrl = 0x8f0effff6dbffdbf
>>> hex(d.patioctrl) >>> hex(d.patioctrl)
@ -1967,7 +2170,7 @@ class Detector(CppDetectorApi):
def patlimits(self): def patlimits(self):
"""[Ctb][Moench][Mythen3] Limits (start and stop address) of complete pattern. """[Ctb][Moench][Mythen3] Limits (start and stop address) of complete pattern.
Examples Example
--------- ---------
>>> d.patlimits = [0x0, 0x18c] >>> d.patlimits = [0x0, 0x18c]
>>> d.patlimits >>> d.patlimits
@ -1986,7 +2189,7 @@ class Detector(CppDetectorApi):
def patsetbit(self): def patsetbit(self):
"""[Ctb][Moench][Mythen3] Selects the bits that will have a pattern mask applied to the selected patmask for every pattern. """[Ctb][Moench][Mythen3] Selects the bits that will have a pattern mask applied to the selected patmask for every pattern.
Examples Example
-------- --------
>>> d.patsetbit = 0x8f0effff6dbffdbf >>> d.patsetbit = 0x8f0effff6dbffdbf
>>> hex(d.patsetbit) >>> hex(d.patsetbit)
@ -2002,7 +2205,7 @@ class Detector(CppDetectorApi):
def patmask(self): def patmask(self):
"""[Ctb][Moench][Mythen3] Sets the mask applied to every pattern to the selected bits. """[Ctb][Moench][Mythen3] Sets the mask applied to every pattern to the selected bits.
Examples Example
-------- --------
>>> d.patmask = 0x8f0effff6dbffdbf >>> d.patmask = 0x8f0effff6dbffdbf
>>> hex(d.patmask) >>> hex(d.patmask)
@ -2020,7 +2223,7 @@ class Detector(CppDetectorApi):
def patwait0(self): def patwait0(self):
"""[Ctb][Moench][Mythen3] Wait 0 address. """[Ctb][Moench][Mythen3] Wait 0 address.
Examples Example
-------- --------
>>> d.patwait0 = 0xaa >>> d.patwait0 = 0xaa
>>> d.patwait0 >>> d.patwait0
@ -2038,7 +2241,7 @@ class Detector(CppDetectorApi):
def patwait1(self): def patwait1(self):
"""[Ctb][Moench][Mythen3] Wait 1 address. """[Ctb][Moench][Mythen3] Wait 1 address.
Examples Example
-------- --------
>>> d.patwait1 = 0xaa >>> d.patwait1 = 0xaa
>>> d.patwait1 >>> d.patwait1
@ -2056,7 +2259,7 @@ class Detector(CppDetectorApi):
def patwait2(self): def patwait2(self):
"""[Ctb][Moench][Mythen3] Wait 2 address. """[Ctb][Moench][Mythen3] Wait 2 address.
Examples Example
-------- --------
>>> d.patwait2 = 0xaa >>> d.patwait2 = 0xaa
>>> d.patwait2 >>> d.patwait2
@ -2101,7 +2304,7 @@ class Detector(CppDetectorApi):
def patloop0(self): def patloop0(self):
"""[Ctb][Moench][Mythen3] Limits (start and stop address) of loop 0. """[Ctb][Moench][Mythen3] Limits (start and stop address) of loop 0.
Examples Example
--------- ---------
>>> d.patloop0 = [0x0, 0x18c] >>> d.patloop0 = [0x0, 0x18c]
>>> d.patloop0 >>> d.patloop0
@ -2119,7 +2322,7 @@ class Detector(CppDetectorApi):
def patloop1(self): def patloop1(self):
"""[Ctb][Moench][Mythen3] Limits (start and stop address) of loop 1. """[Ctb][Moench][Mythen3] Limits (start and stop address) of loop 1.
Examples Example
--------- ---------
>>> d.patloop1 = [0x0, 0x18c] >>> d.patloop1 = [0x0, 0x18c]
>>> d.patloop1 >>> d.patloop1
@ -2138,7 +2341,7 @@ class Detector(CppDetectorApi):
def patloop2(self): def patloop2(self):
"""[Ctb][Moench][Mythen3] Limits (start and stop address) of loop 2. """[Ctb][Moench][Mythen3] Limits (start and stop address) of loop 2.
Examples Example
--------- ---------
>>> d.patloop2 = [0x0, 0x18c] >>> d.patloop2 = [0x0, 0x18c]
>>> d.patloop2 >>> d.patloop2
@ -2183,6 +2386,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def v_a(self): def v_a(self):
"""[Ctb] Voltage supply a in mV."""
return self.getDAC(dacIndex.V_POWER_A, True) return self.getDAC(dacIndex.V_POWER_A, True)
@v_a.setter @v_a.setter
@ -2192,6 +2396,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def v_b(self): def v_b(self):
"""[Ctb] Voltage supply a in mV."""
return self.getDAC(dacIndex.V_POWER_B, True) return self.getDAC(dacIndex.V_POWER_B, True)
@v_b.setter @v_b.setter
@ -2201,6 +2406,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def v_c(self): def v_c(self):
"""[Ctb] Voltage supply a in mV."""
return self.getDAC(dacIndex.V_POWER_C, True) return self.getDAC(dacIndex.V_POWER_C, True)
@v_c.setter @v_c.setter
@ -2210,6 +2416,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def v_d(self): def v_d(self):
"""[Ctb] Voltage supply a in mV."""
return self.getDAC(dacIndex.V_POWER_D, True) return self.getDAC(dacIndex.V_POWER_D, True)
@v_d.setter @v_d.setter
@ -2219,6 +2426,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def v_io(self): def v_io(self):
"""[Ctb] Voltage supply a in mV."""
return self.getDAC(dacIndex.V_POWER_IO, True) return self.getDAC(dacIndex.V_POWER_IO, True)
@v_io.setter @v_io.setter
@ -2228,6 +2436,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def v_limit(self): def v_limit(self):
"""[Ctb][Moench] Soft limit for power supplies (ctb only) and DACS in mV."""
return self.getDAC(dacIndex.V_LIMIT, True) return self.getDAC(dacIndex.V_LIMIT, True)
@v_limit.setter @v_limit.setter
@ -2239,7 +2448,7 @@ class Detector(CppDetectorApi):
def im_a(self): def im_a(self):
"""[Ctb] Measured current of power supply a in mA. """[Ctb] Measured current of power supply a in mA.
Notes Note
----- -----
:setter: Not implemented :setter: Not implemented
""" """
@ -2250,7 +2459,7 @@ class Detector(CppDetectorApi):
def im_b(self): def im_b(self):
"""[Ctb] Measured current of power supply b in mA. """[Ctb] Measured current of power supply b in mA.
Notes Note
----- -----
:setter: Not implemented :setter: Not implemented
""" """
@ -2261,7 +2470,7 @@ class Detector(CppDetectorApi):
def im_c(self): def im_c(self):
"""[Ctb] Measured current of power supply c in mA. """[Ctb] Measured current of power supply c in mA.
Notes Note
----- -----
:setter: Not implemented :setter: Not implemented
""" """
@ -2272,7 +2481,7 @@ class Detector(CppDetectorApi):
def im_d(self): def im_d(self):
"""[Ctb] Measured current of power supply d in mA. """[Ctb] Measured current of power supply d in mA.
Notes Note
----- -----
:setter: Not implemented :setter: Not implemented
""" """
@ -2283,7 +2492,7 @@ class Detector(CppDetectorApi):
def im_io(self): def im_io(self):
"""[Ctb] Measured current of power supply io in mA. """[Ctb] Measured current of power supply io in mA.
Notes Note
----- -----
:setter: Not implemented :setter: Not implemented
""" """

View File

@ -95,7 +95,7 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, SYNC_CLK, DBIT_CLK, NUM_CLOCKS };
#define NDAC_ONLY (NDAC - NPWR) #define NDAC_ONLY (NDAC - NPWR)
#define DYNAMIC_RANGE (16) #define DYNAMIC_RANGE (16)
#define NUM_BYTES_PER_PIXEL (DYNAMIC_RANGE / 8) #define NUM_BYTES_PER_PIXEL (DYNAMIC_RANGE / 8)
#define CLK_FREQ (156.25) /* MHz */ #define CLK_FREQ (156.25) // MHz
#define I2C_POWER_VIO_DEVICE_ID (0x40) #define I2C_POWER_VIO_DEVICE_ID (0x40)
#define I2C_POWER_VA_DEVICE_ID (0x41) #define I2C_POWER_VA_DEVICE_ID (0x41)
#define I2C_POWER_VB_DEVICE_ID (0x42) #define I2C_POWER_VB_DEVICE_ID (0x42)

View File

@ -130,7 +130,7 @@ enum MASTERINDEX { MASTER_HARDWARE, OW_MASTER, OW_SLAVE };
#define DAC_MAX_STEPS (4096) #define DAC_MAX_STEPS (4096)
#define MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS \ #define MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS \
(0x1FFFFFFF) /** 29 bit register for max subframe exposure value */ (0x1FFFFFFF) // 29 bit register for max subframe exposure value
#define SLAVE_HIGH_VOLTAGE_READ_VAL (-999) #define SLAVE_HIGH_VOLTAGE_READ_VAL (-999)
#define HIGH_VOLTAGE_TOLERANCE (5) #define HIGH_VOLTAGE_TOLERANCE (5)

View File

@ -41,7 +41,7 @@ enum CLKINDEX { ADC_CLK, NUM_CLOCKS };
#define DYNAMIC_RANGE (16) #define DYNAMIC_RANGE (16)
#define NUM_BITS_PER_PIXEL (DYNAMIC_RANGE / 8) #define NUM_BITS_PER_PIXEL (DYNAMIC_RANGE / 8)
#define DATA_BYTES (NCHIP * NCHAN * NUM_BITS_PER_PIXEL) #define DATA_BYTES (NCHIP * NCHAN * NUM_BITS_PER_PIXEL)
#define CLK_FREQ (32007729) /* Hz */ #define CLK_FREQ (32007729) // Hz
#define MAX_EXT_SIGNALS (1) #define MAX_EXT_SIGNALS (1)
/** Firmware Definitions */ /** Firmware Definitions */

View File

@ -69,8 +69,8 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
#define DYNAMIC_RANGE (16) #define DYNAMIC_RANGE (16)
#define NUM_BYTES_PER_PIXEL (DYNAMIC_RANGE / 8) #define NUM_BYTES_PER_PIXEL (DYNAMIC_RANGE / 8)
#define DATA_BYTES (NCHIP * NCHAN * NUM_BYTES_PER_PIXEL) #define DATA_BYTES (NCHIP * NCHAN * NUM_BYTES_PER_PIXEL)
#define CLK_RUN (40) /* MHz */ #define CLK_RUN (40) // MHz
#define CLK_SYNC (20) /* MHz */ #define CLK_SYNC (20) // MHz
#define ADC_CLK_INDEX (1) #define ADC_CLK_INDEX (1)
#define DBIT_CLK_INDEX (0) #define DBIT_CLK_INDEX (0)

View File

@ -35,19 +35,20 @@ class Detector {
*/ */
Detector(int shm_id = 0); Detector(int shm_id = 0);
~Detector(); ~Detector();
/** @name Configuration */
///@{
/************************************************** /**************************************************
* * * *
* Configuration * * Configuration *
* * * *
* ************************************************/ * ************************************************/
/* Free the shared memory of this detector and all modules /** Free the shared memory of this detector and all modules
* belonging to it */ belonging to it */
void freeSharedMemory(); void freeSharedMemory();
/** Frees shared memory before loading configuration file. Set up once /** Frees shared memory before loading configuration file. Set up once
* normally */ normally */
void loadConfig(const std::string &fname); void loadConfig(const std::string &fname);
/** Shared memory not freed prior. Set up per measurement. */ /** Shared memory not freed prior. Set up per measurement. */
@ -57,7 +58,7 @@ class Detector {
Result<std::string> getHostname(Positions pos = {}) const; Result<std::string> getHostname(Positions pos = {}) const;
/* Frees shared memory, adds detectors to the list */ /**Frees shared memory, adds detectors to the list */
void setHostname(const std::vector<std::string> &hostname); void setHostname(const std::vector<std::string> &hostname);
/** connects to n servers at local host starting at specific control port */ /** connects to n servers at local host starting at specific control port */
@ -79,6 +80,8 @@ class Detector {
Result<int64_t> getReceiverVersion(Positions pos = {}) const; Result<int64_t> getReceiverVersion(Positions pos = {}) const;
/** Options: EIGER, JUNGFRAU, GOTTHARD, MOENCH, MYTHEN3, GOTTHARD2,
* CHIPTESTBOARD */
Result<defs::detectorType> getDetectorType(Positions pos = {}) const; Result<defs::detectorType> getDetectorType(Positions pos = {}) const;
/** Gets the total number of detectors */ /** Gets the total number of detectors */
@ -95,7 +98,7 @@ class Detector {
defs::xy getDetectorSize() const; defs::xy getDetectorSize() const;
/** /**
* Sets the detector size in both dimensions. * Sets the detector size in both dimensions. \n
* This value is used to calculate row and column positions for each module. * This value is used to calculate row and column positions for each module.
*/ */
void setDetectorSize(const defs::xy value); void setDetectorSize(const defs::xy value);
@ -107,17 +110,18 @@ class Detector {
Result<defs::detectorSettings> getSettings(Positions pos = {}) const; Result<defs::detectorSettings> getSettings(Positions pos = {}) const;
/** [Jungfrau] DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2, /** [Jungfrau] DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2,
* FORCESWITCHG1, FORCESWITCHG2 [Gotthard] \n DYNAMICGAIN, HIGHGAIN, * FORCESWITCHG1, FORCESWITCHG2 \n [Gotthard] DYNAMICGAIN, HIGHGAIN,
* LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN [Gotthard2] \n DYNAMICGAIN, * LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN \n [Gotthard2] DYNAMICGAIN,
* FIXGAIN1, FIXGAIN2 [Moench] \n G1_HIGHGAIN, G1_LOWGAIN, * FIXGAIN1, FIXGAIN2 \n [Moench] G1_HIGHGAIN, G1_LOWGAIN,
* G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN, G2_LOWCAP_HIGHGAIN, * G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN, G2_LOWCAP_HIGHGAIN,
* G2_LOWCAP_LOWGAIN, G4_HIGHGAIN, G4_LOWGAIN \n [Eiger] Use threshold * G2_LOWCAP_LOWGAIN, G4_HIGHGAIN, G4_LOWGAIN \n [Eiger] Use threshold
* command \n [Eiger settings loaded from file found in * command. Settings loaded from file found in
* settingspath * settingspath
*/ */
void setSettings(defs::detectorSettings value, Positions pos = {}); void setSettings(defs::detectorSettings value, Positions pos = {});
/** [Eiger][Mythen3] */ /** [Eiger][Mythen3] If no extension specified, serial number of each module
* is attached. */
void loadTrimbits(const std::string &fname, Positions pos = {}); void loadTrimbits(const std::string &fname, Positions pos = {});
/** [Eiger][Mythen3] -1 if they are all different */ /** [Eiger][Mythen3] -1 if they are all different */
@ -135,15 +139,17 @@ class Detector {
* streaming, receiver file or streaming. Default is disabled. * streaming, receiver file or streaming. Default is disabled.
*/ */
void setGapPixelsinCallback(const bool enable); void setGapPixelsinCallback(const bool enable);
///@{
/** @name Callbacks */
///@{
/************************************************** /**************************************************
* * * *
* Callbacks * * Callbacks *
* * * *
* ************************************************/ * ************************************************/
/** /** register callback for end of acquisition
* register callback for end of acquisition
* @param func function to be called with parameters: * @param func function to be called with parameters:
* current progress in percentage, detector status, pArg pointer * current progress in percentage, detector status, pArg pointer
* @param pArg pointer that is returned in call back * @param pArg pointer that is returned in call back
@ -164,7 +170,10 @@ class Detector {
void registerDataCallback(void (*func)(detectorData *, uint64_t, uint32_t, void registerDataCallback(void (*func)(detectorData *, uint64_t, uint32_t,
void *), void *),
void *pArg); void *pArg);
///@{
/** @name Acquisition Parameters */
///@{
/************************************************** /**************************************************
* * * *
* Acquisition Parameters * * Acquisition Parameters *
@ -373,11 +382,11 @@ class Detector {
void setDAC(defs::dacIndex index, int value, bool mV = false, void setDAC(defs::dacIndex index, int value, bool mV = false,
Positions pos = {}); Positions pos = {});
/* [Gotthard2] */ /**[Gotthard2] */
Result<int> getOnChipDAC(defs::dacIndex index, int chipIndex, Result<int> getOnChipDAC(defs::dacIndex index, int chipIndex,
Positions pos = {}) const; Positions pos = {}) const;
/* [Gotthard2] */ /**[Gotthard2] */
void setOnChipDAC(defs::dacIndex index, int chipIndex, int value, void setOnChipDAC(defs::dacIndex index, int chipIndex, int value,
Positions pos = {}); Positions pos = {});
@ -403,7 +412,10 @@ class Detector {
* [Mythen3] If exposure time is too short, acquisition will return with an * [Mythen3] If exposure time is too short, acquisition will return with an
* ERROR and take fewer frames than expected */ * ERROR and take fewer frames than expected */
void setParallelMode(bool value, Positions pos = {}); void setParallelMode(bool value, Positions pos = {});
///@{
/** @name Acquisition */
///@{
/************************************************** /**************************************************
* * * *
* Acquisition * * Acquisition *
@ -412,12 +424,14 @@ class Detector {
/** /**
* Blocking call: Acquire the number of frames set * Blocking call: Acquire the number of frames set
* - sets acquiring flag * - sets acquiring flag
* - starts the receiver listener * - starts the receiver listener (if enabled)
* - starts detector acquisition for number of frames set * - starts detector acquisition for number of frames set
* - monitors detector status from running to idle * - monitors detector status from running to idle
* - stops the receiver listener * - stops the receiver listener (if enabled)
* - increments file index if file write enabled * - increments file index if file write enabled
* - resets acquiring flag * - resets acquiring flag
* Control server is blocked and cannot accept other commands until
* acquisition is done.
*/ */
void acquire(); void acquire();
@ -473,7 +487,10 @@ class Detector {
/** gets scan error message in case of error during scan in case of non /** gets scan error message in case of error during scan in case of non
* blocking acquisition (startDetector, not acquire) */ * blocking acquisition (startDetector, not acquire) */
Result<std::string> getScanErrorMessage(Positions pos = {}) const; Result<std::string> getScanErrorMessage(Positions pos = {}) const;
///@{
/** @name Network Configuration (Detector<->Receiver) */
///@{
/************************************************** /**************************************************
* * * *
* Network Configuration (Detector<->Receiver) * * Network Configuration (Detector<->Receiver) *
@ -504,31 +521,31 @@ class Detector {
Result<IpAddr> getSourceUDPIP(Positions pos = {}) const; Result<IpAddr> getSourceUDPIP(Positions pos = {}) const;
/* For Eiger 1G, the detector will replace with its own DHCP IP /**For Eiger 1G, the detector will replace with its own DHCP IP
* 10G Eiger and other detectors, the source UDP IP must be in the * 10G Eiger and other detectors. The source UDP IP must be in the
* same subnet of the destination UDP IP * same subnet of the destination UDP IP
*/ */
void setSourceUDPIP(const IpAddr ip, Positions pos = {}); void setSourceUDPIP(const IpAddr ip, Positions pos = {});
/** [Jungfrau] bottom half */ /** [Jungfrau] bottom half [Gotthard2] veto debugging */
Result<IpAddr> getSourceUDPIP2(Positions pos = {}) const; Result<IpAddr> getSourceUDPIP2(Positions pos = {}) const;
/** [Jungfrau] bottom half */ /** [Jungfrau] bottom half [Gotthard2] veto debugging. \n The source UDP IP
* must be in the same subnet of the destination UDP IP2 */
void setSourceUDPIP2(const IpAddr ip, Positions pos = {}); void setSourceUDPIP2(const IpAddr ip, Positions pos = {});
Result<MacAddr> getSourceUDPMAC(Positions pos = {}) const; Result<MacAddr> getSourceUDPMAC(Positions pos = {}) const;
/* For Eiger 1G, the detector will replace with its own DHCP MAC /**For Eiger 1G, the detector will replace with its own DHCP MAC
* For Eiger 10G, the detector will replace with its own DHCP MAC + 1 * For Eiger 10G, the detector will replace with its own DHCP MAC + 1
* Others can be anything (beware of certain bits) * Others can be anything (beware of certain bits)
*/ */
void setSourceUDPMAC(const MacAddr mac, Positions pos = {}); void setSourceUDPMAC(const MacAddr mac, Positions pos = {});
/** [Jungfrau] bottom half */ /** [Jungfrau] bottom half [Gotthard2] veto debugging */
Result<MacAddr> getSourceUDPMAC2(Positions pos = {}) const; Result<MacAddr> getSourceUDPMAC2(Positions pos = {}) const;
/** [Jungfrau] bottom half */ /** [Jungfrau] bottom half [Gotthard2] veto debugging */
void setSourceUDPMAC2(const MacAddr mac, Positions pos = {}); void setSourceUDPMAC2(const MacAddr mac, Positions pos = {});
Result<IpAddr> getDestinationUDPIP(Positions pos = {}) const; Result<IpAddr> getDestinationUDPIP(Positions pos = {}) const;
@ -536,39 +553,42 @@ class Detector {
/** IP of the interface in receiver that the detector sends data to */ /** IP of the interface in receiver that the detector sends data to */
void setDestinationUDPIP(const IpAddr ip, Positions pos = {}); void setDestinationUDPIP(const IpAddr ip, Positions pos = {});
/** [Jungfrau bottom half] */ /** [Jungfrau] bottom half \n [Gotthard2] veto debugging */
Result<IpAddr> getDestinationUDPIP2(Positions pos = {}) const; Result<IpAddr> getDestinationUDPIP2(Positions pos = {}) const;
/** [Jungfrau bottom half] */ /** [Jungfrau] bottom half \n [Gotthard2] veto debugging */
void setDestinationUDPIP2(const IpAddr ip, Positions pos = {}); void setDestinationUDPIP2(const IpAddr ip, Positions pos = {});
Result<MacAddr> getDestinationUDPMAC(Positions pos = {}) const; Result<MacAddr> getDestinationUDPMAC(Positions pos = {}) const;
/** MAC of the interface in receiver that the detector sends data to /** Mac address of the receiver (destination) udp interface. Not mandatory
* Only needed if you use a custom receiver (not slsReceiver) * to set as setDestinationUDPIP (udp_dstip) retrieves it from slsReceiver
* Must be followed by configuremac. * process but must be set if you use a custom receiver (not slsReceiver).
*/ */
void setDestinationUDPMAC(const MacAddr mac, Positions pos = {}); void setDestinationUDPMAC(const MacAddr mac, Positions pos = {});
/** [Jungfrau bottom half] */ /** [Jungfrau] bottom half \n [Gotthard2] veto debugging */
Result<MacAddr> getDestinationUDPMAC2(Positions pos = {}) const; Result<MacAddr> getDestinationUDPMAC2(Positions pos = {}) const;
/** [Jungfrau bottom half] */ /* [Jungfrau][Gotthard2] Mac address of the receiver (destination) udp
interface 2. \n Not mandatory to set as udp_dstip2 retrieves it from
slsReceiver process but must be set if you use a custom receiver (not
slsReceiver). \n [Jungfrau] bottom half \n [Gotthard2] veto debugging \n
*/
void setDestinationUDPMAC2(const MacAddr mac, Positions pos = {}); void setDestinationUDPMAC2(const MacAddr mac, Positions pos = {});
Result<int> getDestinationUDPPort(Positions pos = {}) const; Result<int> getDestinationUDPPort(Positions pos = {}) const;
/** module_id is -1 for all detectors, ports for each module is calculated /** Default is 50001. \n If module_id is -1, ports for each module is
* (increments) */ * calculated (incremented by 1 if no 2nd interface) */
void setDestinationUDPPort(int port, int module_id = -1); void setDestinationUDPPort(int port, int module_id = -1);
/** [Eiger right port][Jungfrau bottom half] */ /** [Eiger] right port[Jungfrau] bottom half [Gotthard2] veto debugging */
Result<int> getDestinationUDPPort2(Positions pos = {}) const; Result<int> getDestinationUDPPort2(Positions pos = {}) const;
/** [Eiger right port][Jungfrau bottom half] /** [Eiger] right port[Jungfrau] bottom half [Gotthard2] veto debugging \n
* module_id is -1 for all detectors, ports for each module is calculated * Default is 50002. \n If module_id is -1, ports for each module is
* (increments) * calculated (incremented by 1 if no 2nd interface)*/
*/
void setDestinationUDPPort2(int port, int module_id = -1); void setDestinationUDPPort2(int port, int module_id = -1);
void reconfigureUDPDestination(Positions pos = {}); void reconfigureUDPDestination(Positions pos = {});
@ -621,10 +641,13 @@ class Detector {
* port * port
*/ */
void setTransmissionDelayRight(int value, Positions pos = {}); void setTransmissionDelayRight(int value, Positions pos = {});
///@{
/** @name Receiver Configuration */
///@{
/************************************************** /**************************************************
* * * *
* Receiver Config * * Receiver Configuration *
* * * *
* ************************************************/ * ************************************************/
@ -703,7 +726,10 @@ class Detector {
Result<std::array<pid_t, NUM_RX_THREAD_IDS>> Result<std::array<pid_t, NUM_RX_THREAD_IDS>>
getRxThreadIds(Positions pos = {}) const; getRxThreadIds(Positions pos = {}) const;
///@{
/** @name File */
///@{
/************************************************** /**************************************************
* * * *
* File * * File *
@ -740,7 +766,7 @@ class Detector {
Result<bool> getMasterFileWrite(Positions pos = {}) const; Result<bool> getMasterFileWrite(Positions pos = {}) const;
/* default enabled */ /**default enabled */
void setMasterFileWrite(bool value, Positions pos = {}); void setMasterFileWrite(bool value, Positions pos = {});
Result<bool> getFileOverWrite(Positions pos = {}) const; Result<bool> getFileOverWrite(Positions pos = {}) const;
@ -753,7 +779,10 @@ class Detector {
/** Default depends on detector type. \n 0 will set frames per file to /** Default depends on detector type. \n 0 will set frames per file to
* unlimited */ * unlimited */
void setFramesPerFile(int n, Positions pos = {}); void setFramesPerFile(int n, Positions pos = {});
///@{
/** @name ZMQ Streaming Parameters (Receiver<->Client) */
///@{
/************************************************** /**************************************************
* * * *
* ZMQ Streaming Parameters (Receiver<->Client)* * ZMQ Streaming Parameters (Receiver<->Client)*
@ -803,10 +832,10 @@ class Detector {
/** Zmq port for data to be streamed out of the receiver. \n /** Zmq port for data to be streamed out of the receiver. \n
* Also restarts receiver zmq streaming if enabled. \n Default is 30001. \n * Also restarts receiver zmq streaming if enabled. \n Default is 30001. \n
* Modified only when using an intermediate process after receiver. \n Must * Must be different for every detector (and udp port). \n module_id is -1
* be different for every detector (and udp port). \n module_id is -1 for * for all detectors, ports for each module is calculated (increment by 1 if
* all detectors, ports for each module is calculated (increments) Restarts * no 2nd interface). \n Restarts receiver zmq sockets only if it was
* receiver zmq sockets only if it was already enabled * already enabled
*/ */
void setRxZmqPort(int port, int module_id = -1); void setRxZmqPort(int port, int module_id = -1);
@ -820,18 +849,27 @@ class Detector {
Result<int> getClientZmqPort(Positions pos = {}) const; Result<int> getClientZmqPort(Positions pos = {}) const;
/** /** Port number to listen to zmq data streamed out from receiver or
* Modified only when using an intermediate process between receiver and * intermediate process. \n Must be different for every detector (and udp
* gui/client. Module_id is -1 for all detectors, ports for each module is * port). \n Module_id is -1 for all detectors, ports for each module is
* calculated (increments) Restarts client zmq sockets only if it was * calculated (increment by 1 if no 2nd interface). \n Restarts client zmq
* already enabled * sockets only if it was already enabled \n Default connects to receiver
* zmq streaming out port (30001).
*/ */
void setClientZmqPort(int port, int module_id = -1); void setClientZmqPort(int port, int module_id = -1);
Result<IpAddr> getClientZmqIp(Positions pos = {}) const; Result<IpAddr> getClientZmqIp(Positions pos = {}) const;
/** Ip Address to listen to zmq data streamed out from receiver or
* intermediate process. Default connects to receiver zmq Ip Address (from
* rx_hostname). Modified only when using an intermediate process between
* receiver and client(gui). Also restarts client zmq streaming if enabled.
*/
void setClientZmqIp(const IpAddr ip, Positions pos = {}); void setClientZmqIp(const IpAddr ip, Positions pos = {});
///@{
/** @name Eiger Specific */
///@{
/************************************************** /**************************************************
* * * *
* Eiger Specific * * Eiger Specific *
@ -879,7 +917,8 @@ class Detector {
/**[Eiger] Returns energies in eV where the module is trimmed */ /**[Eiger] Returns energies in eV where the module is trimmed */
Result<std::vector<int>> getTrimEnergies(Positions pos = {}) const; Result<std::vector<int>> getTrimEnergies(Positions pos = {}) const;
/** [Eiger] Set the energies where the detector is trimmed */ /** [Eiger] List of trim energies, where corresponding default trim files
* exist in corresponding trim folders */
void setTrimEnergies(std::vector<int> energies, Positions pos = {}); void setTrimEnergies(std::vector<int> energies, Positions pos = {});
/** [Eiger] deadtime in ns, 0 = disabled */ /** [Eiger] deadtime in ns, 0 = disabled */
@ -953,7 +992,10 @@ class Detector {
/** [Eiger] with specific quad hardware */ /** [Eiger] with specific quad hardware */
void setQuad(const bool enable); void setQuad(const bool enable);
///@{
/** @name Jungfrau Specific */
///@{
/************************************************** /**************************************************
* * * *
* Jungfrau Specific * * Jungfrau Specific *
@ -1022,7 +1064,10 @@ class Detector {
/** [Jungfrau] Advanced \n /** [Jungfrau] Advanced \n
* Options: (0-1638375 ns (resolution of 25ns) */ * Options: (0-1638375 ns (resolution of 25ns) */
void setStorageCellDelay(ns value, Positions pos = {}); void setStorageCellDelay(ns value, Positions pos = {});
///@{
/** @name Gotthard Specific */
///@{
/************************************************** /**************************************************
* * * *
* Gotthard Specific * * Gotthard Specific *
@ -1045,7 +1090,10 @@ class Detector {
/** [Gotthard] */ /** [Gotthard] */
Result<ns> getExptimeLeft(Positions pos = {}) const; Result<ns> getExptimeLeft(Positions pos = {}) const;
///@{
/** @name Gotthard2 Specific */
///@{
/************************************************** /**************************************************
* * * *
* Gotthard2 Specific * * Gotthard2 Specific *
@ -1124,7 +1172,7 @@ class Detector {
/** [Gotthard2] */ /** [Gotthard2] */
Result<bool> getVeto(Positions pos = {}) const; Result<bool> getVeto(Positions pos = {}) const;
/** [Gotthard2] */ /** [Gotthard2] Default disabled */
void setVeto(const bool enable, Positions pos = {}); void setVeto(const bool enable, Positions pos = {});
/** [Gotthard2] */ /** [Gotthard2] */
@ -1140,7 +1188,10 @@ class Detector {
/** [Gotthard2] */ /** [Gotthard2] */
void setBadChannels(const std::string &fname, Positions pos = {}); void setBadChannels(const std::string &fname, Positions pos = {});
///@{
/** @name Mythen3 Specific */
///@{
/************************************************** /**************************************************
* * * *
* Mythen3 Specific * * Mythen3 Specific *
@ -1181,7 +1232,10 @@ class Detector {
/** [Mythen3] gate delay for all gates in auto or trigger timing mode /** [Mythen3] gate delay for all gates in auto or trigger timing mode
* (internal gating). Gate index: 0-2, -1 for all */ * (internal gating). Gate index: 0-2, -1 for all */
Result<std::array<ns, 3>> getGateDelayForAllGates(Positions pos = {}) const; Result<std::array<ns, 3>> getGateDelayForAllGates(Positions pos = {}) const;
///@{
/** @name CTB / Moench Specific */
///@{
/************************************************** /**************************************************
* * * *
* CTB / Moench Specific * * CTB / Moench Specific *
@ -1236,7 +1290,10 @@ class Detector {
/** [CTB][Moench] */ /** [CTB][Moench] */
void setTenGigaADCEnableMask(uint32_t mask, Positions pos = {}); void setTenGigaADCEnableMask(uint32_t mask, Positions pos = {});
///@{
/** @name CTB Specific */
///@{
/************************************************** /**************************************************
* * * *
* CTB Specific * * CTB Specific *
@ -1320,7 +1377,10 @@ class Detector {
/** [CTB] Default is enabled. */ /** [CTB] Default is enabled. */
void setLEDEnable(bool enable, Positions pos = {}); void setLEDEnable(bool enable, Positions pos = {});
///@{
/** @name Pattern */
///@{
/************************************************** /**************************************************
* * * *
* Pattern * * Pattern *
@ -1369,7 +1429,7 @@ class Detector {
* levels */ * levels */
void setPatternLoopCycles(int level, int n, Positions pos = {}); void setPatternLoopCycles(int level, int n, Positions pos = {});
/* [CTB][Moench][Mythen3] */ /**[CTB][Moench][Mythen3] */
Result<int> getPatternWaitAddr(int level, Positions pos = {}) const; Result<int> getPatternWaitAddr(int level, Positions pos = {}) const;
/** [CTB][Moench][Mythen3] Options: level 0-2 */ /** [CTB][Moench][Mythen3] Options: level 0-2 */
@ -1397,7 +1457,10 @@ class Detector {
/** [Mythen3] */ /** [Mythen3] */
void startPattern(Positions pos = {}); void startPattern(Positions pos = {});
///@{
/** @name Moench specific */
///@{
/************************************************** /**************************************************
* * * *
* Moench specific * * Moench specific *
@ -1426,7 +1489,10 @@ class Detector {
void setAdditionalJsonParameter(const std::string &key, void setAdditionalJsonParameter(const std::string &key,
const std::string &value, const std::string &value,
Positions pos = {}); Positions pos = {});
///@{
/** @name Advanced */
///@{
/************************************************** /**************************************************
* * * *
* Advanced * * Advanced *
@ -1506,7 +1572,10 @@ class Detector {
/** [CTB][Moench][Jungfrau] Advanced user Function! */ /** [CTB][Moench][Jungfrau] Advanced user Function! */
void setADCInvert(uint32_t value, Positions pos = {}); void setADCInvert(uint32_t value, Positions pos = {});
///@{
/** @name Insignificant */
///@{
/************************************************** /**************************************************
* * * *
* Insignificant * * Insignificant *
@ -1549,9 +1618,12 @@ class Detector {
* [Gotthard2] only in continuous mode */ * [Gotthard2] only in continuous mode */
Result<ns> getMeasurementTime(Positions pos = {}) const; Result<ns> getMeasurementTime(Positions pos = {}) const;
/** get user details from shared memory (hostname, type, PID, User, Date)
*/
std::string getUserDetails() const; std::string getUserDetails() const;
Result<uint64_t> getRxCurrentFrameIndex(Positions pos = {}) const; Result<uint64_t> getRxCurrentFrameIndex(Positions pos = {}) const;
///@{
private: private:
std::vector<int> getPortNumbers(int start_port); std::vector<int> getPortNumbers(int start_port);

View File

@ -128,7 +128,7 @@ std::string CmdProxy::Hostname(int action) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
auto t = det->getHostname({det_id}); auto t = det->getHostname(std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.empty()) { if (args.empty()) {
@ -182,7 +182,15 @@ std::string CmdProxy::VirtualServer(int action) {
std::string CmdProxy::Acquire(int action) { std::string CmdProxy::Acquire(int action) {
std::ostringstream os; std::ostringstream os;
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << cmd << "\n\tAcquire the number of frames set up.\n"; os << cmd
<< "\n\tAcquire the number of frames set up.\n\tBlocking command, "
"where control server is blocked and cannot accept other "
"commands until acquisition is done. \n\t- sets acquiring "
"flag\n\t- starts the receiver listener (if enabled)\n\t- starts "
"detector acquisition for number of frames set\n\t- monitors "
"detector status from running to idle\n\t- stops the receiver "
"listener (if enabled)\n\t- increments file index if file write "
"enabled\n\t- resets acquiring flag";
} else { } else {
if (det->empty()) { if (det->empty()) {
throw sls::RuntimeError( throw sls::RuntimeError(
@ -219,7 +227,7 @@ std::string CmdProxy::FirmwareVersion(int action) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
auto t = det->getFirmwareVersion({det_id}); auto t = det->getFirmwareVersion(std::vector<int>{det_id});
if (det->getDetectorType().squash() == defs::EIGER) { if (det->getDetectorType().squash() == defs::EIGER) {
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else { } else {
@ -412,7 +420,7 @@ std::string CmdProxy::Exptime(int action) {
// vector of exptimes // vector of exptimes
if (gateIndex == -1 && if (gateIndex == -1 &&
det->getDetectorType().squash() == defs::MYTHEN3) { det->getDetectorType().squash() == defs::MYTHEN3) {
auto t = det->getExptimeForAllGates({det_id}); auto t = det->getExptimeForAllGates(std::vector<int>{det_id});
if (args.empty()) { if (args.empty()) {
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (args.size() == 1) { } else if (args.size() == 1) {
@ -423,9 +431,9 @@ std::string CmdProxy::Exptime(int action) {
else { else {
Result<ns> t; Result<ns> t;
if (gateIndex == -1) { if (gateIndex == -1) {
t = det->getExptime({det_id}); t = det->getExptime(std::vector<int>{det_id});
} else { } else {
t = det->getExptime(gateIndex, {det_id}); t = det->getExptime(gateIndex, std::vector<int>{det_id});
} }
if (args.empty()) { if (args.empty()) {
os << OutString(t) << '\n'; os << OutString(t) << '\n';
@ -440,16 +448,16 @@ std::string CmdProxy::Exptime(int action) {
std::string unit = RemoveUnit(time_str); std::string unit = RemoveUnit(time_str);
auto t = StringTo<time::ns>(time_str, unit); auto t = StringTo<time::ns>(time_str, unit);
if (type == defs::MYTHEN3) { if (type == defs::MYTHEN3) {
det->setExptime(gateIndex, t, {det_id}); det->setExptime(gateIndex, t, std::vector<int>{det_id});
} else { } else {
det->setExptime(t, {det_id}); det->setExptime(t, std::vector<int>{det_id});
} }
} else if (args.size() == 2) { } else if (args.size() == 2) {
auto t = StringTo<time::ns>(args[0], args[1]); auto t = StringTo<time::ns>(args[0], args[1]);
if (type == defs::MYTHEN3) { if (type == defs::MYTHEN3) {
det->setExptime(gateIndex, t, {det_id}); det->setExptime(gateIndex, t, std::vector<int>{det_id});
} else { } else {
det->setExptime(t, {det_id}); det->setExptime(t, std::vector<int>{det_id});
} }
} else { } else {
WrongNumberOfParameters(2); WrongNumberOfParameters(2);
@ -480,7 +488,7 @@ std::string CmdProxy::DynamicRange(int action) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
auto t = det->getDynamicRange({det_id}); auto t = det->getDynamicRange(std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (det_id != -1) { if (det_id != -1) {
@ -523,7 +531,7 @@ std::string CmdProxy::Speed(int action) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
auto t = det->getSpeed({det_id}); auto t = det->getSpeed(std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() != 1) { if (args.size() != 1) {
@ -548,7 +556,7 @@ std::string CmdProxy::Speed(int action) {
} catch (...) { } catch (...) {
t = sls::StringTo<defs::speedLevel>(args[0]); t = sls::StringTo<defs::speedLevel>(args[0]);
} }
det->setSpeed(t, {det_id}); det->setSpeed(t, std::vector<int>{det_id});
os << sls::ToString(t) << '\n'; // no args to convert 0,1,2 as well os << sls::ToString(t) << '\n'; // no args to convert 0,1,2 as well
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -580,7 +588,7 @@ std::string CmdProxy::Adcphase(int action) {
if (action == defs::GET_ACTION) { if (action == defs::GET_ACTION) {
Result<int> t; Result<int> t;
if (args.empty()) { if (args.empty()) {
t = det->getADCPhase({det_id}); t = det->getADCPhase(std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (args.size() == 1) { } else if (args.size() == 1) {
if (args[0] != "deg") { if (args[0] != "deg") {
@ -588,21 +596,23 @@ std::string CmdProxy::Adcphase(int action) {
args[0] + args[0] +
". Did you mean deg? "); ". Did you mean deg? ");
} }
t = det->getADCPhaseInDegrees({det_id}); t = det->getADCPhaseInDegrees(std::vector<int>{det_id});
os << OutString(t) << " deg\n"; os << OutString(t) << " deg\n";
} else { } else {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() == 1) { if (args.size() == 1) {
det->setADCPhase(StringTo<int>(args[0]), {det_id}); det->setADCPhase(StringTo<int>(args[0]),
std::vector<int>{det_id});
os << args.front() << '\n'; os << args.front() << '\n';
} else if (args.size() == 2) { } else if (args.size() == 2) {
if (args[1] != "deg") { if (args[1] != "deg") {
throw sls::RuntimeError("Unknown adcphase 2nd argument " + throw sls::RuntimeError("Unknown adcphase 2nd argument " +
args[1] + ". Did you mean deg?"); args[1] + ". Did you mean deg?");
} }
det->setADCPhaseInDegrees(StringTo<int>(args[0]), {det_id}); det->setADCPhaseInDegrees(StringTo<int>(args[0]),
std::vector<int>{det_id});
os << args[0] << " " << args[1] << '\n'; os << args[0] << " " << args[1] << '\n';
} else { } else {
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
@ -633,28 +643,30 @@ std::string CmdProxy::Dbitphase(int action) {
if (action == defs::GET_ACTION) { if (action == defs::GET_ACTION) {
Result<int> t; Result<int> t;
if (args.empty()) { if (args.empty()) {
t = det->getDBITPhase({det_id}); t = det->getDBITPhase(std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (args.size() == 1) { } else if (args.size() == 1) {
if (args[0] != "deg") { if (args[0] != "deg") {
throw sls::RuntimeError("Unknown dbitphase argument " + throw sls::RuntimeError("Unknown dbitphase argument " +
args[0] + ". Did you mean deg? "); args[0] + ". Did you mean deg? ");
} }
t = det->getDBITPhaseInDegrees({det_id}); t = det->getDBITPhaseInDegrees(std::vector<int>{det_id});
os << OutString(t) << " deg\n"; os << OutString(t) << " deg\n";
} else { } else {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() == 1) { if (args.size() == 1) {
det->setDBITPhase(StringTo<int>(args[0]), {det_id}); det->setDBITPhase(StringTo<int>(args[0]),
std::vector<int>{det_id});
os << args.front() << '\n'; os << args.front() << '\n';
} else if (args.size() == 2) { } else if (args.size() == 2) {
if (args[1] != "deg") { if (args[1] != "deg") {
throw sls::RuntimeError("Unknown dbitphase 2nd argument " + throw sls::RuntimeError("Unknown dbitphase 2nd argument " +
args[1] + ". Did you mean deg? "); args[1] + ". Did you mean deg? ");
} }
det->setDBITPhaseInDegrees(StringTo<int>(args[0]), {det_id}); det->setDBITPhaseInDegrees(StringTo<int>(args[0]),
std::vector<int>{det_id});
os << args[0] << " " << args[1] << '\n'; os << args[0] << " " << args[1] << '\n';
} else { } else {
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
@ -683,14 +695,16 @@ std::string CmdProxy::ClockFrequency(int action) {
if (args.size() != 1) { if (args.size() != 1) {
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
} }
auto t = det->getClockFrequency(StringTo<int>(args[0]), {det_id}); auto t = det->getClockFrequency(StringTo<int>(args[0]),
std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() != 2) { if (args.size() != 2) {
WrongNumberOfParameters(2); WrongNumberOfParameters(2);
} }
det->setClockFrequency(StringTo<int>(args[0]), det->setClockFrequency(StringTo<int>(args[0]),
StringTo<int>(args[1]), {det_id}); StringTo<int>(args[1]),
std::vector<int>{det_id});
os << StringTo<int>(args[1]) << '\n'; os << StringTo<int>(args[1]) << '\n';
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -716,7 +730,8 @@ std::string CmdProxy::ClockPhase(int action) {
} }
if (action == defs::GET_ACTION) { if (action == defs::GET_ACTION) {
if (args.size() == 1) { if (args.size() == 1) {
auto t = det->getClockPhase(StringTo<int>(args[0]), {det_id}); auto t = det->getClockPhase(StringTo<int>(args[0]),
std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (args.size() == 2) { } else if (args.size() == 2) {
if (args[1] != "deg") { if (args[1] != "deg") {
@ -732,7 +747,8 @@ std::string CmdProxy::ClockPhase(int action) {
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() == 2) { if (args.size() == 2) {
det->setClockPhase(StringTo<int>(args[0]), det->setClockPhase(StringTo<int>(args[0]),
StringTo<int>(args[1]), {det_id}); StringTo<int>(args[1]),
std::vector<int>{det_id});
os << args[1] << '\n'; os << args[1] << '\n';
} else if (args.size() == 3) { } else if (args.size() == 3) {
if (args[2] != "deg") { if (args[2] != "deg") {
@ -740,7 +756,8 @@ std::string CmdProxy::ClockPhase(int action) {
". Did you mean deg?"); ". Did you mean deg?");
} }
det->setClockPhaseinDegrees(StringTo<int>(args[0]), det->setClockPhaseinDegrees(StringTo<int>(args[0]),
StringTo<int>(args[1]), {det_id}); StringTo<int>(args[1]),
std::vector<int>{det_id});
os << args[1] << " " << args[2] << '\n'; os << args[1] << " " << args[2] << '\n';
} else { } else {
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
@ -769,8 +786,8 @@ std::string CmdProxy::MaxClockPhaseShift(int action) {
if (args.size() != 1) { if (args.size() != 1) {
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
} }
auto t = auto t = det->getMaxClockPhaseShift(StringTo<int>(args[0]),
det->getMaxClockPhaseShift(StringTo<int>(args[0]), {det_id}); std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
throw sls::RuntimeError("Cannot put"); throw sls::RuntimeError("Cannot put");
@ -798,7 +815,8 @@ std::string CmdProxy::ClockDivider(int action) {
if (args.size() != 1) { if (args.size() != 1) {
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
} }
auto t = det->getClockDivider(StringTo<int>(args[0]), {det_id}); auto t = det->getClockDivider(StringTo<int>(args[0]),
std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() != 2) { if (args.size() != 2) {
@ -832,7 +850,8 @@ std::string CmdProxy::ExternalSignal(int action) {
if (args.size() != 1) { if (args.size() != 1) {
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
} }
auto t = det->getExternalSignalFlags(StringTo<int>(args[0]), {det_id}); auto t = det->getExternalSignalFlags(StringTo<int>(args[0]),
std::vector<int>{det_id});
os << args[0] << " " << OutString(t) << '\n'; os << args[0] << " " << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() != 2) { if (args.size() != 2) {
@ -840,7 +859,8 @@ std::string CmdProxy::ExternalSignal(int action) {
} }
det->setExternalSignalFlags( det->setExternalSignalFlags(
StringTo<int>(args[0]), StringTo<int>(args[0]),
StringTo<slsDetectorDefs::externalSignalFlag>(args[1]), {det_id}); StringTo<slsDetectorDefs::externalSignalFlag>(args[1]),
std::vector<int>{det_id});
os << args[0] << " " << args[1] << '\n'; os << args[0] << " " << args[1] << '\n';
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -864,10 +884,14 @@ std::string CmdProxy::TemperatureValues(int action) {
if (t.size() > 0) { if (t.size() > 0) {
auto it = t.cbegin(); auto it = t.cbegin();
os << ToString(*it) << ' '; os << ToString(*it) << ' ';
os << OutString(det->getTemperature(*it++, {det_id})) << " °C"; os << OutString(
det->getTemperature(*it++, std::vector<int>{det_id}))
<< " °C";
while (it != t.cend()) { while (it != t.cend()) {
os << ", " << ToString(*it) << ' '; os << ", " << ToString(*it) << ' ';
os << OutString(det->getTemperature(*it++, {det_id})) << " °C"; os << OutString(
det->getTemperature(*it++, std::vector<int>{det_id}))
<< " °C";
} }
} }
os << "]\n"; os << "]\n";
@ -903,8 +927,9 @@ std::string CmdProxy::Dac(int action) {
} else if (args.size() > 2) { } else if (args.size() > 2) {
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
} }
auto t = det->getDAC( auto t =
static_cast<defs::dacIndex>(StringTo<int>(args[0])), mv, {det_id}); det->getDAC(static_cast<defs::dacIndex>(StringTo<int>(args[0])), mv,
std::vector<int>{det_id});
os << args[0] << ' ' << OutString(t) os << args[0] << ' ' << OutString(t)
<< (args.size() > 1 ? " mV\n" : "\n"); << (args.size() > 1 ? " mV\n" : "\n");
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
@ -919,7 +944,7 @@ std::string CmdProxy::Dac(int action) {
WrongNumberOfParameters(2); WrongNumberOfParameters(2);
} }
det->setDAC(static_cast<defs::dacIndex>(StringTo<int>(args[0])), det->setDAC(static_cast<defs::dacIndex>(StringTo<int>(args[0])),
StringTo<int>(args[1]), mv, {det_id}); StringTo<int>(args[1]), mv, std::vector<int>{det_id});
os << args[0] << ' ' << args[1] << (args.size() > 2 ? " mV\n" : "\n"); os << args[0] << ' ' << args[1] << (args.size() > 2 ? " mV\n" : "\n");
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -949,11 +974,11 @@ std::string CmdProxy::DacValues(int action) {
os << '['; os << '[';
auto it = t.cbegin(); auto it = t.cbegin();
os << ToString(*it) << ' '; os << ToString(*it) << ' ';
os << OutString(det->getDAC(*it++, mv, {det_id})) os << OutString(det->getDAC(*it++, mv, std::vector<int>{det_id}))
<< (!args.empty() ? " mV" : ""); << (!args.empty() ? " mV" : "");
while (it != t.cend()) { while (it != t.cend()) {
os << ", " << ToString(*it) << ' '; os << ", " << ToString(*it) << ' ';
os << OutString(det->getDAC(*it++, mv, {det_id})) os << OutString(det->getDAC(*it++, mv, std::vector<int>{det_id}))
<< (!args.empty() ? " mV" : ""); << (!args.empty() ? " mV" : "");
} }
os << "]\n"; os << "]\n";
@ -977,7 +1002,7 @@ std::string CmdProxy::ReceiverStatus(int action) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
auto t = det->getReceiverStatus({det_id}); auto t = det->getReceiverStatus(std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
throw sls::RuntimeError( throw sls::RuntimeError(
@ -999,7 +1024,7 @@ std::string CmdProxy::DetectorStatus(int action) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
auto t = det->getDetectorStatus({det_id}); auto t = det->getDetectorStatus(std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
throw sls::RuntimeError( throw sls::RuntimeError(
@ -1076,7 +1101,7 @@ std::string CmdProxy::UDPDestinationIP(int action) {
"rx_hostname." "rx_hostname."
<< '\n'; << '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
auto t = det->getDestinationUDPIP({det_id}); auto t = det->getDestinationUDPIP(std::vector<int>{det_id});
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
@ -1087,7 +1112,7 @@ std::string CmdProxy::UDPDestinationIP(int action) {
} }
if (args[0] == "auto") { if (args[0] == "auto") {
std::string rxHostname = std::string rxHostname =
det->getRxHostname({det_id}).squash("none"); det->getRxHostname(std::vector<int>{det_id}).squash("none");
// Hostname could be ip try to decode otherwise look up the hostname // Hostname could be ip try to decode otherwise look up the hostname
auto val = sls::IpAddr{rxHostname}; auto val = sls::IpAddr{rxHostname};
if (val == 0) { if (val == 0) {
@ -1095,11 +1120,11 @@ std::string CmdProxy::UDPDestinationIP(int action) {
} }
LOG(logINFO) << "Setting udp_dstip of detector " << det_id << " to " LOG(logINFO) << "Setting udp_dstip of detector " << det_id << " to "
<< val; << val;
det->setDestinationUDPIP(val, {det_id}); det->setDestinationUDPIP(val, std::vector<int>{det_id});
os << val << '\n'; os << val << '\n';
} else { } else {
auto val = IpAddr(args[0]); auto val = IpAddr(args[0]);
det->setDestinationUDPIP(val, {det_id}); det->setDestinationUDPIP(val, std::vector<int>{det_id});
os << args.front() << '\n'; os << args.front() << '\n';
} }
} else { } else {
@ -1112,13 +1137,13 @@ std::string CmdProxy::UDPDestinationIP2(int action) {
std::ostringstream os; std::ostringstream os;
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[x.x.x.x] or auto\n\t[Jungfrau] Ip address of the receiver " os << "[x.x.x.x] or auto\n\t[Jungfrau][Gotthard2] Ip address of the "
"(destination) udp interface where the second half of detector " "receiver (destination) udp interface 2. If 'auto' used, then ip "
"data is sent to. If 'auto' used, then ip is set to ip of " "is set to ip of rx_hostname.\n\t[Jungfrau] bottom half "
"rx_hostname." "\n\t[Gotthard2] veto debugging. "
<< '\n'; << '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
auto t = det->getDestinationUDPIP2({det_id}); auto t = det->getDestinationUDPIP2(std::vector<int>{det_id});
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
@ -1129,7 +1154,7 @@ std::string CmdProxy::UDPDestinationIP2(int action) {
} }
if (args[0] == "auto") { if (args[0] == "auto") {
std::string rxHostname = std::string rxHostname =
det->getRxHostname({det_id}).squash("none"); det->getRxHostname(std::vector<int>{det_id}).squash("none");
// Hostname could be ip try to decode otherwise look up the hostname // Hostname could be ip try to decode otherwise look up the hostname
auto val = sls::IpAddr{rxHostname}; auto val = sls::IpAddr{rxHostname};
if (val == 0) { if (val == 0) {
@ -1137,11 +1162,11 @@ std::string CmdProxy::UDPDestinationIP2(int action) {
} }
LOG(logINFO) << "Setting udp_dstip2 of detector " << det_id LOG(logINFO) << "Setting udp_dstip2 of detector " << det_id
<< " to " << val; << " to " << val;
det->setDestinationUDPIP2(val, {det_id}); det->setDestinationUDPIP2(val, std::vector<int>{det_id});
os << val << '\n'; os << val << '\n';
} else { } else {
auto val = IpAddr(args[0]); auto val = IpAddr(args[0]);
det->setDestinationUDPIP2(val, {det_id}); det->setDestinationUDPIP2(val, std::vector<int>{det_id});
os << args.front() << '\n'; os << args.front() << '\n';
} }
} else { } else {
@ -1169,7 +1194,7 @@ std::string CmdProxy::ReceiverHostname(int action) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
auto t = det->getRxHostname({det_id}); auto t = det->getRxHostname(std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() < 1) { if (args.size() < 1) {
@ -1203,7 +1228,7 @@ std::string CmdProxy::ReceiverHostname(int action) {
} }
// single receiver // single receiver
else { else {
det->setRxHostname(args[0], {det_id}); det->setRxHostname(args[0], std::vector<int>{det_id});
os << ToString(args) << '\n'; os << ToString(args) << '\n';
} }
} }
@ -1229,13 +1254,14 @@ std::string CmdProxy::Threshold(int action) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
auto t = det->getThresholdEnergy({det_id}); auto t = det->getThresholdEnergy(std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() == 1) { if (args.size() == 1) {
auto t = det->getSettings({det_id}).tsquash( auto t = det->getSettings(std::vector<int>{det_id})
"Inconsistent settings between detectors"); .tsquash("Inconsistent settings between detectors");
det->setThresholdEnergy(StringTo<int>(args[0]), t, true, {det_id}); det->setThresholdEnergy(StringTo<int>(args[0]), t, true,
std::vector<int>{det_id});
} else if (args.size() == 2) { } else if (args.size() == 2) {
det->setThresholdEnergy( det->setThresholdEnergy(
StringTo<int>(args[0]), StringTo<int>(args[0]),
@ -1263,14 +1289,15 @@ std::string CmdProxy::ThresholdNoTb(int action) {
throw sls::RuntimeError("cannot get"); throw sls::RuntimeError("cannot get");
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() == 1) { if (args.size() == 1) {
auto t = det->getSettings({det_id}).tsquash( auto t = det->getSettings(std::vector<int>{det_id})
"Inconsistent settings between detectors"); .tsquash("Inconsistent settings between detectors");
det->setThresholdEnergy(StringTo<int>(args[0]), t, false, {det_id}); det->setThresholdEnergy(StringTo<int>(args[0]), t, false,
std::vector<int>{det_id});
} else if (args.size() == 2) { } else if (args.size() == 2) {
det->setThresholdEnergy( det->setThresholdEnergy(
StringTo<int>(args[0]), StringTo<int>(args[0]),
sls::StringTo<slsDetectorDefs::detectorSettings>(args[1]), sls::StringTo<slsDetectorDefs::detectorSettings>(args[1]),
false, {det_id}); false, std::vector<int>{det_id});
} else { } else {
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
} }
@ -1294,7 +1321,7 @@ std::string CmdProxy::TrimEnergies(int action) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
auto t = det->getTrimEnergies({det_id}); auto t = det->getTrimEnergies(std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
std::vector<int> t(args.size()); std::vector<int> t(args.size());
@ -1303,7 +1330,7 @@ std::string CmdProxy::TrimEnergies(int action) {
t[i] = StringTo<int>(args[i]); t[i] = StringTo<int>(args[i]);
} }
} }
det->setTrimEnergies(t, {det_id}); det->setTrimEnergies(t, std::vector<int>{det_id});
os << sls::ToString(args) << '\n'; os << sls::ToString(args) << '\n';
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -1323,7 +1350,7 @@ std::string CmdProxy::RateCorrection(int action) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
auto t = det->getRateCorrection({det_id}); auto t = det->getRateCorrection(std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() != 1) { if (args.size() != 1) {
@ -1331,12 +1358,12 @@ std::string CmdProxy::RateCorrection(int action) {
} }
int tau = StringTo<int>(args[0]); int tau = StringTo<int>(args[0]);
if (tau == -1) { if (tau == -1) {
det->setDefaultRateCorrection({det_id}); det->setDefaultRateCorrection(std::vector<int>{det_id});
auto t = det->getRateCorrection({det_id}); auto t = det->getRateCorrection(std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else { } else {
auto t = StringTo<time::ns>(args[0], "ns"); auto t = StringTo<time::ns>(args[0], "ns");
det->setRateCorrection(t, {det_id}); det->setRateCorrection(t, std::vector<int>{det_id});
os << args.front() << "ns\n"; os << args.front() << "ns\n";
} }
} else { } else {
@ -1357,8 +1384,8 @@ std::string CmdProxy::Activate(int action) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
auto t = det->getActive({det_id}); auto t = det->getActive(std::vector<int>{det_id});
auto p = det->getRxPadDeactivatedMode({det_id}); auto p = det->getRxPadDeactivatedMode(std::vector<int>{det_id});
Result<std::string> pResult(p.size()); Result<std::string> pResult(p.size());
for (unsigned int i = 0; i < p.size(); ++i) { for (unsigned int i = 0; i < p.size(); ++i) {
pResult[i] = p[i] ? "padding" : "nopadding"; pResult[i] = p[i] ? "padding" : "nopadding";
@ -1369,7 +1396,7 @@ std::string CmdProxy::Activate(int action) {
WrongNumberOfParameters(2); WrongNumberOfParameters(2);
} }
int t = StringTo<int>(args[0]); int t = StringTo<int>(args[0]);
det->setActive(t, {det_id}); det->setActive(t, std::vector<int>{det_id});
os << args[0]; os << args[0];
if (args.size() == 2) { if (args.size() == 2) {
bool p = true; bool p = true;
@ -1379,7 +1406,7 @@ std::string CmdProxy::Activate(int action) {
throw sls::RuntimeError( throw sls::RuntimeError(
"Unknown argument for deactivated padding."); "Unknown argument for deactivated padding.");
} }
det->setRxPadDeactivatedMode(p, {det_id}); det->setRxPadDeactivatedMode(p, std::vector<int>{det_id});
os << ' ' << args[1]; os << ' ' << args[1];
} }
os << '\n'; os << '\n';
@ -1406,7 +1433,7 @@ std::string CmdProxy::PulsePixel(int action) {
defs::xy c; defs::xy c;
c.x = StringTo<int>(args[1]); c.x = StringTo<int>(args[1]);
c.y = StringTo<int>(args[2]); c.y = StringTo<int>(args[2]);
det->pulsePixel(n, c, {det_id}); det->pulsePixel(n, c, std::vector<int>{det_id});
os << sls::ToString(args) << '\n'; os << sls::ToString(args) << '\n';
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -1431,7 +1458,7 @@ std::string CmdProxy::PulsePixelAndMove(int action) {
defs::xy c; defs::xy c;
c.x = StringTo<int>(args[1]); c.x = StringTo<int>(args[1]);
c.y = StringTo<int>(args[2]); c.y = StringTo<int>(args[2]);
det->pulsePixelNMove(n, c, {det_id}); det->pulsePixelNMove(n, c, std::vector<int>{det_id});
os << sls::ToString(args) << '\n'; os << sls::ToString(args) << '\n';
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -1453,7 +1480,7 @@ std::string CmdProxy::PulseChip(int action) {
if (args.size() != 1) { if (args.size() != 1) {
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
} }
det->pulseChip(StringTo<int>(args[0]), {det_id}); det->pulseChip(StringTo<int>(args[0]), std::vector<int>{det_id});
os << args.front() << '\n'; os << args.front() << '\n';
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -1472,7 +1499,7 @@ std::string CmdProxy::Quad(int action) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
auto t = det->getQuad({det_id}); auto t = det->getQuad(std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (det_id != -1) { if (det_id != -1) {
@ -1506,7 +1533,7 @@ std::string CmdProxy::TemperatureEvent(int action) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
auto t = det->getTemperatureEvent({det_id}); auto t = det->getTemperatureEvent(std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() != 1) { if (args.size() != 1) {
@ -1516,7 +1543,7 @@ std::string CmdProxy::TemperatureEvent(int action) {
throw sls::RuntimeError("Unknown argument for temp event. Did you " throw sls::RuntimeError("Unknown argument for temp event. Did you "
"mean 0 to reset event?"); "mean 0 to reset event?");
} }
det->resetTemperatureEvent({det_id}); det->resetTemperatureEvent(std::vector<int>{det_id});
os << "cleared" << '\n'; os << "cleared" << '\n';
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -1538,7 +1565,7 @@ std::string CmdProxy::ROI(int action) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
auto t = det->getROI({det_id}); auto t = det->getROI(std::vector<int>{det_id});
for (auto &it : t) { for (auto &it : t) {
os << '[' << it.xmin << ", " << it.xmax << "] \n"; os << '[' << it.xmin << ", " << it.xmax << "] \n";
} }
@ -1571,7 +1598,7 @@ std::string CmdProxy::ClearROI(int action) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
det->clearROI({det_id}); det->clearROI(std::vector<int>{det_id});
os << "[-1, -1]\n"; os << "[-1, -1]\n";
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -1594,7 +1621,7 @@ std::string CmdProxy::InjectChannel(int action) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
auto t = det->getInjectChannel({det_id}); auto t = det->getInjectChannel(std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() != 2) { if (args.size() != 2) {
@ -1624,14 +1651,16 @@ std::string CmdProxy::VetoPhoton(int action) {
if (args.size() != 2) { if (args.size() != 2) {
WrongNumberOfParameters(2); WrongNumberOfParameters(2);
} }
det->getVetoPhoton(StringTo<int>(args[0]), args[1], {det_id}); det->getVetoPhoton(StringTo<int>(args[0]), args[1],
std::vector<int>{det_id});
os << "saved to file " << args[1] << '\n'; os << "saved to file " << args[1] << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() != 4) { if (args.size() != 4) {
WrongNumberOfParameters(4); WrongNumberOfParameters(4);
} }
det->setVetoPhoton(StringTo<int>(args[0]), StringTo<int>(args[1]), det->setVetoPhoton(StringTo<int>(args[0]), StringTo<int>(args[1]),
StringTo<int>(args[2]), args[3], {det_id}); StringTo<int>(args[2]), args[3],
std::vector<int>{det_id});
os << sls::ToString(args) << '\n'; os << sls::ToString(args) << '\n';
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -1676,7 +1705,8 @@ std::string CmdProxy::VetoFile(int action) {
if (args.size() != 2) { if (args.size() != 2) {
WrongNumberOfParameters(2); WrongNumberOfParameters(2);
} }
det->setVetoFile(StringTo<int>(args[0]), args[1], {det_id}); det->setVetoFile(StringTo<int>(args[0]), args[1],
std::vector<int>{det_id});
os << sls::ToString(args) << '\n'; os << sls::ToString(args) << '\n';
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -1696,7 +1726,7 @@ std::string CmdProxy::BurstMode(int action) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
auto t = det->getBurstMode({det_id}); auto t = det->getBurstMode(std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() != 1) { if (args.size() != 1) {
@ -1724,7 +1754,7 @@ std::string CmdProxy::BurstMode(int action) {
} catch (...) { } catch (...) {
t = sls::StringTo<defs::burstMode>(args[0]); t = sls::StringTo<defs::burstMode>(args[0]);
} }
det->setBurstMode(t, {det_id}); det->setBurstMode(t, std::vector<int>{det_id});
os << sls::ToString(t) << '\n'; // no args to convert 0,1,2 as well os << sls::ToString(t) << '\n'; // no args to convert 0,1,2 as well
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -1747,7 +1777,8 @@ std::string CmdProxy::ConfigureADC(int action) {
WrongNumberOfParameters(2); WrongNumberOfParameters(2);
} }
auto t = det->getADCConfiguration(StringTo<int>(args[0]), auto t = det->getADCConfiguration(StringTo<int>(args[0]),
StringTo<int>(args[1]), {det_id}); StringTo<int>(args[1]),
std::vector<int>{det_id});
os << OutStringHex(t) << '\n'; os << OutStringHex(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() != 3) { if (args.size() != 3) {
@ -1755,7 +1786,7 @@ std::string CmdProxy::ConfigureADC(int action) {
} }
int value = StringTo<int>(args[2]); int value = StringTo<int>(args[2]);
det->setADCConfiguration(StringTo<int>(args[0]), StringTo<int>(args[1]), det->setADCConfiguration(StringTo<int>(args[0]), StringTo<int>(args[1]),
value, {det_id}); value, std::vector<int>{det_id});
os << '[' << args[0] << ", " << args[1] << ", " << ToStringHex(value) os << '[' << args[0] << ", " << args[1] << ", " << ToStringHex(value)
<< "]\n"; << "]\n";
} else { } else {
@ -1775,13 +1806,13 @@ std::string CmdProxy::BadChannels(int action) {
if (args.size() != 1) { if (args.size() != 1) {
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
} }
det->getBadChannels(args[0], {det_id}); det->getBadChannels(args[0], std::vector<int>{det_id});
os << "successfully retrieved" << '\n'; os << "successfully retrieved" << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() != 1) { if (args.size() != 1) {
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
} }
det->setBadChannels(args[0], {det_id}); det->setBadChannels(args[0], std::vector<int>{det_id});
os << "successfully loaded" << '\n'; os << "successfully loaded" << '\n';
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -1803,7 +1834,7 @@ std::string CmdProxy::Counters(int action) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
auto mask = det->getCounterMask({det_id}).squash(-1); auto mask = det->getCounterMask(std::vector<int>{det_id}).squash(-1);
os << sls::ToString(getSetBits(mask)) << '\n'; os << sls::ToString(getSetBits(mask)) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.empty()) { if (args.empty()) {
@ -1821,7 +1852,7 @@ std::string CmdProxy::Counters(int action) {
} }
mask |= (1 << val); mask |= (1 << val);
} }
det->setCounterMask(mask, {det_id}); det->setCounterMask(mask, std::vector<int>{det_id});
os << sls::ToString(args) << '\n'; os << sls::ToString(args) << '\n';
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -1871,7 +1902,7 @@ std::string CmdProxy::GateDelay(int action) {
} }
// vector of gate delays // vector of gate delays
if (gateIndex == -1) { if (gateIndex == -1) {
auto t = det->getGateDelayForAllGates({det_id}); auto t = det->getGateDelayForAllGates(std::vector<int>{det_id});
if (args.empty()) { if (args.empty()) {
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (args.size() == 1) { } else if (args.size() == 1) {
@ -1880,7 +1911,7 @@ std::string CmdProxy::GateDelay(int action) {
} }
// single gate delay // single gate delay
else { else {
auto t = det->getGateDelay(gateIndex, {det_id}); auto t = det->getGateDelay(gateIndex, std::vector<int>{det_id});
if (args.empty()) { if (args.empty()) {
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (args.size() == 1) { } else if (args.size() == 1) {
@ -1892,10 +1923,10 @@ std::string CmdProxy::GateDelay(int action) {
std::string time_str(args[0]); std::string time_str(args[0]);
std::string unit = RemoveUnit(time_str); std::string unit = RemoveUnit(time_str);
auto t = StringTo<time::ns>(time_str, unit); auto t = StringTo<time::ns>(time_str, unit);
det->setGateDelay(gateIndex, t, {det_id}); det->setGateDelay(gateIndex, t, std::vector<int>{det_id});
} else if (args.size() == 2) { } else if (args.size() == 2) {
auto t = StringTo<time::ns>(args[0], args[1]); auto t = StringTo<time::ns>(args[0], args[1]);
det->setGateDelay(gateIndex, t, {det_id}); det->setGateDelay(gateIndex, t, std::vector<int>{det_id});
} else { } else {
WrongNumberOfParameters(2); WrongNumberOfParameters(2);
} }
@ -1924,10 +1955,10 @@ std::string CmdProxy::Samples(int action) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
auto a = det->getNumberOfAnalogSamples({det_id}); auto a = det->getNumberOfAnalogSamples(std::vector<int>{det_id});
// get also digital samples for ctb and compare with analog // get also digital samples for ctb and compare with analog
if (det->getDetectorType().squash() == defs::CHIPTESTBOARD) { if (det->getDetectorType().squash() == defs::CHIPTESTBOARD) {
auto d = det->getNumberOfDigitalSamples({det_id}); auto d = det->getNumberOfDigitalSamples(std::vector<int>{det_id});
int as = a.squash(-1); int as = a.squash(-1);
int ds = d.squash(-1); int ds = d.squash(-1);
if (as == -1 || ds == -1 || as != ds) { // check if a == d? if (as == -1 || ds == -1 || as != ds) { // check if a == d?
@ -1940,10 +1971,12 @@ std::string CmdProxy::Samples(int action) {
if (args.size() != 1) { if (args.size() != 1) {
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
} }
det->setNumberOfAnalogSamples(StringTo<int>(args[0]), {det_id}); det->setNumberOfAnalogSamples(StringTo<int>(args[0]),
std::vector<int>{det_id});
// set also digital samples for ctb // set also digital samples for ctb
if (det->getDetectorType().squash() == defs::CHIPTESTBOARD) { if (det->getDetectorType().squash() == defs::CHIPTESTBOARD) {
det->setNumberOfDigitalSamples(StringTo<int>(args[0]), {det_id}); det->setNumberOfDigitalSamples(StringTo<int>(args[0]),
std::vector<int>{det_id});
} }
os << args.front() << '\n'; os << args.front() << '\n';
} else { } else {
@ -1970,7 +2003,8 @@ std::string CmdProxy::SlowAdc(int action) {
throw sls::RuntimeError("Unknown adc argument " + args[0]); throw sls::RuntimeError("Unknown adc argument " + args[0]);
} }
auto t = det->getSlowADC( auto t = det->getSlowADC(
static_cast<defs::dacIndex>(nchan + defs::SLOW_ADC0), {det_id}); static_cast<defs::dacIndex>(nchan + defs::SLOW_ADC0),
std::vector<int>{det_id});
Result<double> result(t.size()); Result<double> result(t.size());
for (unsigned int i = 0; i < t.size(); ++i) { for (unsigned int i = 0; i < t.size(); ++i) {
result[i] = t[i] / 1000.00; result[i] = t[i] / 1000.00;
@ -1998,7 +2032,7 @@ std::string CmdProxy::ReceiverDbitList(int action) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
auto t = det->getRxDbitList({det_id}); auto t = det->getRxDbitList(std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.empty()) { if (args.empty()) {
@ -2017,7 +2051,7 @@ std::string CmdProxy::ReceiverDbitList(int action) {
t[i] = StringTo<int>(args[i]); t[i] = StringTo<int>(args[i]);
} }
} }
det->setRxDbitList(t, {det_id}); det->setRxDbitList(t, std::vector<int>{det_id});
os << sls::ToString(args) << '\n'; os << sls::ToString(args) << '\n';
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -2040,7 +2074,8 @@ std::string CmdProxy::DigitalIODelay(int action) {
WrongNumberOfParameters(2); WrongNumberOfParameters(2);
} }
det->setDigitalIODelay(StringTo<uint64_t>(args[0]), det->setDigitalIODelay(StringTo<uint64_t>(args[0]),
StringTo<int>(args[1]), {det_id}); StringTo<int>(args[1]),
std::vector<int>{det_id});
os << sls::ToString(args) << '\n'; os << sls::ToString(args) << '\n';
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -2063,7 +2098,7 @@ std::string CmdProxy::Pattern(int action) {
if (args.size() != 1) { if (args.size() != 1) {
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
} }
det->setPattern(args[0], {det_id}); det->setPattern(args[0], std::vector<int>{det_id});
os << args.front() << '\n'; os << args.front() << '\n';
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -2084,7 +2119,7 @@ std::string CmdProxy::PatternWord(int action) {
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
} }
int addr = StringTo<int>(args[0]); int addr = StringTo<int>(args[0]);
auto t = det->getPatternWord(addr, {det_id}); auto t = det->getPatternWord(addr, std::vector<int>{det_id});
os << '[' << ToStringHex(addr, 4) << ", " << OutStringHex(t, 16) os << '[' << ToStringHex(addr, 4) << ", " << OutStringHex(t, 16)
<< "]\n"; << "]\n";
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
@ -2093,7 +2128,7 @@ std::string CmdProxy::PatternWord(int action) {
} }
int addr = StringTo<int>(args[0]); int addr = StringTo<int>(args[0]);
uint64_t word = StringTo<uint64_t>(args[1]); uint64_t word = StringTo<uint64_t>(args[1]);
det->setPatternWord(addr, word, {det_id}); det->setPatternWord(addr, word, std::vector<int>{det_id});
os << '[' << ToStringHex(addr, 4) << ", " << ToStringHex(word, 16) os << '[' << ToStringHex(addr, 4) << ", " << ToStringHex(word, 16)
<< "]\n"; << "]\n";
} else { } else {
@ -2144,7 +2179,8 @@ std::string CmdProxy::PatternLoopAddresses(int action) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
auto t = det->getPatternLoopAddresses(level, {det_id}); auto t =
det->getPatternLoopAddresses(level, std::vector<int>{det_id});
os << OutStringHex(t, 4) << '\n'; os << OutStringHex(t, 4) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() != 2) { if (args.size() != 2) {
@ -2152,7 +2188,8 @@ std::string CmdProxy::PatternLoopAddresses(int action) {
} }
int start = StringTo<int>(args[0]); int start = StringTo<int>(args[0]);
int stop = StringTo<int>(args[1]); int stop = StringTo<int>(args[1]);
det->setPatternLoopAddresses(level, start, stop, {det_id}); det->setPatternLoopAddresses(level, start, stop,
std::vector<int>{det_id});
os << '[' << ToStringHex(start, 4) << ", " << ToStringHex(stop, 4) os << '[' << ToStringHex(start, 4) << ", " << ToStringHex(stop, 4)
<< "]\n"; << "]\n";
} else { } else {
@ -2198,13 +2235,14 @@ std::string CmdProxy::PatternLoopCycles(int action) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
auto t = det->getPatternLoopCycles(level, {det_id}); auto t = det->getPatternLoopCycles(level, std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() != 1) { if (args.size() != 1) {
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
} }
det->setPatternLoopCycles(level, StringTo<int>(args[0]), {det_id}); det->setPatternLoopCycles(level, StringTo<int>(args[0]),
std::vector<int>{det_id});
os << args.front() << '\n'; os << args.front() << '\n';
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -2243,14 +2281,14 @@ std::string CmdProxy::PatternWaitAddress(int action) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
auto t = det->getPatternWaitAddr(level, {det_id}); auto t = det->getPatternWaitAddr(level, std::vector<int>{det_id});
os << OutStringHex(t, 4) << '\n'; os << OutStringHex(t, 4) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() != 1) { if (args.size() != 1) {
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
} }
int addr = StringTo<int>(args[0]); int addr = StringTo<int>(args[0]);
det->setPatternWaitAddr(level, addr, {det_id}); det->setPatternWaitAddr(level, addr, std::vector<int>{det_id});
os << ToStringHex(addr, 4) << '\n'; os << ToStringHex(addr, 4) << '\n';
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -2295,7 +2333,7 @@ std::string CmdProxy::PatternWaitTime(int action) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
auto t = det->getPatternWaitTime(level, {det_id}); auto t = det->getPatternWaitTime(level, std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() != 1) { if (args.size() != 1) {
@ -2328,7 +2366,7 @@ std::string CmdProxy::AdditionalJsonHeader(int action) {
if (!args.empty()) { if (!args.empty()) {
WrongNumberOfParameters(0); WrongNumberOfParameters(0);
} }
auto t = det->getAdditionalJsonHeader({det_id}); auto t = det->getAdditionalJsonHeader(std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
// arguments can be empty // arguments can be empty
@ -2341,7 +2379,7 @@ std::string CmdProxy::AdditionalJsonHeader(int action) {
json[args[i]] = args[i + 1]; json[args[i]] = args[i + 1];
} }
} }
det->setAdditionalJsonHeader(json, {det_id}); det->setAdditionalJsonHeader(json, std::vector<int>{det_id});
os << sls::ToString(json) << '\n'; os << sls::ToString(json) << '\n';
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -2362,15 +2400,18 @@ std::string CmdProxy::JsonParameter(int action) {
if (args.size() != 1) { if (args.size() != 1) {
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
} }
auto t = det->getAdditionalJsonParameter(args[0], {det_id}); auto t =
det->getAdditionalJsonParameter(args[0], std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
switch (args.size()) { switch (args.size()) {
case 1: case 1:
det->setAdditionalJsonParameter(args[0], "", {det_id}); det->setAdditionalJsonParameter(args[0], "",
std::vector<int>{det_id});
break; break;
case 2: case 2:
det->setAdditionalJsonParameter(args[0], args[1], {det_id}); det->setAdditionalJsonParameter(args[0], args[1],
std::vector<int>{det_id});
break; break;
default: default:
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
@ -2401,7 +2442,7 @@ std::string CmdProxy::ProgramFpga(int action) {
if (args.size() != 1) { if (args.size() != 1) {
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
} }
det->programFPGA(args[0], {det_id}); det->programFPGA(args[0], std::vector<int>{det_id});
os << "successful\n"; os << "successful\n";
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -2426,7 +2467,7 @@ std::string CmdProxy::CopyDetectorServer(int action) {
if (args.size() != 2) { if (args.size() != 2) {
WrongNumberOfParameters(2); WrongNumberOfParameters(2);
} }
det->copyDetectorServer(args[0], args[1], {det_id}); det->copyDetectorServer(args[0], args[1], std::vector<int>{det_id});
os << "successful\n"; os << "successful\n";
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -2452,7 +2493,8 @@ std::string CmdProxy::UpdateFirmwareAndDetectorServer(int action) {
if (args[2].find(".pof") == std::string::npos) { if (args[2].find(".pof") == std::string::npos) {
throw sls::RuntimeError("Programming file must be a pof file."); throw sls::RuntimeError("Programming file must be a pof file.");
} }
det->updateFirmwareAndServer(args[0], args[1], args[2], {det_id}); det->updateFirmwareAndServer(args[0], args[1], args[2],
std::vector<int>{det_id});
os << "successful\n"; os << "successful\n";
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -2472,14 +2514,16 @@ std::string CmdProxy::Register(int action) {
if (args.size() != 1) { if (args.size() != 1) {
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
} }
auto t = det->readRegister(StringTo<uint32_t>(args[0]), {det_id}); auto t = det->readRegister(StringTo<uint32_t>(args[0]),
std::vector<int>{det_id});
os << OutStringHex(t) << '\n'; os << OutStringHex(t) << '\n';
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() != 2) { if (args.size() != 2) {
WrongNumberOfParameters(2); WrongNumberOfParameters(2);
} }
det->writeRegister(StringTo<uint32_t>(args[0]), det->writeRegister(StringTo<uint32_t>(args[0]),
StringTo<uint32_t>(args[1]), {det_id}); StringTo<uint32_t>(args[1]),
std::vector<int>{det_id});
os << sls::ToString(args) << '\n'; os << sls::ToString(args) << '\n';
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -2502,7 +2546,8 @@ std::string CmdProxy::AdcRegister(int action) {
WrongNumberOfParameters(2); WrongNumberOfParameters(2);
} }
det->writeAdcRegister(StringTo<uint32_t>(args[0]), det->writeAdcRegister(StringTo<uint32_t>(args[0]),
StringTo<uint32_t>(args[1]), {det_id}); StringTo<uint32_t>(args[1]),
std::vector<int>{det_id});
os << sls::ToString(args) << '\n'; os << sls::ToString(args) << '\n';
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -2548,7 +2593,7 @@ std::string CmdProxy::BitOperations(int action) {
if (cmd == "setbit" || cmd == "clearbit") { if (cmd == "setbit" || cmd == "clearbit") {
throw sls::RuntimeError("Cannot get"); throw sls::RuntimeError("Cannot get");
} }
auto t = det->readRegister(addr, {det_id}); auto t = det->readRegister(addr, std::vector<int>{det_id});
Result<int> result(t.size()); Result<int> result(t.size());
for (unsigned int i = 0; i < t.size(); ++i) { for (unsigned int i = 0; i < t.size(); ++i) {
result[i] = ((t[i] >> bitnr) & 0x1); result[i] = ((t[i] >> bitnr) & 0x1);
@ -2559,9 +2604,9 @@ std::string CmdProxy::BitOperations(int action) {
throw sls::RuntimeError("Cannot put"); throw sls::RuntimeError("Cannot put");
} }
if (cmd == "setbit") { if (cmd == "setbit") {
det->setBit(addr, bitnr, {det_id}); det->setBit(addr, bitnr, std::vector<int>{det_id});
} else if (cmd == "clearbit") { } else if (cmd == "clearbit") {
det->clearBit(addr, bitnr, {det_id}); det->clearBit(addr, bitnr, std::vector<int>{det_id});
} }
os << sls::ToString(args) << '\n'; os << sls::ToString(args) << '\n';
} else { } else {
@ -2619,7 +2664,7 @@ std::string CmdProxy::ExecuteCommand(int action) {
if (args.size() != 1) { if (args.size() != 1) {
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
} }
auto t = det->executeCommand(args[0], {det_id}); auto t = det->executeCommand(args[0], std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");
@ -2631,7 +2676,9 @@ std::string CmdProxy::UserDetails(int action) {
std::ostringstream os; std::ostringstream os;
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "\n\tUser details from shared memory." << '\n'; os << "\n\tUser details from shared memory (hostname, type, PID, User, "
"Date)."
<< '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
if (det_id != -1) { if (det_id != -1) {
throw sls::RuntimeError("Cannot execute this at module level"); throw sls::RuntimeError("Cannot execute this at module level");

View File

@ -24,7 +24,7 @@
if (action == slsDetectorDefs::HELP_ACTION) \ if (action == slsDetectorDefs::HELP_ACTION) \
os << HLPSTR << '\n'; \ os << HLPSTR << '\n'; \
else if (action == slsDetectorDefs::GET_ACTION) { \ else if (action == slsDetectorDefs::GET_ACTION) { \
auto t = det->GETFCN({det_id}); \ auto t = det->GETFCN(std::vector<int>{det_id}); \
if (args.empty()) { \ if (args.empty()) { \
os << OutString(t) << '\n'; \ os << OutString(t) << '\n'; \
} else if (args.size() == 1) { \ } else if (args.size() == 1) { \
@ -37,10 +37,10 @@
std::string time_str(args[0]); \ std::string time_str(args[0]); \
std::string unit = RemoveUnit(time_str); \ std::string unit = RemoveUnit(time_str); \
auto t = StringTo<time::ns>(time_str, unit); \ auto t = StringTo<time::ns>(time_str, unit); \
det->SETFCN(t, {det_id}); \ det->SETFCN(t, std::vector<int>{det_id}); \
} else if (args.size() == 2) { \ } else if (args.size() == 2) { \
auto t = StringTo<time::ns>(args[0], args[1]); \ auto t = StringTo<time::ns>(args[0], args[1]); \
det->SETFCN(t, {det_id}); \ det->SETFCN(t, std::vector<int>{det_id}); \
} else { \ } else { \
WrongNumberOfParameters(2); \ WrongNumberOfParameters(2); \
} \ } \
@ -64,7 +64,7 @@
if (action == slsDetectorDefs::HELP_ACTION) \ if (action == slsDetectorDefs::HELP_ACTION) \
os << HLPSTR << '\n'; \ os << HLPSTR << '\n'; \
else if (action == slsDetectorDefs::GET_ACTION) { \ else if (action == slsDetectorDefs::GET_ACTION) { \
auto t = det->GETFCN({det_id}); \ auto t = det->GETFCN(std::vector<int>{det_id}); \
if (args.empty()) { \ if (args.empty()) { \
os << OutString(t) << '\n'; \ os << OutString(t) << '\n'; \
} else if (args.size() == 1) { \ } else if (args.size() == 1) { \
@ -91,13 +91,13 @@
if (!args.empty()) { \ if (!args.empty()) { \
WrongNumberOfParameters(0); \ WrongNumberOfParameters(0); \
} \ } \
auto t = det->GETFCN({det_id}); \ auto t = det->GETFCN(std::vector<int>{det_id}); \
os << OutString(t) << '\n'; \ os << OutString(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \ } else if (action == slsDetectorDefs::PUT_ACTION) { \
if (args.size() != 1) { \ if (args.size() != 1) { \
WrongNumberOfParameters(1); \ WrongNumberOfParameters(1); \
} \ } \
det->SETFCN(args[0], {det_id}); \ det->SETFCN(args[0], std::vector<int>{det_id}); \
os << args.front() << '\n'; \ os << args.front() << '\n'; \
} else { \ } else { \
throw sls::RuntimeError("Unknown action"); \ throw sls::RuntimeError("Unknown action"); \
@ -116,14 +116,14 @@
if (!args.empty()) { \ if (!args.empty()) { \
WrongNumberOfParameters(0); \ WrongNumberOfParameters(0); \
} \ } \
auto t = det->GETFCN({det_id}); \ auto t = det->GETFCN(std::vector<int>{det_id}); \
os << OutStringHex(t, 16) << '\n'; \ os << OutStringHex(t, 16) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \ } else if (action == slsDetectorDefs::PUT_ACTION) { \
if (args.size() != 1) { \ if (args.size() != 1) { \
WrongNumberOfParameters(1); \ WrongNumberOfParameters(1); \
} \ } \
auto val = CONV(args[0]); \ auto val = CONV(args[0]); \
det->SETFCN(val, {det_id}); \ det->SETFCN(val, std::vector<int>{det_id}); \
os << ToStringHex(val, 16) << '\n'; \ os << ToStringHex(val, 16) << '\n'; \
} else { \ } else { \
throw sls::RuntimeError("Unknown action"); \ throw sls::RuntimeError("Unknown action"); \
@ -142,14 +142,14 @@
if (!args.empty()) { \ if (!args.empty()) { \
WrongNumberOfParameters(0); \ WrongNumberOfParameters(0); \
} \ } \
auto t = det->GETFCN({det_id}); \ auto t = det->GETFCN(std::vector<int>{det_id}); \
os << OutStringHex(t) << '\n'; \ os << OutStringHex(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \ } else if (action == slsDetectorDefs::PUT_ACTION) { \
if (args.size() != 1) { \ if (args.size() != 1) { \
WrongNumberOfParameters(1); \ WrongNumberOfParameters(1); \
} \ } \
auto val = CONV(args[0]); \ auto val = CONV(args[0]); \
det->SETFCN(val, {det_id}); \ det->SETFCN(val, std::vector<int>{det_id}); \
os << args.front() << '\n'; \ os << args.front() << '\n'; \
} else { \ } else { \
throw sls::RuntimeError("Unknown action"); \ throw sls::RuntimeError("Unknown action"); \
@ -158,7 +158,7 @@
} }
/** int or enum */ /** int or enum */
#define INTEGER_COMMAND(CMDNAME, GETFCN, SETFCN, CONV, HLPSTR) \ #define INTEGER_COMMAND_VEC_ID(CMDNAME, GETFCN, SETFCN, CONV, HLPSTR) \
std::string CMDNAME(const int action) { \ std::string CMDNAME(const int action) { \
std::ostringstream os; \ std::ostringstream os; \
os << cmd << ' '; \ os << cmd << ' '; \
@ -168,14 +168,66 @@
if (!args.empty()) { \ if (!args.empty()) { \
WrongNumberOfParameters(0); \ WrongNumberOfParameters(0); \
} \ } \
auto t = det->GETFCN({det_id}); \ auto t = det->GETFCN(std::vector<int>{det_id}); \
os << OutString(t) << '\n'; \ os << OutString(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \ } else if (action == slsDetectorDefs::PUT_ACTION) { \
if (args.size() != 1) { \ if (args.size() != 1) { \
WrongNumberOfParameters(1); \ WrongNumberOfParameters(1); \
} \ } \
auto val = CONV(args[0]); \ auto val = CONV(args[0]); \
det->SETFCN(val, {det_id}); \ det->SETFCN(val, std::vector<int>{det_id}); \
os << args.front() << '\n'; \
} else { \
throw sls::RuntimeError("Unknown action"); \
} \
return os.str(); \
}
/** int or enum */
#define INTEGER_COMMAND_VEC_ID_GET(CMDNAME, GETFCN, SETFCN, CONV, HLPSTR) \
std::string CMDNAME(const int action) { \
std::ostringstream os; \
os << cmd << ' '; \
if (action == slsDetectorDefs::HELP_ACTION) \
os << HLPSTR << '\n'; \
else if (action == slsDetectorDefs::GET_ACTION) { \
if (!args.empty()) { \
WrongNumberOfParameters(0); \
} \
auto t = det->GETFCN(std::vector<int>{det_id}); \
os << OutString(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
if (args.size() != 1) { \
WrongNumberOfParameters(1); \
} \
auto val = CONV(args[0]); \
det->SETFCN(val, det_id); \
os << args.front() << '\n'; \
} else { \
throw sls::RuntimeError("Unknown action"); \
} \
return os.str(); \
}
/** int or enum */
#define INTEGER_COMMAND_SINGLE_ID(CMDNAME, GETFCN, SETFCN, CONV, HLPSTR) \
std::string CMDNAME(const int action) { \
std::ostringstream os; \
os << cmd << ' '; \
if (action == slsDetectorDefs::HELP_ACTION) \
os << HLPSTR << '\n'; \
else if (action == slsDetectorDefs::GET_ACTION) { \
if (!args.empty()) { \
WrongNumberOfParameters(0); \
} \
auto t = det->GETFCN(det_id); \
os << OutString(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
if (args.size() != 1) { \
WrongNumberOfParameters(1); \
} \
auto val = CONV(args[0]); \
det->SETFCN(val, det_id); \
os << args.front() << '\n'; \ os << args.front() << '\n'; \
} else { \ } else { \
throw sls::RuntimeError("Unknown action"); \ throw sls::RuntimeError("Unknown action"); \
@ -223,14 +275,14 @@
if (!args.empty()) { \ if (!args.empty()) { \
WrongNumberOfParameters(0); \ WrongNumberOfParameters(0); \
} \ } \
auto t = det->GETFCN(INDEX, {det_id}); \ auto t = det->GETFCN(INDEX, std::vector<int>{det_id}); \
os << OutString(t) << '\n'; \ os << OutString(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \ } else if (action == slsDetectorDefs::PUT_ACTION) { \
if (args.size() != 1) { \ if (args.size() != 1) { \
WrongNumberOfParameters(1); \ WrongNumberOfParameters(1); \
} \ } \
auto val = CONV(args[0]); \ auto val = CONV(args[0]); \
det->SETFCN(INDEX, val, {det_id}); \ det->SETFCN(INDEX, val, std::vector<int>{det_id}); \
os << args.front() << '\n'; \ os << args.front() << '\n'; \
} else { \ } else { \
throw sls::RuntimeError("Unknown action"); \ throw sls::RuntimeError("Unknown action"); \
@ -249,14 +301,16 @@
if (args.size() != 1) { \ if (args.size() != 1) { \
WrongNumberOfParameters(1); \ WrongNumberOfParameters(1); \
} \ } \
auto t = det->GETFCN(INDEX, StringTo<int>(args[0]), {det_id}); \ auto t = det->GETFCN(INDEX, StringTo<int>(args[0]), \
std::vector<int>{det_id}); \
os << args[0] << ' ' << OutStringHex(t) << '\n'; \ os << args[0] << ' ' << OutStringHex(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \ } else if (action == slsDetectorDefs::PUT_ACTION) { \
if (args.size() != 2) { \ if (args.size() != 2) { \
WrongNumberOfParameters(2); \ WrongNumberOfParameters(2); \
} \ } \
auto val = CONV(args[1]); \ auto val = CONV(args[1]); \
det->SETFCN(INDEX, StringTo<int>(args[0]), val, {det_id}); \ det->SETFCN(INDEX, StringTo<int>(args[0]), val, \
std::vector<int>{det_id}); \
os << args[0] << ' ' << args[1] << '\n'; \ os << args[0] << ' ' << args[1] << '\n'; \
} else { \ } else { \
throw sls::RuntimeError("Unknown action"); \ throw sls::RuntimeError("Unknown action"); \
@ -282,7 +336,7 @@
} else if (args.size() > 1) { \ } else if (args.size() > 1) { \
WrongNumberOfParameters(0); \ WrongNumberOfParameters(0); \
} \ } \
auto t = det->GETFCN(DAC_INDEX, mv, {det_id}); \ auto t = det->GETFCN(DAC_INDEX, mv, std::vector<int>{det_id}); \
os << OutString(t) << (!args.empty() ? " mV\n" : "\n"); \ os << OutString(t) << (!args.empty() ? " mV\n" : "\n"); \
} else if (action == slsDetectorDefs::PUT_ACTION) { \ } else if (action == slsDetectorDefs::PUT_ACTION) { \
bool mv = false; \ bool mv = false; \
@ -295,7 +349,8 @@
} else if (args.size() > 2 || args.empty()) { \ } else if (args.size() > 2 || args.empty()) { \
WrongNumberOfParameters(1); \ WrongNumberOfParameters(1); \
} \ } \
det->SETFCN(DAC_INDEX, StringTo<int>(args[0]), mv, {det_id}); \ det->SETFCN(DAC_INDEX, StringTo<int>(args[0]), mv, \
std::vector<int>{det_id}); \
os << args.front() << (args.size() > 1 ? " mV\n" : "\n"); \ os << args.front() << (args.size() > 1 ? " mV\n" : "\n"); \
} else { \ } else { \
throw sls::RuntimeError("Unknown action"); \ throw sls::RuntimeError("Unknown action"); \
@ -340,7 +395,7 @@
if (!args.empty()) { \ if (!args.empty()) { \
WrongNumberOfParameters(0); \ WrongNumberOfParameters(0); \
} \ } \
det->SETFCN({det_id}); \ det->SETFCN(std::vector<int>{det_id}); \
os << "successful\n"; \ os << "successful\n"; \
} else { \ } else { \
throw sls::RuntimeError("Unknown action"); \ throw sls::RuntimeError("Unknown action"); \
@ -385,7 +440,7 @@
if (args.size() != 1) { \ if (args.size() != 1) { \
WrongNumberOfParameters(1); \ WrongNumberOfParameters(1); \
} \ } \
det->SETFCN(args[0], {det_id}); \ det->SETFCN(args[0], std::vector<int>{det_id}); \
os << args.front() << '\n'; \ os << args.front() << '\n'; \
} else { \ } else { \
throw sls::RuntimeError("Unknown action"); \ throw sls::RuntimeError("Unknown action"); \
@ -404,7 +459,7 @@
if (!args.empty()) { \ if (!args.empty()) { \
WrongNumberOfParameters(0); \ WrongNumberOfParameters(0); \
} \ } \
auto t = det->GETFCN({det_id}); \ auto t = det->GETFCN(std::vector<int>{det_id}); \
os << OutString(t) << '\n'; \ os << OutString(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \ } else if (action == slsDetectorDefs::PUT_ACTION) { \
throw sls::RuntimeError("Cannot put"); \ throw sls::RuntimeError("Cannot put"); \
@ -446,7 +501,7 @@
if (!args.empty()) { \ if (!args.empty()) { \
WrongNumberOfParameters(0); \ WrongNumberOfParameters(0); \
} \ } \
auto t = det->GETFCN({det_id}); \ auto t = det->GETFCN(std::vector<int>{det_id}); \
os << OutStringHex(t) << '\n'; \ os << OutStringHex(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \ } else if (action == slsDetectorDefs::PUT_ACTION) { \
throw sls::RuntimeError("Cannot put"); \ throw sls::RuntimeError("Cannot put"); \
@ -466,7 +521,7 @@
if (!args.empty()) { \ if (!args.empty()) { \
WrongNumberOfParameters(0); \ WrongNumberOfParameters(0); \
} \ } \
auto t = det->GETFCN(VAL, {det_id}); \ auto t = det->GETFCN(VAL, std::vector<int>{det_id}); \
os << OutString(t) << APPEND << '\n'; \ os << OutString(t) << APPEND << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \ } else if (action == slsDetectorDefs::PUT_ACTION) { \
throw sls::RuntimeError("Cannot put"); \ throw sls::RuntimeError("Cannot put"); \
@ -1125,14 +1180,16 @@ class CmdProxy {
"\n\tReceiver version in format [0xYYMMDD]."); "\n\tReceiver version in format [0xYYMMDD].");
GET_COMMAND(type, getDetectorType, GET_COMMAND(type, getDetectorType,
"\n\tSerial number or MAC of detector (hex)."); "\n\tReturns detector type. Can be Eiger, Jungfrau, Gotthard, "
"Moench, Mythen3, Gotthard2, ChipTestBoard");
GET_COMMAND_NOID(nmod, size, "\n\tNumber of modules in shared memory."); GET_COMMAND_NOID(nmod, size, "\n\tNumber of modules in shared memory.");
GET_COMMAND_NOID(settingslist, getSettingsList, GET_COMMAND_NOID(settingslist, getSettingsList,
"\n\tList of settings implemented for this detector."); "\n\tList of settings implemented for this detector.");
INTEGER_COMMAND(settings, getSettings, setSettings, INTEGER_COMMAND_VEC_ID(
settings, getSettings, setSettings,
sls::StringTo<slsDetectorDefs::detectorSettings>, sls::StringTo<slsDetectorDefs::detectorSettings>,
"[standard, fast, highgain, dynamicgain, lowgain, " "[standard, fast, highgain, dynamicgain, lowgain, "
"mediumgain, veryhighgain, dynamichg0, " "mediumgain, veryhighgain, dynamichg0, "
@ -1155,7 +1212,8 @@ class CmdProxy {
"[fname]\n\t[Eiger][Mythen3] Loads the trimbit file to detector. If no " "[fname]\n\t[Eiger][Mythen3] Loads the trimbit file to detector. If no "
"extension specified, serial number of each module is attached."); "extension specified, serial number of each module is attached.");
INTEGER_COMMAND(trimval, getAllTrimbits, setAllTrimbits, StringTo<int>, INTEGER_COMMAND_VEC_ID(
trimval, getAllTrimbits, setAllTrimbits, StringTo<int>,
"[n_trimval]\n\t[Eiger][Mythen3] All trimbits set to this " "[n_trimval]\n\t[Eiger][Mythen3] All trimbits set to this "
"value. Returns -1 if all trimbits are different values."); "value. Returns -1 if all trimbits are different values.");
@ -1170,8 +1228,8 @@ class CmdProxy {
INTEGER_COMMAND_NOID(triggers, getNumberOfTriggers, setNumberOfTriggers, INTEGER_COMMAND_NOID(triggers, getNumberOfTriggers, setNumberOfTriggers,
StringTo<int64_t>, StringTo<int64_t>,
"[n_triggers]\n\tNumber of triggers per aquire. Use " "[n_triggers]\n\tNumber of triggers per aquire. Set "
"timing command to set timing mode."); "timing mode to use triggers.");
TIME_COMMAND( TIME_COMMAND(
period, getPeriod, setPeriod, period, getPeriod, setPeriod,
@ -1205,7 +1263,8 @@ class CmdProxy {
GET_COMMAND_NOID(drlist, getDynamicRangeList, GET_COMMAND_NOID(drlist, getDynamicRangeList,
"\n\tGets the list of dynamic ranges for this detector."); "\n\tGets the list of dynamic ranges for this detector.");
INTEGER_COMMAND(timing, getTimingMode, setTimingMode, INTEGER_COMMAND_VEC_ID(
timing, getTimingMode, setTimingMode,
sls::StringTo<slsDetectorDefs::timingMode>, sls::StringTo<slsDetectorDefs::timingMode>,
"[auto|trigger|gating|burst_trigger]\n\tTiming Mode of " "[auto|trigger|gating|burst_trigger]\n\tTiming Mode of "
"detector.\n\t[Jungfrau][Gotthard][Ctb][Moench][Gotthard2] " "detector.\n\t[Jungfrau][Gotthard][Ctb][Moench][Gotthard2] "
@ -1224,13 +1283,15 @@ class CmdProxy {
"\n\t[CTB][Jungfrau] Absolute maximum Phase shift of of the " "\n\t[CTB][Jungfrau] Absolute maximum Phase shift of of the "
"clock to latch digital bits."); "clock to latch digital bits.");
INTEGER_COMMAND(highvoltage, getHighVoltage, setHighVoltage, StringTo<int>, INTEGER_COMMAND_VEC_ID(highvoltage, getHighVoltage, setHighVoltage,
StringTo<int>,
"[n_value]\n\tHigh voltage to the sensor in Voltage." "[n_value]\n\tHigh voltage to the sensor in Voltage."
"\n\t[Gotthard] [0|90|110|120|150|180|200]" "\n\t[Gotthard] [0|90|110|120|150|180|200]"
"\n\t[Eiger][Mythen3][Gotthard2] 0-200" "\n\t[Eiger][Mythen3][Gotthard2] 0-200"
"\n\t[Jungfrau][Ctb][Moench] [0|60-200]"); "\n\t[Jungfrau][Ctb][Moench] [0|60-200]");
INTEGER_COMMAND(powerchip, getPowerChip, setPowerChip, StringTo<int>, INTEGER_COMMAND_VEC_ID(
powerchip, getPowerChip, setPowerChip, StringTo<int>,
"[0, 1]\n\t[Jungfrau][Mythen3][Gotthard2][Moench] Power " "[0, 1]\n\t[Jungfrau][Mythen3][Gotthard2][Moench] Power "
"the chip. Default 0." "the chip. Default 0."
"\n\t[Jungfrau] Get will return power status." "\n\t[Jungfrau] Get will return power status."
@ -1241,14 +1302,15 @@ class CmdProxy {
"\n\t[Gotthard2] If module not connected or wrong module, " "\n\t[Gotthard2] If module not connected or wrong module, "
"1 will fail. By default, powered on at server start up."); "1 will fail. By default, powered on at server start up.");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
imagetest, getImageTestMode, setImageTestMode, StringTo<int>, imagetest, getImageTestMode, setImageTestMode, StringTo<int>,
"[0, 1]\n\t[Gotthard] 1 adds channel intensity with precalculated " "[0, 1]\n\t[Gotthard] 1 adds channel intensity with precalculated "
"values when taking an acquisition. Default is 0." "values when taking an acquisition. Default is 0."
"\n\t[Eiger][Jungfrau] Only for Virtual servers. If 0, each pixel " "\n\t[Eiger][Jungfrau] Only for Virtual servers. If 0, each pixel "
"intensity incremented by 1. If 1, all pixels almost saturated."); "intensity incremented by 1. If 1, all pixels almost saturated.");
INTEGER_COMMAND(parallel, getParallelMode, setParallelMode, StringTo<int>, INTEGER_COMMAND_VEC_ID(
parallel, getParallelMode, setParallelMode, StringTo<int>,
"[0, 1]\n\t[Eiger][Mythen3] Enable or disable parallel " "[0, 1]\n\t[Eiger][Mythen3] Enable or disable parallel "
"mode.\n\t[Mythen3] If exptime is too short, the " "mode.\n\t[Mythen3] If exptime is too short, the "
"acquisition will return ERROR status and take fewer " "acquisition will return ERROR status and take fewer "
@ -1302,9 +1364,12 @@ class CmdProxy {
/* dacs */ /* dacs */
DAC_COMMAND(vthreshold, getDAC, setDAC, defs::VTHRESHOLD, DAC_COMMAND(
vthreshold, getDAC, setDAC, defs::VTHRESHOLD,
"[dac or mV value][(optional unit) mV] \n\t[Eiger][Mythen3] " "[dac or mV value][(optional unit) mV] \n\t[Eiger][Mythen3] "
"Detector threshold voltage for single photon counters."); "Detector threshold voltage for single photon counters.\n\t[Eiger] "
"Sets vcmp_ll, vcmp_lr, vcmp_rl, vcmp_rr and vcp to the same value. "
"\n\t[Mythen3] Sets vth1, vth2 and vth3 to the same value.");
DAC_COMMAND(vsvp, getDAC, setDAC, defs::VSVP, DAC_COMMAND(vsvp, getDAC, setDAC, defs::VSVP,
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for "
@ -1633,8 +1698,9 @@ class CmdProxy {
GET_COMMAND(rx_missingpackets, getNumMissingPackets, GET_COMMAND(rx_missingpackets, getNumMissingPackets,
"\n\tNumber of missing packets for each port in receiver."); "\n\tNumber of missing packets for each port in receiver.");
INTEGER_COMMAND(startingfnum, getStartingFrameNumber, INTEGER_COMMAND_VEC_ID(
setStartingFrameNumber, StringTo<uint64_t>, startingfnum, getStartingFrameNumber, setStartingFrameNumber,
StringTo<uint64_t>,
"[n_value]\n\t[Eiger][Jungfrau] Starting frame number for " "[n_value]\n\t[Eiger][Jungfrau] Starting frame number for "
"next acquisition. Stopping acquiistion might result in " "next acquisition. Stopping acquiistion might result in "
"different frame numbers for different modules."); "different frame numbers for different modules.");
@ -1649,7 +1715,7 @@ class CmdProxy {
/* Network Configuration (Detector<->Receiver) */ /* Network Configuration (Detector<->Receiver) */
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
numinterfaces, getNumberofUDPInterfaces, setNumberofUDPInterfaces, numinterfaces, getNumberofUDPInterfaces, setNumberofUDPInterfaces,
StringTo<int>, StringTo<int>,
"[1, 2]\n\t[Jungfrau][Gotthard2] Number of udp interfaces to stream " "[1, 2]\n\t[Jungfrau][Gotthard2] Number of udp interfaces to stream "
@ -1660,52 +1726,66 @@ class CmdProxy {
"veto information via 10Gbps for debugging. By default, if veto " "veto information via 10Gbps for debugging. By default, if veto "
"enabled, it is sent via 2.5 gbps interface."); "enabled, it is sent via 2.5 gbps interface.");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
selinterface, getSelectedUDPInterface, selectUDPInterface, selinterface, getSelectedUDPInterface, selectUDPInterface,
StringTo<int>, StringTo<int>,
"[0, 1]\n\t[Jungfrau] The udp interface to stream data from detector. " "[0, 1]\n\t[Jungfrau] The udp interface to stream data from detector. "
"Effective only when number of interfaces is 1. Default: 0 (outer)"); "Effective only when number of interfaces is 1. Default: 0 (outer)");
INTEGER_COMMAND(udp_srcip, getSourceUDPIP, setSourceUDPIP, IpAddr, INTEGER_COMMAND_VEC_ID(
udp_srcip, getSourceUDPIP, setSourceUDPIP, IpAddr,
"[x.x.x.x]\n\tIp address of the detector (source) udp " "[x.x.x.x]\n\tIp address of the detector (source) udp "
"interface. Must be same subnet as destination udp ip."); "interface. Must be same subnet as destination udp "
"ip.\n\t[Eiger] Set only for 10G. For 1G, detector will "
"replace with its own DHCP IP address.");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
udp_srcip2, getSourceUDPIP2, setSourceUDPIP2, IpAddr, udp_srcip2, getSourceUDPIP2, setSourceUDPIP2, IpAddr,
"[x.x.x.x]\n\t[Jungfrau] Ip address of the bottom half of detector " "[x.x.x.x]\n\t[Jungfrau][Gotthard2] Ip address of the detector "
"(source) udp interface. Must be same subnet as destination udp ip2."); "(source) udp interface 2. Must be same subnet as destination udp "
"ip2.\n\t [Jungfrau] bottom half \n\t [Gotthard2] veto debugging.");
INTEGER_COMMAND(udp_srcmac, getSourceUDPMAC, setSourceUDPMAC, MacAddr, INTEGER_COMMAND_VEC_ID(
udp_srcmac, getSourceUDPMAC, setSourceUDPMAC, MacAddr,
"[x:x:x:x:x:x]\n\tMac address of the detector (source) udp " "[x:x:x:x:x:x]\n\tMac address of the detector (source) udp "
"interface. "); "interface. \n\t[Eiger] Do not set as detector will replace with its "
"own DHCP Mac (1G) or DHCP Mac + 1 (10G).");
INTEGER_COMMAND(udp_srcmac2, getSourceUDPMAC2, setSourceUDPMAC2, MacAddr, INTEGER_COMMAND_VEC_ID(
udp_srcmac2, getSourceUDPMAC2, setSourceUDPMAC2, MacAddr,
"[x:x:x:x:x:x]\n\t[Jungfrau] Mac address of the bottom " "[x:x:x:x:x:x]\n\t[Jungfrau] Mac address of the bottom "
"half of detector (source) udp interface. "); "half of detector (source) udp interface. ");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
udp_dstmac, getDestinationUDPMAC, setDestinationUDPMAC, MacAddr, udp_dstmac, getDestinationUDPMAC, setDestinationUDPMAC, MacAddr,
"[x:x:x:x:x:x]\n\tMac address of the receiver (destination) udp " "[x:x:x:x:x:x]\n\tMac address of the receiver (destination) udp "
"interface. Can be unused as udp_dstip retrieves it."); "interface. Not mandatory to set as udp_dstip retrieves it from "
"slsReceiver process, but must be set if you use a custom receiver "
"(not slsReceiver).");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
udp_dstmac2, getDestinationUDPMAC2, setDestinationUDPMAC2, MacAddr, udp_dstmac2, getDestinationUDPMAC2, setDestinationUDPMAC2, MacAddr,
"[x:x:x:x:x:x]\n\t[Jungfrau] Mac address of the receiver (destination) " "[x:x:x:x:x:x]\n\t[Jungfrau] Mac address of the receiver (destination) "
"udp interface where the second half of detector data is sent to. Can " "udp interface 2. Not mandatory to set as udp_dstip2 retrieves it from "
"be unused as udp_dstip2 retrieves it."); "slsReceiver process but must be set if you use a custom receiver (not "
"slsReceiver). \n\t [Jungfrau] bottom half \n\t [Gotthard2] veto "
"debugging.");
INTEGER_COMMAND(udp_dstport, getDestinationUDPPort, setDestinationUDPPort, INTEGER_COMMAND_VEC_ID_GET(
udp_dstport, getDestinationUDPPort, setDestinationUDPPort,
StringTo<int>, StringTo<int>,
"[n]\n\tPort number of the receiver (destination) udp " "[n]\n\tPort number of the receiver (destination) udp "
"interface. Default is 50001."); "interface. Default is 50001. \n\tIf multi command, ports for each "
"module is calculated (incremented by 1 if no 2nd interface)");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID_GET(
udp_dstport2, getDestinationUDPPort2, setDestinationUDPPort2, udp_dstport2, getDestinationUDPPort2, setDestinationUDPPort2,
StringTo<int>, StringTo<int>,
"[n]\n\tDefault is 50002.\n\t[Jungfrau] Port number of the receiver " "[n]\n\t[Jungfrau][Eiger][Gotthard2] Port number of the "
"(destination) udp interface where the second half of detector data is " "receiver (destination) udp interface 2. Default is 50002. "
"sent to. \n\t[Eiger] Port number of the reciever (desintation) udp " "\n\tIf multi command, ports for each module is calculated "
"interface where the right half of the detector data is sent to."); "(incremented by 2) \n\t[Jungfrau] bottom half \n\t[Eiger] "
"right half \n\t[Gotthard2] veto debugging");
EXECUTE_SET_COMMAND( EXECUTE_SET_COMMAND(
udp_reconfigure, reconfigureUDPDestination, udp_reconfigure, reconfigureUDPDestination,
@ -1722,14 +1802,15 @@ class CmdProxy {
GET_COMMAND(rx_printconfig, printRxConfiguration, GET_COMMAND(rx_printconfig, printRxConfiguration,
"\n\tPrints the receiver configuration."); "\n\tPrints the receiver configuration.");
INTEGER_COMMAND(tengiga, getTenGiga, setTenGiga, StringTo<int>, INTEGER_COMMAND_VEC_ID(
tengiga, getTenGiga, setTenGiga, StringTo<int>,
"[0, 1]\n\t[Eiger][Ctb][Moench][Mythen3] 10GbE Enable."); "[0, 1]\n\t[Eiger][Ctb][Moench][Mythen3] 10GbE Enable.");
INTEGER_COMMAND(flowcontrol10g, getTenGigaFlowControl, INTEGER_COMMAND_VEC_ID(flowcontrol10g, getTenGigaFlowControl,
setTenGigaFlowControl, StringTo<int>, setTenGigaFlowControl, StringTo<int>,
"[0, 1]\n\t[Eiger][Jungfrau] 10GbE Flow Control."); "[0, 1]\n\t[Eiger][Jungfrau] 10GbE Flow Control.");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
txndelay_frame, getTransmissionDelayFrame, setTransmissionDelayFrame, txndelay_frame, getTransmissionDelayFrame, setTransmissionDelayFrame,
StringTo<int>, StringTo<int>,
"[n_delay]\n\t[Eiger][Jungfrau][Mythen3] Transmission delay of each " "[n_delay]\n\t[Eiger][Jungfrau][Mythen3] Transmission delay of each "
@ -1740,14 +1821,14 @@ class CmdProxy {
"50000.\n\t[Mythen3] [0-16777215] Each value represents 8 ns (125 MHz " "50000.\n\t[Mythen3] [0-16777215] Each value represents 8 ns (125 MHz "
"clock), max is 134 ms."); "clock), max is 134 ms.");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
txndelay_left, getTransmissionDelayLeft, setTransmissionDelayLeft, txndelay_left, getTransmissionDelayLeft, setTransmissionDelayLeft,
StringTo<int>, StringTo<int>,
"[n_delay]\n\t[Eiger] Transmission delay of first packet in an image " "[n_delay]\n\t[Eiger] Transmission delay of first packet in an image "
"being streamed out of the module's left UDP port. Each value " "being streamed out of the module's left UDP port. Each value "
"represents 10ns. Typical value is 50000."); "represents 10ns. Typical value is 50000.");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
txndelay_right, getTransmissionDelayRight, setTransmissionDelayRight, txndelay_right, getTransmissionDelayRight, setTransmissionDelayRight,
StringTo<int>, StringTo<int>,
"[n_delay]\n\t[Eiger] Transmission delay of first packet in an image " "[n_delay]\n\t[Eiger] Transmission delay of first packet in an image "
@ -1756,22 +1837,23 @@ class CmdProxy {
/* Receiver Config */ /* Receiver Config */
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID_GET(
rx_tcpport, getRxPort, setRxPort, StringTo<int>, rx_tcpport, getRxPort, setRxPort, StringTo<int>,
"[port]\n\tTCP port for client-receiver communication. Default is " "[port]\n\tTCP port for client-receiver communication. Default is "
"1954. Must be different if multiple receivers on same pc. Must be " "1954. Must be different if multiple receivers on same pc. Must be "
"first command to set a receiver parameter. Multi command will " "first command to set a receiver parameter. Multi command will "
"automatically increment for individual modules."); "automatically increment for individual modules.");
INTEGER_COMMAND(rx_fifodepth, getRxFifoDepth, setRxFifoDepth, StringTo<int>, INTEGER_COMMAND_VEC_ID(
rx_fifodepth, getRxFifoDepth, setRxFifoDepth, StringTo<int>,
"[n_frames]\n\tSet the number of frames in the receiver " "[n_frames]\n\tSet the number of frames in the receiver "
"fifo depth (buffer between listener and writer threads)."); "fifo depth (buffer between listener and writer threads).");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
rx_silent, getRxSilentMode, setRxSilentMode, StringTo<int>, rx_silent, getRxSilentMode, setRxSilentMode, StringTo<int>,
"[0, 1]\n\tSwitch on or off receiver text output during acquisition."); "[0, 1]\n\tSwitch on or off receiver text output during acquisition.");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
rx_discardpolicy, getRxFrameDiscardPolicy, setRxFrameDiscardPolicy, rx_discardpolicy, getRxFrameDiscardPolicy, setRxFrameDiscardPolicy,
sls::StringTo<slsDetectorDefs::frameDiscardPolicy>, sls::StringTo<slsDetectorDefs::frameDiscardPolicy>,
"[nodiscard (default)|discardempty|discardpartial(fastest)]\n\tFrame " "[nodiscard (default)|discardempty|discardpartial(fastest)]\n\tFrame "
@ -1779,12 +1861,12 @@ class CmdProxy {
"discardempty discards empty frames, discardpartial discards partial " "discardempty discards empty frames, discardpartial discards partial "
"frames."); "frames.");
INTEGER_COMMAND(rx_padding, getPartialFramesPadding, INTEGER_COMMAND_VEC_ID(rx_padding, getPartialFramesPadding,
setPartialFramesPadding, StringTo<int>, setPartialFramesPadding, StringTo<int>,
"[0, 1]\n\tPartial frames padding enable in the " "[0, 1]\n\tPartial frames padding enable in the "
"receiver. Default: enabled. Disabling is fastest."); "receiver. Default: enabled. Disabling is fastest.");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
rx_udpsocksize, getRxUDPSocketBufferSize, setRxUDPSocketBufferSize, rx_udpsocksize, getRxUDPSocketBufferSize, setRxUDPSocketBufferSize,
StringTo<int64_t>, StringTo<int64_t>,
"[n_size]\n\tUDP socket buffer size in receiver. Tune rmem_default and " "[n_size]\n\tUDP socket buffer size in receiver. Tune rmem_default and "
@ -1794,7 +1876,8 @@ class CmdProxy {
"\n\tActual udp socket buffer size. Double the size of " "\n\tActual udp socket buffer size. Double the size of "
"rx_udpsocksize due to kernel bookkeeping."); "rx_udpsocksize due to kernel bookkeeping.");
INTEGER_COMMAND(rx_lock, getRxLock, setRxLock, StringTo<int>, INTEGER_COMMAND_VEC_ID(
rx_lock, getRxLock, setRxLock, StringTo<int>,
"[0, 1]\n\tLock receiver to one client IP, 1 locks, 0 " "[0, 1]\n\tLock receiver to one client IP, 1 locks, 0 "
"unlocks. Default is unlocked. 1: locks"); "unlocks. Default is unlocked. 1: locks");
@ -1812,7 +1895,7 @@ class CmdProxy {
/* File */ /* File */
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
fformat, getFileFormat, setFileFormat, fformat, getFileFormat, setFileFormat,
sls::StringTo<slsDetectorDefs::fileFormat>, sls::StringTo<slsDetectorDefs::fileFormat>,
"[binary|hdf5]\n\tFile format of data file. For HDF5, package must be " "[binary|hdf5]\n\tFile format of data file. For HDF5, package must be "
@ -1828,11 +1911,11 @@ class CmdProxy {
"is run. File name: [file name prefix]_d[detector " "is run. File name: [file name prefix]_d[detector "
"index]_f[sub file index]_[acquisition/file index].raw."); "index]_f[sub file index]_[acquisition/file index].raw.");
INTEGER_COMMAND(findex, getAcquisitionIndex, setAcquisitionIndex, INTEGER_COMMAND_VEC_ID(findex, getAcquisitionIndex, setAcquisitionIndex,
StringTo<int64_t>, StringTo<int64_t>,
"[n_value]\n\tFile or Acquisition index."); "[n_value]\n\tFile or Acquisition index.");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
fwrite, getFileWrite, setFileWrite, StringTo<int>, fwrite, getFileWrite, setFileWrite, StringTo<int>,
"[0, 1]\n\tEnable or disable receiver file write. Default is 1."); "[0, 1]\n\tEnable or disable receiver file write. Default is 1.");
@ -1840,18 +1923,18 @@ class CmdProxy {
fmaster, getMasterFileWrite, setMasterFileWrite, StringTo<int>, fmaster, getMasterFileWrite, setMasterFileWrite, StringTo<int>,
"[0, 1]\n\tEnable or disable receiver master file. Default is 1."); "[0, 1]\n\tEnable or disable receiver master file. Default is 1.");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
foverwrite, getFileOverWrite, setFileOverWrite, StringTo<int>, foverwrite, getFileOverWrite, setFileOverWrite, StringTo<int>,
"[0, 1]\n\tEnable or disable file overwriting. Default is 1."); "[0, 1]\n\tEnable or disable file overwriting. Default is 1.");
INTEGER_COMMAND(rx_framesperfile, getFramesPerFile, setFramesPerFile, INTEGER_COMMAND_VEC_ID(
StringTo<int>, rx_framesperfile, getFramesPerFile, setFramesPerFile, StringTo<int>,
"[n_frames]\n\tNumber of frames per file in receiver. 0 is " "[n_frames]\n\tNumber of frames per file in receiver. 0 is "
"infinite or all frames in single file."); "infinite or all frames in single file.");
/* ZMQ Streaming Parameters (Receiver<->Client) */ /* ZMQ Streaming Parameters (Receiver<->Client) */
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
rx_zmqstream, getRxZmqDataStream, setRxZmqDataStream, StringTo<int>, rx_zmqstream, getRxZmqDataStream, setRxZmqDataStream, StringTo<int>,
"[0, 1]\n\tEnable/ disable data streaming from receiver via zmq (eg. " "[0, 1]\n\tEnable/ disable data streaming from receiver via zmq (eg. "
"to GUI or to another process for further processing). This creates/ " "to GUI or to another process for further processing). This creates/ "
@ -1860,7 +1943,7 @@ class CmdProxy {
"to command line acquire will require disabling data streaming in " "to command line acquire will require disabling data streaming in "
"receiver for fast applications. "); "receiver for fast applications. ");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
rx_zmqfreq, getRxZmqFrequency, setRxZmqFrequency, StringTo<int>, rx_zmqfreq, getRxZmqFrequency, setRxZmqFrequency, StringTo<int>,
"[nth frame]\n\tFrequency of frames streamed out from receiver via " "[nth frame]\n\tFrequency of frames streamed out from receiver via "
"zmq\n\tDefault: 1, Means every frame is streamed out. \n\tIf 2, every " "zmq\n\tDefault: 1, Means every frame is streamed out. \n\tIf 2, every "
@ -1868,13 +1951,14 @@ class CmdProxy {
"timeout, after which current frame is sent out. (default timeout is " "timeout, after which current frame is sent out. (default timeout is "
"200 ms). Usually used for gui purposes."); "200 ms). Usually used for gui purposes.");
INTEGER_COMMAND(rx_zmqstartfnum, getRxZmqStartingFrame, INTEGER_COMMAND_VEC_ID(
setRxZmqStartingFrame, StringTo<int>, rx_zmqstartfnum, getRxZmqStartingFrame, setRxZmqStartingFrame,
StringTo<int>,
"[fnum]\n\tThe starting frame index to stream out. 0 by " "[fnum]\n\tThe starting frame index to stream out. 0 by "
"default, which streams the first frame in an acquisition, " "default, which streams the first frame in an acquisition, "
"and then depending on the rx zmq frequency/ timer"); "and then depending on the rx zmq frequency/ timer");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID_GET(
rx_zmqport, getRxZmqPort, setRxZmqPort, StringTo<int>, rx_zmqport, getRxZmqPort, setRxZmqPort, StringTo<int>,
"[port]\n\tZmq port for data to be streamed out of the receiver. Also " "[port]\n\tZmq port for data to be streamed out of the receiver. Also "
"restarts receiver zmq streaming if enabled. Default is 30001. " "restarts receiver zmq streaming if enabled. Default is 30001. "
@ -1882,27 +1966,27 @@ class CmdProxy {
"client(gui). Must be different for every detector (and udp port). " "client(gui). Must be different for every detector (and udp port). "
"Multi command will automatically increment for individual modules."); "Multi command will automatically increment for individual modules.");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID_GET(
zmqport, getClientZmqPort, setClientZmqPort, StringTo<int>, zmqport, getClientZmqPort, setClientZmqPort, StringTo<int>,
"[port]\n\tZmq port in client(gui) or intermediate process for data to " "[port]\n\tZmq port in client(gui) or intermediate process for data to "
"be streamed to from receiver. efault connects to receiver zmq " "be streamed to from receiver. Default connects to receiver zmq "
"streaming out port (30001). Modified only when using an intermediate " "streaming out port (30001). Modified only when using an intermediate "
"process between receiver and client(gui). Also restarts client zmq " "process between receiver and client(gui). Also restarts client zmq "
"streaming if enabled. Must be different for every detector (and udp " "streaming if enabled. Must be different for every detector (and udp "
"port). Multi command will automatically increment for individual " "port). Multi command will automatically increment for individual "
"modules."); "modules.");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
rx_zmqip, getRxZmqIP, setRxZmqIP, IpAddr, rx_zmqip, getRxZmqIP, setRxZmqIP, IpAddr,
"[x.x.x.x]\n\tZmq Ip Address from which data is to be streamed out of " "[x.x.x.x]\n\tZmq Ip Address from which data is to be streamed out of "
"the receiver. Also restarts receiver zmq streaming if enabled. " "the receiver. Also restarts receiver zmq streaming if enabled. "
"Default is from rx_hostname. Modified only when using an intermediate " "Default is from rx_hostname. Modified only when using an intermediate "
"process between receiver."); "process between receiver.");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
zmqip, getClientZmqIp, setClientZmqIp, IpAddr, zmqip, getClientZmqIp, setClientZmqIp, IpAddr,
"[x.x.x.x]\n\tZmq IP Address in client(gui) or intermediate process " "[x.x.x.x]\n\tIp Address to listen to zmq data streamed out from "
"for data to be streamed to from receiver. Default connects to " "receiver or intermediate process. Default connects to "
"receiver zmq Ip Address (from rx_hostname). Modified only when using " "receiver zmq Ip Address (from rx_hostname). Modified only when using "
"an intermediate process between receiver and client(gui). Also " "an intermediate process between receiver and client(gui). Also "
"restarts client zmq streaming if enabled."); "restarts client zmq streaming if enabled.");
@ -1922,24 +2006,26 @@ class CmdProxy {
settingspath, getSettingsPath, setSettingsPath, settingspath, getSettingsPath, setSettingsPath,
"[path]\n\t[Eiger] Directory where settings files are loaded from/to."); "[path]\n\t[Eiger] Directory where settings files are loaded from/to.");
INTEGER_COMMAND(overflow, getOverFlowMode, setOverFlowMode, StringTo<int>, INTEGER_COMMAND_VEC_ID(
overflow, getOverFlowMode, setOverFlowMode, StringTo<int>,
"[0, 1]\n\t[Eiger] Enable or disable show overflow flag in " "[0, 1]\n\t[Eiger] Enable or disable show overflow flag in "
"32 bit mode. Default is disabled."); "32 bit mode. Default is disabled.");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
flippeddatax, getBottom, setBottom, StringTo<int>, flippeddatax, getBottom, setBottom, StringTo<int>,
"[0, 1]\n\t[Eiger] Top or Bottom Half of Eiger module. 1 is bottom, 0 " "[0, 1]\n\t[Eiger] Top or Bottom Half of Eiger module. 1 is bottom, 0 "
"is top. Used to let Receivers and Gui know to flip the bottom image " "is top. Used to let Receivers and Gui know to flip the bottom image "
"over the x axis. Files are not written without the flip however."); "over the x axis. Files are not written without the flip however.");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
readnlines, getPartialReadout, setPartialReadout, StringTo<int>, readnlines, getPartialReadout, setPartialReadout, StringTo<int>,
"[1 - 256]\n\t[Eiger] Number of rows to readout per half module " "[1 - 256]\n\t[Eiger] Number of rows to readout per half module "
"starting from the centre. 256 is default. The permissible values " "starting from the centre. 256 is default. The permissible values "
"depend on dynamic range and 10Gbe enabled."); "depend on dynamic range and 10Gbe enabled.");
INTEGER_COMMAND(interruptsubframe, getInterruptSubframe, INTEGER_COMMAND_VEC_ID(
setInterruptSubframe, StringTo<int>, interruptsubframe, getInterruptSubframe, setInterruptSubframe,
StringTo<int>,
"[0, 1]\n\t[Eiger] 1 interrupts last subframe at required " "[0, 1]\n\t[Eiger] 1 interrupts last subframe at required "
"exposure time. 0 will wait for last sub frame to finish " "exposure time. 0 will wait for last sub frame to finish "
"exposing. 0 is default."); "exposing. 0 is default.");
@ -1953,7 +2039,7 @@ class CmdProxy {
"[(optional unit) ns|us|ms|s]\n\t[Eiger] Measured sub " "[(optional unit) ns|us|ms|s]\n\t[Eiger] Measured sub "
"frame period between last sub frame and previous one."); "frame period between last sub frame and previous one.");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
partialreset, getPartialReset, setPartialReset, StringTo<int>, partialreset, getPartialReset, setPartialReset, StringTo<int>,
"[0, 1]\n\t[Eiger] Sets up detector to do partial or complete reset at " "[0, 1]\n\t[Eiger] Sets up detector to do partial or complete reset at "
"start of acquisition. 0 complete reset, 1 partial reset. Default is " "start of acquisition. 0 complete reset, 1 partial reset. Default is "
@ -1961,7 +2047,7 @@ class CmdProxy {
/* Jungfrau Specific */ /* Jungfrau Specific */
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
temp_threshold, getThresholdTemperature, setThresholdTemperature, temp_threshold, getThresholdTemperature, setThresholdTemperature,
StringTo<int>, StringTo<int>,
"[n_temp (in degrees)]\n\t[Jungfrau] Threshold temperature in degrees. " "[n_temp (in degrees)]\n\t[Jungfrau] Threshold temperature in degrees. "
@ -1970,7 +2056,7 @@ class CmdProxy {
"occurs. To power on chip again, temperature has to be less than " "occurs. To power on chip again, temperature has to be less than "
"threshold temperature and temperature event has to be cleared."); "threshold temperature and temperature event has to be cleared.");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
temp_control, getTemperatureControl, setTemperatureControl, temp_control, getTemperatureControl, setTemperatureControl,
StringTo<int>, StringTo<int>,
"[0, 1]\n\t[Jungfrau] Temperature control enable. Default is 0 " "[0, 1]\n\t[Jungfrau] Temperature control enable. Default is 0 "
@ -1980,7 +2066,7 @@ class CmdProxy {
"to be less than threshold temperature and temperature event has to be " "to be less than threshold temperature and temperature event has to be "
"cleared."); "cleared.");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
auto_comp_disable, getAutoCompDisable, setAutoCompDisable, auto_comp_disable, getAutoCompDisable, setAutoCompDisable,
StringTo<int>, StringTo<int>,
"[0, 1]\n\t[Jungfrau] Auto comparator disable mode. By default, the " "[0, 1]\n\t[Jungfrau] Auto comparator disable mode. By default, the "
@ -1997,7 +2083,7 @@ class CmdProxy {
"0. For advanced users only. \n\tThe #images = #frames x #triggers x " "0. For advanced users only. \n\tThe #images = #frames x #triggers x "
"(#storagecells + 1)."); "(#storagecells + 1).");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
storagecell_start, getStorageCellStart, setStorageCellStart, storagecell_start, getStorageCellStart, setStorageCellStart,
StringTo<int>, StringTo<int>,
"[0-15]\n\t[Jungfrau] Storage cell that stores the first acquisition " "[0-15]\n\t[Jungfrau] Storage cell that stores the first acquisition "
@ -2025,53 +2111,56 @@ class CmdProxy {
"[duration] [(optional unit) ns|us|ms|s]\n\t[Gotthard2] Burst " "[duration] [(optional unit) ns|us|ms|s]\n\t[Gotthard2] Burst "
"period. Only in burst mode and auto timing mode."); "period. Only in burst mode and auto timing mode.");
INTEGER_COMMAND(cdsgain, getCDSGain, setCDSGain, StringTo<bool>, INTEGER_COMMAND_VEC_ID(
cdsgain, getCDSGain, setCDSGain, StringTo<bool>,
"[0, 1]\n\t[Gotthard2] Enable or disable CDS gain. Default " "[0, 1]\n\t[Gotthard2] Enable or disable CDS gain. Default "
"is disabled."); "is disabled.");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
filter, getFilter, setFilter, StringTo<int>, filter, getFilter, setFilter, StringTo<int>,
"[0|1|2|3]\n\t[Gotthard2] Set filter resistor. Default is 0."); "[0|1|2|3]\n\t[Gotthard2] Set filter resistor. Default is 0.");
INTEGER_COMMAND(currentsource, getCurrentSource, setCurrentSource, INTEGER_COMMAND_VEC_ID(
StringTo<int>, currentsource, getCurrentSource, setCurrentSource, StringTo<int>,
"[0, 1]\n\t[Gotthard2] Enable or disable current source. " "[0, 1]\n\t[Gotthard2] Enable or disable current source. "
"Default is disabled."); "Default is disabled.");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
timingsource, getTimingSource, setTimingSource, timingsource, getTimingSource, setTimingSource,
sls::StringTo<slsDetectorDefs::timingSourceType>, sls::StringTo<slsDetectorDefs::timingSourceType>,
"[internal|external]\n\t[Gotthard2] Timing source. Internal is crystal " "[internal|external]\n\t[Gotthard2] Timing source. Internal is crystal "
"and external is system timing. Default is internal."); "and external is system timing. Default is internal.");
INTEGER_COMMAND(veto, getVeto, setVeto, StringTo<int>, INTEGER_COMMAND_VEC_ID(veto, getVeto, setVeto, StringTo<int>,
"[0, 1]\n\t[Gotthard2] Enable or disable veto data " "[0, 1]\n\t[Gotthard2] Enable or disable veto data "
"streaming from detector. Default is 0."); "streaming from detector. Default is 0.");
/* Mythen3 Specific */ /* Mythen3 Specific */
INTEGER_COMMAND(gates, getNumberOfGates, setNumberOfGates, StringTo<int>, INTEGER_COMMAND_VEC_ID(
gates, getNumberOfGates, setNumberOfGates, StringTo<int>,
"[n_gates]\n\t[Mythen3] Number of external gates in gating " "[n_gates]\n\t[Mythen3] Number of external gates in gating "
"or trigger_gating mode (external gating)."); "or trigger_gating mode (external gating).");
/* CTB/ Moench Specific */ /* CTB/ Moench Specific */
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
asamples, getNumberOfAnalogSamples, setNumberOfAnalogSamples, asamples, getNumberOfAnalogSamples, setNumberOfAnalogSamples,
StringTo<int>, StringTo<int>,
"[n_samples]\n\t[CTB][Moench] Number of analog samples expected."); "[n_samples]\n\t[CTB][Moench] Number of analog samples expected.");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
adcclk, getADCClock, setADCClock, StringTo<int>, adcclk, getADCClock, setADCClock, StringTo<int>,
"[n_clk in MHz]\n\t[Ctb][Moench] ADC clock frequency in MHz."); "[n_clk in MHz]\n\t[Ctb][Moench] ADC clock frequency in MHz.");
INTEGER_COMMAND(runclk, getRUNClock, setRUNClock, StringTo<int>, INTEGER_COMMAND_VEC_ID(runclk, getRUNClock, setRUNClock, StringTo<int>,
"[n_clk in MHz]\n\t[Ctb][Moench] Run clock in MHz."); "[n_clk in MHz]\n\t[Ctb][Moench] Run clock in MHz.");
GET_COMMAND(syncclk, getSYNCClock, GET_COMMAND(syncclk, getSYNCClock,
"[n_clk in MHz]\n\t[Ctb][Moench] Sync clock in MHz."); "[n_clk in MHz]\n\t[Ctb][Moench] Sync clock in MHz.");
INTEGER_COMMAND(adcpipeline, getADCPipeline, setADCPipeline, StringTo<int>, INTEGER_COMMAND_VEC_ID(
adcpipeline, getADCPipeline, setADCPipeline, StringTo<int>,
"[n_value]\n\t[Ctb][Moench] Pipeline for ADC clock."); "[n_value]\n\t[Ctb][Moench] Pipeline for ADC clock.");
INTEGER_IND_COMMAND(v_limit, getVoltage, setVoltage, StringTo<int>, INTEGER_IND_COMMAND(v_limit, getVoltage, setVoltage, StringTo<int>,
@ -2093,20 +2182,22 @@ class CmdProxy {
/* CTB Specific */ /* CTB Specific */
INTEGER_COMMAND(dsamples, getNumberOfDigitalSamples, INTEGER_COMMAND_VEC_ID(
setNumberOfDigitalSamples, StringTo<int>, dsamples, getNumberOfDigitalSamples, setNumberOfDigitalSamples,
StringTo<int>,
"[n_value]\n\t[CTB] Number of digital samples expected."); "[n_value]\n\t[CTB] Number of digital samples expected.");
INTEGER_COMMAND(romode, getReadoutMode, setReadoutMode, INTEGER_COMMAND_VEC_ID(
romode, getReadoutMode, setReadoutMode,
sls::StringTo<slsDetectorDefs::readoutMode>, sls::StringTo<slsDetectorDefs::readoutMode>,
"[analog|digital|analog_digital]\n\t[CTB] Readout mode. " "[analog|digital|analog_digital]\n\t[CTB] Readout mode. "
"Default is analog."); "Default is analog.");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
dbitclk, getDBITClock, setDBITClock, StringTo<int>, dbitclk, getDBITClock, setDBITClock, StringTo<int>,
"[n_clk in MHz]\n\t[Ctb] Clock for latching the digital bits in MHz."); "[n_clk in MHz]\n\t[Ctb] Clock for latching the digital bits in MHz.");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
dbitpipeline, getDBITPipeline, setDBITPipeline, StringTo<int>, dbitpipeline, getDBITPipeline, setDBITPipeline, StringTo<int>,
"[n_value]\n\t[Ctb] Pipeline of the clock for latching digital bits."); "[n_value]\n\t[Ctb] Pipeline of the clock for latching digital bits.");
@ -2167,22 +2258,23 @@ class CmdProxy {
GET_IND_COMMAND(im_io, getMeasuredCurrent, defs::I_POWER_IO, "", GET_IND_COMMAND(im_io, getMeasuredCurrent, defs::I_POWER_IO, "",
"\n\t[Ctb] Measured current of power supply io in mA."); "\n\t[Ctb] Measured current of power supply io in mA.");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
extsampling, getExternalSampling, setExternalSampling, StringTo<int>, extsampling, getExternalSampling, setExternalSampling, StringTo<int>,
"[0, 1]\n\t[Ctb] Enable for external sampling signal to extsamplingsrc " "[0, 1]\n\t[Ctb] Enable for external sampling signal to extsamplingsrc "
"signal for digital data. For advanced users only."); "signal for digital data. For advanced users only.");
INTEGER_COMMAND(extsamplingsrc, getExternalSamplingSource, INTEGER_COMMAND_VEC_ID(
setExternalSamplingSource, StringTo<int>, extsamplingsrc, getExternalSamplingSource, setExternalSamplingSource,
StringTo<int>,
"[0-63]\n\t[Ctb] Sampling source signal for digital data. " "[0-63]\n\t[Ctb] Sampling source signal for digital data. "
"For advanced users only."); "For advanced users only.");
INTEGER_COMMAND(rx_dbitoffset, getRxDbitOffset, setRxDbitOffset, INTEGER_COMMAND_VEC_ID(
StringTo<int>, rx_dbitoffset, getRxDbitOffset, setRxDbitOffset, StringTo<int>,
"[n_bytes]\n\t[Ctb] Offset in bytes in digital data to " "[n_bytes]\n\t[Ctb] Offset in bytes in digital data to "
"skip in receiver."); "skip in receiver.");
INTEGER_COMMAND(led, getLEDEnable, setLEDEnable, StringTo<int>, INTEGER_COMMAND_VEC_ID(led, getLEDEnable, setLEDEnable, StringTo<int>,
"[0, 1]\n\t[Ctb] Switches on/off all LEDs."); "[0, 1]\n\t[Ctb] Switches on/off all LEDs.");
/* Pattern */ /* Pattern */
@ -2238,17 +2330,18 @@ class CmdProxy {
/* Insignificant */ /* Insignificant */
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
port, getControlPort, setControlPort, StringTo<int>, port, getControlPort, setControlPort, StringTo<int>,
"[n]\n\tPort number of the control server on detector for " "[n]\n\tPort number of the control server on detector for "
"detector-client tcp interface. Default is 1952. Normally unchanged."); "detector-client tcp interface. Default is 1952. Normally unchanged.");
INTEGER_COMMAND( INTEGER_COMMAND_VEC_ID(
stopport, getStopPort, setStopPort, StringTo<int>, stopport, getStopPort, setStopPort, StringTo<int>,
"[n]\n\tPort number of the stop server on detector for detector-client " "[n]\n\tPort number of the stop server on detector for detector-client "
"tcp interface. Default is 1953. Normally unchanged."); "tcp interface. Default is 1953. Normally unchanged.");
INTEGER_COMMAND(lock, getDetectorLock, setDetectorLock, StringTo<int>, INTEGER_COMMAND_VEC_ID(lock, getDetectorLock, setDetectorLock,
StringTo<int>,
"[0, 1]\n\tLock detector to one IP, 1: locks"); "[0, 1]\n\tLock detector to one IP, 1: locks");
GET_COMMAND( GET_COMMAND(

View File

@ -435,7 +435,6 @@ void DetectorImpl::readFrameFromReceiver() {
bool gapPixels = multi_shm()->gapPixels; bool gapPixels = multi_shm()->gapPixels;
LOG(logDEBUG) << "Gap pixels: " << gapPixels; LOG(logDEBUG) << "Gap pixels: " << gapPixels;
int nX = 0; int nX = 0;
int nY = 0; int nY = 0;
int nDetPixelsX = 0; int nDetPixelsX = 0;
@ -464,7 +463,6 @@ void DetectorImpl::readFrameFromReceiver() {
runningList[i] = false; runningList[i] = false;
} }
} }
int numConnected = numRunning;
bool data = false; bool data = false;
bool completeImage = false; bool completeImage = false;
char *image = nullptr; char *image = nullptr;
@ -482,14 +480,7 @@ void DetectorImpl::readFrameFromReceiver() {
uint32_t currentSubFrameIndex = -1, coordX = -1, coordY = -1, uint32_t currentSubFrameIndex = -1, coordX = -1, coordY = -1,
flippedDataX = -1; flippedDataX = -1;
// wait for real time acquisition to start while (numRunning != 0) {
bool running = true;
sem_wait(&sem_newRTAcquisition);
if (getJoinThreadFlag()) {
running = false;
}
while (running) {
// reset data // reset data
data = false; data = false;
if (multiframe != nullptr) { if (multiframe != nullptr) {
@ -658,26 +649,6 @@ void DetectorImpl::readFrameFromReceiver() {
pCallbackArg); pCallbackArg);
delete thisData; delete thisData;
} }
// all done
if (numRunning == 0) {
// let main thread know that all dummy packets have been received
//(also from external process),
// main thread can now proceed to measurement finished call back
sem_post(&sem_endRTAcquisition);
// wait for next scan/measurement, else join thread
sem_wait(&sem_newRTAcquisition);
// done with complete acquisition
if (getJoinThreadFlag()) {
running = false;
} else {
// starting a new scan/measurement (got dummy data)
for (size_t i = 0; i < zmqSocket.size(); ++i) {
runningList[i] = connectList[i];
}
numRunning = numConnected;
}
}
} }
// Disconnect resources // Disconnect resources
@ -1030,17 +1001,11 @@ int DetectorImpl::acquire() {
struct timespec begin, end; struct timespec begin, end;
clock_gettime(CLOCK_REALTIME, &begin); clock_gettime(CLOCK_REALTIME, &begin);
// in the real time acquisition loop, processing thread will wait for a
// post each time
sem_init(&sem_newRTAcquisition, 1, 0);
// in the real time acquistion loop, main thread will wait for
// processing thread to be done each time (which in turn waits for
// receiver/ext process)
sem_init(&sem_endRTAcquisition, 1, 0);
bool receiver = Parallel(&Module::getUseReceiverFlag, {}).squash(false); bool receiver = Parallel(&Module::getUseReceiverFlag, {}).squash(false);
if (dataReady == nullptr) {
setJoinThreadFlag(false); setJoinThreadFlag(false);
}
// verify receiver is idle // verify receiver is idle
if (receiver) { if (receiver) {
@ -1050,13 +1015,11 @@ int DetectorImpl::acquire() {
} }
} }
startProcessingThread(); startProcessingThread(receiver);
// start receiver // start receiver
if (receiver) { if (receiver) {
Parallel(&Module::startReceiver, {}); Parallel(&Module::startReceiver, {});
// let processing thread listen to these packets
sem_post(&sem_newRTAcquisition);
} }
// start and read all // start and read all
@ -1071,18 +1034,13 @@ int DetectorImpl::acquire() {
// stop receiver // stop receiver
if (receiver) { if (receiver) {
Parallel(&Module::stopReceiver, {}); Parallel(&Module::stopReceiver, {});
if (dataReady != nullptr) {
sem_wait(&sem_endRTAcquisition); // waits for receiver's
}
// external process to be
// done sending data to gui
Parallel(&Module::incrementFileIndex, {}); Parallel(&Module::incrementFileIndex, {});
} }
// waiting for the data processing thread to finish! // let the progress thread (no callback) know acquisition is done
if (dataReady == nullptr) {
setJoinThreadFlag(true); setJoinThreadFlag(true);
sem_post(&sem_newRTAcquisition); }
dataProcessingThread.join(); dataProcessingThread.join();
if (acquisition_finished != nullptr) { if (acquisition_finished != nullptr) {
@ -1092,9 +1050,6 @@ int DetectorImpl::acquire() {
acquisition_finished(progress, status, acqFinished_p); acquisition_finished(progress, status, acqFinished_p);
} }
sem_destroy(&sem_newRTAcquisition);
sem_destroy(&sem_endRTAcquisition);
clock_gettime(CLOCK_REALTIME, &end); clock_gettime(CLOCK_REALTIME, &end);
LOG(logDEBUG1) << "Elapsed time for acquisition:" LOG(logDEBUG1) << "Elapsed time for acquisition:"
<< ((end.tv_sec - begin.tv_sec) + << ((end.tv_sec - begin.tv_sec) +
@ -1115,12 +1070,13 @@ void DetectorImpl::printProgress(double progress) {
std::cout << '\r' << std::flush; std::cout << '\r' << std::flush;
} }
void DetectorImpl::startProcessingThread() { void DetectorImpl::startProcessingThread(bool receiver) {
dataProcessingThread = std::thread(&DetectorImpl::processData, this); dataProcessingThread =
std::thread(&DetectorImpl::processData, this, receiver);
} }
void DetectorImpl::processData() { void DetectorImpl::processData(bool receiver) {
if (Parallel(&Module::getUseReceiverFlag, {}).squash(false)) { if (receiver) {
if (dataReady != nullptr) { if (dataReady != nullptr) {
readFrameFromReceiver(); readFrameFromReceiver();
} }

View File

@ -276,7 +276,7 @@ class DetectorImpl : public virtual slsDetectorDefs {
* Combines data from all readouts and gives it to the gui * Combines data from all readouts and gives it to the gui
* or just gives progress of acquisition by polling receivers * or just gives progress of acquisition by polling receivers
*/ */
void processData(); void processData(bool receiver);
/** /**
* Convert raw file * Convert raw file
@ -352,7 +352,7 @@ class DetectorImpl : public virtual slsDetectorDefs {
void printProgress(double progress); void printProgress(double progress);
void startProcessingThread(); void startProcessingThread(bool receiver);
/** /**
* Check if processing thread is ready to join main thread * Check if processing thread is ready to join main thread
@ -387,14 +387,6 @@ class DetectorImpl : public virtual slsDetectorDefs {
/** ZMQ Socket - Receiver to Client */ /** ZMQ Socket - Receiver to Client */
std::vector<std::unique_ptr<ZmqSocket>> zmqSocket; std::vector<std::unique_ptr<ZmqSocket>> zmqSocket;
/** semaphore to let postprocessing thread continue for next
* scan/measurement */
sem_t sem_newRTAcquisition;
/** semaphore to let main thread know it got all the dummy packets (also
* from ext. process) */
sem_t sem_endRTAcquisition;
/** mutex to synchronize main and data processing threads */ /** mutex to synchronize main and data processing threads */
mutable std::mutex mp; mutable std::mutex mp;

View File

@ -298,7 +298,7 @@ TEST_CASE("triggers", "[.cmd][.new]") {
det.setNumberOfTriggers(prev_val); det.setNumberOfTriggers(prev_val);
} }
TEST_CASE("exptime", "[.cmd][.new]") { TEST_CASE("exptime", "[.cmd][.time]") {
Detector det; Detector det;
CmdProxy proxy(&det); CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
@ -333,6 +333,12 @@ TEST_CASE("exptime", "[.cmd][.new]") {
proxy.Call("exptime", {"0"}, -1, PUT, oss); proxy.Call("exptime", {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == "exptime 0\n"); REQUIRE(oss.str() == "exptime 0\n");
} }
{
//Get exptime of single module
std::ostringstream oss;
proxy.Call("exptime", {}, 0, GET, oss);
REQUIRE(oss.str() == "exptime 0ns\n");
}
det.setExptime(-1, prev_val); det.setExptime(-1, prev_val);
} }

View File

@ -24,16 +24,16 @@ const std::string DataProcessor::TypeName = "DataProcessor";
DataProcessor::DataProcessor(int ind, detectorType dtype, Fifo *f, DataProcessor::DataProcessor(int ind, detectorType dtype, Fifo *f,
fileFormat *ftype, bool fwenable, bool *mfwenable, fileFormat *ftype, bool fwenable, bool *mfwenable,
bool *dsEnable, uint32_t *dr, uint32_t *freq, bool *dsEnable, uint32_t *freq,
uint32_t *timer, uint32_t *sfnum, bool *fp, uint32_t *timer, uint32_t *sfnum, bool *fp,
bool *act, bool *depaden, bool *sm, bool *qe, bool *act, bool *depaden, bool *sm,
std::vector<int> *cdl, int *cdo, int *cad) std::vector<int> *cdl, int *cdo, int *cad)
: ThreadObject(ind, TypeName), fifo(f), myDetectorType(dtype), : ThreadObject(ind, TypeName), fifo(f), myDetectorType(dtype),
dataStreamEnable(dsEnable), fileFormatType(ftype), dataStreamEnable(dsEnable), fileFormatType(ftype),
fileWriteEnable(fwenable), masterFileWriteEnable(mfwenable), fileWriteEnable(fwenable), masterFileWriteEnable(mfwenable),
dynamicRange(dr), streamingFrequency(freq), streamingTimerInMs(timer), streamingFrequency(freq), streamingTimerInMs(timer),
streamingStartFnum(sfnum), activated(act), streamingStartFnum(sfnum), activated(act),
deactivatedPaddingEnable(depaden), silentMode(sm), quadEnable(qe), deactivatedPaddingEnable(depaden), silentMode(sm),
framePadding(fp), ctbDbitList(cdl), ctbDbitOffset(cdo), framePadding(fp), ctbDbitList(cdl), ctbDbitOffset(cdo),
ctbAnalogDataBytes(cad), firstStreamerFrame(false) { ctbAnalogDataBytes(cad), firstStreamerFrame(false) {
LOG(logDEBUG) << "DataProcessor " << ind << " created"; LOG(logDEBUG) << "DataProcessor " << ind << " created";

View File

@ -49,9 +49,9 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
* @param cad pointer to ctb analog databytes * @param cad pointer to ctb analog databytes
*/ */
DataProcessor(int ind, detectorType dtype, Fifo *f, fileFormat *ftype, DataProcessor(int ind, detectorType dtype, Fifo *f, fileFormat *ftype,
bool fwenable, bool *mfwenable, bool *dsEnable, uint32_t *dr, bool fwenable, bool *mfwenable, bool *dsEnable,
uint32_t *freq, uint32_t *timer, uint32_t *sfnum, bool *fp, uint32_t *freq, uint32_t *timer, uint32_t *sfnum, bool *fp,
bool *act, bool *depaden, bool *sm, bool *qe, bool *act, bool *depaden, bool *sm,
std::vector<int> *cdl, int *cdo, int *cad); std::vector<int> *cdl, int *cdo, int *cad);
/** /**
@ -268,9 +268,6 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
/** Master File Write Enable */ /** Master File Write Enable */
bool *masterFileWriteEnable; bool *masterFileWriteEnable;
/** Dynamic Range */
uint32_t *dynamicRange;
/** Pointer to Streaming frequency, if 0, sending random images with a timer /** Pointer to Streaming frequency, if 0, sending random images with a timer
*/ */
uint32_t *streamingFrequency; uint32_t *streamingFrequency;
@ -296,9 +293,6 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
/** Silent Mode */ /** Silent Mode */
bool *silentMode; bool *silentMode;
/** quad enable */
bool *quadEnable;
/** frame padding */ /** frame padding */
bool *framePadding; bool *framePadding;

View File

@ -180,7 +180,7 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
std::map<std::string, std::string> localAdditionalJsonHeader; std::map<std::string, std::string> localAdditionalJsonHeader;
/** Aquisition Started flag */ /** Aquisition Started flag */
bool startedFlag{nullptr}; bool startedFlag{false};
/** Frame Number of First Frame */ /** Frame Number of First Frame */
uint64_t firstIndex{0}; uint64_t firstIndex{0};

View File

@ -168,7 +168,6 @@ class GeneralData {
class GotthardData : public GeneralData { class GotthardData : public GeneralData {
private: private:
const int nChip = 10;
const int nChan = 128; const int nChan = 128;
const int nChipsPerAdc = 2; const int nChipsPerAdc = 2;
@ -532,8 +531,6 @@ class Gotthard2Data : public GeneralData {
class ChipTestBoardData : public GeneralData { class ChipTestBoardData : public GeneralData {
private: private:
/** Number of analog channels */
const int NCHAN_ANALOG = 32;
/** Number of digital channels */ /** Number of digital channels */
const int NCHAN_DIGITAL = 64; const int NCHAN_DIGITAL = 64;
/** Number of bytes per analog channel */ /** Number of bytes per analog channel */
@ -579,14 +576,8 @@ class ChipTestBoardData : public GeneralData {
// analog channels (normal, analog/digital readout) // analog channels (normal, analog/digital readout)
if (f == slsDetectorDefs::ANALOG_ONLY || if (f == slsDetectorDefs::ANALOG_ONLY ||
f == slsDetectorDefs::ANALOG_AND_DIGITAL) { f == slsDetectorDefs::ANALOG_AND_DIGITAL) {
if (a == BIT32_MASK) { nachans = __builtin_popcount(a);
nachans = 32;
} else {
for (int ich = 0; ich < 32; ++ich) {
if (a & (1 << ich))
++nachans;
}
}
adatabytes = nachans * NUM_BYTES_PER_ANALOG_CHANNEL * as; adatabytes = nachans * NUM_BYTES_PER_ANALOG_CHANNEL * as;
LOG(logDEBUG1) << " Number of Analog Channels:" << nachans LOG(logDEBUG1) << " Number of Analog Channels:" << nachans
<< " Databytes: " << adatabytes; << " Databytes: " << adatabytes;

View File

@ -162,15 +162,15 @@ void Implementation::setDetectorType(const detectorType d) {
auto fifo_ptr = fifo[i].get(); auto fifo_ptr = fifo[i].get();
listener.push_back(sls::make_unique<Listener>( listener.push_back(sls::make_unique<Listener>(
i, myDetectorType, fifo_ptr, &status, &udpPortNum[i], &eth[i], i, myDetectorType, fifo_ptr, &status, &udpPortNum[i], &eth[i],
&numberOfTotalFrames, &dynamicRange, &udpSocketBufferSize, &numberOfTotalFrames, &udpSocketBufferSize,
&actualUDPSocketBufferSize, &framesPerFile, &frameDiscardMode, &actualUDPSocketBufferSize, &framesPerFile, &frameDiscardMode,
&activated, &deactivatedPaddingEnable, &silentMode)); &activated, &deactivatedPaddingEnable, &silentMode));
dataProcessor.push_back(sls::make_unique<DataProcessor>( dataProcessor.push_back(sls::make_unique<DataProcessor>(
i, myDetectorType, fifo_ptr, &fileFormatType, fileWriteEnable, i, myDetectorType, fifo_ptr, &fileFormatType, fileWriteEnable,
&masterFileWriteEnable, &dataStreamEnable, &dynamicRange, &masterFileWriteEnable, &dataStreamEnable,
&streamingFrequency, &streamingTimerInMs, &streamingStartFnum, &streamingFrequency, &streamingTimerInMs, &streamingStartFnum,
&framePadding, &activated, &deactivatedPaddingEnable, &framePadding, &activated, &deactivatedPaddingEnable,
&silentMode, &quadEnable, &ctbDbitList, &ctbDbitOffset, &silentMode, &ctbDbitList, &ctbDbitOffset,
&ctbAnalogDataBytes)); &ctbAnalogDataBytes));
} catch (...) { } catch (...) {
listener.clear(); listener.clear();
@ -841,7 +841,7 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
auto fifo_ptr = fifo[i].get(); auto fifo_ptr = fifo[i].get();
listener.push_back(sls::make_unique<Listener>( listener.push_back(sls::make_unique<Listener>(
i, myDetectorType, fifo_ptr, &status, &udpPortNum[i], i, myDetectorType, fifo_ptr, &status, &udpPortNum[i],
&eth[i], &numberOfTotalFrames, &dynamicRange, &eth[i], &numberOfTotalFrames,
&udpSocketBufferSize, &actualUDPSocketBufferSize, &udpSocketBufferSize, &actualUDPSocketBufferSize,
&framesPerFile, &frameDiscardMode, &activated, &framesPerFile, &frameDiscardMode, &activated,
&deactivatedPaddingEnable, &silentMode)); &deactivatedPaddingEnable, &silentMode));
@ -850,9 +850,9 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
dataProcessor.push_back(sls::make_unique<DataProcessor>( dataProcessor.push_back(sls::make_unique<DataProcessor>(
i, myDetectorType, fifo_ptr, &fileFormatType, i, myDetectorType, fifo_ptr, &fileFormatType,
fileWriteEnable, &masterFileWriteEnable, &dataStreamEnable, fileWriteEnable, &masterFileWriteEnable, &dataStreamEnable,
&dynamicRange, &streamingFrequency, &streamingTimerInMs, &streamingFrequency, &streamingTimerInMs,
&streamingStartFnum, &framePadding, &activated, &streamingStartFnum, &framePadding, &activated,
&deactivatedPaddingEnable, &silentMode, &quadEnable, &deactivatedPaddingEnable, &silentMode,
&ctbDbitList, &ctbDbitOffset, &ctbAnalogDataBytes)); &ctbDbitList, &ctbDbitOffset, &ctbAnalogDataBytes));
dataProcessor[i]->SetGeneralData(generalData); dataProcessor[i]->SetGeneralData(generalData);
} catch (...) { } catch (...) {

View File

@ -21,11 +21,11 @@ const std::string Listener::TypeName = "Listener";
Listener::Listener(int ind, detectorType dtype, Fifo *f, Listener::Listener(int ind, detectorType dtype, Fifo *f,
std::atomic<runStatus> *s, uint32_t *portno, std::string *e, std::atomic<runStatus> *s, uint32_t *portno, std::string *e,
uint64_t *nf, uint32_t *dr, int64_t *us, int64_t *as, uint64_t *nf, int64_t *us, int64_t *as,
uint32_t *fpf, frameDiscardPolicy *fdp, bool *act, uint32_t *fpf, frameDiscardPolicy *fdp, bool *act,
bool *depaden, bool *sm) bool *depaden, bool *sm)
: ThreadObject(ind, TypeName), fifo(f), myDetectorType(dtype), status(s), : ThreadObject(ind, TypeName), fifo(f), myDetectorType(dtype), status(s),
udpPortNumber(portno), eth(e), numImages(nf), dynamicRange(dr), udpPortNumber(portno), eth(e), numImages(nf),
udpSocketBufferSize(us), actualUDPSocketBufferSize(as), udpSocketBufferSize(us), actualUDPSocketBufferSize(as),
framesPerFile(fpf), frameDiscardMode(fdp), activated(act), framesPerFile(fpf), frameDiscardMode(fdp), activated(act),
deactivatedPaddingEnable(depaden), silentMode(sm) { deactivatedPaddingEnable(depaden), silentMode(sm) {

View File

@ -41,7 +41,7 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
* @param sm pointer to silent mode * @param sm pointer to silent mode
*/ */
Listener(int ind, detectorType dtype, Fifo *f, std::atomic<runStatus> *s, Listener(int ind, detectorType dtype, Fifo *f, std::atomic<runStatus> *s,
uint32_t *portno, std::string *e, uint64_t *nf, uint32_t *dr, uint32_t *portno, std::string *e, uint64_t *nf,
int64_t *us, int64_t *as, uint32_t *fpf, frameDiscardPolicy *fdp, int64_t *us, int64_t *as, uint32_t *fpf, frameDiscardPolicy *fdp,
bool *act, bool *depaden, bool *sm); bool *act, bool *depaden, bool *sm);
@ -172,9 +172,6 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
/** Number of Images to catch */ /** Number of Images to catch */
uint64_t *numImages; uint64_t *numImages;
/** Dynamic Range */
uint32_t *dynamicRange;
/** UDP Socket Buffer Size */ /** UDP Socket Buffer Size */
int64_t *udpSocketBufferSize; int64_t *udpSocketBufferSize;