mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-20 02:40:03 +02:00
merge conflict resolved from 4.0.0
This commit is contained in:
commit
def79807f6
@ -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
|
||||
```
|
||||
|
132
RELEASE.txt
132
RELEASE.txt
@ -1,71 +1,80 @@
|
||||
SLS Detector Package 4.0.0 released on 2018-08-22
|
||||
SLS Detector Package 4.0.0 released on 27.09.2018
|
||||
=================================================
|
||||
|
||||
|
||||
|
||||
INTRODUCTION
|
||||
|
||||
This document describes the differences between 4.0.0 and 3.2.0 releases.
|
||||
This document describes the differences between 4.0.0 and 3.1.4 releases.
|
||||
|
||||
The conda package of the binaries can be downloaded from
|
||||
Download
|
||||
--------
|
||||
|
||||
https://github.com/slsdetectorgroup/sls_detector_software.git
|
||||
The Source Code (Default C++ API):
|
||||
https://github.com/slsdetectorgroup/slsDetectorPackage
|
||||
|
||||
The Python interface to the software package (including the package) is at
|
||||
The Conda Lib Package:
|
||||
https://github.com/slsdetectorgroup/sls_detector_lib
|
||||
|
||||
https://github.com/slsdetectorgroup/sls_detector.git
|
||||
The Conda GUI Package:
|
||||
https://github.com/slsdetectorgroup/sls_detector_gui
|
||||
|
||||
Manual (both HTML and pdf versions) are provided in
|
||||
The Python Interface (including the package):
|
||||
https://github.com/slsdetectorgroup/sls_detector
|
||||
|
||||
manual/docs/
|
||||
|
||||
Documentation from Source Code can be found for the Command Line and C++ API in
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
html:
|
||||
Manual (HTML & PDF):
|
||||
https://www.psi.ch/detectors/documentation
|
||||
slsDetectorPackage/manual/docs/
|
||||
|
||||
Command Line Documentation:
|
||||
manual/docs/html/slsDetectorClientDocs/index.html
|
||||
manual/docs/html/slsDetectorUsersDocs/index.html
|
||||
pdf:
|
||||
manual/docs/pdf/slsDetectorClientDocs.pdf
|
||||
|
||||
C++ API Documentation:
|
||||
manual/docs/html/slsDetectorUsersDocs/index.html
|
||||
manual/docs/pdf/slsDetectorUsersDocs.pdf
|
||||
|
||||
Documentation to the python API is available at
|
||||
C++ API Example:
|
||||
manual/manual-api/mainClient.cpp
|
||||
manual/manual-api/mainReceiver.cpp
|
||||
|
||||
Python API Documentation:
|
||||
https://slsdetectorgroup.github.io/sls_detector/
|
||||
|
||||
Example for detector and receiver API can be found in
|
||||
|
||||
manual/manual-api
|
||||
|
||||
User documentation can also be accessed directly at this location:
|
||||
|
||||
Further Documentation:
|
||||
https://www.psi.ch/detectors/users-support
|
||||
|
||||
Please send any software related questions or comments to:
|
||||
|
||||
Support
|
||||
-------
|
||||
|
||||
General Software related:
|
||||
dhanya.thattil@psi.ch
|
||||
anna.bergamaschi@psi.ch
|
||||
|
||||
Please send any python related questions or comments to:
|
||||
|
||||
Python related:
|
||||
erik.frojdh@psi.ch
|
||||
|
||||
|
||||
|
||||
CONTENTS
|
||||
|
||||
- Firmware Requirements
|
||||
- Changes in User Interface
|
||||
- New/Modified Commands
|
||||
- Other New Features
|
||||
- Resolved Issues
|
||||
- Known Issues
|
||||
- Neat Release Plans
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
||||
Firmware Requirements
|
||||
=====================
|
||||
1. Firmware Requirements
|
||||
========================
|
||||
|
||||
Gotthard
|
||||
========
|
||||
@ -79,8 +88,8 @@ Firmware Requirements
|
||||
|
||||
Jungfrau
|
||||
========
|
||||
Minimum compatible version : 26.02.2018
|
||||
Latest version : 26.02.2018
|
||||
Minimum compatible version : 15.06.2018
|
||||
Latest version : 15.06.2018
|
||||
|
||||
|
||||
Detector Upgrade
|
||||
@ -94,14 +103,13 @@ Firmware Requirements
|
||||
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.
|
||||
|
||||
|
||||
|
||||
Changes in User Interface
|
||||
=========================
|
||||
2. Changes in User Interface
|
||||
============================
|
||||
|
||||
Client
|
||||
------
|
||||
@ -209,8 +217,8 @@ Changes in User Interface
|
||||
|
||||
|
||||
|
||||
New/Modified Commands
|
||||
=====================
|
||||
3. New/Modified Commands
|
||||
========================
|
||||
|
||||
Client
|
||||
------
|
||||
@ -250,9 +258,9 @@ New/Modified Commands
|
||||
|
||||
4. r_discardpolicy:
|
||||
sets/gets the frame discard policy in the receiver.
|
||||
0 - no discard (default),
|
||||
1 - discard only empty frames,
|
||||
2 - discard any partial frame(fastest)
|
||||
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.
|
||||
@ -309,7 +317,7 @@ New/Modified Commands
|
||||
previous one) in s in 32 bit mode.
|
||||
|
||||
6. flags(modified):
|
||||
extra flags "overflow" (default) and "nooverflow" for sub images in 32
|
||||
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.
|
||||
|
||||
@ -328,8 +336,8 @@ New/Modified Commands
|
||||
|
||||
|
||||
|
||||
Other New Features
|
||||
==================
|
||||
4. Other New Features
|
||||
=====================
|
||||
|
||||
Client
|
||||
------
|
||||
@ -340,8 +348,8 @@ Other New Features
|
||||
continue to have them.
|
||||
|
||||
2. Depending on 1d position of detectors and detsizechan in config file,
|
||||
xcoord and ycoord are given to detector servers (Eiger and Jungfrau)
|
||||
to encode into the udp header.
|
||||
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.
|
||||
@ -374,7 +382,8 @@ Other New Features
|
||||
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 xcoord and ycoord are hardcoded for missing packets. (Eiger and Jungfrau)
|
||||
2. Default row and column (previously xcoord and ycoord) are hardcoded
|
||||
for missing packets. (Eiger and Jungfrau)
|
||||
|
||||
|
||||
Gui
|
||||
@ -405,8 +414,8 @@ Other New Features
|
||||
|
||||
|
||||
|
||||
Resolved Issues
|
||||
===============
|
||||
5. Resolved Issues
|
||||
==================
|
||||
|
||||
Client
|
||||
------
|
||||
@ -424,6 +433,8 @@ Resolved Issues
|
||||
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
|
||||
--------
|
||||
|
||||
@ -433,15 +444,15 @@ Resolved Issues
|
||||
used that are handled inside the package.
|
||||
|
||||
3. Global optind variable initialized to instantiate multiple receivers
|
||||
in same process.
|
||||
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, including removing
|
||||
many static members, blocking push in buffer between listener and dataprocessor
|
||||
5. Refactored code a bit for performance and robustness, blocking push
|
||||
in buffer between listener and dataprocessor
|
||||
|
||||
|
||||
Detector Server
|
||||
@ -452,9 +463,12 @@ Resolved Issues
|
||||
|
||||
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.
|
||||
|
||||
Known Issues
|
||||
============
|
||||
|
||||
6. Known Issues
|
||||
===============
|
||||
|
||||
Receiver
|
||||
--------
|
||||
@ -470,10 +484,14 @@ Known Issues
|
||||
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.
|
||||
|
||||
|
||||
Neat Release Plans
|
||||
==================
|
||||
|
||||
7. Next Major Release Plans
|
||||
===========================
|
||||
|
||||
Client
|
||||
------
|
||||
|
15
cmk.sh
15
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"
|
||||
@ -91,6 +93,10 @@ while getopts ":bchd:j:trg" opt ; do
|
||||
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
|
||||
|
@ -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(),
|
||||
|
Binary file not shown.
@ -548,7 +548,7 @@ the SLS Detectors group.
|
||||
\indent Minimum compatible version: \\
|
||||
\indent \indent 11.01.2013 \\
|
||||
\indent Latest version: \\
|
||||
\indent \indent 26.06.2018 (50um) \\
|
||||
\indent \indent 08.02.2018 (50um) \\
|
||||
\indent \indent 08.02.2018 (25 um Master) \\
|
||||
\indent \indent 09.02.2018 (25 um Slave) \\
|
||||
|
||||
@ -747,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=
|
||||
@ -757,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 \\
|
||||
@ -773,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
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
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
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
|
@ -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">
|
||||
|
@ -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);
|
||||
|
@ -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,5 +1,6 @@
|
||||
/** API versions */
|
||||
#define APIRECEIVER 0x180718
|
||||
#define APIRECEIVER 0x180927
|
||||
#define APIEIGER 0x180820
|
||||
#define APIJUNGFRAU 0x180820
|
||||
#define APIGOTTHARD 0x180820
|
||||
#define APIJUNGFRAU 0x180925
|
||||
#define APIGOTTHARD 0x180928
|
||||
|
||||
|
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: 548036a602123cb3c06bbf4f9a40c9acd6c527fc
|
||||
Revision: 349
|
||||
Repsitory UUID: c52025dd7c4b44b93e64353a22997d971996ab18
|
||||
Revision: 350
|
||||
Branch: developer
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 3988
|
||||
Last Changed Date: 2018-08-23 11:57:31.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 "548036a602123cb3c06bbf4f9a40c9acd6c527fc"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x3988
|
||||
#define GITDATE 0x20180823
|
||||
#define GITREPUUID "c52025dd7c4b44b93e64353a22997d971996ab18"
|
||||
#define GITAUTH "Gemma_Tinti"
|
||||
#define GITREV 0x3999
|
||||
#define GITDATE 0x20180928
|
||||
#define GITBRANCH "developer"
|
||||
|
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsDetectorSoftware
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: 6bb7195a2c7dc9526088882e0244a7455d3c15b2
|
||||
Revision: 1992
|
||||
Branch: 3.3.0-rc
|
||||
Repsitory UUID: d2bce7e372c241cd235977b92be18555bca6a77d
|
||||
Revision: 2040
|
||||
Branch: 4.0.0
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 3941
|
||||
Last Changed Date: 2018-07-18 12:26:21.000000002 +0200 ./threadFiles/ThreadPool.o
|
||||
Last Changed Rev: 4020
|
||||
Last Changed Date: 2018-09-27 18:22:10.000000002 +0200 ./sharedMemory/SharedMemory.o
|
||||
|
@ -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,30 +1558,11 @@ u_int32_t fifo_full(void)
|
||||
}
|
||||
|
||||
|
||||
u_int32_t* fifo_read_event()
|
||||
{
|
||||
#ifdef VIRTUAL
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("before looping\n");
|
||||
#endif
|
||||
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) {
|
||||
if (runBusy()==0) {
|
||||
t = bus_r(LOOK_AT_ME_REG);
|
||||
@ -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());
|
||||
@ -1614,37 +1581,11 @@ 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,23 +1736,28 @@ 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
|
||||
@ -1892,78 +1765,9 @@ int configureADC(){
|
||||
}
|
||||
|
||||
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: 548036a602123cb3c06bbf4f9a40c9acd6c527fc
|
||||
Revision: 236
|
||||
Repsitory UUID: c52025dd7c4b44b93e64353a22997d971996ab18
|
||||
Revision: 237
|
||||
Branch: developer
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 3988
|
||||
Last Changed Date: 2018-08-23 11:57:31.000000002 +0200 ./server_funcs.h
|
||||
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 "548036a602123cb3c06bbf4f9a40c9acd6c527fc"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x3988
|
||||
#define GITDATE 0x20180823
|
||||
#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
|
||||
if (nROI) {
|
||||
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);
|
||||
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,92 +1917,43 @@ 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);
|
||||
cprintf(RED,"%s\n",mess);
|
||||
sendDataOnly(file_des,&dataret,sizeof(dataret));
|
||||
sendDataOnly(file_des,mess,sizeof(mess));
|
||||
#ifdef VERBOSE
|
||||
printf("dataret %d\n",dataret);
|
||||
#endif
|
||||
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);
|
||||
#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????
|
||||
|
||||
#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));
|
||||
printf("%s\n",mess);
|
||||
cprintf(RED,"%s\n",mess);
|
||||
} else {
|
||||
dataret = FINISHED;
|
||||
sprintf(mess,"acquisition successfully finished\n");
|
||||
printf("%s\n",mess);
|
||||
cprintf(GREEN,"%s",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;
|
||||
}
|
||||
|
||||
@ -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: 548036a602123cb3c06bbf4f9a40c9acd6c527fc
|
||||
Revision: 162
|
||||
Repsitory UUID: c52025dd7c4b44b93e64353a22997d971996ab18
|
||||
Revision: 163
|
||||
Branch: developer
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 3988
|
||||
Last Changed Date: 2018-08-23 11:57:31.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 "548036a602123cb3c06bbf4f9a40c9acd6c527fc"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x3988
|
||||
#define GITDATE 0x20180823
|
||||
#define GITREPUUID "c52025dd7c4b44b93e64353a22997d971996ab18"
|
||||
#define GITAUTH "Gemma_Tinti"
|
||||
#define GITREV 0x3999
|
||||
#define GITDATE 0x20180928
|
||||
#define GITBRANCH "developer"
|
||||
|
@ -43,12 +43,12 @@ multiSlsDetector::multiSlsDetector(int id, bool verify, bool update)
|
||||
|
||||
multiSlsDetector::~multiSlsDetector() {
|
||||
// delete zmq sockets first
|
||||
for (vector<ZmqSocket*>::const_iterator it = zmqSocket.begin(); it != zmqSocket.end(); ++it) {
|
||||
for (std::vector<ZmqSocket*>::const_iterator it = zmqSocket.begin(); it != zmqSocket.end(); ++it) {
|
||||
delete(*it);
|
||||
}
|
||||
zmqSocket.clear();
|
||||
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
delete(*it);
|
||||
}
|
||||
detectors.clear();
|
||||
@ -101,12 +101,12 @@ T multiSlsDetector::callDetectorMember(T (slsDetector::*somefunc)())
|
||||
return minusOneIfDifferent(values);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::callDetectorMember(string (slsDetector::*somefunc)()) {
|
||||
string concatenatedValue, firstValue;
|
||||
std::string multiSlsDetector::callDetectorMember(std::string (slsDetector::*somefunc)()) {
|
||||
std::string concatenatedValue, firstValue;
|
||||
bool valueNotSame = false;
|
||||
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
string thisValue = (detectors[idet]->*somefunc)();
|
||||
std::string thisValue = (detectors[idet]->*somefunc)();
|
||||
;
|
||||
if (detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask() | (1 << idet));
|
||||
@ -347,14 +347,14 @@ double* multiSlsDetector::decodeData(int* datain, int& nn, double* fdata) {
|
||||
|
||||
|
||||
|
||||
int multiSlsDetector::writeDataFile(string fname, double* data, double* err,
|
||||
int multiSlsDetector::writeDataFile(std::string fname, double* data, double* err,
|
||||
double* ang, char dataformat, int nch) {
|
||||
#ifdef VERBOSE
|
||||
cout << "using overloaded multiSlsDetector function to write formatted data file "
|
||||
<< getTotalNumberOfChannels() << endl;
|
||||
#endif
|
||||
|
||||
ofstream outfile;
|
||||
std::ofstream outfile;
|
||||
int choff = 0, off = 0; //idata,
|
||||
double *pe = err, *pa = ang;
|
||||
int nch_left = nch, n; //, nd;
|
||||
@ -365,7 +365,7 @@ int multiSlsDetector::writeDataFile(string fname, double* data, double* err,
|
||||
if (data == NULL)
|
||||
return FAIL;
|
||||
|
||||
outfile.open(fname.c_str(), ios_base::out);
|
||||
outfile.open(fname.c_str(), std::ios_base::out);
|
||||
if (outfile.is_open()) {
|
||||
|
||||
for (unsigned int i = 0; i < detectors.size(); ++i) {
|
||||
@ -399,8 +399,8 @@ int multiSlsDetector::writeDataFile(string fname, double* data, double* err,
|
||||
}
|
||||
}
|
||||
|
||||
int multiSlsDetector::writeDataFile(string fname, int* data) {
|
||||
ofstream outfile;
|
||||
int multiSlsDetector::writeDataFile(std::string fname, int* data) {
|
||||
std::ofstream outfile;
|
||||
int choff = 0, off = 0;
|
||||
#ifdef VERBOSE
|
||||
cout << "using overloaded multiSlsDetector function to write raw data file " << endl;
|
||||
@ -409,7 +409,7 @@ int multiSlsDetector::writeDataFile(string fname, int* data) {
|
||||
if (data == NULL)
|
||||
return FAIL;
|
||||
|
||||
outfile.open(fname.c_str(), ios_base::out);
|
||||
outfile.open(fname.c_str(), std::ios_base::out);
|
||||
if (outfile.is_open()) {
|
||||
for (unsigned int i = 0; i < detectors.size(); ++i) {
|
||||
#ifdef VERBOSE
|
||||
@ -430,22 +430,22 @@ int multiSlsDetector::writeDataFile(string fname, int* data) {
|
||||
}
|
||||
}
|
||||
|
||||
int multiSlsDetector::readDataFile(string fname, double* data, double* err,
|
||||
int multiSlsDetector::readDataFile(std::string fname, double* data, double* err,
|
||||
double* ang, char dataformat) {
|
||||
#ifdef VERBOSE
|
||||
cout << "using overloaded multiSlsDetector function to read formatted data file " << endl;
|
||||
#endif
|
||||
|
||||
ifstream infile;
|
||||
std::ifstream infile;
|
||||
int iline = 0;
|
||||
string str;
|
||||
std::string str;
|
||||
int choff = 0, off = 0;
|
||||
double *pe = err, *pa = ang;
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Opening file " << fname << std::endl;
|
||||
#endif
|
||||
infile.open(fname.c_str(), ios_base::in);
|
||||
infile.open(fname.c_str(), std::ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
|
||||
for (unsigned int i = 0; i < detectors.size(); ++i) {
|
||||
@ -469,19 +469,19 @@ int multiSlsDetector::readDataFile(string fname, double* data, double* err,
|
||||
return iline;
|
||||
}
|
||||
|
||||
int multiSlsDetector::readDataFile(string fname, int* data) {
|
||||
int multiSlsDetector::readDataFile(std::string fname, int* data) {
|
||||
#ifdef VERBOSE
|
||||
cout << "using overloaded multiSlsDetector function to read raw data file " << endl;
|
||||
#endif
|
||||
ifstream infile;
|
||||
std::ifstream infile;
|
||||
int iline = 0;
|
||||
string str;
|
||||
std::string str;
|
||||
int choff = 0, off = 0;
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Opening file " << fname << std::endl;
|
||||
#endif
|
||||
infile.open(fname.c_str(), ios_base::in);
|
||||
infile.open(fname.c_str(), std::ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
|
||||
for (unsigned int i = 0; i < detectors.size(); ++i) {
|
||||
@ -501,17 +501,17 @@ int multiSlsDetector::readDataFile(string fname, int* data) {
|
||||
}
|
||||
|
||||
|
||||
string multiSlsDetector::getErrorMessage(int& critical) {
|
||||
std::string multiSlsDetector::getErrorMessage(int& critical) {
|
||||
int64_t multiMask, slsMask = 0;
|
||||
string retval = "";
|
||||
std::string retval = "";
|
||||
char sNumber[100];
|
||||
critical = 0;
|
||||
|
||||
multiMask = getErrorMask();
|
||||
if (multiMask) {
|
||||
if (multiMask & MULTI_DETECTORS_NOT_ADDED) {
|
||||
retval.append("Detectors not added:\n" + string(getNotAddedList()) +
|
||||
string("\n"));
|
||||
retval.append("Detectors not added:\n" + std::string(getNotAddedList()) +
|
||||
std::string("\n"));
|
||||
critical = 1;
|
||||
}
|
||||
if (multiMask & MULTI_HAVE_DIFFERENT_VALUES) {
|
||||
@ -529,13 +529,13 @@ string multiSlsDetector::getErrorMessage(int& critical) {
|
||||
if (multiMask & (1 << idet)) {
|
||||
//append detector id
|
||||
sprintf(sNumber, "%d", idet);
|
||||
retval.append("Detector " + string(sNumber) + string(":\n"));
|
||||
retval.append("Detector " + std::string(sNumber) + std::string(":\n"));
|
||||
//get sls det error mask
|
||||
slsMask = detectors[idet]->getErrorMask();
|
||||
#ifdef VERYVERBOSE
|
||||
//append sls det error mask
|
||||
sprintf(sNumber, "0x%lx", slsMask);
|
||||
retval.append("Error Mask " + string(sNumber) + string("\n"));
|
||||
retval.append("Error Mask " + std::string(sNumber) + std::string("\n"));
|
||||
#endif
|
||||
//get the error critical level
|
||||
if ((slsMask > 0xFFFFFFFF) | critical)
|
||||
@ -610,7 +610,7 @@ slsDetector* multiSlsDetector::getSlsDetector(unsigned int pos) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
slsDetector *multiSlsDetector::operator()(int pos) {
|
||||
slsDetector *multiSlsDetector::operator()(int pos) const {
|
||||
if (pos >= 0 && pos < (int)detectors.size())
|
||||
return detectors[pos];
|
||||
return NULL;
|
||||
@ -643,7 +643,7 @@ void multiSlsDetector::freeSharedMemory(int multiId) {
|
||||
|
||||
void multiSlsDetector::freeSharedMemory() {
|
||||
// clear zmq vector
|
||||
for (vector<ZmqSocket*>::const_iterator it = zmqSocket.begin(); it != zmqSocket.end(); ++it) {
|
||||
for (std::vector<ZmqSocket*>::const_iterator it = zmqSocket.begin(); it != zmqSocket.end(); ++it) {
|
||||
delete(*it);
|
||||
}
|
||||
zmqSocket.clear();
|
||||
@ -652,7 +652,7 @@ void multiSlsDetector::freeSharedMemory() {
|
||||
clearAllErrorMask();
|
||||
|
||||
// clear sls detector vector shm
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
(*it)->freeSharedMemory();
|
||||
delete (*it);
|
||||
}
|
||||
@ -687,7 +687,7 @@ std::string multiSlsDetector::getUserDetails() {
|
||||
//type
|
||||
sstream<< "\nType: ";
|
||||
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it)
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it)
|
||||
sstream<< (*it)->sgetDetectorsType() << "+";
|
||||
//PID
|
||||
sstream << "\nPID: " << thisMultiDetector->lastPID
|
||||
@ -695,7 +695,7 @@ std::string multiSlsDetector::getUserDetails() {
|
||||
<< "\nUser: " << thisMultiDetector->lastUser
|
||||
<< "\nDate: " << thisMultiDetector->lastDate << endl;
|
||||
|
||||
string s = sstream.str();
|
||||
std::string s = sstream.str();
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -876,7 +876,7 @@ void multiSlsDetector::initializeMembers(bool verify) {
|
||||
badFFList = NULL;
|
||||
|
||||
//multiSlsDetector
|
||||
for (vector<ZmqSocket*>::const_iterator it = zmqSocket.begin(); it != zmqSocket.end(); ++it) {
|
||||
for (std::vector<ZmqSocket*>::const_iterator it = zmqSocket.begin(); it != zmqSocket.end(); ++it) {
|
||||
delete(*it);
|
||||
}
|
||||
zmqSocket.clear();
|
||||
@ -888,7 +888,7 @@ void multiSlsDetector::initializeMembers(bool verify) {
|
||||
detectors.push_back(sdet);
|
||||
} catch (...) {
|
||||
// clear detectors list
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
delete(*it);
|
||||
}
|
||||
detectors.clear();
|
||||
@ -951,21 +951,21 @@ void multiSlsDetector::setHostname(const char* name) {
|
||||
}
|
||||
|
||||
|
||||
string multiSlsDetector::getHostname(int pos) {
|
||||
std::string multiSlsDetector::getHostname(int pos) {
|
||||
return concatResultOrPos(&slsDetector::getHostname, pos);
|
||||
}
|
||||
|
||||
void multiSlsDetector::addMultipleDetectors(const char* name) {
|
||||
size_t p1 = 0;
|
||||
string temp = string(name);
|
||||
std::string temp = std::string(name);
|
||||
size_t p2 = temp.find('+', p1);
|
||||
//single
|
||||
if (p2 == string::npos) {
|
||||
if (p2 == std::string::npos) {
|
||||
addSlsDetector(temp);
|
||||
}
|
||||
// multi
|
||||
else {
|
||||
while(p2 != string::npos) {
|
||||
while(p2 != std::string::npos) {
|
||||
addSlsDetector(temp.substr(p1, p2-p1));
|
||||
temp = temp.substr(p2 + 1);
|
||||
p2 = temp.find('+');
|
||||
@ -982,7 +982,7 @@ void multiSlsDetector::addSlsDetector (std::string s) {
|
||||
#ifdef VERBOSE
|
||||
cout << "Adding detector " << s << endl;
|
||||
#endif
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
if ((*it)->getHostname((it-detectors.begin())) == s) {
|
||||
cout << "Detector " << s << "already part of the multiDetector!" << endl
|
||||
<< "Remove it before adding it back in a new position!" << endl;
|
||||
@ -1048,7 +1048,7 @@ void multiSlsDetector::createThreadPool() {
|
||||
threadpool = new ThreadPool(numthreads);
|
||||
switch (threadpool->initialize_threadpool()) {
|
||||
case 0:
|
||||
cerr << "Failed to initialize thread pool!" << endl;
|
||||
std::cerr << "Failed to initialize thread pool!" << endl;
|
||||
throw ThreadpoolException();
|
||||
case 1:
|
||||
#ifdef VERBOSE
|
||||
@ -1089,7 +1089,7 @@ void multiSlsDetector::getNumberOfDetectors(int& nx, int& ny) {
|
||||
|
||||
int multiSlsDetector::getNMods() {
|
||||
int nm = 0;
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
nm += (*it)->getNMods();
|
||||
}
|
||||
return nm;
|
||||
@ -1097,7 +1097,7 @@ int multiSlsDetector::getNMods() {
|
||||
|
||||
int multiSlsDetector::getNMod(dimension d) {
|
||||
int nm = 0;
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
nm += (*it)->getNMod(d);
|
||||
}
|
||||
return nm;
|
||||
@ -1105,7 +1105,7 @@ int multiSlsDetector::getNMod(dimension d) {
|
||||
|
||||
int multiSlsDetector::getMaxMods() {
|
||||
int ret = 0;
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
ret += (*it)->getMaxMods();
|
||||
}
|
||||
return ret;
|
||||
@ -1113,7 +1113,7 @@ int multiSlsDetector::getMaxMods() {
|
||||
|
||||
int multiSlsDetector::getMaxMod(dimension d) {
|
||||
int ret = 0, ret1;
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
ret1 = (*it)->getNMaxMod(d);
|
||||
#ifdef VERBOSE
|
||||
cout << "detector " << (it-detectors.begin()) << " maxmods " <<
|
||||
@ -1130,7 +1130,7 @@ int multiSlsDetector::getMaxMod(dimension d) {
|
||||
|
||||
int multiSlsDetector::getMaxNumberOfModules(dimension d) {
|
||||
int ret = 0;
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
ret += (*it)->getMaxNumberOfModules(d);
|
||||
}
|
||||
return ret;
|
||||
@ -1181,7 +1181,7 @@ int multiSlsDetector::getChansPerMod(int imod) {
|
||||
|
||||
int multiSlsDetector::getTotalNumberOfChannels() {
|
||||
thisMultiDetector->numberOfChannels = 0;
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
thisMultiDetector->numberOfChannels += (*it)->getTotalNumberOfChannels();
|
||||
}
|
||||
return thisMultiDetector->numberOfChannels;
|
||||
@ -1197,7 +1197,7 @@ int multiSlsDetector::getTotalNumberOfChannelsInclGapPixels(dimension d) {
|
||||
|
||||
int multiSlsDetector::getMaxNumberOfChannels() {
|
||||
thisMultiDetector->maxNumberOfChannels = 0;
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
thisMultiDetector->maxNumberOfChannels += (*it)->getMaxNumberOfChannels();
|
||||
}
|
||||
return thisMultiDetector->maxNumberOfChannels;
|
||||
@ -1401,10 +1401,10 @@ int multiSlsDetector::setOnline(int off) {
|
||||
}
|
||||
|
||||
|
||||
string multiSlsDetector::checkOnline() {
|
||||
string offlineDetectors = "";
|
||||
for (vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
string tmp = (*it)->checkOnline();
|
||||
std::string multiSlsDetector::checkOnline() {
|
||||
std::string offlineDetectors = "";
|
||||
for (std::vector<slsDetector*>::const_iterator it = detectors.begin(); it != detectors.end(); ++it) {
|
||||
std::string tmp = (*it)->checkOnline();
|
||||
if (!tmp.empty())
|
||||
offlineDetectors += tmp + "+";
|
||||
}
|
||||
@ -1420,7 +1420,7 @@ int multiSlsDetector::lockServer(int p) {
|
||||
return callDetectorMember(&slsDetector::lockServer, p);
|
||||
}
|
||||
|
||||
string multiSlsDetector::getLastClientIP() {
|
||||
std::string multiSlsDetector::getLastClientIP() {
|
||||
return callDetectorMember(&slsDetector::getLastClientIP);
|
||||
}
|
||||
|
||||
@ -1434,26 +1434,26 @@ int multiSlsDetector::exitServer() {
|
||||
return ival;
|
||||
}
|
||||
|
||||
int multiSlsDetector::readConfigurationFile(string const fname) {
|
||||
int multiSlsDetector::readConfigurationFile(std::string const fname) {
|
||||
|
||||
freeSharedMemory();
|
||||
setupMultiDetector();
|
||||
|
||||
|
||||
multiSlsDetectorClient* cmd;
|
||||
string ans;
|
||||
string str;
|
||||
ifstream infile;
|
||||
std::string ans;
|
||||
std::string str;
|
||||
std::ifstream infile;
|
||||
int iargval;
|
||||
int interrupt = 0;
|
||||
char* args[1000];
|
||||
|
||||
char myargs[1000][1000];
|
||||
|
||||
string sargname, sargval;
|
||||
std::string sargname, sargval;
|
||||
int iline = 0;
|
||||
std::cout << "config file name " << fname << std::endl;
|
||||
infile.open(fname.c_str(), ios_base::in);
|
||||
infile.open(fname.c_str(), std::ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
|
||||
while (infile.good() and interrupt == 0) {
|
||||
@ -1463,7 +1463,7 @@ int multiSlsDetector::readConfigurationFile(string const fname) {
|
||||
++iline;
|
||||
|
||||
// remove comments that come after
|
||||
if (str.find('#') != string::npos)
|
||||
if (str.find('#') != std::string::npos)
|
||||
str.erase(str.find('#'));
|
||||
#ifdef VERBOSE
|
||||
std::cout << "string:" << str << std::endl;
|
||||
@ -1474,7 +1474,7 @@ int multiSlsDetector::readConfigurationFile(string const fname) {
|
||||
#endif
|
||||
continue;
|
||||
} else {
|
||||
istringstream ssstr(str);
|
||||
std::istringstream ssstr(str);
|
||||
iargval = 0;
|
||||
while (ssstr.good()) {
|
||||
ssstr >> sargname;
|
||||
@ -1524,9 +1524,9 @@ int multiSlsDetector::readConfigurationFile(string const fname) {
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::writeConfigurationFile(string const fname) {
|
||||
int multiSlsDetector::writeConfigurationFile(std::string const fname) {
|
||||
|
||||
string names[] = {
|
||||
std::string names[] = {
|
||||
"detsizechan",
|
||||
"hostname",
|
||||
"master",
|
||||
@ -1551,10 +1551,10 @@ int multiSlsDetector::writeConfigurationFile(string const fname) {
|
||||
}
|
||||
int ret = OK, ret1 = OK;
|
||||
|
||||
ofstream outfile;
|
||||
std::ofstream outfile;
|
||||
int iline = 0;
|
||||
|
||||
outfile.open(fname.c_str(), ios_base::out);
|
||||
outfile.open(fname.c_str(), std::ios_base::out);
|
||||
if (outfile.is_open()) {
|
||||
|
||||
slsDetectorCommand* cmd = new slsDetectorCommand(this);
|
||||
@ -1610,7 +1610,7 @@ int multiSlsDetector::writeConfigurationFile(string const fname) {
|
||||
|
||||
|
||||
|
||||
string multiSlsDetector::getSettingsFile() {
|
||||
std::string multiSlsDetector::getSettingsFile() {
|
||||
return callDetectorMember(&slsDetector::getSettingsFile);
|
||||
}
|
||||
|
||||
@ -1774,14 +1774,14 @@ slsDetectorDefs::detectorSettings multiSlsDetector::setSettings(detectorSettings
|
||||
}
|
||||
|
||||
|
||||
string multiSlsDetector::getSettingsDir() {
|
||||
std::string multiSlsDetector::getSettingsDir() {
|
||||
return callDetectorMember(&slsDetector::getSettingsDir);
|
||||
}
|
||||
|
||||
|
||||
string multiSlsDetector::setSettingsDir(string s) {
|
||||
std::string multiSlsDetector::setSettingsDir(std::string s) {
|
||||
|
||||
if (s.find('+') == string::npos) {
|
||||
if (s.find('+') == std::string::npos) {
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
detectors[idet]->setSettingsDir(s);
|
||||
if (detectors[idet]->getErrorMask())
|
||||
@ -1791,7 +1791,7 @@ string multiSlsDetector::setSettingsDir(string s) {
|
||||
size_t p1 = 0;
|
||||
size_t p2 = s.find('+', p1);
|
||||
int id = 0;
|
||||
while (p2 != string::npos) {
|
||||
while (p2 != std::string::npos) {
|
||||
detectors[id]->setSettingsDir(s.substr(p1, p2 - p1));
|
||||
if (detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask() | (1 << id));
|
||||
@ -1805,13 +1805,13 @@ string multiSlsDetector::setSettingsDir(string s) {
|
||||
return getSettingsDir();
|
||||
}
|
||||
|
||||
string multiSlsDetector::getCalDir() {
|
||||
std::string multiSlsDetector::getCalDir() {
|
||||
return callDetectorMember(&slsDetector::getCalDir);
|
||||
}
|
||||
|
||||
string multiSlsDetector::setCalDir(string s) {
|
||||
std::string multiSlsDetector::setCalDir(std::string s) {
|
||||
|
||||
if (s.find('+') == string::npos) {
|
||||
if (s.find('+') == std::string::npos) {
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
detectors[idet]->setCalDir(s);
|
||||
if (detectors[idet]->getErrorMask())
|
||||
@ -1821,7 +1821,7 @@ string multiSlsDetector::setCalDir(string s) {
|
||||
size_t p1 = 0;
|
||||
size_t p2 = s.find('+', p1);
|
||||
int id = 0;
|
||||
while (p2 != string::npos) {
|
||||
while (p2 != std::string::npos) {
|
||||
|
||||
if (detectors[id]) {
|
||||
detectors[id]->setCalDir(s.substr(p1, p2 - p1));
|
||||
@ -1839,7 +1839,7 @@ string multiSlsDetector::setCalDir(string s) {
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::loadSettingsFile(string fname, int imod) {
|
||||
int multiSlsDetector::loadSettingsFile(std::string fname, int imod) {
|
||||
int ret = OK;
|
||||
|
||||
// single
|
||||
@ -1864,7 +1864,7 @@ int multiSlsDetector::loadSettingsFile(string fname, int imod) {
|
||||
int* iret[detectors.size()];
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
iret[idet] = new int(OK);
|
||||
Task* task = new Task(new func2_t<int, string, int>(&slsDetector::loadSettingsFile,
|
||||
Task* task = new Task(new func2_t<int, std::string, int>(&slsDetector::loadSettingsFile,
|
||||
detectors[idet], fname, imod, iret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
@ -1884,7 +1884,7 @@ int multiSlsDetector::loadSettingsFile(string fname, int imod) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int multiSlsDetector::saveSettingsFile(string fname, int imod) {
|
||||
int multiSlsDetector::saveSettingsFile(std::string fname, int imod) {
|
||||
int id = -1, im = -1, ret;
|
||||
|
||||
if (decodeNMod(imod, id, im) >= 0) {
|
||||
@ -1905,7 +1905,7 @@ int multiSlsDetector::saveSettingsFile(string fname, int imod) {
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::loadCalibrationFile(string fname, int imod) {
|
||||
int multiSlsDetector::loadCalibrationFile(std::string fname, int imod) {
|
||||
int ret = OK;
|
||||
|
||||
// single
|
||||
@ -1931,7 +1931,7 @@ int multiSlsDetector::loadCalibrationFile(string fname, int imod) {
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
if (detectors[idet]) {
|
||||
iret[idet] = new int(OK);
|
||||
Task* task = new Task(new func2_t<int, string, int>(&slsDetector::loadCalibrationFile,
|
||||
Task* task = new Task(new func2_t<int, std::string, int>(&slsDetector::loadCalibrationFile,
|
||||
detectors[idet], fname, imod, iret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
@ -1954,7 +1954,7 @@ int multiSlsDetector::loadCalibrationFile(string fname, int imod) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int multiSlsDetector::saveCalibrationFile(string fname, int imod) {
|
||||
int multiSlsDetector::saveCalibrationFile(std::string fname, int imod) {
|
||||
int id = -1, im = -1, ret;
|
||||
if (decodeNMod(imod, id, im) >= 0) {
|
||||
if (id < 0 || id >= (int)detectors.size())
|
||||
@ -2458,7 +2458,7 @@ int* multiSlsDetector::getDataFromDetector() {
|
||||
int nodatadet = -1;
|
||||
int nodatadetectortype = false;
|
||||
detectorType types = getDetectorsType();
|
||||
if (types == EIGER || types == JUNGFRAU) {
|
||||
if (types == EIGER || types == JUNGFRAU || GOTTHARD || PROPIX) {
|
||||
nodatadetectortype = true;
|
||||
}
|
||||
|
||||
@ -3030,21 +3030,21 @@ uint32_t multiSlsDetector::clearBit(uint32_t addr, int n) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
string multiSlsDetector::setNetworkParameter(networkParameter p, string s) {
|
||||
std::string multiSlsDetector::setNetworkParameter(networkParameter p, std::string s) {
|
||||
|
||||
if (s.find('+') == string::npos) {
|
||||
if (s.find('+') == std::string::npos) {
|
||||
|
||||
if (!threadpool) {
|
||||
cout << "Error in creating threadpool. Exiting" << endl;
|
||||
return getNetworkParameter(p);
|
||||
} else {
|
||||
string* sret[detectors.size()];
|
||||
std::string* sret[detectors.size()];
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
if (p == RECEIVER_STREAMING_PORT || p == CLIENT_STREAMING_PORT)
|
||||
s.append("multi\0");
|
||||
sret[idet] = new string("error");
|
||||
Task* task = new Task(new func2_t<string, networkParameter,
|
||||
string>(&slsDetector::setNetworkParameter,
|
||||
sret[idet] = new std::string("error");
|
||||
Task* task = new Task(new func2_t<std::string, networkParameter,
|
||||
std::string>(&slsDetector::setNetworkParameter,
|
||||
detectors[idet], p, s, sret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
@ -3063,7 +3063,7 @@ string multiSlsDetector::setNetworkParameter(networkParameter p, string s) {
|
||||
size_t p1 = 0;
|
||||
size_t p2 = s.find('+', p1);
|
||||
int id = 0;
|
||||
while (p2 != string::npos) {
|
||||
while (p2 != std::string::npos) {
|
||||
detectors[id]->setNetworkParameter(p, s.substr(p1, p2 - p1));
|
||||
if (detectors[id]->getErrorMask())
|
||||
setErrorMask(getErrorMask() | (1 << id));
|
||||
@ -3078,18 +3078,18 @@ string multiSlsDetector::setNetworkParameter(networkParameter p, string s) {
|
||||
return getNetworkParameter(p);
|
||||
}
|
||||
|
||||
string multiSlsDetector::getNetworkParameter(networkParameter p) {
|
||||
string s0 = "", s1 = "", s;
|
||||
string ans = "";
|
||||
std::string multiSlsDetector::getNetworkParameter(networkParameter p) {
|
||||
std::string s0 = "", s1 = "", s;
|
||||
std::string ans = "";
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
s = detectors[idet]->getNetworkParameter(p);
|
||||
if (detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask() | (1 << idet));
|
||||
|
||||
if (s0 == "")
|
||||
s0 = s + string("+");
|
||||
s0 = s + std::string("+");
|
||||
else
|
||||
s0 += s + string("+");
|
||||
s0 += s + std::string("+");
|
||||
|
||||
if (s1 == "")
|
||||
s1 = s;
|
||||
@ -3168,13 +3168,13 @@ int multiSlsDetector::executeTrimming(trimMode mode, int par1, int par2, int imo
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::loadImageToDetector(imageType index, string const fname) {
|
||||
int multiSlsDetector::loadImageToDetector(imageType index, std::string const fname) {
|
||||
|
||||
int ret = -100, ret1;
|
||||
short int imageVals[thisMultiDetector->numberOfChannels];
|
||||
|
||||
ifstream infile;
|
||||
infile.open(fname.c_str(), ios_base::in);
|
||||
std::ifstream infile;
|
||||
infile.open(fname.c_str(), std::ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << std::endl
|
||||
@ -3204,11 +3204,11 @@ int multiSlsDetector::loadImageToDetector(imageType index, string const fname) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int multiSlsDetector::writeCounterBlockFile(string const fname, int startACQ) {
|
||||
int multiSlsDetector::writeCounterBlockFile(std::string const fname, int startACQ) {
|
||||
int ret = OK, ret1 = OK;
|
||||
short int arg[thisMultiDetector->numberOfChannels];
|
||||
ofstream outfile;
|
||||
outfile.open(fname.c_str(), ios_base::out);
|
||||
std::ofstream outfile;
|
||||
outfile.open(fname.c_str(), std::ios_base::out);
|
||||
if (outfile.is_open()) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << std::endl
|
||||
@ -3872,7 +3872,7 @@ int multiSlsDetector::setStoragecellStart(int pos) {
|
||||
return parallelCallDetectorMember(&slsDetector::setStoragecellStart, pos);
|
||||
}
|
||||
|
||||
int multiSlsDetector::programFPGA(string fname) {
|
||||
int multiSlsDetector::programFPGA(std::string fname) {
|
||||
int ret = OK, ret1 = OK;
|
||||
|
||||
for (unsigned int i = 0; i < detectors.size(); ++i) {
|
||||
@ -4173,14 +4173,14 @@ int multiSlsDetector::rateCorrect(double* datain, double* errin, double* dataout
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::setFlatFieldCorrection(string fname) {
|
||||
int multiSlsDetector::setFlatFieldCorrection(std::string fname) {
|
||||
double* data = new double[thisMultiDetector->numberOfChannels];
|
||||
double* ffcoefficients = new double[thisMultiDetector->numberOfChannels];
|
||||
double* fferrors = new double[thisMultiDetector->numberOfChannels];
|
||||
char ffffname[MAX_STR_LENGTH * 2];
|
||||
int nch;
|
||||
if (fname == "default") {
|
||||
fname = string(thisMultiDetector->flatFieldFile);
|
||||
fname = std::string(thisMultiDetector->flatFieldFile);
|
||||
}
|
||||
|
||||
thisMultiDetector->correctionMask &= ~(1 << FLAT_FIELD_CORRECTION);
|
||||
@ -4200,7 +4200,7 @@ int multiSlsDetector::setFlatFieldCorrection(string fname) {
|
||||
std::cout << "Setting flat field correction from file " << fname << std::endl;
|
||||
#endif
|
||||
sprintf(ffffname, "%s/%s", thisMultiDetector->flatFieldDir, fname.c_str());
|
||||
nch = readDataFile(string(ffffname), data);
|
||||
nch = readDataFile(std::string(ffffname), data);
|
||||
|
||||
if (nch > thisMultiDetector->numberOfChannels)
|
||||
nch = thisMultiDetector->numberOfChannels;
|
||||
@ -4298,7 +4298,7 @@ int multiSlsDetector::flatFieldCorrect(double* datain, double* errin, double* da
|
||||
return 0;
|
||||
}
|
||||
|
||||
int multiSlsDetector::setBadChannelCorrection(string fname) {
|
||||
int multiSlsDetector::setBadChannelCorrection(std::string fname) {
|
||||
int badlist[MAX_BADCHANS];
|
||||
int nbad = 0;
|
||||
int ret = 0;
|
||||
@ -4306,7 +4306,7 @@ int multiSlsDetector::setBadChannelCorrection(string fname) {
|
||||
cout << thisMultiDetector->badChanFile << endl;
|
||||
|
||||
if (fname == "default")
|
||||
fname = string(thisMultiDetector->badChanFile);
|
||||
fname = std::string(thisMultiDetector->badChanFile);
|
||||
|
||||
ret = setBadChannelCorrection(fname, nbad, badlist);
|
||||
//#ifdef VERBOSE
|
||||
@ -4428,11 +4428,11 @@ int multiSlsDetector::getBadChannelCorrection(int* bad) {
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::readAngularConversionFile(string fname) {
|
||||
int multiSlsDetector::readAngularConversionFile(std::string fname) {
|
||||
|
||||
ifstream infile;
|
||||
std::ifstream infile;
|
||||
//int nm=0;
|
||||
infile.open(fname.c_str(), ios_base::in);
|
||||
infile.open(fname.c_str(), std::ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
@ -4451,11 +4451,11 @@ int multiSlsDetector::readAngularConversionFile(string fname) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int multiSlsDetector::writeAngularConversion(string fname) {
|
||||
int multiSlsDetector::writeAngularConversion(std::string fname) {
|
||||
|
||||
ofstream outfile;
|
||||
std::ofstream outfile;
|
||||
// int nm=0;
|
||||
outfile.open(fname.c_str(), ios_base::out);
|
||||
outfile.open(fname.c_str(), std::ios_base::out);
|
||||
if (outfile.is_open()) {
|
||||
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
@ -4548,8 +4548,8 @@ int multiSlsDetector::setReceiverOnline(int off) {
|
||||
return thisMultiDetector->receiverOnlineFlag;
|
||||
}
|
||||
|
||||
string multiSlsDetector::checkReceiverOnline() {
|
||||
string retval1 = "", retval;
|
||||
std::string multiSlsDetector::checkReceiverOnline() {
|
||||
std::string retval1 = "", retval;
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
retval = detectors[idet]->checkReceiverOnline();
|
||||
if (!retval.empty()) {
|
||||
@ -4564,7 +4564,7 @@ int multiSlsDetector::lockReceiver(int lock) {
|
||||
return callDetectorMember(&slsDetector::lockReceiver, lock);
|
||||
}
|
||||
|
||||
string multiSlsDetector::getReceiverLastClientIP() {
|
||||
std::string multiSlsDetector::getReceiverLastClientIP() {
|
||||
return callDetectorMember(&slsDetector::getReceiverLastClientIP);
|
||||
}
|
||||
|
||||
@ -4583,9 +4583,9 @@ std::string multiSlsDetector::getFilePath() {
|
||||
return setFilePath();
|
||||
}
|
||||
|
||||
string multiSlsDetector::setFilePath(string s) {
|
||||
std::string multiSlsDetector::setFilePath(std::string s) {
|
||||
|
||||
string ret = "errorerror", ret1;
|
||||
std::string ret = "errorerror", ret1;
|
||||
for (unsigned int idet = 0; idet < detectors.size(); ++idet) {
|
||||
ret1 = detectors[idet]->setFilePath(s);
|
||||
if (detectors[idet]->getErrorMask())
|
||||
@ -4603,9 +4603,9 @@ std::string multiSlsDetector::getFileName() {
|
||||
return setFileName();
|
||||
}
|
||||
|
||||
string multiSlsDetector::setFileName(string s) {
|
||||
std::string multiSlsDetector::setFileName(std::string s) {
|
||||
|
||||
string ret = "error";
|
||||
std::string ret = "error";
|
||||
int posmax = detectors.size();
|
||||
|
||||
if (!s.empty()) {
|
||||
@ -4616,12 +4616,12 @@ string multiSlsDetector::setFileName(string s) {
|
||||
|
||||
if (!threadpool) {
|
||||
cout << "Error in creating threadpool. Exiting" << endl;
|
||||
return string("");
|
||||
return std::string("");
|
||||
} else {
|
||||
string* sret[detectors.size()];
|
||||
std::string* sret[detectors.size()];
|
||||
for (int idet = 0; idet < posmax; ++idet) {
|
||||
sret[idet] = new string("error");
|
||||
Task* task = new Task(new func1_t<string, string>(&slsDetector::setFileName,
|
||||
sret[idet] = new std::string("error");
|
||||
Task* task = new Task(new func1_t<std::string, std::string>(&slsDetector::setFileName,
|
||||
detectors[idet], s, sret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
@ -4928,7 +4928,7 @@ int multiSlsDetector::createReceivingDataSockets(const bool destroy) {
|
||||
if (destroy) {
|
||||
cprintf(MAGENTA, "Going to destroy data sockets\n");
|
||||
//close socket
|
||||
for (vector<ZmqSocket*>::const_iterator it = zmqSocket.begin(); it != zmqSocket.end(); ++it) {
|
||||
for (std::vector<ZmqSocket*>::const_iterator it = zmqSocket.begin(); it != zmqSocket.end(); ++it) {
|
||||
(*it)->Close();
|
||||
delete(*it);
|
||||
}
|
||||
@ -5010,7 +5010,7 @@ void multiSlsDetector::readFrameFromReceiver() {
|
||||
uint32_t size = 0, nPixelsX = 0, nPixelsY = 0, dynamicRange = 0;
|
||||
float bytesPerPixel = 0;
|
||||
// header info every header
|
||||
string currentFileName = "";
|
||||
std::string currentFileName = "";
|
||||
uint64_t currentAcquisitionIndex = -1, currentFrameIndex = -1, currentFileIndex = -1;
|
||||
uint32_t currentSubFrameIndex = -1, coordX = -1, coordY = -1, flippedDataX = -1;
|
||||
|
||||
@ -5078,11 +5078,11 @@ void multiSlsDetector::readFrameFromReceiver() {
|
||||
currentFrameIndex = doc["fIndex"].GetUint64();
|
||||
currentFileIndex = doc["fileIndex"].GetUint64();
|
||||
currentSubFrameIndex = doc["expLength"].GetUint();
|
||||
coordX = doc["xCoord"].GetUint();
|
||||
coordY = doc["yCoord"].GetUint();
|
||||
coordY = doc["row"].GetUint();
|
||||
coordX = doc["column"].GetUint();
|
||||
if (eiger)
|
||||
coordY = (nY - 1) - coordY;
|
||||
//cout << "X:" << doc["xCoord"].GetUint() <<" Y:"<<doc["yCoord"].GetUint();
|
||||
//cout << "X:" << doc["row"].GetUint() <<" Y:"<<doc["column"].GetUint();
|
||||
flippedDataX = doc["flippedDataX"].GetUint();
|
||||
#ifdef VERBOSE
|
||||
cprintf(BLUE, "(Debug) Header Info:\n"
|
||||
@ -5375,7 +5375,7 @@ int multiSlsDetector::setReceiverSilentMode(int i) {
|
||||
return callDetectorMember(&slsDetector::setReceiverSilentMode, i);
|
||||
}
|
||||
|
||||
int multiSlsDetector::setCTBPattern(string fname) {
|
||||
int multiSlsDetector::setCTBPattern(std::string fname) {
|
||||
uint64_t word;
|
||||
int addr = 0;
|
||||
FILE* fd = fopen(fname.c_str(), "r");
|
||||
|
@ -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
|
||||
|
@ -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) \
|
||||
|
@ -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,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 0x20180718
|
||||
#define GITBRANCH "3.3.0-rc"
|
||||
#define GITREV 0x4020
|
||||
#define GITDATE 0x20180927
|
||||
#define GITBRANCH "4.0.0"
|
||||
|
@ -768,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;
|
||||
|
||||
|
||||
@ -3808,7 +3808,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;
|
||||
}
|
||||
|
||||
@ -3949,7 +3949,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;
|
||||
@ -4149,27 +4149,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;
|
||||
}
|
||||
@ -5321,6 +5300,9 @@ string slsDetector::setReceiver(string receiverIP) {
|
||||
setReceiverStreamingIP(getReceiverStreamingIP());
|
||||
setAdditionalJsonHeader(getAdditionalJsonHeader());
|
||||
enableDataStreamingFromReceiver(enableDataStreamingFromReceiver(-1));
|
||||
|
||||
if(thisDetector->myDetectorType == GOTTHARD)
|
||||
sendROI(-1, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6065,9 +6047,6 @@ int slsDetector::setROI(int n,ROI roiLimits[]) {
|
||||
}
|
||||
|
||||
ret = sendROI(n,roiLimits);
|
||||
if(ret==FAIL)
|
||||
setErrorMask((getErrorMask())|(COULDNOT_SET_ROI));
|
||||
|
||||
|
||||
if(thisDetector->myDetectorType==JUNGFRAUCTB) getTotalNumberOfChannels();
|
||||
return ret;
|
||||
@ -6132,17 +6111,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;
|
||||
}
|
||||
@ -9026,13 +9027,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;
|
||||
}
|
||||
|
||||
@ -9044,11 +9038,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;
|
||||
|
@ -519,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
|
||||
@ -582,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
|
||||
@ -596,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)
|
||||
@ -768,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
|
||||
@ -778,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);
|
||||
|
||||
|
||||
/**
|
||||
@ -818,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
|
||||
@ -833,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
|
||||
@ -854,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
|
||||
@ -869,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
|
||||
@ -877,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,
|
||||
@ -896,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
|
||||
@ -965,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)
|
||||
@ -978,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
|
||||
@ -988,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
|
||||
@ -997,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)
|
||||
@ -1006,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)
|
||||
@ -1015,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)
|
||||
@ -1275,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.
|
||||
@ -1371,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
|
||||
@ -1407,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
|
||||
@ -1415,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)
|
||||
@ -1455,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
|
||||
@ -1471,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)
|
||||
@ -1658,7 +1658,7 @@ public:
|
||||
* @param fname file name
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int programFPGA(string fname);
|
||||
int programFPGA(std::string fname);
|
||||
|
||||
/**
|
||||
* Resets FPGA (Jungfrau)
|
||||
@ -1845,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)
|
||||
@ -1880,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)
|
||||
@ -1905,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)
|
||||
@ -1913,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)
|
||||
@ -1921,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)
|
||||
@ -1929,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)
|
||||
@ -1965,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
|
||||
@ -1974,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
|
||||
@ -1987,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
|
||||
@ -2028,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
|
||||
@ -2236,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
|
||||
@ -2394,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
|
||||
@ -2429,7 +2429,7 @@ private:
|
||||
* @param delay delay
|
||||
* @returns transmission delay
|
||||
*/
|
||||
string setDetectorNetworkParameter(networkParameter index, int delay);
|
||||
std::string setDetectorNetworkParameter(networkParameter index, int delay);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -4464,6 +4464,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!");
|
||||
@ -4481,10 +4484,10 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
||||
ROI allroi[val];
|
||||
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)) )
|
||||
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);
|
||||
|
@ -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:
|
||||
|
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsReceiverSoftware
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: 6bb7195a2c7dc9526088882e0244a7455d3c15b2
|
||||
Revision: 809
|
||||
Branch: 3.3.0-rc
|
||||
Repsitory UUID: d2bce7e372c241cd235977b92be18555bca6a77d
|
||||
Revision: 839
|
||||
Branch: 4.0.0
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 3941
|
||||
Last Changed Date: 2018-07-18 12:11:38.000000002 +0200 ./include/HDF5FileStatic.h
|
||||
Last Changed Rev: 4020
|
||||
Last Changed Date: 2018-09-27 17:58:04.000000002 +0200 ./src/UDPStandardImplementation.cpp
|
||||
|
@ -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"
|
||||
|
@ -14,6 +14,8 @@ class Fifo;
|
||||
class DataStreamer;
|
||||
class ZmqSocket;
|
||||
|
||||
#include <vector>
|
||||
|
||||
class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
|
||||
|
||||
public:
|
||||
@ -23,13 +25,13 @@ 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,
|
||||
DataStreamer(int ind, Fifo*& f, uint32_t* dr, std::vector<ROI>* r,
|
||||
uint64_t* fi, int* fd, char* ajh, bool* sm);
|
||||
|
||||
/**
|
||||
@ -172,8 +174,11 @@ 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;
|
||||
|
@ -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,9 +279,16 @@ class ShortGotthardData : public GeneralData {
|
||||
*/
|
||||
virtual void GetHeaderInfo(int index, char* packetData, uint64_t& frameNumber, uint32_t& packetNumber) const
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Header Infomation (frame number, packet number)
|
||||
@ -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
|
||||
{
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -181,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,8 +196,8 @@ 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};
|
||||
@ -214,9 +213,9 @@ public:
|
||||
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.xCoord, parameterDataTypes[6], memspace, *dspace_para);i=7;
|
||||
dset_para[7]->write(&header.yCoord, parameterDataTypes[7], memspace, *dspace_para);i=8;
|
||||
dset_para[8]->write(&header.zCoord, parameterDataTypes[8], memspace, *dspace_para);i=9;
|
||||
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;
|
||||
@ -260,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
|
||||
@ -309,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,
|
||||
@ -357,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;
|
||||
@ -368,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 );
|
||||
@ -390,30 +389,30 @@ 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();
|
||||
|
||||
@ -450,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
|
||||
@ -488,10 +487,10 @@ public:
|
||||
|
||||
|
||||
//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
|
||||
@ -557,52 +556,52 @@ public:
|
||||
* @returns 0 for success and 1 for fail
|
||||
*/
|
||||
static int CreateVirtualDataFile(
|
||||
string virtualFileName,
|
||||
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)
|
||||
{
|
||||
//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
|
||||
@ -610,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
|
||||
@ -674,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};
|
||||
@ -697,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(),
|
||||
@ -737,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
|
||||
@ -758,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
|
||||
@ -786,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;
|
||||
@ -814,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;
|
||||
@ -884,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));
|
||||
}
|
||||
|
||||
@ -919,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"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -956,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);
|
||||
|
@ -141,12 +141,12 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject {
|
||||
int CreateDummySocketForUDPSocketBufferSize(uint32_t s);
|
||||
|
||||
/**
|
||||
* Set xcoord and y coord
|
||||
* xcoord is in 1d if detector has not send them yet in firmware,
|
||||
* xcoord is in 2d for jungfrau and eiger (for missing packets/deactivated eiger)
|
||||
* ycoord when used is in 2d
|
||||
* 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 SetHardCodedCoords(uint16_t x, uint16_t y);
|
||||
void SetHardCodedPosition(uint16_t r, uint16_t c);
|
||||
|
||||
|
||||
|
||||
@ -251,14 +251,14 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject {
|
||||
/** Silent Mode */
|
||||
bool* silentMode;
|
||||
|
||||
/** x coord hardcoded as 1D or 2d,
|
||||
/** row hardcoded as 1D or 2d,
|
||||
* if detector does not send them yet or
|
||||
* missing packets/deactivated (eiger/jungfrau sends 2d pos) **/
|
||||
uint16_t xcoord;
|
||||
uint16_t row;
|
||||
|
||||
/** y coord hardcoded as 2D,
|
||||
/** column hardcoded as 2D,
|
||||
* deactivated eiger/missing packets (eiger/jungfrau sends 2d pos) **/
|
||||
uint16_t ycoord;
|
||||
uint16_t column;
|
||||
|
||||
|
||||
// acquisition start
|
||||
|
@ -182,10 +182,10 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
|
||||
//***acquisition parameters***
|
||||
/**
|
||||
* Get Short Frame Enabled, later will be moved to getROI (so far only for gotthard)
|
||||
* Get ROI
|
||||
* @return index of adc enabled, else -1 if all enabled
|
||||
*/
|
||||
int getShortFrameEnable() const;
|
||||
std::vector<ROI> getROI() const;
|
||||
|
||||
/**
|
||||
* Get the Frequency of Frames Sent to GUI
|
||||
@ -332,7 +332,7 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
* Configure command line parameters
|
||||
* @param config_map mapping of config parameters passed from command line arguments
|
||||
*/
|
||||
void configure(map<string, string> config_map);
|
||||
void configure(std::map<std::string, std::string> config_map);
|
||||
|
||||
/*
|
||||
* Set multi detector size
|
||||
@ -448,11 +448,11 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
|
||||
//***acquisition parameters***
|
||||
/**
|
||||
* Set Short Frame Enabled, later will be moved to getROI (so far only for gotthard)
|
||||
* @param i index of adc enabled, else -1 if all enabled
|
||||
* Set ROI
|
||||
* @param i ROI
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int setShortFrameEnable(const int i);
|
||||
int setROI(const std::vector<ROI> i);
|
||||
|
||||
/**
|
||||
* Set the Frequency of Frames Sent to GUI
|
||||
@ -785,8 +785,8 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
bool dataCompressionEnable;
|
||||
|
||||
//***acquisition parameters***
|
||||
/* Short Frame Enable or index of adc enabled, else -1 if all enabled (gotthard specific) TODO: move to setROI */
|
||||
int shortFrameEnable;
|
||||
/* ROI */
|
||||
std::vector<ROI> roi;
|
||||
/** Frequency of Frames sent to GUI */
|
||||
uint32_t frameToGuiFrequency;
|
||||
/** Timer of Frames sent to GUI when frequency is 0 */
|
||||
|
@ -11,13 +11,13 @@
|
||||
* @short Base class with all the functions for the UDP inteface of the receiver
|
||||
*/
|
||||
|
||||
#include <exception>
|
||||
|
||||
#include "sls_receiver_defs.h"
|
||||
#include "receiver_defs.h"
|
||||
#include "utilities.h"
|
||||
#include "logger.h"
|
||||
|
||||
#include <exception>
|
||||
#include <vector>
|
||||
|
||||
class UDPInterface {
|
||||
|
||||
@ -54,6 +54,8 @@ class UDPInterface {
|
||||
* -setStreamingSourceIP
|
||||
* -setAdditionalJsonHeader
|
||||
* -setDataStreamEnable
|
||||
* -setROI
|
||||
*
|
||||
*
|
||||
*
|
||||
* supported sequence of method-calls:
|
||||
@ -114,7 +116,7 @@ class UDPInterface {
|
||||
* @param [in] receiver_type type can be standard or custom (must be derived from base class)
|
||||
* @return a UDPInterface reference to object depending on receiver type
|
||||
*/
|
||||
static UDPInterface *create(string receiver_type = "standard");
|
||||
static UDPInterface *create(std::string receiver_type = "standard");
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
@ -271,10 +273,10 @@ class UDPInterface {
|
||||
|
||||
//***acquisition parameters***
|
||||
/**
|
||||
* Get Short Frame Enabled, later will be moved to getROI (so far only for gotthard)
|
||||
* Get ROI
|
||||
* @return index of adc enabled, else -1 if all enabled
|
||||
*/
|
||||
virtual int getShortFrameEnable() const = 0;
|
||||
virtual std::vector<slsReceiverDefs::ROI> getROI() const = 0;
|
||||
|
||||
/**
|
||||
* Get the Frequency of Frames Sent to GUI
|
||||
@ -420,7 +422,7 @@ class UDPInterface {
|
||||
* Configure command line parameters
|
||||
* @param config_map mapping of config parameters passed from command line arguments
|
||||
*/
|
||||
virtual void configure(map<string, string> config_map) = 0;
|
||||
virtual void configure(std::map<std::string, std::string> config_map) = 0;
|
||||
|
||||
/*
|
||||
* Set multi detector size
|
||||
@ -535,11 +537,11 @@ class UDPInterface {
|
||||
|
||||
//***acquisition parameters***
|
||||
/**
|
||||
* Set Short Frame Enabled, later will be moved to getROI (so far only for gotthard)
|
||||
* @param i index of adc enabled, else -1 if all enabled
|
||||
* Set ROI
|
||||
* @param i ROI
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
virtual int setShortFrameEnable(const int i) = 0;
|
||||
virtual int setROI(const std::vector<slsReceiverDefs::ROI> i) = 0;
|
||||
|
||||
/**
|
||||
* Set the Frequency of Frames Sent to GUI
|
||||
|
@ -14,7 +14,6 @@ class DataProcessor;
|
||||
class DataStreamer;
|
||||
class Fifo;
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBaseImplementation {
|
||||
@ -74,11 +73,11 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
|
||||
void setFileWriteEnable(const bool b);
|
||||
|
||||
/**
|
||||
* Set Short Frame Enabled, later will be moved to getROI (so far only for gotthard)
|
||||
* @param i index of adc enabled, else -1 if all enabled
|
||||
* Set ROI
|
||||
* @param i ROI
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int setShortFrameEnable(const int i);
|
||||
int setROI(const std::vector<ROI> i);
|
||||
|
||||
/**
|
||||
* Set the Frequency of Frames Sent to GUI
|
||||
|
@ -248,7 +248,7 @@ public:
|
||||
uint64_t acqIndex = 0, uint64_t fIndex = 0, char* fname = NULL,
|
||||
uint64_t frameNumber = 0, uint32_t expLength = 0, uint32_t packetNumber = 0,
|
||||
uint64_t bunchId = 0, uint64_t timestamp = 0,
|
||||
uint16_t modId = 0, uint16_t xCoord = 0, uint16_t yCoord = 0, uint16_t zCoord = 0,
|
||||
uint16_t modId = 0, uint16_t row = 0, uint16_t column = 0, uint16_t reserved = 0,
|
||||
uint32_t debug = 0, uint16_t roundRNumber = 0,
|
||||
uint8_t detType = 0, uint8_t version = 0, int* flippedData = 0,
|
||||
char* additionalJsonHeader = 0) {
|
||||
@ -274,9 +274,9 @@ public:
|
||||
"\"bunchId\":%llu, "
|
||||
"\"timestamp\":%llu, "
|
||||
"\"modId\":%u, "
|
||||
"\"xCoord\":%u, "
|
||||
"\"yCoord\":%u, "
|
||||
"\"zCoord\":%u, "
|
||||
"\"row\":%u, "
|
||||
"\"column\":%u, "
|
||||
"\"reserved\":%u, "
|
||||
"\"debug\":%u, "
|
||||
"\"roundRNumber\":%u, "
|
||||
"\"detType\":%u, "
|
||||
@ -285,22 +285,22 @@ public:
|
||||
//additional stuff
|
||||
"\"flippedDataX\":%u"
|
||||
|
||||
;//"}\n\0";
|
||||
;//"}\n";
|
||||
int length = sprintf(buf, jsonHeaderFormat,
|
||||
jsonversion, dynamicrange, fileIndex, npixelsx, npixelsy, imageSize,
|
||||
acqIndex, fIndex, (fname == NULL)? "":fname, dummy?0:1,
|
||||
|
||||
frameNumber, expLength, packetNumber, bunchId, timestamp,
|
||||
modId, xCoord, yCoord, zCoord, debug, roundRNumber,
|
||||
modId, row, column, reserved, debug, roundRNumber,
|
||||
detType, version,
|
||||
|
||||
//additional stuff
|
||||
((flippedData == 0 ) ? 0 :flippedData[0])
|
||||
);
|
||||
if (additionalJsonHeader && strlen(additionalJsonHeader)) {
|
||||
length = sprintf(buf, "%s, %s}\n%c", buf, additionalJsonHeader, '\0');
|
||||
length = sprintf(buf, "%s, %s}\n", buf, additionalJsonHeader);
|
||||
} else {
|
||||
length = sprintf(buf, "%s}\n%c", buf, '\0');
|
||||
length = sprintf(buf, "%s}\n", buf);
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <semaphore.h>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
typedef double double32_t;
|
||||
typedef float float32_t;
|
||||
@ -46,7 +45,7 @@ public:
|
||||
int getFreeValue() const;
|
||||
|
||||
private:
|
||||
vector <Element*> array;
|
||||
std::vector <Element*> array;
|
||||
unsigned int tail; // input index
|
||||
unsigned int head; // output index
|
||||
unsigned int Capacity;
|
||||
|
@ -43,7 +43,7 @@ class sockaddr_in;
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include "logger.h"
|
||||
using namespace std;
|
||||
|
||||
|
||||
#define DEFAULT_PACKET_SIZE 1286
|
||||
#define SOCKET_BUFFER_SIZE (100*1024*1024) //100 MB
|
||||
@ -142,8 +142,8 @@ public:
|
||||
strcpy(ip,"0.0.0.0");
|
||||
clientAddress_length=sizeof(clientAddress);
|
||||
if (eth) {
|
||||
strcpy(ip,nameToIp(string(eth)).c_str());
|
||||
if (string(ip)==string("0.0.0.0"))
|
||||
strcpy(ip,nameToIp(std::string(eth)).c_str());
|
||||
if (std::string(ip)==std::string("0.0.0.0"))
|
||||
strcpy(ip,eth);
|
||||
}
|
||||
|
||||
@ -161,7 +161,7 @@ public:
|
||||
serverAddress.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
|
||||
|
||||
if (string(ip)!=string("0.0.0.0")) {
|
||||
if (std::string(ip)!=std::string("0.0.0.0")) {
|
||||
if (inet_pton(AF_INET, ip, &(serverAddress.sin_addr)));
|
||||
else
|
||||
serverAddress.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
@ -493,7 +493,7 @@ public:
|
||||
* @param ip IP
|
||||
* @returns hostname
|
||||
*/
|
||||
static string ipToName(string ip) {
|
||||
static std::string ipToName(std::string ip) {
|
||||
struct ifaddrs *addrs, *iap;
|
||||
struct sockaddr_in *sa;
|
||||
|
||||
@ -507,7 +507,7 @@ public:
|
||||
if (iap->ifa_addr && (iap->ifa_flags & IFF_UP) && iap->ifa_addr->sa_family == AF_INET) {
|
||||
sa = (struct sockaddr_in *)(iap->ifa_addr);
|
||||
inet_ntop(iap->ifa_addr->sa_family, (void *)&(sa->sin_addr), buf, buf_len);
|
||||
if (ip==string(buf)) {
|
||||
if (ip==std::string(buf)) {
|
||||
//printf("%s\n", iap->ifa_name);
|
||||
strcpy(buf,iap->ifa_name);
|
||||
break;
|
||||
@ -515,7 +515,7 @@ public:
|
||||
}
|
||||
}
|
||||
freeifaddrs(addrs);
|
||||
return string(buf);
|
||||
return std::string(buf);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -523,7 +523,7 @@ public:
|
||||
* @param inf interface
|
||||
* @returns mac address
|
||||
*/
|
||||
static string nameToMac(string inf) {
|
||||
static std::string nameToMac(std::string inf) {
|
||||
struct ifreq ifr;
|
||||
int sock, j, k;
|
||||
char mac[32];
|
||||
@ -534,7 +534,7 @@ public:
|
||||
|
||||
if (-1==ioctl(sock, SIOCGIFHWADDR, &ifr)) {
|
||||
perror("ioctl(SIOCGIFHWADDR) ");
|
||||
return string("00:00:00:00:00:00");
|
||||
return std::string("00:00:00:00:00:00");
|
||||
}
|
||||
for (j=0, k=0; j<6; j++) {
|
||||
k+=snprintf(mac+k, mac_len-k-1, j ? ":%02X" : "%02X",
|
||||
@ -545,7 +545,7 @@ public:
|
||||
if(sock!=1){
|
||||
close(sock);
|
||||
}
|
||||
return string(mac);
|
||||
return std::string(mac);
|
||||
|
||||
};
|
||||
|
||||
@ -554,7 +554,7 @@ public:
|
||||
* @param inf hostname
|
||||
* @returns IP
|
||||
*/
|
||||
static string nameToIp(string inf){
|
||||
static std::string nameToIp(std::string inf){
|
||||
struct ifreq ifr;
|
||||
int sock;
|
||||
char *p, addr[32];
|
||||
@ -565,7 +565,7 @@ public:
|
||||
|
||||
if (-1==ioctl(sock, SIOCGIFADDR, &ifr)) {
|
||||
perror("ioctl(SIOCGIFADDR) ");
|
||||
return string("0.0.0.0");
|
||||
return std::string("0.0.0.0");
|
||||
}
|
||||
p=inet_ntoa(((struct sockaddr_in *)(&ifr.ifr_addr))->sin_addr);
|
||||
strncpy(addr,p,addr_len-1);
|
||||
@ -574,7 +574,7 @@ public:
|
||||
if(sock!=1){
|
||||
close(sock);
|
||||
}
|
||||
return string(addr);
|
||||
return std::string(addr);
|
||||
|
||||
};
|
||||
|
||||
@ -584,7 +584,7 @@ public:
|
||||
* @param ifr interface request structure
|
||||
* @returns sock
|
||||
*/
|
||||
static int getSock(string inf, struct ifreq *ifr) {
|
||||
static int getSock(std::string inf, struct ifreq *ifr) {
|
||||
|
||||
int sock;
|
||||
sock=socket(PF_INET, SOCK_STREAM, 0);
|
||||
|
@ -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 0x20180718
|
||||
#define GITBRANCH "3.3.0-rc"
|
||||
#define GITREV 0x4020
|
||||
#define GITDATE 0x20180927
|
||||
#define GITBRANCH "4.0.0"
|
||||
|
@ -24,13 +24,13 @@
|
||||
#define STRINGIFY(x) #x
|
||||
#define TOSTRING(x) STRINGIFY(x)
|
||||
#define MYCONCAT(x,y)
|
||||
#define __AT__ string(__FILE__) + string("::") + string(__func__) + string("(): ")
|
||||
#define __AT__ std::string(__FILE__) + std::string("::") + std::string(__func__) + std::string("(): ")
|
||||
#define __SHORT_FORM_OF_FILE__ \
|
||||
(strrchr(__FILE__,'/') \
|
||||
? strrchr(__FILE__,'/')+1 \
|
||||
: __FILE__ \
|
||||
)
|
||||
#define __SHORT_AT__ string(__SHORT_FORM_OF_FILE__) + string("::") + string(__func__) + string("(): ")
|
||||
#define __SHORT_AT__ std::string(__SHORT_FORM_OF_FILE__) + std::string("::") + std::string(__func__) + std::string("(): ")
|
||||
|
||||
|
||||
|
||||
|
@ -28,8 +28,8 @@
|
||||
#define MAX_CHUNKED_IMAGES 1
|
||||
|
||||
//versions
|
||||
#define HDF5_WRITER_VERSION 2.0 //1 decimal places
|
||||
#define BINARY_WRITER_VERSION 2.0 //1 decimal places
|
||||
#define HDF5_WRITER_VERSION 3.0 //1 decimal places
|
||||
#define BINARY_WRITER_VERSION 3.0 //1 decimal places
|
||||
|
||||
|
||||
//parameters to calculate fifo depth
|
||||
|
@ -163,8 +163,8 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
|
||||
/** set detector hostname */
|
||||
int set_detector_hostname();
|
||||
|
||||
/** set short frame */
|
||||
int set_short_frame();
|
||||
/** set roi */
|
||||
int set_roi();
|
||||
|
||||
/** Set up UDP Details */
|
||||
int setup_udp();
|
||||
|
@ -37,8 +37,8 @@ typedef int int32_t;
|
||||
#define DEFAULT_ZMQ_CL_PORTNO 30001
|
||||
#define DEFAULT_ZMQ_RX_PORTNO 30001
|
||||
|
||||
#define SLS_DETECTOR_HEADER_VERSION 0x1
|
||||
#define SLS_DETECTOR_JSON_HEADER_VERSION 0x2
|
||||
#define SLS_DETECTOR_HEADER_VERSION 0x2
|
||||
#define SLS_DETECTOR_JSON_HEADER_VERSION 0x3
|
||||
|
||||
/**
|
||||
\file sls_receiver_defs.h
|
||||
@ -143,9 +143,9 @@ public:
|
||||
@li bunchId is the bunch id from beamline
|
||||
@li timestamp is the time stamp with 10 MHz clock
|
||||
@li modId is the unique module id (unique even for left, right, top, bottom)
|
||||
@li xCoord is the x coordinate in the complete detector system
|
||||
@li yCoord is the y coordinate in the complete detector system
|
||||
@li zCoord is the z coordinate in the complete detector system
|
||||
@li row is the row index in the complete detector system
|
||||
@li column is the column index in the complete detector system
|
||||
@li reserved is reserved
|
||||
@li debug is for debugging purposes
|
||||
@li roundRNumber is the round robin set number
|
||||
@li detType is the detector type see :: detectorType
|
||||
@ -159,9 +159,9 @@ public:
|
||||
uint64_t bunchId; /**< is the bunch id from beamline */
|
||||
uint64_t timestamp; /**< is the time stamp with 10 MHz clock */
|
||||
uint16_t modId; /**< is the unique module id (unique even for left, right, top, bottom) */
|
||||
uint16_t xCoord; /**< is the x coordinate in the complete detector system */
|
||||
uint16_t yCoord; /**< is the y coordinate in the complete detector system */
|
||||
uint16_t zCoord; /**< is the z coordinate in the complete detector system */
|
||||
uint16_t row; /**< is the row index in the complete detector system */
|
||||
uint16_t column; /**< is the column index in the complete detector system */
|
||||
uint16_t reserved; /**< is reserved */
|
||||
uint32_t debug; /**< is for debugging purposes */
|
||||
uint16_t roundRNumber; /**< is the round robin set number */
|
||||
uint8_t detType; /**< is the detector type see :: detectorType */
|
||||
@ -205,6 +205,19 @@ public:
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@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 ;
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
/** returns string from enabled/disabled
|
||||
\param b true or false
|
||||
|
@ -22,7 +22,7 @@ enum recFuncs{
|
||||
F_SEND_RECEIVER_DETHOSTNAME, /**< set detector hostname to receiver */
|
||||
|
||||
//network functions
|
||||
F_RECEIVER_SHORT_FRAME, /**< Sets receiver to receive short frames */
|
||||
F_RECEIVER_SET_ROI, /**< Sets receiver ROI */
|
||||
F_SETUP_RECEIVER_UDP, /**< sets the receiver udp connection and returns receiver mac address */
|
||||
|
||||
//Acquisition setup functions
|
||||
|
@ -5,12 +5,11 @@
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
|
||||
using namespace std;
|
||||
#include "sls_receiver_defs.h"
|
||||
|
||||
/* uncomment next line to enable debug output */
|
||||
//#define EIGER_DEBUG
|
||||
|
||||
|
||||
int read_config_file(string fname, int *tcpip_port_no, map<string, string> * configuration_map);
|
||||
int read_config_file(std::string fname, int *tcpip_port_no, std::map<std::string, std::string> * configuration_map);
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "Fifo.h"
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
FILE* BinaryFile::masterfd = 0;
|
||||
|
@ -18,9 +18,8 @@
|
||||
#include <iostream>
|
||||
#include <errno.h>
|
||||
#include <cstring>
|
||||
using namespace std;
|
||||
|
||||
const string DataProcessor::TypeName = "DataProcessor";
|
||||
const std::string DataProcessor::TypeName = "DataProcessor";
|
||||
|
||||
|
||||
DataProcessor::DataProcessor(int ind, detectorType dtype, Fifo*& f,
|
||||
@ -78,7 +77,7 @@ DataProcessor::~DataProcessor() {
|
||||
}
|
||||
|
||||
/** getters */
|
||||
string DataProcessor::GetType(){
|
||||
std::string DataProcessor::GetType(){
|
||||
return TypeName;
|
||||
}
|
||||
|
||||
@ -478,7 +477,7 @@ void DataProcessor::PadMissingPackets(char* buf) {
|
||||
if (!nmissing)
|
||||
break;
|
||||
|
||||
FILE_LOG(logDEBUG) << "padding for " << index << " for pnum: " << pnum << endl;
|
||||
FILE_LOG(logDEBUG) << "padding for " << index << " for pnum: " << pnum << std::endl;
|
||||
|
||||
// missing packet
|
||||
switch(myDetectorType) {
|
||||
|
@ -11,12 +11,11 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <errno.h>
|
||||
using namespace std;
|
||||
|
||||
const string DataStreamer::TypeName = "DataStreamer";
|
||||
const std::string DataStreamer::TypeName = "DataStreamer";
|
||||
|
||||
|
||||
DataStreamer::DataStreamer(int ind, Fifo*& f, uint32_t* dr, int* sEnable,
|
||||
DataStreamer::DataStreamer(int ind, Fifo*& f, uint32_t* dr, std::vector<ROI>* r,
|
||||
uint64_t* fi, int* fd, char* ajh, bool* sm) :
|
||||
ThreadObject(ind),
|
||||
runningFlag(0),
|
||||
@ -24,7 +23,8 @@ DataStreamer::DataStreamer(int ind, Fifo*& f, uint32_t* dr, int* sEnable,
|
||||
fifo(f),
|
||||
zmqSocket(0),
|
||||
dynamicRange(dr),
|
||||
shortFrameEnable(sEnable),
|
||||
roi(r),
|
||||
adcConfigured(-1),
|
||||
fileIndex(fi),
|
||||
flippedData(fd),
|
||||
additionJsonHeader(ajh),
|
||||
@ -51,7 +51,7 @@ DataStreamer::~DataStreamer() {
|
||||
}
|
||||
|
||||
/** getters */
|
||||
string DataStreamer::GetType(){
|
||||
std::string DataStreamer::GetType(){
|
||||
return TypeName;
|
||||
}
|
||||
|
||||
@ -88,7 +88,10 @@ void DataStreamer::ResetParametersforNewMeasurement(char* fname){
|
||||
delete [] completeBuffer;
|
||||
completeBuffer = 0;
|
||||
}
|
||||
if (*shortFrameEnable >= 0) {
|
||||
if (roi->size()) {
|
||||
if (generalData->myDetectorType == GOTTHARD) {
|
||||
adcConfigured = generalData->GetAdcConfigured(index, roi);
|
||||
}
|
||||
completeBuffer = new char[generalData->imageSizeComplete];
|
||||
memset(completeBuffer, 0, generalData->imageSizeComplete);
|
||||
}
|
||||
@ -212,11 +215,19 @@ void DataStreamer::ProcessAnImage(char* buf) {
|
||||
//shortframe gotthard
|
||||
if (completeBuffer) {
|
||||
|
||||
if (!SendHeader(header, (uint32_t)(*((uint32_t*)buf)), generalData->nPixelsXComplete, generalData->nPixelsYComplete, false))
|
||||
//disregarding the size modified from callback (always using imageSizeComplete
|
||||
// instead of buf (32 bit) because gui needs imagesizecomplete and listener
|
||||
//write imagesize
|
||||
|
||||
if (!SendHeader(header, generalData->imageSizeComplete,
|
||||
generalData->nPixelsXComplete, generalData->nPixelsYComplete, false))
|
||||
cprintf(RED,"Error: Could not send zmq header for fnum %lld and streamer %d\n",
|
||||
(long long int) fnum, index);
|
||||
|
||||
memcpy(completeBuffer + ((generalData->imageSize)**shortFrameEnable), buf + FIFO_HEADER_NUMBYTES + sizeof(sls_receiver_header), (uint32_t)(*((uint32_t*)buf)) ); // new size possibly from callback
|
||||
memcpy(completeBuffer + ((generalData->imageSize) * adcConfigured),
|
||||
buf + FIFO_HEADER_NUMBYTES + sizeof(sls_receiver_header),
|
||||
(uint32_t)(*((uint32_t*)buf)) );
|
||||
|
||||
if (!zmqSocket->SendData(completeBuffer, generalData->imageSizeComplete))
|
||||
cprintf(RED,"Error: Could not send zmq data for fnum %lld and streamer %d\n",
|
||||
(long long int) fnum, index);
|
||||
@ -226,11 +237,13 @@ void DataStreamer::ProcessAnImage(char* buf) {
|
||||
//normal
|
||||
else {
|
||||
|
||||
if (!SendHeader(header, (uint32_t)(*((uint32_t*)buf)), generalData->nPixelsX, generalData->nPixelsY, false)) // new size possibly from callback
|
||||
if (!SendHeader(header, (uint32_t)(*((uint32_t*)buf)),
|
||||
generalData->nPixelsX, generalData->nPixelsY, false)) // new size possibly from callback
|
||||
cprintf(RED,"Error: Could not send zmq header for fnum %lld and streamer %d\n",
|
||||
(long long int) fnum, index);
|
||||
|
||||
if (!zmqSocket->SendData(buf + FIFO_HEADER_NUMBYTES + sizeof(sls_receiver_header), (uint32_t)(*((uint32_t*)buf)) )) // new size possibly from callback
|
||||
if (!zmqSocket->SendData(buf + FIFO_HEADER_NUMBYTES + sizeof(sls_receiver_header),
|
||||
(uint32_t)(*((uint32_t*)buf)) )) // new size possibly from callback
|
||||
cprintf(RED,"Error: Could not send zmq data for fnum %lld and streamer %d\n",
|
||||
(long long int) fnum, index);
|
||||
}
|
||||
@ -252,7 +265,7 @@ int DataStreamer::SendHeader(sls_receiver_header* rheader, uint32_t size, uint32
|
||||
nx, ny, size,
|
||||
acquisitionIndex, frameIndex, fileNametoStream,
|
||||
header.frameNumber, header.expLength, header.packetNumber, header.bunchId, header.timestamp,
|
||||
header.modId, header.xCoord, header.yCoord, header.zCoord,
|
||||
header.modId, header.row, header.column, header.reserved,
|
||||
header.debug, header.roundRNumber,
|
||||
header.detType, header.version,
|
||||
flippedData,
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
using namespace std;
|
||||
|
||||
|
||||
Fifo::Fifo(int ind, uint32_t fifoItemSize, uint32_t depth):
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include "File.h"
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
File::File(int ind, uint32_t* maxf,
|
||||
@ -35,28 +34,28 @@ File::File(int ind, uint32_t* maxf,
|
||||
|
||||
File::~File() {}
|
||||
|
||||
string File::GetCurrentFileName() {
|
||||
std::string File::GetCurrentFileName() {
|
||||
return currentFileName;
|
||||
}
|
||||
|
||||
void File::PrintMembers() {
|
||||
FILE_LOG(logINFO) << "\nGeneral Writer Variables:" << endl
|
||||
<< "Index: " << index << endl
|
||||
<< "Max Frames Per File: " << *maxFramesPerFile << endl
|
||||
<< "Number of Detectors in x dir: " << numDetX << endl
|
||||
<< "Number of Detectors in y dir: " << numDetY << endl
|
||||
<< "File Name Prefix: " << fileNamePrefix << endl
|
||||
<< "File Path: " << filePath << endl
|
||||
<< "File Index: " << *fileIndex << endl
|
||||
<< "Over Write Enable: " << *overWriteEnable << endl
|
||||
FILE_LOG(logINFO) << "\nGeneral Writer Variables:" << std::endl
|
||||
<< "Index: " << index << std::endl
|
||||
<< "Max Frames Per File: " << *maxFramesPerFile << std::endl
|
||||
<< "Number of Detectors in x dir: " << numDetX << std::endl
|
||||
<< "Number of Detectors in y dir: " << numDetY << std::endl
|
||||
<< "File Name Prefix: " << fileNamePrefix << std::endl
|
||||
<< "File Path: " << filePath << std::endl
|
||||
<< "File Index: " << *fileIndex << std::endl
|
||||
<< "Over Write Enable: " << *overWriteEnable << std::endl
|
||||
|
||||
<< "Detector Index: " << *detIndex << endl
|
||||
<< "Number of Units Per Detector: " << *numUnitsPerDetector << endl
|
||||
<< "Number of Images in Acquisition: " << *numImages << endl
|
||||
<< "Dynamic Range: " << *dynamicRange << endl
|
||||
<< "UDP Port number: " << *udpPortNumber << endl
|
||||
<< "Master File Name: " << masterFileName << endl
|
||||
<< "Current File Name: " << currentFileName << endl
|
||||
<< "Detector Index: " << *detIndex << std::endl
|
||||
<< "Number of Units Per Detector: " << *numUnitsPerDetector << std::endl
|
||||
<< "Number of Images in Acquisition: " << *numImages << std::endl
|
||||
<< "Dynamic Range: " << *dynamicRange << std::endl
|
||||
<< "UDP Port number: " << *udpPortNumber << std::endl
|
||||
<< "Master File Name: " << masterFileName << std::endl
|
||||
<< "Current File Name: " << currentFileName << std::endl
|
||||
<< "Silent Mode: " << *silentMode;
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,6 @@
|
||||
#include <iomanip>
|
||||
#include <libgen.h> //basename
|
||||
#include <string.h>
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
pthread_mutex_t HDF5File::Mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
@ -65,13 +63,13 @@ HDF5File::HDF5File(int ind, uint32_t* maxf,
|
||||
parameterNames.push_back("mod id");
|
||||
parameterDataTypes.push_back(PredType::STD_U16LE);
|
||||
|
||||
parameterNames.push_back("x Coord");
|
||||
parameterNames.push_back("row");
|
||||
parameterDataTypes.push_back(PredType::STD_U16LE);
|
||||
|
||||
parameterNames.push_back("y Coord");
|
||||
parameterNames.push_back("column");
|
||||
parameterDataTypes.push_back(PredType::STD_U16LE);
|
||||
|
||||
parameterNames.push_back("z Coord");
|
||||
parameterNames.push_back("reserved");
|
||||
parameterDataTypes.push_back(PredType::STD_U16LE);
|
||||
|
||||
parameterNames.push_back("debug");
|
||||
@ -298,7 +296,7 @@ void HDF5File::EndofAcquisition(bool anyPacketsCaught, uint64_t numf) {
|
||||
int HDF5File::CreateVirtualFile(uint64_t numf) {
|
||||
pthread_mutex_lock(&Mutex);
|
||||
|
||||
string vname = HDF5FileStatic::CreateVirtualFileName(filePath, fileNamePrefix, *fileIndex);
|
||||
std::string vname = HDF5FileStatic::CreateVirtualFileName(filePath, fileNamePrefix, *fileIndex);
|
||||
if(!(*silentMode)) {
|
||||
FILE_LOG(logINFO) << "Virtual File: " << vname;
|
||||
}
|
||||
@ -321,10 +319,10 @@ int HDF5File::CreateVirtualFile(uint64_t numf) {
|
||||
// called only by the one maser receiver
|
||||
int HDF5File::LinkVirtualFileinMasterFile() {
|
||||
//dataset name
|
||||
ostringstream osfn;
|
||||
std::ostringstream osfn;
|
||||
osfn << "/data";
|
||||
if ((*numImages > 1)) osfn << "_f" << setfill('0') << setw(12) << 0;
|
||||
string dsetname = osfn.str();
|
||||
if ((*numImages > 1)) osfn << "_f" << std::setfill('0') << std::setw(12) << 0;
|
||||
std::string dsetname = osfn.str();
|
||||
|
||||
pthread_mutex_lock(&Mutex);
|
||||
int ret = HDF5FileStatic::LinkVirtualInMaster(masterFileName, currentFileName,
|
||||
|
@ -14,9 +14,8 @@
|
||||
#include <iostream>
|
||||
#include <errno.h>
|
||||
#include <cstring>
|
||||
using namespace std;
|
||||
|
||||
const string Listener::TypeName = "Listener";
|
||||
const std::string Listener::TypeName = "Listener";
|
||||
|
||||
|
||||
Listener::Listener(int ind, detectorType dtype, Fifo*& f, runStatus* s,
|
||||
@ -41,8 +40,8 @@ Listener::Listener(int ind, detectorType dtype, Fifo*& f, runStatus* s,
|
||||
activated(act),
|
||||
deactivatedPaddingEnable(depaden),
|
||||
silentMode(sm),
|
||||
xcoord(0),
|
||||
ycoord(0),
|
||||
row(0),
|
||||
column(0),
|
||||
acquisitionStartedFlag(false),
|
||||
measurementStartedFlag(false),
|
||||
firstAcquisitionIndex(0),
|
||||
@ -74,7 +73,7 @@ Listener::~Listener() {
|
||||
}
|
||||
|
||||
/** getters */
|
||||
string Listener::GetType(){
|
||||
std::string Listener::GetType(){
|
||||
return TypeName;
|
||||
}
|
||||
|
||||
@ -289,9 +288,9 @@ int Listener::CreateDummySocketForUDPSocketBufferSize(uint32_t s) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
void Listener::SetHardCodedCoords(uint16_t x, uint16_t y) {
|
||||
xcoord = x;
|
||||
ycoord = y;
|
||||
void Listener::SetHardCodedPosition(uint16_t r, uint16_t c) {
|
||||
row = r;
|
||||
column = c;
|
||||
}
|
||||
|
||||
void Listener::ThreadExecution() {
|
||||
@ -406,8 +405,8 @@ uint32_t Listener::ListenToAnImage(char* buf) {
|
||||
++currentFrameIndex;
|
||||
}
|
||||
new_header->detHeader.frameNumber = currentFrameIndex;
|
||||
new_header->detHeader.xCoord = xcoord;
|
||||
new_header->detHeader.yCoord = ycoord;
|
||||
new_header->detHeader.row = row;
|
||||
new_header->detHeader.column = column;
|
||||
new_header->detHeader.detType = (uint8_t) generalData->myDetectorType;
|
||||
new_header->detHeader.version = (uint8_t) SLS_DETECTOR_HEADER_VERSION;
|
||||
return generalData->imageSize;
|
||||
@ -448,8 +447,8 @@ uint32_t Listener::ListenToAnImage(char* buf) {
|
||||
}
|
||||
new_header->detHeader.packetNumber = numpackets;
|
||||
if(isHeaderEmpty) {
|
||||
new_header->detHeader.xCoord = xcoord;
|
||||
new_header->detHeader.yCoord = ycoord;
|
||||
new_header->detHeader.row = row;
|
||||
new_header->detHeader.column = column;
|
||||
}
|
||||
return generalData->imageSize;
|
||||
}
|
||||
@ -488,8 +487,8 @@ uint32_t Listener::ListenToAnImage(char* buf) {
|
||||
// -------------------old header ------------------------------------------------------------------------------
|
||||
else {
|
||||
new_header->detHeader.frameNumber = fnum;
|
||||
new_header->detHeader.xCoord = xcoord;
|
||||
new_header->detHeader.yCoord = ycoord;
|
||||
new_header->detHeader.row = row;
|
||||
new_header->detHeader.column = column;
|
||||
new_header->detHeader.detType = (uint8_t) generalData->myDetectorType;
|
||||
new_header->detHeader.version = (uint8_t) SLS_DETECTOR_HEADER_VERSION;
|
||||
}
|
||||
@ -525,8 +524,8 @@ uint32_t Listener::ListenToAnImage(char* buf) {
|
||||
}
|
||||
new_header->detHeader.packetNumber = numpackets; //number of packets caught
|
||||
if(isHeaderEmpty) {
|
||||
new_header->detHeader.xCoord = xcoord;
|
||||
new_header->detHeader.yCoord = ycoord;
|
||||
new_header->detHeader.row = row;
|
||||
new_header->detHeader.column = column;
|
||||
}
|
||||
return generalData->imageSize; //empty packet now, but not empty image
|
||||
}
|
||||
@ -584,8 +583,8 @@ uint32_t Listener::ListenToAnImage(char* buf) {
|
||||
}
|
||||
new_header->detHeader.packetNumber = numpackets; //number of packets caught
|
||||
if(isHeaderEmpty) {
|
||||
new_header->detHeader.xCoord = xcoord;
|
||||
new_header->detHeader.yCoord = ycoord;
|
||||
new_header->detHeader.row = row;
|
||||
new_header->detHeader.column = column;
|
||||
}
|
||||
return generalData->imageSize;
|
||||
}
|
||||
@ -621,8 +620,8 @@ uint32_t Listener::ListenToAnImage(char* buf) {
|
||||
// -------------------old header ------------------------------------------------------------------------------
|
||||
else {
|
||||
new_header->detHeader.frameNumber = fnum;
|
||||
new_header->detHeader.xCoord = xcoord;
|
||||
new_header->detHeader.yCoord = ycoord;
|
||||
new_header->detHeader.row = row;
|
||||
new_header->detHeader.column = column;
|
||||
new_header->detHeader.detType = (uint8_t) generalData->myDetectorType;
|
||||
new_header->detHeader.version = (uint8_t) SLS_DETECTOR_HEADER_VERSION;
|
||||
}
|
||||
|
@ -7,13 +7,6 @@
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <syscall.h>
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include <sys/stat.h> // stat
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
@ -82,7 +81,7 @@ void UDPBaseImplementation::initializeMembers(){
|
||||
dataCompressionEnable = false;
|
||||
|
||||
//***acquisition parameters***
|
||||
shortFrameEnable = -1;
|
||||
roi.clear();
|
||||
frameToGuiFrequency = 0;
|
||||
frameToGuiTimerinMS = DEFAULT_STREAMING_TIMER_IN_MS;
|
||||
dataStreamEnable = false;
|
||||
@ -250,9 +249,9 @@ char *UDPBaseImplementation::getEthernetInterface() const{
|
||||
|
||||
|
||||
/***acquisition parameters***/
|
||||
int UDPBaseImplementation::getShortFrameEnable() const{
|
||||
std::vector<slsReceiverDefs::ROI> UDPBaseImplementation::getROI() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return shortFrameEnable;
|
||||
return roi;
|
||||
}
|
||||
|
||||
uint32_t UDPBaseImplementation::getFrameToGuiFrequency() const{
|
||||
@ -373,7 +372,7 @@ uint32_t UDPBaseImplementation::getActualUDPSocketBufferSize() const {
|
||||
*************************************************************************/
|
||||
|
||||
/**initial parameters***/
|
||||
void UDPBaseImplementation::configure(map<string, string> config_map){
|
||||
void UDPBaseImplementation::configure(std::map<std::string, std::string> config_map){
|
||||
FILE_LOG(logERROR) << __AT__ << " doing nothing...";
|
||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
||||
}
|
||||
@ -541,11 +540,27 @@ void UDPBaseImplementation::setEthernetInterface(const char* c){
|
||||
|
||||
|
||||
/***acquisition parameters***/
|
||||
int UDPBaseImplementation::setShortFrameEnable(const int i){
|
||||
int UDPBaseImplementation::setROI(const std::vector<slsReceiverDefs::ROI> i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
shortFrameEnable = i;
|
||||
FILE_LOG(logINFO) << "Short Frame Enable: " << stringEnable(shortFrameEnable);
|
||||
roi = i;
|
||||
|
||||
std::stringstream sstm;
|
||||
sstm << "ROI: ";
|
||||
if (!roi.size())
|
||||
sstm << "0";
|
||||
else {
|
||||
for (unsigned int i = 0; i < roi.size(); ++i) {
|
||||
sstm << "( " <<
|
||||
roi[i].xmin << ", " <<
|
||||
roi[i].xmax << ", " <<
|
||||
roi[i].ymin << ", " <<
|
||||
roi[i].ymax << " )";
|
||||
}
|
||||
}
|
||||
std::string message = sstm.str();
|
||||
FILE_LOG(logINFO) << message;
|
||||
|
||||
//overrridden child classes might return FAIL
|
||||
return OK;
|
||||
}
|
||||
|
@ -7,16 +7,14 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#include "UDPInterface.h"
|
||||
#include "UDPBaseImplementation.h"
|
||||
#include "UDPStandardImplementation.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
UDPInterface * UDPInterface::create(string receiver_type){
|
||||
UDPInterface * UDPInterface::create(std::string receiver_type){
|
||||
|
||||
if (receiver_type == "standard"){
|
||||
FILE_LOG(logINFO) << "Starting " << receiver_type;
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <cstring> //strcpy
|
||||
#include <errno.h> //eperm
|
||||
#include <fstream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
/** cosntructor & destructor */
|
||||
@ -33,16 +32,16 @@ UDPStandardImplementation::~UDPStandardImplementation() {
|
||||
|
||||
void UDPStandardImplementation::DeleteMembers() {
|
||||
if (generalData) { delete generalData; generalData=0;}
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
delete(*it);
|
||||
listener.clear();
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
delete(*it);
|
||||
dataProcessor.clear();
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
delete(*it);
|
||||
dataStreamer.clear();
|
||||
for (vector<Fifo*>::const_iterator it = fifo.begin(); it != fifo.end(); ++it)
|
||||
for (std::vector<Fifo*>::const_iterator it = fifo.begin(); it != fifo.end(); ++it)
|
||||
delete(*it);
|
||||
fifo.clear();
|
||||
}
|
||||
@ -69,8 +68,8 @@ uint64_t UDPStandardImplementation::getTotalFramesCaught() const {
|
||||
uint64_t sum = 0;
|
||||
uint32_t flagsum = 0;
|
||||
|
||||
vector<DataProcessor*>::const_iterator it;
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) {
|
||||
std::vector<DataProcessor*>::const_iterator it;
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) {
|
||||
flagsum += ((*it)->GetMeasurementStartedFlag() ? 1 : 0);
|
||||
sum += (*it)->GetNumTotalFramesCaught();
|
||||
}
|
||||
@ -85,7 +84,7 @@ uint64_t UDPStandardImplementation::getFramesCaught() const {
|
||||
uint64_t sum = 0;
|
||||
uint32_t flagsum = 0;
|
||||
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) {
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) {
|
||||
flagsum += ((*it)->GetAcquisitionStartedFlag() ? 1 : 0);
|
||||
sum += (*it)->GetNumFramesCaught();
|
||||
}
|
||||
@ -100,7 +99,7 @@ int64_t UDPStandardImplementation::getAcquisitionIndex() const {
|
||||
uint64_t sum = 0;
|
||||
uint32_t flagsum = 0;
|
||||
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it){
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it){
|
||||
flagsum += ((*it)->GetAcquisitionStartedFlag() ? 1 : 0);
|
||||
sum += (*it)->GetActualProcessedAcquisitionIndex();
|
||||
}
|
||||
@ -120,7 +119,7 @@ int UDPStandardImplementation::setGapPixelsEnable(const bool b) {
|
||||
// side effects
|
||||
generalData->SetGapPixelsEnable(b, dynamicRange);
|
||||
// to update npixelsx, npixelsy in file writer
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
(*it)->SetPixelDimension();
|
||||
|
||||
numberofJobs = -1; //changes to imagesize has to be noted to recreate fifo structure
|
||||
@ -144,7 +143,7 @@ void UDPStandardImplementation::setFileFormat(const fileFormat f){
|
||||
break;
|
||||
}
|
||||
//destroy file writer, set file format and create file writer
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
(*it)->SetFileFormat(f);
|
||||
|
||||
FILE_LOG(logINFO) << "File Format:" << getFileFormatType(fileFormatType);
|
||||
@ -168,35 +167,64 @@ void UDPStandardImplementation::setFileWriteEnable(const bool b){
|
||||
|
||||
|
||||
|
||||
int UDPStandardImplementation::setShortFrameEnable(const int i) {
|
||||
int UDPStandardImplementation::setROI(const std::vector<slsReceiverDefs::ROI> i) {
|
||||
if (myDetectorType != GOTTHARD) {
|
||||
cprintf(RED, "Error: Can not set short frame for this detector\n");
|
||||
cprintf(RED, "Error: Can not set ROI for this detector\n");
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
if (shortFrameEnable != i) {
|
||||
shortFrameEnable = i;
|
||||
|
||||
if (generalData)
|
||||
delete generalData;
|
||||
if (i != -1)
|
||||
generalData = new ShortGotthardData();
|
||||
else
|
||||
generalData = new GotthardData();
|
||||
bool change = false;
|
||||
if (roi.size() != i.size())
|
||||
change = true;
|
||||
else {
|
||||
for (unsigned int iloop = 0; iloop < i.size(); ++iloop) {
|
||||
if (
|
||||
(roi[iloop].xmin != i[iloop].xmin) ||
|
||||
(roi[iloop].xmax != i[iloop].xmax) ||
|
||||
(roi[iloop].ymin != i[iloop].ymin) ||
|
||||
(roi[iloop].xmax != i[iloop].xmax)) {
|
||||
change = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (change) {
|
||||
|
||||
roi = i;
|
||||
|
||||
generalData->SetROI(i);
|
||||
framesPerFile = generalData->maxFramesPerFile;
|
||||
|
||||
numberofJobs = -1; //changes to imagesize has to be noted to recreate fifo structure
|
||||
if (SetupFifoStructure() == FAIL)
|
||||
return FAIL;
|
||||
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
(*it)->SetGeneralData(generalData);
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
(*it)->SetGeneralData(generalData);
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
(*it)->SetGeneralData(generalData);
|
||||
}
|
||||
FILE_LOG(logINFO) << "Short Frame Enable: " << shortFrameEnable;
|
||||
|
||||
|
||||
std::stringstream sstm;
|
||||
sstm << "ROI: ";
|
||||
if (!roi.size())
|
||||
sstm << "0";
|
||||
else {
|
||||
for (unsigned int i = 0; i < roi.size(); ++i) {
|
||||
sstm << "( " <<
|
||||
roi[i].xmin << ", " <<
|
||||
roi[i].xmax << ", " <<
|
||||
roi[i].ymin << ", " <<
|
||||
roi[i].ymax << " )";
|
||||
}
|
||||
}
|
||||
std::string message = sstm.str();
|
||||
FILE_LOG(logINFO) << message;
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -216,7 +244,7 @@ int UDPStandardImplementation::setDataStreamEnable(const bool enable) {
|
||||
dataStreamEnable = enable;
|
||||
|
||||
//data sockets have to be created again as the client ones are
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
delete(*it);
|
||||
dataStreamer.clear();
|
||||
|
||||
@ -224,13 +252,13 @@ int UDPStandardImplementation::setDataStreamEnable(const bool enable) {
|
||||
for ( int i = 0; i < numThreads; ++i ) {
|
||||
try {
|
||||
DataStreamer* s = new DataStreamer(i, fifo[i], &dynamicRange,
|
||||
&shortFrameEnable, &fileIndex, flippedData, additionalJsonHeader, &silentMode);
|
||||
&roi, &fileIndex, flippedData, additionalJsonHeader, &silentMode);
|
||||
dataStreamer.push_back(s);
|
||||
dataStreamer[i]->SetGeneralData(generalData);
|
||||
dataStreamer[i]->CreateZmqSockets(&numThreads, streamingPort, streamingSrcIP);
|
||||
}
|
||||
catch(...) {
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
delete(*it);
|
||||
dataStreamer.clear();
|
||||
dataStreamEnable = false;
|
||||
@ -269,7 +297,7 @@ int UDPStandardImplementation::setDynamicRange(const uint32_t i) {
|
||||
generalData->SetDynamicRange(i,tengigaEnable);
|
||||
generalData->SetGapPixelsEnable(gapPixelsEnable, dynamicRange);
|
||||
// to update npixelsx, npixelsy in file writer
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
(*it)->SetPixelDimension();
|
||||
|
||||
numberofJobs = -1; //changes to imagesize has to be noted to recreate fifo structure
|
||||
@ -374,10 +402,10 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) {
|
||||
}
|
||||
catch (...) {
|
||||
FILE_LOG(logERROR) << "Could not create listener/dataprocessor threads (index:" << i << ")";
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
delete(*it);
|
||||
listener.clear();
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
delete(*it);
|
||||
dataProcessor.clear();
|
||||
return FAIL;
|
||||
@ -385,9 +413,9 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) {
|
||||
}
|
||||
|
||||
//set up writer and callbacks
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
(*it)->SetGeneralData(generalData);
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
(*it)->SetGeneralData(generalData);
|
||||
|
||||
SetThreadPriorities();
|
||||
@ -413,27 +441,22 @@ void UDPStandardImplementation::setDetectorPositionId(const int i){
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < listener.size(); ++i) {
|
||||
uint16_t x = 0, y = 0;
|
||||
if (myDetectorType == EIGER || myDetectorType == JUNGFRAU) {
|
||||
x = detID % numDet[1]; // row
|
||||
y = (detID / numDet[1]) * ((myDetectorType == EIGER) ? 2 : 1) + i; // col for horiz. udp ports
|
||||
}
|
||||
// calculate x in 1d
|
||||
else
|
||||
x = detID * numThreads + i;
|
||||
listener[i]->SetHardCodedCoords(x,y);
|
||||
uint16_t row = 0, col = 0;
|
||||
row = detID % numDet[1]; // row
|
||||
col = (detID / numDet[1]) * ((myDetectorType == EIGER) ? 2 : 1) + i; // col for horiz. udp ports
|
||||
listener[i]->SetHardCodedPosition(row, col);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void UDPStandardImplementation::resetAcquisitionCount() {
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
(*it)->ResetParametersforNewAcquisition();
|
||||
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
(*it)->ResetParametersforNewAcquisition();
|
||||
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
(*it)->ResetParametersforNewAcquisition();
|
||||
|
||||
FILE_LOG(logINFO) << "Acquisition Count has been reset";
|
||||
@ -444,7 +467,6 @@ void UDPStandardImplementation::resetAcquisitionCount() {
|
||||
int UDPStandardImplementation::startReceiver(char *c) {
|
||||
cprintf(RESET,"\n");
|
||||
FILE_LOG(logINFO) << "Starting Receiver";
|
||||
|
||||
ResetParametersforNewMeasurement();
|
||||
|
||||
//listener
|
||||
@ -498,10 +520,10 @@ void UDPStandardImplementation::stopReceiver(){
|
||||
bool running = true;
|
||||
while(running) {
|
||||
running = false;
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
if ((*it)->IsRunning())
|
||||
running = true;
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
if ((*it)->IsRunning())
|
||||
running = true;
|
||||
usleep(5000);
|
||||
@ -512,8 +534,8 @@ void UDPStandardImplementation::stopReceiver(){
|
||||
if (fileWriteEnable && fileFormatType == HDF5) {
|
||||
uint64_t maxIndexCaught = 0;
|
||||
bool anycaught = false;
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) {
|
||||
maxIndexCaught = max(maxIndexCaught, (*it)->GetProcessedMeasurementIndex());
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) {
|
||||
maxIndexCaught = std::max(maxIndexCaught, (*it)->GetProcessedMeasurementIndex());
|
||||
if((*it)->GetMeasurementStartedFlag())
|
||||
anycaught = true;
|
||||
}
|
||||
@ -525,7 +547,7 @@ void UDPStandardImplementation::stopReceiver(){
|
||||
running = true;
|
||||
while(running) {
|
||||
running = false;
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
if ((*it)->IsRunning())
|
||||
running = true;
|
||||
usleep(5000);
|
||||
@ -575,7 +597,7 @@ void UDPStandardImplementation::startReadout(){
|
||||
// wait for incoming delayed packets
|
||||
//current packets caught
|
||||
volatile int totalP = 0,prev=-1;
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
totalP += (*it)->GetPacketsCaught();
|
||||
|
||||
//wait for all packets
|
||||
@ -594,7 +616,7 @@ void UDPStandardImplementation::startReadout(){
|
||||
prev = totalP;
|
||||
totalP = 0;
|
||||
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
totalP += (*it)->GetPacketsCaught();
|
||||
#ifdef VERY_VERBOSE
|
||||
cprintf(MAGENTA,"\tupdated: totalP:%d\n",totalP);
|
||||
@ -613,7 +635,7 @@ void UDPStandardImplementation::startReadout(){
|
||||
|
||||
|
||||
void UDPStandardImplementation::shutDownUDPSockets() {
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
(*it)->ShutDownUDPSocket();
|
||||
}
|
||||
|
||||
@ -622,9 +644,9 @@ void UDPStandardImplementation::shutDownUDPSockets() {
|
||||
void UDPStandardImplementation::closeFiles() {
|
||||
uint64_t maxIndexCaught = 0;
|
||||
bool anycaught = false;
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) {
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) {
|
||||
(*it)->CloseFiles();
|
||||
maxIndexCaught = max(maxIndexCaught, (*it)->GetProcessedMeasurementIndex());
|
||||
maxIndexCaught = std::max(maxIndexCaught, (*it)->GetProcessedMeasurementIndex());
|
||||
if((*it)->GetMeasurementStartedFlag())
|
||||
anycaught = true;
|
||||
}
|
||||
@ -640,7 +662,7 @@ int UDPStandardImplementation::setUDPSocketBufferSize(const uint32_t s) {
|
||||
|
||||
int UDPStandardImplementation::restreamStop() {
|
||||
bool ret = OK;
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it) {
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it) {
|
||||
if ((*it)->RestreamStop() == FAIL)
|
||||
ret = FAIL;
|
||||
}
|
||||
@ -660,14 +682,14 @@ void UDPStandardImplementation::SetLocalNetworkParameters() {
|
||||
int max_back_log;
|
||||
const char *proc_file_name = "/proc/sys/net/core/netdev_max_backlog";
|
||||
{
|
||||
ifstream proc_file(proc_file_name);
|
||||
std::ifstream proc_file(proc_file_name);
|
||||
proc_file >> max_back_log;
|
||||
}
|
||||
|
||||
if (max_back_log < MAX_SOCKET_INPUT_PACKET_QUEUE) {
|
||||
ofstream proc_file(proc_file_name);
|
||||
std::ofstream proc_file(proc_file_name);
|
||||
if (proc_file.good()) {
|
||||
proc_file << MAX_SOCKET_INPUT_PACKET_QUEUE << endl;
|
||||
proc_file << MAX_SOCKET_INPUT_PACKET_QUEUE << std::endl;
|
||||
cprintf(GREEN, "Max length of input packet queue "
|
||||
"[/proc/sys/net/core/netdev_max_backlog] modified to %d\n",
|
||||
MAX_SOCKET_INPUT_PACKET_QUEUE);
|
||||
@ -683,13 +705,13 @@ void UDPStandardImplementation::SetLocalNetworkParameters() {
|
||||
|
||||
void UDPStandardImplementation::SetThreadPriorities() {
|
||||
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it){
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it){
|
||||
if ((*it)->SetThreadPriority(LISTENER_PRIORITY) == FAIL) {
|
||||
FILE_LOG(logWARNING) << "Could not prioritize listener threads. (No Root Privileges?)";
|
||||
return;
|
||||
}
|
||||
}
|
||||
ostringstream osfn;
|
||||
std::ostringstream osfn;
|
||||
osfn << "Priorities set - "
|
||||
"Listener:" << LISTENER_PRIORITY;
|
||||
|
||||
@ -701,10 +723,10 @@ int UDPStandardImplementation::SetupFifoStructure() {
|
||||
numberofJobs = 1;
|
||||
|
||||
|
||||
for (vector<Fifo*>::const_iterator it = fifo.begin(); it != fifo.end(); ++it)
|
||||
for (std::vector<Fifo*>::const_iterator it = fifo.begin(); it != fifo.end(); ++it)
|
||||
delete(*it);
|
||||
fifo.clear();
|
||||
for ( int i = 0; i < numThreads; i++ ) {
|
||||
for ( int i = 0; i < numThreads; ++i ) {
|
||||
|
||||
//create fifo structure
|
||||
try {
|
||||
@ -714,7 +736,7 @@ int UDPStandardImplementation::SetupFifoStructure() {
|
||||
fifo.push_back(f);
|
||||
} catch (...) {
|
||||
cprintf(RED,"Error: Could not allocate memory for fifo structure of index %d\n", i);
|
||||
for (vector<Fifo*>::const_iterator it = fifo.begin(); it != fifo.end(); ++it)
|
||||
for (std::vector<Fifo*>::const_iterator it = fifo.begin(); it != fifo.end(); ++it)
|
||||
delete(*it);
|
||||
fifo.clear();
|
||||
return FAIL;
|
||||
@ -733,15 +755,15 @@ int UDPStandardImplementation::SetupFifoStructure() {
|
||||
|
||||
|
||||
void UDPStandardImplementation::ResetParametersforNewMeasurement() {
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
(*it)->ResetParametersforNewMeasurement();
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
(*it)->ResetParametersforNewMeasurement();
|
||||
|
||||
if (dataStreamEnable) {
|
||||
char fnametostream[MAX_STR_LENGTH];
|
||||
snprintf(fnametostream, MAX_STR_LENGTH, "%s/%s", filePath, fileName);
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
(*it)->ResetParametersforNewMeasurement(fnametostream);
|
||||
}
|
||||
}
|
||||
@ -785,15 +807,15 @@ int UDPStandardImplementation::SetupWriter() {
|
||||
|
||||
void UDPStandardImplementation::StartRunning() {
|
||||
//set running mask and post semaphore to start the inner loop in execution thread
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it) {
|
||||
for (std::vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it) {
|
||||
(*it)->StartRunning();
|
||||
(*it)->Continue();
|
||||
}
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it){
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it){
|
||||
(*it)->StartRunning();
|
||||
(*it)->Continue();
|
||||
}
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it){
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it){
|
||||
(*it)->StartRunning();
|
||||
(*it)->Continue();
|
||||
}
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <sys/wait.h> //wait
|
||||
#include <unistd.h> //usleep
|
||||
#include <syscall.h>
|
||||
using namespace std;
|
||||
|
||||
|
||||
bool keeprunning;
|
||||
@ -44,18 +43,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"
|
||||
"xCrow%u\t\tcolumn: %u\t\tcolumn: %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, detectorHeader.frameNumber,
|
||||
detectorHeader.row, detectorHeader.frameNumber,
|
||||
detectorHeader.expLength, detectorHeader.packetNumber, detectorHeader.bunchId,
|
||||
detectorHeader.timestamp, detectorHeader.modId,
|
||||
detectorHeader.xCoord, detectorHeader.yCoord, detectorHeader.zCoord,
|
||||
detectorHeader.row, detectorHeader.column, detectorHeader.column,
|
||||
detectorHeader.debug, detectorHeader.roundRNumber,
|
||||
detectorHeader.detType, detectorHeader.version,
|
||||
//header->packetsMask.to_string().c_str(),
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "slsReceiver.h"
|
||||
#include "gitInfoReceiver.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
@ -22,9 +21,9 @@ slsReceiver::slsReceiver(int argc, char *argv[]):
|
||||
tcpipInterface (0) {
|
||||
|
||||
// options
|
||||
map<string, string> configuration_map;
|
||||
std::map<std::string, std::string> configuration_map;
|
||||
int tcpip_port_no = 1954;
|
||||
string fname = "";
|
||||
std::string fname = "";
|
||||
int64_t tempval = 0;
|
||||
|
||||
//parse command line for config
|
||||
@ -68,28 +67,28 @@ slsReceiver::slsReceiver(int argc, char *argv[]):
|
||||
case 'v':
|
||||
tempval = GITREV;
|
||||
tempval = (tempval <<32) | GITDATE;
|
||||
cout << "SLS Receiver " << GITBRANCH << " (0x" << hex << tempval << ")" << endl;
|
||||
throw exception();
|
||||
std::cout << "SLS Receiver " << GITBRANCH << " (0x" << std::hex << tempval << ")" << std::endl;
|
||||
throw std::exception();
|
||||
|
||||
case 'h':
|
||||
default:
|
||||
string help_message = "\n"
|
||||
+ string(argv[0]) + "\n"
|
||||
+ "Usage: " + string(argv[0]) + " [arguments]\n"
|
||||
std::string help_message = "\n"
|
||||
+ std::string(argv[0]) + "\n"
|
||||
+ "Usage: " + std::string(argv[0]) + " [arguments]\n"
|
||||
+ "Possible arguments are:\n"
|
||||
+ "\t-f, --config <fname> : Loads config from file\n"
|
||||
+ "\t-t, --rx_tcpport <port> : TCP Communication Port with client. \n"
|
||||
+ "\t Default: 1954. Required for multiple \n"
|
||||
+ "\t receivers\n\n";
|
||||
|
||||
FILE_LOG(logINFO) << help_message << endl;
|
||||
throw exception();
|
||||
FILE_LOG(logINFO) << help_message << std::endl;
|
||||
throw std::exception();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if( !fname.empty() && read_config_file(fname, &tcpip_port_no, &configuration_map) == FAIL) {
|
||||
throw exception();
|
||||
throw std::exception();
|
||||
}
|
||||
|
||||
// might throw an exception
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <fstream>
|
||||
#include <stdlib.h>
|
||||
#include <syscall.h>
|
||||
using namespace std;
|
||||
#include <vector>
|
||||
|
||||
|
||||
|
||||
@ -140,7 +140,7 @@ void* slsReceiverTCPIPInterface::startTCPServerThread(void *this_pointer){
|
||||
|
||||
void slsReceiverTCPIPInterface::startTCPServer(){
|
||||
cprintf(BLUE,"Created [ TCP server Tid: %ld ]\n", (long)syscall(SYS_gettid));
|
||||
FILE_LOG(logINFO) << "SLS Receiver starting TCP Server on port " << portNumber << endl;
|
||||
FILE_LOG(logINFO) << "SLS Receiver starting TCP Server on port " << portNumber << std::endl;
|
||||
|
||||
#ifdef VERYVERBOSE
|
||||
FILE_LOG(logDEBUG5) << "Starting Receiver TCP Server";
|
||||
@ -206,7 +206,7 @@ const char* slsReceiverTCPIPInterface::getFunctionName(enum recFuncs func) {
|
||||
case F_GET_RECEIVER_ID: return "F_GET_RECEIVER_ID";
|
||||
case F_GET_RECEIVER_TYPE: return "F_GET_RECEIVER_TYPE";
|
||||
case F_SEND_RECEIVER_DETHOSTNAME: return "F_SEND_RECEIVER_DETHOSTNAME";
|
||||
case F_RECEIVER_SHORT_FRAME: return "F_RECEIVER_SHORT_FRAME";
|
||||
case F_RECEIVER_SET_ROI: return "F_RECEIVER_SET_ROI";
|
||||
case F_SETUP_RECEIVER_UDP: return "F_SETUP_RECEIVER_UDP";
|
||||
case F_SET_RECEIVER_TIMER: return "F_SET_RECEIVER_TIMER";
|
||||
case F_SET_RECEIVER_DYNAMIC_RANGE: return "F_SET_RECEIVER_DYNAMIC_RANGE";
|
||||
@ -263,7 +263,7 @@ int slsReceiverTCPIPInterface::function_table(){
|
||||
flist[F_GET_RECEIVER_ID] = &slsReceiverTCPIPInterface::get_id;
|
||||
flist[F_GET_RECEIVER_TYPE] = &slsReceiverTCPIPInterface::set_detector_type;
|
||||
flist[F_SEND_RECEIVER_DETHOSTNAME] = &slsReceiverTCPIPInterface::set_detector_hostname;
|
||||
flist[F_RECEIVER_SHORT_FRAME] = &slsReceiverTCPIPInterface::set_short_frame;
|
||||
flist[F_RECEIVER_SET_ROI] = &slsReceiverTCPIPInterface::set_roi;
|
||||
flist[F_SETUP_RECEIVER_UDP] = &slsReceiverTCPIPInterface::setup_udp;
|
||||
flist[F_SET_RECEIVER_TIMER] = &slsReceiverTCPIPInterface::set_timer;
|
||||
flist[F_SET_RECEIVER_DYNAMIC_RANGE] = &slsReceiverTCPIPInterface::set_dynamic_range;
|
||||
@ -535,7 +535,7 @@ int slsReceiverTCPIPInterface::set_port() {
|
||||
sprintf(mess,"Port Number (%d) too low\n", p_number);
|
||||
FILE_LOG(logERROR) << mess;
|
||||
} else {
|
||||
FILE_LOG(logINFO) << "set port to " << p_number <<endl;
|
||||
FILE_LOG(logINFO) << "set port to " << p_number <<std::endl;
|
||||
strcpy(oldLastClientIP, mySock->lastClientIP);
|
||||
|
||||
try {
|
||||
@ -879,16 +879,24 @@ int slsReceiverTCPIPInterface::set_detector_hostname() {
|
||||
|
||||
|
||||
|
||||
int slsReceiverTCPIPInterface::set_short_frame() {
|
||||
int slsReceiverTCPIPInterface::set_roi() {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int index = 0;
|
||||
int retval = -100;
|
||||
int nroi = 0;
|
||||
|
||||
// receive arguments
|
||||
if (mySock->ReceiveDataOnly(&index,sizeof(index)) < 0 )
|
||||
if (mySock->ReceiveDataOnly(&nroi,sizeof(nroi)) < 0 )
|
||||
return printSocketReadError();
|
||||
|
||||
std::vector <ROI> roiLimits;
|
||||
int iloop = 0;
|
||||
for (iloop = 0; iloop < nroi; iloop++) {
|
||||
ROI temp;
|
||||
if ( mySock->ReceiveDataOnly(&temp,sizeof(ROI)) < 0 )
|
||||
return printSocketReadError();
|
||||
roiLimits.push_back(temp);
|
||||
}
|
||||
|
||||
//does not exist
|
||||
if (myDetectorType != GOTTHARD)
|
||||
functionNotImplemented();
|
||||
@ -904,8 +912,8 @@ int slsReceiverTCPIPInterface::set_short_frame() {
|
||||
else if (receiverBase->getStatus() != IDLE)
|
||||
receiverNotIdle();
|
||||
else {
|
||||
receiverBase->setShortFrameEnable(index);
|
||||
retval = receiverBase->getShortFrameEnable();
|
||||
ret = receiverBase->setROI(roiLimits);
|
||||
//retval = receiverBase->getROI();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -916,7 +924,8 @@ int slsReceiverTCPIPInterface::set_short_frame() {
|
||||
mySock->SendDataOnly(&ret,sizeof(ret));
|
||||
if (ret == FAIL)
|
||||
mySock->SendDataOnly(mess,sizeof(mess));
|
||||
mySock->SendDataOnly(&retval,sizeof(retval));
|
||||
|
||||
roiLimits.clear();
|
||||
|
||||
// return ok/fail
|
||||
return ret;
|
||||
@ -957,7 +966,7 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
||||
//setup udpip
|
||||
//get ethernet interface or IP to listen to
|
||||
FILE_LOG(logINFO) << "Receiver UDP IP: " << args[0];
|
||||
string temp = genericSocket::ipToName(args[0]);
|
||||
std::string temp = genericSocket::ipToName(args[0]);
|
||||
if (temp == "none"){
|
||||
ret = FAIL;
|
||||
strcpy(mess, "Failed to get ethernet interface or IP\n");
|
||||
|
@ -11,20 +11,19 @@
|
||||
#include "logger.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
int read_config_file(string fname, int *tcpip_port_no, map<string, string> * configuration_map ){
|
||||
int read_config_file(std::string fname, int *tcpip_port_no, std::map<std::string, std::string> * configuration_map ){
|
||||
|
||||
ifstream infile;
|
||||
string sLine,sargname, sargvalue;
|
||||
std::ifstream infile;
|
||||
std::string sLine,sargname, sargvalue;
|
||||
int iline = 0;
|
||||
int success = slsReceiverDefs::OK;
|
||||
|
||||
|
||||
FILE_LOG(logINFO) << "config file name " << fname;
|
||||
try {
|
||||
infile.open(fname.c_str(), ios_base::in);
|
||||
infile.open(fname.c_str(), std::ios_base::in);
|
||||
} catch(...) {
|
||||
FILE_LOG(logERROR) << "Could not open configuration file " << fname ;
|
||||
success = slsReceiverDefs::FAIL;
|
||||
@ -37,14 +36,14 @@ int read_config_file(string fname, int *tcpip_port_no, map<string, string> * con
|
||||
|
||||
//VERBOSE_PRINT(sLine);
|
||||
|
||||
if(sLine.find('#') != string::npos)
|
||||
if(sLine.find('#') != std::string::npos)
|
||||
continue;
|
||||
|
||||
else if(sLine.length()<2)
|
||||
continue;
|
||||
|
||||
else{
|
||||
istringstream sstr(sLine);
|
||||
std::istringstream sstr(sLine);
|
||||
|
||||
//parameter name
|
||||
if(sstr.good()){
|
||||
|
Loading…
x
Reference in New Issue
Block a user