mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-01 10:20:04 +02:00
after merging with developer
This commit is contained in:
commit
817736fcd5
@ -18,7 +18,7 @@ find_package(Qt4)
|
||||
find_package(Qwt 6)
|
||||
find_package(CBF)
|
||||
find_package(Doxygen)
|
||||
find_package(PNG REQUIRED)
|
||||
# find_package(PNG REQUIRED)
|
||||
|
||||
if (USE_HDF5)
|
||||
find_package(HDF5 1.10 COMPONENTS CXX)
|
||||
|
@ -2,7 +2,7 @@
|
||||
Detailed documentation can be found on the [official site.](https://www.psi.ch/detectors/users-support)
|
||||
|
||||
### Binaries
|
||||
Documentation to obtain the binaries via the conda package is available [here.](https://github.com/slsdetectorgroup/sls_detector_software)
|
||||
Documentation to obtain the binaries via the conda package is available for [lib](https://github.com/slsdetectorgroup/sls_detector_lib) and [gui](https://github.com/slsdetectorgroup/sls_detector_gui)
|
||||
|
||||
### Source code
|
||||
One can also obtain the source code from this repository and compile while realizing the setup dependencies as required.
|
||||
@ -19,7 +19,7 @@ Requirements: Qt 4.8 and Qwt 6.0
|
||||
```
|
||||
If either of them does not exist, the GUI client will not be built.
|
||||
|
||||
* Calibration wizards<br>
|
||||
* Advanced user Calibration wizards<br>
|
||||
Requirements: ROOT
|
||||
```
|
||||
export ROOTSYS=/usr/local/root-5.34
|
||||
@ -43,6 +43,7 @@ Usage: [-c] [-b] [-h] [-d HDF5 directory] [-j]<br>
|
||||
* -r: Build/Rebuilds only receiver<br>
|
||||
* -g: Build/Rebuilds only gui<br>
|
||||
* -j: Number of threads to compile through<br>
|
||||
* -e: Debug mode
|
||||
|
||||
Basic Option:
|
||||
./cmk.sh -b
|
||||
@ -86,5 +87,5 @@ After compiling, the libraries and executables will be found at `bin` directory
|
||||
```
|
||||
$ ls bin/
|
||||
gui_client libSlsDetector.a libSlsDetector.so libSlsReceiver.a libSlsReceiver.so
|
||||
sls_detector_acquire sls_detector_get slsDetectorGui sls_detector_help sls_detector_put slsReceiver
|
||||
sls_detector_acquire sls_detector_get slsDetectorGui sls_detector_help sls_detector_put slsReceiver slsMultiReceiver
|
||||
```
|
||||
|
507
RELEASE.txt
507
RELEASE.txt
@ -1 +1,508 @@
|
||||
SLS Detector Package 4.0.0 released on 27.09.2018
|
||||
=================================================
|
||||
|
||||
|
||||
|
||||
INTRODUCTION
|
||||
|
||||
This document describes the differences between 4.0.0 and 3.1.4 releases.
|
||||
|
||||
Download
|
||||
--------
|
||||
|
||||
The Source Code (Default C++ API):
|
||||
https://github.com/slsdetectorgroup/slsDetectorPackage
|
||||
|
||||
The Conda Lib Package:
|
||||
https://github.com/slsdetectorgroup/sls_detector_lib
|
||||
|
||||
The Conda GUI Package:
|
||||
https://github.com/slsdetectorgroup/sls_detector_gui
|
||||
|
||||
The Python Interface (including the package):
|
||||
https://github.com/slsdetectorgroup/sls_detector
|
||||
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
Manual (HTML & PDF):
|
||||
https://www.psi.ch/detectors/documentation
|
||||
slsDetectorPackage/manual/docs/
|
||||
|
||||
Command Line Documentation:
|
||||
manual/docs/html/slsDetectorClientDocs/index.html
|
||||
manual/docs/pdf/slsDetectorClientDocs.pdf
|
||||
|
||||
C++ API Documentation:
|
||||
manual/docs/html/slsDetectorUsersDocs/index.html
|
||||
manual/docs/pdf/slsDetectorUsersDocs.pdf
|
||||
|
||||
C++ API Example:
|
||||
manual/manual-api/mainClient.cpp
|
||||
manual/manual-api/mainReceiver.cpp
|
||||
|
||||
Python API Documentation:
|
||||
https://slsdetectorgroup.github.io/sls_detector/
|
||||
|
||||
Further Documentation:
|
||||
https://www.psi.ch/detectors/users-support
|
||||
|
||||
|
||||
Support
|
||||
-------
|
||||
|
||||
General Software related:
|
||||
dhanya.thattil@psi.ch
|
||||
anna.bergamaschi@psi.ch
|
||||
|
||||
Python related:
|
||||
erik.frojdh@psi.ch
|
||||
|
||||
|
||||
|
||||
CONTENTS
|
||||
|
||||
1. Firmware Requirements
|
||||
2. Changes in User Interface
|
||||
3. New/Modified Commands
|
||||
4. Other New Features
|
||||
5. Resolved Issues
|
||||
6. Known Issues
|
||||
7. Next Major Release Plans
|
||||
|
||||
|
||||
|
||||
1. Firmware Requirements
|
||||
========================
|
||||
|
||||
Gotthard
|
||||
========
|
||||
Minimum compatible version : 11.01.2013
|
||||
Latest version : 08.02.2018 (50um and 25um Master)
|
||||
09.02.2018 (25 um Slave)
|
||||
Eiger
|
||||
=====
|
||||
Minimum compatible version : 22
|
||||
Latest version : 22
|
||||
|
||||
Jungfrau
|
||||
========
|
||||
Minimum compatible version : 15.06.2018
|
||||
Latest version : 15.06.2018
|
||||
|
||||
|
||||
Detector Upgrade
|
||||
================
|
||||
Gotthard Cannot be upgraded remotely. Requires programming via USB blaster
|
||||
Eiger Can be upgraded remotely via bit files
|
||||
Jungfrau Can be upgraded remotely using sls_detector_put programfpga <pof>
|
||||
|
||||
Instructions available at
|
||||
https://www.psi.ch/detectors/installation-instructions
|
||||
under Detector Upgrade -> [Detector Type] -> Firmware.
|
||||
|
||||
|
||||
Please refer to the link below for more details on the firmware versions.
|
||||
https://www.psi.ch/detectors/firmware.
|
||||
|
||||
|
||||
|
||||
2. Changes in User Interface
|
||||
============================
|
||||
|
||||
Client
|
||||
------
|
||||
|
||||
1. Shared Memory:
|
||||
|
||||
POSIX shared memory has been implemented and they are typically created in
|
||||
/dev/shm/ folder.
|
||||
|
||||
A multiSlsDetector object will create a shared memory segment with naming style:
|
||||
slsDetectorPackage_x_[_z]
|
||||
and an slsDetector object will create a shared memory segment with naming style:
|
||||
slsDetectorPackage_x_sls_y[_z]
|
||||
|
||||
where
|
||||
x is the multi detector id
|
||||
y is the sls detector id
|
||||
z is the environment variable SLSDETNAME, if set.
|
||||
They can be deleted directly.
|
||||
|
||||
Environment variable SLSDETNAME included for user-friendliness
|
||||
of using 2 different detectors from the same client pc. One needn't use
|
||||
different multi detector id if the SLSDETNAME is different for both consoles.
|
||||
|
||||
Constructor will fail if shared memory size is different (different package
|
||||
releases/detectors). Loading config file cleans shared memory.
|
||||
|
||||
|
||||
2. Exceptions in constructors:
|
||||
|
||||
All constructors that have an error throws an exception. For this release,
|
||||
this is caught within the package and interfaced as error codes or messages
|
||||
to the users using command line or API.
|
||||
|
||||
As a result:
|
||||
- slsDetectorsUsers constructor signature now includes a success flag.
|
||||
- If one uses multiSlsDetector, slsDetector, ZmqSocket classes directly,
|
||||
catch exceptions from constructors.
|
||||
- In future releases, the exception will be thrown
|
||||
outside the package for the users to handle it.
|
||||
|
||||
|
||||
3. API Compatibility:
|
||||
|
||||
Client now checks API version of Detector Server - Client and Receiver - Client
|
||||
when connecting for the first time to detector server or receiver server
|
||||
and the online flags have not been set in shm.
|
||||
|
||||
Upon failure, error messages will ensue and further commands will not
|
||||
be executed. Detector servers referred to are only for Eiger, Jungfrau and Gotthard.
|
||||
|
||||
Previously, the detector server would exit on mismatched Firmware-Detector
|
||||
server mismatch. They now wait for client to ask for compatibility check,
|
||||
which is done the first time client connects to the detector and the
|
||||
online flag in shm has not been set.
|
||||
|
||||
|
||||
4. Commands "type", "id" and "replace" are removed.
|
||||
|
||||
|
||||
Receiver
|
||||
--------
|
||||
|
||||
1. Reciever Header Structure in file writing and call back:
|
||||
|
||||
sls_receiver_header structure added to sls_receiver_defs.h for image headers
|
||||
in file writing.
|
||||
|
||||
#define MAX_NUM_PACKETS 512
|
||||
typedef std::bitset<MAX_NUM_PACKETS> sls_bitset;
|
||||
typedef struct {
|
||||
sls_detector_header detHeader; /**< is the detector header */
|
||||
sls_bitset packetsMask; /**< is the packets caught bit mask */
|
||||
} sls_receiver_header;
|
||||
|
||||
It includes the detector header structure + bitmask of 512 bits,
|
||||
where each bit represents a packet caught. This is useful in saving time
|
||||
in writing to file by not padding missing packets and still retaining useful data.
|
||||
|
||||
The binary and HDF5 writer version number changed from 1.0 to 2.0.
|
||||
The detector header version remains as 1.0.
|
||||
|
||||
registerCallBackRawDataReady modified to give this structure pointer,
|
||||
instead of individual structure member pointers.
|
||||
|
||||
|
||||
2. ZmqSocket class:
|
||||
|
||||
If one uses ZmqSocket.h, then the json header has to be parsed outside
|
||||
the class to allow the user to remove the restriction in extracting all data
|
||||
from the json header.
|
||||
|
||||
|
||||
3. Receiver Call back with modified size:
|
||||
|
||||
registerCallBackRawDataModifyReady call back that is similar to the receiver
|
||||
registerCallBackRawDataReady has been added to allow the call back to
|
||||
specify an updated size of image after call back. This is in view to process
|
||||
an image in call back (including extract only a region of the image) and
|
||||
provide this updated size in callback. This new resized/processed image
|
||||
will be written to file or streamed out via zmq. This is useful in ROI
|
||||
selection in the receiver.
|
||||
|
||||
This also means that the call back is now called before writing to file.
|
||||
|
||||
|
||||
|
||||
3. New/Modified Commands
|
||||
========================
|
||||
|
||||
Client
|
||||
------
|
||||
|
||||
1. add (modified):
|
||||
appends detector to end of multi detector list.
|
||||
|
||||
2. replace:
|
||||
sets hostname/ip address for a single detector.
|
||||
|
||||
3. user:
|
||||
get user details from shared memory.
|
||||
|
||||
4. checkdetversion:
|
||||
checks client version compatibility with detector server.
|
||||
|
||||
5. checkrecversion:
|
||||
checks client version compatibility with receiver server.
|
||||
|
||||
|
||||
Receiver
|
||||
--------
|
||||
|
||||
1. rx_zmqip:
|
||||
sets/gets the zmq (TCP) ip of the receiver from where data is streamed
|
||||
out from. (Eg. to the gui or intermediate process). By default, it is
|
||||
the same as the zmqip.
|
||||
|
||||
2. zmqip:
|
||||
sets/gets the zmq (TCP) ip, where client listens to, to reconstuct images.
|
||||
(Eg. from receiver or intermediate process). By default, it is the same
|
||||
as rx_zmqip.
|
||||
|
||||
3. rx_jsonaddheader:
|
||||
sets/gets additional json header to be streamed out with the zmq from
|
||||
receiver. Default is empty. Eg. p rx_jsonaddheader \"what\":\"nothing\"
|
||||
|
||||
4. r_discardpolicy:
|
||||
sets/gets the frame discard policy in the receiver.
|
||||
nodiscard - no discard (default),
|
||||
discardempty - discard only empty frames,
|
||||
discardpartial - discard any partial frame(fastest)
|
||||
|
||||
5. r_padding:
|
||||
sets/gets the frame padding in the receiver.
|
||||
0 does not pad partial frames(fastest),
|
||||
1 (default) pads partial frames.
|
||||
One can look at bitmask in the sls_receiver_header to process the unpadded
|
||||
partial frames later.
|
||||
|
||||
6. activate (modified):
|
||||
Extra option added to pad or unpad images in receivers when deactivated.
|
||||
activate i [padding option], where i is activate/deactivate and padding
|
||||
option is "padding" (default) or "nopadding".
|
||||
|
||||
7. rx_udpsocksize:
|
||||
sets/gets the UDP socket buffer size. Already attempts to set by default
|
||||
to 100mb, 2gb for Jungfrau. Does not remember custom values in client
|
||||
shared memory, so must be initialized each time after setting receiver
|
||||
hostname in config file.
|
||||
|
||||
8. rx_realudpsocksize:
|
||||
gets the actual UDP socket buffer size. Usually double the set udp socket
|
||||
buffer size due to kernel bookkeeping.
|
||||
|
||||
9. r_framesperfile:
|
||||
sets/gets the frames per file in receiver. 0 means infinite or all frames
|
||||
in a single file. Default of Eiger changed from 2k to 10k.
|
||||
|
||||
|
||||
Eiger Specific
|
||||
--------------
|
||||
|
||||
1. status trigger:
|
||||
To trigger internally via software, one can use "status trigger".
|
||||
|
||||
2. subdeadtime:
|
||||
sets/gets sub frame dead time in s in 32 bit mode. Subperiod is set in
|
||||
the detector by subexptime + subdeadtime. This value is normally a
|
||||
constant set by an expert catered to individual detector modules in the
|
||||
config file. Receiver files writes master file metadata subperiod
|
||||
instead of subdeadtime.
|
||||
|
||||
3. gappixels:
|
||||
enables/disables gap pixels in system (detector & receiver). 1 sets,
|
||||
0 unsets. In Receiver, 4 bit gap pixels mode is not implemented, but is
|
||||
implemented in client data call back. Gap pixels are at module level
|
||||
and not at multi module level.
|
||||
|
||||
4. measuredperiod:
|
||||
gets the measured frame period (time between last frame and the previous
|
||||
one) in s. Makes sense only for acquisitions of more than 1 frame.
|
||||
|
||||
5. measuredsubperiod:
|
||||
gets the measured subframe period (time between last subframe and the
|
||||
previous one) in s in 32 bit mode.
|
||||
|
||||
6. flags(modified):
|
||||
extra flags "nooverflow" (default) and "overflow" for sub images in 32
|
||||
bit mode. If set to overflow, it will set MSB of pixel data high if
|
||||
there was any saturation in any of the sub images 32 bit mode.
|
||||
|
||||
|
||||
Jungfrau Specific
|
||||
-----------------
|
||||
|
||||
1. storagecells:
|
||||
sets/gets number of additional storage cells per acquisition. For very
|
||||
advanced users only. Range: 0-15. Default: 0.
|
||||
The #images = #frames * #cycles * (#storagecells +1).
|
||||
|
||||
2. storage_start:
|
||||
sets/gets the storage cell that stores the first acquisition of the series.
|
||||
For very advanced users only. Range: 0-15. Default: 15(0xf).
|
||||
|
||||
|
||||
|
||||
4. Other New Features
|
||||
=====================
|
||||
|
||||
Client
|
||||
------
|
||||
|
||||
1. (Jungfrau & Gotthard) Settingsdir and caldir is removed from config file.
|
||||
Default dacs are stored in detector server. Hence, these folders
|
||||
are also removed from slsDetectorPackage/settingsdir. Eiger and Mythen
|
||||
continue to have them.
|
||||
|
||||
2. Depending on 1d position of detectors and detsizechan in config file,
|
||||
row and column (previously xcoord and ycoord) are given to detector
|
||||
servers (Eiger and Jungfrau) to encode into the udp header.
|
||||
|
||||
3. (Eiger) Setting threshold energy changes such as CAL dac is irrelevant
|
||||
when interpolating between two energies and VRS dac is interpolated, not copied.
|
||||
|
||||
4. Users API updated with the following functions:
|
||||
- setReceiverFramesDiscardPolicy
|
||||
- setReceiverPartialFramesPadding
|
||||
- setReceiverFramesPerFile
|
||||
- sendSoftwareTrigger
|
||||
- setSubFrameExposureDeadTime
|
||||
- setSubFrameExposureTime
|
||||
- enableGapPixels
|
||||
- getMeasuredPeriod
|
||||
- getMeasuredSubFramePeriod
|
||||
- setOverflowMode
|
||||
- setNumberOfStorageCells
|
||||
- setStoragecellStart
|
||||
- setThresholdEnergy (overloaded)
|
||||
- resetFramesCaughtInReceiver
|
||||
- setReceiverFifoDepth
|
||||
- setFlowControl10G
|
||||
- setTenGigabitEthernet
|
||||
- getNMods
|
||||
- setReceiverDataStreamingOutIP
|
||||
- setClientDataStreamingInIP
|
||||
|
||||
SlsReceiver
|
||||
-----------
|
||||
|
||||
1. slsMultiReceiver executable added that creates multiple receiver child processes.
|
||||
./slsMultiReceiver [start_tcp_port] [num_receivers] [1 for call back, 0 for none]
|
||||
|
||||
2. Default row and column (previously xcoord and ycoord) are hardcoded
|
||||
for missing packets. (Eiger and Jungfrau)
|
||||
|
||||
|
||||
Gui
|
||||
---
|
||||
|
||||
1. (Jungfrau) Gain plot included. Option under 2D options in Plot tab.
|
||||
|
||||
2. Option to maintain aspect ratio
|
||||
|
||||
3. Start and Stop separated to prevent multiple click syndrome.
|
||||
|
||||
|
||||
Detector Server
|
||||
---------------
|
||||
|
||||
1. (Jungfrau) To use programfpga command, one must start server with -update
|
||||
mode and then restart server without -update mode.
|
||||
|
||||
2. (Jungfrau) ASIC Timer configured at server start up and changed a few
|
||||
startup values for firmware v0.7 such as adc phase, ADC_PORT_INVERT_VAL
|
||||
and ADC offset half speed value.
|
||||
|
||||
3. (Jungfrau) Minimum exposure time of 50 us was implemented.
|
||||
|
||||
4. (Eiger and Jungfrau) They can be configured to have x and y coord values
|
||||
of the detector in their udp header.
|
||||
|
||||
|
||||
|
||||
|
||||
5. Resolved Issues
|
||||
==================
|
||||
|
||||
Client
|
||||
------
|
||||
memory leak for multi threading
|
||||
|
||||
1. Compiler flag -std=c++98 enforced. Debug flag removed.
|
||||
|
||||
2. If trimen gives different list from different detectors, it returns a -1.
|
||||
|
||||
3. Version format for each submodule of the package changed to just date YYMMDD.
|
||||
Users class fixed to give correct version, instead of -1.
|
||||
|
||||
4. Getting settings in users class gave -1. Fixed now.
|
||||
|
||||
5. (Jungfrau) Programming FPGA now creates the rawbin file from pof in tmp
|
||||
rather than source file location (for permission issues).
|
||||
|
||||
6. (Gotthard) ROI segmentation fault fixed.
|
||||
|
||||
Receiver
|
||||
--------
|
||||
|
||||
1. Silent feature of receiver fixed.
|
||||
|
||||
2. Socket descriptor misused earlier for success flag, instead exceptions
|
||||
used that are handled inside the package.
|
||||
|
||||
3. Global optind variable initialized to instantiate multiple receivers
|
||||
in same process. Also removed static members to enable this feature.
|
||||
|
||||
4. Socket buffer size attempts to set for each acquiistion and provide
|
||||
warning if no capabilities. Warnings can be removed using instruction with
|
||||
error provided. Default Jungfrau UDP socket buffer size if 2 GB, default is
|
||||
100 MB.
|
||||
|
||||
5. Refactored code a bit for performance and robustness, blocking push
|
||||
in buffer between listener and dataprocessor
|
||||
|
||||
|
||||
Detector Server
|
||||
---------------
|
||||
|
||||
1. (Jungfrau) Stop server also mapped during a reset. Reading power status
|
||||
instead of user input register for power.
|
||||
|
||||
2. (Eiger) Bug fix for saving trimbits to file (Advanced users).
|
||||
|
||||
3. (Gotthard 25um) config.txt is not read again after detector startup,
|
||||
no matter the number of times the detector server is restarted.
|
||||
|
||||
|
||||
6. Known Issues
|
||||
===============
|
||||
|
||||
Receiver
|
||||
--------
|
||||
|
||||
1. HDF5 compression and filters are not implemented yet.
|
||||
|
||||
|
||||
Detector Server
|
||||
---------------
|
||||
|
||||
1. (Eiger) Registers mapped differently between firmware v20 and v22.
|
||||
So, please ensure correct on-board server before switching between
|
||||
firmware versions. Else one cannot ping it anymore. Will need to flash firmware
|
||||
again to recover.
|
||||
|
||||
2. (Gotthard) To switch back to all ADC from single ADC ROI, one must take
|
||||
even number of images for the receiver to understand complete images.
|
||||
This will be fixed in the next firmware upgrade.
|
||||
|
||||
|
||||
|
||||
7. Next Major Release Plans
|
||||
===========================
|
||||
|
||||
Client
|
||||
------
|
||||
|
||||
1. Exceptions thrown to the user to be handled.
|
||||
|
||||
2. Compilation using c++11.
|
||||
|
||||
3. Support of Mythen II restricted to this major and its minor releases.
|
||||
|
||||
4. Restructuring and refactoring of client code.
|
||||
|
||||
|
||||
|
||||
|
17
cmk.sh
17
cmk.sh
@ -6,6 +6,7 @@ COMPILERTHREADS=0
|
||||
TEXTCLIENT=0
|
||||
RECEIVER=0
|
||||
GUI=0
|
||||
DEBUG=0
|
||||
|
||||
|
||||
CLEAN=0
|
||||
@ -24,6 +25,7 @@ Usage: $0 [-c] [-b] [-h] [-d <HDF5 directory>] [-j]
|
||||
-r: Build/Rebuilds only receiver
|
||||
-g: Build/Rebuilds only gui
|
||||
-j: Number of threads to compile through
|
||||
-e: Debug mode
|
||||
|
||||
For only make:
|
||||
./cmk.sh
|
||||
@ -53,7 +55,7 @@ For rebuilding only certain sections
|
||||
|
||||
" ; exit 1; }
|
||||
|
||||
while getopts ":bchd:j:trg" opt ; do
|
||||
while getopts ":bchd:j:trge" opt ; do
|
||||
case $opt in
|
||||
b)
|
||||
echo "Building of CMake files Required"
|
||||
@ -90,7 +92,11 @@ while getopts ":bchd:j:trg" opt ; do
|
||||
echo "Compiling Options: GUI"
|
||||
GUI=1
|
||||
REBUILD=1
|
||||
;;
|
||||
;;
|
||||
e)
|
||||
echo "Compiling Options: Debug"
|
||||
DEBUG=1
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG"
|
||||
usage
|
||||
@ -145,7 +151,12 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug "
|
||||
#Debug
|
||||
if [ $DEBUG -eq 1 ]; then
|
||||
CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug "
|
||||
echo "Debug Option enabled"
|
||||
fi
|
||||
|
||||
|
||||
#hdf5 rebuild
|
||||
if [ $HDF5 -eq 1 ]; then
|
||||
|
@ -20,7 +20,7 @@ all: docs detUser slsMultiReceiver
|
||||
|
||||
docs: createdocs docspdf docshtml removedocs
|
||||
|
||||
createdocs: slsDetectorUsers.doxy slsDetectorUsers.h detectorData.h slsReceiverUsers.h mainClient.cpp mainReceiver.cpp
|
||||
createdocs: slsDetectorUsers.doxy mainClient.cpp mainReceiver.cpp
|
||||
doxygen slsDetectorUsers.doxy
|
||||
|
||||
docspdf:
|
||||
|
@ -54,7 +54,12 @@ int main(int argc, char **argv) {
|
||||
|
||||
|
||||
/** - slsDetectorUsers Object is instantiated with appropriate ID */
|
||||
slsDetectorUsers *pDetector = new slsDetectorUsers (id);
|
||||
int ret = 1;
|
||||
slsDetectorUsers *pDetector = new slsDetectorUsers (ret, id);
|
||||
if (ret == 1) {
|
||||
std::cout << "Error: Could not instantiate slsDetectorUsers" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
/** - if specified, load configuration file (necessary at least the first time it is called to properly configure advanced settings in the shared memory) */
|
||||
@ -89,7 +94,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
/** - start measurement */
|
||||
pDetector->startMeasurement();
|
||||
std::cout << "measurement finished" << std::endl; usleep(1*1000*1000);
|
||||
std::cout << "measurement finished" << std::endl;
|
||||
|
||||
/** - returning when acquisition is finished or data are avilable */
|
||||
|
||||
|
@ -99,18 +99,18 @@ void GetData(char* metadata, char* datapointer, uint32_t datasize, void* p){
|
||||
slsReceiverDefs::sls_receiver_header* header = (slsReceiverDefs::sls_receiver_header*)metadata;
|
||||
slsReceiverDefs::sls_detector_header detectorHeader = header->detHeader;
|
||||
|
||||
PRINT_IN_COLOR (detectorHeader.modId?detectorHeader.modId:detectorHeader.xCoord,
|
||||
PRINT_IN_COLOR (detectorHeader.modId?detectorHeader.modId:detectorHeader.row,
|
||||
"#### %d GetData: ####\n"
|
||||
"frameNumber: %llu\t\texpLength: %u\t\tpacketNumber: %u\t\tbunchId: %llu"
|
||||
"\t\ttimestamp: %llu\t\tmodId: %u\t\t"
|
||||
"xCoord: %u\t\tyCoord: %u\t\tzCoord: %u\t\tdebug: %u"
|
||||
"row: %u\t\tcolumn: %u\t\treserved: %u\t\tdebug: %u"
|
||||
"\t\troundRNumber: %u\t\tdetType: %u\t\tversion: %u"
|
||||
//"\t\tpacketsMask:%s"
|
||||
"\t\tfirstbytedata: 0x%x\t\tdatsize: %u\n\n",
|
||||
detectorHeader.xCoord, (long long unsigned int)detectorHeader.frameNumber,
|
||||
detectorHeader.row, (long long unsigned int)detectorHeader.frameNumber,
|
||||
detectorHeader.expLength, detectorHeader.packetNumber, (long long unsigned int)detectorHeader.bunchId,
|
||||
(long long unsigned int)detectorHeader.timestamp, detectorHeader.modId,
|
||||
detectorHeader.xCoord, detectorHeader.yCoord, detectorHeader.zCoord,
|
||||
detectorHeader.row, detectorHeader.column, detectorHeader.reserved,
|
||||
detectorHeader.debug, detectorHeader.roundRNumber,
|
||||
detectorHeader.detType, detectorHeader.version,
|
||||
//header->packetsMask.to_string().c_str(),
|
||||
@ -133,18 +133,18 @@ void GetData(char* metadata, char* datapointer, uint32_t &revDatasize, void* p){
|
||||
slsReceiverDefs::sls_receiver_header* header = (slsReceiverDefs::sls_receiver_header*)metadata;
|
||||
slsReceiverDefs::sls_detector_header detectorHeader = header->detHeader;
|
||||
|
||||
PRINT_IN_COLOR (detectorHeader.modId?detectorHeader.modId:detectorHeader.xCoord,
|
||||
PRINT_IN_COLOR (detectorHeader.modId?detectorHeader.modId:detectorHeader.row,
|
||||
"#### %d GetData: ####\n"
|
||||
"frameNumber: %llu\t\texpLength: %u\t\tpacketNumber: %u\t\tbunchId: %llu"
|
||||
"\t\ttimestamp: %llu\t\tmodId: %u\t\t"
|
||||
"xCoord: %u\t\tyCoord: %u\t\tzCoord: %u\t\tdebug: %u"
|
||||
"row: %u\t\tcolumn: %u\t\treserved: %u\t\tdebug: %u"
|
||||
"\t\troundRNumber: %u\t\tdetType: %u\t\tversion: %u"
|
||||
//"\t\tpacketsMask:%s"
|
||||
"\t\tfirstbytedata: 0x%x\t\tdatsize: %u\n\n",
|
||||
detectorHeader.xCoord, (long long unsigned int)detectorHeader.frameNumber,
|
||||
detectorHeader.row, (long long unsigned int)detectorHeader.frameNumber,
|
||||
detectorHeader.expLength, detectorHeader.packetNumber, (long long unsigned int)detectorHeader.bunchId,
|
||||
(long long unsigned int)detectorHeader.timestamp, detectorHeader.modId,
|
||||
detectorHeader.xCoord, detectorHeader.yCoord, detectorHeader.zCoord,
|
||||
detectorHeader.row, detectorHeader.column, detectorHeader.reserved,
|
||||
detectorHeader.debug, detectorHeader.roundRNumber,
|
||||
detectorHeader.detType, detectorHeader.version,
|
||||
//header->packetsMask.to_string().c_str(),
|
||||
|
@ -81,7 +81,11 @@ LATEX_HIDE_INDICES = YES
|
||||
SOURCE_BROWSER = YES
|
||||
|
||||
PREDEFINED = __cplusplus
|
||||
|
||||
INPUT = slsDetectorUsers.h detectorData.h slsReceiverUsers.h mainClient.cpp mainReceiver.cpp
|
||||
|
||||
INPUT = ../../slsDetectorSoftware/slsDetector/slsDetectorUsers.h \
|
||||
../../slDetectorSoftware/slsDetectorAnalysis/detectorData.h \
|
||||
../../slsReceiverSoftware/include/slsReceiverUsers.h \
|
||||
mainClient.cpp \
|
||||
mainReceiver.cpp
|
||||
|
||||
OUTPUT_DIRECTORY = slsDetectorUsersDocs
|
||||
|
Binary file not shown.
@ -28,8 +28,6 @@ Figure ~\ref{boards} show the readout board basic components on an Eiger half mo
|
||||
\label{boards}
|
||||
\end{figure}
|
||||
|
||||
|
||||
|
||||
\subsection{Mandatory setup - Hardware}
|
||||
An EIGER single module (500~kpixels) needs:
|
||||
\begin{itemize}
|
||||
@ -93,10 +91,14 @@ The receiver is a process run on a PC closely connected to the detector. Open on
|
||||
where xxxx, yyyy are the tcp port numbers. Use 1955 and 1956 for example. The receiver for the bottom is open without arguments but still in the configuration file one needs to write {\tt{n:flippeddatax 1}}, where {\tt{2n+1}} indicated the half module number, 1 if it is a module.
|
||||
\\ Open as many receiver as half module boards. A single module has two half module boards.
|
||||
|
||||
From the software version 3.0.1, one can decide weather start a zmq callback from the receiver to the client (for example to visualize data in the slsDetectorGui or another gui). If the zmq steam is not required (cased of the command line for example, one can switch off the streaming with {\tt{./sls\_detector\_put rx\_datastream 0}}, enable it with {\tt{./sls\_detector\_put rx\_datastream 1}}. In the case of inizialising the stream to use the slsDetectorGui, nothing needs to be taken care of by the user. If instead you want to stream the streaming on different channels, the zmq port of the client can be set stealing from the slsDetectorGui stream having {\tt{./sls\_detector\_put zmqport 300y}}. Note that if this is done globally (not for every half module n independently, then the client automatically takes into account that for every half module, there are 2 zmq stream. The receiver stream {\tt{./sls\_detector\_put rx\_zmqport 300y}} has to match such that the GUI can work.
|
||||
From the software version 3.0.1, one can decide weather start a zmq callback from the receiver to the client (for example to visualize data in the slsDetectorGui or another gui). If the zmq steam is not required (cased of the command line for example, one can switch off the streaming with {\tt{./sls\_detector\_put rx\_datastream 0}}, enable it with {\tt{./sls\_detector\_put rx\_datastream 1}}. In the case of initializing the stream to use the slsDetectorGui, nothing needs to be taken care of by the user. If instead you want to stream the streaming on different channels, the zmq port of the client can be set stealing from the slsDetectorGui stream having {\tt{./sls\_detector\_put zmqport 300y}}. Note that if this is done globally (not for every half module n independently, then the client automatically takes into account that for every half module, there are 2 zmq stream. The receiver stream {\tt{./sls\_detector\_put rx\_zmqport 300y}} has to match such that the GUI can work.
|
||||
If one desires to set the zmqport manually, he offset has to be taken into account: {\tt{./sls\_detector\_put 0:rx\_zmqport 300y}}, {\tt{./sls\_detector\_put 1:rx\_zmqport 300y+2}} and so on..
|
||||
|
||||
There is an example code that can be compiled in {\tt{manual/manual-api/mainReceiver.cpp}} and gives the executable {\tt{./detReceiver}}, use it with two or more receivers to open all receivers in one single terminal: {\tt{./detReceiver startTCPPort numReceivers withCallback}}, where startTCPPort assumes the other ports are consecutively increased.
|
||||
|
||||
{\tt{slsMultiReceiver}} uses two or more receivers in one single terminal: {\tt{./slsMultiReceiver startTCPPort numReceivers withCallback}}, where startTCPPort assumes the other ports are consecutively increased.
|
||||
|
||||
The command {\tt{r\_framesperfile}} sets the number of frames written in the same file. By default now it is 10000. It can be changes. It needs to be lowered particularly if one wants to parallelize the following conversion of the files.
|
||||
|
||||
|
||||
\subsection{Mandatory setup - Client}
|
||||
|
||||
@ -282,6 +284,39 @@ The detector will not accept other commands while acquiring. If an acquisition w
|
||||
\end{itemize}
|
||||
this same command can be used after a non proper abortion of the acquisition to reset to normal status the detector.
|
||||
|
||||
\section{Gap pixels inside a module}
|
||||
A module is composed of 2$\times$4 chips. Each chip is of dimension 256$\times$256 pixels. There is no dead area in a module, as a single sensor covers the 8 chips. The physical pixels at the border of the chips in the sensor are double in size, to allow not to loose photons in the gaps between the chip alignment. They count double what the other normal pixels would count. In the corner between chips, the pixels are 4-times the normal size. See figure~\ref{fgappix} to check the geometry.
|
||||
|
||||
\begin{figure}[t]
|
||||
\begin{center}
|
||||
\includegraphics[width=0.9\textwidth]{GapPixels}
|
||||
\end{center}
|
||||
\caption{Geometry of gap pixels between a module.}
|
||||
\label{fgappix}
|
||||
\end{figure}
|
||||
|
||||
It is possible to interpolated the value on the larger pixels by splitting the events (or properly interpolating) introducing a virtual pixel for every double pixel, or 3 virtual pixels for every corner. In this way the counts of a single large pixel can be shared among the correct amount of pixels of the normal dimension.
|
||||
|
||||
The gap pixels can be added for the slsDetectorGui, from the datacall back or stealing the zmq port from the GUI (see later). The detector size can be added in the configuration file as first thing.
|
||||
|
||||
Putting the long side of the module first always as a convection for the code, WITHOUT GAP PIXELS an EIGER module is:
|
||||
\begin{verbatim}
|
||||
detsizechan 1024 512
|
||||
\end{verbatim}
|
||||
and the client needs to be set {\tt{sls\_detector\_put gappixels 0}}, which is the default behavior.\\
|
||||
If you want to have GAP PIXELS included:
|
||||
\begin{verbatim}
|
||||
detsizechan 1030 514
|
||||
\end{verbatim}
|
||||
and the client needs to be set {\tt{sls\_detector\_put gappixels 1}}.
|
||||
|
||||
The size of the gap pixels between modules to insert is
|
||||
\begin{verbatim}
|
||||
GapPixelsBetweenModules_x = 8
|
||||
GapPixelsBetweenModules_y = 36
|
||||
\end{verbatim}
|
||||
where the {\tt{GapPixelsBetweenModules\_x}} are the one on the short side of the module, while {\tt{GapPixelsBetweenModules\_y}} are the ones on the long side of the module (where the wirebonds take physical space).
|
||||
|
||||
\section{Readout timing- maximum frame rate}\label{timing}
|
||||
IMPORTANT: to have faster readout and smaller dead time, one can configure {\tt{clkdivider}}, i.e. the speed at which the data are read, i.e. 200/100/50~MHz for {\tt{clkdivider 0/1/2}} and the dead time between frames through {\tt{flags parallel}}, i.e. acquire and read at the same time or acquire and then read out.
|
||||
The configuration of this timing variables allows to achieve different frame rates. NOTE THAT IN EIGER, WHATEVER YOU DO, THE FRAME RATE LIMITATIONS COME FROM THE NETWORK BOTTLENECK AS THE HARDWARE GOES FASTER THAN THE DATA OUT.
|
||||
@ -369,48 +404,50 @@ where the 'minimum time between frames' and the minimum period will be discussed
|
||||
\begin{tiny}
|
||||
\begin{table}
|
||||
\begin{flushleft}
|
||||
\begin{tabular}{|c|c|c|c|c|c|c|}
|
||||
\begin{tabular}{|c|c|c|c|c|c|c|c|}
|
||||
\hline
|
||||
\tiny{dr} & \tiny{clkdivider} & \tiny{flags} & \tiny{t between frames($\mu$s) } & \tiny{max frame rate (kHz)} & \tiny{min period ($\mu$s)} & \tiny{max imgs (nominal/our network)}\\
|
||||
\tiny{dr} & \tiny{clkdivider} & \tiny{flags} & \tiny{$\Delta$t frames($\mu$s) } & \tiny{max FR (kHz)} & \tiny{min period ($\mu$s)} & \tiny{meas. period ($\mu$s)} & \tiny{max imgs (nominal/our network)}\\
|
||||
\hline
|
||||
4 & 0 & parallel & 3.4 & 22 & 44 & 30k/50k\\
|
||||
4 & 0 & \tiny {parallel} & 3.4 & 22 & 44 & 44.01 & 30k/50k\\
|
||||
\hline
|
||||
4 & 1 & parallel & 6 & 10.5 & 92 & 30k/100k\\
|
||||
4 & 1 & \tiny {parallel} & 6 & 10.5 & 92 & 92.02 & 30k/100k\\
|
||||
\hline
|
||||
4 & 2 & parallel & 11.2 & 5.4 & 197 & infinite\\
|
||||
4 & 2 & \tiny {parallel} & 11.2 & 5.4 & 197& 197.01 & infinite\\
|
||||
\hline
|
||||
\hline
|
||||
8 & 0 & parallel & 3.4 & 11.1 & 89 & 15k/24k\\
|
||||
8 & 0 & \tiny {parallel} & 3.4 & 11.1 & 89 & 89.01 & 15k/24k\\
|
||||
\hline
|
||||
8 & 1 & parallel & 6.1 & 5.7 & 181 & 15k/52k\\
|
||||
8 & 1 & \tiny {parallel} & 6.1 & 5.7 & 181 & 181.01 & 15k/52k\\
|
||||
\hline
|
||||
8 & 2 & parallel & 11.2 & 2.9 & 342 & infinite\\
|
||||
8 & 2 & \tiny {parallel} & 11.2 & 2.9 & 342 & 342.01 & infinite\\
|
||||
\hline
|
||||
\hline
|
||||
16 & 0 & parallel & 3.4 & 6.1 & (126+38)* =164 & 8k/12k\\
|
||||
16 & 0 & \tiny {parallel} & 3.4 & 6.1 & (126+38)* =164 & 164.02 & 8k/12k\\
|
||||
\hline
|
||||
16 & 0 & nonparallel & 126 & 5.6 & (126+52)*= 179 & 8k/23k\\
|
||||
16 & 0 & \tiny {nonparallel} & 127 & 5.6 & (126+52)*= 179 & 179.01& 8k/23k\\
|
||||
\hline
|
||||
16 & 1 & parallel & 6.1 & 3.9 & 257 & 8k/28k\\
|
||||
16 & 1 & \tiny {parallel} & 6.1 & 3.9 & 257 & 257.01 & 8k/28k\\
|
||||
\hline
|
||||
16 & 1 & nonparallel & 255 & 3.3 & 303 & infinite\\
|
||||
16 & 1 & \tiny {nonparallel} & 255 & 3.3 & 303 & 303.01 & infinite\\
|
||||
\hline
|
||||
16 & 2 & parallel & 11 & 1.9 & 526 & infinite \\
|
||||
16 & 2 & \tiny {parallel} & 11.2 & 1.9 & 526 & 526.2 & infinite \\
|
||||
\hline
|
||||
16 & 2 & nonparallel & 504 & 1.8 & 555 & infinite\\
|
||||
16 & 2 & \tiny {nonparallel} & 505 & 1.8 & 555 & 555.01& infinite\\
|
||||
\hline
|
||||
%32 & 2 & parallel & 11 & 2& & &\\
|
||||
%\hline
|
||||
%32 & 2 & nonparallel & 504 & $<2$& & &\\
|
||||
%\hline
|
||||
\end{tabular}
|
||||
\caption{Readout settings. The {\tiny{min exptime}} possible is 5$-$10~$\mu$s. This is due to the time to pass the pixel enable signal in the whole chip. The time between frames has been measured with the oscilloscope and the maximum frames rate has been tested with an external gating from a pulse generator at known frequence. The minimum period is obtained as 1/$\textrm{max frame rate}$.}
|
||||
\caption{Readout settings. The {\tiny{min exptime}} possible is 5$-$10~$\mu$s. This is due to the time to pass the pixel enable signal in the whole chip. The time between frames ($\Delta$t) has been measured with the oscilloscope and the maximum frames rate (max FR) has been tested with an external gating from a pulse generator at known frequency. The minimum period is obtained as 1/$\textrm{max frame rate}$.}
|
||||
\label{tframes}
|
||||
\end{flushleft}
|
||||
\end{table}
|
||||
\end{tiny}
|
||||
|
||||
\textbf{As if you run too fast, the detector could become noisier, it is important to match the detector settings to your frame rate. This can be done having more parameters files and load the one suitable with your experiment.} We experienced that with low energy settings could not reach 6~kHz and no noise.
|
||||
\textbf{From software version 4.0.0, there is a very useful function {\tt{sls\_detector\_get measuredperiod}} which return the measured period AFTER the acquisition. This is important to check that the settings to obtain the targeted frame rate was correct.}
|
||||
|
||||
\textbf{If you run too fast, the detector could become noisier (see problem shooting), it is important to match the detector settings to your frame rate. This can be done having more parameters files and load the one suitable with your experiment.} We experienced that with low energy settings could not reach 6~kHz and no noise.
|
||||
|
||||
In 16 bit mode, it could make sense, in case of noise and low threshold to either reduce the frame rate:
|
||||
\begin{equation}
|
||||
@ -482,6 +519,12 @@ The number of subframes composing a single 32bit acquisition can be calculated a
|
||||
\end{equation}
|
||||
This also means that {\tt{exptime}}$<${\tt{subexptime}} will be rounded to{\tt{subexptime}}. If you want shorter acquisitions, either reduce the {\tt{subexptime}} or switch two 16-bit mode (you can always sum offline if needed).
|
||||
|
||||
From release 4.0.0, an extra {\tt{flag overflow/nooverflow}} is added, with {\tt{nooverflow}} default:
|
||||
\begin{itemize}
|
||||
\item {\tt{nooverflow}}: the internal 12-bit result is summed, even if there was saturation of the 12-bit counter (4095) in any of the subframes. Note that if there is saturation for every subframe, you might get as a result a value of the counter equal to (4095$\times$~number~of~subframes), which you need to correctly identify. On the other hand if the saturation occurred only one time, you will get something "close'' to the real number.
|
||||
\item {\tt{overflow}}: In this case, even if a pixel saturate only 1 time in a subframe, you will be returned as a value of the counter for that pixel: $2^{32}-1$, i.e. 4294967295.
|
||||
\end{itemize}
|
||||
|
||||
The UDP header will contain, after you receive the data, the effective number of subframe per image (see section~\ref{UDP}) as "SubFrame Num or Exp Time", i.e. the number of subframes recorded (32 bit eiger).
|
||||
The effective time the detector has recorded data can be computed as:
|
||||
\begin{equation}
|
||||
@ -489,7 +532,9 @@ The effective time the detector has recorded data can be computed as:
|
||||
%\label{esubframes}
|
||||
\end{equation}
|
||||
|
||||
In the future release, a configurable extra time difference between subframes will be introduced for the parallel mode, so that some noise appearing in detectors at low threshold can be removed. This will enlarge the time difference between frames form the default 12~$\mu$s to something configurable, expected to be 15-40~$\mu$s (for the 9M it is currently 200~$\mu$s due to a noisier module).
|
||||
From release 4.0.0, a configurable extra time difference between subframes can be introduced for the parallel mode, so that some noise appearing in detectors at low threshold can be removed. This is obtained through the {\tt{subdeadtime}}. You need to add values specific for your detector (ask the detector group). Typically, values between 15-40~$\mu$s should be used (for the 9M it is currently 200~$\mu$s due to a noisier module).
|
||||
|
||||
|
||||
|
||||
\section{External triggering options}\label{triggering}
|
||||
The detector can be setup such to receive external triggers. Connect a LEMO signal to the TRIGGER IN connector in the Power Distribution Board (see Fig.). The logic 0 for the board is passed by low level 0$-$0.7~V, the logic 1 is passed to the board with a signal between 1.2$-$5~V. Eiger is 50~$\Omega$ terminated. By default the positive polarity is used (negative should not be passed to the board).
|
||||
@ -718,44 +763,53 @@ white the option {\tt{n:flippeddatax 1}}, which flips in vertical the content of
|
||||
\subsection{``raw'' files}
|
||||
If you use the option of writing raw files, you will have a raw file for each UDP port (meaning most likely 2 chips), 4 files per module. In addition to the raw files, you will get also a ``master'' file, containing in ascii some detector general parameters and the explanation of how to interpret the data from the raw files.
|
||||
|
||||
The master file is named: {\tt{filename\_master\_0.raw}} and for version ``3.0'' of the slsDetectorSoftware looks like:
|
||||
The master file is named: {\tt{filename\_master\_0.raw}} and for version ``4.0.0'' of the slsDetectorSoftware looks like:
|
||||
|
||||
\begin{verbatim}
|
||||
Version : 1.0
|
||||
Dynamic Range : 16
|
||||
Ten Giga : 1
|
||||
Image Size : 262144 bytes
|
||||
x : 512 pixels
|
||||
y : 256 pixels
|
||||
Total Frames : 1
|
||||
Exptime (ns) : 1000000000
|
||||
SubExptime (ns) : 2621440
|
||||
Period (ns) : 1000000000
|
||||
Timestamp : Thu Aug 17 10:55:19 2017
|
||||
Version : 2.0
|
||||
Dynamic Range : 32
|
||||
Ten Giga : 1
|
||||
Image Size : 524288 bytes
|
||||
x : 512 pixels
|
||||
y : 256 pixels
|
||||
Max. Frames Per File : 10000
|
||||
Total Frames : 1
|
||||
Exptime (ns) : 1000000000
|
||||
SubExptime (ns) : 2621440
|
||||
SubPeriod(ns) : 2621440
|
||||
Period (ns) : 1000000000
|
||||
Timestamp : Mon Sep 3 09:07:05 2018
|
||||
|
||||
|
||||
#Frame Header
|
||||
Frame Number : 8 bytes
|
||||
SubFrame Number : 4 bytes
|
||||
Packet Number : 4 bytes
|
||||
Bunch ID : 8 bytes
|
||||
Timestamp : 8 bytes
|
||||
Module Id : 2 bytes
|
||||
X Coordinate : 2 bytes
|
||||
Y Coordinate : 2 bytes
|
||||
Z Coordinate : 2 bytes
|
||||
Debug : 4 bytes
|
||||
Round Robin Number : 2 bytes
|
||||
Detector Type : 1 byte
|
||||
Header Version : 1 byte
|
||||
Frame Number : 8 bytes
|
||||
SubFrame Number/ExpLength : 4 bytes
|
||||
Packet Number : 4 bytes
|
||||
Bunch ID : 8 bytes
|
||||
Timestamp : 8 bytes
|
||||
Module Id : 2 bytes
|
||||
X Coordinate : 2 bytes
|
||||
Y Coordinate : 2 bytes
|
||||
Z Coordinate : 2 bytes
|
||||
Debug : 4 bytes
|
||||
Round Robin Number : 2 bytes
|
||||
Detector Type : 1 byte
|
||||
Header Version : 1 byte
|
||||
Packets Caught Mask : 64 bytes
|
||||
\end{verbatim}
|
||||
|
||||
Note that if one wants to reconstruct the real time the detector was acquiring in 32 bit (autosumming mode), one would have to multiply the SubExptime (ns) for the SubFrame Number.
|
||||
|
||||
\subsection{Offline image reconstruction}
|
||||
The offline image reconstruction{\tt{slsImageReconstruction}} is not part of the package anymore.
|
||||
The offline image reconstruction{\tt{slsImageReconstruction}} is not part of the package anymore. The code is still available doing \\
|
||||
{\tt{git clone git@git.psi.ch:sls\_detectors\_software/sls\_image\_reconstruction.git slsImageReconstruction}}.
|
||||
Checkout the {\tt{developer}} branch if in a 3.1.X release or the {\tt{v4.0.0}} branch if in 4.0.X release of the {\tt{slsDetector}} code.
|
||||
|
||||
The detector writes 2 raw files per receiver. An offline image reconstruction executable has been written to collate the possible files together and produce cbf files. The executable uses the CBFlib-0.9.5 library (downloaded from the web as it download some architecture dependent packages at installation).\\
|
||||
Three possible conversions are possible: into \textbf{cbf}, \textbf{hdf5} and \textbf{root} format. The detector writes 4 raw files per receiver. An offline image reconstruction executable has been written to collate the possible files together and produce output files. By default an interpolation between the values of the large pixels is performed. Gap pixels between modules are also inserted.
|
||||
|
||||
|
||||
\subsubsection{cbf}
|
||||
The cbf executable executable uses the CBFlib-0.9.5 library (downloaded from the web as it download some architecture dependent packages at installation).Edit the Makefile to correclty point at it.\\
|
||||
\underline{At cSAXS, the CBFlib-0.9.5 has been compiled -such that the required packages are}\\\underline{ downloaded in /sls/X12SA/data/x12saop/EigerPackage/CBFlib-0.9.5.}\\
|
||||
|
||||
To use it for a single module:
|
||||
@ -765,29 +819,90 @@ cbfMaker [filename with dir]
|
||||
eg.
|
||||
{\tt{cbfMaker /scratch/run\_63\_d1\_f000000000000\_3.raw}}\\
|
||||
|
||||
To use it for a 1.5 multi modules:
|
||||
\begin{verbatim}
|
||||
cbfMaker [filename] [pixels x] [pixels y] ([singlemodulelongside_x] [start det])
|
||||
\end{verbatim}
|
||||
To use it any geometry:\\
|
||||
{\tt{cbfMaker [filename] [pixels x, def=1024] [pixels y, def=512] [singlemodulelongside\_x, def=1] [fillgaps, def=Interpolate Big Pixels] [hdf5datasetname, def="Eiger"] [start det,def=0]}}\\
|
||||
eg.
|
||||
{\tt cbfMaker /scratch/run\_63\_d0\_f000000000000\_3.raw 3072 512 1 0}.\\
|
||||
The {\tt{[singlemodulelongside\_x]}} {\tt{[option to interpolate gap pixels]}} param are optional. Defaults are ``1'', the detector long side is on the x coordinate and start to reconstruct from module 0.
|
||||
{\tt cbfMaker /scratch/run\_63\_d0\_f000000000000\_3.raw 3072 512 1 2 ``Eiger'' 0}.\\
|
||||
|
||||
The {\tt{[singlemodulelongside\_x]}} {\tt{[option to interpolate gap pixels]}} param are optional. Defaults are ``1'', the detector long side is on the x coordinate and to start to reconstruct from module 0.
|
||||
The interpolation scheme fro the gap pixels between chips is by default ``interpolate large big pixels'', =2;
|
||||
If you want to change interpolation scheme, use:\\
|
||||
\begin{tabular}{|c|c|}
|
||||
\hline
|
||||
interpolation scheme & argument\\
|
||||
\hline
|
||||
insert gap pixels and assign value only to the first one & 0\\
|
||||
\hline
|
||||
equally divide the value of the counter bettern the two pixels & 1\\
|
||||
\hline
|
||||
interpolate large pixel value & 2\\
|
||||
\hline
|
||||
mask the value of the two gap pixels & 3\\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\ \\
|
||||
\ \\
|
||||
The executables:
|
||||
\begin{verbatim}
|
||||
bcfMaker1.5M [file_name_with_dir]
|
||||
bcfMaker9M [file_name_with_dir]
|
||||
cbfMaker1.5M [file_name_with_dir]
|
||||
cbfMakerOMNY [file_name_with_dir]
|
||||
cbfMaker9M [file_name_with_dir]
|
||||
\end{verbatim}
|
||||
contain the hardcoded geometry for the 1.5M (3 modules horizontal on the long side) and for the 9M at cSAXS: 6(short side)$\times$3 (long side) modules.\\
|
||||
contain the hardcoded geometry for the 1.5M (3 modules horizontal on the long side), the 1.5M OMNY geometry (3 modules next to each other on the long side) and for the 9M at cSAXS: 6(short side)$\times$3 (long side) modules.\\
|
||||
Missing packets in a frame and border pixels ($\times 2$ and $\times 4$ are given with value $-1$ at the present time.
|
||||
|
||||
It is important to know, that the pixels at the edge between 2 chips count more as double size. We can virtually introduced 1 virtual pixel per double larger pixel, so to have an even number of counts everywhere. Virtual pixels (not filled ) between module gaps are also inserted.
|
||||
Make sure the following options are uncommented in the {\tt{slsImageReconstruction/src/main\_csaxs.cpp}} file.
|
||||
\begin{verbatim}
|
||||
#define MYCBF
|
||||
##following line only if you need to process with
|
||||
##BUBBLE (Material Science / uXAS beamlines).
|
||||
#define MSHeader
|
||||
\end{verbatim}
|
||||
Compile it with:
|
||||
\begin{verbatim}
|
||||
make cbfMaker; make cbfMakerOMNY;
|
||||
\end{verbatim}
|
||||
|
||||
\begin{verbatim}
|
||||
GapPixelsBetweenChips_x = 2;
|
||||
GapPixelsBetweenChips_y = 2;
|
||||
GapPixelsBetweenModules_x = 8;
|
||||
GapPixelsBetweenModules_y = 36;
|
||||
\end{verbatim}
|
||||
\subsubsection{hdf5}
|
||||
In case of HDF5 output file, we rely on having the HDF5 1.10.1 library installed. Edit the Makefile to correclty point at it. Different compression methods are being tried so different external filters might be to be installed. This work is not finished yet.
|
||||
|
||||
To choose HDF5, with ZLIB implementation, open {\tt{slsImageReconstruction/src/main\_csaxs.cpp}} and make sure that
|
||||
\begin{verbatim}
|
||||
#define HDF5f
|
||||
#define ZLIB
|
||||
\end{verbatim}
|
||||
are not commented out. All other options need to be commented out. Copile the code with
|
||||
\begin{verbatim}
|
||||
make hdf5Maker; make hdf5MakerOMNY;
|
||||
\end{verbatim}
|
||||
|
||||
If you are at cSAXS. all images collected will be written in a single file. If you are not at CSAXS, most likely you want to have all the images written in a single raw file into an HDF5 file. The multiple HDF5 files are then linked in a master file, with many subdatasets (can be read by albula) or by a virtual file with a single dataset. If you want a mster o virtual file, uncomment this option:
|
||||
\begin{verbatim}
|
||||
#define MASTERVIRTUAL
|
||||
\end{verbatim}
|
||||
and recompile.
|
||||
To use it for a single module:
|
||||
\begin{verbatim}
|
||||
hdf5Maker [filename with dir]
|
||||
\end{verbatim}
|
||||
eg.
|
||||
{\tt{hdf5Maker /scratch/run\_63\_d1\_f000000000000\_3.raw}}\\
|
||||
|
||||
To use it any geometry:\\
|
||||
{\tt{hdf5Maker [filename] [pixels x, def=1024] [pixels y, def=512] [singlemodulelongside\_x, def=1] [fillgaps, def=Interpolate Big Pixels] [hdf5datasetname, def="Eiger"] [start det,def=0]}}\\
|
||||
eg.
|
||||
{\tt hdf5Maker /scratch/run\_63\_d0\_f000000000000\_3.raw 3072 512 1 2 ``Eiger'' 0}.\\
|
||||
|
||||
\subsubsection{root}
|
||||
The data will be written as TH2D in root format. Edit the {\tt{Makefile}} to point to the correct ROOT library location. Compile the executable as:
|
||||
\begin{verbatim}
|
||||
make image
|
||||
\end{verbatim}
|
||||
There is no program other executable that alredy keeps into account the geometry for it.
|
||||
To use it any geometry:\\
|
||||
{\tt{image [filename] [pixels x, def=1024] [pixels y, def=512] [singlemodulelongside\_x, def=1] [fillgaps, def=Interpolate Big Pixels] [hdf5datasetname, def="Eiger"] [start det,def=0]}}\\
|
||||
eg.
|
||||
{\tt image /scratch/run\_63\_d0\_f000000000000\_3.raw 3072 512 1 2 ``Eiger'' 0}.\\
|
||||
|
||||
\subsection{Read temperatures/HV from boards}
|
||||
|
||||
@ -851,6 +966,16 @@ ssh root@$i sync; done
|
||||
|
||||
\section{Loading firmware bitfiles}
|
||||
|
||||
\textbf{As a new procedure, the first thing to do is to kill the server on the boards, copy the new one there without starting it.} Note taht failure to do this step before may cause the linux on the baords to crash and not being able to ping it (this if the registers between the old and new firmware change).
|
||||
|
||||
This is teh procedure from a terminal;
|
||||
\begin{verbatim}
|
||||
for i in beb111 beb070;
|
||||
do ssh root@$i killall eigerDetectorServer;
|
||||
scp eigerDetectorServer root@$i:~/executables/eigerDetectorServer ;
|
||||
ssh root@$i sync; done
|
||||
\end{verbatim}
|
||||
|
||||
A \textbf{bcp} executable (which needs \textbf{tftp} installed on the PC, is needed.
|
||||
\begin{enumerate}
|
||||
\item Manual way: you need to press something on the detector. To program bitfiles (firmware files), do a hard reset with a pin/thin stuff in the holes at the very back of the module. They are between the top 7 LED and the bottom 1 and opposite for the other side. Push hard till all LEDs are alternating green and red.
|
||||
@ -909,7 +1034,7 @@ for j in $(seq 0 255) ; do
|
||||
sls_detector_put pulsenmove N 0 1;
|
||||
done;
|
||||
done;
|
||||
sls_detector_p resmat 0
|
||||
sls_detector_put resmat 0
|
||||
sls_detector_acquire
|
||||
\end{verbatim}
|
||||
You read {\tt{N}} in every pixel if you are setup correctly.
|
||||
@ -1017,6 +1142,10 @@ Note that occasionally if there is a shared memory of a different size (from an
|
||||
\end{verbatim}
|
||||
This needs to be cleaned with {\tt{ipcs -m}} and then {\tt{ipcrm -M xxx}}, where xxx are the keys with nattch 0. Alternative in the main slsDetectorFolder there is a script that can be used as {\tt{sh cleansharedmemory.sh}}. Note that you need to run the script with the account of the client user, as the shared memory belongs to the client. It is good procedure to implement an automatic cleanup of the shared memory if the client user changes often.
|
||||
|
||||
\subsection{Client has shared memory iusses}
|
||||
The shared memory from software version 4.0.0 creates shared memory segments in /dev/shm/. You can look at them and cancel them directly. Note that this is still user dependent.
|
||||
Environment variable SLSDETNAME can be set for using 2 different detectors from the same client pc. One needs a different multi detector id if the SLSDETNAME is different for both consoles.
|
||||
|
||||
\subsection{Measure the HV}
|
||||
For every system:
|
||||
\begin{itemize}
|
||||
@ -1078,15 +1207,14 @@ If you see the client returning the following error message:\\
|
||||
\end{verbatim}
|
||||
|
||||
\subsection{There is noise running the detector in 32-bit}
|
||||
Short story (for now): You are running in {\tt{parallel}} mode, switch {\tt{flags}} to non {\tt{nonparallel}} mode.
|
||||
Long story: If you are running the detector in 32-bit (autosumming), there might be some noise, particularly at lower thereshold energies. This is due to the fact that the analog part of the chips require some latency time to settle which is larger than the redout time. At the present moment it is possible to run the detector only in {\tt{parallel}} or {\tt{nonparallel}} mode, respectively with readout times between frames of 12~$\mu$s and 504~$\mu$s. If you switch {\tt{flags}} to non {\tt{nonparallel}} mode you will giveenough time for teh signals to settle. For future realeas we are planning to introduce some configurable delay, such that you can remain with the {\tt{parallel}} flag, but can obtain a configurable dead time between frames in the range 12$-$504~$\mu$s.
|
||||
If you are running the detector in 32-bit (autosumming), there might be some noise, particularly at lower thereshold energies. This is due to the fact that the analog part of the chips require some latency time to settle which is larger than the readout time. It is possible to run the detector only in {\tt{parallel}} or {\tt{nonparallel}} mode, respectively with readout times between frames of 12~$\mu$s and 504~$\mu$s. If you switch {\tt{flags}} to non {\tt{nonparallel}} mode you will give enough time for the signals to settle. From release 4.0.0, there is a configurable delay that can be set through the {\tt{subdeadtime}} variable, such that you can remain with the {\tt{parallel}} flag, but can obtain a configurable dead time between frames. Ask the SLS detector group for an appropriate dead time for your detector, but typically a dead time of 20-50~$\mu$s should be enough. Note that this {\tt{subdeadtime}} need to include the 12~$\mu$s minimum readout time, so it has to be larger than 12~$\mu$s to do anything.
|
||||
|
||||
\subsection{There is noise running the detector at high frame rate(4,8,16 bit)}
|
||||
If are running in {\tt{parallel}} mode, in particular at low thereshold energies, you might encounter some noise. The reason is that the analog part of the chips require some latency time to settle which is larger than the redout time.
|
||||
If are running in {\tt{parallel}} mode, in particular at low thereshold energies, you might encounter some noise. The reason is that the analog part of the chips require some latency time to settle which is larger than the readout time.
|
||||
\begin{enumerate}
|
||||
\item You can lower the frame rate and relax requirements on period:
|
||||
At low frame rate, you normally leave enough time between the end of the acquisition and the starting of the next, so you should not see this effect. In any case setting a {\tt{period}}={\tt{exptime}}+readout time from Table~\ref{tchipro} +extra 20$\mu$s cures the problem. The 20$\mu$s could also be 10~$\mu$s, they are very hardware dependent.
|
||||
\item The frame rate requirement are stingent (as for time resolved measurements): the only option here is to reduce the {\tt{exptime}} to let the extra 20~$\mu$s (or 10)~$\mu$s. The {\tt{period}} remains the same.
|
||||
\item The frame rate requirement are stringent (as for time resolved measurements): the only option here is to reduce the {\tt{exptime}} to let the extra 20~$\mu$s (or 10)~$\mu$s. The {\tt{period}} remains the same.
|
||||
\end{enumerate}
|
||||
|
||||
\section{Client checks - command line}
|
||||
@ -1289,7 +1417,7 @@ In table~\ref{tframescomplete} is a list of all the readout times in the differe
|
||||
\end{table}
|
||||
\end{tiny}
|
||||
|
||||
Table~\ref{tx} shows the bandwidth of data trasnferring between the FEB and BEB and of the DDR2 memory access. the GTX lanes are only capable of 25.6~Gbit/s. This limits the 12/16 bit frame rate. The 2$\times$DDR2 memories have a bandwidth or 2$\cdot$25.6~Gb/s=51.2~Gb/s. Due to this memory access bandwidth, the 32 bit autosumming mode can only run in {\tt{clkdivider}} 2.
|
||||
Table~\ref{tx} shows the bandwidth of data transferring between the FEB and BEB and of the DDR2 memory access. the GTX lanes are only capable of 25.6~Gbit/s. This limits the 12/16 bit frame rate. The 2$\times$DDR2 memories have a bandwidth or 2$\cdot$25.6~Gb/s=51.2~Gb/s. Due to this memory access bandwidth, the 32 bit autosumming mode can only run in {\tt{clkdivider}} 2.
|
||||
\begin{figure}[t]
|
||||
\begin{center}
|
||||
\includegraphics[width=1.\textwidth]{TansmissionRates}
|
||||
|
BIN
manual/manual-client/GapPixels.png
Normal file
BIN
manual/manual-client/GapPixels.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 37 KiB |
@ -61,6 +61,11 @@ The \textit{data receiver}, which can be run on a different machine than the
|
||||
client, receives the data from the detector and processes it. The receiver can
|
||||
be configured, controlled and monitored by the client.
|
||||
|
||||
\item \textcolor{blue}{slsMultiReceiver}: \\
|
||||
It is the same as the \textit{slsReceiver}, but that it is a single process
|
||||
for many multiple slsReceiver child processes. One can configure the start TCP port,
|
||||
number of slsReceiver processes and if call back should be enabled or not.
|
||||
|
||||
\item \textcolor{blue}{slsDetectorGUI}: \\
|
||||
The \textit{graphical user interface}, which provides a user friendly way
|
||||
of operating the detectors and data receivers with online data preview.
|
||||
@ -110,13 +115,13 @@ conda config --add channels conda-forge
|
||||
conda config --add channels slsdetectorgroup
|
||||
|
||||
#Install latest version
|
||||
conda install sls_detector_software
|
||||
conda install sls_detector_lib
|
||||
conda install sls_detector_gui
|
||||
|
||||
#Install specific release (GLIBC2.14)
|
||||
conda install sls_detector_software=3.1.0
|
||||
#Install specific release
|
||||
conda install sls_detector_lib=4.0.0
|
||||
conda install sls_detector_gui=4.0.0
|
||||
|
||||
#Scientific Linux 6 version (GLIBC2.12)
|
||||
conda install sls_detector_software=SL6_3.1.0
|
||||
\end{verbatim}
|
||||
\item The package including Python interface
|
||||
\begin{verbatim}
|
||||
@ -127,11 +132,9 @@ conda config --add channels sls_detector
|
||||
#Install latest version
|
||||
conda install sls_detector
|
||||
|
||||
#Install specific release (GLIBC2.14)
|
||||
conda install sls_detector=3.1.0
|
||||
#Install specific release
|
||||
conda install sls_detector=4.0.0
|
||||
|
||||
#Scientific Linux 6 version (GLIBC2.12)
|
||||
conda install sls_detector=SL6_3.1.0
|
||||
\end{verbatim}
|
||||
\end{itemize}
|
||||
|
||||
@ -148,13 +151,13 @@ acquisition system, or if one wants to download the source code and compile.
|
||||
\begin{verbatim}
|
||||
#Clone source code with specific release
|
||||
git clone https://github.com/slsdetectorgroup/slsDetectorPackage.git --branch
|
||||
3.1.0
|
||||
4.0.0
|
||||
\end{verbatim}
|
||||
\item The package including Python interface
|
||||
\begin{verbatim}
|
||||
#Clone source code with specific release
|
||||
git clone https://github.com/slsdetectorgroup/sls_detector.git --branch
|
||||
3.1.0
|
||||
4.0.0
|
||||
\end{verbatim}
|
||||
\end{itemize}
|
||||
|
||||
@ -437,14 +440,11 @@ the SLS Detector Package or a different detector type.
|
||||
One can use the \verb=cleansharedmemory.sh= script available under the
|
||||
slsDetector Package.
|
||||
|
||||
One can also just use the following commands to clean the shared memory
|
||||
segments one by one.
|
||||
\begin{verbatim}
|
||||
#displays list of shared memeory segments
|
||||
ipcs -m
|
||||
#remove segments that have nattach equal to zero. They key is the first column
|
||||
ipcrm -M [key]
|
||||
\end{verbatim}
|
||||
One can also just delete the files that are typically located under /dev/shm/ folder
|
||||
and starts with slsDetectorPackage.
|
||||
|
||||
One no longer has to delete segments using ipcs.
|
||||
|
||||
|
||||
\section{Software Upgrade}
|
||||
|
||||
@ -544,14 +544,14 @@ detector board the programming files and/or software package provided by
|
||||
the SLS Detectors group.
|
||||
|
||||
\subsubsection{GOTTHARD Firmware}
|
||||
\textit{For SLS Detector Package v3.1.0} \\
|
||||
\textit{For SLS Detector Package v4.0.0} \\
|
||||
\indent Minimum compatible version: \\
|
||||
\indent \indent 11.01.2013 \\
|
||||
\indent Latest version: \\
|
||||
\indent \indent 08.02.2018 (50um and 25um Master) \\
|
||||
\indent \indent 08.02.2018 (50um) \\
|
||||
\indent \indent 08.02.2018 (25 um Master) \\
|
||||
\indent \indent 09.02.2018 (25 um Slave) \\
|
||||
|
||||
|
||||
Normally, the firmware will be upgraded by us as it requires programming the
|
||||
FPGA via the USB-Blaster.
|
||||
|
||||
@ -636,9 +636,9 @@ detector board the programming files and/or software package provided by
|
||||
the SLS Detectors group.
|
||||
|
||||
\subsubsection{EIGER Firmware}
|
||||
\textit{For SLS Detector Package v3.1.0} \\
|
||||
\indent Minimum compatible version: 16 \\
|
||||
\indent Latest version: 20 \\
|
||||
\textit{For SLS Detector Package v4.0.0} \\
|
||||
\indent Minimum compatible version: 22 \\
|
||||
\indent Latest version: 22 \\
|
||||
|
||||
|
||||
\begin{enumerate}
|
||||
@ -647,6 +647,20 @@ Detector Group.
|
||||
\item If one does not have the bcp script, that should also be obtained from
|
||||
the SLS Detector Group. It is required to program the bit files and requires
|
||||
that tftp be installed on the pc.
|
||||
\item Bring the detector into programmable mode by either of the following ways.
|
||||
Both ways end up in just the central LED blinking.
|
||||
\begin{enumerate}
|
||||
\item hard reset on the back panel boards resulting in blinking LEDS
|
||||
\item by having the following program running in the background.
|
||||
\begin{verbatim}
|
||||
boot_recovery
|
||||
\end{verbatim}
|
||||
\end{enumerate}
|
||||
\item Start a terminal for each half module and run the following to see
|
||||
progress.
|
||||
\begin{verbatim}
|
||||
nc -p 3000 -u bebxxx 3000
|
||||
\end{verbatim}
|
||||
\item Run the following to update firmware
|
||||
\begin{verbatim}
|
||||
#update back end fpga
|
||||
@ -715,9 +729,9 @@ detector board the programming files and/or software package provided by
|
||||
the SLS Detectors group.
|
||||
|
||||
\subsubsection{JUNGFRAU Firmware}
|
||||
\textit{For SLS Detector Package v3.1.0} \\
|
||||
\indent Minimum compatible version: 13.11.2017 \\
|
||||
\indent Latest version: 13.11.2017 \\
|
||||
\textit{For SLS Detector Package v4.0.0} \\
|
||||
\indent Minimum compatible version: 15.06.2018 \\
|
||||
\indent Latest version: 15.06.2018 \\
|
||||
|
||||
|
||||
At times, one has to update the firmware, which then also requires updating the
|
||||
@ -733,7 +747,7 @@ Detector Group.
|
||||
\item Update the latest SLS Detector package installed.
|
||||
\item Update the on-board software as per the instructions in the next
|
||||
section.
|
||||
\item Start the on-board server in debug mode:
|
||||
\item Start the on-board server in update mode:
|
||||
\begin{enumerate}
|
||||
\item Connect to the blackfin on the detector\\
|
||||
\verb=telnet bchipxxx=
|
||||
@ -743,10 +757,10 @@ section.
|
||||
\item Comment out the line
|
||||
\verb=#ttyS0::respawn:/jungfrauDetectorServervxxx=
|
||||
\item Reboot blackfin using \verb=reboot=
|
||||
\item Run \verb=ps= to ensure no gotthardDetectorServers are running
|
||||
\item Run \verb=ps= to ensure no jungfrauDetectorServers are running
|
||||
\end{enumerate}
|
||||
\item Start the server in debug mode using: \\
|
||||
\verb=./jungfrauDetectorServerxxx -debug= \\
|
||||
\item Start the server in update mode using: \\
|
||||
\verb=./jungfrauDetectorServerxxx -update= \\
|
||||
Leave this console on to come back to it later.
|
||||
\end{enumerate}
|
||||
\item From the command line of the pc, clear shared memory \\
|
||||
@ -759,7 +773,7 @@ script in \verb=slsDetectorPackage/cleansharedmemory.sh=
|
||||
\verb=./sls_detector_put programfpga xxx.pof=
|
||||
\item Once the programming is done:
|
||||
\begin{enumerate}
|
||||
\item Switch to the console that has the debug server running and kill it
|
||||
\item Switch to the console that has the update server running and kill it
|
||||
using Ctrl+C and ensure no jungfrauDetectorServers are
|
||||
running
|
||||
\item Restart the new server to see if it runs with the new firmware \\
|
||||
|
@ -1 +0,0 @@
|
||||
../slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServer_developer
|
@ -1 +0,0 @@
|
||||
../slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServer_virtualMaster
|
@ -1 +0,0 @@
|
||||
../slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServer_virtualSlave
|
1
serverBin/eigerDetectorServerv4.0.0.22.0
Symbolic link
1
serverBin/eigerDetectorServerv4.0.0.22.0
Symbolic link
@ -0,0 +1 @@
|
||||
../slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv4.0.0.22.0
|
@ -1 +0,0 @@
|
||||
../slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServer_developer
|
@ -1 +0,0 @@
|
||||
../slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServer_virtual
|
1
serverBin/gotthardDetectorServerv4.0.0.3
Symbolic link
1
serverBin/gotthardDetectorServerv4.0.0.3
Symbolic link
@ -0,0 +1 @@
|
||||
../slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServerv4.0.0.3
|
@ -1 +0,0 @@
|
||||
../slsDetectorSoftware/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer
|
@ -1 +0,0 @@
|
||||
../slsDetectorSoftware/jungfrauDetectorServer/bin/jungfrauDetectorServer_virtual
|
1
serverBin/jungfrauDetectorServerv4.0.0.0
Symbolic link
1
serverBin/jungfrauDetectorServerv4.0.0.0
Symbolic link
@ -0,0 +1 @@
|
||||
../slsDetectorSoftware/jungfrauDetectorServer/bin/jungfrauDetectorServerv4.0.0.0
|
@ -21,34 +21,40 @@ using namespace std;
|
||||
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
|
||||
qClient *cl =new qClient(argv[1]);
|
||||
qClient* cl = 0;
|
||||
try {
|
||||
cl = new qClient(argv[1]);
|
||||
} catch(...) {
|
||||
return 0;
|
||||
}
|
||||
cl->executeLine(argc-2, argv+2);
|
||||
|
||||
delete cl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
qClient::qClient(char* hostname){
|
||||
//create socket
|
||||
mySocket = new MySocketTCP(hostname, DEFAULT_GUI_PORTNO);
|
||||
if (mySocket->getErrorStatus()){
|
||||
cout << "Error: could not connect to host:" << hostname << " with port " << DEFAULT_GUI_PORTNO << endl;
|
||||
delete mySocket;
|
||||
exit(-1);
|
||||
}
|
||||
qClient::qClient(char* hostname):
|
||||
mySocket(0),
|
||||
myStopSocket(0){
|
||||
|
||||
//create socket to connect to stop server
|
||||
myStopSocket = new MySocketTCP(hostname, DEFAULT_GUI_PORTNO+1);
|
||||
if (myStopSocket->getErrorStatus()){
|
||||
cout << "Error: could not connect to host:" << hostname << " with port " << DEFAULT_GUI_PORTNO + 1 << endl;
|
||||
delete myStopSocket;
|
||||
exit(-1);
|
||||
try {
|
||||
// control socket
|
||||
mySocket = new MySocketTCP(hostname, DEFAULT_GUI_PORTNO);
|
||||
// stop socket
|
||||
myStopSocket = new MySocketTCP(hostname, DEFAULT_GUI_PORTNO+1);
|
||||
} catch(...) {
|
||||
if (mySocket == 0)
|
||||
cout << "Error: could not connect to control server:" <<
|
||||
hostname << " with port " << DEFAULT_GUI_PORTNO << endl;
|
||||
else
|
||||
cout << "Error: could not connect to stop server:" <<
|
||||
hostname << " with port " << DEFAULT_GUI_PORTNO + 1 << endl;
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -93,7 +99,7 @@ int qClient::executeLine(int narg, char *args[]){
|
||||
else if (argument == "stop")
|
||||
stopAcquisition();
|
||||
else{
|
||||
cout << "Error: could not parse arguments: " << argument << endl;
|
||||
cprintf(RED,"Error: could not parse arguments: %s\n", argument.c_str());
|
||||
printCommands();
|
||||
return FAIL;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@
|
||||
<enum>QTabWidget::North</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>4</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="elideMode">
|
||||
<enum>Qt::ElideLeft</enum>
|
||||
@ -124,7 +124,7 @@
|
||||
<rect>
|
||||
<x>5</x>
|
||||
<y>10</y>
|
||||
<width>467</width>
|
||||
<width>495</width>
|
||||
<height>66</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -946,7 +946,7 @@ An extension given by the modules serial number will be attached.
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>135</y>
|
||||
<y>132</y>
|
||||
<width>736</width>
|
||||
<height>171</height>
|
||||
</rect>
|
||||
@ -960,7 +960,7 @@ An extension given by the modules serial number will be attached.
|
||||
<x>420</x>
|
||||
<y>140</y>
|
||||
<width>291</width>
|
||||
<height>25</height>
|
||||
<height>29</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -975,9 +975,9 @@ An extension given by the modules serial number will be attached.
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>25</x>
|
||||
<y>25</y>
|
||||
<y>21</y>
|
||||
<width>686</width>
|
||||
<height>148</height>
|
||||
<height>119</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_8">
|
||||
@ -1355,9 +1355,9 @@ An extension given by the modules serial number will be attached.
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>35</x>
|
||||
<y>15</y>
|
||||
<y>10</y>
|
||||
<width>686</width>
|
||||
<height>146</height>
|
||||
<height>123</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
@ -1949,15 +1949,15 @@ Exposure Time of a sub frame. Only for Eiger in 32 bit mode
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Period between sub frames. Only for Eiger in 32 bit mode.
|
||||
Dead time between sub frames. Only for Eiger in 32 bit mode.
|
||||
</nobr><br><nobr>
|
||||
Default value is 0. A value less than the required minimum is ignored.
|
||||
</nobr><br><nobr>
|
||||
#subperiod#
|
||||
#subdeadtime#
|
||||
</nobr></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sub Frame Period:</string>
|
||||
<string>Sub Frame Dead Time:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsDetectorGui
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: 6bb7195a2c7dc9526088882e0244a7455d3c15b2
|
||||
Revision: 511
|
||||
Branch: 3.3.0-rc
|
||||
Repsitory UUID: d2bce7e372c241cd235977b92be18555bca6a77d
|
||||
Revision: 521
|
||||
Branch: 4.0.0
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 3941
|
||||
Last Changed Date: 2018-07-17 16:15:43.000000002 +0200 ./src/qTabSettings.cpp
|
||||
Last Changed Rev: 4020
|
||||
Last Changed Date: 2018-09-27 16:09:16.000000002 +0200 ./src/qTabSettings.cpp
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "6bb7195a2c7dc9526088882e0244a7455d3c15b2"
|
||||
#define GITREPUUID "d2bce7e372c241cd235977b92be18555bca6a77d"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x3941
|
||||
#define GITDATE 0x20180717
|
||||
#define GITBRANCH "3.3.0-rc"
|
||||
#define GITREV 0x4020
|
||||
#define GITDATE 0x20180927
|
||||
#define GITBRANCH "4.0.0"
|
||||
|
@ -246,7 +246,7 @@ void qDrawPlot::SetupWidgetWindow(){
|
||||
this->setLayout(layout);
|
||||
|
||||
histFrameIndexTitle = new QLabel("");
|
||||
|
||||
histFrameIndexTitle->setFixedHeight(10);
|
||||
boxPlot = new QGroupBox("");
|
||||
layout->addWidget(boxPlot,1,0);
|
||||
boxPlot->setAlignment(Qt::AlignHCenter);
|
||||
|
@ -27,7 +27,7 @@ int qServer::gui_server_thread_running(0);
|
||||
|
||||
|
||||
qServer::qServer(qDetectorMain *t):
|
||||
myMainTab(t), mySocket(NULL),myStopSocket(NULL),port_no(DEFAULT_GUI_PORTNO),lockStatus(0),checkStarted(0),checkStopStarted(0){
|
||||
myMainTab(t), mySocket(0),myStopSocket(0),port_no(DEFAULT_GUI_PORTNO),lockStatus(0),checkStarted(0),checkStopStarted(0){
|
||||
strcpy(mess,"");
|
||||
FunctionTable();
|
||||
|
||||
@ -196,7 +196,7 @@ int qServer::StartStopServer(int start){
|
||||
pthread_join(gui_server_thread,NULL);
|
||||
if(mySocket){
|
||||
delete mySocket;
|
||||
mySocket = NULL;
|
||||
mySocket = 0;
|
||||
}
|
||||
|
||||
if(myStopSocket)
|
||||
@ -204,7 +204,7 @@ int qServer::StartStopServer(int start){
|
||||
pthread_join(gui_stop_server_thread,NULL);
|
||||
if(myStopSocket){
|
||||
delete myStopSocket;
|
||||
myStopSocket = NULL;
|
||||
myStopSocket = 0;
|
||||
}
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
@ -235,8 +235,10 @@ int qServer::StopServer(){
|
||||
#endif
|
||||
int ret = qDefs::OK;
|
||||
|
||||
myStopSocket = new MySocketTCP(port_no+1);
|
||||
if (myStopSocket->getErrorStatus()){
|
||||
try {
|
||||
MySocketTCP* s = new MySocketTCP(port_no+1);
|
||||
myStopSocket = s;
|
||||
} catch(...) {
|
||||
gui_server_thread_running = 0;
|
||||
qDefs::Message(qDefs::WARNING,"Could not start gui stop server socket","qServer::StopServer");
|
||||
}
|
||||
@ -270,7 +272,7 @@ int qServer::StopServer(){
|
||||
//delete socket(via exit server)
|
||||
if(myStopSocket){
|
||||
delete myStopSocket;
|
||||
myStopSocket = NULL;
|
||||
myStopSocket = 0;
|
||||
}
|
||||
|
||||
if(!gui_server_thread_running)
|
||||
@ -300,8 +302,10 @@ int qServer::StartServer(){
|
||||
#endif
|
||||
int ret = qDefs::OK;
|
||||
|
||||
mySocket = new MySocketTCP(port_no);
|
||||
if (mySocket->getErrorStatus()){
|
||||
try {
|
||||
MySocketTCP* s = new MySocketTCP(port_no);
|
||||
mySocket = s;
|
||||
} catch(...) {
|
||||
gui_server_thread_running = 0;
|
||||
qDefs::Message(qDefs::WARNING,"Could not start gui server socket","qServer::StartServer");
|
||||
}
|
||||
@ -335,7 +339,7 @@ int qServer::StartServer(){
|
||||
//delete socket(via exit server)
|
||||
if(mySocket){
|
||||
delete mySocket;
|
||||
mySocket = NULL;
|
||||
mySocket = 0;
|
||||
}
|
||||
|
||||
if(!gui_server_thread_running)
|
||||
|
@ -233,7 +233,7 @@ void qTabAdvanced::SetupWidgetWindow(){
|
||||
spinSubExpTime->setValue(time);
|
||||
comboSubExpTimeUnit->setCurrentIndex((int)unit);
|
||||
//period
|
||||
time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::SUBFRAME_PERIOD,-1)*(1E-9))));
|
||||
time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::SUBFRAME_DEADTIME,-1)*(1E-9))));
|
||||
spinSubPeriod->setValue(time);
|
||||
comboSubPeriodUnit->setCurrentIndex((int)unit);
|
||||
|
||||
@ -1342,13 +1342,13 @@ void qTabAdvanced::SetSubPeriod() {
|
||||
"/" << spinSubPeriod->value() <<
|
||||
qDefs::getUnitString((qDefs::timeUnit)comboSubPeriodUnit->currentIndex()) << endl;
|
||||
#endif
|
||||
myDet->setTimer(slsDetectorDefs::SUBFRAME_PERIOD,(int64_t)timeNS);
|
||||
myDet->setTimer(slsDetectorDefs::SUBFRAME_DEADTIME,(int64_t)timeNS);
|
||||
qDefs::checkErrorMessage(myDet,"qTabAdvanced::SetSubPeriod");
|
||||
|
||||
// update value in gui
|
||||
qDefs::timeUnit unit;
|
||||
double time = qDefs::getCorrectTime(unit,((double)(
|
||||
myDet->setTimer(slsDetectorDefs::SUBFRAME_PERIOD,-1)*(1E-9))));
|
||||
myDet->setTimer(slsDetectorDefs::SUBFRAME_DEADTIME,-1)*(1E-9))));
|
||||
spinSubPeriod->setValue(time);
|
||||
comboSubPeriodUnit->setCurrentIndex((int)unit);
|
||||
|
||||
@ -1605,7 +1605,7 @@ void qTabAdvanced::Refresh(){
|
||||
comboSubExpTimeUnit->setCurrentIndex((int)unit);
|
||||
|
||||
// subperiod
|
||||
time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::SUBFRAME_PERIOD,-1)*(1E-9))));
|
||||
time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::SUBFRAME_DEADTIME,-1)*(1E-9))));
|
||||
spinSubPeriod->setValue(time);
|
||||
comboSubPeriodUnit->setCurrentIndex((int)unit);
|
||||
|
||||
|
@ -59,7 +59,6 @@ set(PUBLICHEADERS
|
||||
commonFiles/sls_detector_defs.h
|
||||
commonFiles/sls_detector_funcs.h
|
||||
commonFiles/error_defs.h
|
||||
commonFiles/sls_detector_exceptions.h
|
||||
commonFiles/versionAPI.h
|
||||
sharedMemory/SharedMemory.h
|
||||
slsDetector/slsDetectorUtils.h
|
||||
@ -78,7 +77,7 @@ set(PUBLICHEADERS
|
||||
slsDetectorAnalysis/fileIOStatic.h
|
||||
multiSlsDetector/multiSlsDetector.h
|
||||
slsReceiverInterface/receiverInterface.h
|
||||
|
||||
../slsReceiverSoftware/include/sls_receiver_exceptions.h
|
||||
)
|
||||
set_target_properties(slsDetectorShared PROPERTIES
|
||||
LIBRARY_OUTPUT_NAME SlsDetector
|
||||
|
@ -17,7 +17,7 @@ LIBZMQDIR = ../slsReceiverSoftware/include
|
||||
LIBZMQ = -L$(LIBZMQDIR) -Wl,-rpath=$(LIBZMQDIR) -lzmq
|
||||
|
||||
SRC_CLNT=slsDetectorAnalysis/fileIO.cpp usersFunctions/usersFunctions.cpp slsDetector/slsDetectorUtils.cpp slsDetector/slsDetectorCommand.cpp slsDetectorAnalysis/angularConversion.cpp slsDetectorAnalysis/angularConversionStatic.cpp slsDetectorAnalysis/energyConversion.cpp slsDetector/slsDetectorActions.cpp slsDetectorAnalysis/postProcessing.cpp slsDetector/slsDetector.cpp multiSlsDetector/multiSlsDetector.cpp slsDetectorAnalysis/postProcessingFuncs.cpp slsReceiverInterface/receiverInterface.cpp slsDetector/slsDetectorUsers.cpp threadFiles/CondVar.cpp threadFiles/Mutex.cpp threadFiles/ThreadPool.cpp sharedMemory/SharedMemory.cpp #../slsReceiverSoftware/MySocketTCP/MySocketTCP.cpp
|
||||
DEPSINCLUDES = $(LIBZMQDIR)/sls_receiver_defs.h $(LIBZMQDIR)/sls_receiver_funcs.h $(LIBZMQDIR)/ansi.h commonFiles/sls_detector_defs.h commonFiles/sls_detector_funcs.h commonFiles/error_defs.h slsDetector/slsDetectorBase.h slsDetectorAnalysis/angCalLogClass.h slsDetectorAnalysis/angleConversionConstant.h slsDetectorAnalysis/badChannelCorrections.h slsDetectorAnalysis/detectorData.h slsDetectorAnalysis/enCalLogClass.h slsDetectorAnalysis/fileIOStatic.h slsDetectorAnalysis/movingStat.h slsDetectorAnalysis/runningStat.h slsDetectorAnalysis/single_photon_hit.h threadFiles/Global.h threadFiles/Task.h usersFunctions/angleFunction.h sharedMemory/SharedMemory.h commonFiles/sls_detector_exceptions.h commonFiles/versionAPI.h
|
||||
DEPSINCLUDES = $(LIBZMQDIR)/sls_receiver_defs.h $(LIBZMQDIR)/sls_receiver_funcs.h $(LIBZMQDIR)/ansi.h commonFiles/sls_detector_defs.h commonFiles/sls_detector_funcs.h commonFiles/error_defs.h slsDetector/slsDetectorBase.h slsDetectorAnalysis/angCalLogClass.h slsDetectorAnalysis/angleConversionConstant.h slsDetectorAnalysis/badChannelCorrections.h slsDetectorAnalysis/detectorData.h slsDetectorAnalysis/enCalLogClass.h slsDetectorAnalysis/fileIOStatic.h slsDetectorAnalysis/movingStat.h slsDetectorAnalysis/runningStat.h slsDetectorAnalysis/single_photon_hit.h threadFiles/Global.h threadFiles/Task.h usersFunctions/angleFunction.h sharedMemory/SharedMemory.h $(LIBZMQDIR)/sls_receiver_exceptions.h commonFiles/versionAPI.h
|
||||
|
||||
|
||||
|
||||
|
@ -146,19 +146,6 @@ typedef struct {
|
||||
} sls_detector_module;
|
||||
|
||||
|
||||
/**
|
||||
@short structure for a region of interest
|
||||
|
||||
xmin,xmax,ymin,ymax define the limits of the region
|
||||
*/
|
||||
typedef struct {
|
||||
int xmin; /**< is the roi xmin (in channel number) */
|
||||
int xmax; /**< is the roi xmax (in channel number)*/
|
||||
int ymin; /**< is the roi ymin (in channel number)*/
|
||||
int ymax; /**< is the roi ymax (in channel number)*/
|
||||
} ROI ;
|
||||
|
||||
|
||||
/* /\* */
|
||||
/* @short structure for a generic integer array */
|
||||
/* *\/ */
|
||||
|
@ -1,25 +0,0 @@
|
||||
#pragma once
|
||||
/************************************************
|
||||
* @file sls_detector_exceptions.h
|
||||
* @short exceptions defined
|
||||
***********************************************/
|
||||
/**
|
||||
*@short exceptions defined
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
using namespace std;
|
||||
|
||||
|
||||
struct SharedMemoryException : public exception {
|
||||
public:
|
||||
SharedMemoryException() {}
|
||||
string GetMessage() const { return "Shared Memory Failed";};
|
||||
};
|
||||
|
||||
struct ThreadpoolException : public exception {
|
||||
public:
|
||||
ThreadpoolException() {}
|
||||
string GetMessage() const { return "Threadpool Failed";};
|
||||
};
|
@ -121,6 +121,8 @@ enum detFuncs{
|
||||
F_STORAGE_CELL_START, /** < storage cell start */
|
||||
|
||||
F_CHECK_VERSION, /** < check version compatibility */
|
||||
|
||||
F_SOFTWARE_TRIGGER, /** < software trigger */
|
||||
/* Always append functions hereafter!!! */
|
||||
|
||||
/* Always append functions before!!! */
|
||||
|
@ -1,5 +1,6 @@
|
||||
/** API versions */
|
||||
#define APIRECEIVER 0x180517
|
||||
#define APIEIGER 0x180528
|
||||
#define APIJUNGFRAU 0x180628
|
||||
#define APIGOTTHARD 0x180529
|
||||
#define APIRECEIVER 0x180927
|
||||
#define APIEIGER 0x180820
|
||||
#define APIJUNGFRAU 0x180925
|
||||
#define APIGOTTHARD 0x180928
|
||||
|
||||
|
@ -1215,8 +1215,10 @@ void Beb_SetDetectorNumber(uint32_t detid) {
|
||||
int Beb_SetDetectorPosition(int pos[]) {
|
||||
if(!Beb_activated)
|
||||
return OK;
|
||||
cprintf(BLUE,"Got Position values %d %d %d...\n", pos[0],pos[1], pos[2]);
|
||||
|
||||
pos[1] = Beb_swap_uint16(pos[1]);
|
||||
pos[0] = Beb_swap_uint16(pos[0]);
|
||||
//pos[1] = Beb_swap_uint16(pos[1]);
|
||||
pos[2] = Beb_swap_uint16(pos[2]);
|
||||
|
||||
int ret = FAIL;
|
||||
@ -1231,37 +1233,37 @@ int Beb_SetDetectorPosition(int pos[]) {
|
||||
uint32_t value = 0;
|
||||
ret = OK;
|
||||
// x left
|
||||
int posval = Beb_swap_uint16((Beb_top ? pos[0] : (pos[0]+1)));
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_A_RIGHT_OFST);
|
||||
value &= UDP_HEADER_ID_MSK; // to keep previous id value
|
||||
Beb_Write32(csp0base, UDP_HEADER_A_LEFT_OFST, value | ((posval << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK));
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_A_LEFT_OFST);
|
||||
if((value & UDP_HEADER_X_MSK) != ((posval << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK))
|
||||
value &= UDP_HEADER_ID_MSK; // to keep previous id value
|
||||
Beb_Write32(csp0base, UDP_HEADER_A_LEFT_OFST, value | ((pos[0] << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK));
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_A_LEFT_OFST);
|
||||
if((value & UDP_HEADER_X_MSK) != ((pos[0] << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK))
|
||||
ret = FAIL;
|
||||
|
||||
// x right
|
||||
posval = Beb_swap_uint16((Beb_top ? (pos[0]+1) : pos[0]));
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_A_LEFT_OFST);
|
||||
value &= UDP_HEADER_ID_MSK; // to keep previous id value
|
||||
Beb_Write32(csp0base, UDP_HEADER_A_RIGHT_OFST, value | ((posval << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK));
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_A_RIGHT_OFST);
|
||||
if((value & UDP_HEADER_X_MSK) != ((posval << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK))
|
||||
value &= UDP_HEADER_ID_MSK; // to keep previous id value
|
||||
Beb_Write32(csp0base, UDP_HEADER_A_RIGHT_OFST, value | ((pos[0] << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK));
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_A_RIGHT_OFST);
|
||||
if((value & UDP_HEADER_X_MSK) != ((pos[0] << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK))
|
||||
ret = FAIL;
|
||||
|
||||
|
||||
|
||||
// y left
|
||||
// y left (column)
|
||||
// overwriting z anyway, so no need to look at previous z value
|
||||
Beb_Write32(csp0base, UDP_HEADER_B_LEFT_OFST, ((pos[1] << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK));
|
||||
int posval = Beb_swap_uint16(Beb_top ? pos[1] : (pos[1]+1));
|
||||
Beb_Write32(csp0base, UDP_HEADER_B_LEFT_OFST, ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK));
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_B_LEFT_OFST);
|
||||
if(value != ((pos[1] << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK))
|
||||
if(value != ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK))
|
||||
ret = FAIL;
|
||||
|
||||
// y right
|
||||
// overwriting z anyway, so no need to look at previous z value
|
||||
Beb_Write32(csp0base, UDP_HEADER_B_RIGHT_OFST, ((pos[1] << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK));
|
||||
posval = Beb_swap_uint16(Beb_top ? (pos[1]+1) : pos[1]);
|
||||
Beb_Write32(csp0base, UDP_HEADER_B_RIGHT_OFST, ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK));
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_B_RIGHT_OFST);
|
||||
if(value != ((pos[1] << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK))
|
||||
if(value != ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK))
|
||||
ret = FAIL;
|
||||
|
||||
|
||||
@ -1290,8 +1292,8 @@ int Beb_SetDetectorPosition(int pos[]) {
|
||||
cprintf(BLUE, "Position set to...\n"
|
||||
"Left: [%d, %d, %d]\n"
|
||||
"Right:[%d, %d, %d]\n",
|
||||
(Beb_top ? pos[0] : (pos[0]+1)), Beb_swap_uint16(pos[1]), Beb_swap_uint16(pos[2]),
|
||||
(Beb_top ? (pos[0]+1) : pos[0]), Beb_swap_uint16(pos[1]), Beb_swap_uint16(pos[2]));
|
||||
Beb_swap_uint16(pos[0]), Beb_top ? pos[1] : (pos[1]+1), Beb_swap_uint16(pos[2]),
|
||||
Beb_swap_uint16(pos[0]), Beb_top ? (pos[1]+1) : pos[1], Beb_swap_uint16(pos[2]));
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -37,6 +37,7 @@ unsigned int Feb_Control_acquireNReadoutMode; //safe or parallel, half or full s
|
||||
unsigned int Feb_Control_triggerMode; //internal timer, external start, external window, signal polarity (external trigger and enable)
|
||||
unsigned int Feb_Control_externalEnableMode; //external enabling engaged and it's polarity
|
||||
unsigned int Feb_Control_subFrameMode;
|
||||
unsigned int Feb_Control_softwareTrigger;
|
||||
|
||||
|
||||
unsigned int Feb_Control_nimages;
|
||||
@ -1958,6 +1959,56 @@ int Feb_Control_GetRightFPGATemp(){
|
||||
return (int)temperature;
|
||||
}
|
||||
|
||||
int64_t Feb_Control_GetMeasuredPeriod() {
|
||||
unsigned int sub_num = (Module_TopAddressIsValid(&modules[1])) ?
|
||||
Module_GetTopLeftAddress (&modules[1]):
|
||||
Module_GetBottomLeftAddress (&modules[1]);
|
||||
|
||||
unsigned int value = 0;
|
||||
Feb_Interface_ReadRegister(sub_num,MEAS_PERIOD_REG, &value);
|
||||
return value*10;
|
||||
}
|
||||
|
||||
int64_t Feb_Control_GetSubMeasuredPeriod() {
|
||||
unsigned int sub_num = (Module_TopAddressIsValid(&modules[1])) ?
|
||||
Module_GetTopLeftAddress (&modules[1]):
|
||||
Module_GetBottomLeftAddress (&modules[1]);
|
||||
|
||||
unsigned int value = 0;
|
||||
Feb_Interface_ReadRegister(sub_num,MEAS_SUBPERIOD_REG, &value);
|
||||
return value*10;
|
||||
}
|
||||
|
||||
|
||||
int Feb_Control_SoftwareTrigger() {
|
||||
unsigned int orig_value = 0;
|
||||
Feb_Interface_ReadRegister(Feb_Control_AddressToAll(),DAQ_REG_CHIP_CMDS, &orig_value);
|
||||
|
||||
unsigned int cmd = orig_value | DAQ_REG_CHIP_CMDS_INT_TRIGGER;
|
||||
|
||||
if(Feb_Control_activated) {
|
||||
// set trigger bit
|
||||
#ifdef VERBOSE
|
||||
cprintf(BLUE,"Setting Trigger, Register:0x%x\n",cmd);
|
||||
#endif
|
||||
if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),DAQ_REG_CHIP_CMDS,cmd,0,0)) {
|
||||
cprintf(RED,"Warning: Could not give software trigger\n");
|
||||
return 0;
|
||||
}
|
||||
// unset trigger bit
|
||||
#ifdef VERBOSE
|
||||
cprintf(BLUE,"Unsetting Trigger, Register:0x%x\n",orig_value);
|
||||
#endif
|
||||
if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),DAQ_REG_CHIP_CMDS,orig_value,0,0)) {
|
||||
cprintf(RED,"Warning: Could not give software trigger\n");
|
||||
return 0;
|
||||
}
|
||||
cprintf(BLUE,"Software Internal Trigger Sent!\n");
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
uint32_t Feb_Control_WriteRegister(uint32_t offset, uint32_t data) {
|
||||
uint32_t value=0;
|
||||
|
@ -200,6 +200,11 @@ int Feb_Control_GetModuleNumber();
|
||||
int Feb_Control_GetLeftFPGATemp();
|
||||
int Feb_Control_GetRightFPGATemp();
|
||||
|
||||
int64_t Feb_Control_GetMeasuredPeriod();
|
||||
int64_t Feb_Control_GetSubMeasuredPeriod();
|
||||
|
||||
int Feb_Control_SoftwareTrigger();
|
||||
|
||||
uint32_t Feb_Control_WriteRegister(uint32_t offset, uint32_t data);
|
||||
uint32_t Feb_Control_ReadRegister(uint32_t offset);
|
||||
#endif
|
||||
|
@ -22,10 +22,10 @@
|
||||
|
||||
|
||||
#define DAQ_REG_RO_OFFSET 12
|
||||
#define DAQ_REG_STATUS (0 + DAQ_REG_RO_OFFSET) //also pg and fifo status register
|
||||
//temp so far
|
||||
#define FEB_REG_STATUS (3 + DAQ_REG_RO_OFFSET)
|
||||
|
||||
#define DAQ_REG_STATUS (DAQ_REG_RO_OFFSET + 0) //also pg and fifo status register
|
||||
#define FEB_REG_STATUS (DAQ_REG_RO_OFFSET + 3)
|
||||
#define MEAS_SUBPERIOD_REG (DAQ_REG_RO_OFFSET + 4)
|
||||
#define MEAS_PERIOD_REG (DAQ_REG_RO_OFFSET + 5)
|
||||
|
||||
|
||||
|
||||
@ -64,7 +64,8 @@
|
||||
#define DAQ_CHIP_CONTROLLER_QUARTER_SPEED 0x00080000 //everything at 50 MHz (25MHz ddr readout)
|
||||
#define DAQ_CHIP_CONTROLLER_SUPER_SLOW_SPEED 0x000c0000 //everything at ~200 kHz (200 kHz MHz ddr readout)
|
||||
|
||||
#define DAQ_FIFO_ENABLE 0x00100000
|
||||
//#define DAQ_FIFO_ENABLE 0x00100000 commented out as it is not used anywhere
|
||||
#define DAQ_REG_CHIP_CMDS_INT_TRIGGER 0x00100000
|
||||
|
||||
//direct chip commands to the DAQ_REG_CHIP_CMDS register
|
||||
#define DAQ_NEXPOSURERS_SAFEST_MODE_ROW_CLK_BEFORE_MODE 0x00200000 //row clk is before main clk readout sequence
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: 3b6ead77836f2b6d2a795a9a994259d1dc8c131d
|
||||
Revision: 343
|
||||
Repsitory UUID: c52025dd7c4b44b93e64353a22997d971996ab18
|
||||
Revision: 350
|
||||
Branch: developer
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 3943
|
||||
Last Changed Date: 2018-07-17 16:15:43.000000002 +0200 ./Makefile.virtual
|
||||
Last Changed Author: Gemma_Tinti
|
||||
Last Changed Rev: 3999
|
||||
Last Changed Date: 2018-09-28 14:11:53.000000002 +0200 ./Makefile.virtual
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "3b6ead77836f2b6d2a795a9a994259d1dc8c131d"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x3943
|
||||
#define GITDATE 0x20180717
|
||||
#define GITREPUUID "c52025dd7c4b44b93e64353a22997d971996ab18"
|
||||
#define GITAUTH "Gemma_Tinti"
|
||||
#define GITREV 0x3999
|
||||
#define GITDATE 0x20180928
|
||||
#define GITBRANCH "developer"
|
||||
|
@ -458,7 +458,7 @@ void setupDetector() {
|
||||
setTimer(FRAME_NUMBER, DEFAULT_NUM_FRAMES);
|
||||
setTimer(ACQUISITION_TIME, DEFAULT_EXPTIME);
|
||||
setTimer(SUBFRAME_ACQUISITION_TIME, DEFAULT_SUBFRAME_EXPOSURE);
|
||||
setTimer(SUBFRAME_PERIOD, DEFAULT_SUBFRAME_PERIOD);
|
||||
setTimer(SUBFRAME_DEADTIME, DEFAULT_SUBFRAME_DEADTIME);
|
||||
setTimer(FRAME_PERIOD, DEFAULT_PERIOD);
|
||||
setTimer(CYCLES_NUMBER, DEFAULT_NUM_CYCLES);
|
||||
setDynamicRange(DEFAULT_DYNAMIC_RANGE);
|
||||
@ -657,6 +657,10 @@ enum readOutFlags setReadOutFlags(enum readOutFlags val){
|
||||
/* parameters - timer */
|
||||
|
||||
int64_t setTimer(enum timerIndex ind, int64_t val){
|
||||
#ifndef VIRTUAL
|
||||
int64_t subdeadtime = 0;
|
||||
#endif
|
||||
int64_t subexptime = 0;
|
||||
switch(ind){
|
||||
case FRAME_NUMBER:
|
||||
if(val >= 0){
|
||||
@ -694,11 +698,20 @@ int64_t setTimer(enum timerIndex ind, int64_t val){
|
||||
|
||||
case SUBFRAME_ACQUISITION_TIME:
|
||||
if(val >= 0){
|
||||
printf(" Setting sub exp time: %lldns\n",(long long int)val/10);
|
||||
printf(" Setting sub exp time: %lldns\n",(long long int)val);
|
||||
#ifndef VIRTUAL
|
||||
// calculate subdeadtime before settings subexptime
|
||||
subdeadtime = Feb_Control_GetSubFramePeriod() -
|
||||
Feb_Control_GetSubFrameExposureTime();
|
||||
|
||||
Feb_Control_SetSubFrameExposureTime(val/10);
|
||||
// set subperiod
|
||||
Feb_Control_SetSubFramePeriod((val+subdeadtime)/10);
|
||||
#else
|
||||
int64_t subdeadtime = eiger_virtual_subperiod*10 -
|
||||
eiger_virtual_subexptime*10;
|
||||
eiger_virtual_subexptime = (val/(10));
|
||||
eiger_virtual_subperiod = (val+subdeadtime/10);
|
||||
#endif
|
||||
}
|
||||
#ifndef VIRTUAL
|
||||
@ -707,19 +720,30 @@ int64_t setTimer(enum timerIndex ind, int64_t val){
|
||||
return eiger_virtual_subexptime*10;
|
||||
#endif
|
||||
|
||||
case SUBFRAME_PERIOD:
|
||||
case SUBFRAME_DEADTIME:
|
||||
#ifndef VIRTUAL
|
||||
// get subexptime
|
||||
subexptime = Feb_Control_GetSubFrameExposureTime();
|
||||
#else
|
||||
subexptime = eiger_virtual_subexptime*10;
|
||||
#endif
|
||||
if(val >= 0){
|
||||
printf(" Setting sub period: %lldns\n",(long long int)val/10);
|
||||
printf(" Setting sub period: %lldns = subexptime(%lld) + subdeadtime(%lld)\n",
|
||||
(long long int)(val + subexptime),
|
||||
(long long int)subexptime,
|
||||
(long long int)val);
|
||||
//calculate subperiod
|
||||
val += subexptime;
|
||||
#ifndef VIRTUAL
|
||||
Feb_Control_SetSubFramePeriod(val/10);
|
||||
#else
|
||||
eiger_virtual_subperiod = (val/(1E9));
|
||||
eiger_virtual_subperiod = (val/10);
|
||||
#endif
|
||||
}
|
||||
#ifndef VIRTUAL
|
||||
return (Feb_Control_GetSubFramePeriod());
|
||||
return (Feb_Control_GetSubFramePeriod() - subexptime);
|
||||
#else
|
||||
return eiger_virtual_subperiod*1e9;
|
||||
return (eiger_virtual_subperiod*10 - subexptime);
|
||||
#endif
|
||||
|
||||
case FRAME_PERIOD:
|
||||
@ -764,6 +788,21 @@ int64_t setTimer(enum timerIndex ind, int64_t val){
|
||||
}
|
||||
|
||||
|
||||
int64_t getTimeLeft(enum timerIndex ind) {
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
#else
|
||||
switch(ind){
|
||||
case MEASURED_PERIOD: return Feb_Control_GetMeasuredPeriod();
|
||||
case MEASURED_SUBPERIOD: return Feb_Control_GetSubMeasuredPeriod();
|
||||
return 0;
|
||||
default:
|
||||
cprintf(RED,"This timer left index (%d) not defined for Eiger\n",ind);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1579,6 +1618,16 @@ int stopStateMachine(){
|
||||
#endif
|
||||
}
|
||||
|
||||
int softwareTrigger() {
|
||||
#ifdef VIRTUAL
|
||||
return OK;
|
||||
#else
|
||||
if (!Feb_Control_SoftwareTrigger())
|
||||
return FAIL;
|
||||
return OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int startReadOut(){
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#define GOODBYE (-200)
|
||||
#define REQUIRED_FIRMWARE_VERSION (21)
|
||||
#define REQUIRED_FIRMWARE_VERSION (22)
|
||||
#define IDFILECOMMAND "more /home/root/executables/detid.txt"
|
||||
|
||||
#define STATUS_IDLE 0
|
||||
@ -74,7 +74,7 @@ enum NETWORKINDEX {TXN_LEFT, TXN_RIGHT, TXN_FRAME,FLOWCTRL_10G};
|
||||
#define DEFAULT_HIGH_VOLTAGE (0)
|
||||
#define DEFAULT_SETTINGS (DYNAMICGAIN)
|
||||
#define DEFAULT_SUBFRAME_EXPOSURE (2621440) // 2.6ms
|
||||
#define DEFAULT_SUBFRAME_PERIOD (0)
|
||||
#define DEFAULT_SUBFRAME_DEADTIME (0)
|
||||
#define DEFAULT_DYNAMIC_RANGE (16)
|
||||
|
||||
#define DEFAULT_READOUT_MODE (NONPARALLEL)
|
||||
|
@ -1,9 +1,18 @@
|
||||
Path: slsDetectorsPackage/slsDetectorSoftware
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
<<<<<<< HEAD
|
||||
Repsitory UUID: 83600fcb15c8261173ab15a8ba8d1009693f2d23
|
||||
Revision: 2005
|
||||
Branch: anna
|
||||
Last Changed Author: Anna_Bergamaschi
|
||||
Last Changed Rev: 3962
|
||||
Last Changed Date: 2018-09-11 16:29:59.000000002 +0200 ./slsDetector/slsDetector.o
|
||||
=======
|
||||
Repsitory UUID: d2bce7e372c241cd235977b92be18555bca6a77d
|
||||
Revision: 2040
|
||||
Branch: 4.0.0
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 4020
|
||||
Last Changed Date: 2018-09-27 18:22:10.000000002 +0200 ./sharedMemory/SharedMemory.o
|
||||
>>>>>>> developer
|
||||
|
@ -16,7 +16,7 @@ INSTMODE= 0777
|
||||
|
||||
|
||||
BINS = testlib_sharedlibc
|
||||
SRCS = server.c firmware_funcs.c server_funcs.c communication_funcs.c mcb_funcs.c trimming_funcs.c sharedmemory.c
|
||||
SRCS = server.c firmware_funcs.c server_funcs.c communication_funcs.c mcb_funcs.c
|
||||
OBJS = $(SRCS:%.c=%.o)
|
||||
|
||||
|
||||
@ -31,6 +31,7 @@ versioning:
|
||||
$(PROGS): $(OBJS)
|
||||
# echo $(OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS_$@) $(LDFLAGS_$@)
|
||||
rm gotthardDetectorServer.gdb
|
||||
|
||||
|
||||
install: $(PROGS)
|
||||
|
@ -16,7 +16,7 @@ INSTMODE= 0777
|
||||
|
||||
|
||||
BINS = testlib_sharedlibc
|
||||
SRCS = server.c server_funcs.c communication_funcs.c firmware_funcs.c mcb_funcs.c trimming_funcs.c sharedmemory.c
|
||||
SRCS = server.c server_funcs.c communication_funcs.c firmware_funcs.c mcb_funcs.c
|
||||
OBJS = $(SRCS:%.c=%.o)
|
||||
|
||||
|
||||
|
@ -8,7 +8,7 @@ CFLAGS += -Wall -DGOTTHARDD -DMCB_FUNCS -DDACS_INT -DDEBUG -DVIRTUAL
|
||||
PROGS= $(DESTDIR)/gotthardDetectorServer_virtual
|
||||
|
||||
|
||||
SRCS = server.c server_funcs.c communication_funcs.c firmware_funcs.c mcb_funcs.c trimming_funcs.c sharedmemory.c
|
||||
SRCS = server.c server_funcs.c communication_funcs.c firmware_funcs.c mcb_funcs.c
|
||||
OBJS = $(SRCS:%.c=%.o)
|
||||
|
||||
gotthardVirtualServer = $(PROGS)
|
||||
|
@ -4,10 +4,6 @@
|
||||
#include "mcb_funcs.h"
|
||||
#include "registers_g.h"
|
||||
|
||||
#ifdef SHAREDMEMORY
|
||||
#include "sharedmemory.h"
|
||||
#endif
|
||||
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
#include <sys/stat.h>
|
||||
@ -34,9 +30,7 @@ int dataBytes=NMAXMOD*NCHIP*NCHAN*2;
|
||||
int storeInRAM=0;
|
||||
int ROI_flag=0;
|
||||
int adcConfigured=-1;
|
||||
u_int32_t *ram_values=NULL;
|
||||
volatile char *now_ptr=NULL;
|
||||
volatile u_int16_t *values;
|
||||
|
||||
int ram_size=0;
|
||||
|
||||
int64_t totalTime=1;
|
||||
@ -64,6 +58,8 @@ int slaveadcphase = 0;
|
||||
int rsttosw1delay = 2;
|
||||
int startacqdelay = 1;
|
||||
|
||||
int detectorFirstServer = 1;
|
||||
|
||||
|
||||
#ifdef MCB_FUNCS
|
||||
extern const int nChans;
|
||||
@ -187,9 +183,6 @@ int mapCSP0(void) {
|
||||
printf("CSPObase is 0x%llx \n",CSP0BASE);
|
||||
printf("CSPOBASE=from %llx to %llx\n",CSP0BASE,CSP0BASE+MEM_SIZE);
|
||||
|
||||
u_int32_t address;
|
||||
address = FIFO_DATA_REG_OFF;
|
||||
values=(u_int16_t*)(CSP0BASE+address*2);
|
||||
printf("statusreg=%08x\n",bus_r(STATUS_REG));
|
||||
printf("\n\n");
|
||||
return OK;
|
||||
@ -273,12 +266,20 @@ void setMasterSlaveConfiguration(){
|
||||
}
|
||||
else {
|
||||
cprintf(RED,"could not scan masterflags %s value from config file\n",value);
|
||||
fclose(fd);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (!detectorFirstServer) {
|
||||
cprintf(BLUE, "Server has been started up before. Ignoring rest of config file\n");
|
||||
fclose(fd);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(sscanf(value,"%d",&ival)<=0) {
|
||||
cprintf(RED,"could not scan patternphase %s value from config file\n",value);
|
||||
fclose(fd);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@ -298,6 +299,7 @@ void setMasterSlaveConfiguration(){
|
||||
startacqdelay = ival;
|
||||
else {
|
||||
cprintf(RED,"could not scan parameter name %s from config file\n",key);
|
||||
fclose(fd);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
@ -384,6 +386,7 @@ int setPhaseShiftOnce(){
|
||||
//bus_w(addr,0x0); //clear the reg
|
||||
|
||||
if(reg==0){
|
||||
detectorFirstServer = 1;
|
||||
printf("\nImplementing phase shift of %d\n",phase_shift);
|
||||
for (i=1;i<phase_shift;i++) {
|
||||
bus_w(addr,(INT_RSTN_BIT|ENET_RESETN_BIT|SW1_BIT|PHASE_STEP_BIT));//0x2821
|
||||
@ -392,7 +395,7 @@ int setPhaseShiftOnce(){
|
||||
#ifdef VERBOSE
|
||||
printf("Multipupose reg now:%x\n",bus_r(addr));
|
||||
#endif
|
||||
}
|
||||
} else detectorFirstServer = 0;
|
||||
|
||||
return OK;
|
||||
}
|
||||
@ -839,18 +842,6 @@ u_int32_t testFpga(void) {
|
||||
}
|
||||
|
||||
|
||||
// for fpga test
|
||||
u_int32_t testRAM(void) {
|
||||
int result=OK;
|
||||
int i=0;
|
||||
allocateRAM();
|
||||
// while(i<100000) {
|
||||
memcpy((char*)ram_values, (char*)values, dataBytes);
|
||||
printf ("Testing RAM:\t%d: copied fifo %x to memory %x size %d\n",i++, (unsigned int)(values), (unsigned int)(ram_values), dataBytes);
|
||||
// }
|
||||
return result;
|
||||
}
|
||||
|
||||
int getNModBoard() {
|
||||
return nModX;
|
||||
}
|
||||
@ -1261,7 +1252,6 @@ int setADC(int adc){
|
||||
|
||||
int configureMAC(int ipad,long long int macad,long long int detectormacad, int detipad, int ival, int udpport){
|
||||
|
||||
|
||||
#ifdef DDEBUG
|
||||
printf("Chip of Intrst Reg:%x\n",bus_r(CHIP_OF_INTRST_REG));
|
||||
printf("IP Packet Size:%d\n",ipPacketSize);
|
||||
@ -1492,11 +1482,7 @@ int startStateMachine(){
|
||||
//#endif
|
||||
cleanFifo();
|
||||
// fifoReset();
|
||||
now_ptr=(char*)ram_values;
|
||||
#ifdef SHAREDMEMORY
|
||||
write_stop_sm(0);
|
||||
write_status_sm("Started");
|
||||
#endif
|
||||
|
||||
bus_w16(CONTROL_REG, START_ACQ_BIT | START_EXPOSURE_BIT);
|
||||
bus_w16(CONTROL_REG, 0x0);
|
||||
printf("statusreg=%08x\n",bus_r(STATUS_REG));
|
||||
@ -1572,31 +1558,12 @@ u_int32_t fifo_full(void)
|
||||
}
|
||||
|
||||
|
||||
u_int32_t* fifo_read_event()
|
||||
{
|
||||
#ifdef VIRTUAL
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("before looping\n");
|
||||
#endif
|
||||
volatile u_int32_t t = bus_r(LOOK_AT_ME_REG);
|
||||
|
||||
void waitForAcquisitionFinish(){
|
||||
volatile u_int32_t t = bus_r(LOOK_AT_ME_REG);
|
||||
#ifdef VERBOSE
|
||||
printf("lookatmereg=x%x\n",t);
|
||||
#endif
|
||||
/*
|
||||
while ((t&0x1)==0)
|
||||
{
|
||||
t = bus_r(LOOK_AT_ME_REG);
|
||||
if (!runBusy()){
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
while((t&0x1)==0) {
|
||||
while((t&0x1)==0) {
|
||||
if (runBusy()==0) {
|
||||
t = bus_r(LOOK_AT_ME_REG);
|
||||
if ((t&0x1)==0) {
|
||||
@ -1604,7 +1571,7 @@ u_int32_t* fifo_read_event()
|
||||
printf("no frame found - exiting ");
|
||||
printf("%08x %08x\n", runState(), bus_r(LOOK_AT_ME_REG));
|
||||
#endif
|
||||
return NULL;
|
||||
return;
|
||||
} else {
|
||||
#ifdef VERBOSE
|
||||
printf("no frame found %x status %x\n", bus_r(LOOK_AT_ME_REG),runState());
|
||||
@ -1613,38 +1580,12 @@ u_int32_t* fifo_read_event()
|
||||
}
|
||||
}
|
||||
t = bus_r(LOOK_AT_ME_REG);
|
||||
}
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("before readout %08x %08x\n", runState(), bus_r(LOOK_AT_ME_REG));
|
||||
#endif
|
||||
|
||||
dma_memcpy(now_ptr,values ,dataBytes);
|
||||
|
||||
|
||||
#ifdef VERYVERBOSE
|
||||
int a;
|
||||
for (a=0;a<8; a=a+2)
|
||||
printf("\n%d %d: x%04x x%04x ",a+1,a,*(now_ptr+a+1),*(now_ptr+a) );
|
||||
for (a=2554;a<2560; a=a+2)
|
||||
printf("\n%d %d: x%04x x%04x ",a+1,a,*(now_ptr+a+1),*(now_ptr+a) );
|
||||
printf("********\n");
|
||||
//memcpy(now_ptr, values, dataBytes);
|
||||
#endif
|
||||
#ifdef VERBOSE
|
||||
printf("Copying to ptr %08x %d\n",(unsigned int)(now_ptr), dataBytes);
|
||||
printf("after readout %08x %08x\n", runState(), bus_r(LOOK_AT_ME_REG));
|
||||
#endif
|
||||
|
||||
if (storeInRAM>0) {
|
||||
now_ptr+=dataBytes;
|
||||
}
|
||||
return ram_values;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
u_int32_t* decode_data(int *datain)
|
||||
{
|
||||
u_int32_t *dataout;
|
||||
@ -1759,83 +1700,10 @@ int testBus() {
|
||||
|
||||
|
||||
int setStoreInRAM(int b) {
|
||||
if (b>0)
|
||||
storeInRAM=1;
|
||||
else
|
||||
storeInRAM=0;
|
||||
return allocateRAM();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int allocateRAM() {
|
||||
size_t size;
|
||||
u_int32_t nt, nf;
|
||||
nt=setTrains(-1);
|
||||
nf=setFrames(-1);
|
||||
if (nt==0) nt=1;
|
||||
if (nf==0) nf=1;
|
||||
// ret=clearRAM();
|
||||
if (storeInRAM) {
|
||||
size=dataBytes*nf*nt;
|
||||
if (size<dataBytes)
|
||||
size=dataBytes;
|
||||
} else
|
||||
size=dataBytes;
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("\nnmodx=%d nmody=%d dynamicRange=%d dataBytes=%d nFrames=%d nTrains=%d, size=%d\n",nModX,nModY,dynamicRange,dataBytes,nf,nt,(int)size );
|
||||
#endif
|
||||
|
||||
if (size==ram_size) {
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("RAM of size %d already allocated: nothing to be done\n",(int) size);
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("reallocating ram %x\n",(unsigned int)ram_values);
|
||||
#endif
|
||||
// clearRAM();
|
||||
// ram_values=malloc(size);
|
||||
//+2 was added since dma_memcpy would switch the 16 bit values and the mem is 32 bit
|
||||
ram_values=realloc(ram_values,size)+2;
|
||||
|
||||
if (ram_values) {
|
||||
now_ptr=(char*)ram_values;
|
||||
#ifdef VERBOSE
|
||||
printf("ram allocated 0x%x of size %d to %x\n",(int)now_ptr,(unsigned int) size,(unsigned int)(now_ptr+size));
|
||||
#endif
|
||||
ram_size=size;
|
||||
return OK;
|
||||
} else {
|
||||
printf("could not allocate %d bytes\n",(int)size);
|
||||
if (storeInRAM==1) {
|
||||
printf("retrying\n");
|
||||
storeInRAM=0;
|
||||
size=dataBytes;
|
||||
ram_values=realloc(ram_values,size)+2;
|
||||
if (ram_values==NULL)
|
||||
printf("Fatal error: there must be a memory leak somewhere! You can't allocate even one frame!\n");
|
||||
else {
|
||||
now_ptr=(char*)ram_values;
|
||||
ram_size=size;
|
||||
#ifdef VERBOSE
|
||||
printf("ram allocated 0x%x of size %d to %x\n",(int)now_ptr,(unsigned int) size,(unsigned int)(now_ptr+size));
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
printf("Fatal error: there must be a memory leak somewhere! You can't allocate even one frame!\n");
|
||||
}
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
int configureADC(){
|
||||
@ -1857,7 +1725,7 @@ int configureADC(){
|
||||
|
||||
|
||||
// start point
|
||||
valw=0xff;
|
||||
valw=0xffffffff;
|
||||
bus_w(ADC_SPI_REG,(valw));
|
||||
|
||||
//chip sel bar down
|
||||
@ -1868,102 +1736,38 @@ int configureADC(){
|
||||
//cldwn
|
||||
valw=valw&(~(0x1<<cdx));
|
||||
bus_w(ADC_SPI_REG,valw);
|
||||
usleep(0);
|
||||
//usleep(0);
|
||||
|
||||
//write data (i)
|
||||
valw=(valw&(~(0x1<<ddx)))+(((codata>>(23-i))&0x1)<<ddx);
|
||||
bus_w(ADC_SPI_REG,valw);
|
||||
usleep(0);
|
||||
//usleep(0);
|
||||
|
||||
//clkup
|
||||
valw=valw+(0x1<<cdx);
|
||||
bus_w(ADC_SPI_REG,valw);
|
||||
usleep(0);
|
||||
//usleep(0);
|
||||
}
|
||||
|
||||
valw |= csmask;
|
||||
bus_w(ADC_SPI_REG,valw);
|
||||
//usleep(0);
|
||||
|
||||
// stop point =start point
|
||||
valw=valw&(~(0x1<<cdx));
|
||||
usleep(0);
|
||||
valw=0xff;
|
||||
bus_w(ADC_SPI_REG,(valw));
|
||||
|
||||
valw = 0xffffffff;
|
||||
bus_w(ADC_SPI_REG,(valw));
|
||||
|
||||
//usleep in between
|
||||
usleep(50000);
|
||||
}
|
||||
|
||||
return OK;
|
||||
|
||||
/*
|
||||
codata=0;
|
||||
codata=(0x14<<8)+(0x0); //command and value;
|
||||
valw=0xff; bus_w(ADC_SPI_REG,(valw)); // start point
|
||||
valw=((0xffffffff&(~csmask)));bus_w(ADC_SPI_REG,valw); //chip sel bar down
|
||||
for (i=0;i<24;i++) {
|
||||
valw=valw&(~(0x1<<cdx));bus_w(ADC_SPI_REG,valw);usleep(0); //cldwn
|
||||
|
||||
valw=(valw&(~(0x1<<ddx)))+(((codata>>(23-i))&0x1)<<ddx); bus_w(ADC_SPI_REG,valw); usleep(0); //write data (i)
|
||||
|
||||
valw=valw+(0x1<<cdx);bus_w(ADC_SPI_REG,valw); usleep(0); //clkup
|
||||
|
||||
}
|
||||
|
||||
valw=valw&(~(0x1<<cdx));usleep(0);
|
||||
valw=0xff; bus_w(ADC_SPI_REG,(valw)); // stop point =start point
|
||||
|
||||
|
||||
|
||||
usleep(5000);
|
||||
|
||||
codata=0;
|
||||
codata=(0x08<<8)+(0x3); //command and value;Power modes(global) reset
|
||||
valw=0xff; bus_w(ADC_SPI_REG,(valw)); // start point
|
||||
valw=((0xffffffff&(~csmask)));bus_w(ADC_SPI_REG,valw); //chip sel bar down
|
||||
for (i=0;i<24;i++) {
|
||||
valw=valw&(~(0x1<<cdx));bus_w(ADC_SPI_REG,valw);usleep(0); //cldwn
|
||||
|
||||
valw=(valw&(~(0x1<<ddx)))+(((codata>>(23-i))&0x1)<<ddx); bus_w(ADC_SPI_REG,valw); usleep(0); //write data (i)
|
||||
valw=valw+(0x1<<cdx);bus_w(ADC_SPI_REG,valw); usleep(0); //clkup
|
||||
|
||||
}
|
||||
|
||||
valw=valw&(~(0x1<<cdx));usleep(0);
|
||||
valw=0xff; bus_w(ADC_SPI_REG,(valw)); // stop point =start point
|
||||
|
||||
|
||||
|
||||
usleep(50000);
|
||||
codata=0;
|
||||
codata=(0x08<<8)+(0x0); //command and value;Power modes(global) reset
|
||||
valw=0xff; bus_w(ADC_SPI_REG,(valw)); // start point
|
||||
valw=((0xffffffff&(~csmask)));bus_w(ADC_SPI_REG,valw); //chip sel bar down
|
||||
for (i=0;i<24;i++) {
|
||||
valw=valw&(~(0x1<<cdx));bus_w(ADC_SPI_REG,valw);usleep(0); //cldwn
|
||||
|
||||
valw=(valw&(~(0x1<<ddx)))+(((codata>>(23-i))&0x1)<<ddx); bus_w(ADC_SPI_REG,valw); usleep(0); //write data (i)
|
||||
valw=valw+(0x1<<cdx);bus_w(ADC_SPI_REG,valw); usleep(0); //clkup
|
||||
|
||||
}
|
||||
|
||||
valw=valw&(~(0x1<<cdx));usleep(0);
|
||||
valw=0xff; bus_w(ADC_SPI_REG,(valw)); // stop point =start point
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
int clearRAM() {
|
||||
if (ram_values) {
|
||||
//#ifdef VERBOSE
|
||||
//printf("clearing RAM 0x%x\n", ram_values);
|
||||
//#endif
|
||||
free(ram_values);
|
||||
ram_values=NULL;
|
||||
now_ptr=NULL;
|
||||
}
|
||||
//#ifdef VERBOSE
|
||||
//printf("done 0x%x\n", ram_values);
|
||||
//#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2111,113 +1915,7 @@ int resetCounterBlock(int startACQ){
|
||||
|
||||
|
||||
int calibratePedestal(int frames){
|
||||
printf("---------------------------\n");
|
||||
printf("In Calibrate Pedestal\n");
|
||||
int64_t framesBefore = getFrames();
|
||||
int64_t periodBefore = getPeriod();
|
||||
setFrames(frames);
|
||||
setPeriod(1000000);
|
||||
int dataret = OK;
|
||||
|
||||
double avg[1280];
|
||||
int numberFrames = 0;
|
||||
|
||||
int adc = 3;
|
||||
int adcCh = 3;
|
||||
int Ch = 3;
|
||||
|
||||
|
||||
int i = 0;
|
||||
for(i =0; i < 1280; i++){
|
||||
|
||||
avg[i] = 0.0;
|
||||
}
|
||||
|
||||
startReceiver(0);
|
||||
|
||||
startStateMachine();
|
||||
|
||||
while(dataret==OK){
|
||||
//got data
|
||||
if (fifo_read_event()) {
|
||||
dataret=OK;
|
||||
//sendDataOnly(file_des,&dataret,sizeof(dataret));
|
||||
//sendDataOnly(file_des,dataretval,dataBytes);
|
||||
printf("received frame\n");
|
||||
|
||||
unsigned short *frame = (unsigned short *)now_ptr;
|
||||
|
||||
int a;
|
||||
for (a=0;a<1280; a++){
|
||||
//unsigned short v = (frame[a] << 8) + (frame[a] >> 8);
|
||||
// printf("%i: %i %i\n",a, frame[a],v);
|
||||
avg[a] += ((double)frame[a])/(double)frames;
|
||||
//if(frame[a] == 8191)
|
||||
// printf("ch %i: %u\n",a,frame[a]);
|
||||
}
|
||||
// printf("********\n");
|
||||
numberFrames++;
|
||||
}
|
||||
|
||||
//no more data or no data
|
||||
else {
|
||||
if(getFrames()>-2) {
|
||||
dataret=FAIL;
|
||||
printf("no data and run stopped: %d frames left\n",(int)(getFrames()+2));
|
||||
|
||||
} else {
|
||||
dataret=FINISHED;
|
||||
printf("acquisition successfully finished\n");
|
||||
|
||||
}
|
||||
printf("dataret %d\n",dataret);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//double nf = (double)numberFrames;
|
||||
for(i =0; i < 1280; i++){
|
||||
adc = i / 256;
|
||||
adcCh = (i - adc * 256) / 32;
|
||||
Ch = i - adc * 256 - adcCh * 32;
|
||||
adc--;
|
||||
double v2 = avg[i];
|
||||
avg[i] = avg[i]/ ((double)numberFrames/(double)frames);
|
||||
unsigned short v = (unsigned short)avg[i];
|
||||
printf("setting avg for channel %i(%i,%i,%i): %i (double= %f (%f))\t", i,adc,adcCh,Ch, v,avg[i],v2);
|
||||
v=i*100;
|
||||
ram_w16(DARK_IMAGE_REG,adc,adcCh,Ch,v-4096);
|
||||
if(ram_r16(DARK_IMAGE_REG,adc,adcCh,Ch) != v-4096){
|
||||
printf("value is wrong (%i,%i,%i): %i \n",adc,adcCh,Ch, ram_r16(DARK_IMAGE_REG,adc,adcCh,Ch));
|
||||
}
|
||||
}
|
||||
|
||||
/*for(adc = 1; adc < 5; adc++){
|
||||
for(adcCh = 0; adcCh < 8; adcCh++){
|
||||
for(Ch=0 ; Ch < 32; Ch++){
|
||||
int channel = (adc+1) * 32 * 8 + adcCh * 32 + Ch;
|
||||
double v2 = avg[channel];
|
||||
avg[channel] = avg[channel]/ ((double)numberFrames/(double)frames);
|
||||
unsigned short v = (unsigned short)avg[channel];
|
||||
printf("setting avg for channel %i: %i (double= %f (%f))\t", channel, v,avg[channel],v2);
|
||||
ram_w16(DARK_IMAGE_REG,adc,adcCh,Ch,v-4096);
|
||||
if(ram_r16(DARK_IMAGE_REG,adc,adcCh,Ch) != v-4096){
|
||||
printf("value is wrong (%i,%i,%i): %i \n",adc,adcCh,Ch, ram_r16(DARK_IMAGE_REG,adc,adcCh,Ch));
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
printf("frames: %i\n",numberFrames);
|
||||
printf("corrected avg by: %f\n",(double)numberFrames/(double)frames);
|
||||
|
||||
printf("restoring previous condition\n");
|
||||
setFrames(framesBefore);
|
||||
setPeriod(periodBefore);
|
||||
|
||||
// removed this functionlity as it requires reading via cpu
|
||||
printf("---------------------------\n");
|
||||
return 0;
|
||||
}
|
||||
|
@ -77,7 +77,6 @@ u_int32_t getFirmwareVersion();
|
||||
u_int32_t getFirmwareSVNVersion();
|
||||
int testFifos(void);
|
||||
u_int32_t testFpga(void);
|
||||
u_int32_t testRAM(void);
|
||||
int testBus(void);
|
||||
int setDigitalTestBit(int ival);
|
||||
|
||||
@ -128,8 +127,8 @@ u_int32_t fifoReadStatus();
|
||||
u_int32_t fifo_full(void);
|
||||
|
||||
|
||||
void waitForAcquisitionFinish();
|
||||
|
||||
u_int32_t* fifo_read_event();
|
||||
u_int32_t* decode_data(int* datain);
|
||||
//u_int32_t move_data(u_int64_t* datain, u_int64_t* dataout);
|
||||
int setDynamicRange(int dr);
|
||||
@ -137,8 +136,7 @@ int getDynamicRange();
|
||||
int getNModBoard();
|
||||
int setNMod(int n);
|
||||
int setStoreInRAM(int b);
|
||||
int allocateRAM();
|
||||
int clearRAM();
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsDetectorSoftware/gotthardDetectorServer
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: 711e0d771edb48e77fa23d965f026add268a31ee
|
||||
Revision: 235
|
||||
Branch: 3.3.0-rc
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 3944
|
||||
Last Changed Date: 2018-07-26 13:38:23.000000002 +0200 ./server_defs.h
|
||||
Repsitory UUID: c52025dd7c4b44b93e64353a22997d971996ab18
|
||||
Revision: 237
|
||||
Branch: developer
|
||||
Last Changed Author: Gemma_Tinti
|
||||
Last Changed Rev: 3999
|
||||
Last Changed Date: 2018-09-28 16:10:41.000000002 +0200 ./server_funcs.c
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "711e0d771edb48e77fa23d965f026add268a31ee"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x3944
|
||||
#define GITDATE 0x20180726
|
||||
#define GITBRANCH "3.3.0-rc"
|
||||
#define GITREPUUID "c52025dd7c4b44b93e64353a22997d971996ab18"
|
||||
#define GITAUTH "Gemma_Tinti"
|
||||
#define GITREV 0x3999
|
||||
#define GITDATE 0x20180928
|
||||
#define GITBRANCH "developer"
|
||||
|
Binary file not shown.
Binary file not shown.
BIN
slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServerv4.0.0.3
Executable file
BIN
slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServerv4.0.0.3
Executable file
Binary file not shown.
@ -107,7 +107,6 @@ int initDetector() {
|
||||
// initChip(0, 0,ALLMOD);
|
||||
//nModX=n;
|
||||
//
|
||||
allocateRAM();
|
||||
|
||||
|
||||
return OK;
|
||||
@ -1831,205 +1830,19 @@ int testDataInOut(int num, int imod) {
|
||||
|
||||
|
||||
int testExtPulse(int imod) {
|
||||
int i, ichan, ichip, result=OK;
|
||||
int *val1;
|
||||
|
||||
printf("Testing counter for module %d\n", imod);
|
||||
|
||||
setCSregister(ALLMOD);
|
||||
setSSregister(ALLMOD);
|
||||
counterClear(ALLMOD);
|
||||
putout("0000000000000000",ALLMOD);
|
||||
putout("0000100000000000",ALLMOD);
|
||||
putout("0000000000000000",ALLMOD);
|
||||
for (i=0; i<NCHAN; i++) {
|
||||
putout("0000000000000000",ALLMOD);
|
||||
putout("0000000000001000",ALLMOD);
|
||||
putout("0000000000000000",ALLMOD);
|
||||
extPulse(1,ALLMOD);
|
||||
}
|
||||
clearSSregister(ALLMOD);
|
||||
putout("0000000000000000",ALLMOD);
|
||||
|
||||
|
||||
// Readout with SM
|
||||
|
||||
//startStateMachine();
|
||||
startReadOut();
|
||||
usleep(100);
|
||||
val1=(int*)(decode_data((int*)(fifo_read_event())));
|
||||
// val1=fifo_read_event();
|
||||
//imod=0;
|
||||
//for (imod=0; imod<nModX; imod++) {
|
||||
for (ichip=0; ichip<NCHIP; ichip++) {
|
||||
for (ichan=0; ichan<NCHAN; ichan++) {//
|
||||
if ((*(val1+ichan+(ichip+imod*NCHIP)*NCHAN))!=ichan) {
|
||||
result++;
|
||||
printf("Counter test: channel %d read %d instead of %d\n",ichan+(ichip+imod*NCHIP)*NCHAN, val1[ichan+(ichip+imod*NCHIP)*NCHAN], ichan);
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
free(val1);
|
||||
if (result)
|
||||
return 1;
|
||||
else
|
||||
// reading via cPU doesnt work, so removed this functionality
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int testExtPulseMux(int imod, int ow) {
|
||||
|
||||
int i, ichan, ichip, result=0, ind, chipr=0;
|
||||
int *values, *v1;
|
||||
int vright,v;
|
||||
int nbit_mask=0xffffff;
|
||||
|
||||
printf("Testing counter for module %d, mux %d\n", imod, ow);
|
||||
setExposureTime(0);
|
||||
setFrames(1);
|
||||
setTrains(1);
|
||||
|
||||
|
||||
if (ow==2)
|
||||
nbit_mask=0xffff;
|
||||
else if (ow==3)
|
||||
nbit_mask=0xff;
|
||||
else if (ow==4)
|
||||
nbit_mask=0xf;
|
||||
else if (ow==5)
|
||||
nbit_mask=0x1;
|
||||
|
||||
|
||||
|
||||
setCSregister(ALLMOD);
|
||||
setSSregister(ALLMOD);
|
||||
counterClear(ALLMOD);
|
||||
initChipWithProbes(0, ow,0,ALLMOD);
|
||||
// initChip(0, ow,ALLMOD);
|
||||
for (ichip=0; ichip<NCHIP; ichip++) {
|
||||
setSSregister(ALLMOD);
|
||||
for (i=0; i<NCHAN; i++) {
|
||||
putout("0000000000000000",ALLMOD);
|
||||
putout("0000000000001000",ALLMOD);
|
||||
putout("0000000000000000",ALLMOD);
|
||||
extPulse(1,ALLMOD);
|
||||
}
|
||||
nextChip(ALLMOD);
|
||||
}
|
||||
setCSregister(ALLMOD);
|
||||
clearSSregister(ALLMOD);
|
||||
putout("0000000000000000",ALLMOD);
|
||||
|
||||
// Readout with SM
|
||||
|
||||
|
||||
startReadOut();
|
||||
usleep(100);
|
||||
v1=(int*)(fifo_read_event());
|
||||
if (v1)
|
||||
values=(int*)(decode_data(v1));
|
||||
else {
|
||||
printf("no data found in fifos\n");
|
||||
return 1;
|
||||
}
|
||||
for (ichip=0; ichip<NCHIP; ichip++) {
|
||||
chipr=0;
|
||||
for (ichan=0; ichan<NCHAN; ichan++) {
|
||||
ind=ichan+(ichip+imod*NCHIP)*NCHAN;
|
||||
v=values[ind];
|
||||
vright=(ichan*(ichip+1))&nbit_mask;
|
||||
if (v!=vright) {
|
||||
result++;
|
||||
chipr++;
|
||||
printf("Counter test mux %d mode: channel %d chip %d read %d instead of %d\n",ow, ichan+(ichip+imod*NCHIP)*NCHAN, ichip, v, vright);
|
||||
//break;
|
||||
}
|
||||
//printf("\n");
|
||||
}
|
||||
if (chipr)
|
||||
printf("Test Counter module %d chip%d mux %d: %d errors\n", imod,ichip, ow,chipr);
|
||||
}
|
||||
free(values);
|
||||
if (result)
|
||||
printf("Test Counter module %d mux %d: %d errors\n", imod,ow,result);
|
||||
|
||||
if (result)
|
||||
return 1;
|
||||
else
|
||||
// reading via cPU doesnt work, so removed this functionality
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int testDataInOutMux(int imod, int ow, int num) {
|
||||
|
||||
int ichan, ichip, result=0, chipr=0, ind;
|
||||
int vright,v;
|
||||
int nbit_mask=0xffffff;
|
||||
int *values, *v1;
|
||||
|
||||
printf("Testing data inout for module %d, mux %d, pattern 0x%x\n", imod, ow, num);
|
||||
setExposureTime(0);
|
||||
setFrames(1);
|
||||
setTrains(1);
|
||||
|
||||
|
||||
if (ow==2)
|
||||
nbit_mask=0xffff;
|
||||
else if (ow==3)
|
||||
nbit_mask=0xff;
|
||||
else if (ow==4)
|
||||
nbit_mask=0xf;
|
||||
else if (ow==5)
|
||||
nbit_mask=0x1;
|
||||
|
||||
vright=num&nbit_mask;
|
||||
|
||||
setCSregister(ALLMOD);
|
||||
//printf("Testin data in out\n");
|
||||
setSSregister(ALLMOD);
|
||||
counterClear(ALLMOD);
|
||||
initChannel(0,0,0,0,0,num,ALLMOD);
|
||||
putout("0000000000000000",ALLMOD);
|
||||
clearSSregister(ALLMOD);
|
||||
initChipWithProbes(0, ow,0,ALLMOD);
|
||||
clearSSregister(ALLMOD);
|
||||
putout("0000000000000000",ALLMOD);
|
||||
|
||||
// Readout with SM
|
||||
|
||||
printf("mux %d\n",ow);
|
||||
startReadOut();
|
||||
usleep(100);
|
||||
v1=(int*)(fifo_read_event());
|
||||
if (v1)
|
||||
values=(int*)(decode_data(v1));
|
||||
else {
|
||||
printf("no data found in fifos\n");
|
||||
return 1;
|
||||
}
|
||||
for (ichip=0; ichip<NCHIP; ichip++) {
|
||||
chipr=0;
|
||||
for (ichan=0; ichan<NCHAN; ichan++) {
|
||||
ind=ichan+(ichip+imod*NCHIP)*NCHAN;
|
||||
v=values[ind];
|
||||
if (v!=vright) {
|
||||
result++;
|
||||
chipr++;
|
||||
printf("DataInOut test mux %d mode: channel %d chip %d read %d instead of %d\n",ow, ichan+(ichip+imod*NCHIP)*NCHAN, ichip, v, vright);
|
||||
//break;
|
||||
}
|
||||
//printf("\n");
|
||||
}
|
||||
if (chipr)
|
||||
printf("Test DatInOut module %d chip %d mux %d: %d errors\n", imod,ichip, ow,chipr);
|
||||
}
|
||||
if (result)
|
||||
printf("Test DatInOut module %d mux %d: %d errors\n", imod,ow,result);
|
||||
free(values);
|
||||
if (result)
|
||||
return 1;
|
||||
else
|
||||
// reading via cPU doesnt work, so removed this functionality
|
||||
return 0;
|
||||
|
||||
}
|
||||
@ -2486,7 +2299,7 @@ ROI* setROI(int n, ROI arg[], int *retvalsize, int *ret){
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("\tGoing to enable adc: %d\n", adc);
|
||||
|
||||
//set rois for just 1 adc - take only 1st roi
|
||||
if(adc!=-1){
|
||||
@ -2495,10 +2308,14 @@ ROI* setROI(int n, ROI arg[], int *retvalsize, int *ret){
|
||||
rois[0].ymin=-1;
|
||||
rois[0].ymax=-1;
|
||||
nROI = 1;
|
||||
printf("\tActual xmin:%d xmax:%d\n",rois[0].xmin,rois[0].xmax);
|
||||
}else
|
||||
nROI = 0;
|
||||
|
||||
if((arg[0].xmin!=rois[0].xmin)||(arg[0].xmax!=rois[0].xmax)||(arg[0].ymin!=rois[0].ymin)||(arg[0].ymax!=rois[0].ymax))
|
||||
if((n!=0) && ((arg[0].xmin!=rois[0].xmin)||
|
||||
(arg[0].xmax!=rois[0].xmax)||
|
||||
(arg[0].ymin!=rois[0].ymin)||
|
||||
(arg[0].ymax!=rois[0].ymax)))
|
||||
*ret=FAIL;
|
||||
if(n!=nROI)
|
||||
*ret=FAIL;
|
||||
@ -2508,9 +2325,11 @@ ROI* setROI(int n, ROI arg[], int *retvalsize, int *ret){
|
||||
}
|
||||
|
||||
//#ifdef VERBOSE
|
||||
printf("Rois:\n");
|
||||
for( i=0;i<nROI;i++)
|
||||
printf("%d\t%d\t%d\t%d\n",rois[i].xmin,rois[i].xmax,rois[i].ymin,rois[i].ymax);
|
||||
if (nROI) {
|
||||
printf("Rois:\n");
|
||||
for( i=0;i<nROI;i++)
|
||||
printf("\t%d\t%d\t%d\t%d\n\n",rois[i].xmin,rois[i].xmax,rois[i].ymin,rois[i].ymax);
|
||||
}else printf("Rois: 0\n\n");
|
||||
//#endif
|
||||
*retvalsize = nROI;
|
||||
return rois;
|
||||
|
@ -47,8 +47,8 @@
|
||||
#define DEFAULT_PHASE_SHIFT 120
|
||||
#define DEFAULT_IP_PACKETSIZE 0x0522
|
||||
#define DEFAULT_UDP_PACKETSIZE 0x050E
|
||||
#define ADC1_IP_PACKETSIZE 256*2+14+20
|
||||
#define ADC1_UDP_PACKETSIZE 256*2+4+8+2
|
||||
#define ADC1_IP_PACKETSIZE (256*2+14+20)
|
||||
#define ADC1_UDP_PACKETSIZE (256*2+4+8+2)
|
||||
|
||||
#ifdef VIRTUAL
|
||||
#define DEBUGOUT
|
||||
|
@ -7,7 +7,6 @@
|
||||
#endif
|
||||
#include "firmware_funcs.h"
|
||||
#include "mcb_funcs.h"
|
||||
#include "trimming_funcs.h"
|
||||
#include "registers_g.h"
|
||||
#include "gitInfoGotthard.h"
|
||||
#include "AD9257.h" // include "commonServerFunctions.h"
|
||||
@ -82,11 +81,11 @@ int init_detector( int b) {
|
||||
printf("Initializing Detector\n");
|
||||
#endif
|
||||
testFpga();
|
||||
testRAM();
|
||||
|
||||
//gotthard specific
|
||||
setPhaseShiftOnce();
|
||||
configureADC();
|
||||
|
||||
setADC(-1); //already does setdaqreg and clean fifo
|
||||
setSettings(DYNAMICGAIN,-1);
|
||||
setDefaultDacs();
|
||||
@ -101,7 +100,7 @@ int init_detector( int b) {
|
||||
setTiming(GET_EXTERNAL_COMMUNICATION_MODE);
|
||||
setMaster(GET_MASTER);
|
||||
setSynchronization(GET_SYNCHRONIZATION_MODE);
|
||||
startReceiver(0);
|
||||
startReceiver(1);
|
||||
setMasterSlaveConfiguration();
|
||||
}
|
||||
strcpy(mess,"dummy message");
|
||||
@ -709,9 +708,9 @@ int digital_test(int file_des) {
|
||||
case DETECTOR_FIRMWARE_TEST:
|
||||
retval=testFpga();
|
||||
break;
|
||||
case DETECTOR_MEMORY_TEST:
|
||||
/*case DETECTOR_MEMORY_TEST:
|
||||
ret=testRAM();
|
||||
break;
|
||||
break;*/
|
||||
case DETECTOR_BUS_TEST:
|
||||
retval=testBus();
|
||||
break;
|
||||
@ -1918,93 +1917,44 @@ int get_run_status(int file_des) {
|
||||
}
|
||||
|
||||
int read_frame(int file_des) {
|
||||
dataret = FAIL;
|
||||
strcpy(mess,"wait for read frame failed\n");
|
||||
|
||||
if (differentClients==1 && lockStatus==1) {
|
||||
dataret=FAIL;
|
||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||
sendDataOnly(file_des,&dataret,sizeof(dataret));
|
||||
sendDataOnly(file_des,mess,sizeof(mess));
|
||||
#ifdef VERBOSE
|
||||
printf("dataret %d\n",dataret);
|
||||
#endif
|
||||
return dataret;
|
||||
if (differentClients==1 && lockStatus==1) {
|
||||
dataret=FAIL;
|
||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||
cprintf(RED,"%s\n",mess);
|
||||
sendDataOnly(file_des,&dataret,sizeof(dataret));
|
||||
sendDataOnly(file_des,mess,sizeof(mess));
|
||||
return dataret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (storeInRAM==0) {
|
||||
if ((dataretval=(char*)fifo_read_event())) {
|
||||
dataret=OK;
|
||||
#ifdef VERYVERBOSE
|
||||
printf("Sending ptr %x %d\n",(unsigned int)(dataretval), dataBytes);
|
||||
|
||||
#ifdef VIRTUAL
|
||||
dataret = FINISHED;
|
||||
strcpy(mess,"acquisition successfully finished\n");
|
||||
#else
|
||||
waitForAcquisitionFinish();
|
||||
|
||||
// set return value and message
|
||||
if(getFrames()>-2) {
|
||||
dataret = FAIL;
|
||||
sprintf(mess,"no data and run stopped: %d frames left\n",(int)(getFrames()+2));
|
||||
cprintf(RED,"%s\n",mess);
|
||||
} else {
|
||||
dataret = FINISHED;
|
||||
sprintf(mess,"acquisition successfully finished\n");
|
||||
cprintf(GREEN,"%s",mess);
|
||||
|
||||
}
|
||||
#endif
|
||||
sendDataOnly(file_des,&dataret,sizeof(dataret));
|
||||
sendDataOnly(file_des,dataretval,dataBytes);
|
||||
#ifdef VERBOSE
|
||||
printf("sent %d bytes \n",dataBytes);
|
||||
printf("dataret OK\n");
|
||||
#endif
|
||||
return OK;
|
||||
} else {
|
||||
//might add delay????
|
||||
if(getFrames()>-2) {
|
||||
dataret=FAIL;
|
||||
sprintf(mess,"no data and run stopped: %d frames left\n",(int)(getFrames()+2));
|
||||
printf("%s\n",mess);
|
||||
} else {
|
||||
dataret=FINISHED;
|
||||
sprintf(mess,"acquisition successfully finished\n");
|
||||
printf("%s\n",mess);
|
||||
}
|
||||
#ifdef VERYVERBOSE
|
||||
printf("%d %d %x %s\n",(int)(sizeof(mess)),(int)(strlen(mess)),(unsigned int)( mess),mess);
|
||||
#endif
|
||||
sendDataOnly(file_des,&dataret,sizeof(dataret));
|
||||
sendDataOnly(file_des,mess,sizeof(mess));
|
||||
#ifdef VERYVERBOSE
|
||||
printf("message sent %s\n",mess);
|
||||
#endif
|
||||
printf("dataret %d\n",dataret);
|
||||
return dataret;
|
||||
}
|
||||
} else {
|
||||
nframes=0;
|
||||
while(fifo_read_event()) {
|
||||
nframes++;
|
||||
}
|
||||
dataretval=(char*)ram_values;
|
||||
dataret=OK;
|
||||
#ifdef VERBOSE
|
||||
printf("sending data of %d frames\n",nframes);
|
||||
#endif
|
||||
for (iframes=0; iframes<nframes; iframes++) {
|
||||
sendDataOnly(file_des,&dataret,sizeof(dataret));
|
||||
#ifdef VERYVERBOSE
|
||||
printf("sending pointer %x of size %d\n",(unsigned int)(dataretval),dataBytes);
|
||||
#endif
|
||||
sendDataOnly(file_des,dataretval,dataBytes);
|
||||
dataretval+=dataBytes;
|
||||
}
|
||||
if (getFrames()>-2) {
|
||||
dataret=FAIL;
|
||||
sprintf(mess,"no data and run stopped: %d frames left\n",(int)(getFrames()+2));
|
||||
printf("%s\n",mess);
|
||||
} else {
|
||||
dataret=FINISHED;
|
||||
sprintf(mess,"acquisition successfully finished\n");
|
||||
printf("%s\n",mess);
|
||||
if (differentClients)
|
||||
dataret=FORCE_UPDATE;
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
printf("Frames left %d\n",(int)(getFrames()));
|
||||
#endif
|
||||
sendDataOnly(file_des,&dataret,sizeof(dataret));
|
||||
sendDataOnly(file_des,mess,sizeof(mess));
|
||||
printf("dataret %d\n",dataret);
|
||||
return dataret;
|
||||
}
|
||||
printf("dataret %d\n",dataret);
|
||||
return dataret;
|
||||
|
||||
if (differentClients)
|
||||
dataret=FORCE_UPDATE;
|
||||
|
||||
sendDataOnly(file_des,&dataret,sizeof(dataret));
|
||||
sendDataOnly(file_des,mess,sizeof(mess));
|
||||
return dataret;
|
||||
}
|
||||
|
||||
|
||||
@ -2096,9 +2046,9 @@ int set_timer(int file_des) {
|
||||
printf(mess);
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
//#ifdef VERBOSE
|
||||
printf("setting timer %d to %lld ns\n",ind,tns);
|
||||
#endif
|
||||
//#endif
|
||||
if (ret==OK) {
|
||||
|
||||
if (differentClients==1 && lockStatus==1 && tns!=-1) {
|
||||
@ -2149,10 +2099,6 @@ int set_timer(int file_des) {
|
||||
if (ret!=OK) {
|
||||
printf(mess);
|
||||
printf("set timer failed\n");
|
||||
} else if (ind==FRAME_NUMBER) {
|
||||
ret=allocateRAM();
|
||||
if (ret!=OK)
|
||||
sprintf(mess, "could not allocate RAM for %lld frames\n", tns);
|
||||
}
|
||||
|
||||
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||
@ -2293,12 +2239,6 @@ int set_dynamic_range(int file_des) {
|
||||
//if (dr>=0 && retval!=dr) ret=FAIL;
|
||||
if (ret!=OK) {
|
||||
sprintf(mess,"set dynamic range failed\n");
|
||||
} else {
|
||||
ret=allocateRAM();
|
||||
if (ret!=OK)
|
||||
sprintf(mess,"Could not allocate RAM for the dynamic range selected\n");
|
||||
else if (differentClients)
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||
@ -2341,9 +2281,9 @@ int set_roi(int file_des) {
|
||||
ret=FAIL;
|
||||
}
|
||||
//#ifdef VERBOSE
|
||||
printf("Setting ROI to:");
|
||||
printf("\n\nSetting ROI: nroi=%d\n",nroi);
|
||||
for( i=0;i<nroi;i++)
|
||||
printf("%d\t%d\t%d\t%d\n",arg[i].xmin,arg[i].xmax,arg[i].ymin,arg[i].ymax);
|
||||
printf("\t%d\t%d\t%d\t%d\n",arg[i].xmin,arg[i].xmax,arg[i].ymin,arg[i].ymax);
|
||||
//#endif
|
||||
}
|
||||
/* execute action if the arguments correctly arrived*/
|
||||
|
@ -1,39 +0,0 @@
|
||||
#include "sharedmemory.h"
|
||||
|
||||
struct statusdata *stdata;
|
||||
|
||||
int inism(int clsv) {
|
||||
|
||||
static int scansmid;
|
||||
|
||||
if (clsv==SMSV) {
|
||||
if ( (scansmid=shmget(SMKEY,1024,IPC_CREAT | 0666 ))==-1 ) {
|
||||
return -1;
|
||||
}
|
||||
if ( (stdata=shmat(scansmid,NULL,0))==(void*)-1) {
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
if (clsv==SMCL) {
|
||||
if ( (scansmid=shmget(SMKEY,0,0) )==-1 ) {
|
||||
return -3;
|
||||
}
|
||||
if ( (stdata=shmat(scansmid,NULL,0))==(void*)-1) {
|
||||
return -4;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void write_status_sm(char *status) {
|
||||
strcpy(stdata->status,status);
|
||||
}
|
||||
|
||||
void write_stop_sm(int v) {
|
||||
stdata->stop=v;
|
||||
}
|
||||
|
||||
void write_runnumber_sm(int v) {
|
||||
stdata->runnumber=v;
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
#ifndef SM
|
||||
#define SM
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
//#include <asm/page.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#include <sys/shm.h>
|
||||
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
/* key for shared memory */
|
||||
#define SMKEY 10001
|
||||
|
||||
#define SMSV 1
|
||||
#define SMCL 2
|
||||
|
||||
|
||||
struct statusdata {
|
||||
int runnumber;
|
||||
int stop;
|
||||
char status[20];
|
||||
} ;
|
||||
|
||||
|
||||
/* for shared memory */
|
||||
|
||||
int inism(int clsv);
|
||||
void write_status_sm(char *status);
|
||||
void write_stop_sm(int v);
|
||||
void write_runnumber_sm(int v);
|
||||
|
||||
#endif
|
@ -1,749 +0,0 @@
|
||||
#ifndef PICASSOD
|
||||
#include "server_defs.h"
|
||||
#else
|
||||
#include "picasso_defs.h"
|
||||
#endif
|
||||
#include "trimming_funcs.h"
|
||||
#include "mcb_funcs.h"
|
||||
#include "firmware_funcs.h"
|
||||
#include <math.h>
|
||||
|
||||
|
||||
|
||||
extern int nModX;
|
||||
//extern int *values;
|
||||
|
||||
extern const int nChans;
|
||||
extern const int nChips;
|
||||
extern const int nDacs;
|
||||
extern const int nAdcs;
|
||||
|
||||
|
||||
int trim_fixed_settings(int countlim, int par2, int im)
|
||||
{
|
||||
|
||||
int retval=OK;
|
||||
#ifdef VERBOSE
|
||||
printf("Trimming with fixed settings\n");
|
||||
#endif
|
||||
#ifdef VIRTUAL
|
||||
return OK;
|
||||
#endif
|
||||
|
||||
if (par2<=0)
|
||||
retval=trim_with_level(countlim, im);
|
||||
else
|
||||
retval=trim_with_median(countlim,im);
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
int trim_with_noise(int countlim, int nsigma, int im)
|
||||
{
|
||||
|
||||
|
||||
int retval=OK, retval1=OK, retval2=OK;
|
||||
#ifdef VERBOSE
|
||||
printf("Trimming using noise\n");
|
||||
#endif
|
||||
#ifdef VIRTUAL
|
||||
return OK;
|
||||
#endif
|
||||
|
||||
/* threshold scan */
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("chosing vthresh and vtrim.....");
|
||||
#endif
|
||||
retval1=choose_vthresh_and_vtrim(countlim,nsigma, im);
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("trimming with noise.....\n");
|
||||
#endif
|
||||
retval2=trim_with_level(countlim, im);
|
||||
|
||||
#ifdef DEBUGOUT
|
||||
printf("done\n");
|
||||
#endif
|
||||
if (retval1==OK && retval2==OK)
|
||||
retval=OK;
|
||||
else
|
||||
retval=FAIL;
|
||||
|
||||
return retval;
|
||||
|
||||
}
|
||||
|
||||
int trim_with_beam(int countlim, int nsigma, int im) //rpc
|
||||
{
|
||||
|
||||
|
||||
int retval=OK, retval1=OK, retval2=OK;
|
||||
|
||||
printf("Trimming using beam\n");
|
||||
//return OK;
|
||||
#ifdef VIRTUAL
|
||||
printf("Trimming using beam\n");
|
||||
return OK;
|
||||
#endif
|
||||
/* threshold scan */
|
||||
#ifdef DEBUGOUT
|
||||
printf("chosing vthresh and vtrim.....");
|
||||
#endif
|
||||
|
||||
retval1=choose_vthresh_and_vtrim(countlim,nsigma,im);
|
||||
retval2=trim_with_median(TRIM_DR, im);
|
||||
|
||||
#ifdef DEBUGOUT
|
||||
printf("done\n");
|
||||
#endif
|
||||
|
||||
if (retval1==OK && retval2==OK)
|
||||
retval=OK;
|
||||
else
|
||||
retval=FAIL;
|
||||
|
||||
return retval;
|
||||
|
||||
}
|
||||
|
||||
|
||||
int trim_improve(int maxit, int par2, int im) //rpc
|
||||
{
|
||||
|
||||
int retval=OK, retval1=OK, retval2=OK;
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("Improve the trimming\n");
|
||||
#endif
|
||||
#ifdef VIRTUAL
|
||||
return OK;
|
||||
#endif
|
||||
|
||||
|
||||
if (par2!=0 && im==ALLMOD)
|
||||
retval1=choose_vthresh();
|
||||
|
||||
retval2=trim_with_median(2*maxit+1, im);
|
||||
#ifdef DEBUGOUT
|
||||
printf("done\n");
|
||||
#endif
|
||||
if (retval1==OK && retval2==OK)
|
||||
retval=OK;
|
||||
else
|
||||
retval=FAIL;
|
||||
|
||||
return retval;
|
||||
|
||||
}
|
||||
|
||||
int calcthr_from_vcal(int vcal) {
|
||||
int thrmin;
|
||||
//thrmin=140+3*vcal/5;
|
||||
thrmin=180+3*vcal/5;
|
||||
return thrmin;
|
||||
}
|
||||
|
||||
int calccal_from_vthr(int vthr) {
|
||||
int vcal;
|
||||
vcal=5*(vthr-140)/3;
|
||||
return vcal;
|
||||
}
|
||||
|
||||
int choose_vthresh_and_vtrim(int countlim, int nsigma, int im) {
|
||||
int retval=OK;
|
||||
#ifdef MCB_FUNCS
|
||||
int modma, modmi, nm;
|
||||
int thr, thrstep=5, nthr=31;
|
||||
|
||||
int *fifodata;
|
||||
|
||||
double vthreshmean, vthreshSTDev;
|
||||
int *thrmi, *thrma;
|
||||
double c;
|
||||
//double b=BVTRIM;
|
||||
//double a=AVTRIM;
|
||||
int *trim;
|
||||
int ich, imod, ichan;
|
||||
int nvalid=0;
|
||||
u_int32_t *scan;
|
||||
int ithr;
|
||||
sls_detector_channel myChan;
|
||||
|
||||
|
||||
|
||||
setFrames(1);
|
||||
// setNMod(getNModBoard());
|
||||
|
||||
if (im==ALLMOD){
|
||||
modmi=0;
|
||||
modma=nModX;
|
||||
} else {
|
||||
modmi=im;
|
||||
modma=im+1;
|
||||
}
|
||||
nm=modma-modmi;
|
||||
|
||||
trim=malloc(sizeof(int)*nChans*nChips*nModX);
|
||||
thrmi=malloc(sizeof(int)*nModX);
|
||||
thrma=malloc(sizeof(int)*nModX);
|
||||
|
||||
|
||||
for (ich=0; ich<nChans*nChips*nm; ich++)
|
||||
trim[ich]=-1;
|
||||
/*
|
||||
setCSregister(im);
|
||||
setSSregister(im);
|
||||
initChannel(0,0,0,1,0,0,im);
|
||||
counterClear(im);
|
||||
clearSSregister(im);
|
||||
usleep(500);
|
||||
*/
|
||||
myChan.chan=-1;
|
||||
myChan.chip=-1;
|
||||
myChan.module=ALLMOD;
|
||||
myChan.reg=COMPARATOR_ENABLE;
|
||||
initChannelbyNumber(myChan);
|
||||
|
||||
|
||||
for (ithr=0; ithr<nthr; ithr++) {
|
||||
fifoReset();
|
||||
/* scanning threshold */
|
||||
for (imod=modmi; imod<modma; imod++) {
|
||||
//commented out by dhanya thr=getDACbyIndexDACU(VTHRESH,imod);
|
||||
if (ithr==0) {
|
||||
thrmi[imod]=thr;
|
||||
//commented out by dhanya initDACbyIndexDACU(VTHRESH,thr,imod);
|
||||
} else
|
||||
;//commented out by dhanya initDACbyIndexDACU(VTHRESH,thr+thrstep,imod);
|
||||
}
|
||||
|
||||
/* setCSregister(ALLMOD);
|
||||
setSSregister(ALLMOD);
|
||||
initChannel(0,0,0,1,0,0,im);
|
||||
setDynamicRange(32);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
counterClear(ALLMOD);
|
||||
clearSSregister(ALLMOD);
|
||||
usleep(500);
|
||||
startStateMachine();
|
||||
while (runBusy()) {
|
||||
}
|
||||
usleep(500);
|
||||
fifodata=(int*)fifo_read_event();
|
||||
scan=decode_data(fifodata);
|
||||
for (imod=modmi; imod<modma; imod++) {
|
||||
for (ichan=0; ichan<nChans*nChips; ichan++){
|
||||
ich=imod*nChips*nChans+ichan;
|
||||
if (scan[ich]>countlim && trim[ich]==-1) {
|
||||
//commented out by dhanya trim[ich]=getDACbyIndexDACU(VTHRESH,imod);
|
||||
#ifdef VERBOSE
|
||||
// printf("yes: %d %d %d\n",ich,ithr,scan[ich]);
|
||||
#endif
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
/* else {
|
||||
printf("no: %d %d %d\n",ich,ithr,scan[ich]);
|
||||
}*/
|
||||
#endif
|
||||
}
|
||||
}
|
||||
free(scan);
|
||||
}
|
||||
|
||||
for (imod=modmi; imod<modma; imod++) {
|
||||
vthreshmean=0;
|
||||
vthreshSTDev=0;
|
||||
nvalid=0;
|
||||
//commented out by dhanya thrma[imod]=getDACbyIndexDACU(VTHRESH,imod);
|
||||
|
||||
for (ichan=0; ichan<nChans*nChips; ichan++){
|
||||
ich=imod*nChans*nChips+ichan;
|
||||
if(trim[ich]>thrmi[imod] && trim[ich]<thrma[imod]) {
|
||||
vthreshmean=vthreshmean+trim[ich];
|
||||
vthreshSTDev=vthreshSTDev+trim[ich]*trim[ich];
|
||||
nvalid++;
|
||||
}
|
||||
}
|
||||
|
||||
if (nvalid>0) {
|
||||
vthreshmean=vthreshmean/nvalid;
|
||||
//commented out by dhanya vthreshSTDev=sqrt((vthreshSTDev/nvalid)-vthreshmean*vthreshmean);
|
||||
} else {
|
||||
vthreshmean=thrmi[imod];
|
||||
vthreshSTDev=nthr*thrstep;
|
||||
printf("No valid channel for module %d\n",imod);
|
||||
retval=FAIL;
|
||||
}
|
||||
|
||||
#ifdef DEBUGOUT
|
||||
printf("module= %d nvalid = %d mean=%f RMS=%f\n",imod, nvalid, vthreshmean,vthreshSTDev);
|
||||
#endif
|
||||
// *vthresh=round(vthreshmean-nsigma*vthreshSTDev);
|
||||
thr=(int)(vthreshmean-nsigma*vthreshSTDev);
|
||||
if (thr<0 || thr>(DAC_DR-1)) {
|
||||
thr=thrmi[imod]/2;
|
||||
printf("Can't find correct threshold for module %d\n",imod);
|
||||
retval=FAIL;
|
||||
}
|
||||
//commented out by dhanya initDACbyIndexDACU(VTHRESH,thr,imod);
|
||||
#ifdef VERBOSE
|
||||
printf("vthresh=%d \n",thr);
|
||||
#endif
|
||||
c=CVTRIM-2.*nsigma*vthreshSTDev/63.;
|
||||
//commented out by dhanya thr=(int)((-b-sqrt(b*b-4*a*c))/(2*a));
|
||||
if (thr<500 || thr>(DAC_DR-1)) {
|
||||
thr=750;
|
||||
printf("Can't find correct trimbit size for module %d\n",imod);
|
||||
retval=FAIL;
|
||||
}
|
||||
|
||||
//commented out by dhanya initDACbyIndexDACU(VTRIM,thr,imod);
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("vtrim=%d \n",thr);
|
||||
#endif
|
||||
|
||||
}
|
||||
free(trim);
|
||||
free(thrmi);
|
||||
free(thrma);
|
||||
|
||||
#endif
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int trim_with_level(int countlim, int im) {
|
||||
int ich, itrim, ichan, ichip, imod;
|
||||
u_int32_t *scan;
|
||||
int *inttrim;
|
||||
int modma, modmi, nm;
|
||||
int retval=OK;
|
||||
int *fifodata;
|
||||
sls_detector_channel myChan;
|
||||
printf("trimming module number %d", im);
|
||||
|
||||
|
||||
#ifdef MCB_FUNCS
|
||||
setFrames(1);
|
||||
// setNMod(getNModBoard());
|
||||
|
||||
if (im==ALLMOD){
|
||||
modmi=0;
|
||||
modma=nModX;
|
||||
} else {
|
||||
modmi=im;
|
||||
modma=im+1;
|
||||
}
|
||||
nm=modma-modmi;
|
||||
|
||||
inttrim=malloc(sizeof(int)*nChips*nChans*nModX);
|
||||
printf("countlim=%d\n",countlim);
|
||||
for (ich=0; ich<nChans*nChips*nModX; ich++)
|
||||
inttrim[ich]=-1;
|
||||
|
||||
for (itrim=0; itrim<TRIM_DR+1; itrim++) {
|
||||
fifoReset();
|
||||
printf("Trimbit %d\n",itrim);
|
||||
myChan.chan=-1;
|
||||
myChan.chip=-1;
|
||||
myChan.module=ALLMOD;
|
||||
myChan.reg=COMPARATOR_ENABLE|(itrim<<TRIMBIT_OFF);
|
||||
initChannelbyNumber(myChan);
|
||||
|
||||
/*
|
||||
setCSregister(im);
|
||||
setSSregister(im);
|
||||
initChannel(itrim,0,0,1,0,0,ALLMOD);
|
||||
setDynamicRange(32);
|
||||
*/
|
||||
setCSregister(ALLMOD);
|
||||
setSSregister(ALLMOD);
|
||||
counterClear(ALLMOD);
|
||||
clearSSregister(ALLMOD);
|
||||
usleep(500);
|
||||
startStateMachine();
|
||||
while (runBusy()) {
|
||||
}
|
||||
usleep(500);
|
||||
|
||||
fifodata=(int*)fifo_read_event();
|
||||
scan=decode_data(fifodata);
|
||||
for (imod=modmi; imod<modma; imod++) {
|
||||
for (ichan=0; ichan<nChans*nChips; ichan++) {
|
||||
ich=ichan+imod*nChans*nChips;
|
||||
if (inttrim[ich]==-1) {
|
||||
if (scan[ich]>countlim){
|
||||
inttrim[ich]=itrim;
|
||||
if (scan[ich]>2*countlim && itrim>0) {
|
||||
//if (scan[ich]>2*countlim || itrim==0) {
|
||||
inttrim[ich]=itrim-1;
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
printf("Channel %d trimbit %d counted %d (%08x) countlim %d\n",ich,itrim,scan[ich],fifodata[ich],countlim);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
/* else
|
||||
printf("Channel %d trimbit %d counted %d countlim %d\n",ich,itrim,scan[ich],countlim);*/
|
||||
#endif
|
||||
}
|
||||
}
|
||||
free(scan);
|
||||
}
|
||||
|
||||
for (imod=modmi; imod<modma; imod++) {
|
||||
clearCSregister(imod);
|
||||
firstChip(im);
|
||||
for (ichip=0; ichip<nChips; ichip++) {
|
||||
clearSSregister(imod);
|
||||
for (ichan=0; ichan<nChans; ichan++) {
|
||||
nextStrip(imod);
|
||||
ich=ichan+imod*nChans*nChips+ichip*nChans;
|
||||
if (*(inttrim+ich)==-1) {
|
||||
*(inttrim+ich)=TRIM_DR;
|
||||
// printf("could not trim channel %d chip %d module %d - set to %d\n", ichan, ichip, imod, *(inttrim+ich) );
|
||||
retval=FAIL;
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
// else
|
||||
// printf("channel %d trimbit %d\n",ich,*(inttrim+ich) );
|
||||
#endif
|
||||
initChannel(inttrim[ich],0,0,1,0,0,imod);
|
||||
}
|
||||
nextChip(imod);
|
||||
}
|
||||
}
|
||||
free(inttrim);
|
||||
|
||||
#endif
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
#define ELEM_SWAP(a,b) { register int t=(a);(a)=(b);(b)=t; }
|
||||
#define median(a,n) kth_smallest(a,n,(((n)&1)?((n)/2):(((n)/2)-1)))
|
||||
|
||||
|
||||
int kth_smallest(int *a, int n, int k)
|
||||
{
|
||||
register int i,j,l,m ;
|
||||
register double x ;
|
||||
|
||||
l=0 ; m=n-1 ;
|
||||
while (l<m) {
|
||||
x=a[k] ;
|
||||
i=l ;
|
||||
j=m ;
|
||||
do {
|
||||
while (a[i]<x) i++ ;
|
||||
while (x<a[j]) j-- ;
|
||||
if (i<=j) {
|
||||
ELEM_SWAP(a[i],a[j]) ;
|
||||
i++ ; j-- ;
|
||||
}
|
||||
} while (i<=j) ;
|
||||
if (j<k) l=i ;
|
||||
if (k<i) m=j ;
|
||||
}
|
||||
return a[k] ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int ave(int *a, int n)
|
||||
{
|
||||
int av=0,i;
|
||||
for (i=0; i<n; i++)
|
||||
av=av+((double)*(a+i))/((double)n);
|
||||
return av;
|
||||
}
|
||||
|
||||
|
||||
int choose_vthresh() {
|
||||
|
||||
int retval=OK;
|
||||
#ifdef MCB_FUNCS
|
||||
int imod, ichan;
|
||||
u_int32_t *scan, *scan1;
|
||||
int olddiff[nModX], direction[nModX];
|
||||
int med[nModX], med1[nModX], diff, media;
|
||||
int change_flag=1;
|
||||
int iteration=0;
|
||||
int maxiterations=10;
|
||||
int vthreshmean=0;
|
||||
int vthresh;
|
||||
int im=ALLMOD;
|
||||
int modma, modmi, nm;
|
||||
int *fifodata;
|
||||
|
||||
setFrames(1);
|
||||
// setNMod(getNModBoard());
|
||||
|
||||
if (im==ALLMOD){
|
||||
modmi=0;
|
||||
modma=nModX;
|
||||
} else {
|
||||
modmi=im;
|
||||
modma=im+1;
|
||||
}
|
||||
nm=modma-modmi;
|
||||
|
||||
|
||||
|
||||
setDynamicRange(32);
|
||||
|
||||
setCSregister(ALLMOD);
|
||||
setSSregister(ALLMOD);
|
||||
counterClear(ALLMOD);
|
||||
clearSSregister(ALLMOD);
|
||||
usleep(500);
|
||||
startStateMachine();
|
||||
while (runBusy()) {
|
||||
//printf(".");
|
||||
}
|
||||
usleep(500);
|
||||
|
||||
fifodata=(int*)fifo_read_event();
|
||||
scan=decode_data(fifodata);
|
||||
//
|
||||
scan1=decode_data(fifodata);
|
||||
|
||||
|
||||
for (imod=modmi; imod<modma; imod++) {
|
||||
//
|
||||
med[imod]=(int)median((int*)scan1+imod*nChans*nChips,nChans*nChips);
|
||||
med1[imod]=med[imod];
|
||||
//commented out by dhanya vthreshmean=vthreshmean+getDACbyIndexDACU(VTHRESH,imod);
|
||||
olddiff[imod]=0xffffff;
|
||||
direction[imod]=0;
|
||||
printf("Median of module %d=%d\n",imod,med[imod]);
|
||||
}
|
||||
vthreshmean=vthreshmean/nm;
|
||||
//media=median(scan,nChans*nChips*nModX);
|
||||
//printf("Median overall=%d\n",media);
|
||||
media=median(med1+modmi,nm);
|
||||
printf("Median of modules=%d\n",media);
|
||||
free(scan);
|
||||
free(scan1);
|
||||
|
||||
|
||||
while(change_flag && iteration<maxiterations) {
|
||||
|
||||
setDynamicRange(32);
|
||||
fifoReset();
|
||||
setCSregister(ALLMOD);
|
||||
setSSregister(ALLMOD);
|
||||
counterClear(ALLMOD);
|
||||
clearSSregister(ALLMOD);
|
||||
usleep(500);
|
||||
startStateMachine();
|
||||
while (runBusy()) {
|
||||
}
|
||||
usleep(500);
|
||||
|
||||
fifodata=(int*)fifo_read_event();
|
||||
scan=decode_data(fifodata);
|
||||
//
|
||||
scan1=decode_data(fifodata);
|
||||
|
||||
change_flag=0;
|
||||
printf("Vthresh iteration %3d 0f %3d\n",iteration, maxiterations);
|
||||
for (ichan=modmi; ichan<modma; ichan++) {
|
||||
med[ichan]=(int)median((int*)scan1+ichan*nChans*nChips,nChans*nChips);
|
||||
med1[imod]=med[imod];
|
||||
media=median(med1+modmi,nm);
|
||||
|
||||
diff=med[ichan]-media;
|
||||
if (direction[ichan]==0) {
|
||||
if (diff>0)
|
||||
direction[ichan]=1;
|
||||
else
|
||||
direction[ichan]=-1;
|
||||
}
|
||||
//commented out by dhanya vthresh=getDACbyIndexDACU(VTHRESH,imod);
|
||||
if ( direction[ichan]!=-3) {
|
||||
if (abs(diff)>abs(olddiff[ichan])) {
|
||||
vthresh=vthresh-direction[ichan];
|
||||
if (vthresh>(DAC_DR-1)) {
|
||||
vthresh=(DAC_DR-1);
|
||||
printf("can't equalize threshold for module %d\n", ichan);
|
||||
retval=FAIL;
|
||||
}
|
||||
if (vthresh<0) {
|
||||
vthresh=0;
|
||||
printf("can't equalize threshold for module %d\n", ichan);
|
||||
retval=FAIL;
|
||||
}
|
||||
direction[ichan]=-3;
|
||||
} else {
|
||||
vthresh=vthresh+direction[ichan];
|
||||
olddiff[ichan]=diff;
|
||||
change_flag=1;
|
||||
}
|
||||
//commented out by dhanya initDACbyIndex(VTHRESH,vthresh, ichan);
|
||||
}
|
||||
}
|
||||
iteration++;
|
||||
free(scan);
|
||||
free(scan1);
|
||||
}
|
||||
#endif
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int trim_with_median(int stop, int im) {
|
||||
|
||||
|
||||
int retval=OK;
|
||||
|
||||
#ifdef MCB_FUNCS
|
||||
int ichan, imod, ichip, ich;
|
||||
u_int32_t *scan, *scan1;
|
||||
int *olddiff, *direction;
|
||||
int med, diff;
|
||||
int change_flag=1;
|
||||
int iteration=0;
|
||||
int me[nModX], me1[nModX];
|
||||
int modma, modmi, nm;
|
||||
int trim;
|
||||
int *fifodata;
|
||||
|
||||
setFrames(1);
|
||||
// setNMod(getNModBoard());
|
||||
|
||||
if (im==ALLMOD){
|
||||
modmi=0;
|
||||
modma=nModX;
|
||||
} else {
|
||||
modmi=im;
|
||||
modma=im+1;
|
||||
}
|
||||
nm=modma-modmi;
|
||||
|
||||
olddiff=malloc(4*nModX*nChips*nChans);
|
||||
direction=malloc(4*nModX*nChips*nChans);
|
||||
for (imod=modmi; imod<modma; imod++) {
|
||||
for (ichip=0; ichip<nChips; ichip++) {
|
||||
for (ich=0; ich<nChans; ich++) {
|
||||
ichan=imod*nChips*nChans+ichip*nChans+ich;
|
||||
direction[ichan]=0;
|
||||
olddiff[ichan]=0x0fffffff;
|
||||
}
|
||||
}
|
||||
}
|
||||
/********
|
||||
fifoReset();
|
||||
setCSregister(ALLMOD);
|
||||
setSSregister(ALLMOD);
|
||||
counterClear(ALLMOD);
|
||||
clearSSregister(ALLMOD);
|
||||
usleep(500);
|
||||
startStateMachine();
|
||||
while (runBusy()) {
|
||||
}
|
||||
usleep(500);
|
||||
scan=decode_data(fifo_read_event());
|
||||
for (imod=modmi; imod<modma; imod++) {
|
||||
me[imod]=median(scan+imod*nChans*nChips,nChans*nChips);
|
||||
printf("Median of module %d=%d\n",imod,me[imod]);
|
||||
}
|
||||
med=median(me,nm);
|
||||
printf("median is %d\n",med);
|
||||
free(scan);
|
||||
**************/
|
||||
while(change_flag && iteration<stop) {
|
||||
|
||||
setDynamicRange(32);
|
||||
fifoReset();
|
||||
setCSregister(ALLMOD);
|
||||
setSSregister(ALLMOD);
|
||||
counterClear(ALLMOD);
|
||||
clearSSregister(ALLMOD);
|
||||
usleep(500);
|
||||
startStateMachine();
|
||||
while (runBusy()) {
|
||||
}
|
||||
usleep(500);
|
||||
fifodata=(int*)fifo_read_event();
|
||||
scan=decode_data(fifodata);
|
||||
scan1=decode_data(fifodata);
|
||||
|
||||
|
||||
|
||||
/********* calculates median every time ***********/
|
||||
|
||||
for (imod=modmi; imod<modma; imod++) {
|
||||
me[imod]=median((int*)scan1+imod*nChans*nChips,nChans*nChips);
|
||||
me1[imod]=me[imod];
|
||||
printf("Median of module %d=%d\n",imod,me[imod]);
|
||||
}
|
||||
med=median(me1,nm);
|
||||
printf("median is %d\n",med);
|
||||
|
||||
change_flag=0;
|
||||
printf("Trimbits iteration %d of %d\n",iteration, stop);
|
||||
for (imod=modmi; imod<modma; imod++) {
|
||||
for (ichip=0; ichip<nChips; ichip++) {
|
||||
selChip(ichip,imod);
|
||||
clearSSregister(imod);
|
||||
for (ich=0; ich<nChans; ich++) {
|
||||
ichan=imod*nChips*nChans+ichip*nChans+ich;
|
||||
nextStrip(imod);
|
||||
diff=scan[ichan]-me[imod];
|
||||
if (direction[ichan]==0) {
|
||||
if (diff>0) {
|
||||
direction[ichan]=1;
|
||||
} else {
|
||||
direction[ichan]=-1;
|
||||
}
|
||||
}
|
||||
if ( direction[ichan]!=-3) {
|
||||
if (abs(diff)>abs(olddiff[ichan])) {
|
||||
trim=getTrimbit(imod,ichip,ich)+direction[ichan];
|
||||
printf("%d old diff %d < new diff %d %d - trimbit %d\n",ichan, olddiff[ichan], diff, direction[ichan], trim);
|
||||
direction[ichan]=-3;
|
||||
} else {
|
||||
trim=getTrimbit(imod,ichip,ich)-direction[ichan];
|
||||
olddiff[ichan]=diff;
|
||||
change_flag=1;
|
||||
}
|
||||
if (trim>TRIM_DR) {
|
||||
trim=63;
|
||||
printf("can't trim channel %d chip %d module %d to trim %d\n",ich, ichip, imod, trim);
|
||||
retval=FAIL;
|
||||
}
|
||||
if (trim<0) {
|
||||
printf("can't trim channel %d chip %d module %d to trim %d\n",ich, ichip, imod, trim);
|
||||
trim=0;
|
||||
retval=FAIL;
|
||||
}
|
||||
initChannel(trim,0,0,1,0,0,imod);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
iteration++;
|
||||
free(scan);
|
||||
free(scan1);
|
||||
}
|
||||
free(olddiff);
|
||||
free(direction);
|
||||
#endif
|
||||
return retval;
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
#ifndef TRIMMING_FUNCS_H
|
||||
#define TRIMMING_FUNCS_H
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
int trim_fixed_settings(int countlim, int par2, int imod);
|
||||
int trim_with_noise(int countlim, int nsigma, int imod);
|
||||
int trim_with_beam(int countlim, int nsigma, int imod);
|
||||
int trim_improve(int maxit, int par2, int imod);
|
||||
int calcthr_from_vcal(int vcal);
|
||||
int calccal_from_vthr(int vthr);
|
||||
int choose_vthresh_and_vtrim(int countlim, int nsigma, int imod);
|
||||
|
||||
int choose_vthresh();
|
||||
int trim_with_level(int countlim, int imod);
|
||||
int trim_with_median(int stop, int imod);
|
||||
int calcthr_from_vcal(int vcal);
|
||||
int calccal_from_vthr(int vthr);
|
||||
|
||||
#endif
|
Binary file not shown.
Binary file not shown.
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsDetectorSoftware/jungfrauDetectorServer
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: 3b6ead77836f2b6d2a795a9a994259d1dc8c131d
|
||||
Revision: 159
|
||||
Repsitory UUID: c52025dd7c4b44b93e64353a22997d971996ab18
|
||||
Revision: 163
|
||||
Branch: developer
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 3943
|
||||
Last Changed Date: 2018-07-17 16:15:43.000000002 +0200 ./RegisterDefs.h
|
||||
Last Changed Author: Gemma_Tinti
|
||||
Last Changed Rev: 3999
|
||||
Last Changed Date: 2018-09-28 14:11:53.000000002 +0200 ./RegisterDefs.h
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "3b6ead77836f2b6d2a795a9a994259d1dc8c131d"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x3943
|
||||
#define GITDATE 0x20180717
|
||||
#define GITREPUUID "c52025dd7c4b44b93e64353a22997d971996ab18"
|
||||
#define GITAUTH "Gemma_Tinti"
|
||||
#define GITREV 0x3999
|
||||
#define GITDATE 0x20180928
|
||||
#define GITBRANCH "developer"
|
||||
|
@ -10,7 +10,7 @@
|
||||
#define GOODBYE (-200)
|
||||
#define PROGRAMMING_MODE (-200)
|
||||
#define MIN_REQRD_VRSN_T_RD_API 0x171220
|
||||
#define REQRD_FRMWR_VRSN 0x180226
|
||||
#define REQRD_FRMWR_VRSN 0x180615
|
||||
|
||||
|
||||
/* Struct Definitions */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -491,7 +491,7 @@ public:
|
||||
* @param pos position in the multi list
|
||||
* @returns slsDetector object
|
||||
*/
|
||||
slsDetector *operator()(int pos);
|
||||
slsDetector *operator()(int pos) const;
|
||||
|
||||
/**
|
||||
* Free shared memory from the command line
|
||||
@ -945,6 +945,12 @@ public:
|
||||
*/
|
||||
int stopAcquisition();
|
||||
|
||||
/**
|
||||
* Give an internal software trigger to the detector (Eiger only)
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int sendSoftwareTrigger();
|
||||
|
||||
/**
|
||||
* Start readout (without exposure or interrupting exposure) (Mythen)
|
||||
* @returns OK or FAIL
|
||||
@ -1042,9 +1048,10 @@ public:
|
||||
* Set/get timer value left in acquisition (not all implemented for all detectors)
|
||||
* @param index timer index
|
||||
* @param t time in ns or number of...(e.g. frames, gates, probes)
|
||||
* @param imod module number
|
||||
* @returns timer set value in ns or number of...(e.g. frames, gates, probes)
|
||||
*/
|
||||
int64_t getTimeLeft(timerIndex index);
|
||||
int64_t getTimeLeft(timerIndex index, int imod = -1);
|
||||
|
||||
/**
|
||||
* Set speed
|
||||
@ -1235,11 +1242,18 @@ public:
|
||||
int writeAdcRegister(int addr, int val);
|
||||
|
||||
/**
|
||||
* Activates the detector (Eiger only)
|
||||
* Activates/Deactivates the detector (Eiger only)
|
||||
* @param enable active (1) or inactive (0), -1 gets
|
||||
* @returns 0 (inactive) or 1 (active)
|
||||
* @returns 0 (inactive) or 1 (active)for activate mode
|
||||
*/
|
||||
int activate(int const enable=GET_ONLINE_FLAG);
|
||||
int activate(int const enable=-1);
|
||||
|
||||
/**
|
||||
* Set deactivated Receiver padding mode (Eiger only)
|
||||
* @param padding padding option for deactivated receiver. Can be 1 (padding), 0 (no padding), -1 (gets)
|
||||
* @returns 1 (padding), 0 (no padding), -1 (inconsistent values) for padding option
|
||||
*/
|
||||
int setDeactivatedRxrPaddingMode(int padding=-1);
|
||||
|
||||
/**
|
||||
* Returns the enable if data will be flipped across x or y axis (Eiger)
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "multiSlsDetector.h"
|
||||
#include "multiSlsDetectorCommand.h"
|
||||
#include "sls_detector_exceptions.h"
|
||||
#include "sls_receiver_exceptions.h"
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -19,7 +19,7 @@ class multiSlsDetectorClient {
|
||||
|
||||
public:
|
||||
multiSlsDetectorClient(int argc, char *argv[], int action, multiSlsDetector *myDetector=NULL) { \
|
||||
string answer; \
|
||||
std::string answer; \
|
||||
multiSlsDetectorCommand *myCmd; \
|
||||
int id = -1, pos = -1, iv = 0; \
|
||||
bool verify = true, update = true; \
|
||||
@ -90,7 +90,7 @@ public:
|
||||
strcpy(cmd, argv[0]); \
|
||||
} \
|
||||
// special commands
|
||||
string scmd = cmd; \
|
||||
std::string scmd = cmd; \
|
||||
// free without calling multiSlsDetector constructor
|
||||
if (scmd == "free") { \
|
||||
if (pos != -1) \
|
||||
@ -113,9 +113,10 @@ public:
|
||||
// create multiSlsDetector class if required
|
||||
if (myDetector==NULL) { \
|
||||
try { \
|
||||
myDetector = new multiSlsDetector(id, verify, update); \
|
||||
} catch (const SharedMemoryException & e) { \
|
||||
cout << e.GetMessage() << endl; \
|
||||
multiSlsDetector* m = new multiSlsDetector(id, verify, update); \
|
||||
myDetector = m; \
|
||||
} catch (const SlsDetectorPackageExceptions & e) { \
|
||||
/*cout << e.GetMessage() << endl;*/ \
|
||||
return; \
|
||||
} catch (...) { \
|
||||
cout << " caught exception" << endl; \
|
||||
@ -128,8 +129,8 @@ public:
|
||||
myCmd=new multiSlsDetectorCommand(myDetector); \
|
||||
try { \
|
||||
answer=myCmd->executeLine(argc, argv, action, pos); \
|
||||
} catch (const SharedMemoryException & e) { \
|
||||
cout << e.GetMessage() << endl; \
|
||||
} catch (const SlsDetectorPackageExceptions & e) { \
|
||||
/*cout << e.GetMessage() << endl; */ \
|
||||
delete myCmd; \
|
||||
if (del) delete myDetector; \
|
||||
return; \
|
||||
|
@ -28,8 +28,8 @@ class multiSlsDetectorCommand : public slsDetectorCommand {
|
||||
/* \returns answer string */
|
||||
/* *\/ */
|
||||
|
||||
string executeLine(int narg, char *args[], int action, int id=-1) { \
|
||||
string s; \
|
||||
std::string executeLine(int narg, char *args[], int action, int id=-1) { \
|
||||
std::string s; \
|
||||
if (id>=0) {
|
||||
slsDetector *d=myDet->getSlsDetector(id); \
|
||||
if (d) { \
|
||||
@ -39,7 +39,7 @@ class multiSlsDetectorCommand : public slsDetectorCommand {
|
||||
myDet->setErrorMask((myDet->getErrorMask())|(1<<id)); \
|
||||
delete cmd;
|
||||
} else
|
||||
s=string("detector does no exist"); \
|
||||
s=std::string("detector does no exist"); \
|
||||
} else \
|
||||
s=slsDetectorCommand::executeLine(narg,args,action); \
|
||||
return s;
|
||||
@ -48,13 +48,13 @@ class multiSlsDetectorCommand : public slsDetectorCommand {
|
||||
/**
|
||||
* calls executeLine with PUT_ACTION
|
||||
*/
|
||||
string putCommand(int narg, char *args[], int pos=-1){\
|
||||
std::string putCommand(int narg, char *args[], int pos=-1){\
|
||||
return executeLine(narg, args,slsDetectorDefs::PUT_ACTION,pos);\
|
||||
};
|
||||
/**
|
||||
* calls executeLine with GET_ACTION
|
||||
*/
|
||||
string getCommand(int narg, char *args[], int pos=-1){\
|
||||
std::string getCommand(int narg, char *args[], int pos=-1){\
|
||||
return executeLine(narg, args,slsDetectorDefs::GET_ACTION,pos);\
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "SharedMemory.h"
|
||||
#include "sls_detector_exceptions.h"
|
||||
#include "sls_receiver_exceptions.h"
|
||||
#include "ansi.h"
|
||||
|
||||
#include <iostream>
|
||||
@ -61,6 +61,7 @@ void* SharedMemory::CreateSharedMemory(size_t sz){
|
||||
cprintf(RED, "Error: Create shared memory %s failed at ftruncate: %s\n",
|
||||
name.c_str(), strerror(errno));
|
||||
close(fd);
|
||||
RemoveSharedMemory();
|
||||
throw SharedMemoryException();
|
||||
}
|
||||
|
||||
@ -122,14 +123,14 @@ void* SharedMemory::MapSharedMemory(size_t sz) {
|
||||
std::string SharedMemory::ConstructSharedMemoryName(int multiId, int slsId) {
|
||||
|
||||
// using environment path
|
||||
string sEnvPath = "";
|
||||
std::string sEnvPath = "";
|
||||
char* envpath = getenv(SHM_ENV_NAME);
|
||||
if (envpath != NULL) {
|
||||
sEnvPath.assign(envpath);
|
||||
sEnvPath.insert(0,"_");
|
||||
}
|
||||
|
||||
stringstream ss;
|
||||
std::stringstream ss;
|
||||
if (slsId < 0)
|
||||
ss << SHM_MULTI_PREFIX << multiId << sEnvPath;
|
||||
else
|
||||
@ -137,8 +138,10 @@ std::string SharedMemory::ConstructSharedMemoryName(int multiId, int slsId) {
|
||||
|
||||
std::string temp = ss.str();
|
||||
if (temp.length() > NAME_MAX) {
|
||||
cprintf(RED, "Error: Shared memory initialization %s failed: %s\n",
|
||||
name.c_str(), strerror(errno));
|
||||
cprintf(RED, "Error: Shared memory initialization failed. "
|
||||
"%s has %lu characters. \n"
|
||||
"Maximum is %d. Change the environment variable %s\n",
|
||||
temp.c_str(), temp.length(), NAME_MAX, SHM_ENV_NAME);
|
||||
throw SharedMemoryException();
|
||||
}
|
||||
return temp;
|
||||
|
@ -88,24 +88,26 @@ int main(int argc, char* argv[])
|
||||
int ret=slsReceiverDefs::FAIL;
|
||||
int arg[2]={idx,0};
|
||||
|
||||
MySocketTCP* mySocket = 0;
|
||||
|
||||
MySocketTCP* tempSocket=new MySocketTCP(argv[1],1952);
|
||||
if (tempSocket->getErrorStatus()){
|
||||
try {
|
||||
mySocket = new MySocketTCP(argv[1],1952);
|
||||
} catch (...) {
|
||||
cerr << "could not create socket with " << argv[1] << endl;
|
||||
help();
|
||||
}
|
||||
|
||||
if (tempSocket->Connect()) {
|
||||
tempSocket->SendDataOnly(&fnum, sizeof(fnum));
|
||||
tempSocket->SendDataOnly(arg,sizeof(arg));
|
||||
tempSocket->ReceiveDataOnly(&ret, sizeof(ret));
|
||||
if (mySocket->Connect()) {
|
||||
mySocket->SendDataOnly(&fnum, sizeof(fnum));
|
||||
mySocket->SendDataOnly(arg,sizeof(arg));
|
||||
mySocket->ReceiveDataOnly(&ret, sizeof(ret));
|
||||
if (ret != slsReceiverDefs::FAIL) {
|
||||
tempSocket->ReceiveDataOnly(&retval, sizeof(retval));
|
||||
mySocket->ReceiveDataOnly(&retval, sizeof(retval));
|
||||
} else {
|
||||
tempSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
mySocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
printf("Detector returned Error: %s",mess);
|
||||
}
|
||||
tempSocket->Disconnect();
|
||||
mySocket->Disconnect();
|
||||
} else
|
||||
cerr << "could not connect to " << argv[1] << endl;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "83600fcb15c8261173ab15a8ba8d1009693f2d23"
|
||||
#define GITAUTH "Anna_Bergamaschi"
|
||||
#define GITREV 0x3962
|
||||
#define GITDATE 0x20180911
|
||||
#define GITBRANCH "anna"
|
||||
|
||||
#define GITREPUUID "d2bce7e372c241cd235977b92be18555bca6a77d"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x4020
|
||||
#define GITDATE 0x20180927
|
||||
#define GITBRANCH "4.0.0"
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "sls_detector_exceptions.h"
|
||||
#include "sls_receiver_exceptions.h"
|
||||
#include "SharedMemory.h"
|
||||
#include "receiverInterface.h"
|
||||
#include "gitInfoLib.h"
|
||||
@ -53,7 +53,6 @@ slsDetector::slsDetector(detectorType type, int multiId, int id, bool verify, mu
|
||||
}
|
||||
delete shm;
|
||||
|
||||
|
||||
initSharedMemory(true, type, multiId, verify);
|
||||
initializeDetectorStructure(type);
|
||||
initializeMembers();
|
||||
@ -81,8 +80,10 @@ slsDetector::slsDetector(int multiId, int id, bool verify, multiSlsDetector* m)
|
||||
offset(0) {
|
||||
/* called from multi constructor to populate structure,
|
||||
* so sls shared memory will be opened, not created */
|
||||
|
||||
// getDetectorType Froom shm will check if it was already existing
|
||||
detectorType type = getDetectorTypeFromShm(multiId, verify);
|
||||
|
||||
initSharedMemory(false, type, multiId, verify);
|
||||
initializeMembers();
|
||||
}
|
||||
@ -424,41 +425,46 @@ void slsDetector::addMultipleDetectors(const char* name) {
|
||||
cprintf(RED, "Error: Add Multiple Detectors should not be called at this level\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* pre: sharedMemory=0, thisDetector = 0
|
||||
* exceptions are caught in calling function, shm unmapped and deleted
|
||||
*/
|
||||
void slsDetector::initSharedMemory(bool created, detectorType type, int multiId,
|
||||
bool verify) {
|
||||
if (sharedMemory)
|
||||
delete sharedMemory;
|
||||
thisDetector = 0;
|
||||
try {
|
||||
// calculate shared memory size
|
||||
int sz = calculateSharedMemorySize(type);
|
||||
|
||||
// calculate shared memory size
|
||||
int sz = calculateSharedMemorySize(type);
|
||||
// shared memory object with name
|
||||
sharedMemory = new SharedMemory(multiId, detId);
|
||||
|
||||
// shared memory object with name
|
||||
sharedMemory = new SharedMemory(multiId, detId);
|
||||
// create
|
||||
if (created) {
|
||||
try {
|
||||
// create
|
||||
if (created) {
|
||||
thisDetector = (sharedSlsDetector*)sharedMemory->CreateSharedMemory(sz);
|
||||
} catch(...) {
|
||||
sharedMemory->RemoveSharedMemory();
|
||||
}
|
||||
// open and verify version
|
||||
else {
|
||||
thisDetector = (sharedSlsDetector*)sharedMemory->OpenSharedMemory(sz);
|
||||
if (verify && thisDetector->shmversion != SLS_SHMVERSION) {
|
||||
cprintf(RED, "Single shared memory (%d-%d:)version mismatch "
|
||||
"(expected 0x%x but got 0x%x)\n",
|
||||
multiId, detId, SLS_SHMVERSION,
|
||||
thisDetector->shmversion);
|
||||
throw SharedMemoryException();
|
||||
}
|
||||
}
|
||||
} catch(...) {
|
||||
if (sharedMemory) {
|
||||
// unmap
|
||||
if (thisDetector) {
|
||||
sharedMemory->UnmapSharedMemory(thisDetector);
|
||||
thisDetector = 0;
|
||||
}
|
||||
// delete
|
||||
delete sharedMemory;
|
||||
sharedMemory = 0;
|
||||
thisDetector = 0;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
// open and verify version
|
||||
else {
|
||||
thisDetector = (sharedSlsDetector*)sharedMemory->OpenSharedMemory(sz);
|
||||
if (verify && thisDetector->shmversion != SLS_SHMVERSION) {
|
||||
cprintf(RED, "Single shared memory (%d-%d:)version mismatch "
|
||||
"(expected 0x%x but got 0x%x)\n",
|
||||
multiId, detId, SLS_SHMVERSION, thisDetector->shmversion);
|
||||
sharedMemory->UnmapSharedMemory(thisDetector); /** is this unncessary? */
|
||||
delete sharedMemory;/** is this unncessary? */
|
||||
sharedMemory = 0;
|
||||
throw SharedMemoryException();
|
||||
}
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
@ -696,7 +702,7 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
|
||||
thisDetector->timerValue[SAMPLES_JCTB] = 1;
|
||||
thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME] = 0;
|
||||
thisDetector->timerValue[STORAGE_CELL_NUMBER] = 0;
|
||||
thisDetector->timerValue[SUBFRAME_PERIOD] = 0;
|
||||
thisDetector->timerValue[SUBFRAME_DEADTIME] = 0;
|
||||
thisDetector->actionMask = 0;
|
||||
for (int i = 0; i < MAX_ACTIONS; ++i) {
|
||||
strcpy(thisDetector->actionScript[i], "none");
|
||||
@ -743,7 +749,9 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
|
||||
thisDetector->receiverAPIVersion = 0;
|
||||
thisDetector->receiver_frameDiscardMode = NO_DISCARD;
|
||||
thisDetector->receiver_framePadding = 1;
|
||||
|
||||
thisDetector->activated = true;
|
||||
thisDetector->receiver_deactivatedPaddingEnable = true;
|
||||
thisDetector->receiver_silentMode = false;
|
||||
|
||||
// get the detector parameters based on type
|
||||
detParameterList detlist;
|
||||
@ -760,7 +768,7 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
|
||||
thisDetector->nOffset = detlist.nOffset;
|
||||
thisDetector->dynamicRange = detlist.dynamicRange;
|
||||
thisDetector->moveFlag = detlist.moveFlag;
|
||||
detlist.nGappixelsY = detlist.nGappixelsX;
|
||||
thisDetector->nGappixels[X] = detlist.nGappixelsX;
|
||||
thisDetector->nGappixels[Y] = detlist.nGappixelsY;
|
||||
|
||||
|
||||
@ -1001,7 +1009,7 @@ slsDetectorDefs::sls_detector_module* slsDetector::createModule(detectorType ty
|
||||
nd = detlist.nDacs;
|
||||
na = detlist.nAdcs;
|
||||
} catch(...) {
|
||||
;// FIXME do what here?
|
||||
return NULL;
|
||||
}
|
||||
dacs_t *dacs=new dacs_t[nd];
|
||||
dacs_t *adcs=new dacs_t[na];
|
||||
@ -1255,35 +1263,48 @@ int slsDetector::receiveModule(sls_detector_module* myMod) {
|
||||
|
||||
|
||||
slsReceiverDefs::detectorType slsDetector::getDetectorTypeFromShm(int multiId, bool verify) {
|
||||
SharedMemory* shm = new SharedMemory(multiId, detId);
|
||||
// shm not created before
|
||||
if (!shm->IsExisting()) {
|
||||
cprintf(RED,"Shared memory %s does not exist.\n"
|
||||
"Corrupted Multi Shared memory. Please free shared memory.\n",
|
||||
shm->GetName().c_str());
|
||||
throw SharedMemoryException();
|
||||
|
||||
detectorType type = GENERIC;
|
||||
SharedMemory* shm = 0;
|
||||
|
||||
try {
|
||||
// create
|
||||
shm = new SharedMemory(multiId, detId);
|
||||
|
||||
// shm not created before
|
||||
if (!shm->IsExisting()) {
|
||||
cprintf(RED,"Shared memory %s does not exist.\n"
|
||||
"Corrupted Multi Shared memory. Please free shared memory.\n",
|
||||
shm->GetName().c_str());
|
||||
throw SharedMemoryException();
|
||||
}
|
||||
|
||||
// only basic size of structure (just version is required)
|
||||
sharedSlsDetector* sdet = 0;
|
||||
size_t sz = sizeof(sharedSlsDetector);
|
||||
|
||||
// open, map, verify version
|
||||
sdet = (sharedSlsDetector*)shm->OpenSharedMemory(sz);
|
||||
if (verify && sdet->shmversion != SLS_SHMVERSION) {
|
||||
cprintf(RED, "Single shared memory (%d-%d:)version mismatch "
|
||||
"(expected 0x%x but got 0x%x)\n",
|
||||
multiId, detId, SLS_SHMVERSION, sdet->shmversion);
|
||||
// unmap and throw
|
||||
sharedMemory->UnmapSharedMemory(thisDetector);
|
||||
throw SharedMemoryException();
|
||||
}
|
||||
|
||||
// get type, unmap
|
||||
type = sdet->myDetectorType;
|
||||
shm->UnmapSharedMemory(sdet);
|
||||
delete shm;
|
||||
|
||||
} catch (...) {
|
||||
if (shm)
|
||||
delete shm;
|
||||
throw;
|
||||
}
|
||||
|
||||
// map basic size of sls detector structure (no need of offsets, just version is required)
|
||||
sharedSlsDetector* sdet = 0;
|
||||
size_t sz = sizeof(sharedSlsDetector);
|
||||
|
||||
// open, map, verify version, get type
|
||||
sdet = (sharedSlsDetector*)shm->OpenSharedMemory(sz);
|
||||
if (verify && sdet->shmversion != SLS_SHMVERSION) {
|
||||
cprintf(RED, "Single shared memory (%d-%d:)version mismatch "
|
||||
"(expected 0x%x but got 0x%x)\n",
|
||||
multiId, detId, SLS_SHMVERSION, sdet->shmversion);
|
||||
shm->UnmapSharedMemory(sdet); /** is this unncessary? */
|
||||
delete shm;/** is this unncessary? */
|
||||
throw SharedMemoryException();
|
||||
}
|
||||
detectorType type = sdet->myDetectorType;
|
||||
|
||||
// unmap
|
||||
shm->UnmapSharedMemory(sdet);
|
||||
delete shm;
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
@ -1291,29 +1312,38 @@ slsReceiverDefs::detectorType slsDetector::getDetectorTypeFromShm(int multiId, b
|
||||
slsDetectorDefs::detectorType slsDetector::getDetectorType(const char *name, int cport) {
|
||||
int fnum=F_GET_DETECTOR_TYPE;
|
||||
int retval = FAIL;
|
||||
detectorType t=GENERIC;
|
||||
MySocketTCP *s= new MySocketTCP(name, cport);
|
||||
detectorType t = GENERIC;
|
||||
MySocketTCP* mySocket = 0;
|
||||
|
||||
try {
|
||||
mySocket = new MySocketTCP(name, cport);
|
||||
} catch(...) {
|
||||
cout << "Cannot create socket to server " << name << " over port " << cport << endl;
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
char m[MAX_STR_LENGTH];
|
||||
#ifdef VERBOSE
|
||||
cout << "Getting detector type " << endl;
|
||||
#endif
|
||||
if (s->Connect() >= 0) {
|
||||
s->SendDataOnly(&fnum,sizeof(fnum));
|
||||
s->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
if (mySocket->Connect() >= 0) {
|
||||
mySocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
mySocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
if (retval!=FAIL) {
|
||||
s->ReceiveDataOnly(&t,sizeof(t));
|
||||
mySocket->ReceiveDataOnly(&t,sizeof(t));
|
||||
#ifdef VERBOSE
|
||||
cout << "Detector type is "<< t << endl;
|
||||
#endif
|
||||
} else {
|
||||
s->ReceiveDataOnly(m,sizeof(m));
|
||||
mySocket->ReceiveDataOnly(m,sizeof(m));
|
||||
std::cout<< "Detector returned error: " << m << std::endl;
|
||||
}
|
||||
s->Disconnect();
|
||||
mySocket->Disconnect();
|
||||
} else {
|
||||
cout << "Cannot connect to server " << name << " over port " << cport << endl;
|
||||
}
|
||||
delete s;
|
||||
delete mySocket;
|
||||
return t;
|
||||
}
|
||||
|
||||
@ -1749,7 +1779,7 @@ string slsDetector::checkOnline() {
|
||||
controlSocket->SetTimeOut(5);
|
||||
thisDetector->onlineFlag=OFFLINE_FLAG;
|
||||
delete controlSocket;
|
||||
controlSocket=NULL;
|
||||
controlSocket=0;
|
||||
retval = string(thisDetector->hostname);
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "offline!" << std::endl;
|
||||
@ -1769,7 +1799,7 @@ string slsDetector::checkOnline() {
|
||||
stopSocket->SetTimeOut(5);
|
||||
thisDetector->onlineFlag=OFFLINE_FLAG;
|
||||
delete stopSocket;
|
||||
stopSocket=NULL;
|
||||
stopSocket=0;
|
||||
retval = string(thisDetector->hostname);
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "stop offline!" << std::endl;
|
||||
@ -1802,11 +1832,11 @@ int slsDetector::setTCPSocket(string const name, int const control_port, int con
|
||||
strcpy(thisDetector->hostname,thisName);
|
||||
if (controlSocket) {
|
||||
delete controlSocket;
|
||||
controlSocket=NULL;
|
||||
controlSocket=0;
|
||||
}
|
||||
if (stopSocket) {
|
||||
delete stopSocket;
|
||||
stopSocket=NULL;
|
||||
stopSocket=0;
|
||||
}
|
||||
} else
|
||||
strcpy(thisName,thisDetector->hostname);
|
||||
@ -1819,7 +1849,7 @@ int slsDetector::setTCPSocket(string const name, int const control_port, int con
|
||||
thisDetector->controlPort=thisCP;
|
||||
if (controlSocket) {
|
||||
delete controlSocket;
|
||||
controlSocket=NULL;
|
||||
controlSocket=0;
|
||||
}
|
||||
} else
|
||||
thisCP=thisDetector->controlPort;
|
||||
@ -1832,46 +1862,50 @@ int slsDetector::setTCPSocket(string const name, int const control_port, int con
|
||||
thisDetector->stopPort=thisSP;
|
||||
if (stopSocket) {
|
||||
delete stopSocket;
|
||||
stopSocket=NULL;
|
||||
stopSocket=0;
|
||||
}
|
||||
} else
|
||||
thisSP=thisDetector->stopPort;
|
||||
|
||||
|
||||
// create control socket
|
||||
if (!controlSocket) {
|
||||
controlSocket= new MySocketTCP(thisName, thisCP);
|
||||
if (controlSocket->getErrorStatus()){
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Could not connect Control socket " << thisName << " "
|
||||
<< thisCP << std::endl;
|
||||
#endif
|
||||
delete controlSocket;
|
||||
controlSocket=NULL;
|
||||
retval=FAIL;
|
||||
}
|
||||
try {
|
||||
controlSocket = new MySocketTCP(thisName, thisCP);
|
||||
#ifdef VERYVERBOSE
|
||||
else
|
||||
std::cout<< "Control socket connected " <<thisName << " " << thisCP
|
||||
<< std::endl;
|
||||
std::cout<< "Control socket connected " <<
|
||||
thisName << " " << thisCP << std::endl;
|
||||
#endif
|
||||
} catch(...) {
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Could not connect Control socket " <<
|
||||
thisName << " " << thisCP << std::endl;
|
||||
#endif
|
||||
controlSocket = 0;
|
||||
retval = FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// create stop socket
|
||||
if (!stopSocket) {
|
||||
stopSocket=new MySocketTCP(thisName, thisSP);
|
||||
if (stopSocket->getErrorStatus()){
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Could not connect Stop socket "<<thisName << " " << thisSP
|
||||
<< std::endl;
|
||||
#endif
|
||||
delete stopSocket;
|
||||
stopSocket=NULL;
|
||||
retval=FAIL;
|
||||
}
|
||||
try {
|
||||
stopSocket = new MySocketTCP(thisName, thisSP);
|
||||
#ifdef VERYVERBOSE
|
||||
else
|
||||
std::cout<< "Stop socket connected " << thisName << " " << thisSP
|
||||
<< std::endl;
|
||||
std::cout<< "Stop socket connected " <<
|
||||
thisName << " " << thisSP << std::endl;
|
||||
#endif
|
||||
} catch(...) {
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Could not connect Stop socket " <<
|
||||
thisName << " " << thisSP << std::endl;
|
||||
#endif
|
||||
stopSocket = 0;
|
||||
retval = FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (retval!=FAIL) {
|
||||
checkOnline();
|
||||
|
||||
@ -1909,7 +1943,7 @@ int slsDetector::setPort(portType index, int num) {
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
int ret=FAIL;
|
||||
bool online=false;
|
||||
MySocketTCP *s;
|
||||
MySocketTCP *s = 0;
|
||||
|
||||
if (num>1024) {
|
||||
switch(index) {
|
||||
@ -1921,7 +1955,7 @@ int slsDetector::setPort(portType index, int num) {
|
||||
cout << thisDetector->controlPort<< " " << " " << thisDetector->stopPort
|
||||
<< endl;
|
||||
#endif
|
||||
if (s==NULL) {
|
||||
if (s==0) {
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "s=NULL"<< endl;
|
||||
@ -1959,7 +1993,7 @@ int slsDetector::setPort(portType index, int num) {
|
||||
s=dataSocket;
|
||||
retval=thisDetector->receiverTCPPort;
|
||||
if(strcmp(thisDetector->receiver_hostname,"none")){
|
||||
if (s==NULL) setReceiverTCPSocket("",retval);
|
||||
if (s==0) setReceiverTCPSocket("",retval);
|
||||
if (dataSocket)s=dataSocket;
|
||||
}
|
||||
online = (thisDetector->receiverOnlineFlag==ONLINE_FLAG);
|
||||
@ -1979,7 +2013,7 @@ int slsDetector::setPort(portType index, int num) {
|
||||
case STOP_PORT:
|
||||
s=stopSocket;
|
||||
retval=thisDetector->stopPort;
|
||||
if (s==NULL) setTCPSocket("",-1,DEFAULT_PORTNO+1);
|
||||
if (s==0) setTCPSocket("",-1,DEFAULT_PORTNO+1);
|
||||
if (stopSocket) s=stopSocket;
|
||||
else setTCPSocket("",-1,retval);
|
||||
online = (thisDetector->onlineFlag==ONLINE_FLAG);
|
||||
@ -1996,7 +2030,7 @@ int slsDetector::setPort(portType index, int num) {
|
||||
break;
|
||||
|
||||
default:
|
||||
s=NULL;
|
||||
s=0;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2281,63 +2315,51 @@ int slsDetector::updateDetectorNoWait() {
|
||||
n += controlSocket->ReceiveDataOnly( &nm,sizeof(nm));
|
||||
thisDetector->dataBytes=nm;
|
||||
|
||||
//t=setSettings(GET_SETTINGS);
|
||||
n += controlSocket->ReceiveDataOnly( &t,sizeof(t));
|
||||
thisDetector->currentSettings=t;
|
||||
|
||||
if((thisDetector->myDetectorType == EIGER) ||
|
||||
(thisDetector->myDetectorType == MYTHEN)){
|
||||
//thr=getThresholdEnergy();
|
||||
n += controlSocket->ReceiveDataOnly( &thr,sizeof(thr));
|
||||
thisDetector->currentThresholdEV=thr;
|
||||
}
|
||||
|
||||
//retval=setFrames(tns);
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[FRAME_NUMBER]=retval;
|
||||
|
||||
// retval=setExposureTime(tns);
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[ACQUISITION_TIME]=retval;
|
||||
|
||||
if(thisDetector->myDetectorType == EIGER){
|
||||
//retval=setSubFrameExposureTime(tns);
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME]=retval;
|
||||
|
||||
//retval=setSubFramePeriod(tns);
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[SUBFRAME_PERIOD]=retval;
|
||||
thisDetector->timerValue[SUBFRAME_DEADTIME]=retval;
|
||||
}
|
||||
|
||||
//retval=setPeriod(tns);
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[FRAME_PERIOD]=retval;
|
||||
|
||||
if(thisDetector->myDetectorType != EIGER) {
|
||||
//retval=setDelay(tns);
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[DELAY_AFTER_TRIGGER]=retval;
|
||||
}
|
||||
|
||||
// retval=setGates(tns);
|
||||
if ((thisDetector->myDetectorType != JUNGFRAU) &&
|
||||
(thisDetector->myDetectorType != EIGER)){
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[GATES_NUMBER]=retval;
|
||||
}
|
||||
|
||||
//retval=setProbes(tns);
|
||||
if (thisDetector->myDetectorType == MYTHEN){
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[PROBES_NUMBER]=retval;
|
||||
}
|
||||
|
||||
//retval=setTrains(tns);
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
thisDetector->timerValue[CYCLES_NUMBER]=retval;
|
||||
|
||||
//retval=setProbes(tns);
|
||||
if (thisDetector->myDetectorType == JUNGFRAUCTB){
|
||||
n += controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
|
||||
if (retval>=0)
|
||||
@ -2346,10 +2368,7 @@ int slsDetector::updateDetectorNoWait() {
|
||||
|
||||
thisDetector->roFlags=ro;
|
||||
|
||||
//retval=setProbes(tns);
|
||||
getTotalNumberOfChannels();
|
||||
// thisDetector->dataBytes=getTotalNumberOfChannels()*
|
||||
//thisDetector->dynamicRange/8*thisDetector->timerValue[SAMPLES_JCTB];
|
||||
}
|
||||
|
||||
|
||||
@ -3673,7 +3692,6 @@ int slsDetector::cleanupAcquisition() {
|
||||
|
||||
int slsDetector::startAcquisition() {
|
||||
|
||||
|
||||
int fnum=F_START_ACQUISITION;
|
||||
int ret=FAIL;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
@ -3696,9 +3714,6 @@ int slsDetector::startAcquisition() {
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -3743,6 +3758,35 @@ int slsDetector::stopAcquisition() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
int slsDetector::sendSoftwareTrigger() {
|
||||
|
||||
int fnum=F_SOFTWARE_TRIGGER;
|
||||
int ret=FAIL;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Sending software trigger "<< std::endl;
|
||||
#endif
|
||||
thisDetector->stoppedFlag=0;
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
if (connectControl() == OK){
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==FAIL) {
|
||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||
}
|
||||
disconnectControl();
|
||||
if (ret==FORCE_UPDATE)
|
||||
updateDetector();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int slsDetector::startReadOut() {
|
||||
|
||||
int fnum=F_START_READOUT;
|
||||
@ -3848,7 +3892,7 @@ int* slsDetector::getDataFromDetector(int *retval) {
|
||||
|
||||
int nodatadetectortype = false;
|
||||
detectorType types = getDetectorsType();
|
||||
if(types == EIGER || types == JUNGFRAU){
|
||||
if(types == EIGER || types == JUNGFRAU || GOTTHARD || PROPIX){
|
||||
nodatadetectortype = true;
|
||||
}
|
||||
|
||||
@ -3989,7 +4033,7 @@ int slsDetector::readAllNoWait() {
|
||||
int slsDetector::configureMAC() {
|
||||
int i;
|
||||
int ret=FAIL;
|
||||
int fnum=F_CONFIGURE_MAC,fnum2=F_RECEIVER_SHORT_FRAME;
|
||||
int fnum=F_CONFIGURE_MAC;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
char arg[6][50];memset(arg,0,sizeof(char)*6*50);
|
||||
int retval=-1;
|
||||
@ -4002,14 +4046,10 @@ int slsDetector::configureMAC() {
|
||||
if (thisDetector->myDetectorType == JUNGFRAU ||
|
||||
thisDetector->myDetectorType == EIGER) {
|
||||
sendpos = true;
|
||||
int max = multiDet->getNumberOfDetectors(X);
|
||||
if(!detId) {
|
||||
pos[0] = 0;
|
||||
pos[1] = 0;
|
||||
} else {
|
||||
pos[1] = detId / max;
|
||||
pos[0] = (detId % max) * ((thisDetector->myDetectorType == EIGER) ? 2 : 1); // for horiz. udp ports
|
||||
}
|
||||
int max = multiDet->getNumberOfDetectors(Y);
|
||||
|
||||
pos[0] = (detId % max); // row
|
||||
pos[1] = (detId / max) * ((thisDetector->myDetectorType == EIGER) ? 2 : 1);// col for horiz. udp ports
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
cout << "SLS [" << detId << "] - (" << pos[0] << "," << pos[1] << "," <<
|
||||
@ -4193,27 +4233,6 @@ int slsDetector::configureMAC() {
|
||||
std::cout<< "Configuring MAC failed " << std::endl;
|
||||
setErrorMask((getErrorMask())|(COULD_NOT_CONFIGURE_MAC));
|
||||
}
|
||||
else if (thisDetector->myDetectorType==GOTTHARD){
|
||||
//set frames per file - only for gotthard
|
||||
pthread_mutex_lock(&ms);
|
||||
if(retval==-1)
|
||||
setFramesPerFile(MAX_FRAMES_PER_FILE);
|
||||
else
|
||||
setFramesPerFile(SHORT_MAX_FRAMES_PER_FILE);
|
||||
pthread_mutex_unlock(&ms);
|
||||
//connect to receiver
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending adc val to receiver " << retval << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->sendInt(fnum2,retval,retval);
|
||||
disconnectData();
|
||||
}
|
||||
if(ret==FAIL)
|
||||
setErrorMask((getErrorMask())|(COULD_NOT_CONFIGURE_MAC));
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -4328,7 +4347,7 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t, int imod) {
|
||||
//send acquisiton time/period/subexptime/frame/cycles/samples to receiver
|
||||
if((index==FRAME_NUMBER)||(index==FRAME_PERIOD)||(index==CYCLES_NUMBER)||
|
||||
(index==ACQUISITION_TIME) || (index==SUBFRAME_ACQUISITION_TIME) ||
|
||||
(index==SUBFRAME_PERIOD) ||
|
||||
(index==SUBFRAME_DEADTIME) ||
|
||||
(index==SAMPLES_JCTB) || (index==STORAGE_CELL_NUMBER)){
|
||||
string timername = getTimerType(index);
|
||||
if(ret != FAIL){
|
||||
@ -4379,7 +4398,7 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t, int imod) {
|
||||
setErrorMask((getErrorMask())|(RECEIVER_ACQ_PERIOD_NOT_SET));
|
||||
break;
|
||||
case SUBFRAME_ACQUISITION_TIME:
|
||||
case SUBFRAME_PERIOD:
|
||||
case SUBFRAME_DEADTIME:
|
||||
case SAMPLES_JCTB:
|
||||
setErrorMask((getErrorMask())|(RECEIVER_TIMER_NOT_SET));
|
||||
break;
|
||||
@ -4399,7 +4418,7 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t, int imod) {
|
||||
|
||||
|
||||
|
||||
int64_t slsDetector::getTimeLeft(timerIndex index) {
|
||||
int64_t slsDetector::getTimeLeft(timerIndex index, int imod) {
|
||||
|
||||
|
||||
int fnum=F_GET_TIME_LEFT;
|
||||
@ -5524,9 +5543,14 @@ string slsDetector::setReceiver(string receiverIP) {
|
||||
std::cout << "frame number:" << thisDetector->timerValue[FRAME_NUMBER] << endl;
|
||||
std::cout << "sub exp time:" << thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME]
|
||||
<< endl;
|
||||
std::cout << "sub period:" << thisDetector->timerValue[SUBFRAME_PERIOD] << endl;
|
||||
std::cout << "sub dead time:" << thisDetector->timerValue[SUBFRAME_DEADTIME] << endl;
|
||||
std::cout << "dynamic range:" << thisDetector->dynamicRange << endl;
|
||||
std::cout << "flippeddatax:" << thisDetector->flippedData[X] << endl;
|
||||
if (thisDetector->myDetectorType == EIGER) {
|
||||
std::cout << "activated: " << thisDetector->activated << endl;
|
||||
std::cout << "receiver deactivated padding: " << thisDetector->receiver_deactivatedPaddingEnable << endl;
|
||||
}
|
||||
std::cout << "silent Mode:" << thisDetector->receiver_silentMode << endl;
|
||||
std::cout << "10GbE:" << thisDetector->tenGigaEnable << endl;
|
||||
std::cout << "Gap pixels: " << thisDetector->gappixels << endl;
|
||||
std::cout << "rx streaming source ip:" << thisDetector->receiver_zmqip << endl;
|
||||
@ -5538,8 +5562,7 @@ string slsDetector::setReceiver(string receiverIP) {
|
||||
|
||||
#endif
|
||||
if(setDetectorType()!= GENERIC){
|
||||
if(!detId)
|
||||
sendMultiDetectorSize();
|
||||
sendMultiDetectorSize();
|
||||
setDetectorId();
|
||||
setDetectorHostname();
|
||||
setUDPConnection();
|
||||
@ -5566,7 +5589,7 @@ string slsDetector::setReceiver(string receiverIP) {
|
||||
if(thisDetector->myDetectorType == EIGER) {
|
||||
setTimer(SUBFRAME_ACQUISITION_TIME,
|
||||
thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME]);
|
||||
setTimer(SUBFRAME_PERIOD,thisDetector->timerValue[SUBFRAME_PERIOD]);
|
||||
setTimer(SUBFRAME_DEADTIME,thisDetector->timerValue[SUBFRAME_DEADTIME]);
|
||||
}
|
||||
if(thisDetector->myDetectorType == JUNGFRAUCTB)
|
||||
setTimer(SAMPLES_JCTB,thisDetector->timerValue[SAMPLES_JCTB]);
|
||||
@ -5574,7 +5597,9 @@ string slsDetector::setReceiver(string receiverIP) {
|
||||
if(thisDetector->myDetectorType == EIGER){
|
||||
setFlippedData(X,-1);
|
||||
activate(-1);
|
||||
setDeactivatedRxrPaddingMode(thisDetector->receiver_deactivatedPaddingEnable);
|
||||
}
|
||||
setReceiverSilentMode(thisDetector->receiver_silentMode);
|
||||
|
||||
if(thisDetector->myDetectorType == EIGER)
|
||||
enableTenGigabitEthernet(thisDetector->tenGigaEnable);
|
||||
@ -5587,6 +5612,9 @@ string slsDetector::setReceiver(string receiverIP) {
|
||||
setReceiverStreamingIP(getReceiverStreamingIP());
|
||||
setAdditionalJsonHeader(getAdditionalJsonHeader());
|
||||
enableDataStreamingFromReceiver(enableDataStreamingFromReceiver(-1));
|
||||
|
||||
if(thisDetector->myDetectorType == GOTTHARD)
|
||||
sendROI(-1, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6401,6 +6429,7 @@ int slsDetector::setROI(int n,ROI roiLimits[]) {
|
||||
setErrorMask((getErrorMask())|(COULDNOT_SET_ROI));
|
||||
|
||||
|
||||
if(thisDetector->myDetectorType==JUNGFRAUCTB) getTotalNumberOfChannels();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -6493,17 +6522,39 @@ int slsDetector::sendROI(int n,ROI roiLimits[]) {
|
||||
}
|
||||
|
||||
//update client
|
||||
if(ret!=FAIL){
|
||||
if(ret==FAIL){
|
||||
setErrorMask((getErrorMask())|(COULDNOT_SET_ROI));
|
||||
} else {
|
||||
for(int i=0;i<retvalsize;++i)
|
||||
thisDetector->roiLimits[i]=retval[i];
|
||||
thisDetector->nROI = retvalsize;
|
||||
}
|
||||
|
||||
//#ifdef VERBOSE
|
||||
#ifdef VERBOSE
|
||||
for(int j=0;j<thisDetector->nROI;++j)
|
||||
cout<<"get"<< roiLimits[j].xmin<<"\t"<<roiLimits[j].xmax<<"\t"
|
||||
<<roiLimits[j].ymin<<"\t"<<roiLimits[j].ymax<<endl;
|
||||
//#endif
|
||||
cout<<"ROI [" <<j<<"] ("<< roiLimits[j].xmin<<"\t"<<roiLimits[j].xmax<<"\t"
|
||||
<<roiLimits[j].ymin<<"\t"<<roiLimits[j].ymax<<")"<<endl;
|
||||
#endif
|
||||
|
||||
// old firmware requires configuremac after setting roi
|
||||
if (thisDetector->myDetectorType == GOTTHARD) {
|
||||
configureMAC();
|
||||
}
|
||||
|
||||
// update roi in receiver
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
int fnum=F_RECEIVER_SET_ROI;
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending ROI to receiver " << thisDetector->nROI << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->sendROI(fnum, thisDetector->nROI, thisDetector->roiLimits);
|
||||
disconnectData();
|
||||
}
|
||||
if(ret==FAIL)
|
||||
setErrorMask((getErrorMask())|(COULDNOT_SET_ROI));
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -6561,7 +6612,7 @@ int slsDetector::activate(int const enable) {
|
||||
int retval = -1;
|
||||
int arg = enable;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
int ret = OK;
|
||||
int ret = FAIL;
|
||||
|
||||
if(thisDetector->myDetectorType != EIGER){
|
||||
std::cout<< "Not implemented for this detector" << std::endl;
|
||||
@ -6588,6 +6639,7 @@ int slsDetector::activate(int const enable) {
|
||||
setErrorMask((getErrorMask())|(DETECTOR_ACTIVATE));
|
||||
} else {
|
||||
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
thisDetector->activated = retval;
|
||||
}
|
||||
disconnectControl();
|
||||
if (ret==FORCE_UPDATE)
|
||||
@ -6604,12 +6656,13 @@ int slsDetector::activate(int const enable) {
|
||||
#endif
|
||||
|
||||
if(ret!=FAIL){
|
||||
int arg = thisDetector->activated;
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Activating/Deactivating Receiver: " << retval << std::endl;
|
||||
std::cout << "Activating/Deactivating Receiver: " << arg << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->sendInt(fnum2,retval,retval);
|
||||
ret=thisReceiver->sendInt(fnum2,retval,arg);
|
||||
disconnectData();
|
||||
}
|
||||
if(ret==FAIL)
|
||||
@ -6626,12 +6679,44 @@ int slsDetector::activate(int const enable) {
|
||||
#endif
|
||||
|
||||
|
||||
return retval;
|
||||
return thisDetector->activated;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int slsDetector::setDeactivatedRxrPaddingMode(int padding) {
|
||||
int fnum = F_RECEIVER_DEACTIVATED_PADDING_ENABLE;
|
||||
int retval = -1;
|
||||
int arg = padding;
|
||||
int ret = OK;
|
||||
|
||||
if(thisDetector->myDetectorType != EIGER){
|
||||
std::cout<< "Not implemented for this detector" << std::endl;
|
||||
setErrorMask((getErrorMask())|(RECEIVER_ACTIVATE));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Deactivated Receiver Padding Enable: " << arg << std::endl;
|
||||
#endif
|
||||
if (connectData() == OK){
|
||||
ret=thisReceiver->sendInt(fnum,retval,arg);
|
||||
disconnectData();
|
||||
}
|
||||
if(ret==FAIL)
|
||||
setErrorMask((getErrorMask())|(RECEIVER_ACTIVATE));
|
||||
else
|
||||
thisDetector->receiver_deactivatedPaddingEnable = retval;
|
||||
}
|
||||
|
||||
return thisDetector->receiver_deactivatedPaddingEnable;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int slsDetector::getFlippedData(dimension d) {
|
||||
return thisDetector->flippedData[d];
|
||||
}
|
||||
@ -8662,7 +8747,7 @@ string slsDetector::checkReceiverOnline() {
|
||||
dataSocket->SetTimeOut(5);
|
||||
thisDetector->receiverOnlineFlag=OFFLINE_FLAG;
|
||||
delete dataSocket;
|
||||
dataSocket=NULL;
|
||||
dataSocket=0;
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "receiver offline!" << std::endl;
|
||||
#endif
|
||||
@ -8699,7 +8784,7 @@ int slsDetector::setReceiverTCPSocket(string const name, int const receiver_port
|
||||
strcpy(thisDetector->receiver_hostname,thisName);
|
||||
if (dataSocket){
|
||||
delete dataSocket;
|
||||
dataSocket=NULL;
|
||||
dataSocket=0;
|
||||
}
|
||||
} else
|
||||
strcpy(thisName,thisDetector->receiver_hostname);
|
||||
@ -8713,28 +8798,30 @@ int slsDetector::setReceiverTCPSocket(string const name, int const receiver_port
|
||||
thisDetector->receiverTCPPort=thisRP;
|
||||
if (dataSocket){
|
||||
delete dataSocket;
|
||||
dataSocket=NULL;
|
||||
dataSocket=0;
|
||||
}
|
||||
} else
|
||||
thisRP=thisDetector->receiverTCPPort;
|
||||
|
||||
//create data socket
|
||||
if (!dataSocket) {
|
||||
dataSocket=new MySocketTCP(thisName, thisRP);
|
||||
if (dataSocket->getErrorStatus()){
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Could not connect Data socket "<<thisName << " " <<
|
||||
thisRP << std::endl;
|
||||
#endif
|
||||
delete dataSocket;
|
||||
dataSocket=NULL;
|
||||
retval=FAIL;
|
||||
}
|
||||
try {
|
||||
dataSocket = new MySocketTCP(thisName, thisRP);
|
||||
#ifdef VERYVERBOSE
|
||||
else
|
||||
std::cout<< "Data socket connected "<< thisName << " " << thisRP << std::endl;
|
||||
std::cout<< "Data socket connected " <<
|
||||
thisName << " " << thisRP << std::endl;
|
||||
#endif
|
||||
} catch(...) {
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Could not connect Data socket " <<
|
||||
thisName << " " << thisRP << std::endl;
|
||||
#endif
|
||||
dataSocket = 0;
|
||||
retval = FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//check if it connects
|
||||
if (retval!=FAIL) {
|
||||
checkReceiverOnline();
|
||||
@ -8918,7 +9005,17 @@ int slsDetector::updateReceiverNoWait() {
|
||||
n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind));
|
||||
thisDetector->receiver_upstream = ind;
|
||||
|
||||
// activate
|
||||
n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind));
|
||||
thisDetector->activated = ind;
|
||||
|
||||
// deactivated padding enable
|
||||
n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind));
|
||||
thisDetector->receiver_deactivatedPaddingEnable = ind;
|
||||
|
||||
// silent mode
|
||||
n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind));
|
||||
thisDetector->receiver_silentMode = ind;
|
||||
|
||||
if (!n) printf("n: %d\n", n);
|
||||
|
||||
@ -9341,13 +9438,6 @@ int slsDetector::startReceiver() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// tell detector to send to receiver (if start receiver failed, this is not executed)
|
||||
if(((thisDetector->myDetectorType == GOTTHARD ||
|
||||
thisDetector->myDetectorType == PROPIX) && ret!= FAIL))
|
||||
return prepareAcquisition(); // send data to receiver for these detectors
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -9359,11 +9449,6 @@ int slsDetector::stopReceiver() {
|
||||
int ret = FAIL;
|
||||
char mess[MAX_STR_LENGTH] = "";
|
||||
|
||||
if(thisDetector->myDetectorType == GOTTHARD ||
|
||||
thisDetector->myDetectorType == PROPIX)
|
||||
cleanupAcquisition(); // reset (send data to receiver) for these detectors,
|
||||
//so back to CPU (dont care about ok/fail at this point)
|
||||
|
||||
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Stopping Receiver " << std::endl;
|
||||
@ -9843,8 +9928,10 @@ int slsDetector::setReceiverSilentMode(int i) {
|
||||
}
|
||||
if(ret==FAIL)
|
||||
setErrorMask((getErrorMask())|(RECEIVER_PARAMETER_NOT_SET));
|
||||
else
|
||||
thisDetector->receiver_silentMode = retval;
|
||||
}
|
||||
return retval;
|
||||
return thisDetector->receiver_silentMode;
|
||||
}
|
||||
|
||||
|
||||
|
@ -375,6 +375,15 @@ private:
|
||||
/** receiver partial frames padding enable */
|
||||
bool receiver_framePadding;
|
||||
|
||||
/** activated receiver */
|
||||
bool activated;
|
||||
|
||||
/** padding enable in deactivated receiver */
|
||||
bool receiver_deactivatedPaddingEnable;
|
||||
|
||||
/** silent receiver */
|
||||
bool receiver_silentMode;
|
||||
|
||||
} sharedSlsDetector;
|
||||
|
||||
|
||||
@ -510,7 +519,7 @@ public:
|
||||
* @param pos insignificant
|
||||
* @returns hostname
|
||||
*/
|
||||
string getHostname(int pos = -1);
|
||||
std::string getHostname(int pos = -1);
|
||||
|
||||
/**
|
||||
* Appends detectors to the end of the list in shared memory
|
||||
@ -573,7 +582,7 @@ public:
|
||||
* @param type string of detector type
|
||||
* @returns detector type in receiver
|
||||
*/
|
||||
int setDetectorType(string stype);
|
||||
int setDetectorType(std::string stype);
|
||||
|
||||
/**
|
||||
* Get Detector type from shared memory variable
|
||||
@ -587,14 +596,14 @@ public:
|
||||
* @param pos insignificant
|
||||
* @returns string version of detector type from shared memory variable
|
||||
*/
|
||||
string sgetDetectorsType(int pos=-1);
|
||||
std::string sgetDetectorsType(int pos=-1);
|
||||
|
||||
/**
|
||||
* Just to overload getDetectorType from users
|
||||
* Gets string version of detector type from shared memory variable
|
||||
* @returns gets string version of detector type from shared memory variable
|
||||
*/
|
||||
string getDetectorType();
|
||||
std::string getDetectorType();
|
||||
|
||||
/**
|
||||
* Returns number of modules from shared memory (Mythen)
|
||||
@ -759,7 +768,7 @@ public:
|
||||
* @returns empty string if it is online
|
||||
* else returns hostnameif it is offline
|
||||
*/
|
||||
string checkOnline();
|
||||
std::string checkOnline();
|
||||
|
||||
/**
|
||||
* Configure the TCP socket communciation and initializes the socket instances
|
||||
@ -769,7 +778,7 @@ public:
|
||||
* @returns OK or FAIL
|
||||
* \sa sharedSlsDetector
|
||||
*/
|
||||
int setTCPSocket(string const name="", int const control_port=-1, int const stop_port=-1);
|
||||
int setTCPSocket(std::string const name="", int const control_port=-1, int const stop_port=-1);
|
||||
|
||||
|
||||
/**
|
||||
@ -793,7 +802,7 @@ public:
|
||||
int getStopPort();
|
||||
|
||||
/**
|
||||
* Returns the receiver TCP port \sa sharedSlsDetector
|
||||
* Returns the receiver TCP port \sa sharedSlsDetector
|
||||
* @returns the receiver TCP port
|
||||
*/
|
||||
int getReceiverPort();
|
||||
@ -809,7 +818,7 @@ public:
|
||||
* Get last client IP saved on detector server
|
||||
* @returns last client IP saved on detector server
|
||||
*/
|
||||
string getLastClientIP();
|
||||
std::string getLastClientIP();
|
||||
|
||||
/**
|
||||
* Exit detector server
|
||||
@ -824,7 +833,7 @@ public:
|
||||
* @param answer is the answer from the detector
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int execCommand(string cmd, string answer);
|
||||
int execCommand(std::string cmd, std::string answer);
|
||||
|
||||
/**
|
||||
* Updates some of the shared memory receiving the data from the detector
|
||||
@ -845,14 +854,14 @@ public:
|
||||
* @param fname configuration file name
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int readConfigurationFile(string const fname);
|
||||
int readConfigurationFile(std::string const fname);
|
||||
|
||||
/**
|
||||
* Load configuration from a stream
|
||||
* @param infile stream
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int readConfigurationFile(ifstream &infile);
|
||||
int readConfigurationFile(std::ifstream &infile);
|
||||
|
||||
/**
|
||||
* Write current configuration to a file
|
||||
@ -860,7 +869,7 @@ public:
|
||||
* @param fname configuration file name
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int writeConfigurationFile(string const fname);
|
||||
int writeConfigurationFile(std::string const fname);
|
||||
|
||||
/**
|
||||
* Write current configuration to a stream
|
||||
@ -868,13 +877,13 @@ public:
|
||||
* @param id detector id
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int writeConfigurationFile(ofstream &outfile, int id=-1);
|
||||
int writeConfigurationFile(std::ofstream &outfile, int id=-1);
|
||||
|
||||
/**
|
||||
* Returns the trimfile or settings file name (Useless??)
|
||||
* @returns the trimfile or settings file name
|
||||
*/
|
||||
string getSettingsFile();
|
||||
std::string getSettingsFile();
|
||||
|
||||
/**
|
||||
* Writes a trim/settings file for module number imod,
|
||||
@ -887,7 +896,7 @@ public:
|
||||
* \sa ::sls_detector_module sharedSlsDetector mythenDetector::writeSettingsFile(string, int)
|
||||
*/
|
||||
using energyConversion::writeSettingsFile;
|
||||
int writeSettingsFile(string fname, int imod, int iodelay, int tau);
|
||||
int writeSettingsFile(std::string fname, int imod, int iodelay, int tau);
|
||||
|
||||
/**
|
||||
* Get detector settings
|
||||
@ -956,7 +965,7 @@ public:
|
||||
* @param s trimbits/settings directory
|
||||
* @returns the trimbit/settings directory
|
||||
*/
|
||||
std::string setSettingsDir(string s);
|
||||
std::string setSettingsDir(std::string s);
|
||||
|
||||
/**
|
||||
* Returns the calibration files directory \sa sharedSlsDetector (Mythen)
|
||||
@ -969,7 +978,7 @@ public:
|
||||
* @param s the calibration files directory
|
||||
* @returns the calibration files directory
|
||||
*/
|
||||
std::string setCalDir(string s);
|
||||
std::string setCalDir(std::string s);
|
||||
|
||||
/**
|
||||
* Loads the modules settings/trimbits reading from a specific file
|
||||
@ -979,7 +988,7 @@ public:
|
||||
* from which will be calculated the detector index and the module index (-1 for all)
|
||||
* returns OK or FAIL
|
||||
*/
|
||||
int loadSettingsFile(string fname, int imod=-1);
|
||||
int loadSettingsFile(std::string fname, int imod=-1);
|
||||
|
||||
/**
|
||||
* Saves the modules settings/trimbits to a specific file
|
||||
@ -988,7 +997,7 @@ public:
|
||||
* @param imod module number (-1 for all)
|
||||
* returns OK or FAIL
|
||||
*/
|
||||
int saveSettingsFile(string fname, int imod=-1);
|
||||
int saveSettingsFile(std::string fname, int imod=-1);
|
||||
|
||||
/**
|
||||
* Loads the modules calibration data reading from a specific file (Mythen)
|
||||
@ -997,7 +1006,7 @@ public:
|
||||
* @param imod module number (-1 for all)
|
||||
* returns OK or FAIL
|
||||
*/
|
||||
int loadCalibrationFile(string fname, int imod=-1);
|
||||
int loadCalibrationFile(std::string fname, int imod=-1);
|
||||
|
||||
/**
|
||||
* Saves the modules calibration data to a specific file (Mythen)
|
||||
@ -1006,7 +1015,7 @@ public:
|
||||
* @param imod module number (-1 for all)
|
||||
* returns OK or FAIL
|
||||
*/
|
||||
int saveCalibrationFile(string fname, int imod=-1);
|
||||
int saveCalibrationFile(std::string fname, int imod=-1);
|
||||
|
||||
/**
|
||||
* Sets/gets the detector in position i as master of the structure (Mythen)
|
||||
@ -1069,6 +1078,12 @@ public:
|
||||
*/
|
||||
int stopAcquisition();
|
||||
|
||||
/**
|
||||
* Give an internal software trigger to the detector (Eiger only)
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int sendSoftwareTrigger();
|
||||
|
||||
/**
|
||||
* Start readout (without exposure or interrupting exposure) (Mythen)
|
||||
* @returns OK or FAIL
|
||||
@ -1149,9 +1164,10 @@ public:
|
||||
* Set/get timer value left in acquisition (not all implemented for all detectors)
|
||||
* @param index timer index
|
||||
* @param t time in ns or number of...(e.g. frames, gates, probes)
|
||||
* @param imod module number
|
||||
* @returns timer set value in ns or number of...(e.g. frames, gates, probes)
|
||||
*/
|
||||
int64_t getTimeLeft(timerIndex index);
|
||||
int64_t getTimeLeft(timerIndex index, int imod = -1);
|
||||
|
||||
/**
|
||||
* Set speed
|
||||
@ -1259,94 +1275,94 @@ public:
|
||||
* @param s network parameter value
|
||||
* @returns network parameter value set (from getNetworkParameter)
|
||||
*/
|
||||
string setNetworkParameter(networkParameter index, string value);
|
||||
std::string setNetworkParameter(networkParameter index, std::string value);
|
||||
|
||||
/**
|
||||
* Get network parameter
|
||||
* @param p network parameter type
|
||||
* @returns network parameter value set (from getNetworkParameter)
|
||||
*/
|
||||
string getNetworkParameter(networkParameter index);
|
||||
std::string getNetworkParameter(networkParameter index);
|
||||
|
||||
/**
|
||||
* Returns the detector MAC address\sa sharedSlsDetector
|
||||
* @returns the detector MAC address
|
||||
*/
|
||||
string getDetectorMAC();
|
||||
std::string getDetectorMAC();
|
||||
|
||||
/**
|
||||
* Returns the detector IP address\sa sharedSlsDetector
|
||||
* @returns the detector IP address
|
||||
*/
|
||||
string getDetectorIP();
|
||||
std::string getDetectorIP();
|
||||
|
||||
/**
|
||||
* Returns the receiver IP address\sa sharedSlsDetector
|
||||
* @returns the receiver IP address
|
||||
*/
|
||||
string getReceiver();
|
||||
std::string getReceiver();
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP IP address\sa sharedSlsDetector
|
||||
* @returns the receiver UDP IP address
|
||||
*/
|
||||
string getReceiverUDPIP();
|
||||
std::string getReceiverUDPIP();
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP MAC address\sa sharedSlsDetector
|
||||
* @returns the receiver UDP MAC address
|
||||
*/
|
||||
string getReceiverUDPMAC();
|
||||
std::string getReceiverUDPMAC();
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP port\sa sharedSlsDetector
|
||||
* @returns the receiver UDP port
|
||||
*/
|
||||
string getReceiverUDPPort();
|
||||
std::string getReceiverUDPPort();
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP port 2 of same interface\sa sharedSlsDetector
|
||||
* @returns the receiver UDP port 2 of same interface
|
||||
*/
|
||||
string getReceiverUDPPort2();
|
||||
std::string getReceiverUDPPort2();
|
||||
|
||||
/**
|
||||
* Returns the client zmq port \sa sharedSlsDetector
|
||||
* @returns the client zmq port
|
||||
*/
|
||||
string getClientStreamingPort();
|
||||
std::string getClientStreamingPort();
|
||||
|
||||
/**
|
||||
* Returns the receiver zmq port \sa sharedSlsDetector
|
||||
* @returns the receiver zmq port
|
||||
*/
|
||||
string getReceiverStreamingPort();
|
||||
std::string getReceiverStreamingPort();
|
||||
|
||||
/**
|
||||
* Returns the client zmq ip \sa sharedSlsDetector
|
||||
* @returns the client zmq ip, returns "none" if default setting and no custom ip set
|
||||
*/
|
||||
string getClientStreamingIP();
|
||||
std::string getClientStreamingIP();
|
||||
|
||||
/**
|
||||
* Returns the receiver zmq ip \sa sharedSlsDetector
|
||||
* @returns the receiver zmq ip, returns "none" if default setting and no custom ip set
|
||||
*/
|
||||
string getReceiverStreamingIP();
|
||||
std::string getReceiverStreamingIP();
|
||||
|
||||
/**
|
||||
* Validates the format of the detector MAC address and sets it \sa sharedSlsDetector
|
||||
* @param detectorMAC detector MAC address
|
||||
* @returns the detector MAC address
|
||||
*/
|
||||
string setDetectorMAC(string detectorMAC);
|
||||
std::string setDetectorMAC(std::string detectorMAC);
|
||||
|
||||
/**
|
||||
* Validates the format of the detector IP address and sets it \sa sharedSlsDetector
|
||||
* @param detectorIP detector IP address
|
||||
* @returns the detector IP address
|
||||
*/
|
||||
string setDetectorIP(string detectorIP);
|
||||
std::string setDetectorIP(std::string detectorIP);
|
||||
|
||||
/**
|
||||
* Validates and sets the receiver.
|
||||
@ -1355,21 +1371,21 @@ public:
|
||||
* @param receiver receiver hostname or IP address
|
||||
* @returns the receiver IP address from shared memory
|
||||
*/
|
||||
string setReceiver(string receiver);
|
||||
std::string setReceiver(std::string receiver);
|
||||
|
||||
/**
|
||||
* Validates the format of the receiver UDP IP address and sets it \sa sharedSlsDetector
|
||||
* @param udpip receiver UDP IP address
|
||||
* @returns the receiver UDP IP address
|
||||
*/
|
||||
string setReceiverUDPIP(string udpip);
|
||||
std::string setReceiverUDPIP(std::string udpip);
|
||||
|
||||
/**
|
||||
* Validates the format of the receiver UDP MAC address and sets it \sa sharedSlsDetector
|
||||
* @param udpmac receiver UDP MAC address
|
||||
* @returns the receiver UDP MAC address
|
||||
*/
|
||||
string setReceiverUDPMAC(string udpmac);
|
||||
std::string setReceiverUDPMAC(std::string udpmac);
|
||||
|
||||
/**
|
||||
* Sets the receiver UDP port\sa sharedSlsDetector
|
||||
@ -1391,7 +1407,7 @@ public:
|
||||
* calculate individual ports)
|
||||
* @returns the client zmq port
|
||||
*/
|
||||
string setClientStreamingPort(string port);
|
||||
std::string setClientStreamingPort(std::string port);
|
||||
|
||||
/**
|
||||
* Sets the receiver zmq port\sa sharedSlsDetector
|
||||
@ -1399,21 +1415,21 @@ public:
|
||||
* calculate individual ports)
|
||||
* @returns the receiver zmq port
|
||||
*/
|
||||
string setReceiverStreamingPort(string port);
|
||||
std::string setReceiverStreamingPort(std::string port);
|
||||
|
||||
/**
|
||||
* Sets the client zmq ip\sa sharedSlsDetector
|
||||
* @param sourceIP client zmq ip
|
||||
* @returns the client zmq ip, returns "none" if default setting and no custom ip set
|
||||
*/
|
||||
string setClientStreamingIP(string sourceIP);
|
||||
std::string setClientStreamingIP(std::string sourceIP);
|
||||
|
||||
/**
|
||||
* Sets the receiver zmq ip\sa sharedSlsDetector
|
||||
* @param sourceIP receiver zmq ip. If empty, uses rx_hostname
|
||||
* @returns the receiver zmq ip, returns "none" if default setting and no custom ip set
|
||||
*/
|
||||
string setReceiverStreamingIP(string sourceIP);
|
||||
std::string setReceiverStreamingIP(std::string sourceIP);
|
||||
|
||||
/**
|
||||
* Execute a digital test (Gotthard, Mythen)
|
||||
@ -1439,7 +1455,7 @@ public:
|
||||
* @param fname file name from which to load image
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int loadImageToDetector(imageType index,string const fname);
|
||||
int loadImageToDetector(imageType index,std::string const fname);
|
||||
|
||||
/**
|
||||
* Called from loadImageToDetector to send the image to detector
|
||||
@ -1455,7 +1471,7 @@ public:
|
||||
* @param startACQ is 1 to start acquisition after reading counter
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int writeCounterBlockFile(string const fname,int startACQ=0);
|
||||
int writeCounterBlockFile(std::string const fname,int startACQ=0);
|
||||
|
||||
/**
|
||||
* Gets counter memory block in detector (Gotthard)
|
||||
@ -1519,11 +1535,18 @@ public:
|
||||
int writeAdcRegister(int addr, int val);
|
||||
|
||||
/**
|
||||
* Activates the detector (Eiger only)
|
||||
* Activates/Deactivates the detector (Eiger only)
|
||||
* @param enable active (1) or inactive (0), -1 gets
|
||||
* @returns 0 (inactive) or 1 (active)
|
||||
* @returns 0 (inactive) or 1 (active)for activate mode
|
||||
*/
|
||||
int activate(int const enable=GET_ONLINE_FLAG);
|
||||
int activate(int const enable=-1);
|
||||
|
||||
/**
|
||||
* Set deactivated Receiver padding mode (Eiger only)
|
||||
* @param padding padding option for deactivated receiver. Can be 1 (padding), 0 (no padding), -1 (gets)
|
||||
* @returns 1 (padding), 0 (no padding), -1 (inconsistent values) for padding option
|
||||
*/
|
||||
int setDeactivatedRxrPaddingMode(int padding=-1);
|
||||
|
||||
/**
|
||||
* Returns the enable if data will be flipped across x or y axis (Eiger)
|
||||
@ -1635,7 +1658,7 @@ public:
|
||||
* @param fname file name
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int programFPGA(string fname);
|
||||
int programFPGA(std::string fname);
|
||||
|
||||
/**
|
||||
* Resets FPGA (Jungfrau)
|
||||
@ -1822,7 +1845,7 @@ public:
|
||||
* @param fname name of the flat field file (or "" if disable)
|
||||
* @returns 0 if disable (or file could not be read), >0 otherwise
|
||||
*/
|
||||
int setFlatFieldCorrection(string fname="");
|
||||
int setFlatFieldCorrection(std::string fname="");
|
||||
|
||||
/**
|
||||
* Set flat field corrections (Mythen)
|
||||
@ -1857,7 +1880,7 @@ public:
|
||||
* @param fname file with bad channel list ("" disable)
|
||||
* @returns 0 if bad channel disabled, >0 otherwise
|
||||
*/
|
||||
int setBadChannelCorrection(string fname="");
|
||||
int setBadChannelCorrection(std::string fname="");
|
||||
|
||||
/**
|
||||
* Set bad channels correction (Mythen)
|
||||
@ -1882,7 +1905,7 @@ public:
|
||||
* @param fname file to be read
|
||||
* @returns 0 if angular conversion disabled, >0 otherwise
|
||||
*/
|
||||
int readAngularConversionFile(string fname="");
|
||||
int readAngularConversionFile(std::string fname="");
|
||||
|
||||
/**
|
||||
* Reads an angular conversion file (Mythen, Gotthard)
|
||||
@ -1890,7 +1913,7 @@ public:
|
||||
* @param ifs input stream
|
||||
* @returns 0 if angular conversion disabled, >0 otherwise
|
||||
*/
|
||||
int readAngularConversion(ifstream& ifs);
|
||||
int readAngularConversion(std::ifstream& ifs);
|
||||
|
||||
/**
|
||||
* Writes an angular conversion file (Mythen, Gotthard)
|
||||
@ -1898,7 +1921,7 @@ public:
|
||||
* @param fname file to be written
|
||||
* @returns 0 if angular conversion disabled, >0 otherwise
|
||||
*/
|
||||
int writeAngularConversion(string fname="");
|
||||
int writeAngularConversion(std::string fname="");
|
||||
|
||||
/**
|
||||
* Writes an angular conversion file (Mythen, Gotthard)
|
||||
@ -1906,7 +1929,7 @@ public:
|
||||
* @param ofs output stream
|
||||
* @returns 0 if angular conversion disabled, >0 otherwise
|
||||
*/
|
||||
int writeAngularConversion(ofstream &ofs);
|
||||
int writeAngularConversion(std::ofstream &ofs);
|
||||
|
||||
/**
|
||||
* Get angular conversion (Mythen, Gotthard)
|
||||
@ -1942,7 +1965,7 @@ public:
|
||||
* Checks if the receiver is really online
|
||||
* @returns empty string if online, else returns receiver hostname
|
||||
*/
|
||||
string checkReceiverOnline();
|
||||
std::string checkReceiverOnline();
|
||||
|
||||
/**
|
||||
* Configure the socket communication and initializes the socket instances
|
||||
@ -1951,7 +1974,7 @@ public:
|
||||
* @returns OK is connection succeded, FAIL otherwise
|
||||
* \sa sharedSlsDetector
|
||||
*/
|
||||
int setReceiverTCPSocket(string const name="", int const receiver_port=-1);
|
||||
int setReceiverTCPSocket(std::string const name="", int const receiver_port=-1);
|
||||
|
||||
/**
|
||||
* Locks/Unlocks the connection to the receiver
|
||||
@ -1964,7 +1987,7 @@ public:
|
||||
* Returns the IP of the last client connecting to the receiver
|
||||
* @returns the IP of the last client connecting to the receiver
|
||||
*/
|
||||
string getReceiverLastClientIP();
|
||||
std::string getReceiverLastClientIP();
|
||||
|
||||
/**
|
||||
* Exits the receiver TCP server
|
||||
@ -2005,27 +2028,27 @@ public:
|
||||
* Returns output file directory
|
||||
* @returns output file directory
|
||||
*/
|
||||
string getFilePath();
|
||||
std::string getFilePath();
|
||||
|
||||
/**
|
||||
* Sets up the file directory
|
||||
* @param s file directory
|
||||
* @returns file dir
|
||||
*/
|
||||
string setFilePath(string s="");
|
||||
std::string setFilePath(std::string s="");
|
||||
|
||||
/**
|
||||
* Returns file name prefix
|
||||
* @returns file name prefix
|
||||
*/
|
||||
string getFileName();
|
||||
std::string getFileName();
|
||||
|
||||
/**
|
||||
* Sets up the file name prefix
|
||||
* @param s file name prefix
|
||||
* @returns file name prefix
|
||||
*/
|
||||
string setFileName(string s="");
|
||||
std::string setFileName(std::string s="");
|
||||
|
||||
/**
|
||||
* Sets the max frames per file in receiver
|
||||
@ -2213,7 +2236,7 @@ public:
|
||||
* @param fname pattern file to open
|
||||
* @returns OK/FAIL
|
||||
*/
|
||||
int setCTBPattern(string fname);
|
||||
int setCTBPattern(std::string fname);
|
||||
|
||||
/**
|
||||
* Writes a pattern word to the CTB
|
||||
@ -2371,33 +2394,33 @@ private:
|
||||
* Returns the additional json header \sa sharedSlsDetector
|
||||
* @returns the additional json header, returns "none" if default setting and no custom ip set
|
||||
*/
|
||||
string getAdditionalJsonHeader();
|
||||
std::string getAdditionalJsonHeader();
|
||||
|
||||
/**
|
||||
* Returns the receiver UDP socket buffer size\sa sharedSlsDetector
|
||||
* @returns the receiver UDP socket buffer size
|
||||
*/
|
||||
string getReceiverUDPSocketBufferSize() ;
|
||||
std::string getReceiverUDPSocketBufferSize() ;
|
||||
|
||||
/**
|
||||
* Returns the receiver real UDP socket buffer size\sa sharedSlsDetector
|
||||
* @returns the receiver real UDP socket buffer size
|
||||
*/
|
||||
string getReceiverRealUDPSocketBufferSize();
|
||||
std::string getReceiverRealUDPSocketBufferSize();
|
||||
|
||||
/**
|
||||
* Sets the additional json header\sa sharedSlsDetector
|
||||
* @param jsonheader additional json header
|
||||
* @returns additional json header, returns "none" if default setting and no custom ip set
|
||||
*/
|
||||
string setAdditionalJsonHeader(string jsonheader);
|
||||
std::string setAdditionalJsonHeader(std::string jsonheader);
|
||||
|
||||
/**
|
||||
* Sets the receiver UDP socket buffer size
|
||||
* @param udpsockbufsize additional json header
|
||||
* @returns receiver udp socket buffer size
|
||||
*/
|
||||
string setReceiverUDPSocketBufferSize(int udpsockbufsize=-1);
|
||||
std::string setReceiverUDPSocketBufferSize(int udpsockbufsize=-1);
|
||||
|
||||
/**
|
||||
* Sets the transmission delay for left, right or entire frame
|
||||
@ -2406,7 +2429,7 @@ private:
|
||||
* @param delay delay
|
||||
* @returns transmission delay
|
||||
*/
|
||||
string setDetectorNetworkParameter(networkParameter index, int delay);
|
||||
std::string setDetectorNetworkParameter(networkParameter index, int delay);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -373,7 +373,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
||||
virtual int64_t setTimer(timerIndex index, int64_t t=-1, int imod = -1)=0;
|
||||
int64_t setExposureTime(int64_t t=-1, int imod = -1){return setTimer(ACQUISITION_TIME,t,imod);};
|
||||
int64_t setSubFrameExposureTime(int64_t t=-1, int imod = -1){return setTimer(SUBFRAME_ACQUISITION_TIME,t,imod);};
|
||||
int64_t setSubFramePeriod(int64_t t=-1, int imod = -1){return setTimer(SUBFRAME_PERIOD,t,imod);};
|
||||
int64_t setSubFrameDeadTime(int64_t t=-1, int imod = -1){return setTimer(SUBFRAME_DEADTIME,t,imod);};
|
||||
int64_t setExposurePeriod(int64_t t=-1, int imod = -1){return setTimer(FRAME_PERIOD,t,imod);};
|
||||
int64_t setDelayAfterTrigger(int64_t t=-1, int imod = -1){return setTimer(DELAY_AFTER_TRIGGER,t,imod);};
|
||||
int64_t setNumberOfGates(int64_t t=-1, int imod = -1){return setTimer(GATES_NUMBER,t,imod);};
|
||||
@ -481,12 +481,19 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
||||
*/
|
||||
virtual int setOnline(int const online=-1)=0;
|
||||
|
||||
/** @short activates the detector (detector specific)
|
||||
\param enable can be: -1 returns wether the detector is in active (1) or inactive (0) state
|
||||
\returns 0 (inactive) or 1 (active)
|
||||
*/
|
||||
virtual int activate(int const enable=GET_ONLINE_FLAG)=0;
|
||||
/**
|
||||
* Activates/Deactivates the detector (Eiger only)
|
||||
* @param enable active (1) or inactive (0), -1 gets
|
||||
* @returns 0 (inactive) or 1 (active)for activate mode
|
||||
*/
|
||||
virtual int activate(int const enable=-1)=0;
|
||||
|
||||
/**
|
||||
* Set deactivated Receiver padding mode (Eiger only)
|
||||
* @param padding padding option for deactivated receiver. Can be 1 (padding), 0 (no padding), -1 (gets)
|
||||
* @returns 1 (padding), 0 (no padding), -1 (inconsistent values) for padding option
|
||||
*/
|
||||
virtual int setDeactivatedRxrPaddingMode(int padding=-1)=0;
|
||||
|
||||
/**
|
||||
@short set detector settings
|
||||
@ -855,8 +862,8 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
||||
}};
|
||||
|
||||
/** returns std::string from timer index
|
||||
\param s can be FRAME_NUMBER,ACQUISITION_TIME,FRAME_PERIOD, DELAY_AFTER_TRIGGER,GATES_NUMBER,PROBES_NUMBER, CYCLES_NUMBER, ACTUAL_TIME,MEASUREMENT_TIME, PROGRESS,MEASUREMENTS_NUMBER,FRAMES_FROM_START,FRAMES_FROM_START_PG,SAMPLES_JCTB,SUBFRAME_ACQUISITION_TIME,STORAGE_CELL_NUMBER, SUBFRAME_PERIOD
|
||||
\returns std::string frame_number,acquisition_time,frame_period, delay_after_trigger,gates_number,probes_number, cycles_number, actual_time,measurement_time, progress,measurements_number,frames_from_start,frames_from_start_pg,samples_jctb,subframe_acquisition_time,storage_cell_number, subframe_period
|
||||
\param s can be FRAME_NUMBER,ACQUISITION_TIME,FRAME_PERIOD, DELAY_AFTER_TRIGGER,GATES_NUMBER,PROBES_NUMBER, CYCLES_NUMBER, ACTUAL_TIME,MEASUREMENT_TIME, PROGRESS,MEASUREMENTS_NUMBER,FRAMES_FROM_START,FRAMES_FROM_START_PG,SAMPLES_JCTB,SUBFRAME_ACQUISITION_TIME,STORAGE_CELL_NUMBER, SUBFRAME_DEADTIME
|
||||
\returns std::string frame_number,acquisition_time,frame_period, delay_after_trigger,gates_number,probes_number, cycles_number, actual_time,measurement_time, progress,measurements_number,frames_from_start,frames_from_start_pg,samples_jctb,subframe_acquisition_time,storage_cell_number, SUBFRAME_DEADTIME
|
||||
*/
|
||||
static std::string getTimerType(timerIndex t){ \
|
||||
switch (t) { \
|
||||
@ -875,7 +882,7 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
||||
case FRAMES_FROM_START_PG: return std::string("frames_from_start_pg"); \
|
||||
case SAMPLES_JCTB: return std::string("samples_jctb"); \
|
||||
case SUBFRAME_ACQUISITION_TIME: return std::string("subframe_acquisition_time"); \
|
||||
case SUBFRAME_PERIOD: return std::string("subframe_period"); \
|
||||
case SUBFRAME_DEADTIME: return std::string("subframe_deadtime"); \
|
||||
case STORAGE_CELL_NUMBER: return std::string("storage_cell_number"); \
|
||||
default: return std::string("unknown"); \
|
||||
}};
|
||||
@ -887,17 +894,17 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
||||
\returns TEMPERATURE_FPGA, TEMPERATURE_FPGAEXT, TEMPERATURE_10GE, TEMPERATURE_DCDC, TEMPERATURE_SODL,
|
||||
TEMPERATURE_SODR, TEMPERATURE_FPGA2, TEMPERATURE_FPGA3, -1 when unknown mode
|
||||
*/
|
||||
static int getADCIndex(std::string s){
|
||||
if (s=="temp_fpga") return TEMPERATURE_FPGA;
|
||||
if (s=="temp_fpgaext") return TEMPERATURE_FPGAEXT;
|
||||
if (s=="temp_10ge") return TEMPERATURE_10GE;
|
||||
if (s=="temp_dcdc") return TEMPERATURE_DCDC;
|
||||
if (s=="temp_sodl") return TEMPERATURE_SODL;
|
||||
if (s=="temp_sodr") return TEMPERATURE_SODR;
|
||||
if (s=="temp_fpgafl") return TEMPERATURE_FPGA2;
|
||||
if (s=="temp_fpgafr") return TEMPERATURE_FPGA3;
|
||||
return -1;
|
||||
};
|
||||
static int getADCIndex(std::string s){ \
|
||||
if (s=="temp_fpga") return TEMPERATURE_FPGA; \
|
||||
if (s=="temp_fpgaext") return TEMPERATURE_FPGAEXT; \
|
||||
if (s=="temp_10ge") return TEMPERATURE_10GE; \
|
||||
if (s=="temp_dcdc") return TEMPERATURE_DCDC; \
|
||||
if (s=="temp_sodl") return TEMPERATURE_SODL; \
|
||||
if (s=="temp_sodr") return TEMPERATURE_SODR; \
|
||||
if (s=="temp_fpgafl") return TEMPERATURE_FPGA2; \
|
||||
if (s=="temp_fpgafr") return TEMPERATURE_FPGA3; \
|
||||
return -1; \
|
||||
}; \
|
||||
|
||||
|
||||
/**
|
||||
@ -905,19 +912,43 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
||||
\param s can be vcmp_ll, vcmp_lr, vcmp_rl, vcmp_rr, vthreshold, vrf, vrs, vtr, vcall, vcp
|
||||
\returns E_Vcmp_ll, E_Vcmp_lr, E_Vcmp_rl, E_Vcmp_rr, THRESHOLD, E_Vrf, E_Vrs, E_Vtr, E_cal, E_Vcp , -1 when unknown mode
|
||||
*/
|
||||
static int getDACIndex(std::string s){
|
||||
if (s=="vcmp_ll") return E_Vcmp_ll;
|
||||
if (s=="vcmp_lr") return E_Vcmp_lr;
|
||||
if (s=="vcmp_rl") return E_Vcmp_rl;
|
||||
if (s=="vcmp_rr") return E_Vcmp_rr;
|
||||
if (s=="vthreshold") return THRESHOLD;
|
||||
if (s=="vrf") return E_Vrf;
|
||||
if (s=="vrs") return E_Vrs;
|
||||
if (s=="vtr") return E_Vtr;
|
||||
if (s=="vcall") return E_cal;
|
||||
if (s=="vcp") return E_Vcp;
|
||||
return -1;
|
||||
};
|
||||
static int getDACIndex(std::string s){ \
|
||||
if (s=="vcmp_ll") return E_Vcmp_ll; \
|
||||
if (s=="vcmp_lr") return E_Vcmp_lr; \
|
||||
if (s=="vcmp_rl") return E_Vcmp_rl; \
|
||||
if (s=="vcmp_rr") return E_Vcmp_rr; \
|
||||
if (s=="vthreshold") return THRESHOLD; \
|
||||
if (s=="vrf") return E_Vrf; \
|
||||
if (s=="vrs") return E_Vrs; \
|
||||
if (s=="vtr") return E_Vtr; \
|
||||
if (s=="vcall") return E_cal; \
|
||||
if (s=="vcp") return E_Vcp; \
|
||||
return -1; \
|
||||
}; \
|
||||
|
||||
/**
|
||||
@short returns receiver frame discard policy from std::string
|
||||
\param s can be nodiscard, discardempty, discardpartial
|
||||
\returns NO_DISCARD, DISCARD_EMPTY_FRAMES, DISCARD_PARTIAL_FRAMES, GET_FRAME_DISCARD_POLICY when unknown mode
|
||||
*/
|
||||
static frameDiscardPolicy getReceiverFrameDiscardPolicy(std::string s){ \
|
||||
if (s=="nodiscard") return NO_DISCARD; \
|
||||
if (s=="discardempty") return DISCARD_EMPTY_FRAMES; \
|
||||
if (s=="discardpartial") return DISCARD_PARTIAL_FRAMES; \
|
||||
return GET_FRAME_DISCARD_POLICY; \
|
||||
}; \
|
||||
|
||||
/** returns std::string from frame discard policy
|
||||
\param f can be NO_DISCARD, DISCARD_EMPTY_FRAMES, DISCARD_PARTIAL_FRAMES
|
||||
\returns std::string nodiscard, discardempty, discardpartial, unknown
|
||||
*/
|
||||
static std::string getReceiverFrameDiscardPolicy(frameDiscardPolicy f){ \
|
||||
switch (f) { \
|
||||
case NO_DISCARD: return std::string("nodiscard"); \
|
||||
case DISCARD_EMPTY_FRAMES: return std::string("discardempty"); \
|
||||
case DISCARD_PARTIAL_FRAMES: return std::string("discardpartial"); \
|
||||
default: return std::string("unknown"); \
|
||||
}}; \
|
||||
|
||||
|
||||
};
|
||||
|
@ -44,6 +44,12 @@ To address a specific controller i of detector j use:
|
||||
|
||||
<b>sls_detector_clnt j-i:cmd</b>
|
||||
|
||||
|
||||
To use different shared memory segements for different detectors on the same
|
||||
client pc, one can use environment variable <b>SLSDETNAME</b> set to any string to
|
||||
different strings to make the shared memory segments unique. One can then use
|
||||
the same multi detector id for both detectors as they have a different shared memory names.
|
||||
|
||||
For additional questions concerning the indexing of the detector, please refer to the SLS Detectors FAQ documentation.
|
||||
|
||||
The commands are sudivided into different pages depending on their functionalities:
|
||||
@ -193,7 +199,7 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
++i;
|
||||
|
||||
/*! \page acquisition
|
||||
- <b> status [s] </b> starts or stops acquisition in detector in non blocking mode. When using stop acquisition and if acquisition is done, it will restream the stop packet from receiver (if data streaming in receiver is on). \c s: [\c start, \c stop]. \c Returns the detector status: [\c running, \c error, \c transmitting, \c finished, \c waiting, \c idle]. \c Returns \c (string)
|
||||
- <b> status [s] </b> starts or stops acquisition in detector in non blocking mode. When using stop acquisition and if acquisition is done, it will restream the stop packet from receiver (if data streaming in receiver is on). Eiger can also provide an internal software trigger. \c s: [\c start, \c stop, \c trigger(EIGER only)]. \c Returns the detector status: [\c running, \c error, \c transmitting, \c finished, \c waiting, \c idle]. \c Returns \c (string)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="status"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdStatus;
|
||||
@ -324,7 +330,7 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdOnline;
|
||||
++i;
|
||||
/*! \page config
|
||||
- <b>activate</b> Activates/Deactivates the detector. Deactivated detector does not send data. Used for EIGER only. \c Returns \c (int)
|
||||
- <b>activate [b] [p]</b> Activates/Deactivates the detector. \c b is 1 for activate, 0 for deactivate. Deactivated detector does not send data. \c p is optional and can be padding (default) or nonpadding for receivers for deactivated detectors. Used for EIGER only. \c Returns \c (int) (string)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="activate"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdOnline;
|
||||
@ -501,7 +507,7 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
*/
|
||||
|
||||
/*! \page config
|
||||
- <b>checkdetversion</b> Checks the version compatibility with detector software (if hostname is in shared memory). Only get! Only for Eiger, Jungfrau & Gotthard. \c Returns \c ("compatible", "incompatible")
|
||||
- <b>checkdetversion</b> Checks the version compatibility with detector server (if hostname is in shared memory). Only get! Only for Eiger, Jungfrau & Gotthard. \c Returns \c ("compatible", "incompatible")
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="checkdetversion"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSN;
|
||||
@ -509,7 +515,7 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
|
||||
|
||||
/*! \page config
|
||||
- <b>checkrecversion</b> Checks the version compatibility with receiver software (if rx_hostname is in shared memory). Only get! Only for Eiger, Jungfrau & Gotthard. \c Returns \c ("compatible", "incompatible")
|
||||
- <b>checkrecversion</b> Checks the version compatibility with receiver server (if rx_hostname is in shared memory). Only get! Only for Eiger, Jungfrau & Gotthard. \c Returns \c ("compatible", "incompatible")
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="checkrecversion"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSN;
|
||||
@ -598,9 +604,9 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
++i;
|
||||
|
||||
/*! \page timing
|
||||
- <b>subperiod [i]</b> sets/gets sub frame period in s. Used in EIGER only in 32 bit mode. \c Returns \c (double with 9 decimal digits)
|
||||
- <b>subdeadtime [i]</b> sets/gets sub frame dead time in s. Subperiod is set in the detector = subexptime + subdeadtime. This value is normally a constant in the config file. Used in EIGER only in 32 bit mode. \c Returns \c (double with 9 decimal digits)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="subperiod"; //
|
||||
descrToFuncMap[i].m_pFuncName="subdeadtime"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimer;
|
||||
++i;
|
||||
|
||||
@ -654,14 +660,14 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
++i;
|
||||
|
||||
/*! \page timing
|
||||
- <b>storagecells [i]</b> sets/gets number of storage cells per acquisition. For very advanced users only! For JUNGFRAU only. Range: 0-15. The #images = #frames * #cycles * (#storagecells +1). \c Returns \c (long long int)
|
||||
- <b>storagecells [i]</b> sets/gets number of additional storage cells per acquisition. For very advanced users only! For JUNGFRAU only. Range: 0-15. The #images = #frames * #cycles * (#storagecells +1). \c Returns \c (long long int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="storagecells"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimer;
|
||||
++i;
|
||||
|
||||
/*! \page timing
|
||||
- <b>storagecell_start [i]</b> sets/gets the storage cell that stores the first acquisition of the series. Default is 0. For very advanced users only! For JUNGFRAU only. Range: 0-15. \c Returns \c (int)
|
||||
- <b>storagecell_start [i]</b> sets/gets the storage cell that stores the first acquisition of the series. Default is 15(0xf).. For very advanced users only! For JUNGFRAU only. Range: 0-15. \c Returns \c (int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="storagecell_start"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimer;
|
||||
@ -743,6 +749,20 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimeLeft;
|
||||
++i;
|
||||
|
||||
/*! \page timing
|
||||
- <b>measuredperiod</b> gets the measured frame period (time between last frame and the previous one) in s. For Eiger only. Makes sense only for acquisitions of more than 1 frame. \c Returns \c (double with 9 decimal digits)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="measuredperiod"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimeLeft;
|
||||
++i;
|
||||
|
||||
/*! \page timing
|
||||
- <b>measuredsubperiod</b> gets the measured subframe period (time between last subframe and the previous one) in s. For Eiger only and in 32 bit mode. \c Returns \c (double with 9 decimal digits)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="measuredsubperiod"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimeLeft;
|
||||
++i;
|
||||
|
||||
/* speed */
|
||||
/*! \page config
|
||||
\section configspeed Speed
|
||||
@ -2243,21 +2263,14 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
++i;
|
||||
|
||||
/*! \page receiver
|
||||
- <b>r_framesperfile</b> sets/gets the frames per file in receiver. 0 means infinite or all frames in a single file. \c Returns \c (int)
|
||||
- <b>r_framesperfile [i]</b> sets/gets the frames per file in receiver to i. 0 means infinite or all frames in a single file. \c Returns \c (int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="r_framesperfile"; //OK
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
|
||||
++i;
|
||||
|
||||
/*! \page receiver
|
||||
- <b>r_framesperfile</b> sets/gets the frames per file in receiver. 0 means infinite or all frames in a single file. \c Returns \c (int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="r_framesperfile"; //OK
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
|
||||
++i;
|
||||
|
||||
/*! \page receiver
|
||||
- <b>r_discardpolicy</b> sets/gets the frame discard policy in the receiver. 0 - no discard (default), 1 - discard only empty frames, 2 - discard any partial frame(fastest). \c Returns \c (int)
|
||||
- <b>r_discardpolicy</b> sets/gets the frame discard policy in the receiver. nodiscard (default) - discards nothing, discardempty - discard only empty frames, discardpartial(fastest) - discards all partial frames. \c Returns \c (int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="r_discardpolicy"; //OK
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
|
||||
@ -2652,9 +2665,12 @@ string slsDetectorCommand::cmdStatus(int narg, char *args[], int action) {
|
||||
if (string(args[1])=="start")
|
||||
myDet->startAcquisition();
|
||||
else if (string(args[1])=="stop") {
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);//restream stop
|
||||
myDet->stopAcquisition();
|
||||
}
|
||||
else if (string(args[1])=="trigger") {
|
||||
myDet->sendSoftwareTrigger();
|
||||
}
|
||||
else
|
||||
return string("unknown action");
|
||||
}
|
||||
@ -2686,7 +2702,7 @@ string slsDetectorCommand::helpStatus(int narg, char *args[], int action) {
|
||||
os << string("busy \t gets the status of acquire- can be: 0 or 1. 0 for idle, 1 for running\n");
|
||||
}
|
||||
if (action==PUT_ACTION || action==HELP_ACTION) {
|
||||
os << string("status \t controls the detector acquisition - can be start or stop. When using stop acquisition and if acquisition is done, it will restream the stop packet from receiver (if data streaming in receiver is on). \n");
|
||||
os << string("status \t controls the detector acquisition - can be start or stop or trigger(EIGER only). When using stop acquisition and if acquisition is done, it will restream the stop packet from receiver (if data streaming in receiver is on). Eiger can also provide an internal software trigger\n");
|
||||
os << string("busy i\t sets the status of acquire- can be: 0(idle) or 1(running).Command Acquire sets it to 1 at beignning of acquire and back to 0 at the end. Clear Flag for unexpected acquire terminations. \n");
|
||||
}
|
||||
return os.str();
|
||||
@ -4360,11 +4376,20 @@ string slsDetectorCommand::cmdOnline(int narg, char *args[], int action) {
|
||||
if (action==PUT_ACTION) {
|
||||
if (!sscanf(args[1],"%d",&ival))
|
||||
return string("Could not scan activate mode ")+string(args[1]);
|
||||
/* if(dynamic_cast<slsDetector*>(myDet) != NULL)
|
||||
return string("Can only set it from the multiDetector mode");*/
|
||||
myDet->activate(ival);
|
||||
bool padding = true;
|
||||
if (narg > 2) {
|
||||
if (string(args[2]) == "padding")
|
||||
padding = true;
|
||||
else if (string(args[2]) == "nopadding")
|
||||
padding = false;
|
||||
else
|
||||
return string ("Could not scan activate mode's padding option " + string(args[2]));
|
||||
myDet->setDeactivatedRxrPaddingMode(padding);
|
||||
}
|
||||
}
|
||||
sprintf(ans,"%d",myDet->activate());
|
||||
int ret = myDet->setDeactivatedRxrPaddingMode();
|
||||
sprintf(ans,"%d %s", myDet->activate(), ret == 1 ? "padding" : (ret == 0 ? "nopadding" : "unknown"));
|
||||
}
|
||||
else if(cmd=="r_online"){
|
||||
if (action==PUT_ACTION) {
|
||||
@ -4395,14 +4420,14 @@ string slsDetectorCommand::helpOnline(int narg, char *args[], int action) {
|
||||
if (action==PUT_ACTION || action==HELP_ACTION) {
|
||||
os << "online i \n sets the detector in online (1) or offline (0) mode"<< std::endl;
|
||||
os << "r_online i \n sets the receiver in online (1) or offline (0) mode"<< std::endl;
|
||||
os << "activate i \n sets the detector in activated (1) or deactivated (0) mode (does not send data). Only for Eiger."<< std::endl;
|
||||
os << "activate i [p]\n sets the detector in activated (1) or deactivated (0) mode (does not send data). p is optional and can be padding (default) or nonpadding for receivers for deactivated detectors. Only for Eiger."<< std::endl;
|
||||
}
|
||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||
os << "online \n gets the detector online (1) or offline (0) mode"<< std::endl;
|
||||
os << "checkonline \n returns the hostnames of all detectors in offline mode"<< std::endl;
|
||||
os << "r_online \n gets the receiver online (1) or offline (0) mode"<< std::endl;
|
||||
os << "r_checkonline \n returns the hostnames of all receiver in offline mode"<< std::endl;
|
||||
os << "activate \n gets the detector activated (1) or deactivated (0) mode. Only for Eiger."<< std::endl;
|
||||
os << "activate \n gets the detector activated (1) or deactivated (0) mode. And padding or nonpadding for the deactivated receiver. Only for Eiger."<< std::endl;
|
||||
}
|
||||
return os.str();
|
||||
|
||||
@ -4453,6 +4478,9 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
|
||||
if (cmd == "roi")
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
|
||||
if (action==PUT_ACTION) {
|
||||
if (cmd=="maxmod")
|
||||
return string("cannot put!");
|
||||
@ -4468,13 +4496,13 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
||||
if ((val<0) || (narg!=((val*4)+2)) )
|
||||
return helpDetectorSize(narg,args,action);
|
||||
ROI allroi[val];
|
||||
pos=1;
|
||||
// std::cout << val << std::endl;
|
||||
for(i=0;i<val;i++){
|
||||
if ((!sscanf(args[++pos],"%d",&allroi[i].xmin)) ||
|
||||
(!sscanf(args[++pos],"%d",&allroi[i].xmax)) ||
|
||||
(!sscanf(args[++pos],"%d",&allroi[i].ymin)) ||
|
||||
(!sscanf(args[++pos],"%d",&allroi[i].ymax)) )
|
||||
// pos=1;
|
||||
pos=2;
|
||||
for(i=0;i<val;++i){
|
||||
if ((!sscanf(args[pos++],"%d",&allroi[i].xmin)) ||
|
||||
(!sscanf(args[pos++],"%d",&allroi[i].xmax)) ||
|
||||
(!sscanf(args[pos++],"%d",&allroi[i].ymin)) ||
|
||||
(!sscanf(args[pos++],"%d",&allroi[i].ymax)) )
|
||||
return string("cannot parse arguments for roi");
|
||||
}
|
||||
myDet->setROI(val,allroi);
|
||||
@ -4520,7 +4548,9 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
ret=myDet->setDynamicRange(val);
|
||||
} else if (cmd=="roi") {
|
||||
myDet->getROI(ret);
|
||||
ROI* r = myDet->getROI(ret);
|
||||
if (myDet->isMultiSlsDetectorClass() && r != NULL)
|
||||
delete [] r;
|
||||
} else if (cmd=="detsizechan") {
|
||||
sprintf(ans,"%d %d",myDet->getMaxNumberOfChannelsPerDetector(X),myDet->getMaxNumberOfChannelsPerDetector(Y));
|
||||
return string(ans);
|
||||
@ -4874,8 +4904,8 @@ string slsDetectorCommand::helpSN(int narg, char *args[], int action) {
|
||||
|
||||
ostringstream os;
|
||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||
os << "checkdetversion \n gets the version compatibility with detector software (if hostname is in shared memory). Only for Eiger, Jungfrau & Gotthard. Prints compatible/ incompatible."<< std::endl;
|
||||
os << "checkrecversion \n gets the version compatibility with receiver software (if rx_hostname is in shared memory). Only for Eiger, Jungfrau & Gotthard. Prints compatible/ incompatible."<< std::endl;
|
||||
os << "checkdetversion \n gets the version compatibility with detector server (if hostname is in shared memory). Only for Eiger, Jungfrau & Gotthard. Prints compatible/ incompatible."<< std::endl;
|
||||
os << "checkrecversion \n gets the version compatibility with receiver server (if rx_hostname is in shared memory). Only for Eiger, Jungfrau & Gotthard. Prints compatible/ incompatible."<< std::endl;
|
||||
os << "moduleversion:i \n gets the firmwareversion of the module i"<< std::endl;
|
||||
os << "modulenumber:i \n gets the serial number of the module i"<< std::endl;
|
||||
os << "detectornumber \n gets the serial number of the detector (MAC)"<< std::endl;
|
||||
@ -5649,8 +5679,8 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) {
|
||||
index=SUBFRAME_ACQUISITION_TIME;
|
||||
else if (cmd=="period")
|
||||
index=FRAME_PERIOD;
|
||||
else if (cmd=="subperiod")
|
||||
index=SUBFRAME_PERIOD;
|
||||
else if (cmd=="subdeadtime")
|
||||
index=SUBFRAME_DEADTIME;
|
||||
else if (cmd=="delay")
|
||||
index=DELAY_AFTER_TRIGGER;
|
||||
else if (cmd=="gates")
|
||||
@ -5689,7 +5719,7 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) {
|
||||
return string("cannot scan timer value ")+string(args[1]);
|
||||
if (index==ACQUISITION_TIME || index==SUBFRAME_ACQUISITION_TIME ||
|
||||
index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER ||
|
||||
index == SUBFRAME_PERIOD) {
|
||||
index == SUBFRAME_DEADTIME) {
|
||||
// +0.5 for precision of eg.0.0000325
|
||||
t = ( val * 1E9 + 0.5);
|
||||
}else t=(int64_t)val;
|
||||
@ -5703,7 +5733,7 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) {
|
||||
|
||||
if ((ret!=-1) && (index==ACQUISITION_TIME || index==SUBFRAME_ACQUISITION_TIME
|
||||
|| index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER ||
|
||||
index == SUBFRAME_PERIOD)) {
|
||||
index == SUBFRAME_DEADTIME)) {
|
||||
rval=(double)ret*1E-9;
|
||||
sprintf(answer,"%0.9f",rval);
|
||||
}
|
||||
@ -5731,8 +5761,8 @@ string slsDetectorCommand::helpTimer(int narg, char *args[], int action) {
|
||||
os << "probes t \t sets the number of probes to accumulate (max 3! cycles should be set to 1, frames to the number of pump-probe events)" << std::endl;
|
||||
os << "samples t \t sets the number of samples expected from the jctb" << std::endl;
|
||||
os << "storagecells t \t sets number of storage cells per acquisition. For very advanced users only! For JUNGFRAU only. Range: 0-15. The #images = #frames * #cycles * (#storagecells+1)." << std::endl;
|
||||
os << "storagecell_start t \t sets the storage cell that stores the first acquisition of the series. Default is 0. For very advanced users only! For JUNGFRAU only. Range: 0-15." << std::endl;
|
||||
os << "subperiod t \t sets sub frame period in s. Used in EIGER only in 32 bit mode. " << std::endl;
|
||||
os << "storagecell_start t \t sets the storage cell that stores the first acquisition of the series. Default is 15(0xf). For very advanced users only! For JUNGFRAU only. Range: 0-15." << std::endl;
|
||||
os << "subdeadtime t \t sets sub frame dead time in s. Subperiod is set in the detector = subexptime + subdeadtime. This value is normally a constant in the config file. Used in EIGER only in 32 bit mode. " << std::endl;
|
||||
os << std::endl;
|
||||
|
||||
|
||||
@ -5749,7 +5779,7 @@ string slsDetectorCommand::helpTimer(int narg, char *args[], int action) {
|
||||
os << "samples \t gets the number of samples expected from the jctb" << std::endl;
|
||||
os << "storagecells \t gets number of storage cells per acquisition.For JUNGFRAU only." << std::endl;
|
||||
os << "storagecell_start \t gets the storage cell that stores the first acquisition of the series." << std::endl;
|
||||
os << "subperiod \t gets sub frame period in s. Used in EIGER in 32 bit only." << std::endl;
|
||||
os << "subperiod \t gets sub frame dead time in s. Used in EIGER in 32 bit only." << std::endl;
|
||||
os << std::endl;
|
||||
|
||||
}
|
||||
@ -5796,6 +5826,10 @@ string slsDetectorCommand::cmdTimeLeft(int narg, char *args[], int action) {
|
||||
index=MEASUREMENT_TIME;
|
||||
else if (cmd=="nframes")
|
||||
index=FRAMES_FROM_START;
|
||||
else if (cmd=="measuredperiod")
|
||||
index=MEASURED_PERIOD;
|
||||
else if (cmd=="measuredsubperiod")
|
||||
index=MEASURED_SUBPERIOD;
|
||||
else
|
||||
return string("could not decode timer ")+cmd;
|
||||
|
||||
@ -5805,13 +5839,13 @@ string slsDetectorCommand::cmdTimeLeft(int narg, char *args[], int action) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
|
||||
ret=myDet->getTimeLeft(index);
|
||||
|
||||
if (index==ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER || index==ACTUAL_TIME || index==MEASUREMENT_TIME)
|
||||
if ((ret!=-1) && (index==ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER
|
||||
|| index==ACTUAL_TIME || index==MEASUREMENT_TIME ||
|
||||
MEASURED_PERIOD || MEASURED_SUBPERIOD))
|
||||
rval=(double)ret*1E-9;
|
||||
else rval=ret;
|
||||
|
||||
@ -5839,6 +5873,8 @@ string slsDetectorCommand::helpTimeLeft(int narg, char *args[], int action) {
|
||||
os << "framesl \t gets the number of frames left" << std::endl;
|
||||
os << "cyclesl \t gets the number of cycles left" << std::endl;
|
||||
os << "probesl \t gets the number of probes left" << std::endl;
|
||||
os << "measuredperiod \t gets the measured frame period (time between last frame and the previous one) in s. For Eiger only. Makes sense only for acquisitions of more than 1 frame." << std::endl;
|
||||
os << "measuredsubperiod \t gets the measured subframe period (time between last subframe and the previous one) in s. For Eiger only and in 32 bit mode." << std::endl;
|
||||
os << std::endl;
|
||||
|
||||
}
|
||||
@ -6409,14 +6445,12 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
|
||||
|
||||
else if(cmd=="r_discardpolicy") {
|
||||
if (action==PUT_ACTION){
|
||||
if (sscanf(args[1],"%d",&ival) && (ival >= 0) && (ival < NUM_DISCARD_POLICIES)) {
|
||||
myDet->setReceiverFramesDiscardPolicy((frameDiscardPolicy)ival);
|
||||
} else return string("could not scan frames discard policy\n");
|
||||
frameDiscardPolicy f = myDet->getReceiverFrameDiscardPolicy(string(args[1]));
|
||||
if (f == GET_FRAME_DISCARD_POLICY)
|
||||
return string("could not scan frame discard policy. Options: nodiscard, discardempty, discardpartial\n");
|
||||
myDet->setReceiverFramesDiscardPolicy(f);
|
||||
}
|
||||
char answer[100];
|
||||
memset(answer, 0, 100);
|
||||
sprintf(answer,"%d",myDet->setReceiverFramesDiscardPolicy());
|
||||
return string(answer);
|
||||
return myDet->getReceiverFrameDiscardPolicy(myDet->setReceiverFramesDiscardPolicy());
|
||||
}
|
||||
|
||||
else if(cmd=="r_padding") {
|
||||
@ -6450,7 +6484,7 @@ string slsDetectorCommand::helpReceiver(int narg, char *args[], int action) {
|
||||
os << "rx_fifodepth [val]\t sets receiver fifo depth to val" << std::endl;
|
||||
os << "r_silent [i]\t sets receiver in silent mode, ie. it will not print anything during real time acquisition. 1 sets, 0 unsets." << std::endl;
|
||||
os << "r_framesperfile s\t sets the number of frames per file in receiver. 0 means infinite or all frames in a single file." << std::endl;
|
||||
os << "r_discardpolicy s\t sets the frame discard policy in the receiver. 0 - no discard (default), 1 - discard only empty frames, 2 - discard any partial frame(fastest)." << std::endl;
|
||||
os << "r_discardpolicy s\t sets the frame discard policy in the receiver. nodiscard (default) - discards nothing, discardempty - discard only empty frames, discardpartial(fastest) - discards all partial frames." << std::endl;
|
||||
os << "r_padding s\t enables/disables partial frames to be padded in the receiver. 0 does not pad partial frames(fastest), 1 (default) pads partial frames." << std::endl;
|
||||
}
|
||||
if (action==GET_ACTION || action==HELP_ACTION){
|
||||
@ -6462,7 +6496,7 @@ string slsDetectorCommand::helpReceiver(int narg, char *args[], int action) {
|
||||
os << "rx_fifodepth \t returns receiver fifo depth" << std::endl;
|
||||
os << "r_silent \t returns receiver silent mode enable. 1 is silent, 0 not silent." << std::endl;
|
||||
os << "r_framesperfile \t gets the number of frames per file in receiver. 0 means infinite or all frames in a single file." << std::endl;
|
||||
os << "r_discardpolicy \t gets the frame discard policy in the receiver. 0 - no discard (default), 1 - discard only empty frames, 2 - discard any partial frame(fastest)." << std::endl;
|
||||
os << "r_discardpolicy \t gets the frame discard policy in the receiver. nodiscard (default) - discards nothing, discardempty - discard only empty frames, discardpartial(fastest) - discards all partial frames." << std::endl;
|
||||
os << "r_padding \t gets partial frames padding enable in the receiver. 0 does not pad partial frames(fastest), 1 (default) pads partial frames." << std::endl;
|
||||
}
|
||||
return os.str();
|
||||
@ -7014,7 +7048,8 @@ string slsDetectorCommand::cmdPattern(int narg, char *args[], int action) {
|
||||
}
|
||||
}
|
||||
os << hex << reg << dec;
|
||||
|
||||
if (myDet->isMultiSlsDetectorClass() && aa != NULL)
|
||||
delete [] aa;
|
||||
|
||||
//os <<" "<< hex << myDet->readRegister(120) << dec;
|
||||
|
||||
|
@ -6,26 +6,28 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
slsDetectorUsers::slsDetectorUsers(int id) : myDetector(NULL){
|
||||
slsDetectorUsers::slsDetectorUsers(int& ret, int id) : myDetector(0), myCmd(0){
|
||||
try {
|
||||
myDetector=new multiSlsDetector(id);
|
||||
} catch(...) {
|
||||
ret = 1;
|
||||
return;
|
||||
}
|
||||
myCmd=new multiSlsDetectorCommand(myDetector);
|
||||
ret = 0;
|
||||
|
||||
myDetector=new multiSlsDetector(id);
|
||||
myCmd=new multiSlsDetectorCommand(myDetector);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
slsDetectorUsers::~slsDetectorUsers() {
|
||||
if (myDetector)
|
||||
delete myDetector;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
string slsDetectorUsers::getDetectorDeveloper(){
|
||||
return myDetector->getDetectorDeveloper();
|
||||
}
|
||||
|
||||
|
||||
|
||||
int slsDetectorUsers::setOnline(int const online){
|
||||
return myDetector->setOnline(online);
|
||||
}
|
||||
@ -42,7 +44,6 @@ int slsDetectorUsers::stopMeasurement(){
|
||||
return myDetector->stopAcquisition();
|
||||
}
|
||||
|
||||
|
||||
int slsDetectorUsers::getDetectorStatus(){
|
||||
return (int)myDetector->getRunStatus();
|
||||
}
|
||||
@ -51,12 +52,10 @@ string slsDetectorUsers::getFilePath(){
|
||||
return myDetector->getFilePath();
|
||||
}
|
||||
|
||||
|
||||
string slsDetectorUsers::setFilePath(string s){
|
||||
return myDetector->setFilePath(s);
|
||||
}
|
||||
|
||||
|
||||
string slsDetectorUsers::getFileName(){
|
||||
return myDetector->getFileName();
|
||||
}
|
||||
@ -83,7 +82,7 @@ string slsDetectorUsers::setFlatFieldCorrectionDir(string dir){
|
||||
|
||||
string slsDetectorUsers::getFlatFieldCorrectionFile(){
|
||||
return myDetector->getFlatFieldCorrectionFile();
|
||||
};
|
||||
}
|
||||
|
||||
int slsDetectorUsers::setFlatFieldCorrectionFile(string fname){
|
||||
return myDetector->setFlatFieldCorrectionFile(fname);
|
||||
@ -116,17 +115,37 @@ int slsDetectorUsers::getPositions(double *pos){
|
||||
}
|
||||
|
||||
int slsDetectorUsers::setDetectorSize(int x0, int y0, int nx, int ny){
|
||||
if(myDetector->getTotalNumberOfChannels(slsDetectorDefs::Y)>1)
|
||||
return 1;
|
||||
int nmod=nx/(myDetector->getChansPerMod(0));
|
||||
cout << myDetector->getChansPerMod(0) << " " << nx << " " << nmod << endl;
|
||||
return myDetector->setNumberOfModules(nmod)*myDetector->getChansPerMod(0);}
|
||||
// only one roi
|
||||
slsDetectorDefs::ROI roi[1];
|
||||
roi[0].xmin = x0;
|
||||
roi[0].ymin = y0;
|
||||
roi[0].xmax = x0 + nx;
|
||||
roi[0].ymax = y0 + ny;
|
||||
return myDetector->setROI(1, roi);
|
||||
}
|
||||
|
||||
int slsDetectorUsers::getDetectorSize(int &x0, int &y0, int &nx, int &ny){
|
||||
y0=0;
|
||||
x0=0;
|
||||
nx=myDetector->getTotalNumberOfChannels(slsDetectorDefs::X);
|
||||
ny=myDetector->getTotalNumberOfChannels(slsDetectorDefs::Y);
|
||||
int n = 0;
|
||||
slsDetectorDefs::ROI* roi = myDetector->getROI(n);
|
||||
|
||||
// roi
|
||||
if (roi != NULL && n > 0) {
|
||||
x0 = roi[0].xmin;
|
||||
y0 = roi[0].ymin;
|
||||
nx = roi[0].xmax - roi[0].xmin;
|
||||
ny = roi[0].ymax - roi[0].ymin;
|
||||
}
|
||||
// no roi
|
||||
else {
|
||||
y0=0;
|
||||
x0=0;
|
||||
nx=myDetector->getTotalNumberOfChannels(slsDetectorDefs::X);
|
||||
ny=myDetector->getTotalNumberOfChannels(slsDetectorDefs::Y);
|
||||
}
|
||||
|
||||
if (roi != NULL)
|
||||
delete [] roi;
|
||||
|
||||
return nx*ny;
|
||||
}
|
||||
|
||||
@ -140,7 +159,6 @@ int slsDetectorUsers::setBitDepth(int i){
|
||||
return myDetector->setDynamicRange(i);
|
||||
}
|
||||
|
||||
|
||||
int slsDetectorUsers::setSettings(int isettings){
|
||||
return myDetector->slsDetectorBase::setSettings(isettings);
|
||||
}
|
||||
@ -160,43 +178,40 @@ int slsDetectorUsers::setThresholdEnergy(int e_ev, int tb, int isettings, int id
|
||||
double slsDetectorUsers::setExposureTime(double t, bool inseconds, int imod){
|
||||
if(!inseconds)
|
||||
return myDetector->setExposureTime((int64_t)t,imod);
|
||||
else {
|
||||
// + 0.5 to round for precision lost from converting double to int64_t
|
||||
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
|
||||
if (t < 0) tms = -1;
|
||||
tms = myDetector->setExposureTime(tms,imod);
|
||||
if (tms < 0)
|
||||
return -1;
|
||||
return ((1E-9) * (double)tms);
|
||||
}
|
||||
|
||||
// + 0.5 to round for precision lost from converting double to int64_t
|
||||
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
|
||||
if (t < 0) tms = -1;
|
||||
tms = myDetector->setExposureTime(tms,imod);
|
||||
if (tms < 0)
|
||||
return -1;
|
||||
return ((1E-9) * (double)tms);
|
||||
}
|
||||
|
||||
double slsDetectorUsers::setExposurePeriod(double t, bool inseconds, int imod){
|
||||
if(!inseconds)
|
||||
return myDetector->setExposurePeriod((int64_t)t,imod);
|
||||
else {
|
||||
// + 0.5 to round for precision lost from converting double to int64_t
|
||||
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
|
||||
if (t < 0) tms = -1;
|
||||
tms = myDetector->setExposurePeriod(tms,imod);
|
||||
if (tms < 0)
|
||||
return -1;
|
||||
return ((1E-9) * (double)tms);
|
||||
}
|
||||
|
||||
// + 0.5 to round for precision lost from converting double to int64_t
|
||||
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
|
||||
if (t < 0) tms = -1;
|
||||
tms = myDetector->setExposurePeriod(tms,imod);
|
||||
if (tms < 0)
|
||||
return -1;
|
||||
return ((1E-9) * (double)tms);
|
||||
}
|
||||
|
||||
double slsDetectorUsers::setDelayAfterTrigger(double t, bool inseconds, int imod){
|
||||
if(!inseconds)
|
||||
return myDetector->setDelayAfterTrigger((int64_t)t,imod);
|
||||
else {
|
||||
// + 0.5 to round for precision lost from converting double to int64_t
|
||||
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
|
||||
if (t < 0) tms = -1;
|
||||
tms = myDetector->setDelayAfterTrigger(tms,imod);
|
||||
if (tms < 0)
|
||||
return -1;
|
||||
return ((1E-9) * (double)tms);
|
||||
}
|
||||
|
||||
// + 0.5 to round for precision lost from converting double to int64_t
|
||||
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
|
||||
if (t < 0) tms = -1;
|
||||
tms = myDetector->setDelayAfterTrigger(tms,imod);
|
||||
if (tms < 0)
|
||||
return -1;
|
||||
return ((1E-9) * (double)tms);
|
||||
}
|
||||
|
||||
int64_t slsDetectorUsers::setNumberOfGates(int64_t t, int imod){
|
||||
@ -300,6 +315,44 @@ int slsDetectorUsers::enableGapPixels(int enable) {
|
||||
return myDetector->enableGapPixels(enable);
|
||||
}
|
||||
|
||||
std::string slsDetectorUsers::setReceiverFramesDiscardPolicy(std::string f) {
|
||||
return myDetector->getReceiverFrameDiscardPolicy(
|
||||
myDetector->setReceiverFramesDiscardPolicy(
|
||||
myDetector->getReceiverFrameDiscardPolicy(f)));
|
||||
}
|
||||
|
||||
int slsDetectorUsers::setReceiverPartialFramesPadding(int f) {
|
||||
return myDetector->setReceiverPartialFramesPadding(f);
|
||||
}
|
||||
|
||||
int slsDetectorUsers::setReceiverFramesPerFile(int f) {
|
||||
return myDetector->setReceiverFramesPerFile(f);
|
||||
}
|
||||
|
||||
int slsDetectorUsers::sendSoftwareTrigger() {
|
||||
return myDetector->sendSoftwareTrigger();
|
||||
}
|
||||
|
||||
double slsDetectorUsers::getMeasuredPeriod(bool inseconds, int imod) {
|
||||
if(!inseconds)
|
||||
return myDetector->getTimeLeft(slsReceiverDefs::MEASURED_PERIOD, imod);
|
||||
|
||||
int64_t tms = myDetector->getTimeLeft(slsReceiverDefs::MEASURED_PERIOD, imod);
|
||||
if (tms < 0)
|
||||
return -1;
|
||||
return ((1E-9) * (double)tms);
|
||||
}
|
||||
|
||||
double slsDetectorUsers::getMeasuredSubFramePeriod(bool inseconds, int imod) {
|
||||
if(!inseconds)
|
||||
return myDetector->getTimeLeft(slsReceiverDefs::MEASURED_SUBPERIOD, imod);
|
||||
|
||||
int64_t tms = myDetector->getTimeLeft(slsReceiverDefs::MEASURED_SUBPERIOD, imod);
|
||||
if (tms < 0)
|
||||
return -1;
|
||||
return ((1E-9) * (double)tms);
|
||||
}
|
||||
|
||||
void slsDetectorUsers::registerDataCallback(int( *userCallback)(detectorData*, int, int, void*), void *pArg){
|
||||
myDetector->registerDataCallback(userCallback,pArg);
|
||||
}
|
||||
@ -337,8 +390,6 @@ void slsDetectorUsers::registerGetI0Callback( double (*func)(int,void*),void *ar
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
string slsDetectorUsers::putCommand(int narg, char *args[], int pos){
|
||||
if(narg < 2)
|
||||
return string("Error: Insufficient Parameters");
|
||||
@ -352,8 +403,6 @@ string slsDetectorUsers::getCommand(int narg, char *args[], int pos){
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int slsDetectorUsers::setClockDivider(int value) {
|
||||
return myDetector->setClockDivider(value);
|
||||
}
|
||||
@ -402,7 +451,6 @@ int slsDetectorUsers::stopAcquisition() {
|
||||
return myDetector->stopAcquisition();
|
||||
}
|
||||
|
||||
|
||||
int slsDetectorUsers::setReceiverSilentMode(int i) {
|
||||
return myDetector->setReceiverSilentMode(i);
|
||||
}
|
||||
@ -431,21 +479,38 @@ int slsDetectorUsers::getNMods() {
|
||||
return myDetector->getNMods();
|
||||
}
|
||||
|
||||
double slsDetectorUsers::setSubFrameExposureTime(double t, bool inseconds){
|
||||
int64_t tms = (int64_t)(t * (1E+9));
|
||||
if (t < 0) tms = -1;
|
||||
if(!inseconds)
|
||||
return myDetector->setSubFrameExposureTime((int64_t)t);
|
||||
else
|
||||
return ((1E-9) * (double)myDetector->setSubFrameExposureTime(tms));
|
||||
double slsDetectorUsers::setSubFrameExposureTime(double t, bool inseconds, int imod){
|
||||
if(!inseconds)
|
||||
return myDetector->setSubFrameExposureTime((int64_t)t,imod);
|
||||
else {
|
||||
// + 0.5 to round for precision lost from converting double to int64_t
|
||||
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
|
||||
if (t < 0) tms = -1;
|
||||
tms = myDetector->setSubFrameExposureTime(tms,imod);
|
||||
if (tms < 0)
|
||||
return -1;
|
||||
return ((1E-9) * (double)tms);
|
||||
}
|
||||
}
|
||||
|
||||
double slsDetectorUsers::setSubFrameExposurePeriod(double t, bool inseconds){
|
||||
int64_t tms = (int64_t)(t * (1E+9));
|
||||
if (t < 0) tms = -1;
|
||||
if(!inseconds)
|
||||
return myDetector->setSubFramePeriod((int64_t)t);
|
||||
else
|
||||
return ((1E-9) * (double)myDetector->setSubFramePeriod(tms));
|
||||
double slsDetectorUsers::setSubFrameExposureDeadTime(double t, bool inseconds, int imod){
|
||||
if(!inseconds)
|
||||
return myDetector->setSubFrameDeadTime((int64_t)t,imod);
|
||||
else {
|
||||
// + 0.5 to round for precision lost from converting double to int64_t
|
||||
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
|
||||
if (t < 0) tms = -1;
|
||||
tms = myDetector->setSubFrameDeadTime(tms,imod);
|
||||
if (tms < 0)
|
||||
return -1;
|
||||
return ((1E-9) * (double)tms);
|
||||
}
|
||||
}
|
||||
|
||||
int64_t slsDetectorUsers::setNumberOfStorageCells(int64_t t, int imod) {
|
||||
return myDetector->setTimer(slsReceiverDefs::STORAGE_CELL_NUMBER, t, imod);
|
||||
}
|
||||
|
||||
int slsDetectorUsers::setStoragecellStart(int pos) {
|
||||
return myDetector->setStoragecellStart(pos);
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ class multiSlsDetectorCommand;
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
\mainpage
|
||||
<CENTER><H1>API for SLS detectors data acquisition</H1></CENTER>
|
||||
@ -72,12 +71,11 @@ You can find examples of how this classes can be instatiated in mainClient.cpp
|
||||
|
||||
|
||||
*/
|
||||
/**
|
||||
|
||||
@libdoc The slsDetectorUsers class is a minimal interface class which should be instantiated by the users in their acquisition software (EPICS, spec etc.). More advanced configuration functions are not implemented and can be written in a configuration or parameters file that can be read/written.
|
||||
*/
|
||||
/**
|
||||
@short Class for detector functionalities to embed the detector controls in the users custom interface e.g. EPICS, Lima etc.
|
||||
@short The slsDetectorUsers class is a minimal interface class which should be instantiated by the users in their acquisition software (EPICS, spec etc.). More advanced configuration functions are not implemented and can be written in a configuration or parameters file that can be read/written.
|
||||
|
||||
Class for detector functionalities to embed the detector controls in the users custom interface e.g. EPICS, Lima etc.
|
||||
|
||||
*/
|
||||
|
||||
@ -87,23 +85,22 @@ class slsDetectorUsers
|
||||
|
||||
public:
|
||||
|
||||
/** @short default constructor */
|
||||
slsDetectorUsers(int id=0);
|
||||
|
||||
/** @short default constructor
|
||||
* @param ret address of return value. It will be set to 0 for success, else 1 for failure
|
||||
* @param id multi detector id
|
||||
* in creating multidetector object
|
||||
*/
|
||||
slsDetectorUsers(int& ret, int id=0);
|
||||
|
||||
/** @short virtual destructor */
|
||||
virtual ~slsDetectorUsers();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@short useful to define subset of working functions
|
||||
\returns "PSI" or "Dectris"
|
||||
*/
|
||||
std::string getDetectorDeveloper();
|
||||
|
||||
|
||||
|
||||
/** @short sets the onlineFlag
|
||||
\param online can be: -1 returns wether the detector is in online (1) or offline (0) state; 0 detector in offline state; 1 detector in online state
|
||||
\returns 0 (offline) or 1 (online)
|
||||
@ -250,7 +247,7 @@ class slsDetectorUsers
|
||||
int getPositions(double *pos=NULL);
|
||||
|
||||
/**
|
||||
@short sets the detector size
|
||||
@short sets the detector size (only 1 ROI) (not Mythen supported anymore)
|
||||
\param x0 horizontal position origin in channel number (-1 unchanged)
|
||||
\param y0 vertical position origin in channel number (-1 unchanged)
|
||||
\param nx number of channels in horiziontal (-1 unchanged)
|
||||
@ -261,18 +258,16 @@ class slsDetectorUsers
|
||||
|
||||
|
||||
/**
|
||||
@short gets detector size
|
||||
@short gets detector size (not Mythen supported anymore)
|
||||
\param x0 horizontal position origin in channel number
|
||||
\param y0 vertical position origin in channel number
|
||||
\param nx number of channels in horiziontal
|
||||
\param ny number of channels in vertical
|
||||
\returns OK/FAIL
|
||||
\returns total number of channels
|
||||
*/
|
||||
int getDetectorSize(int &x0, int &y0, int &nx, int &ny);
|
||||
/**
|
||||
@short gets the maximum detector size
|
||||
\param x0 horizontal position origin in channel number
|
||||
\param y0 vertical position origin in channel number
|
||||
\param nx number of channels in horiziontal
|
||||
\param ny number of channels in vertical
|
||||
\returns OK/FAIL
|
||||
@ -372,7 +367,6 @@ class slsDetectorUsers
|
||||
\returns number of frames
|
||||
*/
|
||||
int64_t setNumberOfCycles(int64_t t=-1, int imod = -1);
|
||||
|
||||
|
||||
/**
|
||||
@short set/get the external communication mode
|
||||
@ -420,6 +414,7 @@ class slsDetectorUsers
|
||||
/**
|
||||
@short register calbback for accessing detector final data, also enables data streaming in client and receiver (if receiver exists)
|
||||
\param userCallback function for plotting/analyzing the data. Its arguments are the data structure d and the frame number f, s is for subframe number for eiger for 32 bit mode
|
||||
\param pArg argument
|
||||
*/
|
||||
|
||||
void registerDataCallback(int( *userCallback)(detectorData* d, int f, int s, void*), void *pArg);
|
||||
@ -427,6 +422,7 @@ class slsDetectorUsers
|
||||
/**
|
||||
@short register callback for accessing raw data - if the rawDataCallback is registered, no filewriting/postprocessing will be carried on automatically by the software - the raw data are deleted by the software
|
||||
\param userCallback function for postprocessing and saving the data - p is the pointer to the data, n is the number of channels
|
||||
\param pArg argument
|
||||
*/
|
||||
|
||||
void registerRawDataCallback(int( *userCallback)(double* p, int n, void*), void *pArg);
|
||||
@ -463,7 +459,7 @@ class slsDetectorUsers
|
||||
|
||||
|
||||
/** Enable or disable streaming data from receiver (creates transmitting sockets)
|
||||
* @param enable 0 to disable 1 to enable -1 to only get the value
|
||||
* @param i 0 to disable 1 to enable -1 to only get the value
|
||||
* @returns data streaming from receiver enable
|
||||
*/
|
||||
int enableDataStreamingFromReceiver(int i=-1);
|
||||
@ -502,7 +498,7 @@ class slsDetectorUsers
|
||||
/** (for expert users)
|
||||
* Set/Get client streaming in ZMQ IP
|
||||
* By default, it is the IP of receiver hostname
|
||||
* @param i sets, empty std::string gets
|
||||
* @param ip sets, empty std::string gets
|
||||
* @returns client streaming in ZMQ IP
|
||||
*/
|
||||
std::string setClientDataStreamingInIP(std::string ip="");
|
||||
@ -552,42 +548,92 @@ class slsDetectorUsers
|
||||
*/
|
||||
int enableGapPixels(int enable=-1);
|
||||
|
||||
/**
|
||||
* Sets the frames discard policy in receiver
|
||||
* frame discard policy options:
|
||||
* @param f nodiscard (default),discardempty, discardpartial (fastest), get to get the value
|
||||
* @returns f nodiscard (default),discardempty, discardpartial (fastest)
|
||||
*/
|
||||
std::string setReceiverFramesDiscardPolicy(std::string f="get");
|
||||
|
||||
/**
|
||||
* Sets the frame padding in receiver
|
||||
* @param f 0 does not partial frames, 1 pads partial frames (-1 gets)
|
||||
* @returns partial frames padding enable
|
||||
*/
|
||||
int setReceiverPartialFramesPadding(int f = -1);
|
||||
|
||||
/**
|
||||
* Sets the frames per file in receiver
|
||||
* @param f frames per file, 0 is infinite ie. every frame in same file (-1 gets)
|
||||
* @returns frames per file
|
||||
*/
|
||||
int setReceiverFramesPerFile(int f = -1);
|
||||
|
||||
/**
|
||||
* Sends a software internal trigger (EIGER only)
|
||||
* @returns 0 for success, 1 for fail
|
||||
*/
|
||||
int sendSoftwareTrigger();
|
||||
|
||||
/**
|
||||
* get measured period between previous two frames(EIGER only)
|
||||
* @param inseconds true if the value is in s, else ns
|
||||
* @param imod module number (-1 for all)
|
||||
* @returns measured period
|
||||
*/
|
||||
double getMeasuredPeriod(bool inseconds=false, int imod = -1);
|
||||
|
||||
/**
|
||||
* get measured sub period between previous two sub frames in 32 bit mode (EIGER only)
|
||||
* @param inseconds true if the value is in s, else ns
|
||||
* @param imod module number (-1 for all)
|
||||
* @returns measured sub period
|
||||
*/
|
||||
double getMeasuredSubFramePeriod(bool inseconds=false, int imod = -1);
|
||||
|
||||
/**
|
||||
@short register calbback for accessing detector final data
|
||||
\param func function to be called at the end of the acquisition. gets detector status and progress index as arguments
|
||||
\param pArg argument
|
||||
*/
|
||||
|
||||
void registerAcquisitionFinishedCallback(int( *func)(double,int, void*), void *pArg);
|
||||
|
||||
/**
|
||||
@short register calbback for reading detector position
|
||||
\param func function for reading the detector position
|
||||
\param arg argument
|
||||
*/
|
||||
|
||||
void registerGetPositionCallback( double (*func)(void*),void *arg);
|
||||
/**
|
||||
@short register callback for connecting to the epics channels
|
||||
\param func function for connecting to the epics channels
|
||||
\param arg argument
|
||||
*/
|
||||
void registerConnectChannelsCallback( int (*func)(void*),void *arg);
|
||||
/**
|
||||
@short register callback to disconnect the epics channels
|
||||
\param func function to disconnect the epics channels
|
||||
\param arg argument
|
||||
*/
|
||||
void registerDisconnectChannelsCallback( int (*func)(void*),void *arg);
|
||||
/**
|
||||
@short register callback for moving the detector
|
||||
\param func function for moving the detector
|
||||
\param arg argument
|
||||
*/
|
||||
void registerGoToPositionCallback( int (*func)(double,void*),void *arg);
|
||||
/**
|
||||
@short register callback for moving the detector without waiting
|
||||
\param func function for moving the detector
|
||||
\param arg argument
|
||||
*/
|
||||
void registerGoToPositionNoWaitCallback( int (*func)(double,void*),void *arg);
|
||||
/**
|
||||
@short register calbback reading to I0
|
||||
\param func function for reading the I0 (called with parameter 0 before the acquisition, 1 after and the return value used as I0)
|
||||
\param arg argument
|
||||
*/
|
||||
void registerGetI0Callback( double (*func)(int,void*),void *arg);
|
||||
|
||||
@ -662,13 +708,13 @@ class slsDetectorUsers
|
||||
|
||||
/**
|
||||
@short start receiver listening mode
|
||||
\param returns OK or FAIL
|
||||
\returns returns OK or FAIL
|
||||
*/
|
||||
int startReceiver();
|
||||
|
||||
/**
|
||||
@short stop receiver listening mode
|
||||
\param returns OK or FAIL
|
||||
\returns returns OK or FAIL
|
||||
*/
|
||||
int stopReceiver();
|
||||
|
||||
@ -703,7 +749,7 @@ class slsDetectorUsers
|
||||
/**
|
||||
* reset frames caught in receiver
|
||||
* should be called before startReceiver()
|
||||
* @retuns OK or FAIL
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int resetFramesCaughtInReceiver();
|
||||
|
||||
@ -736,19 +782,37 @@ class slsDetectorUsers
|
||||
|
||||
/**
|
||||
* Set sub frame exposure time (only for Eiger)
|
||||
* @param i sub frame exposure time (-1 gets)
|
||||
* @param t sub frame exposure time (-1 gets)
|
||||
* @param inseconds true if the value is in s, else ns
|
||||
* @param imod module number (-1 for all)
|
||||
* @returns sub frame exposure time in ns, or s if specified
|
||||
*/
|
||||
double setSubFrameExposureTime(double t=-1, bool inseconds=false);
|
||||
double setSubFrameExposureTime(double t=-1, bool inseconds=false, int imod = -1);
|
||||
|
||||
/**
|
||||
* Set sub frame period (only for Eiger)
|
||||
* @param i sub frame period (-1 gets)
|
||||
* Set sub frame dead time (only for Eiger)
|
||||
* Very advanced feature. Meant to be a constant in config file by an expert for each individual module
|
||||
* @param t sub frame dead time (-1 gets)
|
||||
* @param inseconds true if the value is in s, else ns
|
||||
* @returns sub frame period in ns, or s if specified
|
||||
* @param imod module number (-1 for all)
|
||||
* @returns sub frame dead time in ns, or s if specified
|
||||
*/
|
||||
double setSubFrameExposurePeriod(double t=-1, bool inseconds=false);
|
||||
double setSubFrameExposureDeadTime(double t=-1, bool inseconds=false, int imod = -1);
|
||||
|
||||
/**
|
||||
* set/get number of additional storage cells (Jungfrau)
|
||||
* @param t number of additional storage cells. Default is 0. (-1 gets)
|
||||
* @param imod module number (-1 for all)
|
||||
* @returns number of additional storage cells
|
||||
*/
|
||||
int64_t setNumberOfStorageCells(int64_t t=-1, int imod = -1);
|
||||
|
||||
/**
|
||||
* Set storage cell that stores first acquisition of the series (Jungfrau)
|
||||
* @param pos storage cell index. Value can be 0 to 15. Default is 15. (-1 gets)
|
||||
* @returns the storage cell that stores the first acquisition of the series
|
||||
*/
|
||||
int setStoragecellStart(int pos=-1);
|
||||
|
||||
/************************************************************************
|
||||
|
||||
@ -829,12 +893,12 @@ class slsDetectorUsers
|
||||
\returns auto, trigger, ro_trigger, gating, triggered_gating, unknown when wrong mode
|
||||
*/
|
||||
|
||||
static int getTimingMode(std::string s){ \
|
||||
static int getTimingMode(std::string s){ \
|
||||
if (s== "auto") return 0; \
|
||||
if (s== "trigger") return 1; \
|
||||
if (s== "ro_trigger") return 2; \
|
||||
if (s== "gating") return 3; \
|
||||
if (s== "triggered_gating") return 4; \
|
||||
if (s== "triggered_gating") return 4; \
|
||||
return -1; };
|
||||
|
||||
|
||||
|
@ -291,9 +291,10 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
||||
/**
|
||||
get current timer value
|
||||
\param index timer index
|
||||
\param imod module number
|
||||
\returns elapsed time value in ns or number of...(e.g. frames, gates, probes)
|
||||
*/
|
||||
virtual int64_t getTimeLeft(timerIndex index)=0;
|
||||
virtual int64_t getTimeLeft(timerIndex index, int imod = -1)=0;
|
||||
|
||||
/**
|
||||
* set storage cell that stores first acquisition of the series (Jungfrau only)
|
||||
@ -475,6 +476,13 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
||||
|
||||
int acquire(int delflag=1);
|
||||
|
||||
/**
|
||||
* Give an internal software trigger to the detector (Eiger only)
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
virtual int sendSoftwareTrigger()=0;
|
||||
|
||||
|
||||
|
||||
// double* convertAngles(){return convertAngles(currentPosition);};
|
||||
// virtual double* convertAngles(double pos)=0;
|
||||
|
@ -21,7 +21,12 @@ class detectorData {
|
||||
\param dr dynamic range or bits per pixel (valid only for non MYTHEN detectors)
|
||||
\param file_ind file index
|
||||
*/
|
||||
detectorData(double *val=NULL, double *err=NULL, double *ang=NULL, double f_ind=-1, const char *fname="", int np=-1, int ny=1, char *cval=NULL, int dbytes=0, int dr=0, long long int file_ind=-1) : values(val), errors(err), angles(ang), progressIndex(f_ind), npoints(np), npy(ny), cvalues(cval), databytes(dbytes), dynamicRange(dr), dgainvalues(NULL), fileIndex(file_ind) {
|
||||
detectorData(double *val=NULL, double *err=NULL, double *ang=NULL, double f_ind=-1,
|
||||
const char *fname="", int np=-1, int ny=1, char *cval=NULL, int dbytes=0, int dr=0,
|
||||
long long int file_ind=-1) :
|
||||
values(val), errors(err), angles(ang), progressIndex(f_ind),
|
||||
npoints(np), npy(ny), cvalues(cval), databytes(dbytes),
|
||||
dynamicRange(dr), dgainvalues(NULL), fileIndex(file_ind) {
|
||||
strcpy(fileName,fname);
|
||||
};
|
||||
|
||||
@ -30,7 +35,8 @@ class detectorData {
|
||||
deletes also the arrays pointing to data/errors/angles if not NULL
|
||||
cvalues are deleted by caller
|
||||
*/
|
||||
~detectorData() {if (values) delete [] values; if (errors) delete [] errors; if (angles) delete [] angles; if(dgainvalues) delete [] dgainvalues;};
|
||||
~detectorData() {if (values) delete [] values; if (errors) delete [] errors;
|
||||
if (angles) delete [] angles; if(dgainvalues) delete [] dgainvalues;};
|
||||
//private:
|
||||
double *values; /**< @short pointer to the data as double array (MYTHEN only) */
|
||||
double *errors; /**< @short pointer to the errors */
|
||||
|
@ -118,9 +118,7 @@ int executeTrimming(enum trimMode mode, int par1, int par2, int imod);
|
||||
int selectStoragecellStart(int pos);
|
||||
#endif
|
||||
int64_t setTimer(enum timerIndex ind, int64_t val);
|
||||
#ifndef EIGERD
|
||||
int64_t getTimeLeft(enum timerIndex ind);
|
||||
#endif
|
||||
|
||||
|
||||
// parameters - channel, chip, module, settings
|
||||
@ -255,6 +253,9 @@ int startStateMachine();
|
||||
void* start_timer(void* arg);
|
||||
#endif
|
||||
int stopStateMachine();
|
||||
#ifdef EIGERD
|
||||
int softwareTrigger();
|
||||
#endif
|
||||
#ifndef JUNGFRAUD
|
||||
int startReadOut();
|
||||
#endif
|
||||
|
@ -113,7 +113,7 @@ int decode_function(int file_des) {
|
||||
#ifdef JUNGFRAUD
|
||||
if ((debugflag == PROGRAMMING_MODE) &&
|
||||
((fnum != F_PROGRAM_FPGA) && (fnum != F_GET_DETECTOR_TYPE) &&
|
||||
(fnum != F_RESET_FPGA) && (fnum != F_UPDATE_CLIENT))) {
|
||||
(fnum != F_RESET_FPGA) && (fnum != F_UPDATE_CLIENT) && (fnum != F_CHECK_VERSION))) {
|
||||
sprintf(mess,"This Function %s cannot be executed. ", getFunctionName((enum detFuncs)fnum));
|
||||
ret=(M_nofuncMode)(file_des);
|
||||
} else
|
||||
@ -210,6 +210,7 @@ const char* getFunctionName(enum detFuncs func) {
|
||||
case F_AUTO_COMP_DISABLE: return "F_AUTO_COMP_DISABLE";
|
||||
case F_STORAGE_CELL_START: return "F_STORAGE_CELL_START";
|
||||
case F_CHECK_VERSION: return "F_CHECK_VERSION";
|
||||
case F_SOFTWARE_TRIGGER: return "F_SOFTWARE_TRIGGER";
|
||||
|
||||
default: return "Unknown Function";
|
||||
}
|
||||
@ -295,6 +296,7 @@ void function_table() {
|
||||
flist[F_AUTO_COMP_DISABLE] = &auto_comp_disable;
|
||||
flist[F_STORAGE_CELL_START] = &storage_cell_start;
|
||||
flist[F_CHECK_VERSION] = &check_version;
|
||||
flist[F_SOFTWARE_TRIGGER] = &software_trigger;
|
||||
|
||||
// check
|
||||
if (NUM_DET_FUNCTIONS >= TOO_MANY_FUNCTIONS_DEFINED) {
|
||||
@ -2787,6 +2789,9 @@ int set_timer(int file_des) {
|
||||
else {
|
||||
#ifdef VERBOSE
|
||||
printf("setting timer %d to %lld ns\n",ind,tns);
|
||||
#endif
|
||||
#ifdef EIGERD
|
||||
int64_t subexptime = 0;
|
||||
#endif
|
||||
switch(ind) {
|
||||
#ifdef JUNGFRAUD
|
||||
@ -2794,6 +2799,7 @@ int set_timer(int file_des) {
|
||||
if (tns > MAX_STORAGE_CELL_VAL) {
|
||||
ret=FAIL;
|
||||
strcpy(mess,"Max Storage cell number should not exceed 15\n");
|
||||
cprintf(RED, "Warning: %s", mess);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@ -2802,14 +2808,19 @@ int set_timer(int file_des) {
|
||||
if (tns > ((int64_t)MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS*10) ){
|
||||
ret=FAIL;
|
||||
strcpy(mess,"Sub Frame exposure time should not exceed 5.368 seconds\n");
|
||||
cprintf(RED, "Warning: %s", mess);
|
||||
break;
|
||||
}
|
||||
retval = setTimer(ind,tns);
|
||||
break;
|
||||
case SUBFRAME_PERIOD:
|
||||
if (tns > ((int64_t)MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS*10) ){
|
||||
case SUBFRAME_DEADTIME:
|
||||
subexptime = setTimer(SUBFRAME_ACQUISITION_TIME, -1);
|
||||
if ((tns + subexptime) > ((int64_t)MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS*10) ){
|
||||
ret=FAIL;
|
||||
strcpy(mess,"Sub Frame Period should not exceed 5.368 seconds\n");
|
||||
sprintf(mess,"Sub Frame Period should not exceed 5.368 seconds. "
|
||||
"So sub frame dead time should not exceed %lfu seconds (subexptime = %lf seconds)\n",
|
||||
((((int64_t)MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS*10) - subexptime)/1E9), (subexptime/1E9));
|
||||
cprintf(RED, "Warning: %s", mess);
|
||||
break;
|
||||
}
|
||||
retval = setTimer(ind,tns);
|
||||
@ -2885,16 +2896,6 @@ int get_time_left(int file_des) {
|
||||
sprintf(mess,"get timer left failed\n");
|
||||
|
||||
|
||||
|
||||
#ifdef EIGERD
|
||||
//to receive any arguments
|
||||
while (n > 0)
|
||||
n = receiveData(file_des,mess,MAX_STR_LENGTH,OTHER);
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Function (Get Timer Left) is not implemented for this detector\n");
|
||||
cprintf(RED, "%s", mess);
|
||||
#else
|
||||
|
||||
// receive arguments
|
||||
enum timerIndex ind=0;
|
||||
n = receiveData(file_des,&ind,sizeof(ind),INT32);
|
||||
@ -2914,7 +2915,10 @@ int get_time_left(int file_des) {
|
||||
#endif
|
||||
|
||||
switch(ind) {
|
||||
#ifdef MYTHEND
|
||||
#ifdef EIGERD
|
||||
case MEASURED_PERIOD:
|
||||
case MEASURED_SUBPERIOD:
|
||||
#elif MYTHEND
|
||||
case PROBES_NUMBER:
|
||||
#elif JUNGFRAUD
|
||||
case FRAMES_FROM_START:
|
||||
@ -2924,6 +2928,7 @@ int get_time_left(int file_des) {
|
||||
case PROBES_NUMBER:
|
||||
case SAMPLES_JCTB:
|
||||
#endif
|
||||
#ifndef EIGERD
|
||||
#ifndef JUNGFRAUD
|
||||
case GATES_NUMBER:
|
||||
#endif
|
||||
@ -2935,6 +2940,7 @@ int get_time_left(int file_des) {
|
||||
case PROGRESS:
|
||||
case ACTUAL_TIME:
|
||||
case MEASUREMENT_TIME:
|
||||
#endif
|
||||
retval=getTimeLeft(ind);
|
||||
break;
|
||||
default:
|
||||
@ -2954,7 +2960,7 @@ int get_time_left(int file_des) {
|
||||
#endif
|
||||
if (ret==OK && differentClients)
|
||||
ret=FORCE_UPDATE;
|
||||
#endif
|
||||
|
||||
|
||||
// ret could be swapped during sendData
|
||||
ret1 = ret;
|
||||
@ -3654,7 +3660,7 @@ int send_update(int file_des) {
|
||||
if (n < 0) return printSocketReadError();
|
||||
|
||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||
retval=setTimer(SUBFRAME_PERIOD,GET_FLAG);
|
||||
retval=setTimer(SUBFRAME_DEADTIME,GET_FLAG);
|
||||
#endif
|
||||
n = sendData(file_des,&retval,sizeof(int64_t),INT64);
|
||||
if (n < 0) return printSocketReadError();
|
||||
@ -5842,7 +5848,7 @@ int check_version(int file_des) {
|
||||
sprintf(mess,"Client's detector SW API version: (0x%llx). "
|
||||
"Detector's SW API Version: (0x%llx). "
|
||||
"Incompatible, update client!\n",
|
||||
client_requiredVersion, det_apiVersion);
|
||||
(long long int)client_requiredVersion, (long long int)det_apiVersion);
|
||||
cprintf(RED, "Warning: %s", mess);
|
||||
}
|
||||
|
||||
@ -5852,7 +5858,7 @@ int check_version(int file_des) {
|
||||
sprintf(mess,"Detector SW Version: (0x%llx). "
|
||||
"Client's detector SW API Version: (0x%llx). "
|
||||
"Incompatible, update detector software!\n",
|
||||
det_version, client_requiredVersion);
|
||||
(long long int)det_version, (long long int)client_requiredVersion);
|
||||
cprintf(RED, "Warning: %s", mess);
|
||||
}
|
||||
}
|
||||
@ -5871,3 +5877,52 @@ int check_version(int file_des) {
|
||||
// return ok / fail
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int software_trigger(int file_des) {
|
||||
int ret=OK,ret1=OK;
|
||||
int n=0;
|
||||
sprintf(mess,"software trigger failed\n");
|
||||
|
||||
#ifndef EIGERD
|
||||
//to receive any arguments
|
||||
while (n > 0)
|
||||
n = receiveData(file_des,mess,MAX_STR_LENGTH,OTHER);
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Function (Software Trigger) is not implemented for this detector\n");
|
||||
cprintf(RED, "%s", mess);
|
||||
#else
|
||||
|
||||
// execute action
|
||||
if (differentClients && lockStatus) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||
cprintf(RED, "Warning: %s", mess);
|
||||
}
|
||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||
else {
|
||||
printf("Software Trigger\n");
|
||||
ret=softwareTrigger();
|
||||
if (ret==FAIL)
|
||||
cprintf(RED, "Warning: %s", mess);
|
||||
}
|
||||
#endif
|
||||
if (ret==OK && differentClients)
|
||||
ret=FORCE_UPDATE;
|
||||
#endif
|
||||
|
||||
// ret could be swapped during sendData
|
||||
ret1 = ret;
|
||||
// send ok / fail
|
||||
n = sendData(file_des,&ret1,sizeof(ret),INT32);
|
||||
// send return argument
|
||||
if (ret==FAIL) {
|
||||
n += sendData(file_des,mess,sizeof(mess),OTHER);
|
||||
}
|
||||
|
||||
// return ok / fail
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -96,5 +96,6 @@ int temp_event(int);
|
||||
int auto_comp_disable(int);
|
||||
int storage_cell_start(int);
|
||||
int check_version(int);
|
||||
int software_trigger(int);
|
||||
|
||||
#endif
|
||||
|
@ -197,3 +197,21 @@ int receiverInterface::executeFunction(int fnum,char mess[]){
|
||||
}
|
||||
|
||||
|
||||
|
||||
int receiverInterface::sendROI(int fnum, int n, slsReceiverDefs::ROI roiLimits[]) {
|
||||
int ret = slsDetectorDefs::FAIL;
|
||||
char mess[MAX_STR_LENGTH];
|
||||
memset(mess, 0, MAX_STR_LENGTH);
|
||||
|
||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
dataSocket->SendDataOnly(&n,sizeof(n));
|
||||
dataSocket->SendDataOnly(roiLimits,n * sizeof(slsReceiverDefs::ROI));
|
||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==slsDetectorDefs::FAIL){
|
||||
dataSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
cprintf(RED, "Receiver returned error: %s", mess);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
@ -131,6 +131,15 @@ public:
|
||||
*/
|
||||
int executeFunction(int fnum,char mess[]);
|
||||
|
||||
/**
|
||||
* Send an integer to receiver
|
||||
* @param fnum function enum to determine what parameter
|
||||
* @param n number of ROIs to send
|
||||
* @param roiLimits ROI structure
|
||||
* \returns success of operation
|
||||
*/
|
||||
int sendROI(int fnum, int n, slsReceiverDefs::ROI roiLimits[]);
|
||||
|
||||
//here one should implement the funcs listed in
|
||||
|
||||
private:
|
||||
|
@ -69,7 +69,7 @@ set(PUBLICHEADERS
|
||||
include/MySocketTCP.h
|
||||
include/genericSocket.h
|
||||
include/logger.h
|
||||
|
||||
include/sls_receiver_exceptions.h
|
||||
)
|
||||
|
||||
|
||||
|
@ -26,7 +26,7 @@ LIBZMQ = -L$(LIBZMQDIR) -Wl,-rpath=$(LIBZMQDIR) -lzmq
|
||||
|
||||
|
||||
SRC_CLNT = MySocketTCP.cpp ThreadObject.cpp Listener.cpp DataProcessor.cpp DataStreamer.cpp Fifo.cpp File.cpp BinaryFile.cpp UDPInterface.cpp UDPBaseImplementation.cpp UDPStandardImplementation.cpp slsReceiverTCPIPInterface.cpp slsReceiver.cpp slsReceiverUsers.cpp utilities.cpp
|
||||
DEPSINCLUDES = $(INCDIR)/ansi.h $(INCDIR)/sls_receiver_defs.h $(INCDIR)/sls_receiver_funcs.h $(INCDIR)/GeneralData.h $(INCDIR)/circularFifo.h $(INCDIR)/genericSocket.h $(INCDIR)/logger.h $(INCDIR)/receiver_defs.h $(INCDIR)/UDPInterface.h $(INCDIR)/utilities.h $(INCDIR)/ZmqSocket.h $(INCDIR)/BinaryFileStatic.h $(INCDIR)/HDF5FileStatic.h
|
||||
DEPSINCLUDES = $(INCDIR)/ansi.h $(INCDIR)/sls_receiver_defs.h $(INCDIR)/sls_receiver_funcs.h $(INCDIR)/GeneralData.h $(INCDIR)/circularFifo.h $(INCDIR)/genericSocket.h $(INCDIR)/logger.h $(INCDIR)/receiver_defs.h $(INCDIR)/UDPInterface.h $(INCDIR)/utilities.h $(INCDIR)/ZmqSocket.h $(INCDIR)/BinaryFileStatic.h $(INCDIR)/HDF5FileStatic.h $(INCDIR)/sls_receiver_exceptions.h
|
||||
|
||||
|
||||
ifeq ($(HDF5),yes)
|
||||
|
@ -1,9 +1,18 @@
|
||||
Path: slsDetectorsPackage/slsReceiverSoftware
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
<<<<<<< HEAD
|
||||
Repsitory UUID: 83600fcb15c8261173ab15a8ba8d1009693f2d23
|
||||
Revision: 813
|
||||
Branch: anna
|
||||
Last Changed Author: Anna_Bergamaschi
|
||||
Last Changed Rev: 3962
|
||||
Last Changed Date: 2018-09-04 08:41:33.000000002 +0200 ./src/slsReceiverTCPIPInterface.cpp
|
||||
=======
|
||||
Repsitory UUID: d2bce7e372c241cd235977b92be18555bca6a77d
|
||||
Revision: 839
|
||||
Branch: 4.0.0
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 4020
|
||||
Last Changed Date: 2018-09-27 17:58:04.000000002 +0200 ./src/UDPStandardImplementation.cpp
|
||||
>>>>>>> developer
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include <string>
|
||||
#include <iomanip>
|
||||
#include <string.h>
|
||||
using namespace std;
|
||||
|
||||
#define MAX_MASTER_FILE_LENGTH 2000
|
||||
|
||||
@ -44,10 +43,10 @@ class BinaryFileStatic {
|
||||
static std::string CreateFileName(char* fpath, char* fnameprefix, uint64_t findex, bool frindexenable,
|
||||
uint64_t fnum = 0, int dindex = -1, int numunits = 1, int unitindex = 0)
|
||||
{
|
||||
ostringstream osfn;
|
||||
std::ostringstream osfn;
|
||||
osfn << fpath << "/" << fnameprefix;
|
||||
if (dindex >= 0) osfn << "_d" << (dindex * numunits + unitindex);
|
||||
if (frindexenable) osfn << "_f" << setfill('0') << setw(12) << fnum;
|
||||
if (frindexenable) osfn << "_f" << std::setfill('0') << std::setw(12) << fnum;
|
||||
osfn << "_" << findex;
|
||||
osfn << ".raw";
|
||||
return osfn.str();
|
||||
@ -60,9 +59,9 @@ class BinaryFileStatic {
|
||||
* @param findex file index
|
||||
* @returns master file name
|
||||
*/
|
||||
string CreateMasterFileName(char* fpath, char* fnameprefix, uint64_t findex)
|
||||
std::string CreateMasterFileName(char* fpath, char* fnameprefix, uint64_t findex)
|
||||
{
|
||||
ostringstream osfn;
|
||||
std::ostringstream osfn;
|
||||
osfn << fpath << "/" << fnameprefix;
|
||||
osfn << "_master";
|
||||
osfn << "_" << findex;
|
||||
@ -115,7 +114,7 @@ class BinaryFileStatic {
|
||||
* @param version version of software for binary writing
|
||||
* @returns 0 for success and 1 for fail
|
||||
*/
|
||||
static int CreateMasterDataFile(FILE*& fd, string fname, bool owenable,
|
||||
static int CreateMasterDataFile(FILE*& fd, std::string fname, bool owenable,
|
||||
uint32_t dr, bool tenE, uint32_t size,
|
||||
uint32_t nPixelsX, uint32_t nPixelsY, uint64_t nf,
|
||||
uint32_t maxf,
|
||||
@ -140,8 +139,8 @@ class BinaryFileStatic {
|
||||
"Dynamic Range : %d\n"
|
||||
"Ten Giga : %d\n"
|
||||
"Image Size : %d bytes\n"
|
||||
"x : %d pixels\n"
|
||||
"y : %d pixels\n"
|
||||
"row : %d pixels\n"
|
||||
"col : %d pixels\n"
|
||||
"Max. Frames Per File : %u\n"
|
||||
"Total Frames : %lld\n"
|
||||
"Exptime (ns) : %lld\n"
|
||||
@ -157,9 +156,9 @@ class BinaryFileStatic {
|
||||
"Bunch ID : 8 bytes\n"
|
||||
"Timestamp : 8 bytes\n"
|
||||
"Module Id : 2 bytes\n"
|
||||
"X Coordinate : 2 bytes\n"
|
||||
"Y Coordinate : 2 bytes\n"
|
||||
"Z Coordinate : 2 bytes\n"
|
||||
"Row : 2 bytes\n"
|
||||
"Column : 2 bytes\n"
|
||||
"Reserved : 2 bytes\n"
|
||||
"Debug : 4 bytes\n"
|
||||
"Round Robin Number : 2 bytes\n"
|
||||
"Detector Type : 1 byte\n"
|
||||
|
@ -35,6 +35,9 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
|
||||
* @param freq pointer to streaming frequency
|
||||
* @param timer pointer to timer if streaming frequency is random
|
||||
* @param fp pointer to frame padding enable
|
||||
* @param act pointer to activated
|
||||
* @param depaden pointer to deactivated padding enable
|
||||
* @param sm pointer to silent mode
|
||||
* @param dataReadycb pointer to data ready call back function
|
||||
* @param dataModifyReadycb pointer to data ready call back function with modified
|
||||
* @param pDataReadycb pointer to arguments of data ready call back function. To write/stream a smaller size of processed data, change this value (only smaller value is allowed).
|
||||
@ -42,7 +45,7 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
|
||||
DataProcessor(int ind, detectorType dtype, Fifo*& f, fileFormat* ftype,
|
||||
bool fwenable, bool* dsEnable, bool* gpEnable, uint32_t* dr,
|
||||
uint32_t* freq, uint32_t* timer,
|
||||
bool* fp,
|
||||
bool* fp, bool* act, bool* depaden, bool* sm,
|
||||
void (*dataReadycb)(char*, char*, uint32_t, void*),
|
||||
void (*dataModifyReadycb)(char*, char*, uint32_t &, void*),
|
||||
void *pDataReadycb);
|
||||
@ -200,11 +203,7 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
|
||||
*/
|
||||
void SetPixelDimension();
|
||||
|
||||
/**
|
||||
* Set Silent Mode
|
||||
* @param mode 1 sets 0 unsets
|
||||
*/
|
||||
void SetSilentMode(bool mode);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
@ -333,10 +332,17 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
|
||||
/** temporary buffer for processing */
|
||||
char* tempBuffer;
|
||||
|
||||
/** x coord hardcoded ad 1D, if detector does not send them yet **/
|
||||
uint16_t xcoordin1D;
|
||||
/** Activated/Deactivated */
|
||||
bool* activated;
|
||||
|
||||
/** Deactivated padding enable */
|
||||
bool* deactivatedPaddingEnable;
|
||||
|
||||
/** Silent Mode */
|
||||
bool* silentMode;
|
||||
|
||||
/** frame padding */
|
||||
bool* framePadding;
|
||||
|
||||
//acquisition start
|
||||
/** Aquisition Started flag */
|
||||
@ -363,12 +369,6 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
|
||||
uint64_t currentFrameIndex;
|
||||
|
||||
|
||||
/** Silent Mode */
|
||||
bool silentMode;
|
||||
|
||||
/** frame padding */
|
||||
bool* framePadding;
|
||||
|
||||
//call back
|
||||
/**
|
||||
* Call back for raw data
|
||||
@ -380,7 +380,6 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
|
||||
void (*rawDataReadyCallBack)(char*,
|
||||
char*, uint32_t, void*);
|
||||
|
||||
|
||||
/**
|
||||
* Call back for raw data (modified)
|
||||
* args to raw data ready callback are
|
||||
|
@ -14,6 +14,8 @@ class Fifo;
|
||||
class DataStreamer;
|
||||
class ZmqSocket;
|
||||
|
||||
#include <vector>
|
||||
|
||||
class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
|
||||
|
||||
public:
|
||||
@ -23,12 +25,14 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
|
||||
* @param ind self index
|
||||
* @param f address of Fifo pointer
|
||||
* @param dr pointer to dynamic range
|
||||
* @param sEnable pointer to short frame enable
|
||||
* @param r roi
|
||||
* @param fi pointer to file index
|
||||
* @param fd flipped data enable for x and y dimensions
|
||||
* @param ajh additional json header
|
||||
* @param sm pointer to silent mode
|
||||
*/
|
||||
DataStreamer(int ind, Fifo*& f, uint32_t* dr, int* sEnable, uint64_t* fi, int* fd, char* ajh);
|
||||
DataStreamer(int ind, Fifo*& f, uint32_t* dr, std::vector<ROI>* r,
|
||||
uint64_t* fi, int* fd, char* ajh, bool* sm);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
@ -104,11 +108,6 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
|
||||
*/
|
||||
int RestreamStop();
|
||||
|
||||
/**
|
||||
* Set Silent Mode
|
||||
* @param mode 1 sets 0 unsets
|
||||
*/
|
||||
void SetSilentMode(bool mode);
|
||||
|
||||
private:
|
||||
|
||||
@ -175,12 +174,25 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
|
||||
/** Pointer to dynamic range */
|
||||
uint32_t* dynamicRange;
|
||||
|
||||
/** Pointer to short frame enable */
|
||||
int* shortFrameEnable;
|
||||
/** ROI */
|
||||
std::vector<ROI>* roi;
|
||||
|
||||
/** adc Configured */
|
||||
int adcConfigured;
|
||||
|
||||
/** Pointer to file index */
|
||||
uint64_t* fileIndex;
|
||||
|
||||
/** flipped data across both dimensions enable */
|
||||
int* flippedData;
|
||||
|
||||
/** additional json header */
|
||||
char* additionJsonHeader;
|
||||
|
||||
/** Silent Mode */
|
||||
bool* silentMode;
|
||||
|
||||
|
||||
/** Aquisition Started flag */
|
||||
bool acquisitionStartedFlag;
|
||||
|
||||
@ -199,13 +211,5 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
|
||||
/** Complete buffer used for roi, eg. shortGotthard */
|
||||
char* completeBuffer;
|
||||
|
||||
/** flipped data across both dimensions enable */
|
||||
int* flippedData;
|
||||
|
||||
/** additional json header */
|
||||
char* additionJsonHeader;
|
||||
|
||||
/** Silent Mode */
|
||||
bool silentMode;
|
||||
};
|
||||
|
||||
|
@ -211,7 +211,7 @@ class File : private virtual slsReceiverDefs {
|
||||
uint32_t* udpPortNumber;
|
||||
|
||||
/** Silent Mode */
|
||||
bool silentMode;
|
||||
bool* silentMode;
|
||||
|
||||
};
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "receiver_defs.h"
|
||||
|
||||
#include <math.h> //ceil
|
||||
#include <vector>
|
||||
|
||||
|
||||
class GeneralData {
|
||||
@ -155,6 +156,25 @@ public:
|
||||
frameNumber = (frameNumber & frameIndexMask) >> frameIndexOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ROI
|
||||
* @param i ROI
|
||||
*/
|
||||
virtual void SetROI(std::vector<slsReceiverDefs::ROI> i) {
|
||||
cprintf(RED,"This is a generic function that should be overloaded by a derived class\n");
|
||||
};
|
||||
|
||||
/**
|
||||
* Get Adc configured
|
||||
* @param index thread index for debugging purposes
|
||||
* @param i pointer to a vector of ROI pointers
|
||||
* @returns adc configured
|
||||
*/
|
||||
virtual const int GetAdcConfigured(int index, std::vector<slsReceiverDefs::ROI>* i) const{
|
||||
cprintf(RED,"This is a generic function that should be overloaded by a derived class\n");
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Setting dynamic range changes member variables
|
||||
* @param dr dynamic range
|
||||
@ -225,6 +245,10 @@ public:
|
||||
|
||||
class GotthardData : public GeneralData {
|
||||
|
||||
private:
|
||||
const static int nChip = 10;
|
||||
const static int nChan = 128;
|
||||
const static int nChipsPerAdc = 2;
|
||||
public:
|
||||
|
||||
/** Constructor */
|
||||
@ -244,32 +268,8 @@ class GotthardData : public GeneralData {
|
||||
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + sizeof(slsReceiverDefs::sls_receiver_header);
|
||||
defaultFifoDepth = 50000;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
class ShortGotthardData : public GeneralData {
|
||||
|
||||
public:
|
||||
|
||||
/** Constructor */
|
||||
ShortGotthardData(){
|
||||
myDetectorType = slsReceiverDefs::GOTTHARD;
|
||||
nPixelsX = 256;
|
||||
nPixelsY = 1;
|
||||
headerSizeinPacket = 4;
|
||||
dataSize = 512;
|
||||
packetSize = 518;
|
||||
packetsPerFrame = 1;
|
||||
imageSize = dataSize*packetsPerFrame;
|
||||
frameIndexMask = 0xFFFFFFFF;
|
||||
maxFramesPerFile = SHORT_MAX_FRAMES_PER_FILE;
|
||||
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + sizeof(slsReceiverDefs::sls_receiver_header);
|
||||
defaultFifoDepth = 50000;
|
||||
nPixelsXComplete = 1280;
|
||||
nPixelsYComplete = 1;
|
||||
imageSizeComplete = 1280 * 2;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get Header Infomation (frame number, packet number)
|
||||
* @param index thread index for debugging purposes
|
||||
@ -279,8 +279,15 @@ class ShortGotthardData : public GeneralData {
|
||||
*/
|
||||
virtual void GetHeaderInfo(int index, char* packetData, uint64_t& frameNumber, uint32_t& packetNumber) const
|
||||
{
|
||||
frameNumber = ((uint32_t)(*((uint32_t*)(packetData))));
|
||||
packetNumber = 0;
|
||||
if (nPixelsX == 1280) {
|
||||
frameNumber = ((uint32_t)(*((uint32_t*)(packetData))));
|
||||
frameNumber++;
|
||||
packetNumber = frameNumber&packetIndexMask;
|
||||
frameNumber = (frameNumber & frameIndexMask) >> frameIndexOffset;
|
||||
} else {
|
||||
frameNumber = ((uint32_t)(*((uint32_t*)(packetData))));
|
||||
packetNumber = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -296,11 +303,96 @@ class ShortGotthardData : public GeneralData {
|
||||
virtual void GetHeaderInfo(int index, char* packetData, uint32_t dynamicRange,
|
||||
uint64_t& frameNumber, uint32_t& packetNumber, uint32_t& subFrameNumber, uint64_t& bunchId) const
|
||||
{
|
||||
subFrameNumber = -1;
|
||||
bunchId = -1;
|
||||
frameNumber = ((uint32_t)(*((uint32_t*)(packetData))));
|
||||
packetNumber = 0;
|
||||
if (nPixelsX == 1280) {
|
||||
subFrameNumber = -1;
|
||||
bunchId = -1;
|
||||
frameNumber = ((uint32_t)(*((uint32_t*)(packetData))));
|
||||
frameNumber++;
|
||||
packetNumber = frameNumber&packetIndexMask;
|
||||
frameNumber = (frameNumber & frameIndexMask) >> frameIndexOffset;
|
||||
} else {
|
||||
subFrameNumber = -1;
|
||||
bunchId = -1;
|
||||
frameNumber = ((uint32_t)(*((uint32_t*)(packetData))));
|
||||
packetNumber = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set ROI
|
||||
* @param i ROI
|
||||
*/
|
||||
virtual void SetROI(std::vector<slsReceiverDefs::ROI> i) {
|
||||
// all adcs
|
||||
if(!i.size()) {
|
||||
nPixelsX = 1280;
|
||||
dataSize = 1280;
|
||||
packetSize = GOTTHARD_PACKET_SIZE;
|
||||
packetsPerFrame = 2;
|
||||
imageSize = dataSize*packetsPerFrame;
|
||||
frameIndexMask = 0xFFFFFFFE;
|
||||
frameIndexOffset = 1;
|
||||
packetIndexMask = 1;
|
||||
maxFramesPerFile = MAX_FRAMES_PER_FILE;
|
||||
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + sizeof(slsReceiverDefs::sls_receiver_header);
|
||||
defaultFifoDepth = 50000;
|
||||
nPixelsXComplete = 0;
|
||||
nPixelsYComplete = 0;
|
||||
imageSizeComplete = 0;
|
||||
}
|
||||
|
||||
// single adc
|
||||
else {
|
||||
nPixelsX = 256;
|
||||
dataSize = 512;
|
||||
packetSize = 518;
|
||||
packetsPerFrame = 1;
|
||||
imageSize = dataSize*packetsPerFrame;
|
||||
frameIndexMask = 0xFFFFFFFF;
|
||||
frameIndexOffset = 0;
|
||||
packetIndexMask = 0;
|
||||
maxFramesPerFile = SHORT_MAX_FRAMES_PER_FILE;
|
||||
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + sizeof(slsReceiverDefs::sls_receiver_header);
|
||||
defaultFifoDepth = 25000;
|
||||
nPixelsXComplete = 1280;
|
||||
nPixelsYComplete = 1;
|
||||
imageSizeComplete = 1280 * 2;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get Adc configured
|
||||
* @param index thread index for debugging purposes
|
||||
* @param i pointer to a vector of ROI
|
||||
* @returns adc configured
|
||||
*/
|
||||
virtual const int GetAdcConfigured(int index, std::vector<slsReceiverDefs::ROI>* i) const{
|
||||
int adc = -1;
|
||||
// single adc
|
||||
if(i->size()) {
|
||||
// gotthard can have only one adc per detector enabled (or all)
|
||||
// so just looking at the first roi is enough (more not possible at the moment)
|
||||
|
||||
//if its for 1 adc or general
|
||||
if ((i->at(0).xmin == 0) && (i->at(0).xmax == nChip * nChan))
|
||||
adc = -1;
|
||||
else {
|
||||
//adc = mid value/numchans also for only 1 roi
|
||||
adc = ((((i->at(0).xmax) + (i->at(0).xmin))/2)/
|
||||
(nChan * nChipsPerAdc));
|
||||
if((adc < 0) || (adc > 4)) {
|
||||
FILE_LOG(logWARNING) << index << ": Deleting ROI. "
|
||||
"Adc value should be between 0 and 4";
|
||||
adc = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
FILE_LOG(logINFO) << "Adc Configured: " << adc;
|
||||
return adc;
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -114,6 +114,9 @@ class HDF5File : private virtual slsReceiverDefs, public File, public HDF5FileSt
|
||||
*/
|
||||
void EndofAcquisition(bool anyPacketsCaught, uint64_t numf);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Create Virtual File
|
||||
* @param numf number of images caught
|
||||
@ -121,8 +124,12 @@ class HDF5File : private virtual slsReceiverDefs, public File, public HDF5FileSt
|
||||
*/
|
||||
int CreateVirtualFile(uint64_t numf);
|
||||
|
||||
|
||||
private:
|
||||
/**
|
||||
* Link virtual file in master file
|
||||
* Only for Jungfrau at the moment for 1 module and 1 data file
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int LinkVirtualFileinMasterFile();
|
||||
|
||||
/**
|
||||
* Get Type
|
||||
@ -174,16 +181,16 @@ class HDF5File : private virtual slsReceiverDefs, public File, public HDF5FileSt
|
||||
int numFilesinAcquisition;
|
||||
|
||||
/** parameter names */
|
||||
vector <const char*> parameterNames;
|
||||
std::vector <const char*> parameterNames;
|
||||
|
||||
/** parameter data types */
|
||||
vector <DataType> parameterDataTypes;
|
||||
std::vector <DataType> parameterDataTypes;
|
||||
|
||||
/** Dataspace of parameters */
|
||||
DataSpace* dataspace_para;
|
||||
|
||||
/** Dataset array for parameters */
|
||||
vector <DataSet*> dataset_para;
|
||||
std::vector <DataSet*> dataset_para;
|
||||
|
||||
/** Number of Images (including extended during acquisition) */
|
||||
uint64_t extNumImages;
|
||||
|
@ -23,7 +23,6 @@ using namespace H5;
|
||||
#include <stdlib.h> //malloc
|
||||
#include <sstream>
|
||||
#include <cstring> //memset
|
||||
using namespace std;
|
||||
|
||||
class HDF5FileStatic: public virtual slsReceiverDefs {
|
||||
|
||||
@ -48,13 +47,13 @@ public:
|
||||
* @param unitindex unit index
|
||||
* @returns complete file name created
|
||||
*/
|
||||
static string CreateFileName(char* fpath, char* fnameprefix, uint64_t findex, bool frindexenable,
|
||||
static std::string CreateFileName(char* fpath, char* fnameprefix, uint64_t findex, bool frindexenable,
|
||||
uint64_t fnum = 0, int dindex = -1, int numunits = 1, int unitindex = 0)
|
||||
{
|
||||
ostringstream osfn;
|
||||
std::ostringstream osfn;
|
||||
osfn << fpath << "/" << fnameprefix;
|
||||
if (dindex >= 0) osfn << "_d" << (dindex * numunits + unitindex);
|
||||
if (frindexenable) osfn << "_f" << setfill('0') << setw(12) << fnum;
|
||||
if (frindexenable) osfn << "_f" << std::setfill('0') << std::setw(12) << fnum;
|
||||
osfn << "_" << findex;
|
||||
osfn << ".h5";
|
||||
return osfn.str();
|
||||
@ -67,9 +66,9 @@ public:
|
||||
* @param findex file index
|
||||
* @returns master file name
|
||||
*/
|
||||
static string CreateMasterFileName(char* fpath, char* fnameprefix, uint64_t findex)
|
||||
static std::string CreateMasterFileName(char* fpath, char* fnameprefix, uint64_t findex)
|
||||
{
|
||||
ostringstream osfn;
|
||||
std::ostringstream osfn;
|
||||
osfn << fpath << "/" << fnameprefix;
|
||||
osfn << "_master";
|
||||
osfn << "_" << findex;
|
||||
@ -85,9 +84,9 @@ public:
|
||||
* @param findex file index
|
||||
* @returns virtual file name
|
||||
*/
|
||||
static string CreateVirtualFileName(char* fpath, char* fnameprefix, uint64_t findex)
|
||||
static std::string CreateVirtualFileName(char* fpath, char* fnameprefix, uint64_t findex)
|
||||
{
|
||||
ostringstream osfn;
|
||||
std::ostringstream osfn;
|
||||
osfn << fpath << "/" << fnameprefix;
|
||||
osfn << "_virtual";
|
||||
osfn << "_" << findex;
|
||||
@ -197,29 +196,30 @@ public:
|
||||
* @param parameterDataTypes parameter datatypes
|
||||
*/
|
||||
static int WriteParameterDatasets(int ind, DataSpace* dspace_para, uint64_t fnum,
|
||||
vector <DataSet*> dset_para,sls_receiver_header* rheader,
|
||||
vector <DataType> parameterDataTypes)
|
||||
std::vector <DataSet*> dset_para,sls_receiver_header* rheader,
|
||||
std::vector <DataType> parameterDataTypes)
|
||||
{
|
||||
sls_detector_header header = rheader->detHeader;
|
||||
hsize_t count[1] = {1};
|
||||
hsize_t start[1] = {fnum};
|
||||
int i = 0;
|
||||
try{
|
||||
Exception::dontPrint(); //to handle errors
|
||||
dspace_para->selectHyperslab( H5S_SELECT_SET, count, start);
|
||||
DataSpace memspace(H5S_SCALAR);
|
||||
dset_para[0]->write(&header.frameNumber, parameterDataTypes[0], memspace, *dspace_para);
|
||||
dset_para[1]->write(&header.expLength, parameterDataTypes[1], memspace, *dspace_para);
|
||||
dset_para[2]->write(&header.packetNumber, parameterDataTypes[2], memspace, *dspace_para);
|
||||
dset_para[3]->write(&header.bunchId, parameterDataTypes[3], memspace, *dspace_para);
|
||||
dset_para[4]->write(&header.timestamp, parameterDataTypes[4], memspace, *dspace_para);
|
||||
dset_para[5]->write(&header.modId, parameterDataTypes[5], memspace, *dspace_para);
|
||||
dset_para[6]->write(&header.xCoord, parameterDataTypes[6], memspace, *dspace_para);
|
||||
dset_para[7]->write(&header.yCoord, parameterDataTypes[7], memspace, *dspace_para);
|
||||
dset_para[8]->write(&header.zCoord, parameterDataTypes[8], memspace, *dspace_para);
|
||||
dset_para[9]->write(&header.debug, parameterDataTypes[9], memspace, *dspace_para);
|
||||
dset_para[10]->write(&header.roundRNumber, parameterDataTypes[10], memspace, *dspace_para);
|
||||
dset_para[11]->write(&header.detType, parameterDataTypes[11], memspace, *dspace_para);
|
||||
dset_para[12]->write(&header.version, parameterDataTypes[12], memspace, *dspace_para);
|
||||
dset_para[0]->write(&header.frameNumber, parameterDataTypes[0], memspace, *dspace_para);i=1;
|
||||
dset_para[1]->write(&header.expLength, parameterDataTypes[1], memspace, *dspace_para);i=2;
|
||||
dset_para[2]->write(&header.packetNumber, parameterDataTypes[2], memspace, *dspace_para);i=3;
|
||||
dset_para[3]->write(&header.bunchId, parameterDataTypes[3], memspace, *dspace_para);i=4;
|
||||
dset_para[4]->write(&header.timestamp, parameterDataTypes[4], memspace, *dspace_para);i=5;
|
||||
dset_para[5]->write(&header.modId, parameterDataTypes[5], memspace, *dspace_para);i=6;
|
||||
dset_para[6]->write(&header.row, parameterDataTypes[6], memspace, *dspace_para);i=7;
|
||||
dset_para[7]->write(&header.column, parameterDataTypes[7], memspace, *dspace_para);i=8;
|
||||
dset_para[8]->write(&header.reserved, parameterDataTypes[8], memspace, *dspace_para);i=9;
|
||||
dset_para[9]->write(&header.debug, parameterDataTypes[9], memspace, *dspace_para);i=10;
|
||||
dset_para[10]->write(&header.roundRNumber, parameterDataTypes[10], memspace, *dspace_para);i=11;
|
||||
dset_para[11]->write(&header.detType, parameterDataTypes[11], memspace, *dspace_para);i=12;
|
||||
dset_para[12]->write(&header.version, parameterDataTypes[12], memspace, *dspace_para);i=13;
|
||||
|
||||
// contiguous bitset
|
||||
if (sizeof(sls_bitset) == sizeof(bitset_storage)) {
|
||||
@ -236,10 +236,10 @@ public:
|
||||
storage[i >> 3] |= (bits[i] << (i & 7));
|
||||
// write bitmask
|
||||
dset_para[13]->write((char*)storage, parameterDataTypes[13], memspace, *dspace_para);
|
||||
}
|
||||
}i=14;
|
||||
}
|
||||
catch(Exception error){
|
||||
cprintf(RED,"Error in writing parameters to file in object %d\n",ind);
|
||||
cprintf(RED,"Error in writing parameters (index:%d) to file in object %d\n", i, ind);
|
||||
error.printErrorStack();
|
||||
return 1;
|
||||
}
|
||||
@ -259,7 +259,7 @@ public:
|
||||
* @returns 0 for success and 1 for fail
|
||||
*/
|
||||
static int ExtendDataset(int ind, DataSpace*& dspace, DataSet* dset,
|
||||
DataSpace*& dspace_para, vector <DataSet*> dset_para,
|
||||
DataSpace*& dspace_para, std::vector <DataSet*> dset_para,
|
||||
uint64_t initialNumImages) {
|
||||
try{
|
||||
Exception::dontPrint(); //to handle errors
|
||||
@ -270,12 +270,14 @@ public:
|
||||
|
||||
dset->extend(dims);
|
||||
delete dspace;
|
||||
dspace = 0;
|
||||
dspace = new DataSpace(dset->getSpace());
|
||||
|
||||
hsize_t dims_para[1] = {dims[0]};
|
||||
for (unsigned int i = 0; i < dset_para.size(); ++i)
|
||||
dset_para[i]->extend(dims_para);
|
||||
delete dspace_para;
|
||||
dspace_para = 0;
|
||||
dspace_para = new DataSpace(dset_para[0]->getSpace());
|
||||
|
||||
}
|
||||
@ -306,7 +308,7 @@ public:
|
||||
* @param version version of software for hdf5 writing
|
||||
* @returns 0 for success and 1 for fail
|
||||
*/
|
||||
static int CreateMasterDataFile(H5File*& fd, string fname, bool owenable,
|
||||
static int CreateMasterDataFile(H5File*& fd, std::string fname, bool owenable,
|
||||
uint32_t dr, bool tenE, uint32_t size,
|
||||
uint32_t nPixelsx, uint32_t nPixelsy, uint64_t nf,
|
||||
uint32_t maxf,
|
||||
@ -318,6 +320,7 @@ public:
|
||||
|
||||
FileAccPropList flist;
|
||||
flist.setFcloseDegree(H5F_CLOSE_STRONG);
|
||||
fd = 0;
|
||||
if(!owenable)
|
||||
fd = new H5File( fname.c_str(), H5F_ACC_EXCL,
|
||||
FileCreatPropList::DEFAULT,
|
||||
@ -353,7 +356,7 @@ public:
|
||||
dataset = group5.createDataSet ( "dynamic range", PredType::NATIVE_INT, dataspace );
|
||||
dataset.write ( &dr, PredType::NATIVE_INT);
|
||||
attribute = dataset.createAttribute("unit",strdatatype, dataspace);
|
||||
attribute.write(strdatatype, string("bits"));
|
||||
attribute.write(strdatatype, std::string("bits"));
|
||||
|
||||
//Ten Giga
|
||||
iValue = tenE;
|
||||
@ -364,7 +367,7 @@ public:
|
||||
dataset = group5.createDataSet ( "image size", PredType::NATIVE_INT, dataspace );
|
||||
dataset.write ( &size, PredType::NATIVE_INT);
|
||||
attribute = dataset.createAttribute("unit",strdatatype, dataspace);
|
||||
attribute.write(strdatatype, string("bytes"));
|
||||
attribute.write(strdatatype, std::string("bytes"));
|
||||
|
||||
//x
|
||||
dataset = group5.createDataSet ( "number of pixels in x axis", PredType::NATIVE_INT, dataspace );
|
||||
@ -386,36 +389,37 @@ public:
|
||||
dataset = group5.createDataSet ( "exposure time", PredType::STD_U64LE, dataspace );
|
||||
dataset.write ( &acquisitionTime, PredType::STD_U64LE);
|
||||
attribute = dataset.createAttribute("unit",strdatatype, dataspace);
|
||||
attribute.write(strdatatype, string("ns"));
|
||||
attribute.write(strdatatype, std::string("ns"));
|
||||
|
||||
//SubExptime
|
||||
dataset = group5.createDataSet ( "sub exposure time", PredType::STD_U64LE, dataspace );
|
||||
dataset.write ( &subexposuretime, PredType::STD_U64LE);
|
||||
attribute = dataset.createAttribute("unit",strdatatype, dataspace);
|
||||
attribute.write(strdatatype, string("ns"));
|
||||
attribute.write(strdatatype, std::string("ns"));
|
||||
|
||||
//SubPeriod
|
||||
dataset = group5.createDataSet ( "sub period", PredType::STD_U64LE, dataspace );
|
||||
dataset.write ( &subperiod, PredType::STD_U64LE);
|
||||
attribute = dataset.createAttribute("unit",strdatatype, dataspace);
|
||||
attribute.write(strdatatype, string("ns"));
|
||||
attribute.write(strdatatype, std::string("ns"));
|
||||
|
||||
//Period
|
||||
dataset = group5.createDataSet ( "acquisition period", PredType::STD_U64LE, dataspace );
|
||||
dataset.write ( &acquisitionPeriod, PredType::STD_U64LE);
|
||||
attribute = dataset.createAttribute("unit",strdatatype, dataspace);
|
||||
attribute.write(strdatatype, string("ns"));
|
||||
attribute.write(strdatatype, std::string("ns"));
|
||||
|
||||
//Timestamp
|
||||
time_t t = time(0);
|
||||
dataset = group5.createDataSet ( "timestamp", strdatatype, dataspace );
|
||||
dataset.write ( string(ctime(&t)), strdatatype );
|
||||
dataset.write ( std::string(ctime(&t)), strdatatype );
|
||||
|
||||
fd->close();
|
||||
|
||||
} catch(Exception error) {
|
||||
cprintf(RED,"Error in creating master HDF5 handles\n");
|
||||
error.printErrorStack();
|
||||
if (fd) fd->close();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@ -445,13 +449,13 @@ public:
|
||||
* @param parameterDataTypes parameter datatypes
|
||||
* @returns 0 for success and 1 for fail
|
||||
*/
|
||||
static int CreateDataFile(int ind, bool owenable, string fname, bool frindexenable,
|
||||
static int CreateDataFile(int ind, bool owenable, std::string fname, bool frindexenable,
|
||||
uint64_t fnum, uint64_t nDimx, uint32_t nDimy, uint32_t nDimz,
|
||||
DataType dtype, H5File*& fd, DataSpace*& dspace, DataSet*& dset,
|
||||
double version, uint64_t maxchunkedimages,
|
||||
DataSpace*& dspace_para, vector<DataSet*>& dset_para,
|
||||
vector <const char*> parameterNames,
|
||||
vector <DataType> parameterDataTypes)
|
||||
DataSpace*& dspace_para, std::vector<DataSet*>& dset_para,
|
||||
std::vector <const char*> parameterNames,
|
||||
std::vector <DataType> parameterDataTypes)
|
||||
{
|
||||
try {
|
||||
Exception::dontPrint(); //to handle errors
|
||||
@ -459,6 +463,7 @@ public:
|
||||
//file
|
||||
FileAccPropList fapl;
|
||||
fapl.setFcloseDegree(H5F_CLOSE_STRONG);
|
||||
fd = 0;
|
||||
if(!owenable)
|
||||
fd = new H5File( fname.c_str(), H5F_ACC_EXCL,
|
||||
FileCreatPropList::DEFAULT,
|
||||
@ -477,14 +482,15 @@ public:
|
||||
//dataspace
|
||||
hsize_t srcdims[3] = {nDimx, nDimy, nDimz};
|
||||
hsize_t srcdimsmax[3] = {H5S_UNLIMITED, nDimy, nDimz};
|
||||
dspace = 0;
|
||||
dspace = new DataSpace (3,srcdims,srcdimsmax);
|
||||
|
||||
|
||||
//dataset name
|
||||
ostringstream osfn;
|
||||
std::ostringstream osfn;
|
||||
osfn << "/data";
|
||||
if (frindexenable) osfn << "_f" << setfill('0') << setw(12) << fnum;
|
||||
string dsetname = osfn.str();
|
||||
if (frindexenable) osfn << "_f" << std::setfill('0') << std::setw(12) << fnum;
|
||||
std::string dsetname = osfn.str();
|
||||
|
||||
//dataset
|
||||
//fill value
|
||||
@ -494,11 +500,13 @@ public:
|
||||
// always create chunked dataset as unlimited is only supported with chunked layout
|
||||
hsize_t chunk_dims[3] ={maxchunkedimages, nDimy, nDimz};
|
||||
plist.setChunk(3, chunk_dims);
|
||||
dset = 0;
|
||||
dset = new DataSet (fd->createDataSet(dsetname.c_str(), dtype, *dspace, plist));
|
||||
|
||||
//create parameter datasets
|
||||
hsize_t dims[1] = {nDimx};
|
||||
hsize_t dimsmax[1] = {H5S_UNLIMITED};
|
||||
dspace_para = 0;
|
||||
dspace_para = new DataSpace (1,dims,dimsmax);
|
||||
|
||||
// always create chunked dataset as unlimited is only supported with chunked layout
|
||||
@ -515,7 +523,7 @@ public:
|
||||
catch(Exception error){
|
||||
cprintf(RED,"Error in creating HDF5 handles in object %d\n",ind);
|
||||
error.printErrorStack();
|
||||
fd->close();
|
||||
if (fd) fd->close();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@ -525,6 +533,7 @@ public:
|
||||
/**
|
||||
* Create virtual file
|
||||
* (in C because H5Pset_virtual doesnt exist yet in C++)
|
||||
* @param virtualFileName virtual file name
|
||||
* @param fd virtual file handle
|
||||
* @param masterFileName master file name
|
||||
* @param fpath file path
|
||||
@ -547,55 +556,52 @@ public:
|
||||
* @returns 0 for success and 1 for fail
|
||||
*/
|
||||
static int CreateVirtualDataFile(
|
||||
hid_t& fd, string masterFileName,
|
||||
std::string virtualFileName,
|
||||
hid_t& fd, std::string masterFileName,
|
||||
char* fpath, char* fnameprefix, uint64_t findex, bool frindexenable,
|
||||
int dindex, int numunits,
|
||||
uint32_t maxFramesPerFile, uint64_t numf,
|
||||
string srcDataseName, DataType dataType,
|
||||
std::string srcDataseName, DataType dataType,
|
||||
int numDety, int numDetz, uint32_t nDimy, uint32_t nDimz,
|
||||
double version,
|
||||
vector <const char*> parameterNames,
|
||||
vector <DataType> parameterDataTypes)
|
||||
std::vector <const char*> parameterNames,
|
||||
std::vector <DataType> parameterDataTypes)
|
||||
{
|
||||
//virtual names
|
||||
string virtualFileName = CreateVirtualFileName(fpath, fnameprefix, findex);
|
||||
FILE_LOG(logINFO) << "Virtual File: " << virtualFileName;
|
||||
|
||||
//file
|
||||
hid_t dfal = H5Pcreate (H5P_FILE_ACCESS);
|
||||
if (dfal < 0)
|
||||
return CloseFileOnError(fd,
|
||||
string("Error in creating file access property for virtual file ")
|
||||
+ virtualFileName + string("\n"));
|
||||
std::string("Error in creating file access property for virtual file ")
|
||||
+ virtualFileName + std::string("\n"));
|
||||
if (H5Pset_fclose_degree (dfal, H5F_CLOSE_STRONG) < 0)
|
||||
return CloseFileOnError(fd,
|
||||
string("Error in setting strong file close degree for virtual file ")
|
||||
+ virtualFileName + string("\n"));
|
||||
std::string("Error in setting strong file close degree for virtual file ")
|
||||
+ virtualFileName + std::string("\n"));
|
||||
fd = H5Fcreate( virtualFileName.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, dfal);
|
||||
if (fd < 0)
|
||||
return CloseFileOnError(fd,
|
||||
string("Error in creating virtual file ") + virtualFileName + string("\n"));
|
||||
std::string("Error in creating virtual file ") + virtualFileName + std::string("\n"));
|
||||
|
||||
//attributes - version
|
||||
hid_t dataspace_attr = H5Screate (H5S_SCALAR);
|
||||
if (dataspace_attr < 0)
|
||||
return CloseFileOnError(fd,
|
||||
string("Error in creating dataspace for attribute in virtual file ")
|
||||
+ virtualFileName + string("\n"));
|
||||
std::string("Error in creating dataspace for attribute in virtual file ")
|
||||
+ virtualFileName + std::string("\n"));
|
||||
hid_t attrid = H5Acreate2 (fd, "version", H5T_NATIVE_DOUBLE, dataspace_attr, H5P_DEFAULT, H5P_DEFAULT);
|
||||
if (attrid < 0)
|
||||
return CloseFileOnError(fd,
|
||||
string("Error in creating attribute in virtual file ")
|
||||
+ virtualFileName + string("\n"));
|
||||
std::string("Error in creating attribute in virtual file ")
|
||||
+ virtualFileName + std::string("\n"));
|
||||
double attr_data = version;
|
||||
if (H5Awrite (attrid, H5T_NATIVE_DOUBLE, &attr_data) < 0)
|
||||
return CloseFileOnError(fd,
|
||||
string("Error in writing attribute in virtual file ")
|
||||
+ virtualFileName + string("\n"));
|
||||
std::string("Error in writing attribute in virtual file ")
|
||||
+ virtualFileName + std::string("\n"));
|
||||
if (H5Aclose (attrid) < 0)
|
||||
return CloseFileOnError(fd,
|
||||
string("Error in closing attribute in virtual file ")
|
||||
+ virtualFileName + string("\n"));
|
||||
std::string("Error in closing attribute in virtual file ")
|
||||
+ virtualFileName + std::string("\n"));
|
||||
|
||||
|
||||
//virtual dataspace
|
||||
@ -603,38 +609,38 @@ public:
|
||||
hid_t vdsDataspace = H5Screate_simple(3, vdsdims ,NULL);
|
||||
if (vdsDataspace < 0)
|
||||
return CloseFileOnError(fd,
|
||||
string("Error in creating virtual dataspace in virtual file ")
|
||||
+ virtualFileName + string("\n"));
|
||||
std::string("Error in creating virtual dataspace in virtual file ")
|
||||
+ virtualFileName + std::string("\n"));
|
||||
hsize_t vdsdims_para[2] = {numf, (unsigned int) numDety * numDetz};
|
||||
hid_t vdsDataspace_para = H5Screate_simple(2, vdsdims_para, NULL);
|
||||
if (vdsDataspace_para < 0)
|
||||
return CloseFileOnError(fd,
|
||||
string("Error in creating virtual dataspace (parameters) in virtual file ")
|
||||
+ virtualFileName + string("\n"));
|
||||
std::string("Error in creating virtual dataspace (parameters) in virtual file ")
|
||||
+ virtualFileName + std::string("\n"));
|
||||
|
||||
|
||||
//fill values
|
||||
hid_t dcpl = H5Pcreate (H5P_DATASET_CREATE);
|
||||
if (dcpl < 0)
|
||||
return CloseFileOnError(fd,
|
||||
string("Error in creating file creation properties in virtual file ")
|
||||
+ virtualFileName + string("\n"));
|
||||
std::string("Error in creating file creation properties in virtual file ")
|
||||
+ virtualFileName + std::string("\n"));
|
||||
int fill_value = -1;
|
||||
if (H5Pset_fill_value (dcpl, GetDataTypeinC(dataType), &fill_value) < 0)
|
||||
return CloseFileOnError(fd,
|
||||
string("Error in creating fill value in virtual file ")
|
||||
+ virtualFileName + string("\n"));
|
||||
std::string("Error in creating fill value in virtual file ")
|
||||
+ virtualFileName + std::string("\n"));
|
||||
hid_t dcpl_para[parameterNames.size()];
|
||||
for (unsigned int i = 0; i < parameterNames.size(); ++i) {
|
||||
dcpl_para[i] = H5Pcreate (H5P_DATASET_CREATE);
|
||||
if (dcpl_para[i] < 0)
|
||||
return CloseFileOnError(fd,
|
||||
string("Error in creating file creation properties (parameters) in virtual file ")
|
||||
+ virtualFileName + string("\n"));
|
||||
std::string("Error in creating file creation properties (parameters) in virtual file ")
|
||||
+ virtualFileName + std::string("\n"));
|
||||
if (H5Pset_fill_value (dcpl_para[i], GetDataTypeinC(parameterDataTypes[i]), &fill_value) < 0)
|
||||
return CloseFileOnError(fd,
|
||||
string("Error in creating fill value (parameters) in virtual file ")
|
||||
+ virtualFileName + string("\n"));
|
||||
std::string("Error in creating fill value (parameters) in virtual file ")
|
||||
+ virtualFileName + std::string("\n"));
|
||||
}
|
||||
|
||||
//hyperslab
|
||||
@ -667,22 +673,22 @@ public:
|
||||
}
|
||||
|
||||
//source file name
|
||||
string srcFileName = HDF5FileStatic::CreateFileName(fpath, fnameprefix, findex,
|
||||
std::string srcFileName = HDF5FileStatic::CreateFileName(fpath, fnameprefix, findex,
|
||||
frindexenable, framesSaved, dindex, numunits, i);
|
||||
|
||||
// find relative path
|
||||
string relative_srcFileName = srcFileName;
|
||||
std::string relative_srcFileName = srcFileName;
|
||||
{
|
||||
size_t i = srcFileName.rfind('/', srcFileName.length());
|
||||
if (i != string::npos)
|
||||
if (i != std::string::npos)
|
||||
relative_srcFileName = (srcFileName.substr(i+1, srcFileName.length() - i));
|
||||
}
|
||||
|
||||
//source dataset name
|
||||
ostringstream osfn;
|
||||
std::ostringstream osfn;
|
||||
osfn << "/data";
|
||||
if (frindexenable) osfn << "_f" << setfill('0') << setw(12) << framesSaved;
|
||||
string srcDatasetName = osfn.str();
|
||||
if (frindexenable) osfn << "_f" << std::setfill('0') << std::setw(12) << framesSaved;
|
||||
std::string srcDatasetName = osfn.str();
|
||||
|
||||
//source dataspace
|
||||
hsize_t srcdims[3] = {nDimx, nDimy, nDimz};
|
||||
@ -690,15 +696,15 @@ public:
|
||||
hid_t srcDataspace = H5Screate_simple(3, srcdims, srcdimsmax);
|
||||
if (srcDataspace < 0)
|
||||
return CloseFileOnError(fd,
|
||||
string("Error in creating source dataspace in virtual file ")
|
||||
+ virtualFileName + string("\n"));
|
||||
std::string("Error in creating source dataspace in virtual file ")
|
||||
+ virtualFileName + std::string("\n"));
|
||||
hsize_t srcdims_para[1] = {nDimx};
|
||||
hsize_t srcdimsmax_para[1] = {H5S_UNLIMITED};
|
||||
hid_t srcDataspace_para = H5Screate_simple(1, srcdims_para, srcdimsmax_para);
|
||||
if (srcDataspace_para < 0)
|
||||
return CloseFileOnError(fd,
|
||||
string("Error in creating source dataspace (parameters) in virtual file ")
|
||||
+ virtualFileName + string("\n"));
|
||||
std::string("Error in creating source dataspace (parameters) in virtual file ")
|
||||
+ virtualFileName + std::string("\n"));
|
||||
|
||||
//mapping
|
||||
if (H5Pset_virtual(dcpl, vdsDataspace, relative_srcFileName.c_str(),
|
||||
@ -730,17 +736,17 @@ public:
|
||||
}
|
||||
if (error)
|
||||
return CloseFileOnError(fd,
|
||||
string("Error in mapping files in virtual file ")
|
||||
+ virtualFileName + string("\n"));
|
||||
std::string("Error in mapping files in virtual file ")
|
||||
+ virtualFileName + std::string("\n"));
|
||||
|
||||
//dataset
|
||||
string virtualDatasetName = srcDataseName;
|
||||
std::string virtualDatasetName = srcDataseName;
|
||||
hid_t vdsdataset = H5Dcreate2 (fd, virtualDatasetName.c_str(),
|
||||
GetDataTypeinC(dataType), vdsDataspace, H5P_DEFAULT, dcpl, H5P_DEFAULT);
|
||||
if (vdsdataset < 0)
|
||||
return CloseFileOnError(fd,
|
||||
string("Error in creating virutal dataset in virtual file ")
|
||||
+ virtualFileName + string("\n"));
|
||||
std::string("Error in creating virutal dataset in virtual file ")
|
||||
+ virtualFileName + std::string("\n"));
|
||||
|
||||
|
||||
//virtual parameter dataset
|
||||
@ -751,8 +757,8 @@ public:
|
||||
H5P_DEFAULT, dcpl_para[i], H5P_DEFAULT);
|
||||
if (vdsdataset_para < 0)
|
||||
return CloseFileOnError(fd,
|
||||
string("Error in creating virutal dataset (parameters) in virtual file ")
|
||||
+ virtualFileName + string("\n"));
|
||||
std::string("Error in creating virutal dataset (parameters) in virtual file ")
|
||||
+ virtualFileName + std::string("\n"));
|
||||
}
|
||||
|
||||
//close
|
||||
@ -779,8 +785,8 @@ public:
|
||||
* @returns 0 for success and 1 for fail
|
||||
*/
|
||||
template <typename T>
|
||||
static int CopyVirtualFile(T datatype, bool owenable, string oldFileName, string oldDatasetName,
|
||||
string newFileName, string newDatasetName, int rank,
|
||||
static int CopyVirtualFile(T datatype, bool owenable, std::string oldFileName, std::string oldDatasetName,
|
||||
std::string newFileName, std::string newDatasetName, int rank,
|
||||
uint64_t nDimx, uint32_t nDimy, uint32_t nDimz=0)
|
||||
{
|
||||
T *data_out;
|
||||
@ -807,14 +813,14 @@ public:
|
||||
FILE_LOG(logERROR) << "unknown datatype";
|
||||
return 1;
|
||||
}
|
||||
FILE_LOG(logINFO) << "owenable:" << (owenable?1:0) << endl
|
||||
<< "oldFileName:" << oldFileName << endl
|
||||
<< "oldDatasetName:" << oldDatasetName << endl
|
||||
<< "newFileName:" << newFileName << endl
|
||||
<< "newDatasetName:" << newDatasetName << endl
|
||||
<< "rank:" << rank << endl
|
||||
<< "nDimx:" << nDimx << endl
|
||||
<< "nDimy:" << nDimy << endl
|
||||
FILE_LOG(logINFO) << "owenable:" << (owenable?1:0) << std::endl
|
||||
<< "oldFileName:" << oldFileName << std::endl
|
||||
<< "oldDatasetName:" << oldDatasetName << std::endl
|
||||
<< "newFileName:" << newFileName << std::endl
|
||||
<< "newDatasetName:" << newDatasetName << std::endl
|
||||
<< "rank:" << rank << std::endl
|
||||
<< "nDimx:" << nDimx << std::endl
|
||||
<< "nDimy:" << nDimy << std::endl
|
||||
<< "nDimz:" << nDimz;
|
||||
|
||||
H5File* oldfd;
|
||||
@ -830,6 +836,7 @@ public:
|
||||
//new file
|
||||
FileAccPropList fapl;
|
||||
fapl.setFcloseDegree(H5F_CLOSE_STRONG);
|
||||
newfd = 0;
|
||||
if(!owenable)
|
||||
newfd = new H5File( newFileName.c_str(), H5F_ACC_EXCL,
|
||||
FileCreatPropList::DEFAULT,
|
||||
@ -839,7 +846,7 @@ public:
|
||||
FileCreatPropList::DEFAULT,
|
||||
fapl );
|
||||
//dataspace and dataset
|
||||
DataSpace* newDataspace;
|
||||
DataSpace* newDataspace = 0;
|
||||
if (rank == 3) {
|
||||
hsize_t dims[3] = {nDimx, nDimy, nDimz};
|
||||
newDataspace = new DataSpace (3,dims);
|
||||
@ -847,7 +854,8 @@ public:
|
||||
hsize_t dims[2] = {nDimx, nDimy};
|
||||
newDataspace = new DataSpace (2,dims);
|
||||
}
|
||||
DataSet* newDataset = new DataSet( newfd->createDataSet(newDatasetName.c_str(), datatype, *newDataspace));
|
||||
DataSet* newDataset = 0;
|
||||
newDataset = new DataSet( newfd->createDataSet(newDatasetName.c_str(), datatype, *newDataspace));
|
||||
//write and close
|
||||
newDataset->write(data_out,datatype);
|
||||
newfd->close();
|
||||
@ -875,34 +883,34 @@ public:
|
||||
* @param parameterNames parameter names
|
||||
* @returns 0 for success and 1 for fail
|
||||
*/
|
||||
static int LinkVirtualInMaster(string masterFileName, string virtualfname,
|
||||
string virtualDatasetname, vector <const char*> parameterNames) {
|
||||
static int LinkVirtualInMaster(std::string masterFileName, std::string virtualfname,
|
||||
std::string virtualDatasetname, std::vector <const char*> parameterNames) {
|
||||
char linkname[100];
|
||||
hid_t vfd = 0;
|
||||
|
||||
hid_t dfal = H5Pcreate (H5P_FILE_ACCESS);
|
||||
if (dfal < 0)
|
||||
return CloseFileOnError( vfd, string("Error in creating file access property for link\n"));
|
||||
return CloseFileOnError( vfd, std::string("Error in creating file access property for link\n"));
|
||||
if (H5Pset_fclose_degree (dfal, H5F_CLOSE_STRONG) < 0)
|
||||
return CloseFileOnError( vfd, string("Error in setting strong file close degree for link\n"));
|
||||
return CloseFileOnError( vfd, std::string("Error in setting strong file close degree for link\n"));
|
||||
|
||||
//open master file
|
||||
hid_t mfd = H5Fopen( masterFileName.c_str(), H5F_ACC_RDWR, dfal);
|
||||
if (mfd < 0)
|
||||
return CloseFileOnError( vfd, string("Error in opening master file\n"));
|
||||
return CloseFileOnError( vfd, std::string("Error in opening master file\n"));
|
||||
|
||||
//open virtual file
|
||||
vfd = H5Fopen( virtualfname.c_str(), H5F_ACC_RDWR, dfal);
|
||||
if (vfd < 0) {
|
||||
H5Fclose(mfd); mfd = 0;
|
||||
return CloseFileOnError( vfd, string("Error in opening virtual file\n"));
|
||||
return CloseFileOnError( vfd, std::string("Error in opening virtual file\n"));
|
||||
}
|
||||
|
||||
// find relative path
|
||||
string relative_virtualfname = virtualfname;
|
||||
std::string relative_virtualfname = virtualfname;
|
||||
{
|
||||
size_t i = virtualfname.rfind('/', virtualfname.length());
|
||||
if (i != string::npos)
|
||||
if (i != std::string::npos)
|
||||
relative_virtualfname = (virtualfname.substr(i+1, virtualfname.length() - i));
|
||||
}
|
||||
|
||||
@ -910,29 +918,29 @@ public:
|
||||
hid_t vdset = H5Dopen2( vfd, virtualDatasetname.c_str(), H5P_DEFAULT);
|
||||
if (vdset < 0) {
|
||||
H5Fclose(mfd);
|
||||
return CloseFileOnError( vfd, string("Error in opening virtual data dataset\n"));
|
||||
return CloseFileOnError( vfd, std::string("Error in opening virtual data dataset\n"));
|
||||
}
|
||||
sprintf(linkname, "/entry/data/%s",virtualDatasetname.c_str());
|
||||
if(H5Lcreate_external( relative_virtualfname.c_str(), virtualDatasetname.c_str(),
|
||||
mfd, linkname, H5P_DEFAULT, H5P_DEFAULT) < 0) {
|
||||
H5Fclose(mfd); mfd = 0;
|
||||
return CloseFileOnError( vfd, string("Error in creating link to data dataset\n"));
|
||||
return CloseFileOnError( vfd, std::string("Error in creating link to data dataset\n"));
|
||||
}
|
||||
H5Dclose(vdset);
|
||||
|
||||
//**paramter datasets**
|
||||
for (unsigned int i = 0; i < parameterNames.size(); ++i){
|
||||
hid_t vdset_para = H5Dopen2( vfd, (string (parameterNames[i])).c_str(), H5P_DEFAULT);
|
||||
hid_t vdset_para = H5Dopen2( vfd, (std::string (parameterNames[i])).c_str(), H5P_DEFAULT);
|
||||
if (vdset_para < 0) {
|
||||
H5Fclose(mfd); mfd = 0;
|
||||
return CloseFileOnError( vfd, string("Error in opening virtual parameter dataset to create link\n"));
|
||||
return CloseFileOnError( vfd, std::string("Error in opening virtual parameter dataset to create link\n"));
|
||||
}
|
||||
sprintf(linkname, "/entry/data/%s",(string (parameterNames[i])).c_str());
|
||||
sprintf(linkname, "/entry/data/%s",(std::string (parameterNames[i])).c_str());
|
||||
|
||||
if(H5Lcreate_external( relative_virtualfname.c_str(), (string (parameterNames[i])).c_str(),
|
||||
if(H5Lcreate_external( relative_virtualfname.c_str(), (std::string (parameterNames[i])).c_str(),
|
||||
mfd, linkname, H5P_DEFAULT, H5P_DEFAULT) < 0) {
|
||||
H5Fclose(mfd); mfd = 0;
|
||||
return CloseFileOnError( vfd, string("Error in creating link to virtual parameter dataset\n"));
|
||||
return CloseFileOnError( vfd, std::string("Error in creating link to virtual parameter dataset\n"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -947,7 +955,7 @@ public:
|
||||
* Print Error msg and Close File and called on error
|
||||
* @returns 1 for fail
|
||||
*/
|
||||
static int CloseFileOnError(hid_t& fd, const string msg) {
|
||||
static int CloseFileOnError(hid_t& fd, const std::string msg) {
|
||||
cprintf(RED, "%s", msg.c_str());
|
||||
if(fd > 0)
|
||||
H5Fclose(fd);
|
||||
|
@ -33,11 +33,14 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject {
|
||||
* @param as pointer to actual udp socket buffer size
|
||||
* @param fpf pointer to frames per file
|
||||
* @param fdp frame discard policy
|
||||
* @param act pointer to activated
|
||||
* @param depaden pointer to deactivated padding enable
|
||||
* @param sm pointer to silent mode
|
||||
*/
|
||||
Listener(int ind, detectorType dtype, Fifo*& f, runStatus* s,
|
||||
uint32_t* portno, char* e, uint64_t* nf, uint32_t* dr,
|
||||
uint32_t* us, uint32_t* as, uint32_t* fpf,
|
||||
frameDiscardPolicy* fdp);
|
||||
frameDiscardPolicy* fdp, bool* act, bool* depaden, bool* sm);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
@ -129,12 +132,6 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject {
|
||||
*/
|
||||
void ShutDownUDPSocket();
|
||||
|
||||
/**
|
||||
* Set Silent Mode
|
||||
* @param mode 1 sets 0 unsets
|
||||
*/
|
||||
void SetSilentMode(bool mode);
|
||||
|
||||
/**
|
||||
* Create & closes a dummy UDP socket
|
||||
* to set & get actual buffer size
|
||||
@ -143,6 +140,15 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject {
|
||||
*/
|
||||
int CreateDummySocketForUDPSocketBufferSize(uint32_t s);
|
||||
|
||||
/**
|
||||
* Set hard coded (calculated but not from detector) row and column
|
||||
* r is in row index if detector has not send them yet in firmware,
|
||||
* c is in col index for jungfrau and eiger (for missing packets/deactivated eiger)
|
||||
* c when used is in 2d
|
||||
*/
|
||||
void SetHardCodedPosition(uint16_t r, uint16_t c);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -236,6 +242,24 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject {
|
||||
/** frame discard policy */
|
||||
frameDiscardPolicy* frameDiscardMode;
|
||||
|
||||
/** Activated/Deactivated */
|
||||
bool* activated;
|
||||
|
||||
/** Deactivated padding enable */
|
||||
bool* deactivatedPaddingEnable;
|
||||
|
||||
/** Silent Mode */
|
||||
bool* silentMode;
|
||||
|
||||
/** row hardcoded as 1D or 2d,
|
||||
* if detector does not send them yet or
|
||||
* missing packets/deactivated (eiger/jungfrau sends 2d pos) **/
|
||||
uint16_t row;
|
||||
|
||||
/** column hardcoded as 2D,
|
||||
* deactivated eiger/missing packets (eiger/jungfrau sends 2d pos) **/
|
||||
uint16_t column;
|
||||
|
||||
|
||||
// acquisition start
|
||||
/** Aquisition Started flag */
|
||||
@ -287,8 +311,5 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject {
|
||||
|
||||
/** number of images for statistic */
|
||||
uint32_t numFramesStatistic;
|
||||
|
||||
/** Silent Mode */
|
||||
bool silentMode;
|
||||
};
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user