Compare commits

..

142 Commits

Author SHA1 Message Date
cfbe3c86cc 7.0.3.rc2 (#866) (#867)
*7.0.3.rc2
* moench: handling bug in post processing from receiver when partial_frames policy and empty frame happens, only json header without data is sent
2023-11-14 11:32:33 +01:00
4b414bfddb release notes 2023-11-12 15:39:58 +01:00
5ab64efe3e added python 3.12 to the conda build variants 2023-11-10 14:18:38 +01:00
bfe53c6693 udpated release notes 2023-11-09 15:10:17 +01:00
c64e87a2b6 7.0.3.rc: fix server logic in checking detector idle (#859)
* fix buggy logic in checking detector idle and an argument check
2023-11-09 14:21:11 +01:00
14e11e8b5b formatting and versioning 2023-11-08 11:43:09 +01:00
af3dc1e7f4 7.0.3.rc: execute command inside server fixed (from fix simulator tests and exec command PR) (#855)
* execute command inside server fixed (from fix simulator tests and exec command PR)
2023-11-08 09:25:52 +01:00
8174fc9691 Update RELEASE.txt 2023-11-07 12:34:10 +01:00
d6eac6da71 updated release notes 2023-11-07 11:22:09 +01:00
9b9b09ceaf 703rc/tests/fix execute command (#842)
* fix execute command
* fix for tests for ctb
2023-11-07 09:29:48 +01:00
4613c54f57 handling inconsistent fnums to be -1 in gui, so when one sets 0 (change of value) will also give an exception (#852) 2023-11-06 16:11:25 +01:00
58ac7ac280 7.0.3.rc: gui acq finished callback for different status (#847)
* fix acquisition finished status to have different status for different modules, but does not have to be error. for eg. jf sync fw (2.4.1 gives idle for master and stopped for slaves when stopping acquiistion)
2023-11-06 16:07:38 +01:00
82edfa75d3 7.0.3.rc: process the raw data files as a list (#848)
* Added file list option for moenchRawDataProcess
2023-11-03 12:10:20 +01:00
b6ef3bc39e updated release notest 2023-10-25 09:15:10 +02:00
2035666792 versioning and binaries updated 2023-10-25 08:43:23 +02:00
1ff4d806e7 minor 2023-10-25 08:25:02 +02:00
3861379653 updated release notes 2023-10-24 17:39:47 +02:00
91140bbb71 formatting 2023-10-24 11:17:18 +02:00
d44329117d fix warning for prev_val (variable size array) in tests (#836) 2023-10-23 15:52:59 +02:00
6c67025ea8 7.0.3.rc eiger: fw version to 32 (quad blocking trigger) (#832)
* eiger required fw version to 32: fix for blocking trigger in quad
2023-10-18 16:51:17 +02:00
37ce3d6f59 7.0.3.rc: jf sync: stopping master gives idle (#822)
* jf sync mode master could return idle when stopped and so not all modules return the same value and must check for 'stopped or idle', Also must throw if any of the module gives an error ( not jungfrau, but eiger could)

* added contains_only to sls::Result (#827)

* added variadic template for checking if a result contains only specified values

* fix for gcc4.8

* renamed to Result::contains_only

* stop on only the positions

---------

Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
2023-10-13 12:27:43 +02:00
1484d038de 7.03.rc: update 2d gain plot color map (if no x and ymin/max changes or window resizing): setFixedWidth was updating for window resize, updated virtual servers for g2 and jungfrau to keep changing gain and data for every frame. the data value (#818) 2023-10-03 17:22:03 +02:00
fb0090c79e removing the misleading word 'Simulating' when programmig fpga (#814) 2023-09-28 16:20:59 +02:00
adc68cd519 formatting 2023-09-28 15:51:40 +02:00
1566eef247 703rc/fix numeric limits (#812)
* fixed compilation for fedora for numeric_limits

* formatting
2023-09-28 10:49:02 +02:00
e7cd90db78 fixed crashing of moench03RawDataProcess when nframes>0 (#810) 2023-09-27 09:22:40 +02:00
45414149fe binaries in for the previous PR 2023-09-22 15:59:35 +02:00
48759f440e 703rc/fix port size (#802)
* validate port numbers in client

* validate port numbers created at virtual servers and receiver process as tcp ports
2023-09-18 08:59:53 +02:00
b367b7e431 fixed some interpolation issues (#796) 2023-08-28 13:38:19 +02:00
f0b2a6f6f9 update release notes 2023-08-25 14:02:50 +02:00
f761046bfc updated docs and versions 2023-07-12 16:50:13 +02:00
1a859b83db formatting 2023-07-12 16:06:31 +02:00
70bfc875a6 updating release notes 2023-07-11 17:02:27 +02:00
c0755308a4 updating release notes 2023-07-11 17:01:14 +02:00
ab5509e10c updating release notes 2023-07-11 17:00:42 +02:00
004cb26646 updated firmware versions for 7.0.2 2023-07-10 12:21:19 +02:00
a4f47a5945 synced master status running when setting to slave (#747)
* jf: unsync before setting master/slave and then sync (if it was set) to overcome master going into running state when making it a slave and synced

* add tests for this condition

* updated release notes, updated min fw version requirement for v1.0 boards
2023-05-25 11:04:05 +02:00
312f3f473d fix that only master starts second and not all (for start acq), typo with pos and masters list (#743) 2023-05-11 10:20:17 +02:00
5871086cd6 formatting 2023-05-08 17:04:04 +02:00
6a0fe823b3 enable fix g0 when in expert mode (when gain mode enabled and not just visible) (#736) 2023-05-08 14:20:21 +02:00
5912aae53e Rx roi zmq (#726)
adding rx_roi also in the zmq header for external guis to put the "yellow box".. sending full roi instead of -1, and sending for each zmq port. "(multiple yellow boxes)".
2023-05-08 12:23:05 +02:00
8833ccf5cc 7.0.2.rc (#721)
* row and column for jungfrau mixed up

* multi module jungfrau sync must do slaves first then master for start acquisition and send software trigger, and master first and then slaves for stopacquisition

* non blocking to slaves first and only then blocking/nonblocking to the master for sending software trigger(jungfrau multi mod sync)

* fixed get/set timing jungfrau when sync enabled, getsync during blocking acquire (for trigger or stop) will get stuck as it should ask the stop server

* switching between 1 and 2 interfaces did not set gui/client zmq port properly. Resulted in dummy streaming forever. fixed

* formatting, refactoring: const & for positions, multi mod M3 stop first master first

* adding missing cstdint for gcc 13

* Refactoring handle sync out, handling synchronization also for softwaretrigger for m3, for start/sync/stop for g2/g1

---------

Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com>
2023-05-08 12:11:19 +02:00
77c558a7be formatting 2023-03-24 12:54:55 +01:00
378fc301b8 updating client version, release version and project_version in CMakeLists.txt 2023-03-23 15:43:17 +01:00
87d6e16090 7.0.1 fix det server version (#702)
* check server version before initial checks, catch old server version exception, get old server version as 64 bit and print it along with exception
2023-03-23 15:37:01 +01:00
2ef021041c rx_arping sigchld (#701)
* rx_arping pclose gave -1 due to sigchld being ignored, fixed with sig handler doing a wait
2023-03-23 13:58:40 +01:00
574127b5ac fix hdf5 compilation using det spec fields in header (#700)
* fix hdf5 compilation using det spec fields in header
2023-03-23 12:30:38 +01:00
e942678139 Merge branch 'main' into 7.0.0.rc 2023-02-24 09:48:22 +01:00
72a028eaf3 Update README.md 2023-02-23 17:30:47 +01:00
907257891d updated readme 2023-02-23 17:24:23 +01:00
0a79ae523b updating documentation 2023-02-23 16:52:04 +01:00
90496bcee8 updated release date and lib api date 2023-02-23 16:38:10 +01:00
ed2894dafd python additions (#686)
* python: fixed versions when no receiver, added clearbusy, serialnumber and readoutspeedlist. commandline: modified versions to look like python versions

* python: added clkphase, fixed clkdiv, maxphase

* python added adcvpp

* gaincaps for python

---------

Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com>
2023-02-23 16:29:54 +01:00
a74c9498e2 m3, individual chip index back in for hw 1.2, need the linux drivers for chipdac0-9 (#685) 2023-02-23 09:13:31 +01:00
403989e2f8 trigger, blockingtrigger in python and m3 timefix 2023-02-22 18:01:46 +01:00
7e8d11098a release date 2023-02-22 17:15:51 +01:00
f9c9a53c8c fix python compare script from g to sls_detector_get 2023-02-22 17:09:47 +01:00
90b1b97ffa release notes 2023-02-22 16:30:41 +01:00
50003cbc08 release notes 2023-02-22 16:30:27 +01:00
a799c4d2e2 minor 2023-02-22 15:37:13 +01:00
700f532b5a examples udp before rx_hostame 2023-02-22 15:16:00 +01:00
a098bc4674 fixes for tests for m3 2023-02-22 14:34:01 +01:00
13bbd54a21 formatting 2023-02-22 11:42:06 +01:00
d84e9652d3 updated versions for the servers 2023-02-22 11:36:47 +01:00
1ce39c48c7 updated client versions 2023-02-22 11:29:58 +01:00
9ddff523cd minor 2023-02-22 11:28:39 +01:00
f7618fbb93 error message 'unrecognized function enum' from detector or receiver prepended with Software version mismatch to handle enum start change between v6 and v7 (#680) 2023-02-22 11:11:46 +01:00
8501e1fb1f eiger server moved to fw 31 (#681)
* eiger server moved to fw 31
2023-02-22 11:10:56 +01:00
6faa4c821f udp_srcip auto to detector ip (#683)
* udp_srcip now points to detectorip for 'auto' argument. and not allowed for G1
2023-02-22 11:09:52 +01:00
da291d535e fix ctb test, non blocking will not return for 1g (#684)
* fix ctb test, non blocking will not return for 1g
2023-02-22 11:09:18 +01:00
adcde9fd49 user friendly message added from ' dangerous to continue' to 'check firmware' (#665) 2023-02-20 16:35:33 +01:00
dde99a16b3 fixed documentation for fw upgrade and cmk script show all options (#674)
* fixed documentation for fw upgrade and cmk script show all options

* much more clear definition of the sls receiver header
2023-02-20 15:24:09 +01:00
b200a2efc1 Fix jf softwre trigger and tests with real jungfrau detector (#673)
* jungfrau: software triggers do not work, fixed

* eiger test: get highvoltage must be read twice to get the real voltage
2023-02-20 15:22:46 +01:00
fe281bd1b1 Fix stop rx stuck (#669)
stop should really stop even if receiver had crashed, so check rx status after sending stop; also ensuring restream  in acquire happens only if thers a callback
2023-02-20 15:21:22 +01:00
878eab9fc3 Fix gui browse (#662)
Choosing file path in dialog should already set file path when returning from dialog, must not wait to press enter
2023-02-20 15:20:02 +01:00
4259d49b63 added release notes from 7.0.0.rc1 to rc2 (#639)
* added release notes from 7.0.0.rc1 to rc2
2023-02-17 08:51:05 +01:00
4dac9f2193 zmq4.3 changed default buffer size to -1 instead of 0 (#667) 2023-02-15 09:45:02 +01:00
cb8e4365e3 formatting 2023-02-14 15:08:31 +01:00
0251aa9e63 fixed linking issue in arping and shm test (#659)
Co-authored-by: Erik Frojdh <erik.frojdh@psi.ch>
2023-02-14 14:49:00 +01:00
7c047cab4a udpated version to rc4 2023-02-14 10:30:45 +01:00
572332f870 fix test for eiger half module for gap pixels (#658) 2023-02-14 09:22:32 +01:00
d90bf6c7df formatting 2023-02-13 11:36:41 +01:00
5c8c3ae3f3 fix to access to shared memory that doesnt exist (#638)
* fix to access to shared memory that doesnt exist

* fix for freeing shm and then setting hostname from API

* exception error message moved to private function

* refactoring to avoid allocating intermediate string
2023-02-13 11:29:54 +01:00
18136fed9d exception messages (#656)
* fix exception messages for more printout about sockets or more detail
2023-02-13 11:22:05 +01:00
fc42720208 allow half modules and odd number of half modules to use the gui with gap pixels disabled (#655) 2023-02-13 11:21:35 +01:00
e6505650cb proper update of client and rx versions to 7.0.0.rc3 2023-02-10 16:34:04 +01:00
ba6fdb9695 udpated client and rx versions to rc3 2023-02-10 16:04:32 +01:00
8361f2bb96 zmq: set zmq buffer size also to 0 if hwm >= 25 (#653) 2023-02-10 08:57:36 +01:00
4ee4d66977 Jf zeromq display (#644)
* modified ZmqSocket to expose the SO_RCVBUF and SO_SENDBUF parameters. Modified DataStreamer.cpp to change the SENDBUF to 1MB when HWL is <10. Modified Datastreamer.cpp so that when HWL is changed, socket is unbind/rebind. Added rebind to ZmqSocket.cpp.
Changed slot UpdatePlot() in qdrawplot.h from privat tto public, added plot->UpdatePlot() after every axis range change, so the plots are updated immediatly and not at the next image.
Added onlinedisp_zmq program which connects to the receiver ZMQ port and show images and histos. Compiled against  ROOT 6.22/02. Added examples files.

* added setbuffer size also for gui, moved hardcoded values to a macro, removed unnecessary return of ok or success, added actual zmq exception message to could not create sockets error

* zmq: changing buffer size done within hwm

---------

Co-authored-by: mozzanica <l_mozzanica@mpc2012.psi.ch>
Co-authored-by: Dhanya Thattil <dhanya.thattil@psi.ch>
2023-02-09 17:24:28 +01:00
e14f6981a0 Fix tests (#647)
* fixes tests
2023-02-09 15:57:05 +01:00
8158ef876c eiger: quad write/read reg (dr) and quad positions (#649)
* eiger: adding mask to read/write registers. useful for setting quad parameters as they might have different values for left and right fpga registers.
** fix quad position
* fix quad flipping
* formatting
2023-02-09 15:55:35 +01:00
ebb6f53b21 Fix rx arping socket bind (#646)
* first tries with a process intead of thread for rx_arping

* Moving delete pointer of udp socket to stopReciever,so rx_arping can only be set when udp socket is closed

* refactoring and formatting

* unused variable processId

* ignore sigchild to prevent zombie from child processes being killed
2023-02-03 17:18:09 +01:00
e172df79f3 format 2023-02-03 11:23:19 +01:00
55bf73f3b7 unicast udp_srcmac (#642)
* udp_srcmac can only be a unicast address (LSB of first octet must be 0)

* renamed binaries
2023-02-03 10:56:19 +01:00
c62ce0ce6b m3:changed str_clk (clkdiv 3) default to 166MHz (6) (#643) 2023-01-30 17:05:42 +01:00
3a3628c475 m3 firmware version change (#637)
* m3 firmware version change

* changed binary name to rc3
2023-01-27 10:54:45 +01:00
9ba907f9f7 added none or 0 to unset bad channels (#632)
* added none or 0 to unset bad channels

* free function split to get int array from string of arguments for badchannels

* missed a file

* allowing list for badchannels in command line

* added badchannels in python

* added size check

* more comments in Detector.h and added more tests for facny command line badchannels

* removeDuplicates accept any container, added tests

* corner cases: 1:5,6,7 or 5,6,7 or just 1:5

Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com>
2023-01-27 09:59:31 +01:00
3f7c9529dd m3: changed clk 0 1 2 to 100MHz (#636)
* m3: changed clk 0 1 2 to 100MHz

* m3:fix clk 2

* binaries in
2023-01-25 11:54:37 +01:00
c7af9c9f3e fix for versions command in python failing for eiger due to hardware version not implemented (#602) 2023-01-24 11:05:32 +01:00
0b17318f10 formatting 2023-01-24 10:37:52 +01:00
1f907b911e added documentation about zmq json header (#629)
* added documentation about zmq json header

* fix from 7.0.0 field name changes in zmq header
2023-01-23 14:15:14 +01:00
c5b621b684 intialize pattern addresses with default, else they are created with value 0 and overwrite the default in server (#628) 2023-01-23 10:59:18 +01:00
946e6aa817 badchannel segfault for multi module (#620)
* badchannels segfaults when there are no badchannels for next modules, fixed

* added example badchannels

* refactoring casting
2023-01-20 17:39:25 +01:00
3682644e15 incorrectly using detsize, caught and fixing it in background (#619) 2023-01-19 11:10:05 +01:00
a6aaa2c3c6 adding fliprows to python (#625) 2023-01-19 11:03:04 +01:00
ac64afe747 print also the level when using command line to set/get patloop, patnloop, patwait, patwaittime (#621) 2023-01-19 10:44:17 +01:00
d19f6a3d0d initialchecks werent being bypassed because of the wrong exception being caught. fixed (#623) 2023-01-19 10:43:27 +01:00
d77b353481 Corrected wrong coloring in plotPattern 2023-01-18 08:59:30 +01:00
7466c0bc8f M3 deserialize (#618)
* m3: updated serializing loop in trimming

* fixed the deserializing loop again
2023-01-17 09:39:58 +01:00
713639d001 Fix gotthard delay (#606)
* fix for set delay for gotthard1 (verification adds master delay even if its not master)

* binaries in

* binaries name
2023-01-17 09:16:43 +01:00
3cc4d25eb9 Merge branch '7.0.0.rc' of https://github.com/slsdetectorgroup/slsDetectorPackage into 7.0.0.rc 2023-01-16 15:05:59 +01:00
0d905923dd Corrected a typo in plotPattern.py 2023-01-16 15:03:16 +01:00
e747a5811f added missing equality operator for DurationWrapper in Python (M3 exptime fix) (#615) 2023-01-16 14:12:12 +01:00
22b3229d94 m3: updated serializing loop in trimming (#613) 2023-01-16 13:43:28 +01:00
d106109f6c fixed hostname not split (+) in python (#609)
* fixed hostname not split (+) in python

* also for rx_hostname
2023-01-16 13:33:11 +01:00
ae0a54a774 Merge branch 'main' into 6.1.2.rc 2022-11-25 16:12:02 +01:00
ae33622da2 updated pybind and catch (#588)
* updated pybind and catch
* added to release notes
Co-authored-by: Erik Frojdh <erik.frojdh@psi.ch>
2022-11-25 16:08:36 +01:00
c4a453fdbd updated release version 2022-11-25 10:31:10 +01:00
672c0f4a07 updated client date 2022-11-25 10:26:23 +01:00
05af370883 update server bin 2022-11-25 10:23:49 +01:00
a6022b7cec updated release notes and eiger server 2022-11-25 10:18:37 +01:00
72316fa2ce release notes 2022-11-25 10:09:15 +01:00
65523dcc94 release notes 2022-11-25 10:08:17 +01:00
df40665c5e Using a loop to stop (#585)
* loop for stop, 10 retries
  For example, if module A got a "stop" during an acquisition, it stops to an 'Idle' state. If module B gets a "stop" before an acquisition, it will return it is in 'Idle' state and continue to start the next acquisition, but module B then waits for "ready  for trigger" synchronization from module A, which it will never get. Since module B missed the asynchronous stop command, the workaround in the client is to send another "stop" command (upto 10 retries) till it returns Idle.
2022-11-25 09:55:51 +01:00
8472cca81f naming 2022-11-17 17:15:05 +01:00
110e57ff6c Eiger stop lock (#576)
* added a lock when stopping or starting state machine in eiger server

* added 5ms right after acq started to make sure it really started

* added 100ms right after acq started to make sure it really started
2022-11-17 15:23:41 +01:00
fdd6031add renaming for version 2022-11-15 08:50:39 +01:00
e7c65f44cb returning empty fail message for eiger 2022-11-11 16:56:58 +01:00
0063cc8eb2 update release notes 2022-11-11 16:51:20 +01:00
27e6fc3c73 serverbin shortcuts 2022-11-11 16:02:57 +01:00
83e0eb8b01 removed the test for allow update for kernel and server as it is eligible if the kernel is booting up anyway 2022-11-11 16:02:17 +01:00
7f8b5ac6c0 blackfin nCE pin fix for new kernel 2022-11-11 15:31:30 +01:00
340abec016 updated release txt 2022-11-07 12:47:52 +01:00
a8b37e3932 ensure eiger hot fix server version stays the same 2022-10-24 10:54:48 +02:00
0883c73e88 not updating the client versions for 'server only hot fix' 2022-10-24 10:51:50 +02:00
ef7e9d73a5 eiger server fixes:
- removed feb reset in stop acquisition as it caused processing bit to randomly not go high (leads to infinite loop waiting for it to go high). This is anyway done at prepare acquisition and set trimbits.
- left AND right registers monitored for processing bit done
- febProcessinginprogress returns STATUS_IDLE and not IDLE
- In feb stop acquisition, if processing bit is running forever, checks for 1 s, then if acq done bit is high, returns ok, else throws
- feb stop acquisition returns 1 if success and fucntion in list calling it compares properly instead of STATUS_IDLE (no effect, but incorrect logic)
- chipsignals to trimquad should only monitor right fpga (not both as it will throw)
- fixed error messages of readregister inconsistent values
- setmodule and read frame was returning fail without setting error messages (leading to broken tcp connection due to no error message)
-
2022-10-21 16:31:17 +02:00
a8bdc1495c Update issue templates 2022-03-01 10:19:57 +01:00
1c54dea9c7 Update issue templates 2022-03-01 10:18:52 +01:00
cee286b6ad Update issue templates 2022-03-01 10:16:41 +01:00
da8e0060d3 updated release notes and project version 2022-01-04 10:44:07 +01:00
85da65ca15 update versioning (prev commit) 2022-01-04 10:38:45 +01:00
4fe067363a This commit fixes the issue #336
A delay of 100ms has been added between the generation of the stop pulse and the resetCore function call. This should give enough time to the detector to readout and streamout the ongoing frame before the internal logic is reset (even after the transmission is delayed with txndelay_frame).

Conflicts:
	slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv6.1.0
2022-01-04 10:37:57 +01:00
148 changed files with 4909 additions and 3139 deletions

View File

@ -2,7 +2,7 @@
# Copyright (C) 2021 Contributors to the SLS Detector Package
cmake_minimum_required(VERSION 3.12)
project(slsDetectorPackage)
set(PROJECT_VERSION 7.0.0)
set(PROJECT_VERSION 7.0.3)
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")

279
README.md
View File

@ -1,102 +1,233 @@
### Note
## Dependencies
Before building from source make sure that you have the [software wiki](https://slsdetectorgroup.github.io/devdoc/dependencies.html) installed. If installing using conda, conda will manage the dependencies. Avoid also installing packages with pip.
Please do not update to any xxxx.xx.xx.dev0 tags. They are not releases, but tags for internal usage.
Use only releases with tags such as x.x.x or x.x.x-rcx.
## Documentaion
Detailed documentation can be found in the [software wiki](https://slsdetectorgroup.github.io/devdoc/index.html) and on the [official site](https://www.psi.ch/en/detectors/software).
### Documentation
##### 5.0.0 - Latest Release
Detailed documentation on the latest release can be found in the [software wiki](https://slsdetectorgroup.github.io/devdoc/index.html) and on the [official site](https://www.psi.ch/en/detectors/software).
## Installation
##### Older Releases
Documentation is found in the package.
### 1. Install binaries using conda
Conda is not only useful to manage python environments but can also
be used as a user space package manager. Dates in the tag (for eg. 2020.07.23.dev0)
are from the developer branch. Please use released tags for stability.
We have three different packages available:
* **slsdetlib** shared libraries and command line utilities
* **slsdetgui** GUI
* **slsdet** Python bindings
### Binaries
Binaries for the slsDetectorPackage are available through conda.
```
#Add conda channels
#Add channels for dependencies and our library
conda config --add channels conda-forge
conda config --add channels slsdetectorgroup
conda config --set channel_priority strict
conda install slsdetlib #only shared lib and command line
conda install slsdet #python bindings (includes slsdetlib)
conda install slsdetgui #gui (includes qt4)
#Install specific version
conda install slsdet=2020.03.02.dev0 #developer version from 3 March 2020
#create and activate an environment with our library
#replace 6.1.1 with the required tag
conda create -n myenv slsdetlib=6.1.1
conda activate myenv
#ready to use
sls_detector_get exptime
etc ...
```
### Source code
One can also obtain the source code from this repository and compile.
```
git clone https://github.com/slsdetectorgroup/slsDetectorPackage.git
# List available versions
# lib and binaries
conda search slsdetlib
# python
conda search slsdet
# gui
conda search slsdetgui
```
### 2. Build from source
##### 2.1 Download Source Code from github
```
git clone https://github.com/slsdetectorgroup/slsDetectorPackage.git --branch 7.0.0
```
**Pybind for Python**<br>
* **v7.0.0+**:
pybind11 packaged into 'libs/pybind'. No longer a submodule. No need for "recursive" or "submodule update".
* **Older versions**:
pybind11 is a submodule. Must be cloned using "recursive" and updated when switching between versions using the following commands.
```
#### Dependencies
# clone using recursive to get pybind11 submodule
git clone --recursive https://github.com/slsdetectorgroup/slsDetectorPackage.git
Refer [this page](https://slsdetectorgroup.github.io/devdoc/dependencies.html) for dependencies.
#### Compilation
Compiling can be done in two ways. Either with the convenience script
cmk.sh or directly with cmake for more control.
**1. Compile using script cmk.sh**<br>
These are mainly aimed at those not familiar with using ccmake and cmake.
# update submodule when switching between releases
cd slsDetectorPackage
git submodule update --init
```
The binaries are generated in slsDetectorPackage/build/bin directory.
Usage: ./cmk.sh [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [m] [n] [-h] [z] [-d <HDF5 directory>] [-l Install directory] [-k <CMake command>] [-j <Number of threads>]
-[no option]: only make
-c: Clean
-b: Builds/Rebuilds CMake files normal mode
-p: Builds/Rebuilds Python API
-h: Builds/Rebuilds Cmake files with HDF5 package
-d: HDF5 Custom Directory
-k: CMake command
-l: Install directory
-t: Build/Rebuilds only text client
-r: Build/Rebuilds only receiver
-g: Build/Rebuilds only gui
-s: Simulator
-u: Chip Test Gui
-j: Number of threads to compile through
-e: Debug mode
-i: Builds tests
-m: Manuals
-n: Manuals without compiling doxygen (only rst)
-z: Moench zmq processor
##### 2.2 Build from source
###### Build using CMake
```
# outside slsDetecorPackage folder
mkdir build && cd build
# configure & generate Makefiles using cmake
# by listing all your options (alternately use ccmake described below)
# cmake3 for some systems
cmake ../slsDetectorPackage -DCMAKE_INSTALL_PREFIX=/your/install/path
# compiled to the build/bin directory
make -j12 #or whatever number of cores you are using to build
# install headers and libs in /your/install/path directory
make install
```
Instead of the cmake command, one can use ccmake to get a list of options to configure and generate Makefiles at ease.
```
# ccmake3 for some systems
ccmake ..
# choose the options
# first press [c] - configure
# then press [g] - generate
```
|Example cmake options|Comment|
|---|---|
| -DSLS_USE_PYTHON=ON | Python |
| -DPython_FIND_VIRTUALENV=ONLY | Python from only the conda environment |
| -DZeroMQ_HINT=/usr/lib64 | Use system zmq instead |
| -DSLS_USE_GUI=ON | GUI |
###### Build using in-built cmk.sh script
```
The binaries are generated in slsDetectorPackage/build/bin directory.
Usage: ./cmk.sh [-b] [-c] [-d <HDF5 directory>] [e] [g] [-h] [i] [-j <Number of threads>]
[-k <CMake command>] [-l <Install directory>] [m] [n] [-p] [-q <Zmq hint directory>]
[r] [s] [t] [u] [z]
-[no option]: only make
-b: Builds/Rebuilds CMake files normal mode
-c: Clean
-d: HDF5 Custom Directory
-e: Debug mode
-g: Build/Rebuilds gui
-h: Builds/Rebuilds Cmake files with HDF5 package
-i: Builds tests
-j: Number of threads to compile through
-k: CMake command
-l: Install directory
-m: Manuals
-n: Manuals without compiling doxygen (only rst)
-p: Builds/Rebuilds Python API
-q: Zmq hint directory
-r: Build/Rebuilds only receiver
-s: Simulator
-t: Build/Rebuilds only text client
-u: Chip Test Gui
-z: Moench zmq processor
# get all options
./cmk.sh -?
# display all options
./cmk.sh -?
# new build and compile in parallel:
./cmk.sh -bj5
```
**2. Compile without script**<br>
Use cmake to create out-of-source builds, by creating a build folder parallel to source directory. This would create a debug build with address sanitizers.
```
$ mkdir build
$ cd build
$ cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_SANITIZER=ON
$ make -j12 #or whatever number of threads wanted
# new build and compile in parallel (recommended basic option):
./cmk.sh -cbj5
# new build, python and compile in parallel:
./cmk.sh -cbpj5
#To use the system zmq (/usr/lib64) instead
./cmk.sh -cbj5 -q /usr/lib64
```
To install binaries using CMake
###### Build on old distributions
If your linux distribution doesn't come with a C++11 compiler (gcc>4.8) then
it's possible to install a newer gcc using conda and build the slsDetectorPackage
using this compiler
```
git clone --recursive https://github.com/slsdetectorgroup/slsDetectorPackage.git
mkdir build && cd build
cmake ../slsDetectorPackage -DCMAKE_INSTALL_PREFIX=/your/install/path
make -j12 #or whatever number of cores you are using to build
make install
#Create an environment with the dependencies
conda create -n myenv gxx_linux-64 cmake zmq
conda activate myenv
# outside slsDetecorPackage folder
mkdir build && cd build
cmake ../slsDetectorPackage -DCMAKE_PREFIX_PATH=$CONDA_PREFIX
make -j12
```
###### Build slsDetectorGui (Qt5)
1. Using pre-built binary on conda
```
conda create -n myenv slsdetgui=7.0.0
conda activate myenv
```
2. Using system installation on RHEL7
```
yum install qt5-qtbase-devel.x86_64
yum install qt5-qtsvg-devel.x86_64
```
3. Using conda
```
#Add channels for dependencies and our library
conda config --add channels conda-forge
conda config --add channels slsdetectorgroup
conda config --set channel_priority strict
# create environment to compile
# on rhel7
conda create -n slsgui zeromq gxx_linux-64 gxx_linux-64 mesa-libgl-devel-cos6-x86_64 qt
# on fedora or newer systems
conda create -n slsgui zeromq qt
# when using conda compilers, would also need libgl, but no need for it on fedora unless maybe using it with ROOT
# activate environment
conda activate slsgui
# compile with cmake outside slsDetecorPackage folder
mkdir build && cd build
cmake ../slsDetectorPackage -DSLS_USE_GUI=ON
make -j12
# or compile with cmk.sh
cd slsDetectorPackage
./cmk.sh -cbgj9
```
###### Build documentation from package
The documentation for the slsDetectorPackage is build using a combination
of Doxygen, Sphinx and Breathe. The easiest way to install the dependencies
is to use conda
```
conda create -n myenv python sphinx_rtd_theme breathe
```
```
# using cmake or ccmake to enable DSLS_BUILD_DOCS
# outside slsDetecorPackage folder
mkdir build && cd build
cmake ../slsDetectorPackage -DSLS_BUILD_DOCS=ON
make docs # generate API docs and build Sphinx RST
make rst # rst only, saves time in case the API did not change
```
### Support
## Support
dhanya.thattil@psi.ch
erik.frojdh@psi.ch
erik.frojdh@psi.ch

View File

@ -1,838 +1,139 @@
SLS Detector Package Minor Release 7.0.0.rc1 released on 12.12.2021
===================================================================
SLS Detector Package Major Release 7.0.3 released on 14.11.2023
===============================================================
This document describes the differences between v7.0.0.rc1 and v6.1.2
This document describes the differences between v7.0.3 and v7.0.2
CONTENTS
--------
1. New, Changed or Resolved Features
1.1. Compilation
1.2. Callback
1.3. Python
1.4. Client
1.5. Detector Server
1.6. Simulator
1.7. Receiver
2. On-board Detector Server Compatibility
3. Firmware Requirements
4. Kernel Requirements
5. Download, Documentation & Support
1 Resolved Issues
2 On-board Detector Server Compatibility
3 Firmware Requirements
4 Kernel Requirements
5 Download, Documentation & Support
1 Resolved Issues
=================
1. New or Changed Features
==========================
Firmware
--------
1.1. Compilation
----------------
* [Eiger] Blocking trigger on quad
Previously, blocking software trigger on a quad was not blocking. Fixed
with firmware v32.
General:
Client
------
* Custom location to find ZeroMQ
Option to provide a custom location to look for ZeroMQ, if not found
using FindZeroMQ.cmake
For example, to use the system installed zmq:
Using cmake: -DZeroMQ_HINT=/usr/lib64
Using cmk.sh script: -q /usr/lib64
* Limit port number max to 65535
Previously, one could set the port numbers (TCP, UDP, ZMQ) to values
higher than 65535 and also to 0. However, it was truncated to 16 bit
in the background, but not relayed to the user.
Now, it will throw if it is 0 or greater than 65535 (16 bit).
* Support external build
Assuming already installed version of the slsDetectorPacakge exists,
external build of python bindings, gui, ctbgui and moench has been added.
* Stopping acqusition for a single or subset of modules
The Detector API previously stopped all modules.
Now, it takes into account which modules the user wanted to stop.
* Catch updated to latest 2.x version due to build failure in fedora
* [Jungfrau] Stop in sync mode
When stopping acquisition in sync mode, only the master module sometimes
returns 'Idle' state instead of 'Stopped'. The software threw an
exception for the different states then.
Now, it does not throw and a fix will be added to the next firmware
release for the different states (with SW release: v8.0.0).
Gui:
* [Eiger] Incorrect error message in Stop
When stopping acquisition, if a half module were to give an error in a
rare case while the others succeeded, this would result in an re-attempt
to stop 9 more times before throwing an incorrect exception messsage that
it could not stop.
Now, it is handled and will throw an exception of the error status
immediately.
* Qt5 and in-built compressed Qwt 6.1.5
Ported from Qt4 to Qt5. Minimum requirement: Qt 5.9
Compressed Qwt 6.1.5 added into the package in libs. It is unpacked and built
as a static library.This allows us to remove qwt as an external dependency
and reduces the risk of picking up the wrong version.
Receiver
--------
Python:
* Install python extension
Option to copy the python extension (slsdet folder and _slsdet-..so)
to CMAKE_INSTALL_PREFIX/python using
-DSLS_INSTALL_PYTHONEXT
* Pybind11 (v2.10.0)
Pybind11 is removed as a submodule and instead built into package to
simplify for users. Now, there is no more need to clone with the '--recursive'
argument or to update submodule when switching to this package version
and above.
* Conda packages
Removed conda packages for python 3.6 and 3.7. Added for python 3.11.
1.2. Callback
-------------
* Datatype of Metadata [registerCallBackRawDataReady, registerCallBackRawDataModifyReady]
Datatype changed from char* to sls_receiver_header.
* Datatype of Size [registerCallBackRawDataReady, registerCallBackRawDataModifyReady]
Datatype changed from uint32_t to size_t
* Datatype of file name and file path [registerCallBackStartAcquisition]
Datatype changed from string to const string reference.
* Incorrect image size [registerCallBackStartAcquisition]
Fixed. It used to give +120 bytes.
* [Gotthard2] 25um Image reconstruction for 2 modules
First module (master) interleaves with second modules(slave). First channel
of master is first channel of detector.
Requires firmware update to reverse channels of slaves.
1.3. Python
-----------
* Defines in sls_detector_defs
sls_detetor_defs parsed and #defines extracted into defines.py
For exmaple, one can use slsdet.LOCALHOST_IP
* Python sub-microsecond resolution
Reading back sub-microsecond exposure times from the Python API fixed by
addig Python datetime supports only micro seconds as lowest unit.
This is fixed by introducing a new C++ type (DurationWrapper), which
holds number of nanoseconds as a uint64_t (only in python bindings) and
custom typecaster to convert to and from std::chrono::nanoseconds.
A get using API now returns in DurationWrapper, instead of datetime.
Refer exptime help for examples.
1.4. Client
-----------
Breaking API:
* Versioning
The client, receiver and detector servers now have semantic Versioning
along with the date and are managed with the Version class.
--version argument to the executable gives the complete versioning with date.
Using the client to get versions gives only the semantic version. An older
server will still give date. Hence, the return type is a string, breaking API.
Compatibility checks at hostname or rx_hostname command will only be for
backwards compatibility (ie. it only checks for the major version number).
If its an old server, then its expected to have the exact same date (as
before)
Setting intitialchecks to 0 also bypasses the receiver compatibility check.
* Detector Specific fields
bunchid ->detSpec1
reserved->detSpec2
debug->detSpec3
roundRnumber->detSpec4
Header version number stays the same in the UDP header as there is no
difference in the format from the detector. Only the structure memeber names
have changed in sls_detector_defs.h
Further details about each detector specific field can be found at:
https://slsdetectorgroup.github.io/devdoc/udpdetspec.html
* Namespace sls
All files in slsSupportLib and tests have now been moved to sls namespace
including macros. Using the LOG, for example, will require the sls qualifier.
* [Eiger] Number of UDP interfaces
Command line: numinterfaces, API: getNumberofUDPInterfaces
This command now reflects the actual number of udp interfaces for Eiger,
which is 2.
* [Eiger][Jungfrau] Row column
[Jungfrau] Fixed row column indexing for multi module 2 interfaces
[Eiger] The row indicies were switched across the Y axis for the callback
only for Eiger. This is now changed and kept similar to the other detectors.
The row indices would be in the order of the half modules in the hostname
command. Therefore, to keep the image from callback, invert the hostname
order in the config file.
* Deprecated CopyDetectorServer
Command line: copydetectorserver, API: copydetectorserver
Removed. Use updatedetectorserver
* [Eiger][Jugfrau][Mythen3] Deprecated specific transmission delay commands
txndelay_frame -> txdelay_frame
txndelay_left -> txdelay_left
txndelay_right -> txdelay_right
* [Eiger] Datastream only for 10GbE
Command line: datastream, API: getDataStream/ setDataStream
This command to enable/ disable data stream from left or right port
is now allowed only for 10GbE. Previously, it incorrectly allowed to do so.
* [Eiger][Jungfrau][Moench][Ctb] Stop command effect on next frame number
Stopping acquisition sometimes results in different next frame numbers
for different moduels. Hence, after a stop, if the next frame numbers are
different, they are all set to their maximum value + 1.
* Missing packets
Command line: rx_missingpackets, API: getNumMissingPackets
This now returns a signed 64 bit instead of unsigned. The negative polarity
depicts extra packets instead of missing packets and also takes care of
disabled ports.
* Frames caught and frame index
Command line rx_framescaught, rx_frameindex, API: getFramesCaught/ getRxCurrentFrameIndex
They now return a vector for each port when there are 2 udp interfaces
in the receiver.
* [Gotthard][Gotthard2] Num modules
Only 2 modules allowed maximum in a detector shared memory.
* [Moench][Ctb][Mythen3] Deprecated commands
Patloopx, patnloopx, patwaitx, patwaittimex
Please use instead patloop, patnloop, patwait and patwaittime commands
with the level as an argument.
Old commands work with warning, but the server expects the new ones
such as a default pattern file to be loaded at startup for Moench.
Renamed patternParameters struct member from 'loop' to 'startloop' and
'stoploop'.
* [Mythen3] Clock Divider 4 and 5
Cannot be set anymore. Only read back.
New commands:
* [Eiger][Gotthard][Gotthard2][Mythen3][Jungfrau] Master
Setting up from client:
[Eiger][Gotthard2][Jungfrau]
Command line: master, API: getMaster/ setMaster
All of them can get master mode from the client.
This can also be set up on the detector server. Please refer to notes
on that section.
* [Eiger] Top
Command line: top, API: getTop/ setTop
Sets the half module to top or bottom from the client.
This can also be set up on the detector server. Please refer to notes
on that section.
* [Mythen3][Eiger] Save settings file
Command line: trimbits (sls_detector_get), API: saveTrimbits
Added
* [Gotthard2] Parallel readout added
Command line: parallel, API: getParallelMode/ setParallelMode
Default for Gotthard2 is parallel. Non parallel mode only works in
continuous mode.
* [Jungfrau] Software trigger added
Command line: trigger, API: sendSoftwareTrigger
Send software trigger instead of harware trigger.
* [Eiger][Jungfrau] Blocking trigger
Commandline: blockingtrigger, API: sendSoftwareTrigger with argument true
Sends software trigger signal to detector and blocks until the frames
are sent out for that trigger.
* [Jungfrau] Sync
Command line: sync, API: getSynchronization/ setSynchronization
Enables or disables synchronization between modules
* [Gotthard2][Mythen3] Temperature readout
Command line: temp_fpga, API: getTemperature with TEMPERATURE_FPGA enum
Added
* [Gotthard2][Mythen3] Round robin added
Command line: udp_dstlist, API: getDestinationUDPList/ setDestinationUDPList
Command line: udp_numdst, API: getNumberofUDPDestinations
One can set up to 32 (64 for Mythen3) entries in the destination list.
* [Jungfrau] Module Id
Command line: moduleid, API: getModuleId
16 bit value (ideally unique) that is streamed out in the udp header of
the detector. The on-board detector server picks it up from a file
(if it exists) called detid_jungfrau.txt.
* [Jungfrau][[Gotthard2][Myhten3][Gotthard][Ctb][Moench] Hardware version
Command line: hardwareversion, API: getHardwareVersion
Gets the board or hardware version.
For example, Jungfrau returns 1.0 or 2.0.
It is also printed at on-board detector server start up.
Also printed before starting FPGA programming.
* [Eiger][Jugfrau][Mythen3] Transmission Delay
Command line: tx_delay, API: getTransmissionDelay/ setTransmissionDelay
Sets transmission delay for all modules in the detector using the step
size provided. Sets up for every module:
[Eiger] txdelay_left to (2 * mod_index * n_delay)
[Eiger] txdelay_right to ((2 * mod_index + 1) * n_delay)
[Eiger] txdelay_frame to (2 *num_modules * n_delay)
[Jungfrau][Mythen3] txdelay_frame to (num_modules * n_delay)
* [Mythen3] Bad channels
Command line: badchannels, API: getBadChannels/ setBadChannels
Set bad channels from file with a list of channels, which will be masked
out. Also does trimming. A detector level command will require the channel
numbers accordingly. The file also extended to include commas, colons range)
and removes duplicates.
* [Moench][Ctb] Starting frame number
Command line: nextframenumber, API: getNextFrameNumber/ setNextFrameNumber
Added and default set up on detector server start up.
* [Ctb] DAC names
Command line: daclist, API: getDacNames/ setDacNames
Can set and get dac names in the dac list now.
* [Mythen3] Polarity, interpolation, pump probe, analog pulsing, digital pulsing
Command line: polarity, interpolation, pumpprobe, apulse, dpulse
API: getPolarity/ setPolarity, getInterpolation/ setInterpolation,
getPumpProbe/ setPumpProbe, getAnalogPulsing/ setAnalogPulsing,
getDigitalPulsing/ setDigitalPulsing
Added these commands.
Enabling interpolation will also enable all counters and disable vth3.
Disabling sets to previous counter mask and previous vth values.
In pump probe mode, only vth2 enabled. Disabling sets vth2 to prevevious
value.
Setting counter mask will check interpolation and pump probe mode
requirements, else sets vthx dacs according to counter mask.
Direct overwrite of any dac (including vthx) allowed using dac command
(as before).
New commands for Receiver only:
* Arping for 10GbE
Command line: rx_arping API: getRxArping/ setRxArping
Starts a thread in the receiver to arping the interface it is listening
to in 10GbE mode every 60 s.
Changes NUM_RX_THREAD_IDS (sls_detector_defs.h) from 8 to 9.
* Receiver Region of Interest
Command line: rx_roi, API: getRxROI/ setRxROI
Command line: rx_clearroi, API: clearRxROI
One can set an ROI in the receiver to write to file. 1D detectors can set
xmin and xmax, whereas the 2D can also set ymin and ymax. -1 values signify
no ROI.
This is not at network level and can only be used to reduce size of file.
Virtual HDF5 files not created when this is enabled and also no link in
master file. No file created if module not in ROI.
There can only be one ROI per detector. Therefore, can be set only at
detector level, but can be retrieved at module level as well.
The GUI still shows the entire image, but has a yellow border around the
ROI. Status bar displays a message when Rx ROI enabled.
Additonal Features:
* Non-blocking start
Allowing non-blocking start at modular level again.
* [Jungfrau][Moench][Ctb] Additional programming checks
Also checks if the drive to write to is a special file or a normal
file. If its a normal file, it throws asking to redo the command with a
'--please-delete' argument to delete the normal file and create the device
drive and restart FPGA programming.
More readable error message insetad of "programfpga not implemented for
this detector'. This happens when 'hostname' command fails due to
server-firmware/client compatibility and the detector type becomes
'GENERIC'. Fixed to suggest if 'hostname' executed properly.
* Udp Source IP
Command line: udp_srcip(2), API: getSourceUDPIP(2)/ setSourceUDPIP(2)
One can also set this to 'auto' for 1 GbE data. It will set to IP of
rx_hostname (as in udp_dstip)
* Incrementing default receiver tcp port
Automatically incrementing the default receiver tcp port for every module
when creating shared memory.
* Limit TCP port number (command line) to max of 65535
Refer issue under 'Client'.
Changes or Fixes:
Detector Simulator
------------------
* [Jungfrau][Gotthard2][Mythen3][Gotthard][Moench][Ctb] Can't stop
This bug was introduced in 6.1.1, when stopping an acquisition saying it
cannot stop, even though it was successful. It is fixed now.
* Limit TCP port number (command line) to max of 65535
Refer issue under 'Client'.
* Free and config command fail
Free and config command checked mismatch of size of shared memory before
freeing or loading new config. Fixed.
* Some commands such as 'readnrows' would complain that it cannot be set
because the detector is not idle, but was setting it anyway. Fixed.
* sls_detector_help or sls_detector_get -h
Should not create Detector object. Fixed.
Gui/ Client Callback
--------------------
* [Jungfrau] Storage cells in running receiver
Allowing the possibility to set this when receiver in running state.
* [Jungfrau] Gui: corrected color map of gain plot
Previously, color on the gain plot did not update after the first image,
unless there were x/y min/max changes or window resizing. Fixed.
* [Eiger] Vtr
Allow Vtrim to be interpolated for settings.
* [Jungfrau] Acquisition finished callback error status in sync mode
When stopping acquisition in multi module Jungfrau sync mode,
different status (master 'idle' and slaves 'stopped' in
firmware 2.4.1 or 1.4.1) show as 'error' in acquisition finished call
back (mainly used for gui). This is fixed.
* [Mythen3] Incorrect gain caps when setting threshold energy
Gain caps overwritten with settings enum. Fixed.
* [Jungfrau] Gui: Next frame number shown as 0 for inconsistency
When stopping an acquisition in a multi module Jungfrau, the next
frame numbers might be different, for which the Gui shows an error message
but keeps the number as 0. Now, it is fixed to show -1 for inconsistency
and error message shown. So, setting 0 will also prompt an error message
that 0 is an invalid input.
* [Mythen3] Non blocking start acquisition
Non-blocking start acquisition was sent out twice to the master. Fixed.
Data Processing
---------------
* [Mythen3] Threshold
When settings trimbits or threshold, counter mask is set and hence,
vthx dacs are set accordingly.
* [Moench] Segmentation fault with moench03RawDataPrcess
Previously, it crashed when nframes > 0. Fixed.
setAllThresholdEnergy takes 3 values for each counter and if one of them
is -1, the trimbits and setings for that counter is picked up from the
detector.
* [Moench] Interpolation issues fixed.
* [Moench][Ctb] Pattern levels
Changed from 3 to 6.
* [Moench] When receiver in discard_partial mode and gets an empty frame,
it sends a zmq packet with header and no data. This is handled in post
processing as a temporary solution.
* [Mythen3][Moench][Ctb] Default patwait and patloop addresses
Set default wait and loop addresses to 0x1fff (max value) for all levels
before loading pattern. Please use the pattern command instead of parameters.
This ensures defaults are set up and is faster.
* [Moench] Patsetbit and patsetmask
Command line: patsetbit API: getPatternBitMask/ setPatternBitMask
Command line: patmask API: getPatternMask/ setPatternMask
Exchanging the help and masks for patsetbit and patsetmask in the detector
server, especially in loading settings.
* [Moench][Ctb] ADC Vpp
Command line: adcvpp, API: getADCVpp/ setADCVpp
Moved from SetDAC function into into its own. One can use mV values or
option numbers as before.
* [Ctb] ADC command goes back to control server
Slow ADCs, slow ADC temperature, get measured current and voltage values
are requested via the control server again insetad of the stop server
due to configuration and definitions in the control server.
1.5. Detector Server
--------------------
Config file:
* [Eiger][Gotthard2][Gotthard] Master
Using config file with 'master' with argument (master=1, slave=0)
* [Eiger] Top
Using config file with 'top' with argument (top=1, bottom=0)
Command line arguments:
* They have precedence over config files.
* [Eiger][Gotthard2 Virtual][Mythen3 Virtual][Gotthard Virtual] Master
Using command line '--master = 1' or '-m = 1' with argument
(master = 1, slave = 0)
* [Eiger] Top
Using command line '--top = 1' or '-t = 1' with argument (top=1, bottom=0)
* Ignore config file
The config files can also be ignored by an argument from the command line,
'--ignore-config' or '-i'.
Fixes:
* [Jungfrau][Eiger] Clear UDP destination
Command line: udp_cleardst, API: clearUDPDestinations
Clearing udp destination also clears it in the FPGA now.
* [Eiger] Incorrect next frame number
Command line: nextframenumber, API: getNextFrameNumber/ setNextFrameNumber
Get next frame number for 10g was connected to 1g registers and gave
incorrect values. Fixed.
* [Mythen3][Gotthard2] System clock change effects
When changing the system clock (clkdiv 2), time settings should also be
affected (exptime, period etc.). Fixed.
[Gotthard2] System frequency should be same irrespective of timing source.
Fixed.
* [Mythen3] Kernel version compatibility test
Fix added to parse properly the kernel version with CET for corrected
version compatibility test.
* [Mythen3] Server crash for setting vthrehsold
Fixed.
* [Mythen3] Incorrect gaincaps
Setting threshold energy was overwriting gaincaps with settings enum. Fixed.
* [Ctb][Moench] Hostname fail in update mode.
Fixed
Changes:
* [Jungfrau] Temporary fix for stop in 6.1.1
Temporary fix introduced in 6.1.1 for not being able to start after a
stop command has been issued is removed. Reset core right after also has
been removed. It has been fixed in firmware instead.
* [Gotthard2] Clock Divider defaults
When chancing burst mode, clock dividers (2, 3 and 4) set to their
defaults according to burst mode.
* [Mythen3] DAC check for settings
Verify DAC values for each setting has been temporarily switched off
* [Mythen3] DAC min and max values
Vtrim minimum of 600 has been removed.
The threshold dacs minimum is 200 and maximum is 2400.
The other DACs minimum is 0 and maximum is 2800.
When out of range, will not throw, just a warning.
* [Mythen3] Vicin Dac changed to 800
* [Jungfrau][Moench][Ctb] PLL reset at server start up
PLL reset now at server start up.
* [Moench] ADC9257 Vref
ADC Vref voltage modified from 1.33V to 2V
* [Ctb] Allow all clock dividers for PLL
Fixed. For example, 133 MHz would not really be set previously. Fixed by
changing totaldiv from float to an integer.
Additional Features:
* Stop server startup errors
Stop servers now also check for errors at startup (including version
compatibility) and like the control server, it will translate to the
client when connecting for the first time (hostname command).
* [Jungfrau][Moench][Ctb] Additional server update process
Removes old server binary or target of linked file when updating
detector server for blackfin detectors as there is less space on blackfin.
Clearing up absolute and respawn path (removing double '/')
Raise error if server name to be copied is the same as final soft link name.
* [Moench][Ctb] 1 GbE Non blocking acquisition
Previously non blocking acquisition in 1 GbE would not send data.
This feature added now.
* [Gotthard2] Adapted to new HDI version
HDI module ID written to FPGA register
1.6. Simulator
--------------
* Command line arguments. Please refer to previous section on Detector Server.
* [Eiger] Only one executable
Only one executable for an Eiger virtual server. Master and top mode
can be provided via command line or config file to the detector server,
as well as via the client. See in Other New Features for more details.
One can start a module using:
eigerDetectorServer_virtual # reads default config file (top master)
eigerDetectorServer_virtual -i #ignores the config file (bottom slave)
* [Eiger][Junfrau][Gotthard2][Mythen3] Module Id
Added into udp header
* Minimum Configuration
One can setup with just:
hostname localhost
rx_hostname localhost
udp_dstip auto
* [Mythen3] Packet size
Fixed packet size calculation. Previously, sending only header with no data.
1.7. Receiver
-------------
Breaking API:
* Namespace sls
All the receiver source files have also been added to namespace sls.
* HDF5 and Binary writer version
Changed from 6.3 to 6.4
* Master file format to json
The format has been changed from ASCII to json.
* Geometry metadata
Added geometry (number of modules in each direction) to metadata in file.
* HDF5 Dataset name
Changed to just "data" to simplify for user
* File write
File write is disabled by default.
Fixes:
* Refactored and fixed minor issues
Including memory structure and udp sockets.
Fixed progress also in discard partial packaets mode and deactivated ports.
Fixed 200% progress.
Completely padded images now have detector type or version in metadata.
Fixed getting stuck at stop receiver when using zmq
Fixed clang compiler warnings
* Multiple files
This bug was introduced in v6.0.0, where 1 file was created per frame
after the first file. Fixed by resetting the number of frames in
current file when creating a new one.
* [Eiger] Datastream command order
The order of commands to set datastream from client mattered previously.
Datastream had to be set before 10GbE enable. Order does not matter anymore.
* Udp destination MAC
If it has been set before, changing udp_dstip will not update udp_dstmac.
Fixed to always set it in detector even if it had a value before.
Udp_dstmac can still be used to overwrite again. This is useful when
using a router for example.
* Stuck when using zmq
More often in 6.1.1, gets stuck at stop receiver.
* [Mythen3] Incorrect number of packets calculated or tengiga not set up
Runnig config second time (with tengiga=0, dr !=32, counters !=0x7)
calculated incorrect image size expected due to inconsistent copy of
detector parameters. Fixed
* Storage cells in receiver
Previously not updated in receiver. Fixed.
* Virtual HDF5 Parameter datasets
Corner case bug when frames caught is not a multiple of frames per file.
Not found in virtual image datasets. Fixed.
Changes:
* Master file created at end of acquisition
The file is now written at the end of acquisition. So if any metadata
is changed during an acquisition, it will reflect the last value.
* File name prefix
Slash '/' not allowed.
Additional Features:
* [Gotthard2] 25um image reconstruction in virtual HDF5
Virtual HDF5 reconstructs complete image by interleaving first module
(master) with second module (slave). First channel of master is first
channel of detector.
Requires firmware update to reverse channels of slaves.
* Memory size
Increased an internal fifo header by 8 bytes to align memory allocated for
to receive images for efficiency.
1.8. Gui
--------
* [Jungfrau][Eiger] Gap pixels
Enabled by default in the gui.
* High voltage moved from Developer tab to Settings tab.
* Gain plot zooming
Zooming disabled. Instead, it automatically zooms in when you zoom in
the main plot or if min and max of x and y axis set up in plot tab.
* [Mythen3] Inconsistent timing mode
Timing mode of the slaves should be discarded before squashing. Fixed.
* [Mythen3][Gotthard2] Crashes
Additional locking Added
2. On-board Detector Server Compatibility
2 On-board Detector Server Compatibility
==========================================
Eiger 7.0.0
Jungfrau 7.0.0
Mythen3 7.0.0
Gotthard2 7.0.0
Gotthard 7.0.0
Moench 7.0.0
Ctb 7.0.0
Eiger 7.0.3
Jungfrau 7.0.3
Mythen3 7.0.3
Gotthard2 7.0.3
Gotthard 7.0.3
Moench 7.0.3
Ctb 7.0.3
On-board Detector Server Upgrade
@ -849,25 +150,25 @@ This document describes the differences between v7.0.0.rc1 and v6.1.2
3. Firmware Requirements
3 Firmware Requirements
========================
Eiger 17.02.2022 (v30)
Eiger 02.10.2023 (v32) (updated in 7.0.3)
Jungfrau 04.11.2022 (v1.4, HW v1.0)
03.11.2022 (v2.4, HW v2.0)
Jungfrau 16.05.2023 (v1.4.1, HW v1.0) (updated in 7.0.2)
15.05.2023 (v2.4.1, HW v2.0) (updated in 7.0.2)
Mythen3 05.12.2022 (v1.4)
Mythen3 24.01.2023 (v1.4) (updated in 7.0.0)
Gotthard2 23.11.2022 (v0.3)
Gotthard2 23.11.2022 (v0.3) (updated in 7.0.0)
Gotthard 08.02.2018 (50um and 25um Master)
09.02.2018 (25 um Slave)
Moench 05.12.2022 (v0.3)
Moench 05.12.2022 (v0.3) (updated in 7.0.0)
Ctb 05.12.2022 (v1.1)
Ctb 05.12.2022 (v1.1) (updated in 7.0.0)
Detector Upgrade
@ -898,22 +199,22 @@ This document describes the differences between v7.0.0.rc1 and v6.1.2
4. Kernel Requirements
4 Kernel Requirements
======================
Blackfin
========
--------
Latest version: Fri Oct 29 00:00:00 2021
Older ones will work, but might have issues with programming firmware via
the package.
Nios
====
-----
Compatible version: Mon May 10 18:00:21 CEST 2021
Kernel Upgrade
==============
---------------
Eiger via bit files
Others via command
@ -926,7 +227,7 @@ This document describes the differences between v7.0.0.rc1 and v6.1.2
5. Download, Documentation & Support
5 Download, Documentation & Support
====================================
Download
@ -982,6 +283,9 @@ This document describes the differences between v7.0.0.rc1 and v6.1.2
https://slsdetectorgroup.github.io/devdoc/udpheader.html
https://slsdetectorgroup.github.io/devdoc/udpdetspec.html
slsReceiver Zmq Format:
https://slsdetectorgroup.github.io/devdoc/slsreceiver.html#zmq-json-header-format
TroubleShooting:
https://slsdetectorgroup.github.io/devdoc/troubleshooting.html
https://slsdetectorgroup.github.io/devdoc/troubleshooting.html#receiver-pc-tuning-options

2
cmk.sh
View File

@ -33,7 +33,7 @@ Usage: $0 [-b] [-c] [-d <HDF5 directory>] [e] [g] [-h] [i] [-j <Number of thread
-c: Clean
-d: HDF5 Custom Directory
-e: Debug mode
-g: Build/Rebuilds only gui
-g: Build/Rebuilds gui
-h: Builds/Rebuilds Cmake files with HDF5 package
-i: Builds tests
-j: Number of threads to compile through

View File

@ -3,6 +3,5 @@ python:
- 3.9
- 3.10
- 3.11
- 3.12
numpy:
- 1.17

View File

@ -116,12 +116,16 @@ Program from console
# Always ensure that the client and server software are of the same release.
# copies server from tftp folder of pc, links new server to jungfrauDetectorServer,
# copies server, links new server to jungfrauDetectorServer,
# removes old server from respawn, sets up new lnked server to respawn
# programs fpga,
# reboots
# programs fpga, reboots
# v5.0.0 - 6.0.0 (copies server from tftp folder of the pc)
sls_detector_put update jungfrauDetectorServervxxx pcxxx xx.pof
# v6.1.1 - present (copies server from the full path provided)
sls_detector_put update jungfrauDetectorServervxxx xx.pof
# Or only program firmware
sls_detector_put programfpga xxx.pof
@ -182,11 +186,16 @@ Program from console
# Always ensure that the client and server software are of the same release.
# copies server from tftp folder of pc, links new server to mythen3DetectorServer,
# programs fpga,
# reboots
# copies server, links new server to mythen3DetectorServer,
# removes old server from respawn, sets up new lnked server to respawn
# programs fpga, reboots
# v5.0.0 - 6.0.0 (copies server from tftp folder of the pc)
sls_detector_put update mythen3DetectorServervxxx pcxxx xxx.rbf
# v6.1.1 - present (copies server from the full path provided)
sls_detector_put update mythen3DetectorServervxxx xxx.rbf
# Or only program firmware
sls_detector_put programfpga xxx.rbf
@ -211,11 +220,16 @@ Program from console
# Always ensure that the client and server software are of the same release.
# copies server from tftp folder of pc, links new server to gotthard2DetectorServer,
# programs fpga,
# reboots
# copies server, links new server to gotthard2DetectorServer,
# removes old server from respawn, sets up new lnked server to respawn
# programs fpga, reboots
# v5.0.0 - 6.0.0 (copies server from tftp folder of the pc)
sls_detector_put update gotthard2DetectorServervxxx pcxxx xxx.rbf
# v6.1.1 - present (copies server from the full path provided)
sls_detector_put update gotthard2DetectorServervxxx xxx.rbf
# Or only program firmware
sls_detector_put programfpga xxx.rbf
@ -257,12 +271,16 @@ Program from console
# Always ensure that the client and server software are of the same release.
# copies server from tftp folder of pc, links new server to moenchDetectorServer,
# copies server, links new server to moenchDetectorServer,
# removes old server from respawn, sets up new lnked server to respawn
# programs fpga,
# reboots
# programs fpga, reboots
# v5.0.0 - 6.0.0 (copies server from tftp folder of the pc)
sls_detector_put update moenchDetectorServervxxx pcxxx xx.pof
# v6.1.1 - present (copies server from the full path provided)
sls_detector_put update moenchDetectorServervxxx xx.pof
# Or only program firmware
sls_detector_put programfpga xxx.pof
@ -288,12 +306,16 @@ Program from console
# Always ensure that the client and server software are of the same release.
# copies server from tftp folder of pc, links new server to ctbDetectorServer,
# copies server, links new server to ctbDetectorServer,
# removes old server from respawn, sets up new lnked server to respawn
# programs fpga,
# reboots
# programs fpga, reboots
# v5.0.0 - 6.0.0 (copies server from tftp folder of the pc)
sls_detector_put update ctbDetectorServervxxx pcxxx xx.pof
# v6.1.1 - present (copies server from the full path provided)
sls_detector_put update ctbDetectorServervxxx xx.pof
# Or only program firmware
sls_detector_put programfpga xxx.pof

View File

@ -1,14 +1,3 @@
.. note ::
The default branch of our git repository is developer. It contains the
latest development version. It is expected to compile and work but
features might be added or tweaked. In some cases the API might also change
without being communicated. If absolute stability of the API is needed please
use one of the release versions.
.. warning ::
Before building from source make sure that you have the
@ -161,7 +150,7 @@ Build using in-built cmk.sh script
-c: Clean
-d: HDF5 Custom Directory
-e: Debug mode
-g: Build/Rebuilds only gui
-g: Build/Rebuilds gui
-h: Builds/Rebuilds Cmake files with HDF5 package
-i: Builds tests
-j: Number of threads to compile through
@ -178,17 +167,17 @@ Build using in-built cmk.sh script
-z: Moench zmq processor
# get all options
# display all options
./cmk.sh -?
# new build and compile in parallel:
./cmk.sh -bj5
# new build and compile in parallel (recommended basic option):
./cmk.sh -cbj5
# new build, python and compile in parallel:
./cmk.sh -bpj5
./cmk.sh -cbpj5
#To use the system zmq (/usr/lib64) instead
./cmk.sh -bj5 -q /usr/lib64
./cmk.sh -cbj5 -q /usr/lib64

View File

@ -86,6 +86,194 @@ Client Commands
sls_detector_get -h rx_framescaught
ZMQ: Json Header Format
------------------------
**Change in field names from slsDetectorPackage v6.x.x to v7.0.0**
* detSpec1 <- bunchId
* detSpec2 <- reserved
* detSpec3 <- debug
* detSpec4 <- roundRNumber
**Format**
.. code-block:: bash
{
"jsonversion": unsigned int,
"bitmode": unsigned int,
"fileIndex": unsigned long int,
"detshape": [
unsigned int,
unsigned int
],
"shape": [
unsigned int,
unsigned int
],
"size": unsigned int,
"acqIndex": unsigned long int,
"frameIndex": unsigned long int,
"progress": double,
"fname": string,
"data": unsigned int,
"completeImage": unsigned int,
"frameNumber": unsigned long long int,
"expLength": unsigned int,
"packetNumber": unsigned int,
"detSpec1": unsigned long int,
"timestamp": unsigned long int,
"modId": unsigned int,
"row": unsigned int,
"column": unsigned int,
"detSpec2": unsigned int,
"detSpec3": unsigned int,
"detSpec4": unsigned int,
"detType": unsigned int,
"version": unsigned int,
"flipRows": unsigned int,
"quad": unsigned int,
"addJsonHeader": {
string : string
},
"rx_roi": [
unsigned int,
unsigned int,
unsigned int,
unsigned int
]
}
+--------------+----------------------------------------------+
| Field | Description |
+--------------+----------------------------------------------+
| jsonversion | Version of the json header. |
| | Value at 4 for v6.x.x - v7.0.1 |
| | Value at 5 for v7.0.2 |
+--------------+----------------------------------------------+
| bitmode | Bits per pixel [4|8|16|32] |
+--------------+----------------------------------------------+
| fileIndex | Current file acquisition index |
+--------------+----------------------------------------------+
| detshape | Geometry of the entire detector |
+--------------+----------------------------------------------+
| shape | Geometry of the current port streamed out |
+--------------+----------------------------------------------+
| size | Size of image of current port in bytesout |
+--------------+----------------------------------------------+
| acqIndex | Frame number from the detector (redundant) |
+--------------+----------------------------------------------+
| frameIndex | Frame number of current acquisition |
| | (Starting at 0) |
+--------------+----------------------------------------------+
| progress | Progress of current acquisition in % |
+--------------+----------------------------------------------+
| fname | Current file name |
+--------------+----------------------------------------------+
| data | 1 if there is data following |
| | 0 if dummy header |
+--------------+----------------------------------------------+
| completeImage| 1 if no missing packets for this frame |
| | in this port, else 0 |
+--------------+----------------------------------------------+
| frameNumber | Frame number |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| expLength | subframe number (32 bit eiger) |
| | or real time exposure time in 100ns (others) |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| packetNumber | Number of packets caught for that frame |
+--------------+----------------------------------------------+
| detSpec1 | See :ref:`here<Detector Specific Fields>` |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| timestamp | Timestamp with 10 MHz clock |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| modId | Module Id |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| row | Row number in detector |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| column | Column number in detector |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| detSpec2 | See :ref:`here<Detector Specific Fields>` |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| detSpec3 | See :ref:`here<Detector Specific Fields>` |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| detSpec4 | See :ref:`here<Detector Specific Fields>` |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| detType | Detector type enum |
| detSpec3 | See :ref:`Detector enum<Detector Enum>` |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| version | Detector header version. At 2 |
| | [From detector udp header] |
+--------------+----------------------------------------------+
| flipRows | 1 if rows should be flipped. |
| | Usually for Eiger bottom. |
+--------------+----------------------------------------------+
| quad | 1 if its an Eiger quad. |
+--------------+----------------------------------------------+
| addJsonHeader| Optional custom parameters that is required |
| | for processing code. |
+--------------+----------------------------------------------+
| rx_roi | ROI in the receiver per port (xmin, xmax, |
| | ymin, ymax). For external guis to know |
| | what is saved |
+--------------+----------------------------------------------+
SLS Receiver Header Format
--------------------------
It is 112 bytes and consists of:
* 48 bytes of the SLS Detector Header (described in :ref:`the current detector header <detector udp header>`)
* 64 bytes of packet mask
.. code-block:: cpp
typedef struct {
uint64_t frameNumber;
uint32_t expLength;
uint32_t packetNumber;
uint64_t detSpec1;
uint64_t timestamp;
uint16_t modId;
uint16_t row;
uint16_t column;
uint16_t detSpec2;
uint32_t detSpec3;
uint16_t detSpec4;
uint8_t detType;
uint8_t version;
} sls_detector_header;
struct sls_receiver_header {
sls_detector_header detHeader; /**< is the detector header */
sls_bitset packetsMask; /**< is the packets caught bit mask */
};
.. note ::
| The packetNumber in the SLS Receiver Header will be modified to number of packets caught by receiver for that frame. For eg. Jungfrau will have 128 packets per frame. If it is less, then this is a partial frame due to missing packets.
| Furthermore, the bit mask will specify which packets have been received.
File format
--------------
@ -117,8 +305,6 @@ Some file name examples:
Each acquisition will create a master file that can be enabled/disabled using **fmaster**. This should have parameters relevant to the acquisition.
SLS Receiver Header consist of SLS Detector Header + 64 bytes of bitmask, altogether 112 bytes. The packetNumber in the sls detector header part, will be updated to number of packets caught by receiver for that frame. Furthermore, the bit mask will specify which packets have been received.
**Binary file format**
This is the default file format.

View File

@ -11,7 +11,7 @@ Current Version
**v2.0 (slsDetectorPackage v7.0.0+)**
.. table:: <---------------------------------------------------- 8 bytes ---------------------------------------------------->
.. table:: <---------------------------------------------------- 8 bytes per row --------------------------------------------->
:align: center
:widths: 30,30,30,15,15

6
examples/badchannel.txt Normal file
View File

@ -0,0 +1,6 @@
0
10, 30
40:45 50:52
1279
# all bad channels are applied for all counters in deector

View File

@ -3,33 +3,34 @@
### edit with hostname or IP address of your detector
############################################
#hostname bchip181+
hostname bchip135
hostname bchip076
#############################################
### edit with hostname or 1Gbs IP address of your server
############################################
rx_hostname mpc2011
rx_hostname mpc2011:7777
#############################################
### edit with 10 Gbs IP of your server
############################################
udp_dstip 10.1.1.102
udp_dstip 10.1.2.102
#############################################
### edit with any number in the subnet of your server (first 3 numbers as above)
############################################
udp_srcip 10.1.1.19
udp_dstport 32411
udp_srcip 10.1.2.19
udp_dstport 32777
#############################################
### edit with 10 Gbs IP of your server
############################################
rx_zmqip 10.1.1.102
rx_zmqport 50003
rx_zmqip 10.1.2.102
rx_zmqport 9003
#############################################
### edit with 1 Gbs IP of PC where you will run the GUI
############################################
zmqip 129.129.202.57
zmqport 50001
zmqport 9005
@ -38,7 +39,7 @@ rx_zmqstream 1
frames 100000
frames 1
period 0.0006
exptime 0.00035
@ -49,7 +50,7 @@ fpath /mnt/moench_data/scratch1/
fwrite 0
rx_jsonpara frameMode frame
rx_jsonpara frameMode newPedestal
rx_jsonpara detectorMode counting
rx_discardpolicy discardpartial

View File

@ -1,18 +1,18 @@
# detector hostname
hostname localhost:1910
# receiver hostname
rx_hostname mpc1922:2010
# udp destination ports
udp_dstport 50010
# udp destination ip from rx_hostname
udp_dstip auto
# udp source ip (same subnet as udp_dstip)
udp_srcip 192.168.1.100
# receiver hostname
rx_hostname mpc1922:2010
# udp destination ip from rx_hostname
udp_dstip auto
# output file directory
fpath /tmp
@ -27,418 +27,7 @@ dbitclk 40
# patterns
patword 0x0000 0x0000000000000000
patword 0x0001 0x0000000000000000
patword 0x0002 0x0008000900080000
patword 0x0003 0x0008000900080000
patword 0x0004 0x0008000900080000
patword 0x0005 0x0008000900080000
patword 0x0006 0x0008000900080000
patword 0x0007 0x0008000900080000
patword 0x0008 0x0008000900080000
patword 0x0009 0x0008000900080000
patword 0x000a 0x0008000900080000
patword 0x000b 0x0008000900080000
patword 0x000c 0x0008000900080000
patword 0x000d 0x0008000900080000
patword 0x000e 0x0008000900080000
patword 0x000f 0x0008000900080000
patword 0x0010 0x0008000900080000
patword 0x0011 0x0008000900080000
patword 0x0012 0x0008000900080000
patword 0x0013 0x0008000900080000
patword 0x0014 0x0008000900080000
patword 0x0015 0x0008000900080000
patword 0x0016 0x0008400900080020
patword 0x0017 0x0008400900080020
patword 0x0018 0x0008599f0418503a
patword 0x0019 0x0008599f0418503a
patword 0x001a 0x0108599f0418503a
patword 0x001b 0x0108599f0418503a
patword 0x001c 0x0108599f0418503a
patword 0x001d 0x0108599f0418503a
patword 0x001e 0x0108599f0418503a
patword 0x001f 0x0108599f0418503a
patword 0x0020 0x0108599f0418503a
patword 0x0021 0x0108599f0418503a
patword 0x0022 0x0108599f0418503a
patword 0x0023 0x0108599f0418503a
patword 0x0024 0x0108599f0418503a
patword 0x0025 0x0108599f0418503a
patword 0x0026 0x0108599f0418503a
patword 0x0027 0x0108599f0418503a
patword 0x0028 0x0108599f0418503a
patword 0x0029 0x0108599f0418503a
patword 0x002a 0x0108599f0418503a
patword 0x002b 0x0108599f0418503a
patword 0x002c 0x0108599f0418503a
patword 0x002d 0x0108599f0418503a
patword 0x002e 0x0108599f0418503a
patword 0x002f 0x0108599f0418503a
patword 0x0030 0x0108599f0418503a
patword 0x0031 0x0108599f0418503a
patword 0x0032 0x0108599f0418503a
patword 0x0033 0x0108599f0418503a
patword 0x0034 0x0108599f0418503a
patword 0x0035 0x0108599f0418503a
patword 0x0036 0x0108599f0418503a
patword 0x0037 0x0108599f0418503a
patword 0x0038 0x0108599f0418503a
patword 0x0039 0x0108599f0418503a
patword 0x003a 0x0108599f0418503a
patword 0x003b 0x0108599f0418503a
patword 0x003c 0x0108599f0418503a
patword 0x003d 0x0108599f0418503a
patword 0x003e 0x0108599f0418503a
patword 0x003f 0x0108599f0418503a
patword 0x0040 0x0108599f0418503a
patword 0x0041 0x0108599f0418503a
patword 0x0042 0x0108599f0418503a
patword 0x0043 0x0108599f0418503a
patword 0x0044 0x0108599f0418503a
patword 0x0045 0x0108599f0418503a
patword 0x0046 0x0108599f0418503a
patword 0x0047 0x0108599f0418503a
patword 0x0048 0x0108599f0418503a
patword 0x0049 0x0108599f0418503a
patword 0x004a 0x0108599f0418503a
patword 0x004b 0x0108599f0418503a
patword 0x004c 0x0108599f0418503a
patword 0x004d 0x0108599f0418503a
patword 0x004e 0x0108599f0418503a
patword 0x004f 0x0108599f0418503a
patword 0x0050 0x0108599f0418503a
patword 0x0051 0x0108599f0418503a
patword 0x0052 0x0108599f0418503a
patword 0x0053 0x0108599f0418503a
patword 0x0054 0x0108599f0418503a
patword 0x0055 0x0108599f0418503a
patword 0x0056 0x0108599f0418503a
patword 0x0057 0x0108599f0418503a
patword 0x0058 0x0108599f0418503a
patword 0x0059 0x0108599f0418503a
patword 0x005a 0x0108599f0418503a
patword 0x005b 0x0108599f0418503a
patword 0x005c 0x0108599f0418503a
patword 0x005d 0x0108599f0418503a
patword 0x005e 0x0108599f0418503a
patword 0x005f 0x0108599f0418503a
patword 0x0060 0x0108599f0418503a
patword 0x0061 0x0108599f0418503a
patword 0x0062 0x0108599f0418503a
patword 0x0063 0x0108599f0418503a
patword 0x0064 0x0108599f0418503a
patword 0x0065 0x0108599f0418503a
patword 0x0066 0x0108599f0418503a
patword 0x0067 0x0108599f0418503a
patword 0x0068 0x0108599f0418503a
patword 0x0069 0x0108599f0418503a
patword 0x006a 0x0108599f0418503a
patword 0x006b 0x0108599f0418503a
patword 0x006c 0x0108599f0418503a
patword 0x006d 0x0108599f0418503a
patword 0x006e 0x0108599f0418503a
patword 0x006f 0x0108599f0418503a
patword 0x0070 0x0108599f0418503a
patword 0x0071 0x0108599f0418503a
patword 0x0072 0x0108599f0418503a
patword 0x0073 0x0108599f0418503a
patword 0x0074 0x0108599f0418503a
patword 0x0075 0x0108599f0418503a
patword 0x0076 0x0108599f0418503a
patword 0x0077 0x0108599f0418503a
patword 0x0078 0x0108599f0418503a
patword 0x0079 0x0108599f0418503a
patword 0x007a 0x0108599f0418503a
patword 0x007b 0x0108599f0418503a
patword 0x007c 0x0108599f0418503a
patword 0x007d 0x0108599f0418503a
patword 0x007e 0x010859960418503a
patword 0x007f 0x010859960418503a
patword 0x0080 0x010859960418503a
patword 0x0081 0x010859960418503a
patword 0x0082 0x010859960418503a
patword 0x0083 0x010859960418503a
patword 0x0084 0x010859960418503a
patword 0x0085 0x010859960418503a
patword 0x0086 0x010859960418503a
patword 0x0087 0x010859960418503a
patword 0x0088 0x010859960418503a
patword 0x0089 0x010859960418503a
patword 0x008a 0x010859960418503a
patword 0x008b 0x010859960418503a
patword 0x008c 0x010859960418503a
patword 0x008d 0x010859960418503a
patword 0x008e 0x010859960418503a
patword 0x008f 0x010859960418503a
patword 0x0090 0x010859960418503a
patword 0x0091 0x010859960418503a
patword 0x0092 0x010819960418501a
patword 0x0093 0x010819960418501a
patword 0x0094 0x010819960418501a
patword 0x0095 0x010819960418501a
patword 0x0096 0x030819960418501a
patword 0x0097 0x030819960418501a
patword 0x0098 0x030819960418501a
patword 0x0099 0x030819960418501a
patword 0x009a 0x030819960418501a
patword 0x009b 0x030819960418501a
patword 0x009c 0x030819960418501a
patword 0x009d 0x030819960418501a
patword 0x009e 0x030819960418501a
patword 0x009f 0x030819960418501a
patword 0x00a0 0x030819960418501a
patword 0x00a1 0x030819960418501a
patword 0x00a2 0x030819960418501a
patword 0x00a3 0x030819960418501a
patword 0x00a4 0x030819960418501a
patword 0x00a5 0x030819960418501a
patword 0x00a6 0x030819960418501a
patword 0x00a7 0x030819960418501a
patword 0x00a8 0x030819960418501a
patword 0x00a9 0x030819960418501a
patword 0x00aa 0x030819960418501a
patword 0x00ab 0x030819960418501a
patword 0x00ac 0x030819960008501a
patword 0x00ad 0x030819960008501a
patword 0x00ae 0x030819960008501a
patword 0x00af 0x030819960008501a
patword 0x00b0 0x030819960008501a
patword 0x00b1 0x030819960008501a
patword 0x00b2 0x030819960008501a
patword 0x00b3 0x030819960008501a
patword 0x00b4 0x030819960008501a
patword 0x00b5 0x030819960008501a
patword 0x00b6 0x030819960008501a
patword 0x00b7 0x030819960008501a
patword 0x00b8 0x030819960008501a
patword 0x00b9 0x030819960008501a
patword 0x00ba 0x030819960008501a
patword 0x00bb 0x030819960008501a
patword 0x00bc 0x030819960008501a
patword 0x00bd 0x030819960008501a
patword 0x00be 0x030819960008501a
patword 0x00bf 0x030819960008501a
patword 0x00c0 0x0308199f0008501a
patword 0x00c1 0x0308199f0008501a
patword 0x00c2 0x0308199f0008501a
patword 0x00c3 0x0308199f0008501a
patword 0x00c4 0x0308199f0008501a
patword 0x00c5 0x0308199f0008501a
patword 0x00c6 0x0308199f0008501a
patword 0x00c7 0x0308199f0008501a
patword 0x00c8 0x0308199f0008501a
patword 0x00c9 0x0308199f0008501a
patword 0x00ca 0x0308199f0008501a
patword 0x00cb 0x0308199f0008501a
patword 0x00cc 0x0308199f0008501a
patword 0x00cd 0x0308199f0008501a
patword 0x00ce 0x0308199f0008501a
patword 0x00cf 0x0308199f0008501a
patword 0x00d0 0x0308199f0008501a
patword 0x00d1 0x0308199f0008501a
patword 0x00d2 0x0308199f0008501a
patword 0x00d3 0x0308199f0008501a
patword 0x00d4 0x0308599f0008503a
patword 0x00d5 0x0308599f0008503a
patword 0x00d6 0x030c599f000850ba
patword 0x00d7 0x030c599f000850ba
patword 0x00d8 0x030c599f000850ba
patword 0x00d9 0x030c599f000850ba
patword 0x00da 0x030c599f000850ba
patword 0x00db 0x030c599f000850ba
patword 0x00dc 0x030c599f000850ba
patword 0x00dd 0x030c599f000850ba
patword 0x00de 0x030c599f000850ba
patword 0x00df 0x030c599f000850ba
patword 0x00e0 0x030c599f000850ba
patword 0x00e1 0x030c599f000850ba
patword 0x00e2 0x030c599f000850ba
patword 0x00e3 0x030c599f000850ba
patword 0x00e4 0x030c599f000850ba
patword 0x00e5 0x030c599f000850ba
patword 0x00e6 0x030c599f000850ba
patword 0x00e7 0x030c599f000850ba
patword 0x00e8 0x030c599f000850ba
patword 0x00e9 0x030c599f000850ba
patword 0x00ea 0x030c799f010858ba
patword 0x00eb 0x030c799f010858ba
patword 0x00ec 0x030c599f000850ba
patword 0x00ed 0x030c599f000850ba
patword 0x00ee 0x030c599f000850ba
patword 0x00ef 0x030c599f000850ba
patword 0x00f0 0x030c599f000850ba
patword 0x00f1 0x030c599f000850ba
patword 0x00f2 0x030c599f000850ba
patword 0x00f3 0x030c599f000850ba
patword 0x00f4 0x030c599f000850ba
patword 0x00f5 0x030c599f000850ba
patword 0x00f6 0x030c599f000850ba
patword 0x00f7 0x030c599f000850ba
patword 0x00f8 0x030c599f000850ba
patword 0x00f9 0x030c599f000850ba
patword 0x00fa 0x030c599f000850ba
patword 0x00fb 0x030c599f000850ba
patword 0x00fc 0x030c599f000850ba
patword 0x00fd 0x030c599f000850ba
patword 0x00fe 0x030c599f000850ba
patword 0x00ff 0x030c599f000850ba
patword 0x0100 0x030c599f000850ba
patword 0x0101 0x030c599f000850ba
patword 0x0102 0x030c599f400850ba
patword 0x0103 0x030c599f400850ba
patword 0x0104 0x030c599f600850ba
patword 0x0105 0x030c599f400850ba
patword 0x0106 0x030c599f400850ba
patword 0x0107 0x030c599f400850ba
patword 0x0108 0x870c599f682e50ba
patword 0x0109 0x870c599f482850ba
patword 0x010a 0x870c599f000e50ba
patword 0x010b 0x870c599f000850ba
patword 0x010c 0x870c599f000e50ba
patword 0x010d 0x870c599f000850ba
patword 0x010e 0x870c599f000e50ba
patword 0x010f 0x870c599f000850ba
patword 0x0110 0x870c599f000e50ba
patword 0x0111 0x870c599f000850ba
patword 0x0112 0x870c599f000e50ba
patword 0x0113 0x870c599f000850ba
patword 0x0114 0x870c599f000e50ba
patword 0x0115 0x870c599f000850ba
patword 0x0116 0x870c599f000e50ba
patword 0x0117 0x870c599f000850ba
patword 0x0118 0x870c599f000e50ba
patword 0x0119 0x870c599f000850ba
patword 0x011a 0x870c599f000e50ba
patword 0x011b 0x870c599f000850ba
patword 0x011c 0x870c599f000e50ba
patword 0x011d 0x870c599f000850ba
patword 0x011e 0x870c599f000e50ba
patword 0x011f 0x870c599f000850ba
patword 0x0120 0x870c599f000e50ba
patword 0x0121 0x870c599f000850ba
patword 0x0122 0x870c599f200e50ba
patword 0x0123 0x870c599f000850ba
patword 0x0124 0x870c599f000e50ba
patword 0x0125 0x870c599f000850ba
patword 0x0126 0x870c599f000e50ba
patword 0x0127 0x870c599f000850ba
patword 0x0128 0x870c599f000e50ba
patword 0x0129 0x870c599f000850ba
patword 0x012a 0x870c599f000e50ba
patword 0x012b 0x870c599f000850ba
patword 0x012c 0x870c599f000e50ba
patword 0x012d 0x870c599f000850ba
patword 0x012e 0x870c599f000e50ba
patword 0x012f 0x870c599f000850ba
patword 0x0130 0x870c599f000e50ba
patword 0x0131 0x870c599f000850ba
patword 0x0132 0x870c599f000e50ba
patword 0x0133 0x870c599f000850ba
patword 0x0134 0x870c599f000e50ba
patword 0x0135 0x870c599f000850ba
patword 0x0136 0x870c599f000e50ba
patword 0x0137 0x870c599f000850ba
patword 0x0138 0x870c599f000e50ba
patword 0x0139 0x870c599f000850ba
patword 0x013a 0x870c599f282e50ba
patword 0x013b 0x870c599f082850ba
patword 0x013c 0x870c599f000e50ba
patword 0x013d 0x870c599f000850ba
patword 0x013e 0x870c599f000e50ba
patword 0x013f 0x870c599f000850ba
patword 0x0140 0x870c599f000e50ba
patword 0x0141 0x870c599f000850ba
patword 0x0142 0x870c599f000e50ba
patword 0x0143 0x870c599f000850ba
patword 0x0144 0x870c599f000e50ba
patword 0x0145 0x870c599f000850ba
patword 0x0146 0x870c599f000e50ba
patword 0x0147 0x870c599f000850ba
patword 0x0148 0x870c599f000e50ba
patword 0x0149 0x870c599f000850ba
patword 0x014a 0x870c599f000e50ba
patword 0x014b 0x870c599f000850ba
patword 0x014c 0x870c599f000e50ba
patword 0x014d 0x870c599f000850ba
patword 0x014e 0x870c599f000e50ba
patword 0x014f 0x870c599f000850ba
patword 0x0150 0x870c599f000e50ba
patword 0x0151 0x870c599f000850ba
patword 0x0152 0x870c599f000e50ba
patword 0x0153 0x870c599f000850ba
patword 0x0154 0x870c599f200e50ba
patword 0x0155 0x870c599f000850ba
patword 0x0156 0x870c599f000e50ba
patword 0x0157 0x870c599f000850ba
patword 0x0158 0x870c599f000e50ba
patword 0x0159 0x870c599f000850ba
patword 0x015a 0x870c599f000e50ba
patword 0x015b 0x870c599f000850ba
patword 0x015c 0x870c599f000e50ba
patword 0x015d 0x870c599f000850ba
patword 0x015e 0x870c599f000e50ba
patword 0x015f 0x870c599f000850ba
patword 0x0160 0x870c599f000e50ba
patword 0x0161 0x870c599f000850ba
patword 0x0162 0x870c599f000e50ba
patword 0x0163 0x870c599f000850ba
patword 0x0164 0x870c599f000e50ba
patword 0x0165 0x870c599f000850ba
patword 0x0166 0x870c599f000e50ba
patword 0x0167 0x870c599f000850ba
patword 0x0168 0x870c599f000e50ba
patword 0x0169 0x870c599f000850ba
patword 0x016a 0x870c599f000e50ba
patword 0x016b 0x870c599f000850ba
patword 0x016c 0x070c599f000850ba
patword 0x016d 0x070c599f000850ba
patword 0x016e 0x000c599f000850ba
patword 0x016f 0x000c599f000850ba
patword 0x0170 0x0008599f200e503a
patword 0x0171 0x0008599f0008503a
patword 0x0172 0x0008599f200e503a
patword 0x0173 0x0008599f0008503a
patword 0x0174 0x0008599f0008503a
patword 0x0175 0x0008599f0008503a
patword 0x0176 0x0008599f0008503a
patword 0x0177 0x0008599f0008503a
patword 0x0178 0x0008599f0008503a
patword 0x0179 0x0008599f0008503a
patword 0x017a 0x0008599f0008503a
patword 0x017b 0x0008599f0008503a
patword 0x017c 0x0008599f0008503a
patword 0x017d 0x0008599f0008503a
patword 0x017e 0x0008599f0008503a
patword 0x017f 0x0008599f0008503a
patword 0x0180 0x0008599f0008503a
patword 0x0181 0x0008599f0008503a
patword 0x0182 0x0008599f0008503a
patword 0x0183 0x0008599f0008503a
patword 0x0184 0x0008599f0008503a
patword 0x0185 0x0008599f0008503a
patword 0x0186 0x0008599f0008503a
patword 0x0187 0x0008599f0008503a
patword 0x0188 0x0008599f0008503a
patword 0x0189 0x0008599f0008503a
patword 0x018a 0x0008599f0008503a
patword 0x018b 0x0008599f0008503a
patword 0x018c 0x0008599f0008503a
patword 0x018d 0x0008599f0008503a
patioctrl 0x8f0effff6dbffdbf
patlimits 0x0000 0x018c
patloop 0 0x013a 0x016b
patnloop 0 0x199
patloop 1 0x0400 0x0400
patnloop 1 0
patloop 2 0x0400 0x0400
patnloop 2 0
patwait 0 0x00aa
patwaittime 0 10000
patwait 1 0x0400
patwaittime 1 0
patwait 2 0x0400
patwaittime 2 0
pattern /tmp/pattern.pat
# dacs
dac 6 800

View File

@ -1,13 +1,13 @@
# detector hostname
hostname localhost:1900
# receiver hostname
rx_hostname mpc1922:2000
# udp destination ports
udp_dstport 50000
udp_dstport2 50001
# receiver hostname
rx_hostname mpc1922:2000
# udp destination ip from rx_hostname
udp_dstip auto

View File

@ -1,15 +1,15 @@
# detector hostname
hostname localhost:1900+localhost:1902+
# receiver hostname
rx_hostname mpc1922:2000+mpc1922:2001+
# udp destination ports
0:udp_dstport 50000
0:udp_dstport2 50001
1:udp_dstport 50002
1:udp_dstport2 50003
# receiver hostname
rx_hostname mpc1922:2000+mpc1922:2001+
# udp destination ip from rx_hostname
udp_dstip auto

View File

@ -1,18 +1,18 @@
# detector hostname
hostname localhost:1904
# receiver hostname
rx_hostname mpc1922:2004
# udp destination ports
udp_dstport 50004
# udp destination ip from rx_hostname
udp_dstip auto
# udp source ip (same subnet as udp_dstip)
udp_srcip 192.168.1.100
# receiver hostname
rx_hostname mpc1922:2004
# udp destination ip from rx_hostname
udp_dstip auto
# output file directory
fpath /tmp

View File

@ -1,24 +1,12 @@
# detector hostname
hostname localhost:1914
# receiver hostname
rx_hostname mpc1922:2014
# udp destination ports
udp_dstport 50014
# udp destination ip from rx_hostname
udp_dstip auto
# udp source ip (same subnet as udp_dstip)
udp_srcip 192.168.1.100
# output file directory
fpath /tmp
# disable file writing
fwrite 0
# enable 2nd interface for veto debugging
# udp destination port for veto
udp_dstport2 50015
@ -27,6 +15,18 @@ udp_dstip2 auto
# udp source ip (same subnet as udp_dstip)
udp_srcip2 192.168.1.100
# receiver hostname
rx_hostname mpc1922:2014
# udp destination ip from rx_hostname
udp_dstip auto
# output file directory
fpath /tmp
# disable file writing
fwrite 0
# to enable 2nd interface for veto debugging
numinterfaces 2

View File

@ -1,21 +1,21 @@
# detector hostname
hostname localhost:1906
# receiver hostname
rx_hostname mpc1922:2006
# udp destination ports
udp_dstport 50006
udp_dstport2 50007
# udp destination ip from rx_hostname
udp_dstip auto
udp_dstip2 auto
# udp source ip (same subnet as udp_dstip)
udp_srcip 192.168.1.100
udp_srcip2 192.168.1.100
# receiver hostname
rx_hostname mpc1922:2006
# udp destination ip from rx_hostname
udp_dstip auto
udp_dstip2 auto
# output file directory
fpath /tmp

View File

@ -4,13 +4,6 @@ detsize 2048 1024
# detector hostname
virtual 4 1952
# receiver hostname and tcpports
0:rx_tcpport 1970
1:rx_tcpport 1971
2:rx_tcpport 1972
3:rx_tcpport 1973
rx_hostname mpc1922
# udp destination ports
0:udp_dstport2 50001
0:udp_dstport2 50002
@ -21,14 +14,21 @@ rx_hostname mpc1922
3:udp_dstport 50007
3:udp_dstport2 50008
# udp destination ip from rx_hostname
udp_dstip auto
udp_dstip2 auto
# udp source ip (same subnet as udp_dstip)
udp_srcip 192.168.1.100
udp_srcip2 192.168.1.100
# receiver hostname and tcpports
0:rx_tcpport 1970
1:rx_tcpport 1971
2:rx_tcpport 1972
3:rx_tcpport 1973
rx_hostname mpc1922
# udp destination ip from rx_hostname
udp_dstip auto
udp_dstip2 auto
# transmission delay frame
0:txndelay_frame 0
1:txndelay_frame 1

View File

@ -1,18 +1,18 @@
# detector hostname
hostname localhost:1908
# receiver hostname
rx_hostname mpc1922:2008
# udp destination ports
udp_dstport 50008
# udp destination ip from rx_hostname
udp_dstip auto
# udp source ip (same subnet as udp_dstip)
udp_srcip 192.168.1.100
# receiver hostname
rx_hostname mpc1922:2008
# udp destination ip from rx_hostname
udp_dstip auto
# output file directory
fpath /tmp

View File

@ -1,18 +1,18 @@
# detector hostname
hostname localhost:1912
# receiver hostname
rx_hostname mpc1922:2012
# udp destination ports
udp_dstport 50012
# udp destination ip from rx_hostname
udp_dstip auto
# udp source ip (same subnet as udp_dstip)
udp_srcip 192.168.1.100
# receiver hostname
rx_hostname mpc1922:2012
# udp destination ip from rx_hostname
udp_dstip auto
# output file directory
fpath /tmp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 334 KiB

After

Width:  |  Height:  |  Size: 299 KiB

View File

@ -31,7 +31,7 @@ alpha_wait = [0.5, 0.5, 0.5, 0.5, 0.5, 0.5]
alpha_wait_rect = [0.2, 0.2, 0.2, 0.2, 0.2, 0.2]
# Loop colors and line styles (6 needed from 0 to 5)
colors_loop = ['tab:green', 'tab:red', 'tab:purple', 'tab:brown', 'tab:ping', 'tab:grey']
colors_loop = ['tab:green', 'tab:red', 'tab:purple', 'tab:brown', 'tab:pink', 'tab:grey']
linestyles_loop = ['-.', '-.', '-.', '-.', '-.', '-.']
alpha_loop = [0.5, 0.5, 0.5, 0.5, 0.5, 0.5]
alpha_loop_rect = [0.2, 0.2, 0.2, 0.2, 0.2, 0.2]
@ -527,7 +527,7 @@ for idx, i in enumerate(range(nbiteff)):
linestyle=linestyles_loop[2], color=colors_loop[2], alpha=alpha_loop[2],
label="loop 2: " + str(nloop2) + " times" if idx == 0 else "", linewidth=2.0)
axs2[idx].plot([loop2_end, loop2_end], [-10, 10],
linestyle=linestyles_loop[0], color=colors_loop[0], alpha=alpha_loop[2], linewidth=2.0)
linestyle=linestyles_loop[2], color=colors_loop[2], alpha=alpha_loop[2], linewidth=2.0)
# Loop 3
if nloop3 is not None:

View File

@ -34,6 +34,7 @@ set( PYTHON_FILES
slsdet/eiger.py
slsdet/enums.py
slsdet/errors.py
slsdet/gaincaps.py
slsdet/gotthard.py
slsdet/pattern.py
slsdet/gotthard2.py

View File

@ -2,7 +2,7 @@
# Copyright (C) 2021 Contributors to the SLS Detector Package
import subprocess
import locale
out = subprocess.run(['g', 'list'], stdout = subprocess.PIPE, encoding=locale.getpreferredencoding())
out = subprocess.run(['sls_detector_get', 'list'], stdout = subprocess.PIPE, encoding=locale.getpreferredencoding())
cmd = out.stdout.splitlines()
cmd.pop(0)
@ -99,7 +99,6 @@ intentionally_missing = [
'temp_slowadc',
'temp_sodl',
'temp_sodr',
'trigger', #use sendSoftwareTrigger
'update', #use updateServerAndFirmare
'udp_validate', #use validateUdpConfiguration
'udp_reconfigure', #use reconfigureUdpDestination

View File

@ -11,7 +11,7 @@ from .gotthard2 import Gotthard2
from .gotthard import Gotthard
from .moench import Moench
from .pattern import Pattern, patternParameters
from .gaincaps import Mythen3GainCapsWrapper
import _slsdet
xy = _slsdet.xy

View File

@ -26,6 +26,7 @@ SHORT_STR_LENGTH=20
MAX_PATTERN_LENGTH=0x2000
MAX_PATTERN_LEVELS=6
M3_MAX_PATTERN_LEVELS=3
MAX_NUM_COUNTERS=3
DEFAULT_STREAMING_TIMER_IN_MS=500
NUM_RX_THREAD_IDS=9
MAX_NUM_PACKETS=512

View File

@ -14,8 +14,9 @@ streamingInterface = slsDetectorDefs.streamingInterface
defs = slsDetectorDefs
from .utils import element_if_equal, all_equal, get_set_bits, list_to_bitmask
from .utils import Geometry, to_geo, element, reduce_time, is_iterable
from .utils import Geometry, to_geo, element, reduce_time, is_iterable, hostname_list
from _slsdet import xy
from .gaincaps import Mythen3GainCapsWrapper
from . import utils as ut
from .proxy import JsonProxy, SlowAdcProxy, ClkDivProxy, MaxPhaseProxy, ClkFreqProxy, PatLoopProxy, PatNLoopProxy, PatWaitProxy, PatWaitTimeProxy
from .registers import Register, Adc_register
@ -162,12 +163,8 @@ class Detector(CppDetectorApi):
@hostname.setter
def hostname(self, hostnames):
if isinstance(hostnames, str):
hostnames = [hostnames]
if isinstance(hostnames, list):
self.setHostname(hostnames)
else:
raise ValueError("hostname needs to be string or list of strings")
args = hostname_list(hostnames)
self.setHostname(args)
@property
@ -235,7 +232,7 @@ class Detector(CppDetectorApi):
"""
[Jungfrau][Gotthard2][Myhten3][Gotthard][Ctb][Moench] Hardware version of detector.
"""
return ut.lhex(self.getHardwareVersion())
return self.getHardwareVersion()
@property
@element
@ -267,11 +264,17 @@ class Detector(CppDetectorApi):
"""Receiver version """
return self.getReceiverVersion()
@property
@element
def serialnumber(self):
"""Jungfrau][Gotthard][Mythen3][Gotthard2][CTB][Moench] Serial number of detector """
return ut.lhex(self.getSerialNumber())
@property
@element
def rx_threads(self):
"""
Get thread ids from the receiver in order of [parent, tcp, listener 0, processor 0, streamer 0, listener 1, processor 1, streamer 1, arping].
Get kernel thread ids from the receiver in order of [parent, tcp, listener 0, processor 0, streamer 0, listener 1, processor 1, streamer 1, arping].
Note
-----
@ -457,6 +460,56 @@ class Detector(CppDetectorApi):
def triggers(self, n_triggers):
self.setNumberOfTriggers(n_triggers)
def resetdacs(self, use_hardware_values):
self.resetToDefaultDacs(use_hardware_values)
def trigger(self):
self.sendSoftwareTrigger()
def blockingtrigger(self):
self.sendSoftwareTrigger(True)
@property
@element
def gaincaps(self):
"""
[Mythen3] Gain caps. Enum: M3_GainCaps \n
Note
----
Options: M3_GainCaps, M3_C15sh, M3_C30sh, M3_C50sh, M3_C225ACsh, M3_C15pre
Example
-------
>>> d.gaincaps
C15pre, C30sh
>>> d.gaincaps = M3_GainCaps.M3_C30sh
>>> d.gaincaps
C30sh
>>> d.gaincaps = M3_GainCaps.M3_C30sh | M3_GainCaps.M3_C15sh
>>> d.gaincaps
C15sh, C30sh
"""
res = [Mythen3GainCapsWrapper(it) for it in self.getGainCaps()]
return res
@gaincaps.setter
def gaincaps(self, caps):
#convert to int if called with Wrapper
if isinstance(caps, Mythen3GainCapsWrapper):
self.setGainCaps(caps.value)
elif isinstance(caps, dict):
corr = {}
for key, value in caps.items():
if isinstance(value, Mythen3GainCapsWrapper):
corr[key] = value.value
else:
corr[key] = value
ut.set_using_dict(self.setGainCaps, corr)
else:
self.setGainCaps(caps)
@property
def exptime(self):
"""
@ -504,7 +557,7 @@ class Detector(CppDetectorApi):
@exptime.setter
def exptime(self, t):
if self.type == detectorType.MYTHEN3 and is_iterable(t):
if self.type == detectorType.MYTHEN3 and is_iterable(t) and not isinstance(t,dict):
for i, v in enumerate(t):
if isinstance(v, int):
v = float(v)
@ -513,8 +566,6 @@ class Detector(CppDetectorApi):
ut.set_time_using_dict(self.setExptime, t)
@property
def period(self):
"""
@ -653,6 +704,10 @@ class Detector(CppDetectorApi):
"""Start detector acquisition. Status changes to RUNNING or WAITING and automatically returns to idle at the end of acquisition."""
self.startDetector()
def clearbusy(self):
"""If acquisition aborted during acquire command, use this to clear acquiring flag in shared memory before starting next acquisition"""
self.clearAcquiringFlag()
def rx_start(self):
"""Starts receiver listener for detector data packets and create a data file (if file write enabled)."""
self.startReceiver()
@ -784,7 +839,8 @@ class Detector(CppDetectorApi):
@rx_hostname.setter
def rx_hostname(self, hostname):
self.setRxHostname(hostname)
args = hostname_list(hostname)
self.setRxHostname(args)
@property
@element
@ -1568,6 +1624,20 @@ class Detector(CppDetectorApi):
def trimval(self, value):
ut.set_using_dict(self.setAllTrimbits, value)
@property
@element
def fliprows(self):
"""
[Eiger] flips rows paramater sent to slsreceiver to stream as json parameter to flip rows in gui. \n
[Jungfrau] flips rows in the detector itself. For bottom module and number of interfaces must be set to 2. slsReceiver and slsDetectorGui does not handle.
"""
return self.getFlipRows()
@fliprows.setter
def fliprows(self, value):
ut.set_using_dict(self.setFlipRows, value)
@property
@element
def master(self):
@ -1593,6 +1663,19 @@ class Detector(CppDetectorApi):
def sync(self, value):
ut.set_using_dict(self.setSynchronization, value)
@property
@element
def badchannels(self):
"""
[fname|none|0]\n\t[Gotthard2][Mythen3] Sets the bad channels (from file of bad channel numbers) to be masked out. None or 0 unsets all the badchannels.\n
[Mythen3] Also does trimming
"""
return self.getBadChannels()
@badchannels.setter
def badchannels(self, value):
ut.set_using_dict(self.setBadChannels, value)
@property
@element
def lock(self):
@ -1701,6 +1784,11 @@ class Detector(CppDetectorApi):
"""Gets the list of timing modes (timingMode) for this detector."""
return self.getTimingModeList()
@property
def readoutspeedlist(self):
"""List of readout speed levels implemented for this detector."""
return self.getReadoutSpeedList()
@property
def templist(self):
"""List of temperature enums (dacIndex) implemented for this detector."""
@ -1802,14 +1890,17 @@ class Detector(CppDetectorApi):
@property
def versions(self):
return {'type': self.type,
version_list = {'type': self.type,
'package': self.packageversion,
'client': self.clientversion,
'firmware': self.firmwareversion,
'detectorserver': self.detectorserverversion,
'hardware':self.hardwareversion,
'kernel': self.kernelversion,
'receiver': self.rx_version}
'kernel': self.kernelversion}
if self.type != detectorType.EIGER:
version_list ['hardware'] = self.hardwareversion
if self.use_receiver:
version_list ['receiver'] = self.rx_version
return version_list
@property
def virtual(self):
@ -3098,6 +3189,17 @@ class Detector(CppDetectorApi):
def dbitclk(self, value):
ut.set_using_dict(self.setDBITClock, value)
@property
@element
def adcvpp(self):
"""[Ctb][Moench] Vpp of ADC. [0 -> 1V | 1 -> 1.14V | 2 -> 1.33V | 3 -> 1.6V | 4 -> 2V] \n
Advanced User function!"""
return self.getADCVpp(False)
@adcvpp.setter
def adcvpp(self, value):
ut.set_using_dict(self.setADCVpp, value, False)
@property
@element
def dbitpipeline(self):
@ -3708,6 +3810,23 @@ class Detector(CppDetectorApi):
"""
return self.getMeasuredCurrent(dacIndex.I_POWER_IO)
@property
def clkphase(self):
"""
[Gotthard2][Mythen3] Phase shift of all clocks.
Example
-------
>>> d.clkphase[0] = 20
>>> d.clkphase
0: 20
1: 10
2: 20
3: 10
4: 10
5: 5
"""
return ClkPhaseProxy(self)
@property
def clkdiv(self):

42
python/slsdet/gaincaps.py Normal file
View File

@ -0,0 +1,42 @@
import _slsdet
gc = _slsdet.slsDetectorDefs.M3_GainCaps
class Mythen3GainCapsWrapper:
"""Holds M3_GainCaps enums and facilitates printing"""
# 'M3_C10pre', 'M3_C15pre', 'M3_C15sh', 'M3_C225ACsh', 'M3_C30sh', 'M3_C50sh'
all_bits = gc.M3_C10pre | gc.M3_C15pre | gc.M3_C15sh | gc.M3_C225ACsh | gc.M3_C30sh | gc.M3_C50sh
all_caps = (gc.M3_C10pre, gc.M3_C15pre, gc.M3_C15sh, gc.M3_C225ACsh, gc.M3_C30sh, gc.M3_C50sh)
def __init__(self, value = 0):
self._validate(value)
self.value = value
def __eq__(self, other) -> bool:
if isinstance(other, Mythen3GainCapsWrapper):
return self.value == other.value
else:
return self.value == other
def __ne__(self, other) -> bool:
return not self.__eq__(other)
def __str__(self) -> str:
s = ', '.join(str(c).rsplit('_', 1)[1] for c in self.all_caps if self.value & c)
return s
def __repr__(self) -> str:
return self.__str__()
def _validate(self, value):
"""Check that only bits representing real capacitors are set"""
if isinstance(value, gc):
return True
elif isinstance(value, int):
if value & (~self.all_bits):
raise ValueError(f"The value: {value} is not allowed for Mythen3GainCapsWrapper")
else:
raise ValueError("GainCaps can only be initialized from int or M3_GainCaps enum")

View File

@ -13,6 +13,7 @@ from .detector import Detector, freeze
from .dacs import DetectorDacs
import _slsdet
dacIndex = _slsdet.slsDetectorDefs.dacIndex
gc_enums = _slsdet.slsDetectorDefs.M3_GainCaps
from .detector_property import DetectorProperty
@ -62,4 +63,6 @@ class Mythen3(Detector):
@property
def dacs(self):
return self._dacs
return self._dacs

View File

@ -4,6 +4,7 @@ from .utils import element_if_equal
from .enums import dacIndex
from .defines import M3_MAX_PATTERN_LEVELS, MAX_PATTERN_LEVELS
from _slsdet import slsDetectorDefs
detectorType = slsDetectorDefs.detectorType
def set_proxy_using_dict(func, key, value, unpack = False):
@ -87,7 +88,10 @@ class ClkDivProxy:
def __repr__(self):
rstr = ''
for i in range(6):
num_clocks = 6
if self.det.type == detectorType.MYTHEN3:
num_clocks = 5
for i in range(num_clocks):
r = element_if_equal(self.__getitem__(i))
if isinstance(r, list):
rstr += ' '.join(f'{item}' for item in r)
@ -96,10 +100,35 @@ class ClkDivProxy:
return rstr.strip('\n')
class ClkPhaseProxy:
"""
Proxy class to allow for more intuitive reading clock phase
"""
def __init__(self, det):
self.det = det
def __getitem__(self, key):
return element_if_equal(self.det.getClockPhase(key))
def __setitem__(self, key, value):
set_proxy_using_dict(self.det.setClockPhase, key, value)
def __repr__(self):
rstr = ''
if self.det.type == detectorType.MYTHEN3:
num_clocks = 5
for i in range(num_clocks):
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')
class MaxPhaseProxy:
"""
Proxy class to allow for more intuitive reading clockdivider
Proxy class to allow for more intuitive reading max clock phase shift
"""
def __init__(self, det):
self.det = det
@ -109,7 +138,9 @@ class MaxPhaseProxy:
def __repr__(self):
rstr = ''
for i in range(5):
if self.det.type == detectorType.MYTHEN3:
num_clocks = 5
for i in range(num_clocks):
r = element_if_equal(self.__getitem__(i))
if isinstance(r, list):
rstr += ' '.join(f'{item}' for item in r)
@ -120,7 +151,7 @@ class MaxPhaseProxy:
class ClkFreqProxy:
"""
Proxy class to allow for more intuitive reading clockdivider
Proxy class to allow for more intuitive reading clock frequency
"""
def __init__(self, det):
self.det = det
@ -130,7 +161,9 @@ class ClkFreqProxy:
def __repr__(self):
rstr = ''
for i in range(5):
if self.det.type == detectorType.MYTHEN3:
num_clocks = 5
for i in range(num_clocks):
r = element_if_equal(self.__getitem__(i))
if isinstance(r, list):
rstr += ' '.join(f'{item}' for item in r)

View File

@ -260,4 +260,21 @@ def merge_args(*args):
return (ret,)
else:
raise ValueError("Multiple dictionaries passes cannot merge args")
raise ValueError("Multiple dictionaries passes cannot merge args")
def hostname_list(args):
"""
Generates a list from a hostname string
* Lists are passed through
* as are tuples (conversion in pybind11 to vector)
* if + is found it splits the string
"""
if isinstance(args, (list, tuple)):
return args
elif(isinstance(args, str)):
hosts = args.split('+')
hosts = [it for it in hosts if len(it)]
return hosts
else:
raise ValueError("hostname needs to be string or list of strings")

View File

@ -219,6 +219,21 @@ void init_det(py::module &m) {
(void (Detector::*)(const std::string &, sls::Positions)) &
Detector::setBadChannels,
py::arg(), py::arg() = Positions{});
CppDetectorApi.def(
"getBadChannels",
(Result<std::vector<int>>(Detector::*)(sls::Positions) const) &
Detector::getBadChannels,
py::arg() = Positions{});
CppDetectorApi.def(
"setBadChannels",
(void (Detector::*)(const std::vector<int>, sls::Positions)) &
Detector::setBadChannels,
py::arg(), py::arg() = Positions{});
CppDetectorApi.def(
"setBadChannels",
(void (Detector::*)(const std::vector<std::vector<int>>)) &
Detector::setBadChannels,
py::arg());
CppDetectorApi.def("isVirtualDetectorServer",
(Result<bool>(Detector::*)(sls::Positions) const) &
Detector::isVirtualDetectorServer,

View File

@ -12,6 +12,7 @@ void init_duration(py::module &m) {
.def("total_seconds", &DurationWrapper::total_seconds)
.def("count", &DurationWrapper::count)
.def("set_count", &DurationWrapper::set_count)
.def("__eq__", &DurationWrapper::operator==)
.def("__repr__", [](const DurationWrapper &self) {
std::stringstream ss;
ss << "sls::DurationWrapper(total_seconds: " << self.total_seconds()

View File

@ -0,0 +1,24 @@
import pytest
from slsdet import Mythen3GainCapsWrapper
from slsdet.enums import M3_GainCaps #this is the c++ enum
def test_comapre_with_int():
c = Mythen3GainCapsWrapper(128) #C10pre
assert c == 128
assert c != 5
assert c != 1280
def test_compare_with_other():
a = Mythen3GainCapsWrapper(128)
b = Mythen3GainCapsWrapper(1<<10)
c = Mythen3GainCapsWrapper(128)
assert a!=b
assert (a==b) == False
assert a==c
def test_can_be_default_constructed():
c = Mythen3GainCapsWrapper()
assert c == 0

View File

@ -8,7 +8,7 @@ Testing functions from utils.py
import pytest
from slsdet.utils import *
from slsdet import IpAddr, MacAddr
from slsdet import IpAddr, MacAddr, DurationWrapper
import datetime as dt
import pathlib
from pathlib import Path
@ -22,7 +22,11 @@ def test_iterable():
def test_reduce_time_to_single_value_from_list():
t = 3 * [dt.timedelta(seconds=1)]
t = [dt.timedelta(seconds=1) for i in range(3)]
assert reduce_time(t) == 1
def test_reduce_time_to_single_value_from_list_DurationWrapper():
t = [DurationWrapper(1) for i in range(3)]
assert reduce_time(t) == 1
@ -83,6 +87,12 @@ def test_all_equal_str_fails():
assert all_equal('aaab') == False
def test_all_equal_DurationWrapper():
assert all_equal([DurationWrapper(1), DurationWrapper(1)])
def test_all_equal_DurationWrapper_fail():
assert not all_equal([DurationWrapper(1), DurationWrapper(2)])
def test_element_if_equal_int():
assert element_if_equal([5, 5]) == 5
@ -341,4 +351,33 @@ def test_merge_args_tuple():
assert merge_args(*("a", "b"), 5) == ("a", "b", 5)
def test_merge_args_dict_with_tuple():
assert merge_args({0: (1,2)}, 3) == ({0: (1,2,3)},)
assert merge_args({0: (1,2)}, 3) == ({0: (1,2,3)},)
def test_hostname_to_list():
s = "localhost"
r = hostname_list(s)
assert r == [s]
def test_hostname_to_list_passthrough():
args = ["localhost"]
ret = hostname_list(args)
assert ret == args
args = ("localhost",)
ret = hostname_list(args)
assert ret == args
def test_splitting_hostname():
args = 'apple+banana+pear+'
ret = hostname_list(args)
assert ret == ['apple', 'banana', 'pear']
#not sensitive to trailing +
args = 'apple+banana+pear'
ret = hostname_list(args)
assert ret == ['apple', 'banana', 'pear']
def test_hostame_throws_on_wrong_args():
with pytest.raises(Exception) as e:
hostname_list(5)

View File

@ -1 +0,0 @@
../slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServerv7.0.0.rc1

View File

@ -0,0 +1 @@
../slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServerv7.0.3

View File

@ -1 +0,0 @@
../slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServerv7.0.0.rc1

View File

@ -0,0 +1 @@
../slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServerv7.0.3

View File

@ -1 +0,0 @@
../slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServerv7.0.0.rc1

View File

@ -0,0 +1 @@
../slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServerv7.0.3

View File

@ -1 +0,0 @@
../slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServerv7.0.0.rc1

View File

@ -0,0 +1 @@
../slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServerv7.0.3

View File

@ -1 +0,0 @@
../slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv7.0.0.rc1

View File

@ -0,0 +1 @@
../slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv7.0.3

View File

@ -1 +0,0 @@
../slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv7.0.0.rc1

View File

@ -0,0 +1 @@
../slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv7.0.3

View File

@ -1 +0,0 @@
../slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv7.0.0.rc1

View File

@ -0,0 +1 @@
../slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv7.0.3

View File

@ -40,20 +40,31 @@ class jungfrauModuleData : public slsDetectorData<uint16_t> {
out by a module i.e. using the slsReceiver (160x160 pixels, 40 packets
1286 large etc.) \param c crosstalk parameter for the output buffer
*/
*/
#ifndef ZMQ
#define off sizeof(jf_header)
#endif
#ifdef ZMQ
#define off 0
#endif
jungfrauModuleData()
: slsDetectorData<uint16_t>(1024, 512,
1024* 512 * 2 + sizeof(jf_header)) {
1024* 512 * 2 + off) {
for (int ix = 0; ix < 1024; ix++) {
for (int iy = 0; iy < 512; iy++) {
dataMap[iy][ix] = sizeof(jf_header) + (1024 * iy + ix) * 2;
dataMap[iy][ix] = off + (1024 * iy + ix) * 2;
#ifdef HIGHZ
dataMask[iy][ix] = 0x3fff;
#endif
}
}
iframe = 0;
// cout << "data struct created" << endl;
};

View File

@ -42,7 +42,7 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
int sc_width;
int sc_height;
const int nSamples;
int headerSize;
double ghost[200][25];
// Single point of definition if we need to customize
@ -62,7 +62,7 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
moench03T1ReceiverDataNew(int ns = 5000)
: slsDetectorData<uint16_t>(400, 400, ns * 2 * 32 + sizeof(header)),
nSamples(ns) {
headerSize=112;
int nadc = 32;
int sc_width = 25;
int sc_height = 200;
@ -250,13 +250,22 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
virtual char *readNextFrame(std::ifstream &filebin, int &ff, int &np,
char *data) {
np = 0;
if (filebin.is_open()) {
if (filebin.read(data, dataSize)) {
ff = getFrameNumber(data);
np = getPacketNumber(data);
return data;
}
}
if (filebin.is_open()) {
if (filebin.read(data, headerSize)) {
ff = getFrameNumber(data);
np = getPacketNumber(data);
if (np>0)
filebin.read(data+headerSize, dataSize-headerSize);
return data;
}
/* if (filebin.read(data, dataSize)) { */
/* ff = getFrameNumber(data); */
/* np = getPacketNumber(data); */
/* return data; */
/* } */
}
return nullptr;
}

View File

@ -13,22 +13,7 @@ class etaInterpolationGlobal : public etaInterpolationBase {
virtual void prepareInterpolation(int &ok) {
ok = 1;
#ifdef MYROOT1
if (hhx)
delete hhx;
if (hhy)
delete hhy;
hhx = new TH2D("hhx", "hhx", heta->GetNbinsX(),
heta->GetXaxis()->GetXmin(), heta->GetXaxis()->GetXmax(),
heta->GetNbinsY(), heta->GetYaxis()->GetXmin(),
heta->GetYaxis()->GetXmax());
hhy = new TH2D("hhy", "hhy", heta->GetNbinsX(),
heta->GetXaxis()->GetXmin(), heta->GetXaxis()->GetXmax(),
heta->GetNbinsY(), heta->GetYaxis()->GetXmin(),
heta->GetYaxis()->GetXmax());
#endif
///*Eta Distribution Rebinning*///
double bsize = 1. / nSubPixels; // precision

View File

@ -357,6 +357,16 @@ class slsInterpolation {
}
}
/* cout << "(((" << totquad << "\t" << corner << endl; */
/* for (int iy=0; iy<3; iy++) { */
/* for (int ix=0; ix<3; ix++) */
/* cout << cl[ix+iy*3] <<"\t"; */
/* cout << endl; */
/* } */
/* cout << ")))" << endl; */
return corner;
}
@ -370,6 +380,10 @@ class slsInterpolation {
etax = r / totquad;
etay = t / totquad;
}
/* cout << "************" << endl; */
/* cout << sDum[0][0]<< "\t"<<sDum[0][1] << endl << sDum[1][0]<< "\t"<<sDum[1][1] << endl; */
/* cout << "***************" <<endl; */
/* cout << etax << " " << etay << endl; */
return 0;
}

View File

@ -0,0 +1,64 @@
# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package
#module add CBFlib/0.9.5
INCDIR=-I. -I../ -I../interpolations -I../interpolations/etaVEL -I../dataStructures -I../../slsSupportLib/include/ -I../../slsReceiverSoftware/include/ -I../tiffio/include
LDFLAG= ../tiffio/src/tiffIO.cpp -L/usr/lib64/ -lpthread -lm -lstdc++ -pthread -lrt -ltiff -O3 -std=c++11
MAIN=jungfrauClusterFinder.cpp
all: jungfrauRawDataProcess
jungfrauRawDataProcess: jungfrauRawDataProcess.cpp $(INCS) clean
g++ -o jungfrauRawDataProcess jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DMODULE
jungfrauRawDataProcessStrx: jungfrauRawDataProcess.cpp $(INCS) clean
g++ -o jungfrauRawDataProcessStrx jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DJFSTRX
jungfrauRawDataProcessStrxAldo: jungfrauRawDataProcess.cpp $(INCS) clean
g++ -o jungfrauRawDataProcessStrxAldo jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DJFSTRX -DALDO
jungfrauRawDataProcessStrxOld: jungfrauRawDataProcess.cpp $(INCS) clean
g++ -o jungfrauRawDataProcessStrxOld jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DJFSTRXOLD
jungfrauRawDataProcessStrxOldAldo: jungfrauRawDataProcess.cpp $(INCS) clean
g++ -o jungfrauRawDataProcessStrxOldAldo jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DJFSTRXOLD -DALDO
jungfrauClusterFinder: jungfrauClusterFinder.cpp $(INCS) clean
g++ -o jungfrauClusterFinder jungfrauClusterFinder.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL
jungfrauClusterFinderHighZ: jungfrauClusterFinder.cpp $(INCS) clean
g++ -o jungfrauClusterFinderHighZ jungfrauClusterFinder.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DHIGHZ
jungfrauMakeEta: jungfrauInterpolation.cpp $(INCS) clean
g++ -o jungfrauMakeEta jungfrauInterpolation.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DFF
jungfrauInterpolation: jungfrauInterpolation.cpp $(INCS) clean
g++ -o jungfrauInterpolation jungfrauInterpolation.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF)
jungfrauNoInterpolation: jungfrauNoInterpolation.cpp $(INCS) clean
g++ -o jungfrauNoInterpolation jungfrauNoInterpolation.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF)
jungfrauPhotonCounter: jungfrauPhotonCounter.cpp $(INCS) clean
g++ -o jungfrauPhotonCounter jungfrauPhotonCounter.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWRECEIVER
jungfrauAnalog: jungfrauPhotonCounter.cpp $(INCS) clean
g++ -o jungfrauAnalog jungfrauPhotonCounter.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWRECEIVER -DANALOG
jungfrauPhotonCounterHighZ: jungfrauPhotonCounter.cpp $(INCS) clean
g++ -o jungfrauPhotonCounterHighZ jungfrauPhotonCounter.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWRECEIVER -DHIGHZ
jungfrauAnalogHighZ: jungfrauPhotonCounter.cpp $(INCS) clean
g++ -o jungfrauAnalogHighZ jungfrauPhotonCounter.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWRECEIVER -DANALOG -DHIGHZ
clean:
rm -f jungfrauClusterFinder jungfrauMakeEta jungfrauInterpolation jungfrauNoInterpolation jungfrauPhotonCounter jungfrauAnalog

View File

@ -1,25 +1,19 @@
# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package
INCDIR= -I. -I../dataStructures ../tiffIO.cpp -I../ -I../interpolations/ -I../../slsSupportLib/include/ -I../../slsReceiverSoftware/include/ -I../../libs/rapidjson/
INCDIR= -I. -I../dataStructures ../tiffio/src/tiffIO.cpp -I../ -I../interpolations/ -I../../slsSupportLib/include/ -I../../slsReceiverSoftware/include/ -I../../libs/rapidjson/ -I../tiffio/include
LDFLAG= -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -O3 -std=c++11 -Wall -L../../build/bin/ -lSlsSupport
#-L../../bin -lhdf5 -L.
#DESTDIR?=../bin
all: moenchZmqProcess moenchZmq04Process
#moenchZmqProcessCtbGui
all: jungfrauZmqProcess
#jungfrauZmqProcessCtbGui
moenchZmqProcess: moenchZmqProcess.cpp clean
g++ -o moenchZmqProcess moenchZmqProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWZMQ -DINTERP
moenchZmq04Process: moenchZmqProcess.cpp clean
g++ -o moench04ZmqProcess moenchZmqProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWZMQ -DINTERP -DMOENCH04
#moenchZmqProcessCtbGui: moenchZmqProcess.cpp clean
# g++ -o moenchZmqProcessCtbGui moenchZmqProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWZMQ -DINTERP -DCTBGUI
jungfrauZmqProcess: jungfrauZmqProcess.cpp clean
g++ -o jungfrauZmqProcess jungfrauZmqProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWZMQ -DINTERP
clean:
rm -f moenchZmqProcess
rm -f jungfrauZmqProcess

View File

@ -0,0 +1,26 @@
ROOTSYS=/opt/cern/v6/root
#/afs/psi.ch/project/sls_det_sof/roottware/root_v5.34.23_sl6_64bit
LIBZMQDIR = $(PWD)
LIBZMQ = -L$(LIBZMQDIR) -lzmq
SHLIB_PATH=/opt/cern/v6/root/lib
CMAKE_PREFIX_PATH=/opt/cern/v6/root
DYLD_LIBRARY_PATH=/opt/cern/v6/root/lib
INCDIR= -I. -I../dataStructures ../tiffio/src/tiffIO.cpp -I../ -I../interpolations/ -I../../slsSupportLib/include/ -I../../slsReceiverSoftware/include/ -I../../libs/rapidjson/ -I../tiffio/include
LDFLAG= -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -O3 -std=c++11 -Wall -L../../build/bin/ -lSlsSupport
#-L../../bin -lhdf5 -L.
default: onlinedisp_zmq
onlinedisp_zmq: onlinedisp_zmq.cpp onlinedisp_zmq.h
# flags from root-config --cflags --glibs
g++ -o onlinedisp_zmq onlinedisp_zmq.cpp -I. -I$(ROOTSYS)/include -Wall -g -lm -L. -lzmq -pthread -lrt -L$(ROOTSYS)/lib -lGui -lCore -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -m64 $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF)
#-lCint

View File

@ -0,0 +1,10 @@
sls_detector_put rx_jsonpara detectorMode counting
sls_detector_put rx_jsonpara frameMode newPedestal
sls_detector_put rx_jsonpara frameMode frame
sls_detector_put rx_jsonpara detectorMode analog
sls_detector_put rx_jsonpara threshold 150
sls_detector_put rx_jsonpara threshold 0
sls_detector_put rx_jsonpara threshold 300
sls_detector_put rx_zmqhwm 50

View File

@ -0,0 +1,418 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
//#include "sls/ansi.h"
#include <iostream>
#undef CORR
#define C_GHOST 0.0004
#define CM_ROWS 50
#define RAWDATA
#ifndef JFSTRX
#ifndef JFSTRXOLD
#ifndef MODULE
#include "jungfrauHighZSingleChipData.h"
#endif
#ifdef MODULE
#include "jungfrauModuleData.h"
#endif
#endif
#endif
#ifdef JFSTRX
#include "jungfrauLGADStrixelsData.h"
#endif
#ifdef JFSTRXOLD
#include "jungfrauStrixelsHalfModuleOldDesign.h"
#endif
#include "multiThreadedCountingDetector.h"
#include "singlePhotonDetector.h"
#include <fstream>
#include <map>
#include <stdio.h>
#include <sys/stat.h>
#include <ctime>
using namespace std;
int main(int argc, char *argv[]) {
if (argc < 5) {
cout << "Usage is " << argv[0]
<< "indir outdir fname(no extension) fextension [runmin] [runmax] [pedfile (raw or tiff)] [threshold] "
"[nframes] [xmin xmax ymin ymax] [gainmap]"
<< endl;
cout << "threshold <0 means analog; threshold=0 means cluster finder; "
"threshold>0 means photon counting"
<< endl;
cout << "nframes <0 means sum everything; nframes=0 means one file per "
"run; nframes>0 means one file every nframes"
<< endl;
return 1;
}
int fifosize = 1000;
int nthreads = 10;
int csize = 3;
int nsigma = 5;
int nped = 10000;
int cf = 0;
#ifndef JFSTRX
#ifndef JFSTRXOLD
#ifndef MODULE
jungfrauHighZSingleChipData *decoder = new jungfrauHighZSingleChipData();
int nx = 256, ny = 256;
#endif
#ifdef MODULE
jungfrauModuleData *decoder = new jungfrauModuleData();
int nx = 1024, ny = 512;
#endif
#endif
#endif
#ifdef JFSTRX
cout << "bbb" << endl;
jungfrauLGADStrixelsData *decoder = new jungfrauLGADStrixelsData();
int nx = 1024/5, ny = 512*5;
#endif
#ifdef JFSTRXOLD
cout << "ccc" << endl;
jungfrauStrixelsHalfModuleOldDesign *decoder = new jungfrauStrixelsHalfModuleOldDesign();
int nx = 1024*3, ny = 512/3;
#endif
decoder->getDetectorSize(nx, ny);
cout << "Detector size is " << nx << " " << ny << endl;
double *gainmap = NULL;
//float *gm;
int ff, np;
// cout << " data size is " << dsize;
ifstream filebin;
char *indir = argv[1];
char *outdir = argv[2];
char *fformat = argv[3];
char *fext = argv[4];
int runmin = 0;
// cout << "argc is " << argc << endl;
if (argc >= 6) {
runmin = atoi(argv[5]);
}
int runmax = runmin;
if (argc >= 7) {
runmax = atoi(argv[6]);
}
char *pedfile = NULL;
if (argc >= 8) {
pedfile = argv[7];
}
double thr = 0;
double thr1 = 1;
if (argc >= 9) {
thr = atof(argv[8]);
}
int nframes = 0;
if (argc >= 10) {
nframes = atoi(argv[9]);
}
int xmin = 0, xmax = nx, ymin = 0, ymax = ny;
if (argc >= 14) {
xmin = atoi(argv[10]);
xmax = atoi(argv[11]);
ymin = atoi(argv[12]);
ymax = atoi(argv[13]);
}
char *gainfname = NULL;
if (argc > 14) {
gainfname = argv[14];
cout << "Gain map file name is: " << gainfname << endl;
}
char ffname[10000];
char fname[10000];
char imgfname[10000];
char cfname[10000];
std::time_t end_time;
FILE *of = NULL;
cout << "input directory is " << indir << endl;
cout << "output directory is " << outdir << endl;
cout << "input file is " << fformat << endl;
cout << "runmin is " << runmin << endl;
cout << "runmax is " << runmax << endl;
if (pedfile)
cout << "pedestal file is " << pedfile << endl;
if (thr > 0)
cout << "threshold is " << thr << endl;
cout << "Nframes is " << nframes << endl;
uint32_t nnx, nny;
singlePhotonDetector *filter = new singlePhotonDetector(
decoder, csize, nsigma, 1, NULL, nped, 200, -1, -1, gainmap, NULL);
if (gainfname) {
if (filter->readGainMap(gainfname))
cout << "using gain map " << gainfname << endl;
else
cout << "Could not open gain map " << gainfname << endl;
} else
thr = 0.15 * thr;
filter->newDataSet();
//int dsize = decoder->getDataSize();
if (thr > 0) {
cout << "threshold is " << thr << endl;
filter->setThreshold(thr);
cf = 0;
} else
cf = 1;
filter->setROI(xmin, xmax, ymin, ymax);
std::time(&end_time);
cout << std::ctime(&end_time) << endl;
char *buff;
// multiThreadedAnalogDetector *mt=new
// multiThreadedAnalogDetector(filter,nthreads,fifosize);
multiThreadedCountingDetector *mt =
new multiThreadedCountingDetector(filter, nthreads, fifosize);
#ifndef ANALOG
mt->setDetectorMode(ePhotonCounting);
cout << "Counting!" << endl;
if (thr > 0) {
cf = 0;
}
#endif
//{
#ifdef ANALOG
mt->setDetectorMode(eAnalog);
cout << "Analog!" << endl;
cf = 0;
// thr1=thr;
#endif
// }
mt->StartThreads();
mt->popFree(buff);
// cout << "mt " << endl;
int ifr = 0;
char froot[1000];
double *ped=new double[nx * ny];//, *ped1;
int pos,pos1;
if (pedfile) {
if (string(pedfile).find(".dat") != std::string::npos) {
pos1=string(pedfile).rfind("/");
strcpy(froot,pedfile+pos1);
pos=string(froot).find(".dat");
froot[pos]='\0';
}
cout << "PEDESTAL " << endl;
// sprintf(imgfname, "%s/pedestals.tiff", outdir);
if (string(pedfile).find(".tif") == std::string::npos) {
sprintf(fname, "%s", pedfile);
cout << fname << endl;
std::time(&end_time);
//cout << "aaa" << std::ctime(&end_time) << endl;
mt->setFrameMode(ePedestal);
// sprintf(fn,fformat,irun);
filebin.open((const char *)(fname), ios::in | ios::binary);
// //open file
if (filebin.is_open()) {
ff = -1;
while (decoder->readNextFrame(filebin, ff, np, buff)) {
// if (np == 40) {
if ((ifr+1) % 100 == 0) {
cout << " ****" << decoder->getValue(buff,20,20);// << endl;
}
mt->pushData(buff);
mt->nextThread();
mt->popFree(buff);
ifr++;
if (ifr % 100 == 0) {
cout << " ****" << ifr << " " << ff << " " << np << endl;
} //else
//cout << ifr << " " << ff << " " << np << endl;
if (ifr>=1000)
break;
ff = -1;
}
filebin.close();
while (mt->isBusy()) {
;
}
sprintf(imgfname, "%s/%s_ped.tiff", outdir, froot);
mt->writePedestal(imgfname);
sprintf(imgfname, "%s/%s_rms.tiff", outdir, froot);
mt->writePedestalRMS(imgfname);
} else
cout << "Could not open pedestal file " << fname
<< " for reading " << endl;
} else {
float *pp = ReadFromTiff(pedfile, nny, nnx);
if (pp && (int)nnx == nx && (int)nny == ny) {
for (int i = 0; i < nx * ny; i++) {
ped[i] = pp[i];
}
delete[] pp;
mt->setPedestal(ped);
cout << "Pedestal set from tiff file " << pedfile << endl;
} else {
cout << "Could not open pedestal tiff file " << pedfile
<< " for reading " << endl;
}
}
std::time(&end_time);
cout << std::ctime(&end_time) << endl;
}
ifr = 0;
int ifile = 0;
mt->setFrameMode(eFrame);
for (int irun = runmin; irun <= runmax; irun++) {
cout << "DATA ";
// sprintf(fn,fformat,irun);
sprintf(ffname, "%s/%s.%s", indir, fformat, fext);
sprintf(fname, (const char*)ffname, irun);
sprintf(ffname, "%s/%s.tiff", outdir, fformat);
sprintf(imgfname, (const char*)ffname, irun);
sprintf(ffname, "%s/%s.clust", outdir, fformat);
sprintf(cfname, (const char*)ffname, irun);
cout << fname << " ";
cout << imgfname << endl;
std::time(&end_time);
cout << std::ctime(&end_time) << endl;
// cout << fname << " " << outfname << " " << imgfname << endl;
filebin.open((const char *)(fname), ios::in | ios::binary);
// //open file
ifile = 0;
if (filebin.is_open()) {
if (thr <= 0 && cf != 0) { // cluster finder
if (of == NULL) {
of = fopen(cfname, "w");
if (of) {
mt->setFilePointer(of);
cout << "file pointer set " << endl;
} else {
cout << "Could not open " << cfname << " for writing "
<< endl;
mt->setFilePointer(NULL);
return 1;
}
}
}
// //while read frame
ff = -1;
ifr = 0;
while (decoder->readNextFrame(filebin, ff, np, buff)) {
// if (np == 40) {
// //push
if ((ifr+1) % 100 == 0) {
cout << " ****" << decoder->getValue(buff,20,20);// << endl;
}
mt->pushData(buff);
// // //pop
mt->nextThread();
mt->popFree(buff);
ifr++;
if (ifr % 100 == 0)
cout << " " << ifr << " " << ff << endl;
if (nframes > 0) {
if (ifr % nframes == 0) {
sprintf(ffname, "%s/%s_f%05d.tiff", outdir, fformat,
ifile);
sprintf(imgfname, (const char*)ffname, irun);
mt->writeImage(imgfname, thr1);
mt->clearImage();
ifile++;
}
}
// } else
// cout << ifr << " " << ff << " " << np << endl;
ff = -1;
}
cout << "--" << endl;
filebin.close();
while (mt->isBusy()) {
;
}
if (nframes >= 0) {
if (nframes > 0) {
sprintf(ffname, "%s/%s_f%05d.tiff", outdir, fformat, ifile);
sprintf(imgfname, (const char*)ffname, irun);
} else {
sprintf(ffname, "%s/%s.tiff", outdir, fformat);
sprintf(imgfname, (const char*)ffname, irun);
}
cout << "Writing tiff to " << imgfname << " " << thr1 << endl;
mt->writeImage(imgfname, thr1);
mt->clearImage();
if (of) {
fclose(of);
of = NULL;
mt->setFilePointer(NULL);
}
}
std::time(&end_time);
cout << std::ctime(&end_time) << endl;
} else
cout << "Could not open " << fname << " for reading " << endl;
}
if (nframes < 0) {
sprintf(ffname, "%s/%s.tiff", outdir, fformat);
strcpy(imgfname, ffname);
cout << "Writing tiff to " << imgfname << " " << thr1 << endl;
mt->writeImage(imgfname, thr1);
}
return 0;
}

View File

@ -0,0 +1,679 @@
#include "onlinedisp_zmq.h"
bool hasallpede;
TH1F * his102;TH1F * his101;
int processedf;
sls::zmqHeader zHeader;
#define PEDEFNAME "current_pede.dat"
#define NPRO 50
#define NPRI 50
//#define JFSTRX
#ifdef JFSTRX
#include "jungfrauLGADStrixelsData.h"
#else
#include "jungfrauModuleData.h"
#endif
int main(int argc, char* argv[])
{
goout=1;
hasallpede=false;
dophotonmap=true; if ((argc<3)) {printf("USAGE: command photon_energy_(peakinADC) [rx_ip] [port] \n"); return -1 ;}
else {
phene=atoi(argv[1]);
if (phene<0) dophotonmap=false;
threshold=float (phene/2);
printf( " \n");
printf( "phene %d \n",phene);
}
if (argc>=3) {
strcpy(serverip,argv[2]);
printf("ip is %s ",serverip);
}
portnum=30001;
if (argc>=4 ){ portnum= atoi(argv[3]);
}
printf(", port number is %d ",portnum); printf(". \n");
#ifdef JFSTRX
cout << "JFSTRX" << endl;
jungfrauLGADStrixelsData *decoder = new jungfrauLGADStrixelsData();
nx = 1024/5; ny= 512*5;
#else
nx = 1024; ny= 512;
#endif
gain_flag=false;
pede_flag=false;
bw_flag=false;
HDraw_every=20;
fixranges=false;
hchptr = (short*) malloc(NCH*sizeof(short));
startsocket(); //create and connect ZMQ
for (ipx=0;ipx<NCH;ipx++) hchptr[(ipx)]=0;
// cout<< decoder->getValue((char*)(hchptr),279,130)<<endl;
nonblock(NB_ENABLE);
cout <<"opening the rootapp" <<endl;
rootapp = new TApplication("Online JF display",&argc, argv);
LoadPaletteFalse();
char hname[100];
his1000= new TH2F("his1000","2d , ev. pede corrected",nx,-0.5,nx-0.5,ny,-0.5,ny-0.5);
his1000->SetOption("colz");
his2000= new TH2F("his2000","2d gain ",nx,-0.5,nx-0.5,ny,-0.5,ny-0.5);
his2000->GetZaxis()->SetRangeUser(0,4);
if (dophotonmap) {
his3000= new TH2F("his3000"," photon map ",nx,-0.5,nx-0.5,ny,-0.5,ny-0.5);
}
else {
his3000= new TH2F("his3000"," raw adc ",nx,-0.5,nx-0.5,ny,-0.5,ny-0.5);
}
his4500= new TH2F("his45000","L vs R",101,-50,500,101,-50,500);
hchip=new TH1I*[8];
for (i=0;i<8;i++) {
sprintf(hname,"hchip%d",i);
hchip[i] = new TH1I(hname,hname,NBIN,MIN_POS,MAX_POS);
}
cout <<"end of histo booking" <<endl;
if (A2==NULL) A2 = new TCanvas("A2","Plotting Canvas gain",150,10,500,250);
if (A3==NULL) A3 = new TCanvas("A3","Plotting Canvas ADC",150,360,1200,550);
if (A4==NULL) A4 = new TCanvas("A4","Plotting Canvas PHs",750,300,1000,800);
A4->Clear();
A4->Divide(4,2,0.005,0.005);
if (A5==NULL) A5 = new TCanvas("A5","Plotting Canvas Photon Map",750,300,1000,600);
if (A6==NULL) A6 = new TCanvas("A6","Plotting Canvas LvsR",650,250,650,660);
gSystem->ProcessEvents();
int running=0;
char runc[15]="*\\-/|";
printhelp();
while (1==1) { // loop on streamed frames
if(!zmqSocket->ReceiveHeader(0,zHeader, SLS_DETECTOR_JSON_HEADER_VERSION)){
cout<< "Receiver stopped, waiting for new stream" << endl;
zmqSocket->Disconnect();
zmqSocket->Connect();
}
else {
// if (((icount++)%10)==0) cout <<"recived frameindex "<<zHeader.frameIndex <<endl;
//cout <<"there" <<endl;
zmqSocket->ReceiveData(0, (char *)(&image_data), NCH*2);
}
{
framesinstream++;
running++;
fill1Ds=true; //alway fill 1d and LR plots
//if (((framesinstream%(int(HDraw_every)))==(int (HDraw_every)-1))) {fill1Ds=true;}else{fill1Ds=false;}
if (((framesinstream%(HDraw_every))==(HDraw_every)-1)) {show2Ds=true;}else{show2Ds=false;}
if (((framesinstream%NPRI)==NPRI-1)) { cout<<"\r "<<"frame (from start): "<<framesinstream<<" " << runc[((running/NPRI)%5)]<< " discarded frames %=" << (1-float(processedf)/float(zHeader.frameIndex-frameIndex_old))*100 << " current framenumber= " <<zHeader.frameIndex << " "<<std::flush; processedf=0;frameIndex_old=zHeader.frameIndex;}
npacket=0;
if (show2Ds) {
his1000->Reset();
his2000->Reset();
if (!dophotonmap) his3000->Reset(); //FOR RAW ADC DISPLAY
}
if ((fill1Ds)or(show2Ds)or(dophotonmap)) { // do something, otherwise skip to the next
processedf++;
for (i=0 ;i<NCH;i++) {
adcvalue= (image_data[i]) & 0x3fff;
if ((image_data[i] & 0xc000)!=0){ gain = (image_data[i]>>14) & 0x3;} else {gain=0;}
if (pede_flag){
if (gain_flag)
{
if ((gain==0)||(!hasallpede)) adcpedecorr=(adcvalue&0x3fff)*fgaind[i]-fpeded[i]*fgaind[i];
if ((gain==1)&&hasallpede) adcpedecorr=(fpedeG1d[i]*fgaind[i]+G1Poffset-adcvalue*fgaind[i])*30.0;
if ((gain==3)&&hasallpede) adcpedecorr=(fpedeG2d[i]*fgaind[i]+G2Poffset-adcvalue*fgaind[i])*340.0;
}
else
{
if ((gain==0)||(!hasallpede)) adcpedecorr=(adcvalue&0x3fff)-fpeded[i];
if ((gain==1)&&hasallpede) adcpedecorr=(fpedeG1d[i]+G1Poffset-adcvalue)*30.0;
if ((gain==3)&&hasallpede) adcpedecorr=(fpedeG2d[i]+G2Poffset-adcvalue)*340.0;
}
} else {adcpedecorr=float (adcvalue);} //end of if pede
if ((adcpedecorr>threshold)&&(pede_flag)) hchptr[(i)]= hchptr[(i)]+(int)((adcpedecorr+threshold)/phene);
if (fill1Ds) {
if (((i%1024)<1004)&&((i%1024)>20)&&((i/1024)>20)) { //skip the pix near guardring for PH plots
ichip= i/(256*256*4)*4+((i/256)%4) ;
hchip[ichip]->Fill(adcpedecorr,1);
if (((i%256)<253)&&((i%256)>2)) his4500->Fill(adcpedecorrold,adcpedecorr,1);
adcpedecorrold=adcpedecorr;
}
}//if (fill1Ds)
if ((show2Ds)) {
factor=2.0;
value=adcpedecorr;
if ((i%256==0)||(i%256==255)) value=int(value/factor);
if ((i/1024==255)||(i/1024==256)||(i/1024==767)||(i/1024==768)) value=int(value/factor);
his1000->Fill(float(i%1024),float(int (i/1024)),value);
if (!dophotonmap) his3000->Fill(float(i%1024),float(int (i/1024)) ,adcvalue);
his2000->Fill(float(i%1024),float(int (i/1024)) ,gain);
value=(int)(hchptr[i]);
if ((i%256==0)||(i%256==255)) value=int(value/factor);
if ((i/1024==255)||(i/1024==256)||(i/1024==767)||(i/1024==768)) value=int(value/factor);
if (dophotonmap) his3000->Fill(float(i%1024),float(int (i/1024)),float(value));
}
}// for (i=0 ;i<NCH-0;i++)
}// /end of do something
if ((show2Ds)) {
for (ipx=0;ipx<NCH;ipx++) hchptr[(ipx)]=0;
Plot2DHistos(); Plot1DHistos();
}
ifp=kbhit();
processifp(ifp);
if (((framesinstream%NPRO))==NPRO-1) gSystem->ProcessEvents();
}
}// end of infinite loop
rootapp->Run();
nonblock(NB_DISABLE);
return 0;
}
void processifp(int ifp){
if (ifp!=0){
c=fgetc(stdin);
if (c=='s') {if (goout==0){goout=1;}else {myloop();}}
if (c=='S') SetRanges();
if (c=='+') { HDraw_every=HDraw_every*0.8;cout<< endl <<"Drawing every "<< HDraw_every<<" frames "<<endl; }
if (c=='-') { HDraw_every=HDraw_every*1.25;cout<< endl <<"Drawing every "<< HDraw_every<<" frames "<<endl;}
if (c=='G') {gain_flag=not gain_flag ;if (gain_flag) {cout<<"gain corr enab."<< endl;}else {cout<<"gain corr disab."<< endl;}}
if (c=='[') { G1Poffset=G1Poffset-10;cout<< endl <<"G1Poffset "<<G1Poffset<<endl; }
if (c==']') { G1Poffset=G1Poffset+10;cout<< endl <<"G1Poffset "<<G1Poffset<<endl; }
if (c=='{') { G2Poffset=G2Poffset-10;cout<< endl <<"G2Poffset "<<G2Poffset<<endl; }
if (c=='}') { G2Poffset=G2Poffset+10;cout<< endl <<"G2Poffset "<<G2Poffset<<endl; }
if (c=='p') { //stopsocket();
loadpede();//startsocket();
}
if (c=='b') {LoadPaletteBW(1.1111);bw_flag=true; }
if (c=='B') {LoadPaletteBW(0.9);bw_flag=true; }
if (c=='O') savepede();
if (c=='o') readpede();
if (c=='P') loadallpede();
if (c=='u') his1000->SetOption("surf2z");
if (c=='C') his1000->SetOption("colz");
if (c=='q') exit(0);
if (c=='r') historeset();
if (c=='R') axisreset();
}
}
void loadallpede(){
cout <<"not implemented "<< endl;
// hasallpede=true;
// system("./sls_detector_put setbit 0x5d 12 "); //setting to FSG1 ;
// loadpede();
// loadpede();
// for (i=0;i<NCH;i++) {fpedeG1d[i]=fpeded[i];}
// system("./sls_detector_put setbit 0x5d 13 "); //setting to FSG0 ;
// sleep(1);
// loadpede();
// loadpede();
// for (i=0;i<NCH;i++) {fpedeG2d[i]=fpeded[i];}
// system("./sls_detector_put clearbit 0x5d 12 "); //setting to G0;
// system("./sls_detector_put clearbit 0x5d 13 "); //setting to G0;
// sleep(2);
// loadpede();
// loadpede();
}
void loadpede(void){
//startsocket();
framesinstream=0;
pede_flag=true;
nframes=0;
for (ipx=0;ipx<NCH;ipx++) fpeded[ipx]=0;
while (framesinstream<50) { // loop on files
if (!zmqSocket->ReceiveHeader(0,zHeader, SLS_DETECTOR_JSON_HEADER_VERSION)){
return;
}
cout <<"received frameindex "<<zHeader.frameIndex << endl;
zmqSocket->ReceiveData(0, (char *)(&image_data), NCH*2);
framesinstream++;nframes++;
for (ipx=0;ipx<NCH;ipx++) fpeded[ipx]=(fpeded[ipx]*(nframes-1)+(float)(image_data[ipx]&0x3fff))/(float)(nframes);
}
for (ipx=0;ipx<NCH;ipx++) { ipeded[ipx]=(short)(fpeded[ipx]);
if (ipx%60033==0) printf("i=%d pede= %d %f .\n",ipx, ipeded[ipx],fpeded[ipx]);
}
printf("total frames for pede: %d \n",nframes);
//stopsocket();
printhelp();
}
int kbhit()
{
struct timeval tv;
fd_set fds;
tv.tv_sec = 0;
tv.tv_usec = 0;
FD_ZERO(&fds);
FD_SET(STDIN_FILENO, &fds); //STDIN_FILENO is 0
select(STDIN_FILENO+1, &fds, NULL, NULL, &tv);
return FD_ISSET(STDIN_FILENO, &fds);
}
void myloop(void){ //wait doing nothing.
goout=0;
int ifp;
while (goout==0){
ifp=kbhit();
processifp(ifp);
gSystem->ProcessEvents();
usleep(5000);
}
}
void printhelp(){
cout<< endl << "s=start/pause| p/n=getnewpede/raw | o/O=read/save pede | n=nopede(raw) | r/R=rst His/Axis | +/- = faster/slower ref. |q=exit | U/C sUrf2/Colz " <<endl;
}
void historeset(){
his4500->Reset();
his3000->Reset();
for (i=0;i<8;i++) {
hchip[i]->Reset();
}
Plot2DHistos();
Plot1DHistos();
}
void SetRanges() {
string str;
std::cin.clear();
//cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
cout<< endl;
cout<< " adc min " <<endl;
//getline(cin, str);
// adcmin= stoi(str);
std::cin >> adcmin;
cout<< " adc max " <<endl;
std::cin >> adcmax;
cout<< " p.map min " <<endl;
std::cin >> pmmin;
cout<< " p.map max " <<endl;
std::cin >> pmmax;
fixranges=true;
}
void axisreset(){
fixranges=false;
his1000->GetXaxis()->UnZoom();
his1000->GetYaxis()->UnZoom();
his1000->GetZaxis()->UnZoom();
his2000->GetXaxis()->UnZoom();
his2000->GetYaxis()->UnZoom();
his3000->GetZaxis()->UnZoom();
for (i=0;i<8;i++) {
hchip[i]->GetXaxis()->UnZoom();
hchip[i]->GetYaxis()->UnZoom();
}
his4500->GetXaxis()->UnZoom();
his4500->GetYaxis()->UnZoom();
his4500->GetZaxis()->UnZoom();
Plot2DHistos();
Plot1DHistos();
}
void nonblock(int state)
{
struct termios ttystate;
//get the terminal state
tcgetattr(STDIN_FILENO, &ttystate);
if (state==NB_ENABLE)
{
//turn off canonical mode
ttystate.c_lflag &= ~ICANON;
//minimum of number input read.
ttystate.c_cc[VMIN] = 1;
}
else if (state==NB_DISABLE)
{ //turn on canonical mode
ttystate.c_lflag |= ICANON;
}
//set the terminal attributes.
tcsetattr(STDIN_FILENO, TCSANOW, &ttystate);
}
void LoadPaletteFalse(){
const Int_t NRGBs = 5;
const Int_t NCont = 90;
Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
TColor::CreateGradientColorTable(NRGBs, stops, red,green, blue, NCont);
gStyle->SetNumberContours(NCont);
TColor::CreateGradientColorTable(NRGBs, stops, red,green ,blue, NCont);
gStyle->SetNumberContours(NCont);
}
void LoadPaletteBW(float gammatune){
vgamma=vgamma*gammatune;
cout<< "gamma is "<<vgamma<<endl;
const Int_t NRGBs = 99;
const Int_t NCont = 990;
Double_t stops[NRGBs] ;
Double_t red[NRGBs] ;
Double_t green[NRGBs];
Double_t blue[NRGBs] ;
for (int iRGB=0;iRGB<NRGBs;iRGB++){
stops[iRGB] =(1/float(NRGBs)*float(iRGB));
red[iRGB] = pow(stops[iRGB],vgamma);
green[iRGB] = red[iRGB];
blue[iRGB] =red[iRGB];
// cout << iRGB<<" "<< stops[iRGB] <<" " << red[iRGB]<<endl;
}
TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
gStyle->SetNumberContours(NCont);
// TColor::SetPalette(52,0,1);
}
void Plot1DHistos(void){
if (hchip[0]->GetXaxis()->GetLast()!=oldh0xlast){
oldh0xlast=hchip[0]->GetXaxis()->GetLast();
oldh0xfirst=hchip[0]->GetXaxis()->GetFirst();
for (int ipad=1; ipad<8;ipad++) {
hchip[ipad]->GetXaxis()->SetRange(oldh0xfirst,oldh0xlast);
}
}
for (int ipad=0; ipad<8;ipad++) {
A4->cd(ipad+1);
gStyle->SetOptStat(1); gPad->SetLogy();
hchip[ipad%4+(1-int(ipad/4))*4]->Draw();
}
A4->cd();
A4->Update();
}
void Plot2DHistos(void){
gStyle->SetOptStat(0);
A3->cd();
// if (bw_flag) LoadPaletteBW(1.0);
if (fixranges) {
his1000->GetZaxis()->SetRangeUser(float(adcmin),float(adcmax));
his3000->GetZaxis()->SetRangeUser(float(pmmin),float(pmmax));
}
his1000->SetMinimum(-200);
his1000->Draw();
A3->Update();
A2->cd();
// if (bw_flag) LoadPaletteFalse();
his2000->GetXaxis()->SetRange(his1000->GetXaxis()->GetFirst(),his1000->GetXaxis()->GetLast());
his2000->GetYaxis()->SetRange(his1000->GetYaxis()->GetFirst(),his1000->GetYaxis()->GetLast());
his2000->Draw("colz");
A2->Update();
A5->cd();
his3000->GetXaxis()->SetRange(his1000->GetXaxis()->GetFirst(),his1000->GetXaxis()->GetLast());
his3000->GetYaxis()->SetRange(his1000->GetYaxis()->GetFirst(),his1000->GetYaxis()->GetLast());
his3000->Draw("colz");
A5->Update();
A6->cd();
his4500->Draw("colz");
A6->Update();
}
void startsocket(void) {
try {
zmqSocket = new sls::ZmqSocket(serverip, portnum);
} catch (...) {
cprintf(RED,
"Error: Could not create Zmq socket on port %d with ip %s\n",
portnum, serverip);
delete zmqSocket;
return;
}
zmqSocket->SetReceiveHighWaterMark(3);
zmqSocket->SetReceiveBuffer(1024*1024);
zmqSocket->Connect();
cout<<"Zmq Client[] "<< zmqSocket->GetZmqServerAddress()<<endl;
haveconnection=true;
}
void tryconnect(void)
{
int itry=0;
cout<< endl;
while (haveconnection==false) {
sleep(1);
cout<<"\r trying to (re)connect " <<itry++ << " " << endl ;
startsocket();
}
}
void stopsocket(void) {
// cout<<" cfd " << cfd << endl;;
delete zmqSocket;
zmqSocket=0;
//zmqSocket->~ZmqSocket ();
haveconnection=false;
}
void savepede(void) {
int pfd;
pfd=open(PEDEFNAME,O_CREAT|O_WRONLY, 0666);
if (pfd==-1) perror("open pede file");
write(pfd,fpeded,2*NCH*sizeof(float));
write(pfd,fpedeG1d,2*NCH*sizeof(float));
write(pfd,fpedeG2d,2*NCH*sizeof(float));
close(pfd);
}
void readpede(void) {
int pfd;
pfd=open(PEDEFNAME,O_RDONLY);
if (pfd==-1) perror("open pede file");
read(pfd,fpeded,NCH*2*sizeof(float));
read(pfd,fpedeG1d,NCH*2*sizeof(float));
read(pfd,fpedeG2d,NCH*2*sizeof(float));
close(pfd);
pede_flag=true;
hasallpede=true;
}

View File

@ -0,0 +1,204 @@
/**************************************************************************/
/* Header files section needs cleanup */
/**************************************************************************/
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include "sls/ZmqSocket.h"
#include "sls/tiffIO.h"
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdlib.h> /* exit() */
#include <string.h> /* memset(), memcpy() */
#include <sys/utsname.h> /* uname() */
#include <sys/types.h>
#include <sys/socket.h> /* socket(), bind(),
listen(), accept() */
#include <sys/time.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h> /* fork(), write(), close() */
#include <time.h>
#include <sys/time.h>
#include <sys/mman.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <cmath>
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <rapidjson/document.h> //json header in zmq stream
#include <omp.h>
#define NTHREADS 2
#include <chrono>
#include <cstdio>
#include <ctime> // time_t
using namespace std;
using namespace std::chrono;
using namespace sls;
#include "TCanvas.h"
#include "TH1F.h"
#include "TF1.h"
#include "TH2F.h"
#include "TMath.h"
#include "TFile.h"
#include "TStyle.h"
#include "TSystem.h"
#include "TTimer.h"
#include "TProfile.h"
#include "TColor.h"
#include <iostream>
#include <fstream>
#include <termios.h>
#include <TApplication.h>
#include <stdio.h>
#include <math.h>
#include <fstream>
#include <iomanip>
#include <sstream>
#include <string>
#include <vector>
#include <iostream>
#include "sls/ansi.h"
#define SLS_DETECTOR_JSON_HEADER_VERSION 0x4
#define PI 3.14159265
#define FALSE 0
#define OFFSET 0
#define NBIN 500
#define MIN_POS -500.5 // 400.5
#define MAX_POS 3499.5 //-100.5
#define NCH 524288
// #define NCH 262144 in case of half_frames
char serverip[256];
int portnum;
FILE * sfilefd;
short* hchptr; // photon counted map "histogram"
int value;
float factor=1.84;
int npacket=0;
int totalnpacket=0;
float vgamma;
struct sockaddr_in serveraddr;
struct sockaddr_in clientaddr;
struct in_addr inadr;
struct hostent *server;
int i=0;
int ipx=0;
bool haveconnection;
TStyle *gStyle;
TApplication* rootapp;
TCanvas *A2;
TCanvas *A3;
TCanvas *A4;
TCanvas *A5;
TCanvas *A6;
TH1I **hchip;
TH2F **h4500chip;
short image_data[NCH*2];
short imaged[NCH*2];
float fpeded[NCH*2];
float fpedeG2d[NCH*2];
float fpedeG1d[NCH*2];
short ipeded[NCH*2];
short pcimaged[NCH*2];
float fgaind[NCH*2];
float adcpedecorr,adcpedecorrold;
bool gain_flag;
bool bw_flag;
bool fill2Ds;
bool show2Ds;
bool fill1Ds;
bool pede_flag;
bool dophotonmap;
int nx, ny;
int nframes;
int goout;
int framesinstream;
int ifp;
float threshold;
int phene;
int adcvalue;
int gain;
int ichip;
int frameIndex_old;
char pedefilename[128];
int framenum,bunchid;
TH2F* his1000;
TH2F* his2000;
TH2F* his3000;
TH2F* his4500;
TH1I* hproj;
TH1I* hchcum;
using namespace std;
void printhelp(void);
void processifp(int ifp);
void historeset(void);
void SetRanges(void);
void startsocket(void);
void stopsocket(void);
void axisreset(void);
int kbhit(void);
void myloop(void);
void loadpede(void);
void loadallpede(void);
void loadgain(void);
void nonblock(int state);
void LoadPaletteFalse(void);
void LoadPaletteBW(float);
void Plot1DHistos(void);
void Plot2DHistos(void);
void savepede(void);
void readpede(void);
int findinterpoindex(int startindex);
int findclumax(int startindex);
void tryconnect(void) ;
#define NB_ENABLE 1
#define NB_DISABLE 0
char c;
int HDraw_every;
float oldh0xfirst,oldh0xlast;
int idx;
int GXPoffset,G1Poffset,G2Poffset;
int ix,iy;
int adcmin,adcmax;
int pmmin,pmmax; //min/mnx for the photon map
bool fixranges;
sls::ZmqSocket *zmqSocket= NULL;

View File

@ -33,7 +33,7 @@ int main(int argc, char *argv[]) {
#ifndef FF
if (argc < 9) {
cout << "Wrong usage! Should be: " << argv[0]
<< " infile etafile outfile runmin runmax ns cmin cmax" << endl;
<< " infile etafile outfile runmin runmax ns [cmin cmax xmin xmax ymin ymax]" << endl;
return 1;
}
#endif
@ -41,7 +41,7 @@ int main(int argc, char *argv[]) {
#ifdef FF
if (argc < 7) {
cout << "Wrong usage! Should be: " << argv[0]
<< " infile etafile runmin runmax cmin cmax" << endl;
<< " infile etafile runmin runmax [cmin cmax xmin xmax ymin ymax]" << endl;
return 1;
}
#endif
@ -65,13 +65,30 @@ int main(int argc, char *argv[]) {
nsubpix = atoi(argv[iarg++]);
cout << "Subpix: " << nsubpix << endl;
#endif
float cmin = atof(argv[iarg++]);
float cmax = atof(argv[iarg++]);
float cmin = 0;
float cmax=1000000;
if (argc>iarg)
cmin=atof(argv[iarg++]);
if (argc>iarg)
cmax= atof(argv[iarg++]);
cout << "Energy min: " << cmin << endl;
cout << "Energy max: " << cmax << endl;
int xmin=0, xmax=NC, ymin=0, ymax=NR;
if (argc>iarg)
xmin=atof(argv[iarg++]);
if (argc>iarg)
xmax= atof(argv[iarg++]);
if (argc>iarg)
ymin=atof(argv[iarg++]);
if (argc>iarg)
ymax= atof(argv[iarg++]);
// int etabins=500;
int etabins = 1000; // nsubpix*2*100;
double etamin = -1, etamax = 2;
double etamin = -0.25, etamax = 1.25;
// double etamin=-0.1, etamax=1.1;
// double eta3min = -2, eta3max = 2;
double sum, totquad;
@ -80,7 +97,7 @@ int main(int argc, char *argv[]) {
// double eta3x, eta3y, int3_x, int3_y, noint_x, noint_y;
int ix, iy, isx, isy;
int nframes = 0, lastframe = -1;
int nframes = 0, lastframe = -1, iframe, nphFrame;
//double d_x, d_y, res = 5, xx, yy;
int nph = 0, totph = 0;
//badph = 0,
@ -98,7 +115,7 @@ int main(int argc, char *argv[]) {
// int nSubPixels = nsubpix;
#ifndef NOINTERPOLATION
eta2InterpolationPosXY *interp =
new eta2InterpolationPosXY(NC, NR, nsubpix, etabins, etamin, etamax);
new eta2InterpolationPosXY(NC, NR, nsubpix, nsubpix, etabins, etabins, etamin, etamax);
// eta2InterpolationCleverAdaptiveBins *interp=new
// eta2InterpolationCleverAdaptiveBins(NC, NR, nsubpix, etabins, etamin,
// etamax);
@ -107,8 +124,8 @@ int main(int argc, char *argv[]) {
noInterpolation *interp = new noInterpolation(NC, NR, nsubpix);
#endif
#ifndef FF
int quad;
#ifndef FF
#ifndef NOINTERPOLATION
char fname[10000];
int ok;
@ -142,19 +159,26 @@ int main(int argc, char *argv[]) {
#endif
int irun;
for (irun = runmin; irun < runmax; irun++) {
for (irun = runmin; irun <= runmax; irun++) {
sprintf(infname, argv[1], irun);
#ifndef FF
sprintf(outfname, argv[3], irun);
#endif
f = fopen(infname, "r");
if (f) {
cout << infname << endl;
nframes = 0;
//f0 = -1;
while (cl.read(f)) {
//iff=0;
while (fread((void*)&iframe, 1, sizeof(int), f)) {
//n=0;
if (fread((void*)&nphFrame, 1, sizeof(int), f)) {
for (int iph=0; iph<nphFrame; iph++) {
//while (cl.read(f)) {
if (cl.read(f)) {
totph++;
if (lastframe != cl.iframe) {
lastframe = cl.iframe;
@ -165,18 +189,28 @@ int main(int argc, char *argv[]) {
nframes++;
}
// quad=interp->calcQuad(cl.get_cluster(), sum, totquad, sDum);
#ifndef FF
// #ifndef FF
// quad = interp->calcEta(cl.get_cluster(), etax, etay, sum,
// totquad, sDum);
// #endif
// #ifdef FF
quad = interp->calcEta(cl.get_cluster(), etax, etay, sum,
totquad, sDum);
#endif
#ifdef FF
interp->calcEta(cl.get_cluster(), etax, etay, sum,
totquad, sDum);
#endif
/* cl.print();
cout << "(" << etax <<","<< etay <<")"<< quad<< endl;
*/
//#endif
if (sum > cmin && totquad / sum > 0.8 && totquad / sum < 1.2 &&
sum < cmax) {
nph++;
if (totquad > cmin && cl.x >= xmin && cl.x <= xmax &&
cl.y >= ymin && cl.y <= ymax &&
totquad < cmax) {
// if (sum > cmin && totquad / sum > 0.8 && totquad / sum < 1.2 &&
// sum < cmax) {
nph++;
// if (sum>200 && sum<580) {
// interp->getInterpolatedPosition(cl.x,cl.y,
// totquad,quad,cl.get_cluster(),int_x, int_y);
@ -227,9 +261,12 @@ int main(int argc, char *argv[]) {
#ifdef FF
interp->writeFlatField(outfname);
#endif
}
}
}
}
}
}
}
fclose(f);
#ifdef FF

View File

@ -304,18 +304,38 @@ int main(int argc, char *argv[]) {
int ifile = 0;
mt->setFrameMode(eFrame);
int filelist=0;
ifstream flist;
flist.open (fformat, std::ifstream::in);
if (flist.is_open()) {
runmin=0;
runmax=0;
while (flist.getline(ffname,10000)){
cout << ffname << endl;
runmax++;
}
runmax--;
flist.close();
cout << "Found " << runmax << " files " << endl;
flist.open (fformat, std::ifstream::in);
}
for (int irun = runmin; irun <= runmax; irun++) {
cout << "DATA ";
// sprintf(fn,fformat,irun);
sprintf(ffname, "%s/%s.raw", indir, fformat);
sprintf(fname, (const char*)ffname, irun);
sprintf(ffname, "%s/%s.tiff", outdir, fformat);
sprintf(imgfname, (const char*)ffname, irun);
sprintf(ffname, "%s/%s.clust", outdir, fformat);
sprintf(cfname, (const char*)ffname, irun);
if (flist.is_open()) {
flist.getline(ffname,10000);
cout << "file list " << ffname << endl;
} else {
sprintf(ffname,(const char*)fformat,irun);
cout << "loop " << ffname << endl;
}
cout << "ffname "<<ffname << endl;
sprintf(fname, "%s/%s.raw",indir,ffname);
sprintf(imgfname, "%s/%s.tiff",outdir,ffname);
sprintf(cfname, "%s/%s.clust",outdir,ffname);
cout << fname << " ";
cout << imgfname << endl;
cout << imgfname << " " << cfname << endl;
std::time(&end_time);
cout << std::ctime(&end_time) << endl;
// cout << fname << " " << outfname << " " << imgfname << endl;
@ -349,13 +369,15 @@ int main(int argc, char *argv[]) {
mt->popFree(buff);
ifr++;
if (ifr % 100 == 0)
if (ifr % 10000 == 0)
cout << ifr << " " << ff << endl;
if (nframes > 0) {
if (ifr % nframes == 0) {
sprintf(ffname, "%s/%s_f%05d.tiff", outdir, fformat,
ifile);
sprintf(imgfname, (const char*)ffname, irun);
sprintf(imgfname, "%s/%s_f%05d.tiff",outdir,ffname,ifile);
while (mt->isBusy())
;
mt->writeImage(imgfname, thr1);
mt->clearImage();
ifile++;
@ -374,13 +396,13 @@ int main(int argc, char *argv[]) {
}
if (nframes >= 0) {
if (nframes > 0) {
sprintf(ffname, "%s/%s_f%05d.tiff", outdir, fformat, ifile);
sprintf(imgfname, (const char*)ffname, irun);
sprintf(imgfname, "%s/%s_f%05d.tiff",outdir,ffname,ifile);
} else {
sprintf(ffname, "%s/%s.tiff", outdir, fformat);
sprintf(imgfname, (const char*)ffname, irun);
sprintf(imgfname, "%s/%s_f%05d.tiff",outdir,ffname,ifile);
}
cout << "Writing tiff to " << imgfname << " " << thr1 << endl;
while (mt->isBusy())
;
mt->writeImage(imgfname, thr1);
mt->clearImage();
if (of) {
@ -395,11 +417,12 @@ int main(int argc, char *argv[]) {
cout << "Could not open " << fname << " for reading " << endl;
}
if (nframes < 0) {
sprintf(ffname, "%s/%s.tiff", outdir, fformat);
strcpy(imgfname, ffname);
cout << "Writing tiff to " << imgfname << " " << thr1 << endl;
mt->writeImage(imgfname, thr1);
sprintf(imgfname, "%s/%s_tot.tiff",outdir,ffname);
cout << "Writing tiff to " << imgfname << " " << thr1 << endl;
mt->writeImage(imgfname, thr1);
}
if (flist.is_open()) {
flist.close();
}
return 0;
}

View File

@ -720,6 +720,22 @@ int main(int argc, char *argv[]) {
ymin >> ymax;
}
if (addJsonHeader.find("xMin") != addJsonHeader.end()) {
istringstream(addJsonHeader.at("xMin")) >> xmin;
}
if (addJsonHeader.find("yMin") != addJsonHeader.end()) {
istringstream(addJsonHeader.at("yMin")) >> ymin;
}
if (addJsonHeader.find("xMax") != addJsonHeader.end()) {
istringstream(addJsonHeader.at("xMax")) >> xmax;
}
if (addJsonHeader.find("yMax") != addJsonHeader.end()) {
istringstream(addJsonHeader.at("yMax")) >> ymax;
}
cprintf(MAGENTA, "%d %d %d %d\n", xmin, xmax, ymin, ymax);
mt->setROI(xmin, xmax, ymin, ymax);
if (addJsonHeader.find("dynamicRange") != addJsonHeader.end()) {

View File

@ -533,7 +533,7 @@ class singlePhotonDetector : public analogDetector<uint16_t> {
(clusters + nph)->print();
cout << max << " " << val[iy * nx + ix] << endl;
}
good = 1;
//good = 1;
if (eMin > 0 && tot < eMin)
good = 0;
if (eMax > 0 && tot > eMax)
@ -542,7 +542,7 @@ class singlePhotonDetector : public analogDetector<uint16_t> {
nph++;
image[iy * nx + ix]++;
}
good=1;
} else if (ee == PEDESTAL) {
addToPedestal(data, ix, iy, cm);
} /*else {

View File

@ -59,6 +59,7 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
void ClonePlot();
void SavePlot();
void SetGapPixels(bool enable);
void UpdatePlot();
protected:
void resizeEvent(QResizeEvent *event);
@ -67,7 +68,6 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
void Zoom1DGainPlot(const QRectF &rect);
void Zoom2DGainPlot(const QRectF &rect);
void SetSaveFileName(QString val);
void UpdatePlot();
signals:
void AcquireFinishedSignal();

View File

@ -47,6 +47,7 @@ class qTabPlot : public QWidget, private Ui::TabPlotObject {
private:
void SetupWidgetWindow();
void Initialization();
bool VerifyGapPixelsAllowed();
void Select1DPlot(bool enable);
void GetGapPixels();
void GetStreamingFrequency();
@ -60,7 +61,8 @@ class qTabPlot : public QWidget, private Ui::TabPlotObject {
Detector *det;
qDrawPlot *plot;
bool is1d;
bool is1d{false};
bool isGapPixelsAllowed{false};
/** default plot and axis titles */
static QString defaultPlotTitle;

View File

@ -193,6 +193,7 @@ void qDrawPlot::SetupPlots() {
gainplot2d = new SlsQt2DPlot(boxPlot, true);
gainplot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5,
nPixelsY - 0.5, gainData);
gainplot2d->Update();
gainplot2d->hide();
connect(plot2d, SIGNAL(PlotZoomedSignal(const QRectF &)), this,
SLOT(Zoom2DGainPlot(const QRectF &)));
@ -1009,6 +1010,7 @@ void qDrawPlot::Update2dPlot() {
if (isGainDataExtracted) {
gainplot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5,
nPixelsY - 0.5, gainData);
gainplot2d->Update();
if (!gainplot2d->isVisible()) {
gainplot2d->setFixedWidth(plot2d->width() /
qDefs::DATA_GAIN_PLOT_RATIO);

View File

@ -182,8 +182,10 @@ void qTabDataOutput::BrowseOutputDir() {
LOG(logDEBUG) << "Browsing output directory";
QString directory = QFileDialog::getExistingDirectory(
this, tr("Choose Output Directory "), dispOutputDir->text());
if (!directory.isEmpty())
if (!directory.isEmpty()) {
dispOutputDir->setText(directory);
ForceSetOutputDir();
}
}
void qTabDataOutput::SetOutputDir(bool force) {

View File

@ -849,8 +849,9 @@ void qTabMeasurement::GetNextFrameNumber() {
"Inconsistent starting frame number for all detectors.");
spinNextFrameNumber->setValue(retval);
}
CATCH_DISPLAY("Could not get starting frame number.",
"qTabMeasurement::GetNextFrameNumber")
CATCH_HANDLE("Could not get starting frame number.",
"qTabMeasurement::GetNextFrameNumber", spinNextFrameNumber,
&QSpinBox::setValue, -1)
connect(spinNextFrameNumber, SIGNAL(valueChanged(int)), this,
SLOT(SetNextFrameNumber(int)));
}

View File

@ -16,7 +16,7 @@ QString qTabPlot::defaultImageYAxisTitle("Pixel");
QString qTabPlot::defaultImageZAxisTitle("Intensity");
qTabPlot::qTabPlot(QWidget *parent, Detector *detector, qDrawPlot *p)
: QWidget(parent), det(detector), plot(p), is1d(false) {
: QWidget(parent), det(detector), plot(p) {
setupUi(this);
SetupWidgetWindow();
LOG(logDEBUG) << "Plot ready";
@ -57,11 +57,7 @@ void qTabPlot::SetupWidgetWindow() {
chkGainPlot1D->setChecked(true);
plot->EnableGainPlot(true);
break;
case slsDetectorDefs::EIGER:
chkGapPixels->setEnabled(true);
break;
case slsDetectorDefs::JUNGFRAU:
chkGapPixels->setEnabled(true);
chkGainPlot->setEnabled(true);
chkGainPlot->setChecked(true);
plot->EnableGainPlot(true);
@ -69,6 +65,8 @@ void qTabPlot::SetupWidgetWindow() {
default:
break;
}
isGapPixelsAllowed = VerifyGapPixelsAllowed();
chkGapPixels->setEnabled(isGapPixelsAllowed);
Select1DPlot(is1d);
Initialization();
@ -195,6 +193,29 @@ void qTabPlot::Initialization() {
connect(dispZMax, SIGNAL(editingFinished()), this, SLOT(isZMaxModified()));
}
bool qTabPlot::VerifyGapPixelsAllowed() {
try {
switch (det->getDetectorType().squash()) {
case slsDetectorDefs::JUNGFRAU:
return true;
case slsDetectorDefs::EIGER:
if (det->getQuad().squash(false)) {
return true;
}
// full modules
if (det->getModuleGeometry().y % 2 == 0) {
return true;
}
return false;
default:
return false;
}
}
CATCH_DISPLAY("Could not verify if gap pixels allowed.",
"qTabPlot::VerifyGapPixelsAllowed")
return false;
}
void qTabPlot::Select1DPlot(bool enable) {
LOG(logDEBUG) << "Selecting " << (enable ? "1" : "2") << "D Plot";
is1d = enable;
@ -487,6 +508,7 @@ void qTabPlot::SetXYRange() {
}
plot->SetXYRangeChanged(disablezoom, xyRange, isRange);
plot->UpdatePlot();
emit DisableZoomSignal(disablezoom);
}
@ -624,6 +646,7 @@ void qTabPlot::SetZRange() {
zRange[1] = val;
}
plot->SetZRange(zRange, isZRange);
plot->UpdatePlot();
}
void qTabPlot::GetStreamingFrequency() {
@ -770,15 +793,10 @@ void qTabPlot::Refresh() {
boxFrequency->setEnabled(true);
GetStreamingFrequency();
GetHwm();
// gain plot, gap pixels enable
// gain plot
switch (det->getDetectorType().squash()) {
case slsDetectorDefs::EIGER:
chkGapPixels->setEnabled(true);
GetGapPixels();
break;
case slsDetectorDefs::JUNGFRAU:
chkGainPlot->setEnabled(true);
chkGapPixels->setEnabled(true);
GetGapPixels();
break;
case slsDetectorDefs::GOTTHARD2:
@ -787,6 +805,11 @@ void qTabPlot::Refresh() {
default:
break;
}
// gap pixels
if (isGapPixelsAllowed) {
chkGapPixels->setEnabled(true);
GetGapPixels();
}
} else {
boxFrequency->setEnabled(false);
chkGainPlot->setEnabled(false);

View File

@ -132,7 +132,7 @@ void qTabSettings::SetupWidgetWindow() {
}
void qTabSettings::SetExportMode(bool exportMode) {
if (comboGainMode->isVisible()) {
if (comboGainMode->isEnabled()) {
ShowFixG0(exportMode);
}
}

View File

@ -3,12 +3,12 @@
# empty branch = developer branch in updateAPIVersion.sh
branch=""
det_list=("ctbDetectorServer"
"gotthardDetectorServer"
"gotthard2DetectorServer"
"jungfrauDetectorServer"
"mythen3DetectorServer"
"moenchDetectorServer"
det_list=("ctbDetectorServer
gotthardDetectorServer
gotthard2DetectorServer
jungfrauDetectorServer
mythen3DetectorServer
moenchDetectorServer"
)
usage="\nUsage: compileAllServers.sh [server|all(opt)] [branch(opt)]. \n\tNo arguments mean all servers with 'developer' branch. \n\tNo 'branch' input means 'developer branch'"
@ -25,9 +25,11 @@ elif [ $# -eq 1 ] || [ $# -eq 2 ]; then
else
# only one server
# arg not in list
if [[ $det_list != *$1* ]]; then
echo $det_list | grep -w -q $1
#if [[ $det_list != *$1* ]]; then
if ! [[ $? ]] ; then
echo -e "Invalid argument 1: $1. $usage"
return -1
return 1
fi
declare -a det=("${1}")
#echo "Compiling only $1"
@ -37,14 +39,14 @@ elif [ $# -eq 1 ] || [ $# -eq 2 ]; then
# arg in list
if [[ $det_list == *$2* ]]; then
echo -e "Invalid argument 2: $2. $usage"
return -1
return 1
fi
branch+=$2
#echo "with branch $branch"
fi
else
echo -e "Too many arguments.$usage"
return -1
return 1
fi
declare -a deterror=("OK" "OK" "OK" "OK" "OK" "OK")

View File

@ -99,7 +99,7 @@ void basictests() {
#endif
if (mapCSP0() == FAIL) {
strcpy(initErrorMessage,
"Could not map to memory. Dangerous to continue.\n");
"Could not map to memory. Cannot proceed. Check Firmware.\n");
LOG(logERROR, (initErrorMessage));
initError = FAIL;
return;
@ -109,8 +109,10 @@ void basictests() {
if ((!debugflag) && (!updateFlag) &&
((checkType() == FAIL) || (testFpga() == FAIL) ||
(testBus() == FAIL))) {
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
"Dangerous to continue.\n");
sprintf(initErrorMessage,
"Could not pass basic tests of FPGA and bus. Cannot proceed. "
"Check Firmware. (Firmware version:0x%llx) \n",
getFirmwareVersion());
LOG(logERROR, ("%s\n\n", initErrorMessage));
initError = FAIL;
return;
@ -446,7 +448,7 @@ void initStopServer() {
if (mapCSP0() == FAIL) {
initError = FAIL;
strcpy(initErrorMessage,
"Stop Server: Map Fail. Dangerous to continue. Goodbye!\n");
"Stop Server: Map Fail. Cannot proceed. Check Firmware.\n");
LOG(logERROR, (initErrorMessage));
initCheckDone = 1;
return;

View File

@ -1106,7 +1106,9 @@ int Beb_SetDetectorPosition(int pos[]) {
int posRight[2] = {Beb_top ? pos[X] + 1 : pos[X], pos[Y]};
if (Beb_quadEnable) {
posRight[Y] = 1; // right is next row
posLeft[Y] = 1; // left is next row
posLeft[X] = 0; // left same first row
posRight[Y] = 0; // right same first row
posRight[X] = 0; // right same first column
}

View File

@ -25,7 +25,7 @@ target_include_directories(eigerDetectorServer_virtual
)
target_compile_definitions(eigerDetectorServer_virtual
PUBLIC EIGERD PCCOMPILE STOP_SERVER
PUBLIC EIGERD PCCOMPILE STOP_SERVER #TEST_MOD_GEOMETRY
PUBLIC VIRTUAL #VIRTUAL_9M
)

View File

@ -1240,19 +1240,16 @@ int Feb_Control_GetDynamicRange(int *retval) {
int Feb_Control_Disable16bitConversion(int disable) {
LOG(logINFO, ("%s 16 bit expansion\n", disable ? "Disabling" : "Enabling"));
uint32_t bitmask = DAQ_REG_HRDWRE_DSBL_16BIT_MSK;
unsigned int regval = 0;
if (!Feb_Control_ReadRegister(DAQ_REG_HRDWRE, &regval)) {
LOG(logERROR, ("Could not %s 16 bit expansion (bit mode)\n",
(disable ? "disable" : "enable")));
return 0;
}
if (disable) {
regval |= DAQ_REG_HRDWRE_DSBL_16BIT_MSK;
regval |= bitmask;
} else {
regval &= ~DAQ_REG_HRDWRE_DSBL_16BIT_MSK;
regval &= ~bitmask;
}
if (!Feb_Control_WriteRegister(DAQ_REG_HRDWRE, regval)) {
if (!Feb_Control_WriteRegister_BitMask(DAQ_REG_HRDWRE, regval, bitmask)) {
LOG(logERROR, ("Could not %s 16 bit expansion (bit mode)\n",
(disable ? "disable" : "enable")));
return 0;
@ -1262,11 +1259,12 @@ int Feb_Control_Disable16bitConversion(int disable) {
int Feb_Control_Get16bitConversionDisabled(int *ret) {
unsigned int regval = 0;
if (!Feb_Control_ReadRegister(DAQ_REG_HRDWRE, &regval)) {
if (!Feb_Control_ReadRegister_BitMask(DAQ_REG_HRDWRE, &regval,
DAQ_REG_HRDWRE_DSBL_16BIT_MSK)) {
LOG(logERROR, ("Could not get 16 bit expansion (bit mode)\n"));
return 0;
}
if (regval & DAQ_REG_HRDWRE_DSBL_16BIT_MSK) {
if (regval) {
*ret = 1;
} else {
*ret = 0;
@ -1667,6 +1665,15 @@ int Feb_Control_GetReadNRows() {
}
int Feb_Control_WriteRegister(uint32_t offset, uint32_t data) {
return Feb_Control_WriteRegister_BitMask(offset, data, BIT32_MSK);
}
int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval) {
return Feb_Control_ReadRegister_BitMask(offset, retval, BIT32_MASK);
}
int Feb_Control_WriteRegister_BitMask(uint32_t offset, uint32_t data,
uint32_t bitmask) {
uint32_t actualOffset = offset;
char side[2][10] = {"right", "left"};
unsigned int addr[2] = {Feb_Control_rightAddress, Feb_Control_leftAddress};
@ -1690,24 +1697,41 @@ int Feb_Control_WriteRegister(uint32_t offset, uint32_t data) {
for (int iloop = 0; iloop < 2; ++iloop) {
if (run[iloop]) {
LOG(logDEBUG1,
("Writing 0x%x to %s 0x%x\n", data, side[iloop], actualOffset));
if (!Feb_Interface_WriteRegister(addr[iloop], actualOffset, data, 0,
0)) {
LOG(logERROR, ("Could not write 0x%x to %s addr 0x%x\n", data,
LOG(logDEBUG1, ("Writing 0x%x to %s 0x%x (mask:0x%x)\n", data,
side[iloop], actualOffset, bitmask));
uint32_t writeVal = 0;
if (!Feb_Interface_ReadRegister(addr[iloop], actualOffset,
&writeVal)) {
LOG(logERROR, ("Could not read %s addr 0x%x register\n",
side[iloop], actualOffset));
return 0;
}
uint32_t regVal = 0;
if (!Feb_Interface_ReadRegister(addr[iloop], actualOffset,
&regVal)) {
LOG(logERROR, ("Could not read %s register\n", addr[iloop]));
// set only the bits in the mask
writeVal &= ~(bitmask);
writeVal |= (data & bitmask);
LOG(logDEBUG1, ("writing 0x%x to 0x%x\n", writeVal, actualOffset));
if (!Feb_Interface_WriteRegister(addr[iloop], actualOffset,
writeVal, 0, 0)) {
LOG(logERROR, ("Could not write 0x%x to %s addr 0x%x\n",
writeVal, side[iloop], actualOffset));
return 0;
}
if (regVal != data) {
writeVal &= bitmask;
uint32_t readVal = 0;
if (!Feb_Interface_ReadRegister(addr[iloop], actualOffset,
&readVal)) {
return 0;
}
readVal &= bitmask;
if (writeVal != readVal) {
LOG(logERROR,
("Could not write %s register. Write 0x%x, read 0x%x\n",
addr[iloop], data, regVal));
("Could not write %s addr 0x%x register. Wrote "
"0x%x, read 0x%x (mask:0x%x)\n",
side[iloop], actualOffset, writeVal, readVal, bitmask));
return 0;
}
}
@ -1716,7 +1740,8 @@ int Feb_Control_WriteRegister(uint32_t offset, uint32_t data) {
return 1;
}
int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval) {
int Feb_Control_ReadRegister_BitMask(uint32_t offset, uint32_t *retval,
uint32_t bitmask) {
uint32_t actualOffset = offset;
char side[2][10] = {"right", "left"};
unsigned int addr[2] = {Feb_Control_rightAddress, Feb_Control_leftAddress};
@ -1746,8 +1771,9 @@ int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval) {
side[iloop], actualOffset));
return 0;
}
LOG(logDEBUG1, ("Read 0x%x from %s 0x%x\n", value[iloop],
side[iloop], actualOffset));
value[iloop] &= bitmask;
LOG(logDEBUG1, ("Read 0x%x from %s 0x%x (mask:0x%x)\n",
value[iloop], side[iloop], actualOffset, bitmask));
*retval = value[iloop];
// if not the other (left, not right OR right, not left), return the
// value
@ -1758,7 +1784,7 @@ int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval) {
}
// Inconsistent values when reading both registers
if ((run[0] & run[1]) & (value[0] != value[1])) {
LOG(logERROR, ("Inconsistent values read from %s 0x%x and %s 0x%x\n",
LOG(logERROR, ("Inconsistent values read from %s: 0x%x and %s: 0x%x\n",
side[0], value[0], side[1], value[1]));
return 0;
}

View File

@ -95,7 +95,10 @@ int Feb_Control_SetReadNRows(int value);
int Feb_Control_GetReadNRows();
int Feb_Control_WriteRegister(uint32_t offset, uint32_t data);
int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval);
int Feb_Control_WriteRegister_BitMask(uint32_t offset, uint32_t data,
uint32_t bitmask);
int Feb_Control_ReadRegister_BitMask(uint32_t offset, uint32_t *retval,
uint32_t bitmask);
// pulsing
int Feb_Control_Pulse_Pixel(int npulses, int x, int y);
int Feb_Control_PulsePixelNMove(int npulses, int inc_x_pos, int inc_y_pos);

View File

@ -861,12 +861,15 @@ int setDynamicRange(int dr) {
LOG(logINFO, ("Setting dynamic range: %d\n", dr));
#else
sharedMemory_lockLocalLink();
if (Feb_Control_SetDynamicRange(dr)) {
if (!Beb_SetUpTransferParameters(dr)) {
LOG(logERROR, ("Could not set bit mode in the back end\n"));
sharedMemory_unlockLocalLink();
return eiger_dynamicrange;
}
if (!Feb_Control_SetDynamicRange(dr)) {
LOG(logERROR, ("Could not set dynamic range in feb\n"));
sharedMemory_unlockLocalLink();
return FAIL;
}
if (!Beb_SetUpTransferParameters(dr)) {
LOG(logERROR, ("Could not set bit mode in the back end\n"));
sharedMemory_unlockLocalLink();
return eiger_dynamicrange;
}
sharedMemory_unlockLocalLink();
#endif
@ -1454,6 +1457,12 @@ int setHighVoltage(int val) {
sharedMemory_unlockLocalLink();
return -3;
}
// need to read the file twice to get the proper value
if (!Feb_Control_GetHighVoltage(&eiger_highvoltage)) {
LOG(logERROR, ("Could not read high voltage\n"));
sharedMemory_unlockLocalLink();
return -3;
}
sharedMemory_unlockLocalLink();
// tolerance of 5
@ -2664,6 +2673,10 @@ void *start_timer(void *arg) {
header->modId = eiger_virtual_module_id;
header->row = row;
header->column = colLeft;
if (eiger_virtual_quad_mode) {
header->row = 1; // left is next row
header->column = 0; // left same first column
}
char packetData2[packetsize];
memset(packetData2, 0, packetsize);
@ -2672,11 +2685,11 @@ void *start_timer(void *arg) {
header->version = SLS_DETECTOR_HEADER_VERSION;
header->frameNumber = frameNr + iframes;
header->packetNumber = i;
header->modId = eiger_virtual_module_id;
header->modId = eiger_virtual_module_id + 1;
header->row = row;
header->column = colRight;
if (eiger_virtual_quad_mode) {
header->row = 1; // right is next row
header->row = 0; // right is next row
header->column = 0; // right same first column
}

View File

@ -5,7 +5,7 @@
#define LINKED_SERVER_NAME "eigerDetectorServer"
#define REQUIRED_FIRMWARE_VERSION (30)
#define REQUIRED_FIRMWARE_VERSION (32)
// virtual ones renamed for consistency
// real ones keep previous name for compatibility (already in production)
#ifdef VIRTUAL
@ -137,6 +137,7 @@ enum MASTERINDEX { MASTER_HARDWARE, OW_MASTER, OW_SLAVE };
#define UDP_HEADER_MAX_FRAME_VALUE (0xFFFFFFFFFFFF)
#define BIT16_MASK (0xFFFF)
#define BIT32_MSK (0xFFFFFFFF)
#define DAC_MIN_MV (0)
#define DAC_MAX_MV (2048)

View File

@ -93,7 +93,7 @@ void basictests() {
#endif
if (mapCSP0() == FAIL) {
strcpy(initErrorMessage,
"Could not map to memory. Dangerous to continue.\n");
"Could not map to memory. Cannot proceed. Check Firmware.\n");
LOG(logERROR, (initErrorMessage));
initError = FAIL;
return;
@ -105,8 +105,8 @@ void basictests() {
(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",
"Could not pass basic tests of FPGA and bus. Cannot proceed. "
"Check Firmware. (Firmware version:0x%llx) \n",
getFirmwareVersion());
LOG(logERROR, ("%s\n\n", initErrorMessage));
initError = FAIL;
@ -396,7 +396,7 @@ void initStopServer() {
if (mapCSP0() == FAIL) {
initError = FAIL;
strcpy(initErrorMessage,
"Stop Server: Map Fail. Dangerous to continue. Goodbye!\n");
"Stop Server: Map Fail. Cannot proceed. Check Firmware.\n");
LOG(logERROR, (initErrorMessage));
initCheckDone = 1;
return;
@ -3323,6 +3323,27 @@ void *start_timer(void *arg) {
break;
}
// change gain and data for every frame
{
const int nchannels = NCHIP * NCHAN;
int gainVal = 0;
for (int i = 0; i < nchannels; ++i) {
if ((i % nchannels) < 400) {
gainVal = 1 + frameNr;
} else if ((i % nchannels) < 800) {
gainVal = 2 + frameNr;
} else {
gainVal = 3 + frameNr;
}
int dataVal =
*((uint16_t *)(imageData + i * sizeof(uint16_t)));
dataVal += frameNr;
int channelVal =
(dataVal & ~GAIN_VAL_MSK) | (gainVal << GAIN_VAL_OFST);
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
(uint16_t)channelVal;
}
}
// sleep for exposure time
struct timespec begin, end;
clock_gettime(CLOCK_REALTIME, &begin);

View File

@ -87,7 +87,7 @@ void basictests() {
#endif
if (mapCSP0() == FAIL) {
strcpy(initErrorMessage,
"Could not map to memory. Dangerous to continue.\n");
"Could not map to memory. Cannot proceed. Check Firmware.\n");
LOG(logERROR, (initErrorMessage));
initError = FAIL;
}
@ -97,7 +97,7 @@ void basictests() {
((checkType() == FAIL) || (testFpga() == FAIL) ||
(testBus() == FAIL))) {
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
"Dangerous to continue.\n");
"Cannot proceed. Check Firmware.\n");
LOG(logERROR, ("%s\n\n", initErrorMessage));
initError = FAIL;
return;
@ -381,7 +381,7 @@ void initStopServer() {
if (mapCSP0() == FAIL) {
initError = FAIL;
strcpy(initErrorMessage,
"Stop Server: Map Fail. Dangerous to continue. Goodbye!\n");
"Stop Server: Map Fail. Cannot proceed. Check Firmware.\n");
LOG(logERROR, (initErrorMessage));
initCheckDone = 1;
return;
@ -1007,7 +1007,9 @@ int setDelayAfterTrigger(int64_t val) {
// validate for tolerance
int64_t retval = getDelayAfterTrigger();
val /= (1E-9 * CLK_FREQ);
val -= masterdefaultdelay;
if (master) {
val -= masterdefaultdelay;
}
if (val != retval) {
return FAIL;
}

View File

@ -82,7 +82,7 @@ void basictests() {
#endif
if (mapCSP0() == FAIL) {
strcpy(initErrorMessage,
"Could not map to memory. Dangerous to continue.\n");
"Could not map to memory. Cannot proceed. Check Firmware.\n");
LOG(logERROR, (initErrorMessage));
initError = FAIL;
}
@ -91,8 +91,10 @@ void basictests() {
if ((!debugflag) && (!updateFlag) &&
((checkType() == FAIL) || (testFpga() == FAIL) ||
(testBus() == FAIL))) {
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
"Dangerous to continue.\n");
sprintf(initErrorMessage,
"Could not pass basic tests of FPGA and bus. Cannot proceed. "
"Check Firmware. (Firmware version:0x%llx) \n",
getFirmwareVersion());
LOG(logERROR, ("%s\n\n", initErrorMessage));
initError = FAIL;
return;
@ -428,7 +430,7 @@ void initStopServer() {
if (mapCSP0() == FAIL) {
initError = FAIL;
strcpy(initErrorMessage,
"Stop Server: Map Fail. Dangerous to continue. Goodbye!\n");
"Stop Server: Map Fail. Cannot proceed. Check Firmware.\n");
LOG(logERROR, (initErrorMessage));
initCheckDone = 1;
return;
@ -1386,14 +1388,18 @@ int setMaster(enum MASTERINDEX m) {
char *master_names[] = {MASTER_NAMES};
LOG(logINFOBLUE, ("Setting up as %s in (%s server)\n", master_names[m],
(isControlServer ? "control" : "stop")));
int prevSync = getSynchronization();
setSynchronization(0);
int retval = -1;
int retMaster = OK;
switch (m) {
case OW_MASTER:
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_MASTER_MSK);
isMaster(&retval);
if (retval != 1) {
LOG(logERROR, ("Could not set master\n"));
return FAIL;
retMaster = FAIL;
}
break;
case OW_SLAVE:
@ -1401,15 +1407,16 @@ int setMaster(enum MASTERINDEX m) {
isMaster(&retval);
if (retval != 0) {
LOG(logERROR, ("Could not set slave\n"));
return FAIL;
retMaster = FAIL;
}
break;
default:
LOG(logERROR, ("Cannot reset to hardware settings from client. Restart "
"detector server.\n"));
return FAIL;
retMaster = FAIL;
}
return OK;
setSynchronization(prevSync);
return retMaster;
}
int isMaster(int *retval) {
@ -1447,7 +1454,7 @@ void setTiming(enum timingMode arg) {
}
enum timingMode getTiming() {
if (bus_r(EXT_SIGNAL_REG) == EXT_SIGNAL_MSK)
if ((bus_r(EXT_SIGNAL_REG) & EXT_SIGNAL_MSK) >> EXT_SIGNAL_OFST)
return TRIGGER_EXPOSURE;
return AUTO_TIMING;
}
@ -1734,40 +1741,40 @@ int setDetectorPosition(int pos[]) {
detPos[2] = outerPos[X];
detPos[3] = outerPos[Y];
// row
// row [Y]
// outer
uint32_t addr = COORD_ROW_REG;
bus_w(addr,
(bus_r(addr) & ~COORD_ROW_OUTER_MSK) |
((outerPos[X] << COORD_ROW_OUTER_OFST) & COORD_ROW_OUTER_MSK));
((outerPos[Y] << COORD_ROW_OUTER_OFST) & COORD_ROW_OUTER_MSK));
if (((bus_r(addr) & COORD_ROW_OUTER_MSK) >> COORD_ROW_OUTER_OFST) !=
outerPos[X])
ret = FAIL;
// inner
bus_w(addr,
(bus_r(addr) & ~COORD_ROW_INNER_MSK) |
((innerPos[X] << COORD_ROW_INNER_OFST) & COORD_ROW_INNER_MSK));
if (((bus_r(addr) & COORD_ROW_INNER_MSK) >> COORD_ROW_INNER_OFST) !=
innerPos[X])
ret = FAIL;
// col
// outer
addr = COORD_COL_REG;
bus_w(addr,
(bus_r(addr) & ~COORD_COL_OUTER_MSK) |
((outerPos[Y] << COORD_COL_OUTER_OFST) & COORD_COL_OUTER_MSK));
if (((bus_r(addr) & COORD_COL_OUTER_MSK) >> COORD_COL_OUTER_OFST) !=
outerPos[Y])
ret = FAIL;
// inner
bus_w(addr,
(bus_r(addr) & ~COORD_COL_INNER_MSK) |
((innerPos[Y] << COORD_COL_INNER_OFST) & COORD_COL_INNER_MSK));
if (((bus_r(addr) & COORD_COL_INNER_MSK) >> COORD_COL_INNER_OFST) !=
(bus_r(addr) & ~COORD_ROW_INNER_MSK) |
((innerPos[Y] << COORD_ROW_INNER_OFST) & COORD_ROW_INNER_MSK));
if (((bus_r(addr) & COORD_ROW_INNER_MSK) >> COORD_ROW_INNER_OFST) !=
innerPos[Y])
ret = FAIL;
// col [X]
// outer
addr = COORD_COL_REG;
bus_w(addr,
(bus_r(addr) & ~COORD_COL_OUTER_MSK) |
((outerPos[X] << COORD_COL_OUTER_OFST) & COORD_COL_OUTER_MSK));
if (((bus_r(addr) & COORD_COL_OUTER_MSK) >> COORD_COL_OUTER_OFST) !=
outerPos[X])
ret = FAIL;
// inner
bus_w(addr,
(bus_r(addr) & ~COORD_COL_INNER_MSK) |
((innerPos[X] << COORD_COL_INNER_OFST) & COORD_COL_INNER_MSK));
if (((bus_r(addr) & COORD_COL_INNER_MSK) >> COORD_COL_INNER_OFST) !=
innerPos[X])
ret = FAIL;
if (ret == OK) {
if (getNumberofUDPInterfaces() == 1) {
LOG(logINFOBLUE, ("Position set to [%d, %d] #(col, row)\n",
@ -2625,6 +2632,7 @@ void *start_timer(void *arg) {
if (i % pixelsPerPacket == 0) {
++dataVal;
}
if ((i % 1024) < 300) {
gainVal = 1;
} else if ((i % 1024) < 600) {
@ -2665,6 +2673,28 @@ void *start_timer(void *arg) {
clock_gettime(CLOCK_REALTIME, &begin);
usleep(expUs);
// change gain and data for every frame
{
const int npixels = (NCHAN * NCHIP);
for (int i = 0; i < npixels; ++i) {
int gainVal = 0;
if ((i % 1024) < 300) {
gainVal = 1 + iframes;
} else if ((i % 1024) < 600) {
gainVal = 2 + iframes;
} else {
gainVal = 3 + iframes;
}
int dataVal =
*((uint16_t *)(imageData + i * sizeof(uint16_t)));
dataVal += iframes;
int pixelVal =
(dataVal & ~GAIN_VAL_MSK) | (gainVal << GAIN_VAL_OFST);
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
(uint16_t)pixelVal;
}
}
int srcOffset = 0;
int srcOffset2 = DATA_BYTES / 2;
int row0 = (numInterfaces == 1 ? detPos[1] : detPos[3]);
@ -2798,6 +2828,7 @@ int softwareTrigger(int block) {
LOG(logINFO, ("Sending Software Trigger\n"));
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_SOFTWARE_TRIGGER_MSK);
bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_SOFTWARE_TRIGGER_MSK);
#ifndef VIRTUAL
// block till frame is sent out

View File

@ -5,8 +5,8 @@
#include "sls/sls_detector_defs.h"
#define MIN_REQRD_VRSN_T_RD_API 0x171220
#define REQRD_FRMWRE_VRSN_BOARD2 0x221104 // 1.0 pcb (version = 010)
#define REQRD_FRMWRE_VRSN 0x221103 // 2.0 pcb (version = 011)
#define REQRD_FRMWRE_VRSN_BOARD2 0x230516 // 1.0 pcb (version = 010)
#define REQRD_FRMWRE_VRSN 0x230515 // 2.0 pcb (version = 011)
#define NUM_HARDWARE_VERSIONS (2)
#define HARDWARE_VERSION_NUMBERS \

View File

@ -103,7 +103,7 @@ void basictests() {
#endif
if (mapCSP0() == FAIL) {
strcpy(initErrorMessage,
"Could not map to memory. Dangerous to continue.\n");
"Could not map to memory. Cannot proceed. Check Firmware.\n");
LOG(logERROR, ("%s\n\n", initErrorMessage));
initError = FAIL;
return;
@ -113,8 +113,10 @@ void basictests() {
if ((!debugflag) && (!updateFlag) &&
((checkType() == FAIL) || (testFpga() == FAIL) ||
(testBus() == FAIL))) {
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
"Dangerous to continue.\n");
sprintf(initErrorMessage,
"Could not pass basic tests of FPGA and bus. Cannot proceed. "
"Check Firmware. (Firmware version:0x%llx) \n",
getFirmwareVersion());
LOG(logERROR, ("%s\n\n", initErrorMessage));
initError = FAIL;
return;
@ -451,7 +453,7 @@ void initStopServer() {
if (mapCSP0() == FAIL) {
initError = FAIL;
strcpy(initErrorMessage,
"Stop Server: Map Fail. Dangerous to continue. Goodbye!\n");
"Stop Server: Map Fail. Cannot proceed. Check Firmware.\n");
LOG(logERROR, (initErrorMessage));
initCheckDone = 1;
return;

View File

@ -313,7 +313,7 @@ patternParameters *setChannelRegisterChip(int ichip, char *mask,
chanReg, ichip * NCHAN + ich * NCOUNTERS,
ichip * NCHAN_1_COUNTER + ich, ichip, ich));
}
for (int i = 0; i < 24; i++) {
for (int i = 0; i < 23; i++) {
patword = clearBit(SIGNAL_clk, patword);
pat->word[iaddr++] = patword;

View File

@ -89,7 +89,7 @@ void basictests() {
#endif
if (mapCSP0() == FAIL) {
strcpy(initErrorMessage,
"Could not map to memory. Dangerous to continue.\n");
"Could not map to memory. Cannot proceed. Check Firmware.\n");
LOG(logERROR, (initErrorMessage));
initError = FAIL;
}
@ -99,8 +99,10 @@ void basictests() {
((validateKernelVersion(KERNEL_DATE_VRSN) == FAIL) ||
(checkType() == FAIL) || (testFpga() == FAIL) ||
(testBus() == FAIL))) {
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
"Dangerous to continue.\n");
sprintf(initErrorMessage,
"Could not pass basic tests of FPGA and bus. Cannot proceed. "
"Check Firmware. (Firmware version:0x%llx) \n",
getFirmwareVersion());
LOG(logERROR, ("%s\n\n", initErrorMessage));
initError = FAIL;
return;
@ -388,7 +390,7 @@ void initStopServer() {
if (mapCSP0() == FAIL) {
initError = FAIL;
strcpy(initErrorMessage,
"Stop Server: Map Fail. Dangerous to continue. Goodbye!\n");
"Stop Server: Map Fail. Cannot proceed. Check Firmware. \n");
LOG(logERROR, (initErrorMessage));
initCheckDone = 1;
return;

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