mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-18 15:57:13 +02:00
Compare commits
84 Commits
2020.09.09
...
2020.09.17
Author | SHA1 | Date | |
---|---|---|---|
d945f39142 | |||
ac1e9569b5 | |||
ea1b41c84a | |||
b0dd82c667 | |||
bf69951456 | |||
2d2e80469c | |||
5d648443fa | |||
1fb7352378 | |||
511c206787 | |||
74edb6a1c1 | |||
3376f7fa37 | |||
bfe36085f2 | |||
f061d2273a | |||
b12ae5d929 | |||
2285061623 | |||
e10ebe33d7 | |||
01921bc016 | |||
aa10c4665f | |||
f644cba244 | |||
884da7197e | |||
8ae0659478 | |||
ad95f729dc | |||
3b071cc43f | |||
2805359cd0 | |||
1515b79c97 | |||
2ab4bb1c04 | |||
5214c0f1a4 | |||
60bc3a8fa7 | |||
00f780665f | |||
ab738790e0 | |||
d4cff5b99c | |||
84f49a9b27 | |||
a4926e6ae1 | |||
cf8785ad2e | |||
be8284f5c2 | |||
3fd32b2c9c | |||
d70090967d | |||
88fe306902 | |||
d931416def | |||
6cfaa92b61 | |||
c94dfde17c | |||
b879a377ba | |||
d420451751 | |||
2bc33ad34a | |||
cb23e827bf | |||
a0f915316e | |||
2733bc5320 | |||
3b82e9fcc1 | |||
a95d8f664a | |||
11e7d89da3 | |||
34043c358f | |||
da9c7c354e | |||
4d499e231d | |||
0a7809286b | |||
00abb5e14b | |||
22c2bb0258 | |||
9d1cd09fd4 | |||
80b053eb10 | |||
3cd4f3897b | |||
d011186b9a | |||
669c14d6d5 | |||
ecabc94ade | |||
c58a2d957d | |||
1b214778a5 | |||
d5f6cbc075 | |||
52303daffd | |||
02d4769f6a | |||
a9d1a78662 | |||
3cf2160a2d | |||
4917812bb0 | |||
a0f9c6fe8c | |||
82e978e901 | |||
04bf2aca6d | |||
97687f0f6d | |||
bfbfe204f4 | |||
67d57eb5cd | |||
f940c09290 | |||
30293b1d36 | |||
87bad38f80 | |||
67f1f9924a | |||
e1e04ee755 | |||
6e06d4307d | |||
20a959bf61 | |||
8e49a114db |
@ -38,6 +38,7 @@ set(SPHINX_SOURCE_FILES
|
||||
src/pydetector.rst
|
||||
src/pyenums.rst
|
||||
src/pyexamples.rst
|
||||
src/servers.rst
|
||||
src/receiver.rst
|
||||
src/result.rst
|
||||
src/type_traits.rst
|
||||
@ -57,8 +58,21 @@ configure_file(
|
||||
"${SPHINX_BUILD}/conf.py"
|
||||
@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
|
||||
gendoc
|
||||
COMMAND python gen_server_doc.py
|
||||
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
|
||||
COMMAND ${SPHINX_EXECUTABLE} -a -b html
|
||||
-Dbreathe_projects.slsDetectorPackage=${CMAKE_CURRENT_BINARY_DIR}/xml
|
||||
@ -74,3 +88,4 @@ add_custom_target(rst
|
||||
${SPHINX_BUILD}/src
|
||||
${SPHINX_BUILD}/html
|
||||
COMMENT "Generating documentation with Sphinx")
|
||||
|
||||
|
@ -59,4 +59,8 @@ html_theme = "sphinx_rtd_theme"
|
||||
# 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,
|
||||
# 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
53
docs/gen_server_doc.py.in
Normal 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')
|
@ -50,6 +50,11 @@ Welcome to slsDetectorPackage's documentation!
|
||||
type_traits
|
||||
ToString
|
||||
|
||||
.. toctree::
|
||||
:caption: Servers
|
||||
|
||||
servers
|
||||
|
||||
.. Indices and tables
|
||||
.. ==================
|
||||
|
||||
|
60
docs/src/servers.rst
Normal file
60
docs/src/servers.rst
Normal 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
4
docs/static/extra.css
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/* override table no-wrap */
|
||||
.wy-table-responsive table td, .wy-table-responsive table th {
|
||||
white-space: normal;
|
||||
}
|
@ -41,11 +41,11 @@ hostname bchip074+bchip075+
|
||||
|
||||
|
||||
r_readfreq 1
|
||||
rx_datastream 1
|
||||
rx_zmqstream 1
|
||||
|
||||
#replace my_receiver_hostname with the hostname of 1Gb IP of the machine where the receiver runs
|
||||
rx_hostname my_receiver_hostname
|
||||
rx_datastream 1
|
||||
rx_zmqstream 1
|
||||
outdir /tmp/
|
||||
|
||||
|
||||
|
@ -459,8 +459,8 @@ rx_hostname mpc2011
|
||||
|
||||
tengiga 1
|
||||
|
||||
rx_datastream 1
|
||||
rx_readfreq 1
|
||||
rx_zmqstream 1
|
||||
rx_zmqfreq 1
|
||||
|
||||
|
||||
dac 6 800
|
||||
|
@ -35,7 +35,7 @@ zmqport 50001
|
||||
|
||||
|
||||
tengiga 1
|
||||
rx_datastream 1
|
||||
rx_zmqstream 1
|
||||
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ period 0.0006
|
||||
############################################
|
||||
fpath /mnt/moench_data/scratch/
|
||||
fwrite 0
|
||||
rx_datastream 1
|
||||
rx_zmqstream 1
|
||||
|
||||
rx_jsonpara frameMode frame
|
||||
rx_jsonpara detectorMode counting
|
||||
|
@ -35,7 +35,7 @@ set( PYTHON_FILES
|
||||
gotthard.py
|
||||
gotthard2.py
|
||||
moench.py
|
||||
jsonproxy.py
|
||||
proxy.py
|
||||
ctb.py
|
||||
jungfrau.py
|
||||
mythen3.py
|
||||
|
@ -1,98 +0,0 @@
|
||||
import subprocess
|
||||
import locale
|
||||
out = subprocess.run(['g', 'list'], stdout = subprocess.PIPE, encoding=locale.getpreferredencoding())
|
||||
cmd = out.stdout.splitlines()
|
||||
cmd.pop(0)
|
||||
|
||||
from slsdet import Detector, Eiger, Ctb
|
||||
|
||||
pycmd = dir(Detector)+dir(Eiger)+dir(Ctb)
|
||||
|
||||
#Add commands that we should not expect as direct commands in python
|
||||
pycmd += ['vrf', 'vtr', 'vrs', 'vtgstv', 'vsvn', 'vtrim',
|
||||
'vsvp', 'vth1', 'vth2', 'vth3', 'vshaper', 'vshaperneg', 'rxb_rb',
|
||||
'rxb_lb', 'vref_prech', 'vref_rstore', 'vref_cds',
|
||||
'vpreamp', 'vref_comp', 'vref_comp_fe vref_ds', 'vref_h_adc',
|
||||
'vref_l_adc', 'iodelay', 'list', 'vref_ds', 'vis', 'vpl',
|
||||
'vref_comp_fe', 'vph', 'vout_cm', 'vcp', 'vcn', 'vcmp_ll', 'vcmp_lr'
|
||||
|
||||
]
|
||||
|
||||
|
||||
# dacs are in general not included in the python commands and we expect to
|
||||
# set them from the specialized class or using an enum
|
||||
dacs = [
|
||||
'vicin',
|
||||
'vcassh',
|
||||
'vcal_n',
|
||||
'vcal_p'
|
||||
'vipre_out',
|
||||
'vipre_cds',
|
||||
'vdd_prot',
|
||||
'vcmp_rl',
|
||||
'vcmp_rr',
|
||||
'vcal', 'vcas',
|
||||
'vipre',
|
||||
'vin_com',
|
||||
'vin_cm',
|
||||
'vrshaper',
|
||||
'vrshaper_n',
|
||||
'vrpreamp',
|
||||
'vishaper',
|
||||
'vipre_out',
|
||||
'vcom_adc1',
|
||||
'vcom_adc2',
|
||||
'vcom_cds',
|
||||
'vdcsh',
|
||||
'v_chip',
|
||||
'vb_comp',
|
||||
'vb_comp_adc',
|
||||
'vb_comp_fe',
|
||||
'vb_cs',
|
||||
'vb_ds',
|
||||
'vb_opa_1st',
|
||||
'vb_opa_fd',
|
||||
'vb_pixbuf',
|
||||
'vb_sda',
|
||||
'vbp_colbuf',
|
||||
'vcal_p',
|
||||
'vcasc_out',
|
||||
'vcasc_sfp',
|
||||
'vcascn_pb',
|
||||
'vcascp_pb',
|
||||
'vchip_comp_adc',
|
||||
'vchip_comp_fe',
|
||||
'vchip_cs',
|
||||
'vchip_opa_1st',
|
||||
'vchip_opa_fd',
|
||||
'vchip_ref_comp_fe',
|
||||
|
||||
]
|
||||
|
||||
intentionally_missing = [
|
||||
'temp_10ge', #temperatures already available from enum or specialized class
|
||||
'temp_adc',
|
||||
'temp_dcdc',
|
||||
'temp_fpga',
|
||||
'temp_fpgaext',
|
||||
'temp_fpgafl',
|
||||
'temp_fpgafr',
|
||||
'temp_slowadc',
|
||||
'temp_sodl',
|
||||
'temp_sodr',
|
||||
'trigger', #use sendSoftwareTrigger
|
||||
'update', #use updateServerAndFirmare
|
||||
'udp_validate', #use validateUdpConfiguration
|
||||
'udp_reconfigure', #use reconfigureUdpDestination
|
||||
'emin', #use rx_jsonpara
|
||||
]
|
||||
|
||||
pycmd += intentionally_missing
|
||||
pycmd += dacs
|
||||
missing = []
|
||||
for c in cmd:
|
||||
if c not in pycmd:
|
||||
print(c)
|
||||
missing.append(c)
|
||||
|
||||
print(f'Missing: {len(missing)} commands')
|
132
python/scripts/compare_with_commandline.py
Normal file
132
python/scripts/compare_with_commandline.py
Normal file
@ -0,0 +1,132 @@
|
||||
import subprocess
|
||||
import locale
|
||||
out = subprocess.run(['g', 'list'], stdout = subprocess.PIPE, encoding=locale.getpreferredencoding())
|
||||
cmd = out.stdout.splitlines()
|
||||
cmd.pop(0)
|
||||
|
||||
from slsdet import Detector
|
||||
|
||||
pycmd = dir(Detector)
|
||||
|
||||
|
||||
# dacs are in general not included in the python commands and we expect to
|
||||
# set them from the specialized class or using an enum
|
||||
dacs = [
|
||||
'adcvpp',
|
||||
'iodelay',
|
||||
'list',
|
||||
'rxb_lb',
|
||||
'rxb_rb',
|
||||
'v_chip',
|
||||
'vb_comp',
|
||||
'vb_comp_adc',
|
||||
'vb_comp_fe',
|
||||
'vb_cs',
|
||||
'vb_ds',
|
||||
'vb_opa_1st',
|
||||
'vb_opa_fd',
|
||||
'vb_pixbuf',
|
||||
'vb_sda',
|
||||
'vbp_colbuf',
|
||||
'vcal',
|
||||
'vcal_n',
|
||||
'vcal_p',
|
||||
'vipre_out',
|
||||
'vcas',
|
||||
'vcasc_out',
|
||||
'vcasc_sfp',
|
||||
'vcascn_pb',
|
||||
'vcascp_pb',
|
||||
'vcassh',
|
||||
'vchip_comp_adc',
|
||||
'vchip_comp_fe',
|
||||
'vchip_cs',
|
||||
'vchip_opa_1st',
|
||||
'vchip_opa_fd',
|
||||
'vchip_ref_comp_fe',
|
||||
'vcmp_ll',
|
||||
'vcmp_lr',
|
||||
'vcmp_rl',
|
||||
'vcmp_rr',
|
||||
'vcn',
|
||||
'vcom_adc1',
|
||||
'vcom_adc2',
|
||||
'vcom_cds',
|
||||
'vcp',
|
||||
'vdcsh',
|
||||
'vdd_prot',
|
||||
'vicin',
|
||||
'vin_cm',
|
||||
'vin_com',
|
||||
'vipre',
|
||||
'vipre_cds',
|
||||
'vipre_out',
|
||||
'vishaper',
|
||||
'vout_cm',
|
||||
'vref_cds',
|
||||
'vref_comp',
|
||||
'vref_comp_fe',
|
||||
'vref_ds',
|
||||
'vref_h_adc',
|
||||
'vref_l_adc',
|
||||
'vref_prech',
|
||||
'vref_rstore',
|
||||
'vrpreamp',
|
||||
'vrshaper',
|
||||
'vrshaper_n',
|
||||
'vsvn',
|
||||
'vsvp',
|
||||
'vtgstv',
|
||||
'vth1',
|
||||
'vth2',
|
||||
'vth3',
|
||||
'vtrim'
|
||||
]
|
||||
|
||||
intentionally_missing = [
|
||||
'activate', #use getActive and getRxPadDeactivatedMode syntax is not a good fit for python
|
||||
'temp_10ge', #temperatures already available from enum or specialized class
|
||||
'temp_adc',
|
||||
'temp_dcdc',
|
||||
'temp_fpga',
|
||||
'temp_fpgaext',
|
||||
'temp_fpgafl',
|
||||
'temp_fpgafr',
|
||||
'temp_slowadc',
|
||||
'temp_sodl',
|
||||
'temp_sodr',
|
||||
'trigger', #use sendSoftwareTrigger
|
||||
'update', #use updateServerAndFirmare
|
||||
'udp_validate', #use validateUdpConfiguration
|
||||
'udp_reconfigure', #use reconfigureUdpDestination
|
||||
'pulse', # use pulseChip pulsePixel pulsePixelNmove
|
||||
'pulsechip',
|
||||
'pulsenmove',
|
||||
]
|
||||
|
||||
pycmd += intentionally_missing
|
||||
pycmd += dacs
|
||||
missing = []
|
||||
for c in cmd:
|
||||
if c not in pycmd:
|
||||
print(c)
|
||||
missing.append(c)
|
||||
|
||||
print(f'\nMissing: {len(missing)} commands')
|
||||
print(f'Excluded: {len(dacs)} dacs')
|
||||
print(f'Excluded: {len(intentionally_missing)} other commands')
|
||||
|
||||
|
||||
|
||||
not_in_cmd = []
|
||||
for c in pycmd:
|
||||
if c.islower() and not c.startswith('_'):
|
||||
if c not in cmd:
|
||||
not_in_cmd.append(c)
|
||||
print(f'\nCommands in Python and NOT in command line: {len(not_in_cmd)}')
|
||||
for c in not_in_cmd:
|
||||
print(c)
|
||||
|
||||
|
||||
|
||||
# print(',\n'.join([f'\'{d}\'' for d in sorted(dacs)]))
|
@ -60,6 +60,23 @@ def get_arguments(node):
|
||||
args = f", {args}"
|
||||
return args
|
||||
|
||||
def get_arguments_with_default(node):
|
||||
args = []
|
||||
for arg in node.get_arguments():
|
||||
tokens = [t.spelling for t in arg.get_tokens()]
|
||||
print(tokens)
|
||||
if '=' in tokens:
|
||||
if arg.type.spelling == "sls::Positions": #TODO! automate
|
||||
args.append("py::arg() = Positions{}")
|
||||
else:
|
||||
args.append('py::arg()' + ''.join(tokens[tokens.index('='):]))
|
||||
else:
|
||||
args.append('py::arg()')
|
||||
args = ", ".join(args)
|
||||
if args:
|
||||
args = f", {args}"
|
||||
return args
|
||||
|
||||
|
||||
def get_fdec(node):
|
||||
args = [a.type.spelling for a in node.get_arguments()]
|
||||
@ -86,7 +103,8 @@ def visit(node):
|
||||
and child.access_specifier == cindex.AccessSpecifier.PUBLIC
|
||||
):
|
||||
m.append(child)
|
||||
args = get_arguments(child)
|
||||
# args = get_arguments(child)
|
||||
args = get_arguments_with_default(child)
|
||||
fs = get_fdec(child)
|
||||
lines.append(
|
||||
f'.def("{child.spelling}",{fs} &Detector::{child.spelling}{args})'
|
||||
|
@ -8,31 +8,12 @@ from .mythen3 import Mythen3
|
||||
from .gotthard2 import Gotthard2
|
||||
from .gotthard import Gotthard
|
||||
from .moench import Moench
|
||||
# from .jungfrau_ctb import JungfrauCTB
|
||||
# from _slsdet import DetectorApi
|
||||
|
||||
import _slsdet
|
||||
|
||||
defs = _slsdet.slsDetectorDefs
|
||||
|
||||
from .enums import *
|
||||
# runStatus = _slsdet.slsDetectorDefs.runStatus
|
||||
# speedLevel = _slsdet.slsDetectorDefs.speedLevel
|
||||
# detectorType = _slsdet.slsDetectorDefs.detectorType
|
||||
# frameDiscardPolicy = _slsdet.slsDetectorDefs.frameDiscardPolicy
|
||||
# fileFormat = _slsdet.slsDetectorDefs.fileFormat
|
||||
# dimension = _slsdet.slsDetectorDefs.dimension
|
||||
# externalSignalFlag = _slsdet.slsDetectorDefs.externalSignalFlag
|
||||
# timingMode = _slsdet.slsDetectorDefs.timingMode
|
||||
# dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
# detectorSettings = _slsdet.slsDetectorDefs.detectorSettings
|
||||
# clockIndex = _slsdet.slsDetectorDefs.clockIndex
|
||||
# readoutMode = _slsdet.slsDetectorDefs.readoutMode
|
||||
# masterFlags = _slsdet.slsDetectorDefs.masterFlags
|
||||
# frameModeType = _slsdet.slsDetectorDefs.frameModeType
|
||||
# detectorModeType = _slsdet.slsDetectorDefs.detectorModeType
|
||||
# burstMode = _slsdet.slsDetectorDefs.burstMode
|
||||
# timingSourceType = _slsdet.slsDetectorDefs.timingSourceType
|
||||
|
||||
|
||||
IpAddr = _slsdet.IpAddr
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -13,7 +13,5 @@ detectorSettings = _slsdet.slsDetectorDefs.detectorSettings
|
||||
clockIndex = _slsdet.slsDetectorDefs.clockIndex
|
||||
readoutMode = _slsdet.slsDetectorDefs.readoutMode
|
||||
masterFlags = _slsdet.slsDetectorDefs.masterFlags
|
||||
frameModeType = _slsdet.slsDetectorDefs.frameModeType
|
||||
detectorModeType = _slsdet.slsDetectorDefs.detectorModeType
|
||||
burstMode = _slsdet.slsDetectorDefs.burstMode
|
||||
timingSourceType = _slsdet.slsDetectorDefs.timingSourceType
|
@ -1,30 +0,0 @@
|
||||
from .utils import element_if_equal
|
||||
|
||||
class JsonProxy:
|
||||
"""
|
||||
Proxy class to allow for intuitive setting and getting of rx_jsonpara
|
||||
This class is returned by Detectr.rx_jsonpara
|
||||
"""
|
||||
def __init__(self, det):
|
||||
self.det = det
|
||||
|
||||
def __getitem__(self, key):
|
||||
return element_if_equal(self.det.getAdditionalJsonParameter(key))
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
self.det.setAdditionalJsonParameter(key, str(value))
|
||||
|
||||
def __repr__(self):
|
||||
r = element_if_equal(self.det.getAdditionalJsonHeader())
|
||||
if isinstance(r, list):
|
||||
rstr = ''
|
||||
for i, list_item in enumerate(r):
|
||||
list_item = dict(list_item)
|
||||
rstr += ''.join([f'{i}:{key}: {value}\n' for key, value in list_item.items()])
|
||||
|
||||
return rstr.strip('\n')
|
||||
else:
|
||||
r = dict(r)
|
||||
return '\n'.join([f'{key}: {value}' for key, value in r.items()])
|
||||
|
||||
|
85
python/slsdet/proxy.py
Normal file
85
python/slsdet/proxy.py
Normal file
@ -0,0 +1,85 @@
|
||||
from .utils import element_if_equal
|
||||
from .enums import dacIndex
|
||||
|
||||
|
||||
def set_proxy_using_dict(func, key, value):
|
||||
if isinstance(value, dict) and all(isinstance(k, int) for k in value.keys()):
|
||||
for dkey, dvalue in value.items():
|
||||
func(key, dvalue, [dkey])
|
||||
else:
|
||||
func(key, value)
|
||||
|
||||
class JsonProxy:
|
||||
"""
|
||||
Proxy class to allow for intuitive setting and getting of rx_jsonpara
|
||||
This class is returned by Detectr.rx_jsonpara
|
||||
"""
|
||||
def __init__(self, det):
|
||||
self.det = det
|
||||
|
||||
def __getitem__(self, key):
|
||||
return element_if_equal(self.det.getAdditionalJsonParameter(key))
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
self.det.setAdditionalJsonParameter(key, str(value))
|
||||
|
||||
def __repr__(self):
|
||||
r = element_if_equal(self.det.getAdditionalJsonHeader())
|
||||
if isinstance(r, list):
|
||||
rstr = ''
|
||||
for i, list_item in enumerate(r):
|
||||
list_item = dict(list_item)
|
||||
rstr += ''.join([f'{i}:{key}: {value}\n' for key, value in list_item.items()])
|
||||
|
||||
return rstr.strip('\n')
|
||||
else:
|
||||
r = dict(r)
|
||||
return '\n'.join([f'{key}: {value}' for key, value in r.items()])
|
||||
|
||||
|
||||
|
||||
class SlowAdcProxy:
|
||||
"""
|
||||
Proxy class to allow for more intuitive reading the slow ADCs
|
||||
"""
|
||||
def __init__(self, det):
|
||||
self.det = det
|
||||
|
||||
def __getitem__(self, key):
|
||||
dac_index = dacIndex(int(dacIndex.SLOW_ADC0)+key)
|
||||
return element_if_equal(self.det.getSlowADC(dac_index))
|
||||
|
||||
def __repr__(self):
|
||||
rstr = ''
|
||||
for i in range(7):
|
||||
r = element_if_equal(self.__getitem__(i))
|
||||
if isinstance(r, list):
|
||||
rstr += ' '.join(f'{item} mV' for item in r)
|
||||
else:
|
||||
rstr += f'{i}: {r} mV\n'
|
||||
|
||||
return rstr.strip('\n')
|
||||
|
||||
class ClkDivProxy:
|
||||
"""
|
||||
Proxy class to allow for more intuitive reading clockdivider
|
||||
"""
|
||||
def __init__(self, det):
|
||||
self.det = det
|
||||
|
||||
def __getitem__(self, key):
|
||||
return element_if_equal(self.det.getClockDivider(key))
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
set_proxy_using_dict(self.det.setClockDivider, key, value)
|
||||
|
||||
def __repr__(self):
|
||||
rstr = ''
|
||||
for i in range(6):
|
||||
r = element_if_equal(self.__getitem__(i))
|
||||
if isinstance(r, list):
|
||||
rstr += ' '.join(f'{item}' for item in r)
|
||||
else:
|
||||
rstr += f'{i}: {r}\n'
|
||||
|
||||
return rstr.strip('\n')
|
@ -111,14 +111,14 @@ def make_string_path(path):
|
||||
|
||||
|
||||
def set_using_dict(func, args):
|
||||
if isinstance(args, dict):
|
||||
if isinstance(args, dict) and all(isinstance(k, int) for k in args.keys()):
|
||||
for key, value in args.items():
|
||||
func(value, [key])
|
||||
else:
|
||||
func(args)
|
||||
|
||||
def set_time_using_dict(func, args):
|
||||
if isinstance(args, dict):
|
||||
if isinstance(args, dict) and all(isinstance(k, int) for k in args.keys()):
|
||||
for key, value in args.items():
|
||||
if isinstance(value, int):
|
||||
value = float(value)
|
||||
|
@ -322,11 +322,11 @@ void init_det(py::module &m) {
|
||||
(Result<int>(Detector::*)(defs::dacIndex, bool, sls::Positions)
|
||||
const) &
|
||||
Detector::getDAC,
|
||||
py::arg(), py::arg(), py::arg() = Positions{})
|
||||
py::arg(), py::arg() = false, py::arg() = Positions{})
|
||||
.def("setDAC",
|
||||
(void (Detector::*)(defs::dacIndex, int, bool, sls::Positions)) &
|
||||
Detector::setDAC,
|
||||
py::arg(), py::arg(), py::arg(), py::arg() = Positions{})
|
||||
py::arg(), py::arg(), py::arg() = false, py::arg() = Positions{})
|
||||
.def("getOnChipDAC",
|
||||
(Result<int>(Detector::*)(defs::dacIndex, int, sls::Positions)
|
||||
const) &
|
||||
@ -346,6 +346,14 @@ void init_det(py::module &m) {
|
||||
sls::Positions)) &
|
||||
Detector::setExternalSignalFlags,
|
||||
py::arg(), py::arg(), py::arg() = Positions{})
|
||||
.def("getParallelMode",
|
||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getParallelMode,
|
||||
py::arg() = Positions{})
|
||||
.def("setParallelMode",
|
||||
(void (Detector::*)(bool, sls::Positions)) &
|
||||
Detector::setParallelMode,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("acquire", (void (Detector::*)()) & Detector::acquire)
|
||||
.def("clearAcquiringFlag",
|
||||
(void (Detector::*)()) & Detector::clearAcquiringFlag)
|
||||
@ -480,14 +488,14 @@ void init_det(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("setDestinationUDPPort",
|
||||
(void (Detector::*)(int, int)) & Detector::setDestinationUDPPort,
|
||||
py::arg(), py::arg())
|
||||
py::arg(), py::arg() = -1)
|
||||
.def("getDestinationUDPPort2",
|
||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getDestinationUDPPort2,
|
||||
py::arg() = Positions{})
|
||||
.def("setDestinationUDPPort2",
|
||||
(void (Detector::*)(int, int)) & Detector::setDestinationUDPPort2,
|
||||
py::arg(), py::arg())
|
||||
py::arg(), py::arg() = -1)
|
||||
.def("reconfigureUDPDestination",
|
||||
(void (Detector::*)(sls::Positions)) &
|
||||
Detector::reconfigureUDPDestination,
|
||||
@ -560,7 +568,7 @@ void init_det(py::module &m) {
|
||||
Detector::getRxPort,
|
||||
py::arg() = Positions{})
|
||||
.def("setRxPort", (void (Detector::*)(int, int)) & Detector::setRxPort,
|
||||
py::arg(), py::arg())
|
||||
py::arg(), py::arg() = -1)
|
||||
.def("getRxFifoDepth",
|
||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getRxFifoDepth,
|
||||
@ -722,7 +730,7 @@ void init_det(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("setRxZmqPort",
|
||||
(void (Detector::*)(int, int)) & Detector::setRxZmqPort, py::arg(),
|
||||
py::arg())
|
||||
py::arg() = -1)
|
||||
.def("getRxZmqIP",
|
||||
(Result<sls::IpAddr>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getRxZmqIP,
|
||||
@ -737,7 +745,7 @@ void init_det(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("setClientZmqPort",
|
||||
(void (Detector::*)(int, int)) & Detector::setClientZmqPort,
|
||||
py::arg(), py::arg())
|
||||
py::arg(), py::arg() = -1)
|
||||
.def("getClientZmqIp",
|
||||
(Result<sls::IpAddr>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getClientZmqIp,
|
||||
@ -770,7 +778,8 @@ void init_det(py::module &m) {
|
||||
(void (Detector::*)(int, defs::detectorSettings, bool,
|
||||
sls::Positions)) &
|
||||
Detector::setThresholdEnergy,
|
||||
py::arg(), py::arg(), py::arg(), py::arg() = Positions{})
|
||||
py::arg(), py::arg() = defs::STANDARD, py::arg() = true,
|
||||
py::arg() = Positions{})
|
||||
.def("getSettingsPath",
|
||||
(Result<std::string>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getSettingsPath,
|
||||
@ -779,14 +788,6 @@ void init_det(py::module &m) {
|
||||
(void (Detector::*)(const std::string &, sls::Positions)) &
|
||||
Detector::setSettingsPath,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getParallelMode",
|
||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getParallelMode,
|
||||
py::arg() = Positions{})
|
||||
.def("setParallelMode",
|
||||
(void (Detector::*)(bool, sls::Positions)) &
|
||||
Detector::setParallelMode,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getOverFlowMode",
|
||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getOverFlowMode,
|
||||
@ -1344,31 +1345,6 @@ void init_det(py::module &m) {
|
||||
sls::Positions)) &
|
||||
Detector::setAdditionalJsonParameter,
|
||||
py::arg(), py::arg(), py::arg() = Positions{})
|
||||
.def("getDetectorMinMaxEnergyThreshold",
|
||||
(Result<int>(Detector::*)(const bool, sls::Positions) const) &
|
||||
Detector::getDetectorMinMaxEnergyThreshold,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("setDetectorMinMaxEnergyThreshold",
|
||||
(void (Detector::*)(const bool, const int, sls::Positions)) &
|
||||
Detector::setDetectorMinMaxEnergyThreshold,
|
||||
py::arg(), py::arg(), py::arg() = Positions{})
|
||||
.def("getFrameMode",
|
||||
(Result<defs::frameModeType>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getFrameMode,
|
||||
py::arg() = Positions{})
|
||||
.def("setFrameMode",
|
||||
(void (Detector::*)(defs::frameModeType, sls::Positions)) &
|
||||
Detector::setFrameMode,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getDetectorMode",
|
||||
(Result<defs::detectorModeType>(Detector::*)(sls::Positions)
|
||||
const) &
|
||||
Detector::getDetectorMode,
|
||||
py::arg() = Positions{})
|
||||
.def("setDetectorMode",
|
||||
(void (Detector::*)(defs::detectorModeType, sls::Positions)) &
|
||||
Detector::setDetectorMode,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("programFPGA",
|
||||
(void (Detector::*)(const std::string &, sls::Positions)) &
|
||||
Detector::programFPGA,
|
||||
|
@ -259,20 +259,6 @@ void init_enums(py::module &m) {
|
||||
.value("IS_SLAVE", slsDetectorDefs::masterFlags::IS_SLAVE)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::frameModeType>(Defs, "frameModeType")
|
||||
.value("PEDESTAL", slsDetectorDefs::frameModeType::PEDESTAL)
|
||||
.value("NEW_PEDESTAL", slsDetectorDefs::frameModeType::NEW_PEDESTAL)
|
||||
.value("FLATFIELD", slsDetectorDefs::frameModeType::FLATFIELD)
|
||||
.value("NEW_FLATFIELD", slsDetectorDefs::frameModeType::NEW_FLATFIELD)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::detectorModeType>(Defs, "detectorModeType")
|
||||
.value("COUNTING", slsDetectorDefs::detectorModeType::COUNTING)
|
||||
.value("INTERPOLATING",
|
||||
slsDetectorDefs::detectorModeType::INTERPOLATING)
|
||||
.value("ANALOG", slsDetectorDefs::detectorModeType::ANALOG)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::burstMode>(Defs, "burstMode")
|
||||
.value("BURST_INTERNAL", slsDetectorDefs::burstMode::BURST_INTERNAL)
|
||||
.value("BURST_EXTERNAL", slsDetectorDefs::burstMode::BURST_EXTERNAL)
|
||||
|
@ -379,15 +379,15 @@ def test_set_readout_clock_3(d, mocker):
|
||||
d.readout_clock = 'Super Slow Speed'
|
||||
m.assert_called_once_with(3)
|
||||
|
||||
#----------------------------------------------------------------rx_datastream
|
||||
def test_get_rx_datastream(d, mocker):
|
||||
#----------------------------------------------------------------rx_zmqstream
|
||||
def test_get_rx_zmqstream(d, mocker):
|
||||
m = mocker.patch('_slsdet.DetectorApi.getRxDataStreamStatus')
|
||||
m.return_value = False
|
||||
assert d.rx_datastream == False
|
||||
assert d.rx_zmqstream == False
|
||||
|
||||
def test_set_rx_datastream(d, mocker):
|
||||
def test_set_rx_zmqstream(d, mocker):
|
||||
m = mocker.patch('_slsdet.DetectorApi.setRxDataStreamStatus')
|
||||
d.rx_datastream = True
|
||||
d.rx_zmqstream = True
|
||||
m.assert_called_once_with(True)
|
||||
|
||||
def test_get_rx_zmqip(d, mocker):
|
||||
|
@ -412,15 +412,15 @@ def test_set_counters_single(d, mocker):
|
||||
# d.readout_clock = 'Super Slow Speed'
|
||||
# m.assert_called_once_with(3)
|
||||
|
||||
# #----------------------------------------------------------------rx_datastream
|
||||
# def test_get_rx_datastream(d, mocker):
|
||||
# #----------------------------------------------------------------rx_zmqstream
|
||||
# def test_get_rx_zmqstream(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getRxDataStreamStatus')
|
||||
# m.return_value = False
|
||||
# assert d.rx_datastream == False
|
||||
# assert d.rx_zmqstream == False
|
||||
|
||||
# def test_set_rx_datastream(d, mocker):
|
||||
# def test_set_rx_zmqstream(d, mocker):
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setRxDataStreamStatus')
|
||||
# d.rx_datastream = True
|
||||
# d.rx_zmqstream = True
|
||||
# m.assert_called_once_with(True)
|
||||
|
||||
# def test_get_rx_zmqip(d, mocker):
|
||||
|
Binary file not shown.
@ -23,6 +23,7 @@
|
||||
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
extern int updateFlag;
|
||||
extern udpStruct udpDetails;
|
||||
extern const enum detectorType myDetectorType;
|
||||
|
||||
@ -105,8 +106,9 @@ void basictests() {
|
||||
}
|
||||
|
||||
// does check only if flag is 0 (by default), set by command line
|
||||
if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) ||
|
||||
(testBus() == FAIL))) {
|
||||
if ((!debugflag) && (!updateFlag) &&
|
||||
((checkType() == FAIL) || (testFpga() == FAIL) ||
|
||||
(testBus() == FAIL))) {
|
||||
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
|
||||
"Dangerous to continue.\n");
|
||||
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||
@ -145,7 +147,7 @@ void basictests() {
|
||||
(long long int)client_sw_apiversion));
|
||||
|
||||
// return if flag is not zero, debug mode
|
||||
if (debugflag) {
|
||||
if (debugflag || updateFlag) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -417,7 +419,7 @@ uint32_t getDetectorIP() {
|
||||
/* initialization */
|
||||
|
||||
void initControlServer() {
|
||||
if (initError == OK) {
|
||||
if (!updateFlag && initError == OK) {
|
||||
setupDetector();
|
||||
}
|
||||
initCheckDone = 1;
|
||||
|
@ -95,7 +95,7 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, SYNC_CLK, DBIT_CLK, NUM_CLOCKS };
|
||||
#define NDAC_ONLY (NDAC - NPWR)
|
||||
#define DYNAMIC_RANGE (16)
|
||||
#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_VA_DEVICE_ID (0x41)
|
||||
#define I2C_POWER_VB_DEVICE_ID (0x42)
|
||||
|
Binary file not shown.
@ -20,6 +20,7 @@
|
||||
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
extern int updateFlag;
|
||||
extern udpStruct udpDetails;
|
||||
extern const enum detectorType myDetectorType;
|
||||
|
||||
@ -140,7 +141,7 @@ void basictests() {
|
||||
return;
|
||||
#endif
|
||||
// return if debugflag is not zero, debug mode
|
||||
if (debugflag) {
|
||||
if (debugflag || updateFlag) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -319,7 +320,7 @@ u_int32_t getDetectorIP() {
|
||||
|
||||
void initControlServer() {
|
||||
LOG(logINFOBLUE, ("Configuring Control server\n"));
|
||||
if (initError == OK) {
|
||||
if (!updateFlag && initError == OK) {
|
||||
readDetectorNumber();
|
||||
getModuleConfiguration();
|
||||
#ifndef VIRTUAL
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#define REQUIRED_FIRMWARE_VERSION (26)
|
||||
#define REQUIRED_FIRMWARE_VERSION (27)
|
||||
#define IDFILECOMMAND "more /home/root/executables/detid.txt"
|
||||
#define CONFIG_FILE ("config_eiger.txt")
|
||||
#define WAIT_STOP_SERVER_START (1 * 1000 * 1000)
|
||||
@ -130,7 +130,7 @@ enum MASTERINDEX { MASTER_HARDWARE, OW_MASTER, OW_SLAVE };
|
||||
#define DAC_MAX_STEPS (4096)
|
||||
|
||||
#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 HIGH_VOLTAGE_TOLERANCE (5)
|
||||
|
Binary file not shown.
@ -22,6 +22,7 @@
|
||||
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
extern int updateFlag;
|
||||
extern int checkModuleFlag;
|
||||
extern udpStruct udpDetails;
|
||||
extern const enum detectorType myDetectorType;
|
||||
@ -92,8 +93,9 @@ void basictests() {
|
||||
return;
|
||||
}
|
||||
// does check only if flag is 0 (by default), set by command line
|
||||
if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) ||
|
||||
(testBus() == FAIL))) {
|
||||
if ((!debugflag) && (!updateFlag) &&
|
||||
((checkKernelVersion() == FAIL) || (checkType() == FAIL) ||
|
||||
(testFpga() == FAIL) || (testBus() == FAIL))) {
|
||||
sprintf(initErrorMessage,
|
||||
"Could not pass basic tests of FPGA and bus. Dangerous to "
|
||||
"continue. (Firmware version:0x%llx) \n",
|
||||
@ -131,7 +133,7 @@ void basictests() {
|
||||
(long long int)client_sw_apiversion));
|
||||
|
||||
// return if flag is not zero, debug mode
|
||||
if (debugflag) {
|
||||
if (debugflag || updateFlag) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -175,6 +177,13 @@ void basictests() {
|
||||
#endif
|
||||
}
|
||||
|
||||
int checkKernelVersion() {
|
||||
#ifdef VIRTUAL
|
||||
return OK;
|
||||
#endif
|
||||
return Nios_checkKernelVersion(KERNEL_DATE_VRSN);
|
||||
}
|
||||
|
||||
int checkType() {
|
||||
#ifdef VIRTUAL
|
||||
return OK;
|
||||
@ -326,7 +335,7 @@ u_int32_t getDetectorIP() {
|
||||
/* initialization */
|
||||
|
||||
void initControlServer() {
|
||||
if (initError == OK) {
|
||||
if (!updateFlag && initError == OK) {
|
||||
setupDetector();
|
||||
}
|
||||
initCheckDone = 1;
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#define REQRD_FRMWRE_VRSN (0x200707)
|
||||
#define KERNEL_DATE_VRSN "Wed May 20 13:58:38 CEST 2020"
|
||||
|
||||
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
||||
|
||||
|
Binary file not shown.
@ -18,6 +18,9 @@
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
extern int updateFlag;
|
||||
extern udpStruct udpDetails;
|
||||
extern const enum detectorType myDetectorType;
|
||||
|
||||
@ -91,7 +94,8 @@ void basictests() {
|
||||
}
|
||||
|
||||
// does check only if flag is 0 (by default), set by command line
|
||||
if (((checkType() == FAIL) || (testFpga() == FAIL) ||
|
||||
if ((!debugflag) && (!updateFlag) &&
|
||||
((checkType() == FAIL) || (testFpga() == FAIL) ||
|
||||
(testBus() == FAIL))) {
|
||||
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
|
||||
"Dangerous to continue.\n");
|
||||
@ -125,7 +129,9 @@ void basictests() {
|
||||
(long long int)fwversion, (long long int)swversion,
|
||||
(long long int)client_sw_apiversion));
|
||||
|
||||
LOG(logINFO, ("Basic Tests - success\n"));
|
||||
if (!debugflag || updateFlag) {
|
||||
LOG(logINFO, ("Basic Tests - success\n"));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -343,7 +349,7 @@ u_int32_t getBoardRevision() {
|
||||
/* initialization */
|
||||
|
||||
void initControlServer() {
|
||||
if (initError == OK) {
|
||||
if (!updateFlag && initError == OK) {
|
||||
setupDetector();
|
||||
}
|
||||
initCheckDone = 1;
|
||||
|
@ -41,7 +41,7 @@ enum CLKINDEX { ADC_CLK, NUM_CLOCKS };
|
||||
#define DYNAMIC_RANGE (16)
|
||||
#define NUM_BITS_PER_PIXEL (DYNAMIC_RANGE / 8)
|
||||
#define DATA_BYTES (NCHIP * NCHAN * NUM_BITS_PER_PIXEL)
|
||||
#define CLK_FREQ (32007729) /* Hz */
|
||||
#define CLK_FREQ (32007729) // Hz
|
||||
#define MAX_EXT_SIGNALS (1)
|
||||
|
||||
/** Firmware Definitions */
|
||||
|
Binary file not shown.
@ -22,6 +22,7 @@
|
||||
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
extern int updateFlag;
|
||||
extern udpStruct udpDetails;
|
||||
extern const enum detectorType myDetectorType;
|
||||
|
||||
@ -77,8 +78,9 @@ void basictests() {
|
||||
}
|
||||
|
||||
// does check only if flag is 0 (by default), set by command line
|
||||
if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) ||
|
||||
(testBus() == FAIL))) {
|
||||
if ((!debugflag) && (!updateFlag) &&
|
||||
((checkType() == FAIL) || (testFpga() == FAIL) ||
|
||||
(testBus() == FAIL))) {
|
||||
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
|
||||
"Dangerous to continue.\n");
|
||||
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||
@ -119,7 +121,7 @@ void basictests() {
|
||||
(long long int)client_sw_apiversion));
|
||||
|
||||
// return if flag is not zero, debug mode
|
||||
if (debugflag) {
|
||||
if (debugflag || updateFlag) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -347,7 +349,7 @@ u_int32_t getDetectorIP() {
|
||||
/* initialization */
|
||||
|
||||
void initControlServer() {
|
||||
if (initError == OK) {
|
||||
if (!updateFlag && initError == OK) {
|
||||
setupDetector();
|
||||
}
|
||||
initCheckDone = 1;
|
||||
|
@ -69,8 +69,8 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
|
||||
#define DYNAMIC_RANGE (16)
|
||||
#define NUM_BYTES_PER_PIXEL (DYNAMIC_RANGE / 8)
|
||||
#define DATA_BYTES (NCHIP * NCHAN * NUM_BYTES_PER_PIXEL)
|
||||
#define CLK_RUN (40) /* MHz */
|
||||
#define CLK_SYNC (20) /* MHz */
|
||||
#define CLK_RUN (40) // MHz
|
||||
#define CLK_SYNC (20) // MHz
|
||||
#define ADC_CLK_INDEX (1)
|
||||
#define DBIT_CLK_INDEX (0)
|
||||
|
||||
|
Binary file not shown.
@ -21,6 +21,7 @@
|
||||
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
extern int updateFlag;
|
||||
extern udpStruct udpDetails;
|
||||
extern const enum detectorType myDetectorType;
|
||||
|
||||
@ -101,8 +102,9 @@ void basictests() {
|
||||
}
|
||||
|
||||
// does check only if flag is 0 (by default), set by command line
|
||||
if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) ||
|
||||
(testBus() == FAIL))) {
|
||||
if ((!debugflag) && (!updateFlag) &&
|
||||
((checkType() == FAIL) || (testFpga() == FAIL) ||
|
||||
(testBus() == FAIL))) {
|
||||
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
|
||||
"Dangerous to continue.\n");
|
||||
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||
@ -141,7 +143,7 @@ void basictests() {
|
||||
(long long int)client_sw_apiversion));
|
||||
|
||||
// return if flag is not zero, debug mode
|
||||
if (debugflag) {
|
||||
if (debugflag || updateFlag) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -413,7 +415,7 @@ uint32_t getDetectorIP() {
|
||||
/* initialization */
|
||||
|
||||
void initControlServer() {
|
||||
if (initError == OK) {
|
||||
if (!updateFlag && initError == OK) {
|
||||
setupDetector();
|
||||
}
|
||||
initCheckDone = 1;
|
||||
|
@ -129,6 +129,10 @@
|
||||
#define CONTROL_STP_ACQSTN_MSK (0x00000001 << CONTROL_STP_ACQSTN_OFST)
|
||||
#define CONTROL_STRT_PATTERN_OFST (2)
|
||||
#define CONTROL_STRT_PATTERN_MSK (0x00000001 << CONTROL_STRT_PATTERN_OFST)
|
||||
#define CONTROL_STRT_READOUT_OFST (3) // not connected in software yet
|
||||
#define CONTROL_STRT_READOUT_MSK (0x00000001 << CONTROL_STRT_READOUT_OFST)
|
||||
#define CONTROL_STRT_SW_TRIGGER_OFST (4)
|
||||
#define CONTROL_STRT_SW_TRIGGER_MSK (0x00000001 << CONTROL_STRT_SW_TRIGGER_OFST)
|
||||
#define CONTROL_CRE_RST_OFST (10)
|
||||
#define CONTROL_CRE_RST_MSK (0x00000001 << CONTROL_CRE_RST_OFST)
|
||||
#define CONTROL_PRPHRL_RST_OFST (11) // Only GBE10?
|
||||
|
Binary file not shown.
@ -21,6 +21,7 @@
|
||||
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
extern int updateFlag;
|
||||
extern int checkModuleFlag;
|
||||
extern udpStruct udpDetails;
|
||||
extern const enum detectorType myDetectorType;
|
||||
@ -80,8 +81,9 @@ void basictests() {
|
||||
return;
|
||||
}
|
||||
// does check only if flag is 0 (by default), set by command line
|
||||
if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) ||
|
||||
(testBus() == FAIL))) {
|
||||
if ((!debugflag) && (!updateFlag) &&
|
||||
((checkKernelVersion() == FAIL) || (checkType() == FAIL) ||
|
||||
(testFpga() == FAIL) || (testBus() == FAIL))) {
|
||||
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
|
||||
"Dangerous to continue.\n");
|
||||
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||
@ -117,7 +119,7 @@ void basictests() {
|
||||
(long long int)client_sw_apiversion));
|
||||
|
||||
// return if flag is not zero, debug mode
|
||||
if (debugflag) {
|
||||
if (debugflag || updateFlag) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -161,6 +163,13 @@ void basictests() {
|
||||
#endif
|
||||
}
|
||||
|
||||
int checkKernelVersion() {
|
||||
#ifdef VIRTUAL
|
||||
return OK;
|
||||
#endif
|
||||
return Nios_checkKernelVersion(KERNEL_DATE_VRSN);
|
||||
}
|
||||
|
||||
int checkType() {
|
||||
#ifdef VIRTUAL
|
||||
return OK;
|
||||
@ -313,7 +322,7 @@ u_int32_t getDetectorIP() {
|
||||
/* initialization */
|
||||
|
||||
void initControlServer() {
|
||||
if (initError == OK) {
|
||||
if (!updateFlag && initError == OK) {
|
||||
setupDetector();
|
||||
}
|
||||
initCheckDone = 1;
|
||||
@ -2297,6 +2306,12 @@ int stopStateMachine() {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int softwareTrigger() {
|
||||
LOG(logINFO, ("Sending Software Trigger\n"));
|
||||
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STRT_SW_TRIGGER_MSK);
|
||||
return OK;
|
||||
}
|
||||
|
||||
enum runStatus getRunStatus() {
|
||||
LOG(logDEBUG1, ("Getting status\n"));
|
||||
// scan error or running
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#define REQRD_FRMWRE_VRSN 0x190000
|
||||
#define KERNEL_DATE_VRSN "Wed May 20 13:58:38 CEST 2020"
|
||||
|
||||
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
||||
|
||||
@ -24,24 +25,26 @@
|
||||
#define MAX_EXT_SIGNALS (8)
|
||||
|
||||
/** Default Parameters */
|
||||
#define DEFAULT_PATTERN_FILE ("DefaultPattern_mythen3.txt")
|
||||
#define DEFAULT_INTERNAL_GATES (1)
|
||||
#define DEFAULT_EXTERNAL_GATES (1)
|
||||
#define DEFAULT_DYNAMIC_RANGE (32)
|
||||
#define DEFAULT_NUM_FRAMES (1)
|
||||
#define DEFAULT_NUM_CYCLES (1)
|
||||
#define DEFAULT_GATE_WIDTH (100 * 1000 * 1000) // ns
|
||||
#define DEFAULT_GATE_DELAY (0)
|
||||
#define DEFAULT_PERIOD (2 * 1000 * 1000) // ns
|
||||
#define DEFAULT_DELAY_AFTER_TRIGGER (0)
|
||||
#define DEFAULT_HIGH_VOLTAGE (0)
|
||||
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
||||
#define DEFAULT_READOUT_C0 (8) //(125000000) // rdo_clk, 125 MHz
|
||||
#define DEFAULT_READOUT_C1 (8) //(125000000) // rdo_x2_clk, 125 MHz
|
||||
#define DEFAULT_SYSTEM_C0 (4) //(250000000) // run_clk, 250 MHz
|
||||
#define DEFAULT_SYSTEM_C1 (8) //(125000000) // sync_clk, 125 MHz
|
||||
#define DEFAULT_SYSTEM_C2 (8) //(125000000) // str_clk, 125 MHz
|
||||
#define DEFAULT_SYSTEM_C3 (5) //(200000000) // smp_clk, 200 MHz (only for timing receiver)
|
||||
#define DEFAULT_PATTERN_FILE ("DefaultPattern_mythen3.txt")
|
||||
#define DEFAULT_INTERNAL_GATES (1)
|
||||
#define DEFAULT_EXTERNAL_GATES (1)
|
||||
#define DEFAULT_DYNAMIC_RANGE (32)
|
||||
#define DEFAULT_NUM_FRAMES (1)
|
||||
#define DEFAULT_NUM_CYCLES (1)
|
||||
#define DEFAULT_GATE_WIDTH (100 * 1000 * 1000) // ns
|
||||
#define DEFAULT_GATE_DELAY (0)
|
||||
#define DEFAULT_PERIOD (2 * 1000 * 1000) // ns
|
||||
#define DEFAULT_DELAY_AFTER_TRIGGER (0)
|
||||
#define DEFAULT_HIGH_VOLTAGE (0)
|
||||
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
||||
#define DEFAULT_READOUT_C0 (10) //(100000000) // rdo_clk, 100 MHz
|
||||
#define DEFAULT_READOUT_C1 (10) //(100000000) // smp sample clk (x2), 100 MHz
|
||||
#define DEFAULT_SYSTEM_C0 (20) // (50000000) // run_clk, 50 MHz
|
||||
#define DEFAULT_SYSTEM_C1 (10) //(100000000) // sync_clk, 100 MHz
|
||||
#define DEFAULT_SYSTEM_C2 (10) //(100000000) // str_clk, 100 MHz
|
||||
#define DEFAULT_SYSTEM_C3 (5) //(200000000) // smp_clk, 200 MHz
|
||||
// (DEFAULT_SYSTEM_C3 only for timing receiver) should not be changed
|
||||
|
||||
#define DEFAULT_ASIC_LATCHING_NUM_PULSES (10)
|
||||
#define DEFAULT_MSTR_OTPT_P1_NUM_PULSES (20)
|
||||
|
||||
@ -110,7 +113,8 @@ enum CLKINDEX {
|
||||
NUM_CLOCKS
|
||||
};
|
||||
#define CLK_NAMES \
|
||||
"READOUT_C0", "READOUT_C1", "SYSTEM_C0", "SYSTEM_C1", "SYSTEM_C2", "SYSTEM_C3"
|
||||
"READOUT_C0", "READOUT_C1", "SYSTEM_C0", "SYSTEM_C1", "SYSTEM_C2", \
|
||||
"SYSTEM_C3"
|
||||
enum PLLINDEX { READOUT_PLL, SYSTEM_PLL };
|
||||
|
||||
/* Struct Definitions */
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
/**
|
||||
* Convert a value from a range to a different range (eg voltage to dac or vice
|
||||
@ -17,3 +18,5 @@ int ConvertToDifferentRange(int inputMin, int inputMax, int outputMin,
|
||||
int outputMax, int inputValue, int *outputValue);
|
||||
|
||||
int getAbsPath(char *buf, size_t bufSize, char *fname);
|
||||
|
||||
int GetTimeFromString(char *buf, time_t *result);
|
@ -87,3 +87,7 @@ int mapCSP0(void);
|
||||
* Get Nios base address
|
||||
*/
|
||||
u_int32_t *Nios_getBaseAddress();
|
||||
|
||||
/** check kernel version against expected version string (complain if too old)
|
||||
* @returns OK or FAIL */
|
||||
int Nios_checkKernelVersion(char *expectedVersion);
|
@ -56,6 +56,9 @@ typedef struct udpStruct_s {
|
||||
int isInitCheckDone();
|
||||
int getInitResult(char **mess);
|
||||
void basictests();
|
||||
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||
int checkKernelVersion();
|
||||
#endif
|
||||
#if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || \
|
||||
defined(MOENCHD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||
int checkType();
|
||||
@ -554,7 +557,7 @@ int startStateMachine();
|
||||
void *start_timer(void *arg);
|
||||
#endif
|
||||
int stopStateMachine();
|
||||
#ifdef EIGERD
|
||||
#if defined(EIGERD) || defined(MYTHEN3D)
|
||||
int softwareTrigger();
|
||||
#endif
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
#define _GNU_SOURCE // needed for strptime to be at the top
|
||||
#include "common.h"
|
||||
#include "clogger.h"
|
||||
#include "sls_detector_defs.h"
|
||||
@ -60,3 +61,12 @@ int getAbsPath(char *buf, size_t bufSize, char *fname) {
|
||||
LOG(logDEBUG1, ("full path for %s: %s\n", fname, buf));
|
||||
return OK;
|
||||
}
|
||||
|
||||
int GetTimeFromString(char *buf, time_t *result) {
|
||||
struct tm t;
|
||||
if (NULL == strptime(buf, "%a %b %d %H:%M:%S %Z %Y", &t)) {
|
||||
return FAIL;
|
||||
}
|
||||
*result = mktime(&t);
|
||||
return OK;
|
||||
}
|
@ -2,10 +2,13 @@
|
||||
#include "RegisterDefs.h"
|
||||
#include "ansi.h"
|
||||
#include "clogger.h"
|
||||
#include "common.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#include <fcntl.h> // open
|
||||
#include <sys/mman.h> // mmap
|
||||
#include <fcntl.h> // open
|
||||
#include <string.h>
|
||||
#include <sys/mman.h> // mmap
|
||||
#include <sys/utsname.h> // uname
|
||||
|
||||
/* global variables */
|
||||
u_int32_t *csp0base = 0;
|
||||
@ -127,3 +130,49 @@ int mapCSP0(void) {
|
||||
}
|
||||
|
||||
u_int32_t *Nios_getBaseAddress() { return csp0base; }
|
||||
|
||||
int Nios_checkKernelVersion(char *expectedVersion) {
|
||||
// extract kernel date string
|
||||
struct utsname buf;
|
||||
if (uname(&buf) == -1) {
|
||||
LOG(logERROR, ("Could not get kernel version\n"));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
// remove first word (#version number)
|
||||
const char *ptr = strchr(buf.version, ' ');
|
||||
if (ptr == NULL) {
|
||||
LOG(logERROR, ("Could not parse kernel version\n"));
|
||||
return FAIL;
|
||||
}
|
||||
char output[256];
|
||||
memset(output, 0, 256);
|
||||
strcpy(output, buf.version + (ptr - buf.version + 1));
|
||||
|
||||
// convert kernel date string into time
|
||||
time_t kernelDate;
|
||||
if (GetTimeFromString(output, &kernelDate) == FAIL) {
|
||||
LOG(logERROR, ("Could not parse retrieved kernel date, %s\n", output));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
// convert expected date into time
|
||||
time_t expDate;
|
||||
if (GetTimeFromString(expectedVersion, &expDate) == FAIL) {
|
||||
LOG(logERROR,
|
||||
("Could not parse expected kernel date, %s\n", expectedVersion));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
// compare if kernel time is older than expected time
|
||||
if (kernelDate < expDate) {
|
||||
LOG(logERROR, ("Kernel Version Incompatible (too old)! Expected: [%s], "
|
||||
"Got [%s]\n",
|
||||
expectedVersion, output));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
LOG(logINFOBLUE, ("Kernel Version Compatible: %s [min.: %s]\n", output,
|
||||
expectedVersion));
|
||||
return OK;
|
||||
}
|
@ -21,6 +21,7 @@ extern int ret;
|
||||
// Global variables from slsDetectorServer_funcs
|
||||
extern int sockfd;
|
||||
extern int debugflag;
|
||||
extern int updateFlag;
|
||||
extern int checkModuleFlag;
|
||||
|
||||
// Global variables from slsDetectorFunctionList
|
||||
@ -41,6 +42,7 @@ int main(int argc, char *argv[]) {
|
||||
int portno = DEFAULT_PORTNO;
|
||||
isControlServer = 1;
|
||||
debugflag = 0;
|
||||
updateFlag = 0;
|
||||
checkModuleFlag = 1;
|
||||
int version = 0;
|
||||
|
||||
@ -53,10 +55,12 @@ int main(int argc, char *argv[]) {
|
||||
"Possible arguments are:\n"
|
||||
"\t-v, --version : Software version\n"
|
||||
"\t-p, --port <port> : TCP communication port with client. \n"
|
||||
"\t-d, --devel : Developer mode. Skips firmware checks. \n"
|
||||
"\t-g, --nomodule : [Mythen3][Gotthard2] Generic or No "
|
||||
"Module mode. Skips detector type checks. \n"
|
||||
"\t-f, --phaseshift <value> : [Gotthard] only. Sets phase shift. \n"
|
||||
"\t-d, --devel : Developer mode. Skips firmware checks. \n"
|
||||
"\t-u, --update : Update mode. Skips firmware checks and "
|
||||
"initial detector setup. \n"
|
||||
"\t-s, --stopserver : Stop server. Do not use as created by "
|
||||
"control server \n\n",
|
||||
argv[0]);
|
||||
@ -68,9 +72,10 @@ int main(int argc, char *argv[]) {
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{"version", no_argument, NULL, 'v'},
|
||||
{"port", required_argument, NULL, 'p'},
|
||||
{"devel", no_argument, NULL, 'd'},
|
||||
{"phaseshift", required_argument, NULL, 'f'},
|
||||
{"nomodule", no_argument, NULL, 'g'}, // generic
|
||||
{"devel", no_argument, NULL, 'd'},
|
||||
{"update", no_argument, NULL, 'u'},
|
||||
{"stopserver", no_argument, NULL, 's'},
|
||||
{NULL, 0, NULL, 0}};
|
||||
|
||||
@ -80,7 +85,7 @@ int main(int argc, char *argv[]) {
|
||||
int c = 0;
|
||||
|
||||
while (c != -1) {
|
||||
c = getopt_long(argc, argv, "hvp:df:gs", long_options, &option_index);
|
||||
c = getopt_long(argc, argv, "hvp:f:gdus", long_options, &option_index);
|
||||
|
||||
// Detect the end of the options
|
||||
if (c == -1)
|
||||
@ -116,11 +121,6 @@ int main(int argc, char *argv[]) {
|
||||
LOG(logINFO, ("Detected port: %d\n", portno));
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
LOG(logINFO, ("Detected developer mode\n"));
|
||||
debugflag = 1;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
#ifndef GOTTHARDD
|
||||
LOG(logERROR,
|
||||
@ -141,6 +141,16 @@ int main(int argc, char *argv[]) {
|
||||
checkModuleFlag = 0;
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
LOG(logINFO, ("Detected developer mode\n"));
|
||||
debugflag = 1;
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
LOG(logINFO, ("Detected update mode\n"));
|
||||
updateFlag = 1;
|
||||
break;
|
||||
|
||||
case 's':
|
||||
LOG(logINFO, ("Detected stop server\n"));
|
||||
isControlServer = 0;
|
||||
|
@ -42,6 +42,7 @@ extern char mess[MAX_STR_LENGTH];
|
||||
// Variables that will be exported
|
||||
int sockfd = 0;
|
||||
int debugflag = 0;
|
||||
int updateFlag = 0;
|
||||
int checkModuleFlag = 1;
|
||||
udpStruct udpDetails = {32410, 32411, 50001, 50002, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
int configured = FAIL;
|
||||
@ -4106,7 +4107,7 @@ int software_trigger(int file_des) {
|
||||
memset(mess, 0, sizeof(mess));
|
||||
|
||||
LOG(logDEBUG1, ("Software Trigger\n"));
|
||||
#ifndef EIGERD
|
||||
#if !defined(EIGERD) && !defined(MYTHEN3D)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
|
@ -35,19 +35,20 @@ class Detector {
|
||||
*/
|
||||
Detector(int shm_id = 0);
|
||||
~Detector();
|
||||
|
||||
/** @name Configuration */
|
||||
///@{
|
||||
/**************************************************
|
||||
* *
|
||||
* Configuration *
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
/* Free the shared memory of this detector and all modules
|
||||
* belonging to it */
|
||||
/** Free the shared memory of this detector and all modules
|
||||
belonging to it */
|
||||
void freeSharedMemory();
|
||||
|
||||
/** Frees shared memory before loading configuration file. Set up once
|
||||
* normally */
|
||||
normally */
|
||||
void loadConfig(const std::string &fname);
|
||||
|
||||
/** Shared memory not freed prior. Set up per measurement. */
|
||||
@ -57,7 +58,7 @@ class Detector {
|
||||
|
||||
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);
|
||||
|
||||
/** 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;
|
||||
|
||||
/** Options: EIGER, JUNGFRAU, GOTTHARD, MOENCH, MYTHEN3, GOTTHARD2,
|
||||
* CHIPTESTBOARD */
|
||||
Result<defs::detectorType> getDetectorType(Positions pos = {}) const;
|
||||
|
||||
/** Gets the total number of detectors */
|
||||
@ -95,7 +98,7 @@ class Detector {
|
||||
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.
|
||||
*/
|
||||
void setDetectorSize(const defs::xy value);
|
||||
@ -107,17 +110,18 @@ class Detector {
|
||||
Result<defs::detectorSettings> getSettings(Positions pos = {}) const;
|
||||
|
||||
/** [Jungfrau] DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2,
|
||||
* FORCESWITCHG1, FORCESWITCHG2 [Gotthard] \n DYNAMICGAIN, HIGHGAIN,
|
||||
* LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN [Gotthard2] \n DYNAMICGAIN,
|
||||
* FIXGAIN1, FIXGAIN2 [Moench] \n G1_HIGHGAIN, G1_LOWGAIN,
|
||||
* FORCESWITCHG1, FORCESWITCHG2 \n [Gotthard] DYNAMICGAIN, HIGHGAIN,
|
||||
* LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN \n [Gotthard2] DYNAMICGAIN,
|
||||
* FIXGAIN1, FIXGAIN2 \n [Moench] G1_HIGHGAIN, G1_LOWGAIN,
|
||||
* G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN, G2_LOWCAP_HIGHGAIN,
|
||||
* 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
|
||||
*/
|
||||
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 = {});
|
||||
|
||||
/** [Eiger][Mythen3] -1 if they are all different */
|
||||
@ -135,15 +139,17 @@ class Detector {
|
||||
* streaming, receiver file or streaming. Default is disabled.
|
||||
*/
|
||||
void setGapPixelsinCallback(const bool enable);
|
||||
///@{
|
||||
|
||||
/** @name Callbacks */
|
||||
///@{
|
||||
/**************************************************
|
||||
* *
|
||||
* Callbacks *
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
/**
|
||||
* register callback for end of acquisition
|
||||
/** register callback for end of acquisition
|
||||
* @param func function to be called with parameters:
|
||||
* current progress in percentage, detector status, pArg pointer
|
||||
* @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 *),
|
||||
void *pArg);
|
||||
///@{
|
||||
|
||||
/** @name Acquisition Parameters */
|
||||
///@{
|
||||
/**************************************************
|
||||
* *
|
||||
* Acquisition Parameters *
|
||||
@ -231,9 +240,9 @@ class Detector {
|
||||
Result<defs::timingMode> getTimingMode(Positions pos = {}) const;
|
||||
|
||||
/**
|
||||
* [Gotthard][Jungfrau][CTB][Moench][Mythen3] Options:
|
||||
* AUTO_TIMING, TRIGGER_EXPOSURE
|
||||
* [Gotthard2] Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, TRIGGER_GATED
|
||||
* [Gotthard][Jungfrau][Gotthard][CTB][Moench][Gotthard2] Options:
|
||||
* AUTO_TIMING, TRIGGER_EXPOSURE \n
|
||||
* [Mythen3] Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, TRIGGER_GATED \n
|
||||
* [Eiger] Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER
|
||||
*/
|
||||
void setTimingMode(defs::timingMode value, Positions pos = {});
|
||||
@ -354,27 +363,30 @@ class Detector {
|
||||
|
||||
/**
|
||||
* (Degrees)
|
||||
* [Gotthard] Options: TEMPERATURE_ADC, TEMPERATURE_FPGA
|
||||
* [Jungfrau] Options: TEMPERATURE_ADC, TEMPERATURE_FPGA
|
||||
* [Gotthard] Options: TEMPERATURE_ADC, TEMPERATURE_FPGA \n
|
||||
* [Jungfrau] Options: TEMPERATURE_ADC, TEMPERATURE_FPGA \n
|
||||
* [Eiger] Options: TEMPERATURE_FPGA, TEMPERATURE_FPGAEXT, TEMPERATURE_10GE,
|
||||
* TEMPERATURE_DCDC, TEMPERATURE_SODL, TEMPERATURE_SODR, TEMPERATURE_FPGA2,
|
||||
* TEMPERATURE_FPGA3
|
||||
* [CTB] Options: SLOW_ADC_TEMP
|
||||
* TEMPERATURE_FPGA3 \n
|
||||
* Cannot call TEMPERATURE_FPGA2 and TEMPERATURE_FPGA3 when blocking acquire
|
||||
* in progress \n [CTB] Options: SLOW_ADC_TEMP
|
||||
*/
|
||||
Result<int> getTemperature(defs::dacIndex index, Positions pos = {}) const;
|
||||
|
||||
/** gets list of dac enums for this detector */
|
||||
std::vector<defs::dacIndex> getDacList() const;
|
||||
|
||||
Result<int> getDAC(defs::dacIndex index, bool mV, Positions pos = {}) const;
|
||||
Result<int> getDAC(defs::dacIndex index, bool mV = false,
|
||||
Positions pos = {}) const;
|
||||
|
||||
void setDAC(defs::dacIndex index, int value, bool mV, Positions pos = {});
|
||||
void setDAC(defs::dacIndex index, int value, bool mV = false,
|
||||
Positions pos = {});
|
||||
|
||||
/* [Gotthard2] */
|
||||
/**[Gotthard2] */
|
||||
Result<int> getOnChipDAC(defs::dacIndex index, int chipIndex,
|
||||
Positions pos = {}) const;
|
||||
|
||||
/* [Gotthard2] */
|
||||
/**[Gotthard2] */
|
||||
void setOnChipDAC(defs::dacIndex index, int chipIndex, int value,
|
||||
Positions pos = {});
|
||||
|
||||
@ -400,7 +412,10 @@ class Detector {
|
||||
* [Mythen3] If exposure time is too short, acquisition will return with an
|
||||
* ERROR and take fewer frames than expected */
|
||||
void setParallelMode(bool value, Positions pos = {});
|
||||
///@{
|
||||
|
||||
/** @name Acquisition */
|
||||
///@{
|
||||
/**************************************************
|
||||
* *
|
||||
* Acquisition *
|
||||
@ -409,12 +424,14 @@ class Detector {
|
||||
/**
|
||||
* Blocking call: Acquire the number of frames set
|
||||
* - sets acquiring flag
|
||||
* - starts the receiver listener
|
||||
* - 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
|
||||
* - stops the receiver listener (if enabled)
|
||||
* - increments file index if file write enabled
|
||||
* - resets acquiring flag
|
||||
* Control server is blocked and cannot accept other commands until
|
||||
* acquisition is done.
|
||||
*/
|
||||
void acquire();
|
||||
|
||||
@ -457,7 +474,7 @@ class Detector {
|
||||
* numbers for different modules.*/
|
||||
void setStartingFrameNumber(uint64_t value, Positions pos = {});
|
||||
|
||||
/** [Eiger] Sends an internal software trigger to the detector */
|
||||
/** [Eiger][Mythen3] Sends an internal software trigger to the detector */
|
||||
void sendSoftwareTrigger(Positions pos = {});
|
||||
|
||||
Result<defs::scanParameters> getScan(Positions pos = {}) const;
|
||||
@ -470,7 +487,10 @@ class Detector {
|
||||
/** gets scan error message in case of error during scan in case of non
|
||||
* blocking acquisition (startDetector, not acquire) */
|
||||
Result<std::string> getScanErrorMessage(Positions pos = {}) const;
|
||||
///@{
|
||||
|
||||
/** @name Network Configuration (Detector<->Receiver) */
|
||||
///@{
|
||||
/**************************************************
|
||||
* *
|
||||
* Network Configuration (Detector<->Receiver) *
|
||||
@ -501,31 +521,31 @@ class Detector {
|
||||
|
||||
Result<IpAddr> getSourceUDPIP(Positions pos = {}) const;
|
||||
|
||||
/* 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
|
||||
/**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
|
||||
* same subnet of the destination UDP IP
|
||||
*/
|
||||
void setSourceUDPIP(const IpAddr ip, Positions pos = {});
|
||||
|
||||
/** [Jungfrau] bottom half */
|
||||
/** [Jungfrau] bottom half [Gotthard2] veto debugging */
|
||||
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 = {});
|
||||
|
||||
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
|
||||
* Others can be anything (beware of certain bits)
|
||||
*/
|
||||
|
||||
void setSourceUDPMAC(const MacAddr mac, Positions pos = {});
|
||||
|
||||
/** [Jungfrau] bottom half */
|
||||
/** [Jungfrau] bottom half [Gotthard2] veto debugging */
|
||||
Result<MacAddr> getSourceUDPMAC2(Positions pos = {}) const;
|
||||
|
||||
/** [Jungfrau] bottom half */
|
||||
/** [Jungfrau] bottom half [Gotthard2] veto debugging */
|
||||
void setSourceUDPMAC2(const MacAddr mac, Positions pos = {});
|
||||
|
||||
Result<IpAddr> getDestinationUDPIP(Positions pos = {}) const;
|
||||
@ -533,39 +553,42 @@ class Detector {
|
||||
/** IP of the interface in receiver that the detector sends data to */
|
||||
void setDestinationUDPIP(const IpAddr ip, Positions pos = {});
|
||||
|
||||
/** [Jungfrau bottom half] */
|
||||
/** [Jungfrau] bottom half \n [Gotthard2] veto debugging */
|
||||
Result<IpAddr> getDestinationUDPIP2(Positions pos = {}) const;
|
||||
|
||||
/** [Jungfrau bottom half] */
|
||||
/** [Jungfrau] bottom half \n [Gotthard2] veto debugging */
|
||||
void setDestinationUDPIP2(const IpAddr ip, Positions pos = {});
|
||||
|
||||
Result<MacAddr> getDestinationUDPMAC(Positions pos = {}) const;
|
||||
|
||||
/** MAC of the interface in receiver that the detector sends data to
|
||||
* Only needed if you use a custom receiver (not slsReceiver)
|
||||
* Must be followed by configuremac.
|
||||
/** Mac address of the receiver (destination) udp interface. Not mandatory
|
||||
* to set as setDestinationUDPIP (udp_dstip) retrieves it from slsReceiver
|
||||
* process but must be set if you use a custom receiver (not slsReceiver).
|
||||
*/
|
||||
void setDestinationUDPMAC(const MacAddr mac, Positions pos = {});
|
||||
|
||||
/** [Jungfrau bottom half] */
|
||||
/** [Jungfrau] bottom half \n [Gotthard2] veto debugging */
|
||||
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 = {});
|
||||
|
||||
Result<int> getDestinationUDPPort(Positions pos = {}) const;
|
||||
|
||||
/** module_id is -1 for all detectors, ports for each module is calculated
|
||||
* (increments) */
|
||||
/** Default is 50001. \n If module_id is -1, ports for each module is
|
||||
* calculated (incremented by 1 if no 2nd interface) */
|
||||
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;
|
||||
|
||||
/** [Eiger right port][Jungfrau bottom half]
|
||||
* module_id is -1 for all detectors, ports for each module is calculated
|
||||
* (increments)
|
||||
*/
|
||||
/** [Eiger] right port[Jungfrau] bottom half [Gotthard2] veto debugging \n
|
||||
* Default is 50002. \n If module_id is -1, ports for each module is
|
||||
* calculated (incremented by 1 if no 2nd interface)*/
|
||||
void setDestinationUDPPort2(int port, int module_id = -1);
|
||||
|
||||
void reconfigureUDPDestination(Positions pos = {});
|
||||
@ -618,10 +641,13 @@ class Detector {
|
||||
* port
|
||||
*/
|
||||
void setTransmissionDelayRight(int value, Positions pos = {});
|
||||
///@{
|
||||
|
||||
/** @name Receiver Configuration */
|
||||
///@{
|
||||
/**************************************************
|
||||
* *
|
||||
* Receiver Config *
|
||||
* Receiver Configuration *
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
@ -700,7 +726,10 @@ class Detector {
|
||||
|
||||
Result<std::array<pid_t, NUM_RX_THREAD_IDS>>
|
||||
getRxThreadIds(Positions pos = {}) const;
|
||||
///@{
|
||||
|
||||
/** @name File */
|
||||
///@{
|
||||
/**************************************************
|
||||
* *
|
||||
* File *
|
||||
@ -737,7 +766,7 @@ class Detector {
|
||||
|
||||
Result<bool> getMasterFileWrite(Positions pos = {}) const;
|
||||
|
||||
/* default enabled */
|
||||
/**default enabled */
|
||||
void setMasterFileWrite(bool value, Positions pos = {});
|
||||
|
||||
Result<bool> getFileOverWrite(Positions pos = {}) const;
|
||||
@ -750,7 +779,10 @@ class Detector {
|
||||
/** Default depends on detector type. \n 0 will set frames per file to
|
||||
* unlimited */
|
||||
void setFramesPerFile(int n, Positions pos = {});
|
||||
///@{
|
||||
|
||||
/** @name ZMQ Streaming Parameters (Receiver<->Client) */
|
||||
///@{
|
||||
/**************************************************
|
||||
* *
|
||||
* ZMQ Streaming Parameters (Receiver<->Client)*
|
||||
@ -800,10 +832,10 @@ class Detector {
|
||||
|
||||
/** Zmq port for data to be streamed out of the receiver. \n
|
||||
* Also restarts receiver zmq streaming if enabled. \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 module_id is -1 for
|
||||
* all detectors, ports for each module is calculated (increments) Restarts
|
||||
* receiver zmq sockets only if it was already enabled
|
||||
* Must be different for every detector (and udp port). \n module_id is -1
|
||||
* for all detectors, ports for each module is calculated (increment by 1 if
|
||||
* no 2nd interface). \n Restarts receiver zmq sockets only if it was
|
||||
* already enabled
|
||||
*/
|
||||
void setRxZmqPort(int port, int module_id = -1);
|
||||
|
||||
@ -817,18 +849,27 @@ class Detector {
|
||||
|
||||
Result<int> getClientZmqPort(Positions pos = {}) const;
|
||||
|
||||
/**
|
||||
* Modified only when using an intermediate process between receiver and
|
||||
* gui/client. Module_id is -1 for all detectors, ports for each module is
|
||||
* calculated (increments) Restarts client zmq sockets only if it was
|
||||
* already enabled
|
||||
/** Port number to listen to zmq data streamed out from receiver or
|
||||
* intermediate process. \n Must be different for every detector (and udp
|
||||
* port). \n Module_id is -1 for all detectors, ports for each module is
|
||||
* calculated (increment by 1 if no 2nd interface). \n Restarts client zmq
|
||||
* 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);
|
||||
|
||||
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 = {});
|
||||
///@{
|
||||
|
||||
/** @name Eiger Specific */
|
||||
///@{
|
||||
/**************************************************
|
||||
* *
|
||||
* Eiger Specific *
|
||||
@ -850,7 +891,7 @@ class Detector {
|
||||
/** [Eiger] */
|
||||
Result<int> getThresholdEnergy(Positions pos = {}) const;
|
||||
|
||||
/** [Eiger] */
|
||||
/** [Eiger] It loads trim files from settingspath */
|
||||
void setThresholdEnergy(int threshold_ev,
|
||||
defs::detectorSettings settings = defs::STANDARD,
|
||||
bool trimbits = true, Positions pos = {});
|
||||
@ -876,7 +917,8 @@ class Detector {
|
||||
/**[Eiger] Returns energies in eV where the module is trimmed */
|
||||
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 = {});
|
||||
|
||||
/** [Eiger] deadtime in ns, 0 = disabled */
|
||||
@ -950,7 +992,10 @@ class Detector {
|
||||
|
||||
/** [Eiger] with specific quad hardware */
|
||||
void setQuad(const bool enable);
|
||||
///@{
|
||||
|
||||
/** @name Jungfrau Specific */
|
||||
///@{
|
||||
/**************************************************
|
||||
* *
|
||||
* Jungfrau Specific *
|
||||
@ -963,23 +1008,24 @@ class Detector {
|
||||
/**
|
||||
* [Jungfrau]Set threshold temperature
|
||||
* If temperature crosses threshold temperature
|
||||
* and temperature control is enabled,
|
||||
* power to chip will be switched off and
|
||||
* temperature event will be set
|
||||
* val is value in degrees
|
||||
* and temperature control is enabled (default is disabled), power to chip
|
||||
* will be switched off and temperature event will be set. \n To power on
|
||||
* chip again, temperature has to be less than threshold temperature and
|
||||
* temperature event has to be cleared. val is value in degrees
|
||||
*/
|
||||
void setThresholdTemperature(int temp, Positions pos = {});
|
||||
|
||||
/** [Jungfrau] */
|
||||
Result<bool> getTemperatureControl(Positions pos = {}) const;
|
||||
|
||||
/** [Jungfrau] */
|
||||
/** [Jungfrau] refer to setThresholdTemperature
|
||||
* Default is disabled */
|
||||
void setTemperatureControl(bool enable, Positions pos = {});
|
||||
|
||||
/** [Jungfrau] */
|
||||
/** [Jungfrau] refer to setThresdholdTemperature */
|
||||
Result<int> getTemperatureEvent(Positions pos = {}) const;
|
||||
|
||||
/** [Jungfrau] */
|
||||
/** [Jungfrau] refer to setThresdholdTemperature */
|
||||
void resetTemperatureEvent(Positions pos = {});
|
||||
|
||||
/** [Jungfrau] */
|
||||
@ -1018,7 +1064,10 @@ class Detector {
|
||||
/** [Jungfrau] Advanced \n
|
||||
* Options: (0-1638375 ns (resolution of 25ns) */
|
||||
void setStorageCellDelay(ns value, Positions pos = {});
|
||||
///@{
|
||||
|
||||
/** @name Gotthard Specific */
|
||||
///@{
|
||||
/**************************************************
|
||||
* *
|
||||
* Gotthard Specific *
|
||||
@ -1041,7 +1090,10 @@ class Detector {
|
||||
|
||||
/** [Gotthard] */
|
||||
Result<ns> getExptimeLeft(Positions pos = {}) const;
|
||||
///@{
|
||||
|
||||
/** @name Gotthard2 Specific */
|
||||
///@{
|
||||
/**************************************************
|
||||
* *
|
||||
* Gotthard2 Specific *
|
||||
@ -1120,7 +1172,7 @@ class Detector {
|
||||
/** [Gotthard2] */
|
||||
Result<bool> getVeto(Positions pos = {}) const;
|
||||
|
||||
/** [Gotthard2] */
|
||||
/** [Gotthard2] Default disabled */
|
||||
void setVeto(const bool enable, Positions pos = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
@ -1136,7 +1188,10 @@ class Detector {
|
||||
|
||||
/** [Gotthard2] */
|
||||
void setBadChannels(const std::string &fname, Positions pos = {});
|
||||
///@{
|
||||
|
||||
/** @name Mythen3 Specific */
|
||||
///@{
|
||||
/**************************************************
|
||||
* *
|
||||
* Mythen3 Specific *
|
||||
@ -1177,7 +1232,10 @@ class Detector {
|
||||
/** [Mythen3] gate delay for all gates in auto or trigger timing mode
|
||||
* (internal gating). Gate index: 0-2, -1 for all */
|
||||
Result<std::array<ns, 3>> getGateDelayForAllGates(Positions pos = {}) const;
|
||||
///@{
|
||||
|
||||
/** @name CTB / Moench Specific */
|
||||
///@{
|
||||
/**************************************************
|
||||
* *
|
||||
* CTB / Moench Specific *
|
||||
@ -1201,7 +1259,7 @@ class Detector {
|
||||
/** [CTB][Moench] */
|
||||
void setRUNClock(int value_in_MHz, Positions pos = {});
|
||||
|
||||
/** [CTB][Moench] */
|
||||
/** [CTB][Moench] in MHZ */
|
||||
Result<int> getSYNCClock(Positions pos = {}) const;
|
||||
|
||||
/** [CTB][Moench] */
|
||||
@ -1232,7 +1290,10 @@ class Detector {
|
||||
|
||||
/** [CTB][Moench] */
|
||||
void setTenGigaADCEnableMask(uint32_t mask, Positions pos = {});
|
||||
///@{
|
||||
|
||||
/** @name CTB Specific */
|
||||
///@{
|
||||
/**************************************************
|
||||
* *
|
||||
* CTB Specific *
|
||||
@ -1316,7 +1377,10 @@ class Detector {
|
||||
|
||||
/** [CTB] Default is enabled. */
|
||||
void setLEDEnable(bool enable, Positions pos = {});
|
||||
///@{
|
||||
|
||||
/** @name Pattern */
|
||||
///@{
|
||||
/**************************************************
|
||||
* *
|
||||
* Pattern *
|
||||
@ -1365,7 +1429,7 @@ class Detector {
|
||||
* levels */
|
||||
void setPatternLoopCycles(int level, int n, Positions pos = {});
|
||||
|
||||
/* [CTB][Moench][Mythen3] */
|
||||
/**[CTB][Moench][Mythen3] */
|
||||
Result<int> getPatternWaitAddr(int level, Positions pos = {}) const;
|
||||
|
||||
/** [CTB][Moench][Mythen3] Options: level 0-2 */
|
||||
@ -1393,10 +1457,13 @@ class Detector {
|
||||
|
||||
/** [Mythen3] */
|
||||
void startPattern(Positions pos = {});
|
||||
///@{
|
||||
|
||||
/** @name Moench specific */
|
||||
///@{
|
||||
/**************************************************
|
||||
* *
|
||||
* Moench *
|
||||
* Moench specific *
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
@ -1422,30 +1489,10 @@ class Detector {
|
||||
void setAdditionalJsonParameter(const std::string &key,
|
||||
const std::string &value,
|
||||
Positions pos = {});
|
||||
///@{
|
||||
|
||||
/** [Moench] TODO! How do we do this best??? Can be refactored to something
|
||||
* else? Use a generic zmq message passing system...
|
||||
* For now limiting to all detectors working the same*/
|
||||
/** [Moench: -1 if not found or cannot convert to int] */
|
||||
Result<int> getDetectorMinMaxEnergyThreshold(const bool isEmax,
|
||||
Positions pos = {}) const;
|
||||
|
||||
/** [Moench] */
|
||||
void setDetectorMinMaxEnergyThreshold(const bool isEmax, const int value,
|
||||
Positions pos = {});
|
||||
|
||||
/** [Moench: -1 if unknown mode] */
|
||||
Result<defs::frameModeType> getFrameMode(Positions pos = {}) const;
|
||||
|
||||
/** [Moench] */
|
||||
void setFrameMode(defs::frameModeType value, Positions pos = {});
|
||||
|
||||
/** [Moench: -1 if unknown mode] */
|
||||
Result<defs::detectorModeType> getDetectorMode(Positions pos = {}) const;
|
||||
|
||||
/** [Moench] */
|
||||
void setDetectorMode(defs::detectorModeType value, Positions pos = {});
|
||||
|
||||
/** @name Advanced */
|
||||
///@{
|
||||
/**************************************************
|
||||
* *
|
||||
* Advanced *
|
||||
@ -1525,7 +1572,10 @@ class Detector {
|
||||
|
||||
/** [CTB][Moench][Jungfrau] Advanced user Function! */
|
||||
void setADCInvert(uint32_t value, Positions pos = {});
|
||||
///@{
|
||||
|
||||
/** @name Insignificant */
|
||||
///@{
|
||||
/**************************************************
|
||||
* *
|
||||
* Insignificant *
|
||||
@ -1568,9 +1618,12 @@ class Detector {
|
||||
* [Gotthard2] only in continuous mode */
|
||||
Result<ns> getMeasurementTime(Positions pos = {}) const;
|
||||
|
||||
/** get user details from shared memory (hostname, type, PID, User, Date)
|
||||
*/
|
||||
std::string getUserDetails() const;
|
||||
|
||||
Result<uint64_t> getRxCurrentFrameIndex(Positions pos = {}) const;
|
||||
///@{
|
||||
|
||||
private:
|
||||
std::vector<int> getPortNumbers(int start_port);
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1840,71 +1840,6 @@ void Detector::setAdditionalJsonParameter(const std::string &key,
|
||||
pimpl->Parallel(&Module::setAdditionalJsonParameter, pos, key, value);
|
||||
}
|
||||
|
||||
Result<int> Detector::getDetectorMinMaxEnergyThreshold(const bool isEmax,
|
||||
Positions pos) const {
|
||||
auto res = pimpl->Parallel(&Module::getAdditionalJsonParameter, pos,
|
||||
isEmax ? "emax" : "emin");
|
||||
Result<int> intResult(res.size());
|
||||
try {
|
||||
for (unsigned int i = 0; i < res.size(); ++i) {
|
||||
intResult[i] = stoi(res[i]);
|
||||
}
|
||||
} catch (...) {
|
||||
throw RuntimeError(
|
||||
"Cannot find or convert emin/emax string to integer");
|
||||
}
|
||||
return intResult;
|
||||
}
|
||||
|
||||
void Detector::setDetectorMinMaxEnergyThreshold(const bool isEmax,
|
||||
const int value,
|
||||
Positions pos) {
|
||||
pimpl->Parallel(&Module::setAdditionalJsonParameter, pos,
|
||||
isEmax ? "emax" : "emin", std::to_string(value));
|
||||
}
|
||||
|
||||
Result<defs::frameModeType> Detector::getFrameMode(Positions pos) const {
|
||||
auto res =
|
||||
pimpl->Parallel(&Module::getAdditionalJsonParameter, pos, "frameMode");
|
||||
Result<defs::frameModeType> intResult(res.size());
|
||||
try {
|
||||
for (unsigned int i = 0; i < res.size(); ++i) {
|
||||
intResult[i] =
|
||||
sls::StringTo<slsDetectorDefs::frameModeType>(res[i]);
|
||||
}
|
||||
} catch (...) {
|
||||
throw RuntimeError(
|
||||
"Cannot find or convert frameMode string to integer");
|
||||
}
|
||||
return intResult;
|
||||
}
|
||||
|
||||
void Detector::setFrameMode(defs::frameModeType value, Positions pos) {
|
||||
pimpl->Parallel(&Module::setAdditionalJsonParameter, pos, "frameMode",
|
||||
sls::ToString(value));
|
||||
}
|
||||
|
||||
Result<defs::detectorModeType> Detector::getDetectorMode(Positions pos) const {
|
||||
auto res = pimpl->Parallel(&Module::getAdditionalJsonParameter, pos,
|
||||
"detectorMode");
|
||||
Result<defs::detectorModeType> intResult(res.size());
|
||||
try {
|
||||
for (unsigned int i = 0; i < res.size(); ++i) {
|
||||
intResult[i] =
|
||||
sls::StringTo<slsDetectorDefs::detectorModeType>(res[i]);
|
||||
}
|
||||
} catch (...) {
|
||||
throw RuntimeError(
|
||||
"Cannot find or convert detectorMode string to integer");
|
||||
}
|
||||
return intResult;
|
||||
}
|
||||
|
||||
void Detector::setDetectorMode(defs::detectorModeType value, Positions pos) {
|
||||
pimpl->Parallel(&Module::setAdditionalJsonParameter, pos, "detectorMode",
|
||||
sls::ToString(value));
|
||||
}
|
||||
|
||||
// Advanced
|
||||
|
||||
void Detector::programFPGA(const std::string &fname, Positions pos) {
|
||||
|
@ -435,7 +435,6 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
|
||||
bool gapPixels = multi_shm()->gapPixels;
|
||||
LOG(logDEBUG) << "Gap pixels: " << gapPixels;
|
||||
|
||||
int nX = 0;
|
||||
int nY = 0;
|
||||
int nDetPixelsX = 0;
|
||||
@ -464,7 +463,6 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
runningList[i] = false;
|
||||
}
|
||||
}
|
||||
int numConnected = numRunning;
|
||||
bool data = false;
|
||||
bool completeImage = false;
|
||||
char *image = nullptr;
|
||||
@ -482,14 +480,7 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
uint32_t currentSubFrameIndex = -1, coordX = -1, coordY = -1,
|
||||
flippedDataX = -1;
|
||||
|
||||
// wait for real time acquisition to start
|
||||
bool running = true;
|
||||
sem_wait(&sem_newRTAcquisition);
|
||||
if (getJoinThreadFlag()) {
|
||||
running = false;
|
||||
}
|
||||
|
||||
while (running) {
|
||||
while (numRunning != 0) {
|
||||
// reset data
|
||||
data = false;
|
||||
if (multiframe != nullptr) {
|
||||
@ -658,26 +649,6 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
pCallbackArg);
|
||||
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
|
||||
@ -1030,17 +1001,11 @@ int DetectorImpl::acquire() {
|
||||
struct timespec begin, end;
|
||||
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);
|
||||
|
||||
setJoinThreadFlag(false);
|
||||
if (dataReady == nullptr) {
|
||||
setJoinThreadFlag(false);
|
||||
}
|
||||
|
||||
// verify receiver is idle
|
||||
if (receiver) {
|
||||
@ -1050,13 +1015,11 @@ int DetectorImpl::acquire() {
|
||||
}
|
||||
}
|
||||
|
||||
startProcessingThread();
|
||||
startProcessingThread(receiver);
|
||||
|
||||
// start receiver
|
||||
if (receiver) {
|
||||
Parallel(&Module::startReceiver, {});
|
||||
// let processing thread listen to these packets
|
||||
sem_post(&sem_newRTAcquisition);
|
||||
}
|
||||
|
||||
// start and read all
|
||||
@ -1071,18 +1034,13 @@ int DetectorImpl::acquire() {
|
||||
// stop receiver
|
||||
if (receiver) {
|
||||
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, {});
|
||||
}
|
||||
|
||||
// waiting for the data processing thread to finish!
|
||||
setJoinThreadFlag(true);
|
||||
sem_post(&sem_newRTAcquisition);
|
||||
// let the progress thread (no callback) know acquisition is done
|
||||
if (dataReady == nullptr) {
|
||||
setJoinThreadFlag(true);
|
||||
}
|
||||
dataProcessingThread.join();
|
||||
|
||||
if (acquisition_finished != nullptr) {
|
||||
@ -1092,9 +1050,6 @@ int DetectorImpl::acquire() {
|
||||
acquisition_finished(progress, status, acqFinished_p);
|
||||
}
|
||||
|
||||
sem_destroy(&sem_newRTAcquisition);
|
||||
sem_destroy(&sem_endRTAcquisition);
|
||||
|
||||
clock_gettime(CLOCK_REALTIME, &end);
|
||||
LOG(logDEBUG1) << "Elapsed time for acquisition:"
|
||||
<< ((end.tv_sec - begin.tv_sec) +
|
||||
@ -1115,12 +1070,13 @@ void DetectorImpl::printProgress(double progress) {
|
||||
std::cout << '\r' << std::flush;
|
||||
}
|
||||
|
||||
void DetectorImpl::startProcessingThread() {
|
||||
dataProcessingThread = std::thread(&DetectorImpl::processData, this);
|
||||
void DetectorImpl::startProcessingThread(bool receiver) {
|
||||
dataProcessingThread =
|
||||
std::thread(&DetectorImpl::processData, this, receiver);
|
||||
}
|
||||
|
||||
void DetectorImpl::processData() {
|
||||
if (Parallel(&Module::getUseReceiverFlag, {}).squash(false)) {
|
||||
void DetectorImpl::processData(bool receiver) {
|
||||
if (receiver) {
|
||||
if (dataReady != nullptr) {
|
||||
readFrameFromReceiver();
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ class DetectorImpl : public virtual slsDetectorDefs {
|
||||
* Combines data from all readouts and gives it to the gui
|
||||
* or just gives progress of acquisition by polling receivers
|
||||
*/
|
||||
void processData();
|
||||
void processData(bool receiver);
|
||||
|
||||
/**
|
||||
* Convert raw file
|
||||
@ -352,7 +352,7 @@ class DetectorImpl : public virtual slsDetectorDefs {
|
||||
|
||||
void printProgress(double progress);
|
||||
|
||||
void startProcessingThread();
|
||||
void startProcessingThread(bool receiver);
|
||||
|
||||
/**
|
||||
* Check if processing thread is ready to join main thread
|
||||
@ -387,14 +387,6 @@ class DetectorImpl : public virtual slsDetectorDefs {
|
||||
/** ZMQ Socket - Receiver to Client */
|
||||
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 */
|
||||
mutable std::mutex mp;
|
||||
|
||||
|
@ -357,6 +357,10 @@ void Module::setImageTestMode(const int value) {
|
||||
}
|
||||
|
||||
int Module::getADC(dacIndex index) const {
|
||||
// cannot access fpga links simultaneously (eiger) temp fix
|
||||
if (index == TEMPERATURE_FPGA2 || index == TEMPERATURE_FPGA3) {
|
||||
return sendToDetector<int>(F_GET_ADC, index);
|
||||
}
|
||||
return sendToDetectorStop<int>(F_GET_ADC, index);
|
||||
}
|
||||
|
||||
@ -792,13 +796,6 @@ void Module::setReceiverHostname(const std::string &receiverIP) {
|
||||
|
||||
shm()->numUDPInterfaces = retval.udpInterfaces;
|
||||
|
||||
if (shm()->myDetectorType == MOENCH) {
|
||||
setAdditionalJsonParameter("adcmask_1g",
|
||||
std::to_string(retval.adcMask));
|
||||
setAdditionalJsonParameter("adcmask_10g",
|
||||
std::to_string(retval.adc10gMask));
|
||||
}
|
||||
|
||||
// to use rx_hostname if empty and also update client zmqip
|
||||
updateReceiverStreamingIP();
|
||||
}
|
||||
@ -1073,19 +1070,6 @@ void Module::setSubDeadTime(int64_t value) {
|
||||
}
|
||||
|
||||
int Module::getThresholdEnergy() const {
|
||||
// moench - get threshold energy from json header
|
||||
if (shm()->myDetectorType == MOENCH) {
|
||||
getAdditionalJsonHeader();
|
||||
std::string result = getAdditionalJsonParameter("threshold");
|
||||
// convert to integer
|
||||
try {
|
||||
return std::stoi(result);
|
||||
}
|
||||
// not found or cannot scan integer
|
||||
catch (...) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return sendToDetector<int>(F_GET_THRESHOLD_ENERGY);
|
||||
}
|
||||
|
||||
@ -1097,10 +1081,6 @@ void Module::setThresholdEnergy(int e_eV, detectorSettings isettings,
|
||||
if (shm()->useReceiverFlag) {
|
||||
sendToReceiver(F_RECEIVER_SET_THRESHOLD, e_eV, nullptr);
|
||||
}
|
||||
}
|
||||
// moench - send threshold energy to processor
|
||||
else if (shm()->myDetectorType == MOENCH) {
|
||||
setAdditionalJsonParameter("threshold", std::to_string(e_eV));
|
||||
} else {
|
||||
throw RuntimeError(
|
||||
"Set threshold energy not implemented for this detector");
|
||||
@ -1789,10 +1769,6 @@ void Module::setADCEnableMask(uint32_t mask) {
|
||||
// update #nchan, as it depends on #samples, adcmask,
|
||||
updateNumberOfChannels();
|
||||
|
||||
// send to processor
|
||||
if (shm()->myDetectorType == MOENCH)
|
||||
setAdditionalJsonParameter("adcmask_1g", std::to_string(mask));
|
||||
|
||||
if (shm()->useReceiverFlag) {
|
||||
sendToReceiver<int>(F_RECEIVER_SET_ADC_MASK, mask);
|
||||
}
|
||||
@ -1806,10 +1782,6 @@ void Module::setTenGigaADCEnableMask(uint32_t mask) {
|
||||
sendToDetector(F_SET_ADC_ENABLE_MASK_10G, mask, nullptr);
|
||||
updateNumberOfChannels(); // depends on samples and adcmask
|
||||
|
||||
// send to processor
|
||||
if (shm()->myDetectorType == MOENCH)
|
||||
setAdditionalJsonParameter("adcmask_10g", std::to_string(mask));
|
||||
|
||||
if (shm()->useReceiverFlag) {
|
||||
sendToReceiver<int>(F_RECEIVER_SET_ADC_MASK_10G, mask);
|
||||
}
|
||||
|
@ -574,25 +574,25 @@ TEST_CASE("rx_framesperfile", "[.cmd][.rx][.new]") {
|
||||
|
||||
/* ZMQ Streaming Parameters (Receiver<->Client) */
|
||||
|
||||
TEST_CASE("rx_datastream", "[.cmd][.rx][.new]") {
|
||||
TEST_CASE("rx_zmqstream", "[.cmd][.rx][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto prev_val = det.getRxZmqDataStream();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("rx_datastream", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "rx_datastream 1\n");
|
||||
proxy.Call("rx_zmqstream", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "rx_zmqstream 1\n");
|
||||
REQUIRE(det.getRxZmqDataStream().squash() == true);
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("rx_datastream", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "rx_datastream 1\n");
|
||||
proxy.Call("rx_zmqstream", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "rx_zmqstream 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("rx_datastream", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "rx_datastream 0\n");
|
||||
proxy.Call("rx_zmqstream", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "rx_zmqstream 0\n");
|
||||
REQUIRE(det.getRxZmqDataStream().squash() == false);
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
@ -600,24 +600,24 @@ TEST_CASE("rx_datastream", "[.cmd][.rx][.new]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("rx_readfreq", "[.cmd][.rx][.new]") {
|
||||
TEST_CASE("rx_zmqfreq", "[.cmd][.rx][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto prev_val = det.getRxZmqFrequency();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("rx_readfreq", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "rx_readfreq 1\n");
|
||||
proxy.Call("rx_zmqfreq", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "rx_zmqfreq 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("rx_readfreq", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "rx_readfreq 1\n");
|
||||
proxy.Call("rx_zmqfreq", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "rx_zmqfreq 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("rx_readfreq", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "rx_readfreq 0\n");
|
||||
proxy.Call("rx_zmqfreq", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "rx_zmqfreq 0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setRxZmqFrequency(prev_val[i], {i});
|
||||
|
@ -298,7 +298,7 @@ TEST_CASE("triggers", "[.cmd][.new]") {
|
||||
det.setNumberOfTriggers(prev_val);
|
||||
}
|
||||
|
||||
TEST_CASE("exptime", "[.cmd][.new]") {
|
||||
TEST_CASE("exptime", "[.cmd][.time]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
@ -333,6 +333,12 @@ TEST_CASE("exptime", "[.cmd][.new]") {
|
||||
proxy.Call("exptime", {"0"}, -1, PUT, oss);
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -24,16 +24,16 @@ const std::string DataProcessor::TypeName = "DataProcessor";
|
||||
|
||||
DataProcessor::DataProcessor(int ind, detectorType dtype, Fifo *f,
|
||||
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,
|
||||
bool *act, bool *depaden, bool *sm, bool *qe,
|
||||
bool *act, bool *depaden, bool *sm,
|
||||
std::vector<int> *cdl, int *cdo, int *cad)
|
||||
: ThreadObject(ind, TypeName), fifo(f), myDetectorType(dtype),
|
||||
dataStreamEnable(dsEnable), fileFormatType(ftype),
|
||||
fileWriteEnable(fwenable), masterFileWriteEnable(mfwenable),
|
||||
dynamicRange(dr), streamingFrequency(freq), streamingTimerInMs(timer),
|
||||
streamingFrequency(freq), streamingTimerInMs(timer),
|
||||
streamingStartFnum(sfnum), activated(act),
|
||||
deactivatedPaddingEnable(depaden), silentMode(sm), quadEnable(qe),
|
||||
deactivatedPaddingEnable(depaden), silentMode(sm),
|
||||
framePadding(fp), ctbDbitList(cdl), ctbDbitOffset(cdo),
|
||||
ctbAnalogDataBytes(cad), firstStreamerFrame(false) {
|
||||
LOG(logDEBUG) << "DataProcessor " << ind << " created";
|
||||
|
@ -49,9 +49,9 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
||||
* @param cad pointer to ctb analog databytes
|
||||
*/
|
||||
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,
|
||||
bool *act, bool *depaden, bool *sm, bool *qe,
|
||||
bool *act, bool *depaden, bool *sm,
|
||||
std::vector<int> *cdl, int *cdo, int *cad);
|
||||
|
||||
/**
|
||||
@ -268,9 +268,6 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
||||
/** Master File Write Enable */
|
||||
bool *masterFileWriteEnable;
|
||||
|
||||
/** Dynamic Range */
|
||||
uint32_t *dynamicRange;
|
||||
|
||||
/** Pointer to Streaming frequency, if 0, sending random images with a timer
|
||||
*/
|
||||
uint32_t *streamingFrequency;
|
||||
@ -296,9 +293,6 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
||||
/** Silent Mode */
|
||||
bool *silentMode;
|
||||
|
||||
/** quad enable */
|
||||
bool *quadEnable;
|
||||
|
||||
/** frame padding */
|
||||
bool *framePadding;
|
||||
|
||||
|
@ -180,7 +180,7 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
||||
std::map<std::string, std::string> localAdditionalJsonHeader;
|
||||
|
||||
/** Aquisition Started flag */
|
||||
bool startedFlag{nullptr};
|
||||
bool startedFlag{false};
|
||||
|
||||
/** Frame Number of First Frame */
|
||||
uint64_t firstIndex{0};
|
||||
|
@ -168,7 +168,6 @@ class GeneralData {
|
||||
class GotthardData : public GeneralData {
|
||||
|
||||
private:
|
||||
const int nChip = 10;
|
||||
const int nChan = 128;
|
||||
const int nChipsPerAdc = 2;
|
||||
|
||||
@ -532,8 +531,6 @@ class Gotthard2Data : public GeneralData {
|
||||
|
||||
class ChipTestBoardData : public GeneralData {
|
||||
private:
|
||||
/** Number of analog channels */
|
||||
const int NCHAN_ANALOG = 32;
|
||||
/** Number of digital channels */
|
||||
const int NCHAN_DIGITAL = 64;
|
||||
/** Number of bytes per analog channel */
|
||||
@ -579,14 +576,8 @@ class ChipTestBoardData : public GeneralData {
|
||||
// analog channels (normal, analog/digital readout)
|
||||
if (f == slsDetectorDefs::ANALOG_ONLY ||
|
||||
f == slsDetectorDefs::ANALOG_AND_DIGITAL) {
|
||||
if (a == BIT32_MASK) {
|
||||
nachans = 32;
|
||||
} else {
|
||||
for (int ich = 0; ich < 32; ++ich) {
|
||||
if (a & (1 << ich))
|
||||
++nachans;
|
||||
}
|
||||
}
|
||||
nachans = __builtin_popcount(a);
|
||||
|
||||
adatabytes = nachans * NUM_BYTES_PER_ANALOG_CHANNEL * as;
|
||||
LOG(logDEBUG1) << " Number of Analog Channels:" << nachans
|
||||
<< " Databytes: " << adatabytes;
|
||||
|
@ -162,15 +162,15 @@ void Implementation::setDetectorType(const detectorType d) {
|
||||
auto fifo_ptr = fifo[i].get();
|
||||
listener.push_back(sls::make_unique<Listener>(
|
||||
i, myDetectorType, fifo_ptr, &status, &udpPortNum[i], ð[i],
|
||||
&numberOfTotalFrames, &dynamicRange, &udpSocketBufferSize,
|
||||
&numberOfTotalFrames, &udpSocketBufferSize,
|
||||
&actualUDPSocketBufferSize, &framesPerFile, &frameDiscardMode,
|
||||
&activated, &deactivatedPaddingEnable, &silentMode));
|
||||
dataProcessor.push_back(sls::make_unique<DataProcessor>(
|
||||
i, myDetectorType, fifo_ptr, &fileFormatType, fileWriteEnable,
|
||||
&masterFileWriteEnable, &dataStreamEnable, &dynamicRange,
|
||||
&masterFileWriteEnable, &dataStreamEnable,
|
||||
&streamingFrequency, &streamingTimerInMs, &streamingStartFnum,
|
||||
&framePadding, &activated, &deactivatedPaddingEnable,
|
||||
&silentMode, &quadEnable, &ctbDbitList, &ctbDbitOffset,
|
||||
&silentMode, &ctbDbitList, &ctbDbitOffset,
|
||||
&ctbAnalogDataBytes));
|
||||
} catch (...) {
|
||||
listener.clear();
|
||||
@ -841,7 +841,7 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
||||
auto fifo_ptr = fifo[i].get();
|
||||
listener.push_back(sls::make_unique<Listener>(
|
||||
i, myDetectorType, fifo_ptr, &status, &udpPortNum[i],
|
||||
ð[i], &numberOfTotalFrames, &dynamicRange,
|
||||
ð[i], &numberOfTotalFrames,
|
||||
&udpSocketBufferSize, &actualUDPSocketBufferSize,
|
||||
&framesPerFile, &frameDiscardMode, &activated,
|
||||
&deactivatedPaddingEnable, &silentMode));
|
||||
@ -850,9 +850,9 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
||||
dataProcessor.push_back(sls::make_unique<DataProcessor>(
|
||||
i, myDetectorType, fifo_ptr, &fileFormatType,
|
||||
fileWriteEnable, &masterFileWriteEnable, &dataStreamEnable,
|
||||
&dynamicRange, &streamingFrequency, &streamingTimerInMs,
|
||||
&streamingFrequency, &streamingTimerInMs,
|
||||
&streamingStartFnum, &framePadding, &activated,
|
||||
&deactivatedPaddingEnable, &silentMode, &quadEnable,
|
||||
&deactivatedPaddingEnable, &silentMode,
|
||||
&ctbDbitList, &ctbDbitOffset, &ctbAnalogDataBytes));
|
||||
dataProcessor[i]->SetGeneralData(generalData);
|
||||
} catch (...) {
|
||||
|
@ -21,11 +21,11 @@ const std::string Listener::TypeName = "Listener";
|
||||
|
||||
Listener::Listener(int ind, detectorType dtype, Fifo *f,
|
||||
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,
|
||||
bool *depaden, bool *sm)
|
||||
: 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),
|
||||
framesPerFile(fpf), frameDiscardMode(fdp), activated(act),
|
||||
deactivatedPaddingEnable(depaden), silentMode(sm) {
|
||||
|
@ -41,7 +41,7 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
|
||||
* @param sm pointer to silent mode
|
||||
*/
|
||||
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,
|
||||
bool *act, bool *depaden, bool *sm);
|
||||
|
||||
@ -172,9 +172,6 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
|
||||
/** Number of Images to catch */
|
||||
uint64_t *numImages;
|
||||
|
||||
/** Dynamic Range */
|
||||
uint32_t *dynamicRange;
|
||||
|
||||
/** UDP Socket Buffer Size */
|
||||
int64_t *udpSocketBufferSize;
|
||||
|
||||
|
@ -32,8 +32,6 @@ std::string ToString(const defs::frameDiscardPolicy s);
|
||||
std::string ToString(const defs::fileFormat s);
|
||||
std::string ToString(const defs::externalSignalFlag s);
|
||||
std::string ToString(const defs::readoutMode s);
|
||||
std::string ToString(const defs::frameModeType s);
|
||||
std::string ToString(const defs::detectorModeType s);
|
||||
std::string ToString(const defs::dacIndex s);
|
||||
std::string ToString(const std::vector<defs::dacIndex> &vec);
|
||||
std::string ToString(const defs::burstMode s);
|
||||
@ -283,8 +281,6 @@ template <> defs::frameDiscardPolicy StringTo(const std::string &s);
|
||||
template <> defs::fileFormat StringTo(const std::string &s);
|
||||
template <> defs::externalSignalFlag StringTo(const std::string &s);
|
||||
template <> defs::readoutMode StringTo(const std::string &s);
|
||||
template <> defs::frameModeType StringTo(const std::string &s);
|
||||
template <> defs::detectorModeType StringTo(const std::string &s);
|
||||
template <> defs::dacIndex StringTo(const std::string &s);
|
||||
template <> defs::burstMode StringTo(const std::string &s);
|
||||
template <> defs::timingSourceType StringTo(const std::string &s);
|
||||
|
@ -377,16 +377,6 @@ typedef struct {
|
||||
/** hierarchy in multi-detector structure, if any */
|
||||
enum masterFlags { NO_MASTER, IS_MASTER, IS_SLAVE };
|
||||
|
||||
/**
|
||||
* frame mode for processor
|
||||
*/
|
||||
enum frameModeType { PEDESTAL, NEW_PEDESTAL, FLATFIELD, NEW_FLATFIELD };
|
||||
|
||||
/**
|
||||
* detector mode for processor
|
||||
*/
|
||||
enum detectorModeType { COUNTING, INTERPOLATING, ANALOG };
|
||||
|
||||
/**
|
||||
* burst mode for gotthard2
|
||||
*/
|
||||
|
@ -3,11 +3,11 @@
|
||||
#define APILIB 0x200810
|
||||
#define APIRECEIVER 0x200810
|
||||
#define APIGUI 0x200804
|
||||
#define APICTB 0x200909
|
||||
#define APIGOTTHARD 0x200909
|
||||
#define APIGOTTHARD2 0x200909
|
||||
#define APIJUNGFRAU 0x200909
|
||||
#define APIMOENCH 0x200909
|
||||
#define APIEIGER 0x200909
|
||||
|
||||
#define APIMYTHEN3 0x200909
|
||||
#define APICTB 0x200910
|
||||
#define APIGOTTHARD 0x200910
|
||||
#define APIJUNGFRAU 0x200910
|
||||
#define APIMOENCH 0x200910
|
||||
#define APIEIGER 0x200910
|
||||
#define APIGOTTHARD2 0x200910
|
||||
#define APIMYTHEN3 0x200910
|
||||
|
@ -325,34 +325,6 @@ std::string ToString(const defs::readoutMode s) {
|
||||
}
|
||||
}
|
||||
|
||||
std::string ToString(const defs::frameModeType s) {
|
||||
switch (s) {
|
||||
case defs::PEDESTAL:
|
||||
return std::string("pedestal");
|
||||
case defs::NEW_PEDESTAL:
|
||||
return std::string("newpedestal");
|
||||
case defs::FLATFIELD:
|
||||
return std::string("flatfield");
|
||||
case defs::NEW_FLATFIELD:
|
||||
return std::string("newflatfield");
|
||||
default:
|
||||
return std::string("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
std::string ToString(const defs::detectorModeType s) {
|
||||
switch (s) {
|
||||
case defs::COUNTING:
|
||||
return std::string("counting");
|
||||
case defs::INTERPOLATING:
|
||||
return std::string("interpolating");
|
||||
case defs::ANALOG:
|
||||
return std::string("analog");
|
||||
default:
|
||||
return std::string("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
std::string ToString(const defs::dacIndex s) {
|
||||
switch (s) {
|
||||
case defs::DAC_0:
|
||||
@ -713,28 +685,6 @@ template <> defs::readoutMode StringTo(const std::string &s) {
|
||||
throw sls::RuntimeError("Unknown readout mode " + s);
|
||||
}
|
||||
|
||||
template <> defs::frameModeType StringTo(const std::string &s) {
|
||||
if (s == "pedestal")
|
||||
return defs::PEDESTAL;
|
||||
if (s == "newpedestal")
|
||||
return defs::NEW_PEDESTAL;
|
||||
if (s == "flatfield")
|
||||
return defs::FLATFIELD;
|
||||
if (s == "newflatfield")
|
||||
return defs::NEW_FLATFIELD;
|
||||
throw sls::RuntimeError("Unknown frame mode " + s);
|
||||
}
|
||||
|
||||
template <> defs::detectorModeType StringTo(const std::string &s) {
|
||||
if (s == "counting")
|
||||
return defs::COUNTING;
|
||||
if (s == "interpolating")
|
||||
return defs::INTERPOLATING;
|
||||
if (s == "analog")
|
||||
return defs::ANALOG;
|
||||
throw sls::RuntimeError("Unknown detector mode " + s);
|
||||
}
|
||||
|
||||
template <> defs::dacIndex StringTo(const std::string &s) {
|
||||
if (s == "dac 0")
|
||||
return defs::DAC_0;
|
||||
|
Reference in New Issue
Block a user