mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-17 15:27:13 +02:00
Compare commits
20 Commits
2022.06.07
...
g2rxrgui
Author | SHA1 | Date | |
---|---|---|---|
6964be2aeb | |||
32e3457e84 | |||
aa93aed4ed | |||
97a2a3d7c1 | |||
5490daa0a1 | |||
37a8c61124 | |||
8ca8185d41 | |||
421c2c161a | |||
89aa0760c6 | |||
3cee36a3db | |||
59eea1a1fd | |||
2b5470ef59 | |||
b5d02ac398 | |||
364e0c6268 | |||
728cb35c37 | |||
7536c16a48 | |||
4fe520fdaf | |||
1cfebf667b | |||
23e4dde063 | |||
12c2609978 |
@ -79,6 +79,11 @@ This document describes the differences between v7.0.0 and v6.x.x
|
|||||||
- g2 and m3 clkdiv 2 (system clock) change should affect time settings (g2: exptime, period, delayaftertrigger, burstperiod, m3: exptime, gatedelay, gateperiod, period, delayaftertrigger)
|
- g2 and m3 clkdiv 2 (system clock) change should affect time settings (g2: exptime, period, delayaftertrigger, burstperiod, m3: exptime, gatedelay, gateperiod, period, delayaftertrigger)
|
||||||
- g2 system frequency is the same irrespective of timing source
|
- g2 system frequency is the same irrespective of timing source
|
||||||
- (apparently) rxr doesnt get stuck anymore from 6.1.1
|
- (apparently) rxr doesnt get stuck anymore from 6.1.1
|
||||||
|
-rx_bunchsize, (default fifodepth for g2 changed to 50)
|
||||||
|
- rxr mem size changed (fifo header size from 8 to 16) due to sls rxr header = 112.. 112+ 16=128 (reduces packet losss especially for g2)
|
||||||
|
-udp_srcip and udp_Srcip2: can set to auto (for virtual or 1g data networks)
|
||||||
|
- set dataset name for all hdf5 files to "data" only
|
||||||
|
- number of storage cells is not updated in teh receiver. done. and also allowing it to be modified in running status
|
||||||
|
|
||||||
2. Resolved Issues
|
2. Resolved Issues
|
||||||
==================
|
==================
|
||||||
|
@ -32,17 +32,29 @@
|
|||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0">
|
<item row="1" column="0" colspan="3">
|
||||||
<widget class="QLabel" name="lblReadout">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>5</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="currentIndex">
|
||||||
<string>Readout: </string>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
|
<widget class="QWidget" name="tabDAC">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>DACs</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QGridLayout" name="gridlayoutDac"/>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tabADC">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>ADCs</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QGridLayout" name="gridlayoutAdc"/>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
@ -77,145 +89,19 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="lblComboHV">
|
<widget class="QLabel" name="lblReadout">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>High Voltage</p><p> #highvoltage#</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>High Voltage: </string>
|
<string>Readout: </string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QComboBox" name="comboHV">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>28</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>High Voltage</p><p> #highvoltage#</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>0</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>90</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>110</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>120</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>150</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>180</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>200</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="lblSpinHV">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.</p><p>-1 corresponds to different values from detectors.</p><p>#highvoltage#</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>High Voltage: </string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QSpinBox" name="spinHV">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>28</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p>High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.</p><p>-1 corresponds to different values from detectors.</p><p>#highvoltage#</p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="keyboardTracking">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<number>-1</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>200</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0" colspan="3">
|
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>5</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="tabDAC">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>DACs</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QGridLayout" name="gridlayoutDac"/>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="tabADC">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>ADCs</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QGridLayout" name="gridlayoutAdc"/>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>775</width>
|
<width>775</width>
|
||||||
<height>385</height>
|
<height>400</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -32,7 +32,77 @@
|
|||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item row="2" column="0">
|
<item row="0" column="2" colspan="5">
|
||||||
|
<widget class="QComboBox" name="comboHV">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>140</width>
|
||||||
|
<height>28</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>High Voltage</p><p> #highvoltage#</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>0</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>90</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>110</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>120</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>150</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>180</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>200</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="lblComboHV">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>High Voltage</p><p> #highvoltage#</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>High Voltage: </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="lblThreshold">
|
<widget class="QLabel" name="lblThreshold">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -54,7 +124,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="4">
|
<item row="6" column="4">
|
||||||
<widget class="QCheckBox" name="chkCounter3">
|
<widget class="QCheckBox" name="chkCounter3">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -73,7 +143,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="14">
|
<item row="4" column="14">
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
@ -89,7 +159,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="lblSettings">
|
<widget class="QLabel" name="lblSettings">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -111,7 +181,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="2">
|
<item row="6" column="2">
|
||||||
<widget class="QCheckBox" name="chkCounter1">
|
<widget class="QCheckBox" name="chkCounter1">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -130,7 +200,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2" colspan="9">
|
<item row="2" column="2" colspan="9">
|
||||||
<widget class="QComboBox" name="comboSettings">
|
<widget class="QComboBox" name="comboSettings">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -144,7 +214,7 @@
|
|||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>140</width>
|
<width>140</width>
|
||||||
<height>25</height>
|
<height>28</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
@ -269,7 +339,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="11">
|
<item row="4" column="11">
|
||||||
<widget class="QSpinBox" name="spinThreshold2">
|
<widget class="QSpinBox" name="spinThreshold2">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -306,7 +376,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="13">
|
<item row="4" column="13">
|
||||||
<widget class="QPushButton" name="btnSetThreshold">
|
<widget class="QPushButton" name="btnSetThreshold">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -381,7 +451,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="2" column="1">
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
@ -397,7 +467,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="12">
|
<item row="4" column="12">
|
||||||
<widget class="QSpinBox" name="spinThreshold3">
|
<widget class="QSpinBox" name="spinThreshold3">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -434,7 +504,23 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="2" colspan="9">
|
<item row="7" column="2">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>190</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="2" colspan="9">
|
||||||
<widget class="QSpinBox" name="spinThreshold">
|
<widget class="QSpinBox" name="spinThreshold">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -471,7 +557,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="6" column="0">
|
||||||
<widget class="QLabel" name="lblCounter">
|
<widget class="QLabel" name="lblCounter">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -493,7 +579,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QLabel" name="lblDynamicRange">
|
<widget class="QLabel" name="lblDynamicRange">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -515,23 +601,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="2">
|
<item row="3" column="0">
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>190</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="lblGainMode">
|
<widget class="QLabel" name="lblGainMode">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -553,7 +623,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="2" colspan="9">
|
<item row="5" column="2" colspan="9">
|
||||||
<widget class="QComboBox" name="comboDynamicRange">
|
<widget class="QComboBox" name="comboDynamicRange">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -561,7 +631,7 @@
|
|||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>140</width>
|
<width>140</width>
|
||||||
<height>25</height>
|
<height>28</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
@ -597,7 +667,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="3">
|
<item row="6" column="3">
|
||||||
<widget class="QCheckBox" name="chkCounter2">
|
<widget class="QCheckBox" name="chkCounter2">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -616,7 +686,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2" colspan="9">
|
<item row="3" column="2" colspan="9">
|
||||||
<widget class="QComboBox" name="comboGainMode">
|
<widget class="QComboBox" name="comboGainMode">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -630,7 +700,7 @@
|
|||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>140</width>
|
<width>140</width>
|
||||||
<height>25</height>
|
<height>28</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
@ -674,6 +744,50 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="lblSpinHV">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.</p><p>-1 corresponds to different values from detectors.</p><p>#highvoltage#</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>High Voltage: </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2" colspan="5">
|
||||||
|
<widget class="QSpinBox" name="spinHV">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>140</width>
|
||||||
|
<height>28</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.</p><p>-1 corresponds to different values from detectors.</p><p>#highvoltage#</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="keyboardTracking">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>-1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>200</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
|
@ -20,25 +20,16 @@ class qTabDeveloper : public QWidget, private Ui::TabDeveloperObject {
|
|||||||
public slots:
|
public slots:
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
|
||||||
private slots:
|
|
||||||
void SetHighVoltage();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetupWidgetWindow();
|
void SetupWidgetWindow();
|
||||||
void Initialization();
|
void Initialization();
|
||||||
void PopulateDetectors();
|
void PopulateDetectors();
|
||||||
void GetHighVoltage();
|
|
||||||
slsDetectorDefs::dacIndex getSLSIndex(slsDetectorDefs::detectorType detType,
|
slsDetectorDefs::dacIndex getSLSIndex(slsDetectorDefs::detectorType detType,
|
||||||
int index);
|
int index);
|
||||||
|
|
||||||
Detector *det;
|
Detector *det;
|
||||||
std::vector<qDacWidget *> dacWidgets;
|
std::vector<qDacWidget *> dacWidgets;
|
||||||
std::vector<qDacWidget *> adcWidgets;
|
std::vector<qDacWidget *> adcWidgets;
|
||||||
|
|
||||||
enum hvVals { HV_0, HV_90, HV_110, HV_120, HV_150, HV_180, HV_200 };
|
|
||||||
int hvmin;
|
|
||||||
static const int HV_MIN = 60;
|
|
||||||
static const int HV_MAX = 200;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sls
|
} // namespace sls
|
||||||
|
@ -18,6 +18,7 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
|||||||
void SetExportMode(bool exportMode);
|
void SetExportMode(bool exportMode);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void SetHighVoltage();
|
||||||
void SetSettings(int index);
|
void SetSettings(int index);
|
||||||
void SetGainMode(int index);
|
void SetGainMode(int index);
|
||||||
void SetDynamicRange(int index);
|
void SetDynamicRange(int index);
|
||||||
@ -32,6 +33,7 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
|||||||
void ShowFixG0(bool expertMode);
|
void ShowFixG0(bool expertMode);
|
||||||
void Initialization();
|
void Initialization();
|
||||||
|
|
||||||
|
void GetHighVoltage();
|
||||||
void GetSettings();
|
void GetSettings();
|
||||||
void GetGainMode();
|
void GetGainMode();
|
||||||
void GetDynamicRange();
|
void GetDynamicRange();
|
||||||
@ -42,6 +44,12 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
|||||||
Detector *det;
|
Detector *det;
|
||||||
std::vector<QCheckBox *> counters;
|
std::vector<QCheckBox *> counters;
|
||||||
|
|
||||||
|
enum hvVals { HV_0, HV_90, HV_110, HV_120, HV_150, HV_180, HV_200 };
|
||||||
|
|
||||||
|
int hvmin;
|
||||||
|
static const int HV_MIN = 60;
|
||||||
|
static const int HV_MAX = 200;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
STANDARD,
|
STANDARD,
|
||||||
FAST,
|
FAST,
|
||||||
|
@ -18,12 +18,6 @@ qTabDeveloper::~qTabDeveloper() {}
|
|||||||
void qTabDeveloper::SetupWidgetWindow() {
|
void qTabDeveloper::SetupWidgetWindow() {
|
||||||
int tempid = 0;
|
int tempid = 0;
|
||||||
|
|
||||||
comboHV->hide();
|
|
||||||
lblComboHV->hide();
|
|
||||||
lblSpinHV->hide();
|
|
||||||
spinHV->hide();
|
|
||||||
hvmin = HV_MIN;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
slsDetectorDefs::detectorType detType = det->getDetectorType().squash();
|
slsDetectorDefs::detectorType detType = det->getDetectorType().squash();
|
||||||
switch (detType) {
|
switch (detType) {
|
||||||
@ -84,8 +78,6 @@ void qTabDeveloper::SetupWidgetWindow() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case slsDetectorDefs::GOTTHARD:
|
case slsDetectorDefs::GOTTHARD:
|
||||||
comboHV->show();
|
|
||||||
lblComboHV->show();
|
|
||||||
dacWidgets.push_back(new qDacWidget(
|
dacWidgets.push_back(new qDacWidget(
|
||||||
this, det, true,
|
this, det, true,
|
||||||
"v Reference: ", getSLSIndex(detType, tempid++)));
|
"v Reference: ", getSLSIndex(detType, tempid++)));
|
||||||
@ -119,8 +111,6 @@ void qTabDeveloper::SetupWidgetWindow() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case slsDetectorDefs::JUNGFRAU:
|
case slsDetectorDefs::JUNGFRAU:
|
||||||
lblSpinHV->show();
|
|
||||||
spinHV->show();
|
|
||||||
dacWidgets.push_back(
|
dacWidgets.push_back(
|
||||||
new qDacWidget(this, det, true,
|
new qDacWidget(this, det, true,
|
||||||
"v vb comp: ", getSLSIndex(detType, tempid++)));
|
"v vb comp: ", getSLSIndex(detType, tempid++)));
|
||||||
@ -150,8 +140,6 @@ void qTabDeveloper::SetupWidgetWindow() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case slsDetectorDefs::MOENCH:
|
case slsDetectorDefs::MOENCH:
|
||||||
lblSpinHV->show();
|
|
||||||
spinHV->show();
|
|
||||||
dacWidgets.push_back(
|
dacWidgets.push_back(
|
||||||
new qDacWidget(this, det, true,
|
new qDacWidget(this, det, true,
|
||||||
"vbp_colbuf: ", getSLSIndex(detType, tempid++)));
|
"vbp_colbuf: ", getSLSIndex(detType, tempid++)));
|
||||||
@ -175,9 +163,6 @@ void qTabDeveloper::SetupWidgetWindow() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case slsDetectorDefs::MYTHEN3:
|
case slsDetectorDefs::MYTHEN3:
|
||||||
lblSpinHV->show();
|
|
||||||
spinHV->show();
|
|
||||||
hvmin = 0;
|
|
||||||
dacWidgets.push_back(new qDacWidget(
|
dacWidgets.push_back(new qDacWidget(
|
||||||
this, det, true, "vcassh: ", getSLSIndex(detType, tempid++)));
|
this, det, true, "vcassh: ", getSLSIndex(detType, tempid++)));
|
||||||
dacWidgets.push_back(new qDacWidget(
|
dacWidgets.push_back(new qDacWidget(
|
||||||
@ -218,9 +203,6 @@ void qTabDeveloper::SetupWidgetWindow() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case slsDetectorDefs::GOTTHARD2:
|
case slsDetectorDefs::GOTTHARD2:
|
||||||
lblSpinHV->show();
|
|
||||||
spinHV->show();
|
|
||||||
hvmin = 0;
|
|
||||||
dacWidgets.push_back(
|
dacWidgets.push_back(
|
||||||
new qDacWidget(this, det, true,
|
new qDacWidget(this, det, true,
|
||||||
"vref_h_adc: ", getSLSIndex(detType, tempid++)));
|
"vref_h_adc: ", getSLSIndex(detType, tempid++)));
|
||||||
@ -292,9 +274,6 @@ void qTabDeveloper::SetupWidgetWindow() {
|
|||||||
void qTabDeveloper::Initialization() {
|
void qTabDeveloper::Initialization() {
|
||||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(Refresh()));
|
SLOT(Refresh()));
|
||||||
connect(comboHV, SIGNAL(currentIndexChanged(int)), this,
|
|
||||||
SLOT(SetHighVoltage()));
|
|
||||||
connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDeveloper::PopulateDetectors() {
|
void qTabDeveloper::PopulateDetectors() {
|
||||||
@ -311,75 +290,6 @@ void qTabDeveloper::PopulateDetectors() {
|
|||||||
comboDetector->setCurrentIndex(0);
|
comboDetector->setCurrentIndex(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDeveloper::GetHighVoltage() {
|
|
||||||
// not enabled for eiger
|
|
||||||
if (!comboHV->isVisible() && !spinHV->isVisible())
|
|
||||||
return;
|
|
||||||
LOG(logDEBUG) << "Getting High Voltage";
|
|
||||||
disconnect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
|
|
||||||
disconnect(comboHV, SIGNAL(currentIndexChanged(int)), this,
|
|
||||||
SLOT(SetHighVoltage()));
|
|
||||||
try {
|
|
||||||
// dac units
|
|
||||||
auto retval = det->getHighVoltage({comboDetector->currentIndex() - 1})
|
|
||||||
.tsquash("Inconsistent values for high voltage.");
|
|
||||||
// spinHV
|
|
||||||
if (spinHV->isVisible()) {
|
|
||||||
if (retval != 0 && retval < hvmin && retval > HV_MAX) {
|
|
||||||
throw RuntimeError(std::string("Unknown High Voltage: ") +
|
|
||||||
std::to_string(retval));
|
|
||||||
}
|
|
||||||
spinHV->setValue(retval);
|
|
||||||
}
|
|
||||||
// combo HV
|
|
||||||
else {
|
|
||||||
switch (retval) {
|
|
||||||
case 0:
|
|
||||||
comboHV->setCurrentIndex(HV_0);
|
|
||||||
break;
|
|
||||||
case 90:
|
|
||||||
comboHV->setCurrentIndex(HV_90);
|
|
||||||
break;
|
|
||||||
case 110:
|
|
||||||
comboHV->setCurrentIndex(HV_110);
|
|
||||||
break;
|
|
||||||
case 120:
|
|
||||||
comboHV->setCurrentIndex(HV_120);
|
|
||||||
break;
|
|
||||||
case 150:
|
|
||||||
comboHV->setCurrentIndex(HV_150);
|
|
||||||
break;
|
|
||||||
case 180:
|
|
||||||
comboHV->setCurrentIndex(HV_180);
|
|
||||||
break;
|
|
||||||
case 200:
|
|
||||||
comboHV->setCurrentIndex(HV_200);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw RuntimeError(std::string("Unknown High Voltage: ") +
|
|
||||||
std::to_string(retval));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CATCH_DISPLAY("Could not get high voltage.",
|
|
||||||
"qTabDeveloper::GetHighVoltage")
|
|
||||||
connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
|
|
||||||
connect(comboHV, SIGNAL(currentIndexChanged(int)), this,
|
|
||||||
SLOT(SetHighVoltage()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void qTabDeveloper::SetHighVoltage() {
|
|
||||||
int val = (comboHV->isVisible() ? comboHV->currentText().toInt()
|
|
||||||
: spinHV->value());
|
|
||||||
LOG(logINFO) << "Setting high voltage:" << val;
|
|
||||||
|
|
||||||
try {
|
|
||||||
det->setHighVoltage({comboDetector->currentIndex() - 1});
|
|
||||||
}
|
|
||||||
CATCH_HANDLE("Could not set high voltage.", "qTabDeveloper::SetHighVoltage",
|
|
||||||
this, &qTabDeveloper::GetHighVoltage)
|
|
||||||
}
|
|
||||||
|
|
||||||
slsDetectorDefs::dacIndex
|
slsDetectorDefs::dacIndex
|
||||||
qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
|
qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
|
||||||
switch (detType) {
|
switch (detType) {
|
||||||
@ -606,7 +516,6 @@ void qTabDeveloper::Refresh() {
|
|||||||
for (const auto &it : adcWidgets) {
|
for (const auto &it : adcWidgets) {
|
||||||
it->SetDetectorIndex(comboDetector->currentIndex() - 1);
|
it->SetDetectorIndex(comboDetector->currentIndex() - 1);
|
||||||
}
|
}
|
||||||
GetHighVoltage();
|
|
||||||
LOG(logDEBUG) << "**Updated Developer Tab";
|
LOG(logDEBUG) << "**Updated Developer Tab";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,12 @@ qTabSettings::~qTabSettings() {}
|
|||||||
|
|
||||||
void qTabSettings::SetupWidgetWindow() {
|
void qTabSettings::SetupWidgetWindow() {
|
||||||
|
|
||||||
|
comboHV->hide();
|
||||||
|
lblComboHV->hide();
|
||||||
|
lblSpinHV->hide();
|
||||||
|
spinHV->hide();
|
||||||
|
hvmin = HV_MIN;
|
||||||
|
|
||||||
counters = std::vector<QCheckBox *>{chkCounter1, chkCounter2, chkCounter3};
|
counters = std::vector<QCheckBox *>{chkCounter1, chkCounter2, chkCounter3};
|
||||||
|
|
||||||
spinThreshold2->hide();
|
spinThreshold2->hide();
|
||||||
@ -37,6 +43,9 @@ void qTabSettings::SetupWidgetWindow() {
|
|||||||
// enabling according to det type
|
// enabling according to det type
|
||||||
slsDetectorDefs::detectorType detType = det->getDetectorType().squash();
|
slsDetectorDefs::detectorType detType = det->getDetectorType().squash();
|
||||||
if (detType == slsDetectorDefs::MYTHEN3) {
|
if (detType == slsDetectorDefs::MYTHEN3) {
|
||||||
|
lblSpinHV->show();
|
||||||
|
spinHV->show();
|
||||||
|
hvmin = 0;
|
||||||
lblDynamicRange->setEnabled(true);
|
lblDynamicRange->setEnabled(true);
|
||||||
comboDynamicRange->setEnabled(true);
|
comboDynamicRange->setEnabled(true);
|
||||||
|
|
||||||
@ -77,13 +86,28 @@ void qTabSettings::SetupWidgetWindow() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (detType == slsDetectorDefs::EIGER) {
|
} else if (detType == slsDetectorDefs::EIGER) {
|
||||||
|
lblSpinHV->show();
|
||||||
|
spinHV->show();
|
||||||
|
hvmin = 0;
|
||||||
lblDynamicRange->setEnabled(true);
|
lblDynamicRange->setEnabled(true);
|
||||||
comboDynamicRange->setEnabled(true);
|
comboDynamicRange->setEnabled(true);
|
||||||
lblThreshold->setEnabled(true);
|
lblThreshold->setEnabled(true);
|
||||||
spinThreshold->setEnabled(true);
|
spinThreshold->setEnabled(true);
|
||||||
} else if (detType == slsDetectorDefs::JUNGFRAU) {
|
} else if (detType == slsDetectorDefs::JUNGFRAU) {
|
||||||
|
lblSpinHV->show();
|
||||||
|
spinHV->show();
|
||||||
lblGainMode->setEnabled(true);
|
lblGainMode->setEnabled(true);
|
||||||
comboGainMode->setEnabled(true);
|
comboGainMode->setEnabled(true);
|
||||||
|
} else if (detType == slsDetectorDefs::GOTTHARD) {
|
||||||
|
comboHV->show();
|
||||||
|
lblComboHV->show();
|
||||||
|
} else if (detType == slsDetectorDefs::MOENCH) {
|
||||||
|
lblSpinHV->show();
|
||||||
|
spinHV->show();
|
||||||
|
} else if (detType == slsDetectorDefs::GOTTHARD2) {
|
||||||
|
lblSpinHV->show();
|
||||||
|
spinHV->show();
|
||||||
|
hvmin = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// default settings for the disabled
|
// default settings for the disabled
|
||||||
@ -165,6 +189,11 @@ void qTabSettings::ShowFixG0(bool expertMode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void qTabSettings::Initialization() {
|
void qTabSettings::Initialization() {
|
||||||
|
// High voltage
|
||||||
|
connect(comboHV, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(SetHighVoltage()));
|
||||||
|
connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
if (comboSettings->isEnabled())
|
if (comboSettings->isEnabled())
|
||||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
||||||
@ -201,6 +230,91 @@ void qTabSettings::Initialization() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qTabSettings::GetHighVoltage() {
|
||||||
|
// not enabled for eiger
|
||||||
|
if (!comboHV->isVisible() && !spinHV->isVisible())
|
||||||
|
return;
|
||||||
|
LOG(logDEBUG) << "Getting High Voltage";
|
||||||
|
disconnect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
|
||||||
|
disconnect(comboHV, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(SetHighVoltage()));
|
||||||
|
try {
|
||||||
|
Result<int> retvals = det->getHighVoltage();
|
||||||
|
|
||||||
|
int retval = 0;
|
||||||
|
if (det->getDetectorType().squash() != slsDetectorDefs::EIGER) {
|
||||||
|
retval = retvals.tsquash("Inconsistent values for high voltage.");
|
||||||
|
}
|
||||||
|
// eiger slaves return -999
|
||||||
|
else {
|
||||||
|
|
||||||
|
auto is_master = det->getMaster();
|
||||||
|
Result<int> master_retvals;
|
||||||
|
for (size_t i = 0; i != retvals.size(); ++i) {
|
||||||
|
if (is_master[i]) {
|
||||||
|
master_retvals.push_back(retvals[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
retval = master_retvals.tsquash("Inconsistent values for high voltage.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// spinHV
|
||||||
|
if (spinHV->isVisible()) {
|
||||||
|
if (retval != 0 && retval < hvmin && retval > HV_MAX) {
|
||||||
|
throw RuntimeError(std::string("Unknown High Voltage: ") +
|
||||||
|
std::to_string(retval));
|
||||||
|
}
|
||||||
|
spinHV->setValue(retval);
|
||||||
|
}
|
||||||
|
// combo HV
|
||||||
|
else {
|
||||||
|
switch (retval) {
|
||||||
|
case 0:
|
||||||
|
comboHV->setCurrentIndex(HV_0);
|
||||||
|
break;
|
||||||
|
case 90:
|
||||||
|
comboHV->setCurrentIndex(HV_90);
|
||||||
|
break;
|
||||||
|
case 110:
|
||||||
|
comboHV->setCurrentIndex(HV_110);
|
||||||
|
break;
|
||||||
|
case 120:
|
||||||
|
comboHV->setCurrentIndex(HV_120);
|
||||||
|
break;
|
||||||
|
case 150:
|
||||||
|
comboHV->setCurrentIndex(HV_150);
|
||||||
|
break;
|
||||||
|
case 180:
|
||||||
|
comboHV->setCurrentIndex(HV_180);
|
||||||
|
break;
|
||||||
|
case 200:
|
||||||
|
comboHV->setCurrentIndex(HV_200);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw RuntimeError(std::string("Unknown High Voltage: ") +
|
||||||
|
std::to_string(retval));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CATCH_DISPLAY("Could not get high voltage.",
|
||||||
|
"qTabSettings::GetHighVoltage")
|
||||||
|
connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
|
||||||
|
connect(comboHV, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(SetHighVoltage()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void qTabSettings::SetHighVoltage() {
|
||||||
|
int val = (comboHV->isVisible() ? comboHV->currentText().toInt()
|
||||||
|
: spinHV->value());
|
||||||
|
LOG(logINFO) << "Setting high voltage:" << val;
|
||||||
|
|
||||||
|
try {
|
||||||
|
det->setHighVoltage(val);
|
||||||
|
}
|
||||||
|
CATCH_HANDLE("Could not set high voltage.", "qTabSettings::SetHighVoltage",
|
||||||
|
this, &qTabSettings::GetHighVoltage)
|
||||||
|
}
|
||||||
|
|
||||||
void qTabSettings::GetSettings() {
|
void qTabSettings::GetSettings() {
|
||||||
LOG(logDEBUG) << "Getting settings";
|
LOG(logDEBUG) << "Getting settings";
|
||||||
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
||||||
@ -472,6 +586,8 @@ void qTabSettings::SetCounterMask() {
|
|||||||
void qTabSettings::Refresh() {
|
void qTabSettings::Refresh() {
|
||||||
LOG(logDEBUG) << "**Updating Settings Tab";
|
LOG(logDEBUG) << "**Updating Settings Tab";
|
||||||
|
|
||||||
|
GetHighVoltage();
|
||||||
|
|
||||||
if (comboSettings->isEnabled()) {
|
if (comboSettings->isEnabled()) {
|
||||||
GetSettings();
|
GetSettings();
|
||||||
}
|
}
|
||||||
|
@ -913,6 +913,15 @@ class Detector {
|
|||||||
|
|
||||||
void clearRxROI();
|
void clearRxROI();
|
||||||
|
|
||||||
|
Result<int> getRxBunchSize(Positions pos = {}) const;
|
||||||
|
|
||||||
|
/** Number of frames the receiver listens to before pushing into fifo
|
||||||
|
* (buffer between listener and writer threads).
|
||||||
|
* Higher number results in fewer locks between fifo access. \n
|
||||||
|
* Default is 1. */
|
||||||
|
void setRxBunchSize(int value, Positions pos = {});
|
||||||
|
|
||||||
|
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
/** @name File */
|
/** @name File */
|
||||||
|
@ -1539,6 +1539,72 @@ std::string CmdProxy::UDPDestinationList(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CmdProxy::UDPSourceIP(int action) {
|
||||||
|
std::ostringstream os;
|
||||||
|
os << cmd << ' ';
|
||||||
|
if (action == defs::HELP_ACTION) {
|
||||||
|
os << "[x.x.x.x] or auto\n\tIp address of the detector (source) udp interface. Must be same subnet as destination udp ip.\n\t[Eiger] Set only for 10G. For 1G, detector will replace with its own DHCP IP address. If 'auto' used, then ip is set to ip of rx_hostname."
|
||||||
|
<< '\n';
|
||||||
|
} else if (action == defs::GET_ACTION) {
|
||||||
|
auto t = det->getSourceUDPIP(std::vector<int>{det_id});
|
||||||
|
if (!args.empty()) {
|
||||||
|
WrongNumberOfParameters(0);
|
||||||
|
}
|
||||||
|
os << OutString(t) << '\n';
|
||||||
|
} else if (action == defs::PUT_ACTION) {
|
||||||
|
if (args.size() != 1) {
|
||||||
|
WrongNumberOfParameters(1);
|
||||||
|
}
|
||||||
|
IpAddr val;
|
||||||
|
if (args[0] == "auto") {
|
||||||
|
val = getIpFromAuto();
|
||||||
|
LOG(logINFO) << "Setting udp_srcip of detector " << det_id << " to "
|
||||||
|
<< val;
|
||||||
|
} else {
|
||||||
|
val = IpAddr(args[0]);
|
||||||
|
}
|
||||||
|
det->setSourceUDPIP(val, std::vector<int>{det_id});
|
||||||
|
os << val << '\n';
|
||||||
|
|
||||||
|
} else {
|
||||||
|
throw RuntimeError("Unknown action");
|
||||||
|
}
|
||||||
|
return os.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CmdProxy::UDPSourceIP2(int action) {
|
||||||
|
std::ostringstream os;
|
||||||
|
os << cmd << ' ';
|
||||||
|
if (action == defs::HELP_ACTION) {
|
||||||
|
os << "[x.x.x.x] or auto\n\t[Jungfrau][Gotthard2] Ip address of the detector (source) udp interface 2. Must be same subnet as destination udp ip2.\n\t [Jungfrau] top half or inner interface\n\t [Gotthard2] veto debugging. If 'auto' used, then ip is set to ip of rx_hostname."
|
||||||
|
<< '\n';
|
||||||
|
} else if (action == defs::GET_ACTION) {
|
||||||
|
auto t = det->getSourceUDPIP2(std::vector<int>{det_id});
|
||||||
|
if (!args.empty()) {
|
||||||
|
WrongNumberOfParameters(0);
|
||||||
|
}
|
||||||
|
os << OutString(t) << '\n';
|
||||||
|
} else if (action == defs::PUT_ACTION) {
|
||||||
|
if (args.size() != 1) {
|
||||||
|
WrongNumberOfParameters(1);
|
||||||
|
}
|
||||||
|
IpAddr val;
|
||||||
|
if (args[0] == "auto") {
|
||||||
|
val = getIpFromAuto();
|
||||||
|
LOG(logINFO) << "Setting udp_srcip2 of detector " << det_id << " to "
|
||||||
|
<< val;
|
||||||
|
} else {
|
||||||
|
val = IpAddr(args[0]);
|
||||||
|
}
|
||||||
|
det->setSourceUDPIP2(val, std::vector<int>{det_id});
|
||||||
|
os << val << '\n';
|
||||||
|
|
||||||
|
} else {
|
||||||
|
throw RuntimeError("Unknown action");
|
||||||
|
}
|
||||||
|
return os.str();
|
||||||
|
}
|
||||||
|
|
||||||
std::string CmdProxy::UDPDestinationIP(int action) {
|
std::string CmdProxy::UDPDestinationIP(int action) {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
|
@ -877,8 +877,8 @@ class CmdProxy {
|
|||||||
{"udp_numdst", &CmdProxy::udp_numdst},
|
{"udp_numdst", &CmdProxy::udp_numdst},
|
||||||
{"udp_cleardst", &CmdProxy::udp_cleardst},
|
{"udp_cleardst", &CmdProxy::udp_cleardst},
|
||||||
{"udp_firstdst", &CmdProxy::udp_firstdst},
|
{"udp_firstdst", &CmdProxy::udp_firstdst},
|
||||||
{"udp_srcip", &CmdProxy::udp_srcip},
|
{"udp_srcip", &CmdProxy::UDPSourceIP},
|
||||||
{"udp_srcip2", &CmdProxy::udp_srcip2},
|
{"udp_srcip2", &CmdProxy::UDPSourceIP2},
|
||||||
{"udp_dstip", &CmdProxy::UDPDestinationIP},
|
{"udp_dstip", &CmdProxy::UDPDestinationIP},
|
||||||
{"udp_dstip2", &CmdProxy::UDPDestinationIP2},
|
{"udp_dstip2", &CmdProxy::UDPDestinationIP2},
|
||||||
{"udp_srcmac", &CmdProxy::udp_srcmac},
|
{"udp_srcmac", &CmdProxy::udp_srcmac},
|
||||||
@ -911,6 +911,7 @@ class CmdProxy {
|
|||||||
{"rx_arping", &CmdProxy::rx_arping},
|
{"rx_arping", &CmdProxy::rx_arping},
|
||||||
{"rx_roi", &CmdProxy::Rx_ROI},
|
{"rx_roi", &CmdProxy::Rx_ROI},
|
||||||
{"rx_clearroi", &CmdProxy::rx_clearroi},
|
{"rx_clearroi", &CmdProxy::rx_clearroi},
|
||||||
|
{"rx_bunchsize", &CmdProxy::rx_bunchsize},// FIXME: rx_fifobunchsize?
|
||||||
|
|
||||||
/* File */
|
/* File */
|
||||||
{"fformat", &CmdProxy::fformat},
|
{"fformat", &CmdProxy::fformat},
|
||||||
@ -1148,6 +1149,8 @@ class CmdProxy {
|
|||||||
IpAddr getIpFromAuto();
|
IpAddr getIpFromAuto();
|
||||||
UdpDestination getUdpEntry();
|
UdpDestination getUdpEntry();
|
||||||
std::string UDPDestinationList(int action);
|
std::string UDPDestinationList(int action);
|
||||||
|
std::string UDPSourceIP(int action);
|
||||||
|
std::string UDPSourceIP2(int action);
|
||||||
std::string UDPDestinationIP(int action);
|
std::string UDPDestinationIP(int action);
|
||||||
std::string UDPDestinationIP2(int action);
|
std::string UDPDestinationIP2(int action);
|
||||||
/* Receiver Config */
|
/* Receiver Config */
|
||||||
@ -1597,19 +1600,6 @@ class CmdProxy {
|
|||||||
"out from in a round robin fashion. The entry must not have been "
|
"out from in a round robin fashion. The entry must not have been "
|
||||||
"empty. Default: 0");
|
"empty. Default: 0");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
|
||||||
udp_srcip, getSourceUDPIP, setSourceUDPIP, IpAddr,
|
|
||||||
"[x.x.x.x]\n\tIp address of the detector (source) udp "
|
|
||||||
"interface. Must be same subnet as destination udp "
|
|
||||||
"ip.\n\t[Eiger] Set only for 10G. For 1G, detector will "
|
|
||||||
"replace with its own DHCP IP address.");
|
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
|
||||||
udp_srcip2, getSourceUDPIP2, setSourceUDPIP2, IpAddr,
|
|
||||||
"[x.x.x.x]\n\t[Jungfrau][Gotthard2] Ip address of the detector "
|
|
||||||
"(source) udp interface 2. Must be same subnet as destination udp "
|
|
||||||
"ip2.\n\t [Jungfrau] top half or inner interface\n\t [Gotthard2] veto "
|
|
||||||
"debugging.");
|
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
udp_srcmac, getSourceUDPMAC, setSourceUDPMAC, MacAddr,
|
udp_srcmac, getSourceUDPMAC, setSourceUDPMAC, MacAddr,
|
||||||
@ -1768,6 +1758,10 @@ class CmdProxy {
|
|||||||
"Resets Region of interest in receiver. Default is all "
|
"Resets Region of interest in receiver. Default is all "
|
||||||
"channels/pixels enabled.");
|
"channels/pixels enabled.");
|
||||||
|
|
||||||
|
INTEGER_COMMAND_VEC_ID(
|
||||||
|
rx_bunchsize, getRxBunchSize, setRxBunchSize, StringTo<int>,
|
||||||
|
"[n_frames]\n\tSet the number of frames the receiver listens to before pushing into fifo (buffer between listener and writer threads). Higher number results in fewer locks between fifo access. Default is 1. Expect signed 32 bit integer. ");
|
||||||
|
|
||||||
/* File */
|
/* File */
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
|
@ -1225,6 +1225,14 @@ void Detector::setRxROI(const defs::ROI value) { pimpl->setRxROI(value); }
|
|||||||
|
|
||||||
void Detector::clearRxROI() { pimpl->clearRxROI(); }
|
void Detector::clearRxROI() { pimpl->clearRxROI(); }
|
||||||
|
|
||||||
|
Result<int> Detector::getRxBunchSize(Positions pos) const {
|
||||||
|
return pimpl->Parallel(&Module::getRxBunchSize, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Detector::setRxBunchSize(int value, Positions pos) {
|
||||||
|
pimpl->Parallel(&Module::setRxBunchSize, pos, value);
|
||||||
|
}
|
||||||
|
|
||||||
// File
|
// File
|
||||||
|
|
||||||
Result<defs::fileFormat> Detector::getFileFormat(Positions pos) const {
|
Result<defs::fileFormat> Detector::getFileFormat(Positions pos) const {
|
||||||
|
@ -1388,6 +1388,15 @@ void Module::setRxROIMetadata(const slsDetectorDefs::ROI arg) {
|
|||||||
sendToReceiver(F_RECEIVER_SET_RECEIVER_ROI_METADATA, arg, nullptr);
|
sendToReceiver(F_RECEIVER_SET_RECEIVER_ROI_METADATA, arg, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Module::getRxBunchSize() const {
|
||||||
|
return sendToReceiver<int>(F_GET_RECEIVER_BUNCH_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Module::setRxBunchSize(int value) {
|
||||||
|
sendToReceiver<int>(F_SET_RECEIVER_BUNCH_SIZE, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// File
|
// File
|
||||||
slsDetectorDefs::fileFormat Module::getFileFormat() const {
|
slsDetectorDefs::fileFormat Module::getFileFormat() const {
|
||||||
return sendToReceiver<fileFormat>(F_GET_RECEIVER_FILE_FORMAT);
|
return sendToReceiver<fileFormat>(F_GET_RECEIVER_FILE_FORMAT);
|
||||||
@ -1768,6 +1777,9 @@ int Module::getNumberOfAdditionalStorageCells() const {
|
|||||||
|
|
||||||
void Module::setNumberOfAdditionalStorageCells(int value) {
|
void Module::setNumberOfAdditionalStorageCells(int value) {
|
||||||
sendToDetector(F_SET_NUM_ADDITIONAL_STORAGE_CELLS, value, nullptr);
|
sendToDetector(F_SET_NUM_ADDITIONAL_STORAGE_CELLS, value, nullptr);
|
||||||
|
if (shm()->useReceiverFlag) {
|
||||||
|
sendToReceiver(F_SET_RECEIVER_NUM_ADD_STORAGE_CELLS, value, nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Module::getStorageCellStart() const {
|
int Module::getStorageCellStart() const {
|
||||||
|
@ -294,6 +294,8 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
defs::ROI getRxROI() const;
|
defs::ROI getRxROI() const;
|
||||||
void setRxROI(const slsDetectorDefs::ROI arg);
|
void setRxROI(const slsDetectorDefs::ROI arg);
|
||||||
void setRxROIMetadata(const slsDetectorDefs::ROI arg);
|
void setRxROIMetadata(const slsDetectorDefs::ROI arg);
|
||||||
|
int getRxBunchSize() const;
|
||||||
|
void setRxBunchSize(int value);
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
|
@ -254,6 +254,7 @@ TEST_CASE("rx_fifodepth", "[.cmd][.rx]") {
|
|||||||
proxy.Call("rx_fifodepth", {}, -1, GET, oss);
|
proxy.Call("rx_fifodepth", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "rx_fifodepth 100\n");
|
REQUIRE(oss.str() == "rx_fifodepth 100\n");
|
||||||
}
|
}
|
||||||
|
REQUIRE_THROWS(proxy.Call("rx_fifodepth", {"0"}, -1, PUT));
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setRxFifoDepth(prev_val[i], {i});
|
det.setRxFifoDepth(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
@ -513,6 +514,32 @@ TEST_CASE("rx_clearroi", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST_CASE("rx_bunchsize", "[.cmd][.rx]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto prev_val = det.getRxBunchSize();
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("rx_bunchsize", {"10"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "rx_bunchsize 10\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("rx_bunchsize", {"100"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "rx_bunchsize 100\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("rx_bunchsize", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "rx_bunchsize 100\n");
|
||||||
|
}
|
||||||
|
REQUIRE_THROWS(proxy.Call("rx_bunchsize", {"0"}, -1, PUT));
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setRxBunchSize(prev_val[i], {i});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* File */
|
/* File */
|
||||||
|
|
||||||
TEST_CASE("fformat", "[.cmd]") {
|
TEST_CASE("fformat", "[.cmd]") {
|
||||||
|
@ -223,6 +223,8 @@ int ClientInterface::functionTable(){
|
|||||||
flist[F_RECEIVER_GET_RECEIVER_ROI] = &ClientInterface::get_receiver_roi;
|
flist[F_RECEIVER_GET_RECEIVER_ROI] = &ClientInterface::get_receiver_roi;
|
||||||
flist[F_RECEIVER_SET_RECEIVER_ROI] = &ClientInterface::set_receiver_roi;
|
flist[F_RECEIVER_SET_RECEIVER_ROI] = &ClientInterface::set_receiver_roi;
|
||||||
flist[F_RECEIVER_SET_RECEIVER_ROI_METADATA] = &ClientInterface::set_receiver_roi_metadata;
|
flist[F_RECEIVER_SET_RECEIVER_ROI_METADATA] = &ClientInterface::set_receiver_roi_metadata;
|
||||||
|
flist[F_GET_RECEIVER_BUNCH_SIZE] = &ClientInterface::get_bunch_size;
|
||||||
|
flist[F_SET_RECEIVER_BUNCH_SIZE] = &ClientInterface::set_bunch_size;
|
||||||
|
|
||||||
for (int i = NUM_DET_FUNCTIONS + 1; i < NUM_REC_FUNCTIONS ; i++) {
|
for (int i = NUM_DET_FUNCTIONS + 1; i < NUM_REC_FUNCTIONS ; i++) {
|
||||||
LOG(logDEBUG1) << "function fnum: " << i << " (" <<
|
LOG(logDEBUG1) << "function fnum: " << i << " (" <<
|
||||||
@ -581,7 +583,7 @@ int ClientInterface::set_num_add_storage_cells(Interface &socket) {
|
|||||||
throw RuntimeError("Invalid number of additional storage cells " +
|
throw RuntimeError("Invalid number of additional storage cells " +
|
||||||
std::to_string(value));
|
std::to_string(value));
|
||||||
}
|
}
|
||||||
verifyIdle(socket);
|
// allowing this to be done even when receiver not idle
|
||||||
LOG(logDEBUG1) << "Setting num additional storage cells to " << value;
|
LOG(logDEBUG1) << "Setting num additional storage cells to " << value;
|
||||||
impl()->setNumberOfAdditionalStorageCells(value);
|
impl()->setNumberOfAdditionalStorageCells(value);
|
||||||
return socket.Send(OK);
|
return socket.Send(OK);
|
||||||
@ -1176,7 +1178,7 @@ int ClientInterface::get_additional_json_header(Interface &socket) {
|
|||||||
int ClientInterface::set_udp_socket_buffer_size(Interface &socket) {
|
int ClientInterface::set_udp_socket_buffer_size(Interface &socket) {
|
||||||
auto size = socket.Receive<int>();
|
auto size = socket.Receive<int>();
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
throw RuntimeError("Receiver socket buffer size must be > 0.");
|
throw RuntimeError("Receiver socket buffer size must be greater than 0.");
|
||||||
}
|
}
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
verifyIdle(socket);
|
verifyIdle(socket);
|
||||||
@ -1780,4 +1782,29 @@ int ClientInterface::set_receiver_roi_metadata(Interface &socket) {
|
|||||||
return socket.Send(OK);
|
return socket.Send(OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ClientInterface::get_bunch_size(Interface &socket) {
|
||||||
|
int retval = static_cast<int>(impl()->getBunchSize());
|
||||||
|
LOG(logDEBUG1) << "bunch size retval:" << retval;
|
||||||
|
return socket.sendResult(retval);
|
||||||
|
}
|
||||||
|
|
||||||
|
int ClientInterface::set_bunch_size(Interface &socket) {
|
||||||
|
auto value = socket.Receive<int>();
|
||||||
|
if (value <= 0) {
|
||||||
|
throw RuntimeError("Could not set rx bunch size. Must be greater than 0.");
|
||||||
|
}
|
||||||
|
verifyIdle(socket);
|
||||||
|
LOG(logDEBUG1) << "Setting bunch size:" << value;
|
||||||
|
try {
|
||||||
|
impl()->setBunchSize(static_cast<size_t>(value));
|
||||||
|
} catch (const RuntimeError &e) {
|
||||||
|
throw RuntimeError("Could not set rx bunch size due to fifo structure memory allocation.");
|
||||||
|
}
|
||||||
|
|
||||||
|
int retval = impl()->getBunchSize();
|
||||||
|
validate(value, retval, std::string("set bunch size"), DEC);
|
||||||
|
LOG(logDEBUG1) << "bunch size retval:" << retval;
|
||||||
|
return socket.sendResult(retval);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace sls
|
} // namespace sls
|
||||||
|
@ -170,6 +170,9 @@ class ClientInterface : private virtual slsDetectorDefs {
|
|||||||
int get_receiver_roi(ServerInterface &socket);
|
int get_receiver_roi(ServerInterface &socket);
|
||||||
int set_receiver_roi(ServerInterface &socket);
|
int set_receiver_roi(ServerInterface &socket);
|
||||||
int set_receiver_roi_metadata(ServerInterface &socket);
|
int set_receiver_roi_metadata(ServerInterface &socket);
|
||||||
|
int get_bunch_size(ServerInterface &socket);
|
||||||
|
int set_bunch_size(ServerInterface &socket);
|
||||||
|
|
||||||
|
|
||||||
Implementation *impl() {
|
Implementation *impl() {
|
||||||
if (receiver != nullptr) {
|
if (receiver != nullptr) {
|
||||||
|
@ -44,6 +44,7 @@ DataProcessor::DataProcessor(int index, detectorType detectorType, Fifo *fifo,
|
|||||||
ctbAnalogDataBytes_(ctbAnalogDataBytes) {
|
ctbAnalogDataBytes_(ctbAnalogDataBytes) {
|
||||||
|
|
||||||
LOG(logDEBUG) << "DataProcessor " << index << " created";
|
LOG(logDEBUG) << "DataProcessor " << index << " created";
|
||||||
|
vetoThread = (detectorType_ == GOTTHARD2 && index != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
DataProcessor::~DataProcessor() { DeleteFiles(); }
|
DataProcessor::~DataProcessor() { DeleteFiles(); }
|
||||||
@ -59,6 +60,10 @@ void DataProcessor::SetReceiverROI(ROI roi) {
|
|||||||
receiverRoiEnabled_ = receiverRoi_.completeRoi() ? false : true;
|
receiverRoiEnabled_ = receiverRoi_.completeRoi() ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DataProcessor::SetBunchSize(size_t value) {
|
||||||
|
fifoBunchSize = value;
|
||||||
|
}
|
||||||
|
|
||||||
void DataProcessor::ResetParametersforNewAcquisition() {
|
void DataProcessor::ResetParametersforNewAcquisition() {
|
||||||
StopRunning();
|
StopRunning();
|
||||||
startedFlag_ = false;
|
startedFlag_ = false;
|
||||||
@ -68,6 +73,12 @@ void DataProcessor::ResetParametersforNewAcquisition() {
|
|||||||
firstStreamerFrame_ = true;
|
firstStreamerFrame_ = true;
|
||||||
streamCurrentFrame_ = false;
|
streamCurrentFrame_ = false;
|
||||||
completeImageToStreamBeforeCropping = make_unique<char[]>(generalData_->imageSize);
|
completeImageToStreamBeforeCropping = make_unique<char[]>(generalData_->imageSize);
|
||||||
|
|
||||||
|
fifoBunchSizeBytes = generalData_->imageSize;
|
||||||
|
if (vetoThread) {
|
||||||
|
fifoBunchSizeBytes = generalData_->vetoDataSize;
|
||||||
|
}
|
||||||
|
fifoBunchSizeBytes += generalData_->fifoBufferHeaderSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataProcessor::RecordFirstIndex(uint64_t fnum) {
|
void DataProcessor::RecordFirstIndex(uint64_t fnum) {
|
||||||
@ -169,7 +180,7 @@ uint32_t DataProcessor::GetFilesInAcquisition() const {
|
|||||||
return dataFile_->GetFilesInAcquisition();
|
return dataFile_->GetFilesInAcquisition();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::array<std::string, 2> DataProcessor::CreateVirtualFile(
|
std::string DataProcessor::CreateVirtualFile(
|
||||||
const std::string &filePath, const std::string &fileNamePrefix,
|
const std::string &filePath, const std::string &fileNamePrefix,
|
||||||
const uint64_t fileIndex, const bool overWriteEnable, const bool silentMode,
|
const uint64_t fileIndex, const bool overWriteEnable, const bool silentMode,
|
||||||
const int modulePos, const int numUnitsPerReadout,
|
const int modulePos, const int numUnitsPerReadout,
|
||||||
@ -195,7 +206,7 @@ std::array<std::string, 2> DataProcessor::CreateVirtualFile(
|
|||||||
// stop acquisition)
|
// stop acquisition)
|
||||||
return masterFileUtility::CreateVirtualHDF5File(
|
return masterFileUtility::CreateVirtualHDF5File(
|
||||||
filePath, fileNamePrefix, fileIndex, overWriteEnable, silentMode,
|
filePath, fileNamePrefix, fileIndex, overWriteEnable, silentMode,
|
||||||
modulePos, numUnitsPerReadout, framesPerFile, numImages,
|
modulePos, numUnitsPerReadout, framesPerFile,
|
||||||
generalData_->nPixelsX, generalData_->nPixelsY, dynamicRange,
|
generalData_->nPixelsX, generalData_->nPixelsY, dynamicRange,
|
||||||
numFramesCaught_, numModX, numModY, dataFile_->GetPDataType(),
|
numFramesCaught_, numModX, numModY, dataFile_->GetPDataType(),
|
||||||
dataFile_->GetParameterNames(), dataFile_->GetParameterDataTypes(),
|
dataFile_->GetParameterNames(), dataFile_->GetParameterDataTypes(),
|
||||||
@ -204,21 +215,18 @@ std::array<std::string, 2> DataProcessor::CreateVirtualFile(
|
|||||||
|
|
||||||
void DataProcessor::LinkFileInMaster(const std::string &masterFileName,
|
void DataProcessor::LinkFileInMaster(const std::string &masterFileName,
|
||||||
const std::string &virtualFileName,
|
const std::string &virtualFileName,
|
||||||
const std::string &virtualDatasetName,
|
|
||||||
const bool silentMode,
|
const bool silentMode,
|
||||||
std::mutex *hdf5LibMutex) {
|
std::mutex *hdf5LibMutex) {
|
||||||
|
|
||||||
if (receiverRoiEnabled_) {
|
if (receiverRoiEnabled_) {
|
||||||
throw std::runtime_error("Should not be here, roi with hdf5 virtual should throw.");
|
throw std::runtime_error("Should not be here, roi with hdf5 virtual should throw.");
|
||||||
}
|
}
|
||||||
std::string fname{virtualFileName}, datasetName{virtualDatasetName};
|
std::string fname{virtualFileName}, masterfname{masterFileName};
|
||||||
// if no virtual file, link data file
|
// if no virtual file, link data file
|
||||||
if (virtualFileName.empty()) {
|
if (virtualFileName.empty()) {
|
||||||
auto res = dataFile_->GetFileAndDatasetName();
|
fname = dataFile_->GetFileName();
|
||||||
fname = res[0];
|
|
||||||
datasetName = res[1];
|
|
||||||
}
|
}
|
||||||
masterFileUtility::LinkHDF5FileInMaster(masterFileName, fname, datasetName,
|
masterFileUtility::LinkHDF5FileInMaster(masterfname, fname,
|
||||||
dataFile_->GetParameterNames(),
|
dataFile_->GetParameterNames(),
|
||||||
silentMode, hdf5LibMutex);
|
silentMode, hdf5LibMutex);
|
||||||
}
|
}
|
||||||
@ -252,31 +260,36 @@ std::string DataProcessor::CreateMasterFile(
|
|||||||
void DataProcessor::ThreadExecution() {
|
void DataProcessor::ThreadExecution() {
|
||||||
char *buffer = nullptr;
|
char *buffer = nullptr;
|
||||||
fifo_->PopAddress(buffer);
|
fifo_->PopAddress(buffer);
|
||||||
LOG(logDEBUG5) << "DataProcessor " << index << ", " << std::hex
|
LOG(logDEBUG1) << "DataProcessor " << index << ", " << std::hex
|
||||||
<< static_cast<void *>(buffer) << std::dec << ":" << buffer;
|
<< static_cast<void *>(buffer) << std::dec;
|
||||||
|
|
||||||
// check dummy
|
bool streamImageInBunch = false;
|
||||||
auto numBytes = *reinterpret_cast<uint32_t *>(buffer);
|
char* tempBuffer = buffer;
|
||||||
LOG(logDEBUG1) << "DataProcessor " << index << ", Numbytes:" << numBytes;
|
for (size_t iFrame = 0; iFrame != fifoBunchSize; iFrame ++) {
|
||||||
if (numBytes == DUMMY_PACKET_VALUE) {
|
|
||||||
StopProcessing(buffer);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
// end of acquisition (check dummy)
|
||||||
ProcessAnImage(buffer);
|
auto numBytes = *reinterpret_cast<uint32_t *>(tempBuffer);
|
||||||
} catch (const std::exception &e) {
|
LOG(logDEBUG1) << "DataProcessor " << index << ", Numbytes:" << numBytes << " " << std::hex << static_cast<void *>(tempBuffer) << std::dec;
|
||||||
fifo_->FreeAddress(buffer);
|
if (numBytes == DUMMY_PACKET_VALUE) {
|
||||||
return;
|
StopProcessing(buffer);
|
||||||
}
|
return;
|
||||||
|
|
||||||
// stream (if time/freq to stream) or free
|
|
||||||
if (streamCurrentFrame_) {
|
|
||||||
// copy the complete image back if roi enabled
|
|
||||||
if (receiverRoiEnabled_) {
|
|
||||||
(*((uint32_t *)buffer)) = generalData_->imageSize;
|
|
||||||
memcpy(buffer + generalData_->fifoBufferHeaderSize, &completeImageToStreamBeforeCropping[0], generalData_->imageSize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
ProcessAnImage(tempBuffer);
|
||||||
|
if (streamCurrentFrame_) {
|
||||||
|
streamImageInBunch = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// exception from callback
|
||||||
|
catch (const std::exception &e) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
tempBuffer += fifoBunchSizeBytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
// stream or free
|
||||||
|
if (streamImageInBunch) {
|
||||||
fifo_->PushAddressToStream(buffer);
|
fifo_->PushAddressToStream(buffer);
|
||||||
} else {
|
} else {
|
||||||
fifo_->FreeAddress(buffer);
|
fifo_->FreeAddress(buffer);
|
||||||
@ -286,7 +299,7 @@ void DataProcessor::ThreadExecution() {
|
|||||||
void DataProcessor::StopProcessing(char *buf) {
|
void DataProcessor::StopProcessing(char *buf) {
|
||||||
LOG(logDEBUG1) << "DataProcessing " << index << ": Dummy";
|
LOG(logDEBUG1) << "DataProcessing " << index << ": Dummy";
|
||||||
|
|
||||||
// stream or free
|
// stream dummy or free
|
||||||
if (*dataStreamEnable_)
|
if (*dataStreamEnable_)
|
||||||
fifo_->PushAddressToStream(buf);
|
fifo_->PushAddressToStream(buf);
|
||||||
else
|
else
|
||||||
@ -342,8 +355,13 @@ void DataProcessor::ProcessAnImage(char *buf) {
|
|||||||
(uint32_t)(fnum - firstIndex_);
|
(uint32_t)(fnum - firstIndex_);
|
||||||
}
|
}
|
||||||
streamCurrentFrame_ = true;
|
streamCurrentFrame_ = true;
|
||||||
|
// needed to know which one to stream from the bunch
|
||||||
|
(*((uint32_t *)(buf + FIFO_HEADER_STREAM_ENABLE))) = 1;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
streamCurrentFrame_ = false;
|
streamCurrentFrame_ = false;
|
||||||
|
// needed to know which one not to stream from the bunch
|
||||||
|
(*((uint32_t *)(buf + FIFO_HEADER_STREAM_ENABLE))) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -393,6 +411,15 @@ void DataProcessor::ProcessAnImage(char *buf) {
|
|||||||
// via stopReceiver tcp)
|
// via stopReceiver tcp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy the complete image back if roi enabled
|
||||||
|
if (streamCurrentFrame_) {
|
||||||
|
if (receiverRoiEnabled_) {
|
||||||
|
(*((uint32_t *)buf)) = generalData_->imageSize;
|
||||||
|
memcpy(buf + generalData_->fifoBufferHeaderSize, &completeImageToStreamBeforeCropping[0], generalData_->imageSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DataProcessor::SendToStreamer() {
|
bool DataProcessor::SendToStreamer() {
|
||||||
@ -428,11 +455,11 @@ bool DataProcessor::CheckTimer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool DataProcessor::CheckCount() {
|
bool DataProcessor::CheckCount() {
|
||||||
if (currentFreqCount_ == *streamingFrequency_) {
|
if (currentFreqCount_ >= *streamingFrequency_) {
|
||||||
currentFreqCount_ = 1;
|
currentFreqCount_ = 1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
currentFreqCount_++;
|
++currentFreqCount_;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -458,7 +485,7 @@ void DataProcessor::PadMissingPackets(char *buf) {
|
|||||||
sls_bitset pmask = header->packetsMask;
|
sls_bitset pmask = header->packetsMask;
|
||||||
|
|
||||||
uint32_t dsize = generalData_->dataSize;
|
uint32_t dsize = generalData_->dataSize;
|
||||||
if (detectorType_ == GOTTHARD2 && index != 0) {
|
if (vetoThread) {
|
||||||
dsize = generalData_->vetoDataSize;
|
dsize = generalData_->vetoDataSize;
|
||||||
}
|
}
|
||||||
uint32_t fifohsize = generalData_->fifoBufferHeaderSize;
|
uint32_t fifohsize = generalData_->fifoBufferHeaderSize;
|
||||||
|
@ -44,6 +44,7 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
void SetReceiverROI(ROI roi);
|
void SetReceiverROI(ROI roi);
|
||||||
void ResetParametersforNewAcquisition();
|
void ResetParametersforNewAcquisition();
|
||||||
void SetGeneralData(GeneralData *generalData);
|
void SetGeneralData(GeneralData *generalData);
|
||||||
|
void SetBunchSize(size_t value);
|
||||||
|
|
||||||
void CloseFiles();
|
void CloseFiles();
|
||||||
void DeleteFiles();
|
void DeleteFiles();
|
||||||
@ -62,7 +63,7 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
const bool detectorDataStream);
|
const bool detectorDataStream);
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
uint32_t GetFilesInAcquisition() const;
|
uint32_t GetFilesInAcquisition() const;
|
||||||
std::array<std::string, 2> CreateVirtualFile(
|
std::string CreateVirtualFile(
|
||||||
const std::string &filePath, const std::string &fileNamePrefix,
|
const std::string &filePath, const std::string &fileNamePrefix,
|
||||||
const uint64_t fileIndex, const bool overWriteEnable,
|
const uint64_t fileIndex, const bool overWriteEnable,
|
||||||
const bool silentMode, const int modulePos,
|
const bool silentMode, const int modulePos,
|
||||||
@ -71,7 +72,6 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
const uint32_t dynamicRange, std::mutex *hdf5LibMutex);
|
const uint32_t dynamicRange, std::mutex *hdf5LibMutex);
|
||||||
void LinkFileInMaster(const std::string &masterFileName,
|
void LinkFileInMaster(const std::string &masterFileName,
|
||||||
const std::string &virtualFileName,
|
const std::string &virtualFileName,
|
||||||
const std::string &virtualDatasetName,
|
|
||||||
const bool silentMode, std::mutex *hdf5LibMutex);
|
const bool silentMode, std::mutex *hdf5LibMutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -157,6 +157,8 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
bool activated_{false};
|
bool activated_{false};
|
||||||
ROI receiverRoi_{};
|
ROI receiverRoi_{};
|
||||||
bool receiverRoiEnabled_{false};
|
bool receiverRoiEnabled_{false};
|
||||||
|
bool vetoThread{false};
|
||||||
|
|
||||||
std::unique_ptr<char[]> completeImageToStreamBeforeCropping;
|
std::unique_ptr<char[]> completeImageToStreamBeforeCropping;
|
||||||
/** if 0, sending random images with a timer */
|
/** if 0, sending random images with a timer */
|
||||||
uint32_t *streamingFrequency_;
|
uint32_t *streamingFrequency_;
|
||||||
@ -184,6 +186,10 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
|
|
||||||
File *dataFile_{nullptr};
|
File *dataFile_{nullptr};
|
||||||
|
|
||||||
|
size_t fifoBunchSize{0};
|
||||||
|
/** size in memory including headers */
|
||||||
|
size_t fifoBunchSizeBytes{0};
|
||||||
|
|
||||||
// call back
|
// call back
|
||||||
/**
|
/**
|
||||||
* Call back for raw data
|
* Call back for raw data
|
||||||
|
@ -18,14 +18,15 @@ namespace sls {
|
|||||||
|
|
||||||
const std::string DataStreamer::TypeName = "DataStreamer";
|
const std::string DataStreamer::TypeName = "DataStreamer";
|
||||||
|
|
||||||
DataStreamer::DataStreamer(int ind, Fifo *f, uint32_t *dr, ROI *r, uint64_t *fi,
|
DataStreamer::DataStreamer(int ind, detectorType dType, Fifo *f, uint32_t *dr, ROI *r, uint64_t *fi,
|
||||||
bool fr, slsDetectorDefs::xy np, bool *qe,
|
bool fr, slsDetectorDefs::xy np, bool *qe,
|
||||||
uint64_t *tot)
|
uint64_t *tot)
|
||||||
: ThreadObject(ind, TypeName), fifo(f), dynamicRange(dr), detectorRoi(r),
|
: ThreadObject(ind, TypeName), fifo(f), detType(dType), dynamicRange(dr), detectorRoi(r),
|
||||||
fileIndex(fi), flipRows(fr), numPorts(np), quadEnable(qe),
|
fileIndex(fi), flipRows(fr), numPorts(np), quadEnable(qe),
|
||||||
totalNumFrames(tot) {
|
totalNumFrames(tot) {
|
||||||
|
|
||||||
LOG(logDEBUG) << "DataStreamer " << ind << " created";
|
LOG(logDEBUG) << "DataStreamer " << ind << " created";
|
||||||
|
vetoThread = (detType == GOTTHARD2 && index != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
DataStreamer::~DataStreamer() {
|
DataStreamer::~DataStreamer() {
|
||||||
@ -50,6 +51,11 @@ void DataStreamer::ResetParametersforNewAcquisition(const std::string &fname) {
|
|||||||
completeBuffer = new char[generalData->imageSizeComplete];
|
completeBuffer = new char[generalData->imageSizeComplete];
|
||||||
memset(completeBuffer, 0, generalData->imageSizeComplete);
|
memset(completeBuffer, 0, generalData->imageSizeComplete);
|
||||||
}
|
}
|
||||||
|
fifoBunchSizeBytes = generalData->imageSize;
|
||||||
|
if (vetoThread) {
|
||||||
|
fifoBunchSizeBytes = generalData->vetoDataSize;
|
||||||
|
}
|
||||||
|
fifoBunchSizeBytes += generalData->fifoBufferHeaderSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataStreamer::RecordFirstIndex(uint64_t fnum, char *buf) {
|
void DataStreamer::RecordFirstIndex(uint64_t fnum, char *buf) {
|
||||||
@ -75,6 +81,10 @@ void DataStreamer::SetAdditionalJsonHeader(
|
|||||||
isAdditionalJsonUpdated = true;
|
isAdditionalJsonUpdated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DataStreamer::SetBunchSize(size_t value) {
|
||||||
|
fifoBunchSize = value;
|
||||||
|
}
|
||||||
|
|
||||||
void DataStreamer::CreateZmqSockets(int *nunits, uint32_t port,
|
void DataStreamer::CreateZmqSockets(int *nunits, uint32_t port,
|
||||||
const IpAddr ip, int hwm) {
|
const IpAddr ip, int hwm) {
|
||||||
uint32_t portnum = port + index;
|
uint32_t portnum = port + index;
|
||||||
@ -115,15 +125,23 @@ void DataStreamer::ThreadExecution() {
|
|||||||
"pop 0x"
|
"pop 0x"
|
||||||
<< std::hex << (void *)(buffer) << std::dec << ":" << buffer;
|
<< std::hex << (void *)(buffer) << std::dec << ":" << buffer;
|
||||||
|
|
||||||
// check dummy
|
char* tempBuffer = buffer;
|
||||||
auto numBytes = *reinterpret_cast<uint32_t *>(buffer);
|
for (size_t iFrame = 0; iFrame != fifoBunchSize; iFrame ++) {
|
||||||
LOG(logDEBUG1) << "DataStreamer " << index << ", Numbytes:" << numBytes;
|
|
||||||
if (numBytes == DUMMY_PACKET_VALUE) {
|
|
||||||
StopProcessing(buffer);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ProcessAnImage(buffer);
|
// end of acquisition (check dummy)
|
||||||
|
auto numBytes = *reinterpret_cast<uint32_t *>(tempBuffer);
|
||||||
|
LOG(logDEBUG1) << "DataStreamer " << index << ", Numbytes:" << numBytes;
|
||||||
|
if (numBytes == DUMMY_PACKET_VALUE) {
|
||||||
|
StopProcessing(buffer);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// process only if it needs to be streamed
|
||||||
|
if (*((uint32_t *)(tempBuffer + FIFO_HEADER_STREAM_ENABLE))) {
|
||||||
|
ProcessAnImage(tempBuffer);
|
||||||
|
}
|
||||||
|
tempBuffer += fifoBunchSizeBytes;
|
||||||
|
}
|
||||||
|
|
||||||
// free
|
// free
|
||||||
fifo->FreeAddress(buffer);
|
fifo->FreeAddress(buffer);
|
||||||
|
@ -30,6 +30,7 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
* Calls Base Class CreateThread(), sets ErrorMask if error and increments
|
* Calls Base Class CreateThread(), sets ErrorMask if error and increments
|
||||||
* NumberofDataStreamers
|
* NumberofDataStreamers
|
||||||
* @param ind self index
|
* @param ind self index
|
||||||
|
* @param dType detector type
|
||||||
* @param f address of Fifo pointer
|
* @param f address of Fifo pointer
|
||||||
* @param dr pointer to dynamic range
|
* @param dr pointer to dynamic range
|
||||||
* @param r detectorRoi
|
* @param r detectorRoi
|
||||||
@ -39,7 +40,7 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
* @param qe pointer to quad Enable
|
* @param qe pointer to quad Enable
|
||||||
* @param tot pointer to total number of frames
|
* @param tot pointer to total number of frames
|
||||||
*/
|
*/
|
||||||
DataStreamer(int ind, Fifo *f, uint32_t *dr, ROI *r, uint64_t *fi, bool fr,
|
DataStreamer(int ind, detectorType dType, Fifo *f, uint32_t *dr, ROI *r, uint64_t *fi, bool fr,
|
||||||
xy np, bool *qe, uint64_t *tot);
|
xy np, bool *qe, uint64_t *tot);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,6 +56,7 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
void SetFlipRows(bool fd);
|
void SetFlipRows(bool fd);
|
||||||
void
|
void
|
||||||
SetAdditionalJsonHeader(const std::map<std::string, std::string> &json);
|
SetAdditionalJsonHeader(const std::map<std::string, std::string> &json);
|
||||||
|
void SetBunchSize(size_t value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates Zmq Sockets
|
* Creates Zmq Sockets
|
||||||
@ -105,6 +107,7 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
static const std::string TypeName;
|
static const std::string TypeName;
|
||||||
const GeneralData *generalData{nullptr};
|
const GeneralData *generalData{nullptr};
|
||||||
Fifo *fifo;
|
Fifo *fifo;
|
||||||
|
detectorType detType;
|
||||||
ZmqSocket *zmqSocket{nullptr};
|
ZmqSocket *zmqSocket{nullptr};
|
||||||
uint32_t *dynamicRange;
|
uint32_t *dynamicRange;
|
||||||
ROI *detectorRoi;
|
ROI *detectorRoi;
|
||||||
@ -112,6 +115,7 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
uint64_t *fileIndex;
|
uint64_t *fileIndex;
|
||||||
bool flipRows;
|
bool flipRows;
|
||||||
std::map<std::string, std::string> additionalJsonHeader;
|
std::map<std::string, std::string> additionalJsonHeader;
|
||||||
|
bool vetoThread{false};
|
||||||
|
|
||||||
/** Used by streamer thread to update local copy (reduce number of locks
|
/** Used by streamer thread to update local copy (reduce number of locks
|
||||||
* during streaming) */
|
* during streaming) */
|
||||||
@ -132,6 +136,10 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
xy numPorts{1, 1};
|
xy numPorts{1, 1};
|
||||||
bool *quadEnable;
|
bool *quadEnable;
|
||||||
uint64_t *totalNumFrames;
|
uint64_t *totalNumFrames;
|
||||||
|
|
||||||
|
size_t fifoBunchSize{0};
|
||||||
|
/** size in memory including headers */
|
||||||
|
size_t fifoBunchSizeBytes{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sls
|
} // namespace sls
|
||||||
|
@ -7,15 +7,12 @@
|
|||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
namespace sls {
|
|
||||||
|
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
#include "H5Cpp.h"
|
#include "H5Cpp.h"
|
||||||
#ifndef H5_NO_NAMESPACE
|
|
||||||
using namespace H5;
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
struct MasterAttributes;
|
struct MasterAttributes;
|
||||||
|
|
||||||
class File : private virtual slsDetectorDefs {
|
class File : private virtual slsDetectorDefs {
|
||||||
@ -28,11 +25,11 @@ class File : private virtual slsDetectorDefs {
|
|||||||
virtual void CloseFile() = 0;
|
virtual void CloseFile() = 0;
|
||||||
|
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
virtual std::array<std::string, 2> GetFileAndDatasetName() const {
|
virtual std::string GetFileName() const {
|
||||||
LOG(logERROR)
|
LOG(logERROR)
|
||||||
<< "This is a generic function GetFilesInAcquisition that "
|
<< "This is a generic function GetFileName that "
|
||||||
"should be overloaded by a derived class";
|
"should be overloaded by a derived class";
|
||||||
return std::array<std::string, 2>{};
|
return std::string{};
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual uint32_t GetFilesInAcquisition() const {
|
virtual uint32_t GetFilesInAcquisition() const {
|
||||||
@ -42,24 +39,24 @@ class File : private virtual slsDetectorDefs {
|
|||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual DataType GetPDataType() const {
|
virtual H5::DataType GetPDataType() const {
|
||||||
LOG(logERROR) << "This is a generic function GetPDataType that "
|
LOG(logERROR) << "This is a generic function GetPDataType that "
|
||||||
"should be overloaded by a derived class";
|
"should be overloaded by a derived class";
|
||||||
return PredType::STD_U16LE;
|
return H5::PredType::STD_U16LE;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual std::vector<std::string> GetParameterNames() const {
|
virtual std::vector<std::string> GetParameterNames() const {
|
||||||
LOG(logERROR)
|
LOG(logERROR)
|
||||||
<< "This is a generic function GetFilesInAcquisition that "
|
<< "This is a generic function GetParameterNames that "
|
||||||
"should be overloaded by a derived class";
|
"should be overloaded by a derived class";
|
||||||
return std::vector<std::string>{};
|
return std::vector<std::string>{};
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual std::vector<DataType> GetParameterDataTypes() const {
|
virtual std::vector<H5::DataType> GetParameterDataTypes() const {
|
||||||
LOG(logERROR)
|
LOG(logERROR)
|
||||||
<< "This is a generic function GetFilesInAcquisition that "
|
<< "This is a generic function GetParameterDataTypes that "
|
||||||
"should be overloaded by a derived class";
|
"should be overloaded by a derived class";
|
||||||
return std::vector<DataType>{};
|
return std::vector<H5::DataType>{};
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void CreateFirstHDF5DataFile(
|
virtual void CreateFirstHDF5DataFile(
|
||||||
@ -70,7 +67,7 @@ class File : private virtual slsDetectorDefs {
|
|||||||
const uint32_t maxFramesPerFile, const uint64_t numImages,
|
const uint32_t maxFramesPerFile, const uint64_t numImages,
|
||||||
const uint32_t nPixelsX, const uint32_t nPixelsY,
|
const uint32_t nPixelsX, const uint32_t nPixelsY,
|
||||||
const uint32_t dynamicRange) {
|
const uint32_t dynamicRange) {
|
||||||
LOG(logERROR) << "This is a generic function CreateFirstDataFile that "
|
LOG(logERROR) << "This is a generic function CreateFirstHDF5DataFile that "
|
||||||
"should be overloaded by a derived class";
|
"should be overloaded by a derived class";
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
@ -80,7 +77,7 @@ class File : private virtual slsDetectorDefs {
|
|||||||
const bool silentMode, const int modulePos,
|
const bool silentMode, const int modulePos,
|
||||||
const int numUnitsPerReadout, const uint32_t udpPortNumber,
|
const int numUnitsPerReadout, const uint32_t udpPortNumber,
|
||||||
const uint32_t maxFramesPerFile) {
|
const uint32_t maxFramesPerFile) {
|
||||||
LOG(logERROR) << "This is a generic function CreateFirstDataFile that "
|
LOG(logERROR) << "This is a generic function CreateFirstBinaryDataFile that "
|
||||||
"should be overloaded by a derived class";
|
"should be overloaded by a derived class";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -65,6 +65,7 @@ class GeneralData {
|
|||||||
uint32_t adcEnableMaskTenGiga{BIT32_MASK};
|
uint32_t adcEnableMaskTenGiga{BIT32_MASK};
|
||||||
slsDetectorDefs::ROI roi{};
|
slsDetectorDefs::ROI roi{};
|
||||||
uint32_t counterMask{0};
|
uint32_t counterMask{0};
|
||||||
|
uint32_t defaultBunchSize{1};
|
||||||
|
|
||||||
GeneralData(){};
|
GeneralData(){};
|
||||||
virtual ~GeneralData(){};
|
virtual ~GeneralData(){};
|
||||||
@ -445,10 +446,11 @@ class Gotthard2Data : public GeneralData {
|
|||||||
maxFramesPerFile = GOTTHARD2_MAX_FRAMES_PER_FILE;
|
maxFramesPerFile = GOTTHARD2_MAX_FRAMES_PER_FILE;
|
||||||
fifoBufferHeaderSize =
|
fifoBufferHeaderSize =
|
||||||
FIFO_HEADER_NUMBYTES + sizeof(slsDetectorDefs::sls_receiver_header);
|
FIFO_HEADER_NUMBYTES + sizeof(slsDetectorDefs::sls_receiver_header);
|
||||||
defaultFifoDepth = 50000;
|
defaultFifoDepth = 50;
|
||||||
standardheader = true;
|
standardheader = true;
|
||||||
vetoDataSize = 160;
|
vetoDataSize = 160;
|
||||||
vetoHsize = 16;
|
vetoHsize = 16;
|
||||||
|
defaultBunchSize = 10000;
|
||||||
UpdateImageSize();
|
UpdateImageSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -26,44 +26,44 @@ HDF5DataFile::HDF5DataFile(int index, std::mutex *hdf5Lib)
|
|||||||
"detector header version",
|
"detector header version",
|
||||||
"packets caught bit mask",
|
"packets caught bit mask",
|
||||||
};
|
};
|
||||||
StrType strdatatype(PredType::C_S1, sizeof(bitset_storage));
|
H5::StrType strdatatype(H5::PredType::C_S1, sizeof(bitset_storage));
|
||||||
parameterDataTypes_ = std::vector<DataType>{
|
parameterDataTypes_ = std::vector<H5::DataType>{
|
||||||
PredType::STD_U64LE, PredType::STD_U32LE, PredType::STD_U32LE,
|
H5::PredType::STD_U64LE, H5::PredType::STD_U32LE, H5::PredType::STD_U32LE,
|
||||||
PredType::STD_U64LE, PredType::STD_U64LE, PredType::STD_U16LE,
|
H5::PredType::STD_U64LE, H5::PredType::STD_U64LE, H5::PredType::STD_U16LE,
|
||||||
PredType::STD_U16LE, PredType::STD_U16LE, PredType::STD_U16LE,
|
H5::PredType::STD_U16LE, H5::PredType::STD_U16LE, H5::PredType::STD_U16LE,
|
||||||
PredType::STD_U32LE, PredType::STD_U16LE, PredType::STD_U8LE,
|
H5::PredType::STD_U32LE, H5::PredType::STD_U16LE, H5::PredType::STD_U8LE,
|
||||||
PredType::STD_U8LE, strdatatype};
|
H5::PredType::STD_U8LE, strdatatype};
|
||||||
}
|
}
|
||||||
|
|
||||||
HDF5DataFile::~HDF5DataFile() { CloseFile(); }
|
HDF5DataFile::~HDF5DataFile() { CloseFile(); }
|
||||||
|
|
||||||
std::array<std::string, 2> HDF5DataFile::GetFileAndDatasetName() const {
|
std::string HDF5DataFile::GetFileName() const {
|
||||||
return std::array<std::string, 2>{fileName_, dataSetName_};
|
return fileName_;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t HDF5DataFile::GetFilesInAcquisition() const {
|
uint32_t HDF5DataFile::GetFilesInAcquisition() const {
|
||||||
return numFilesInAcquisition_;
|
return numFilesInAcquisition_;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataType HDF5DataFile::GetPDataType() const { return dataType_; }
|
H5::DataType HDF5DataFile::GetPDataType() const { return dataType_; }
|
||||||
|
|
||||||
std::vector<std::string> HDF5DataFile::GetParameterNames() const {
|
std::vector<std::string> HDF5DataFile::GetParameterNames() const {
|
||||||
return parameterNames_;
|
return parameterNames_;
|
||||||
}
|
}
|
||||||
std::vector<DataType> HDF5DataFile::GetParameterDataTypes() const {
|
std::vector<H5::DataType> HDF5DataFile::GetParameterDataTypes() const {
|
||||||
return parameterDataTypes_;
|
return parameterDataTypes_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HDF5DataFile::CloseFile() {
|
void HDF5DataFile::CloseFile() {
|
||||||
std::lock_guard<std::mutex> lock(*hdf5Lib_);
|
std::lock_guard<std::mutex> lock(*hdf5Lib_);
|
||||||
try {
|
try {
|
||||||
Exception::dontPrint(); // to handle errors
|
H5::Exception::dontPrint(); // to handle errors
|
||||||
if (fd_) {
|
if (fd_) {
|
||||||
fd_->close();
|
fd_->close();
|
||||||
delete fd_;
|
delete fd_;
|
||||||
fd_ = nullptr;
|
fd_ = nullptr;
|
||||||
}
|
}
|
||||||
} catch (const Exception &error) {
|
} catch (const H5::Exception &error) {
|
||||||
LOG(logERROR) << "Could not close data HDF5 handles of index "
|
LOG(logERROR) << "Could not close data HDF5 handles of index "
|
||||||
<< index_;
|
<< index_;
|
||||||
error.printErrorStack();
|
error.printErrorStack();
|
||||||
@ -116,13 +116,13 @@ void HDF5DataFile::CreateFirstHDF5DataFile(
|
|||||||
switch (dynamicRange_) {
|
switch (dynamicRange_) {
|
||||||
case 12:
|
case 12:
|
||||||
case 16:
|
case 16:
|
||||||
dataType_ = PredType::STD_U16LE;
|
dataType_ = H5::PredType::STD_U16LE;
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
dataType_ = PredType::STD_U32LE;
|
dataType_ = H5::PredType::STD_U32LE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dataType_ = PredType::STD_U8LE;
|
dataType_ = H5::PredType::STD_U8LE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,42 +153,35 @@ void HDF5DataFile::CreateFile() {
|
|||||||
uint32_t nDimz = ((dynamicRange_ == 4) ? (nPixelsX_ / 2) : nPixelsX_);
|
uint32_t nDimz = ((dynamicRange_ == 4) ? (nPixelsX_ / 2) : nPixelsX_);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Exception::dontPrint(); // to handle errors
|
H5::Exception::dontPrint(); // to handle errors
|
||||||
|
|
||||||
// file
|
// file
|
||||||
FileAccPropList fapl;
|
H5::FileAccPropList fapl;
|
||||||
fapl.setFcloseDegree(H5F_CLOSE_STRONG);
|
fapl.setFcloseDegree(H5F_CLOSE_STRONG);
|
||||||
fd_ = nullptr;
|
fd_ = nullptr;
|
||||||
if (!overWriteEnable_)
|
if (!overWriteEnable_)
|
||||||
fd_ = new H5File(fileName_.c_str(), H5F_ACC_EXCL,
|
fd_ = new H5::H5File(fileName_.c_str(), H5F_ACC_EXCL,
|
||||||
FileCreatPropList::DEFAULT, fapl);
|
H5::FileCreatPropList::DEFAULT, fapl);
|
||||||
else
|
else
|
||||||
fd_ = new H5File(fileName_.c_str(), H5F_ACC_TRUNC,
|
fd_ = new H5::H5File(fileName_.c_str(), H5F_ACC_TRUNC,
|
||||||
FileCreatPropList::DEFAULT, fapl);
|
H5::FileCreatPropList::DEFAULT, fapl);
|
||||||
|
|
||||||
// attributes - version
|
// attributes - version
|
||||||
double dValue = HDF5_WRITER_VERSION;
|
double dValue = HDF5_WRITER_VERSION;
|
||||||
DataSpace dataspace_attr = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace_attr = H5::DataSpace(H5S_SCALAR);
|
||||||
Attribute attribute = fd_->createAttribute(
|
H5::Attribute attribute = fd_->createAttribute(
|
||||||
"version", PredType::NATIVE_DOUBLE, dataspace_attr);
|
"version", H5::PredType::NATIVE_DOUBLE, dataspace_attr);
|
||||||
attribute.write(PredType::NATIVE_DOUBLE, &dValue);
|
attribute.write(H5::PredType::NATIVE_DOUBLE, &dValue);
|
||||||
|
|
||||||
// dataspace
|
// dataspace
|
||||||
hsize_t srcdims[3] = {nDimx, nDimy, nDimz};
|
hsize_t srcdims[3] = {nDimx, nDimy, nDimz};
|
||||||
hsize_t srcdimsmax[3] = {H5S_UNLIMITED, nDimy, nDimz};
|
hsize_t srcdimsmax[3] = {H5S_UNLIMITED, nDimy, nDimz};
|
||||||
dataSpace_ = nullptr;
|
dataSpace_ = nullptr;
|
||||||
dataSpace_ = new DataSpace(3, srcdims, srcdimsmax);
|
dataSpace_ = new H5::DataSpace(3, srcdims, srcdimsmax);
|
||||||
|
|
||||||
// dataset name
|
|
||||||
std::ostringstream osfn;
|
|
||||||
osfn << "/data";
|
|
||||||
if (numImages_ > 1)
|
|
||||||
osfn << "_f" << std::setfill('0') << std::setw(12) << subFileIndex_;
|
|
||||||
dataSetName_ = osfn.str();
|
|
||||||
|
|
||||||
// dataset
|
// dataset
|
||||||
// fill value
|
// fill value
|
||||||
DSetCreatPropList plist;
|
H5::DSetCreatPropList plist;
|
||||||
int fill_value = -1;
|
int fill_value = -1;
|
||||||
plist.setFillValue(dataType_, &fill_value);
|
plist.setFillValue(dataType_, &fill_value);
|
||||||
// always create chunked dataset as unlimited is only
|
// always create chunked dataset as unlimited is only
|
||||||
@ -196,28 +189,28 @@ void HDF5DataFile::CreateFile() {
|
|||||||
hsize_t chunk_dims[3] = {MAX_CHUNKED_IMAGES, nDimy, nDimz};
|
hsize_t chunk_dims[3] = {MAX_CHUNKED_IMAGES, nDimy, nDimz};
|
||||||
plist.setChunk(3, chunk_dims);
|
plist.setChunk(3, chunk_dims);
|
||||||
dataSet_ = nullptr;
|
dataSet_ = nullptr;
|
||||||
dataSet_ = new DataSet(fd_->createDataSet(
|
dataSet_ = new H5::DataSet(fd_->createDataSet(
|
||||||
dataSetName_.c_str(), dataType_, *dataSpace_, plist));
|
DATASET_NAME, dataType_, *dataSpace_, plist));
|
||||||
|
|
||||||
// create parameter datasets
|
// create parameter datasets
|
||||||
hsize_t dims[1] = {nDimx};
|
hsize_t dims[1] = {nDimx};
|
||||||
hsize_t dimsmax[1] = {H5S_UNLIMITED};
|
hsize_t dimsmax[1] = {H5S_UNLIMITED};
|
||||||
dataSpacePara_ = nullptr;
|
dataSpacePara_ = nullptr;
|
||||||
dataSpacePara_ = new DataSpace(1, dims, dimsmax);
|
dataSpacePara_ = new H5::DataSpace(1, dims, dimsmax);
|
||||||
|
|
||||||
// always create chunked dataset as unlimited is only
|
// always create chunked dataset as unlimited is only
|
||||||
// supported with chunked layout
|
// supported with chunked layout
|
||||||
DSetCreatPropList paralist;
|
H5::DSetCreatPropList paralist;
|
||||||
hsize_t chunkpara_dims[3] = {MAX_CHUNKED_IMAGES};
|
hsize_t chunkpara_dims[3] = {MAX_CHUNKED_IMAGES};
|
||||||
paralist.setChunk(1, chunkpara_dims);
|
paralist.setChunk(1, chunkpara_dims);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < parameterNames_.size(); ++i) {
|
for (unsigned int i = 0; i < parameterNames_.size(); ++i) {
|
||||||
DataSet *ds = new DataSet(fd_->createDataSet(
|
H5::DataSet *ds = new H5::DataSet(fd_->createDataSet(
|
||||||
parameterNames_[i].c_str(), parameterDataTypes_[i],
|
parameterNames_[i].c_str(), parameterDataTypes_[i],
|
||||||
*dataSpacePara_, paralist));
|
*dataSpacePara_, paralist));
|
||||||
dataSetPara_.push_back(ds);
|
dataSetPara_.push_back(ds);
|
||||||
}
|
}
|
||||||
} catch (const Exception &error) {
|
} catch (const H5::Exception &error) {
|
||||||
error.printErrorStack();
|
error.printErrorStack();
|
||||||
CloseFile();
|
CloseFile();
|
||||||
throw RuntimeError("Could not create HDF5 handles in object " +
|
throw RuntimeError("Could not create HDF5 handles in object " +
|
||||||
@ -287,16 +280,16 @@ void HDF5DataFile::WriteDataFile(const uint64_t currentFrameNumber,
|
|||||||
hsize_t start[3] = {nDimx, 0, 0};
|
hsize_t start[3] = {nDimx, 0, 0};
|
||||||
hsize_t dims2[2] = {nDimy, nDimz};
|
hsize_t dims2[2] = {nDimy, nDimz};
|
||||||
try {
|
try {
|
||||||
Exception::dontPrint(); // to handle errors
|
H5::Exception::dontPrint(); // to handle errors
|
||||||
|
|
||||||
dataSpace_->selectHyperslab(H5S_SELECT_SET, count, start);
|
dataSpace_->selectHyperslab(H5S_SELECT_SET, count, start);
|
||||||
DataSpace memspace(2, dims2);
|
H5::DataSpace memspace(2, dims2);
|
||||||
dataSet_->write(revBuffer, dataType_, memspace, *dataSpace_);
|
dataSet_->write(revBuffer, dataType_, memspace, *dataSpace_);
|
||||||
memspace.close();
|
memspace.close();
|
||||||
if (dynamicRange_ == 12) {
|
if (dynamicRange_ == 12) {
|
||||||
free(revBuffer);
|
free(revBuffer);
|
||||||
}
|
}
|
||||||
} catch (const Exception &error) {
|
} catch (const H5::Exception &error) {
|
||||||
if (dynamicRange_ == 12) {
|
if (dynamicRange_ == 12) {
|
||||||
free(revBuffer);
|
free(revBuffer);
|
||||||
}
|
}
|
||||||
@ -320,9 +313,9 @@ void HDF5DataFile::WriteParameterDatasets(const uint64_t currentFrameNumber,
|
|||||||
hsize_t start[1] = {fnum};
|
hsize_t start[1] = {fnum};
|
||||||
int i = 0;
|
int i = 0;
|
||||||
try {
|
try {
|
||||||
Exception::dontPrint(); // to handle errors
|
H5::Exception::dontPrint(); // to handle errors
|
||||||
dataSpacePara_->selectHyperslab(H5S_SELECT_SET, count, start);
|
dataSpacePara_->selectHyperslab(H5S_SELECT_SET, count, start);
|
||||||
DataSpace memspace(H5S_SCALAR);
|
H5::DataSpace memspace(H5S_SCALAR);
|
||||||
dataSetPara_[0]->write(&header.frameNumber, parameterDataTypes_[0],
|
dataSetPara_[0]->write(&header.frameNumber, parameterDataTypes_[0],
|
||||||
memspace, *dataSpacePara_);
|
memspace, *dataSpacePara_);
|
||||||
i = 1;
|
i = 1;
|
||||||
@ -383,7 +376,7 @@ void HDF5DataFile::WriteParameterDatasets(const uint64_t currentFrameNumber,
|
|||||||
memspace, *dataSpacePara_);
|
memspace, *dataSpacePara_);
|
||||||
}
|
}
|
||||||
i = 14;
|
i = 14;
|
||||||
} catch (const Exception &error) {
|
} catch (const H5::Exception &error) {
|
||||||
error.printErrorStack();
|
error.printErrorStack();
|
||||||
throw RuntimeError(
|
throw RuntimeError(
|
||||||
"Could not write parameters (index:" + std::to_string(i) +
|
"Could not write parameters (index:" + std::to_string(i) +
|
||||||
@ -395,7 +388,7 @@ void HDF5DataFile::ExtendDataset() {
|
|||||||
std::lock_guard<std::mutex> lock(*hdf5Lib_);
|
std::lock_guard<std::mutex> lock(*hdf5Lib_);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Exception::dontPrint(); // to handle errors
|
H5::Exception::dontPrint(); // to handle errors
|
||||||
|
|
||||||
hsize_t dims[3];
|
hsize_t dims[3];
|
||||||
dataSpace_->getSimpleExtentDims(dims);
|
dataSpace_->getSimpleExtentDims(dims);
|
||||||
@ -404,16 +397,16 @@ void HDF5DataFile::ExtendDataset() {
|
|||||||
dataSet_->extend(dims);
|
dataSet_->extend(dims);
|
||||||
delete dataSpace_;
|
delete dataSpace_;
|
||||||
dataSpace_ = nullptr;
|
dataSpace_ = nullptr;
|
||||||
dataSpace_ = new DataSpace(dataSet_->getSpace());
|
dataSpace_ = new H5::DataSpace(dataSet_->getSpace());
|
||||||
|
|
||||||
hsize_t dims_para[1] = {dims[0]};
|
hsize_t dims_para[1] = {dims[0]};
|
||||||
for (unsigned int i = 0; i < dataSetPara_.size(); ++i)
|
for (unsigned int i = 0; i < dataSetPara_.size(); ++i)
|
||||||
dataSetPara_[i]->extend(dims_para);
|
dataSetPara_[i]->extend(dims_para);
|
||||||
delete dataSpacePara_;
|
delete dataSpacePara_;
|
||||||
dataSpacePara_ = nullptr;
|
dataSpacePara_ = nullptr;
|
||||||
dataSpacePara_ = new DataSpace(dataSetPara_[0]->getSpace());
|
dataSpacePara_ = new H5::DataSpace(dataSetPara_[0]->getSpace());
|
||||||
|
|
||||||
} catch (const Exception &error) {
|
} catch (const H5::Exception &error) {
|
||||||
error.printErrorStack();
|
error.printErrorStack();
|
||||||
throw RuntimeError("Could not extend dataset in object " +
|
throw RuntimeError("Could not extend dataset in object " +
|
||||||
std::to_string(index_));
|
std::to_string(index_));
|
||||||
|
@ -14,11 +14,11 @@ class HDF5DataFile : private virtual slsDetectorDefs, public File {
|
|||||||
HDF5DataFile(const int index, std::mutex *hdf5Lib);
|
HDF5DataFile(const int index, std::mutex *hdf5Lib);
|
||||||
~HDF5DataFile();
|
~HDF5DataFile();
|
||||||
|
|
||||||
std::array<std::string, 2> GetFileAndDatasetName() const override;
|
std::string GetFileName() const override;
|
||||||
uint32_t GetFilesInAcquisition() const override;
|
uint32_t GetFilesInAcquisition() const override;
|
||||||
DataType GetPDataType() const override;
|
H5::DataType GetPDataType() const override;
|
||||||
std::vector<std::string> GetParameterNames() const override;
|
std::vector<std::string> GetParameterNames() const override;
|
||||||
std::vector<DataType> GetParameterDataTypes() const override;
|
std::vector<H5::DataType> GetParameterDataTypes() const override;
|
||||||
|
|
||||||
void CloseFile() override;
|
void CloseFile() override;
|
||||||
|
|
||||||
@ -45,17 +45,17 @@ class HDF5DataFile : private virtual slsDetectorDefs, public File {
|
|||||||
|
|
||||||
int index_;
|
int index_;
|
||||||
std::mutex *hdf5Lib_;
|
std::mutex *hdf5Lib_;
|
||||||
H5File *fd_{nullptr};
|
H5::H5File *fd_{nullptr};
|
||||||
std::string fileName_;
|
std::string fileName_;
|
||||||
std::string dataSetName_;
|
std::string dataSetName_;
|
||||||
DataSpace *dataSpace_{nullptr};
|
H5::DataSpace *dataSpace_{nullptr};
|
||||||
DataSet *dataSet_{nullptr};
|
H5::DataSet *dataSet_{nullptr};
|
||||||
DataType dataType_{PredType::STD_U16LE};
|
H5::DataType dataType_{H5::PredType::STD_U16LE};
|
||||||
|
|
||||||
DataSpace *dataSpacePara_{nullptr};
|
H5::DataSpace *dataSpacePara_{nullptr};
|
||||||
std::vector<DataSet *> dataSetPara_{nullptr};
|
std::vector<H5::DataSet *> dataSetPara_{nullptr};
|
||||||
std::vector<std::string> parameterNames_;
|
std::vector<std::string> parameterNames_;
|
||||||
std::vector<DataType> parameterDataTypes_;
|
std::vector<H5::DataType> parameterDataTypes_;
|
||||||
|
|
||||||
uint32_t subFileIndex_{0};
|
uint32_t subFileIndex_{0};
|
||||||
uint32_t numFramesInFile_{0};
|
uint32_t numFramesInFile_{0};
|
||||||
|
@ -67,16 +67,17 @@ void Implementation::SetThreadPriorities() {
|
|||||||
void Implementation::SetupFifoStructure() {
|
void Implementation::SetupFifoStructure() {
|
||||||
fifo.clear();
|
fifo.clear();
|
||||||
for (int i = 0; i < numUDPInterfaces; ++i) {
|
for (int i = 0; i < numUDPInterfaces; ++i) {
|
||||||
uint32_t datasize = generalData->imageSize;
|
size_t datasize = generalData->imageSize;
|
||||||
// veto data size
|
// veto data size
|
||||||
if (detType == GOTTHARD2 && i != 0) {
|
if (detType == GOTTHARD2 && i != 0) {
|
||||||
datasize = generalData->vetoImageSize;
|
datasize = generalData->vetoImageSize;
|
||||||
}
|
}
|
||||||
|
datasize += generalData->fifoBufferHeaderSize;
|
||||||
|
datasize *= bunchSize;
|
||||||
|
|
||||||
// create fifo structure
|
// create fifo structure
|
||||||
try {
|
try {
|
||||||
fifo.push_back(sls::make_unique<Fifo>(
|
fifo.push_back(sls::make_unique<Fifo>(i, datasize, fifoDepth));
|
||||||
i, datasize + (generalData->fifoBufferHeaderSize), fifoDepth));
|
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
fifo.clear();
|
fifo.clear();
|
||||||
fifoDepth = 0;
|
fifoDepth = 0;
|
||||||
@ -93,9 +94,7 @@ void Implementation::SetupFifoStructure() {
|
|||||||
dataStreamer[i]->SetFifo(fifo[i].get());
|
dataStreamer[i]->SetFifo(fifo[i].get());
|
||||||
|
|
||||||
LOG(logINFO) << "Memory Allocated for Fifo " << i << ": "
|
LOG(logINFO) << "Memory Allocated for Fifo " << i << ": "
|
||||||
<< (double)(((size_t)(datasize) +
|
<< (double)(datasize * (size_t)fifoDepth) /
|
||||||
(size_t)(generalData->fifoBufferHeaderSize)) *
|
|
||||||
(size_t)fifoDepth) /
|
|
||||||
(double)(1024 * 1024)
|
(double)(1024 * 1024)
|
||||||
<< " MB";
|
<< " MB";
|
||||||
}
|
}
|
||||||
@ -169,6 +168,7 @@ void Implementation::setDetectorType(const detectorType d) {
|
|||||||
adcEnableMaskTenGiga = generalData->adcEnableMaskTenGiga;
|
adcEnableMaskTenGiga = generalData->adcEnableMaskTenGiga;
|
||||||
detectorRoi = generalData->roi;
|
detectorRoi = generalData->roi;
|
||||||
counterMask = generalData->counterMask;
|
counterMask = generalData->counterMask;
|
||||||
|
bunchSize = generalData->defaultBunchSize;
|
||||||
|
|
||||||
SetLocalNetworkParameters();
|
SetLocalNetworkParameters();
|
||||||
SetupFifoStructure();
|
SetupFifoStructure();
|
||||||
@ -204,10 +204,12 @@ void Implementation::setDetectorType(const detectorType d) {
|
|||||||
for (const auto &it : listener) {
|
for (const auto &it : listener) {
|
||||||
it->SetGeneralData(generalData);
|
it->SetGeneralData(generalData);
|
||||||
it->SetActivate(activated);
|
it->SetActivate(activated);
|
||||||
|
it->SetBunchSize(bunchSize);
|
||||||
}
|
}
|
||||||
for (const auto &it : dataProcessor) {
|
for (const auto &it : dataProcessor) {
|
||||||
it->SetGeneralData(generalData);
|
it->SetGeneralData(generalData);
|
||||||
it->SetActivate(activated);
|
it->SetActivate(activated);
|
||||||
|
it->SetBunchSize(bunchSize);
|
||||||
}
|
}
|
||||||
SetThreadPriorities();
|
SetThreadPriorities();
|
||||||
|
|
||||||
@ -453,6 +455,22 @@ void Implementation::setReceiverROIMetadata(const ROI arg) {
|
|||||||
LOG(logINFO) << "receiver roi Metadata: " << ToString(receiverRoiMetadata);
|
LOG(logINFO) << "receiver roi Metadata: " << ToString(receiverRoiMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t Implementation::getBunchSize() const { return bunchSize; }
|
||||||
|
|
||||||
|
void Implementation::setBunchSize(const size_t i) {
|
||||||
|
if (bunchSize != i) {
|
||||||
|
bunchSize = i;
|
||||||
|
for (const auto &it : listener)
|
||||||
|
it->SetBunchSize(i);
|
||||||
|
for (const auto &it : dataProcessor)
|
||||||
|
it->SetBunchSize(i);
|
||||||
|
for (const auto &it : dataStreamer)
|
||||||
|
it->SetBunchSize(i);
|
||||||
|
SetupFifoStructure();
|
||||||
|
}
|
||||||
|
LOG(logINFO) << "Fifo Bunch Size: " << i;
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
* File Parameters *
|
* File Parameters *
|
||||||
@ -675,12 +693,15 @@ void Implementation::stopReceiver() {
|
|||||||
while (running) {
|
while (running) {
|
||||||
running = false;
|
running = false;
|
||||||
for (const auto &it : listener)
|
for (const auto &it : listener)
|
||||||
if (it->IsRunning())
|
if (it->IsRunning()) {
|
||||||
running = true;
|
running = true;
|
||||||
|
//LOG(logINFOBLUE) << "listener NOT done";
|
||||||
|
}
|
||||||
for (const auto &it : dataProcessor)
|
for (const auto &it : dataProcessor)
|
||||||
if (it->IsRunning())
|
if (it->IsRunning()) {
|
||||||
running = true;
|
running = true;
|
||||||
|
//LOG(logINFOBLUE) << "processor NOT done";
|
||||||
|
}
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(5));
|
std::this_thread::sleep_for(std::chrono::milliseconds(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -915,11 +936,11 @@ void Implementation::StartMasterWriter() {
|
|||||||
}
|
}
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
if (fileFormatType == HDF5) {
|
if (fileFormatType == HDF5) {
|
||||||
std::array<std::string, 2> virtualFileAndDatasetNames;
|
std::string virtualFileName;
|
||||||
// create virtual hdf5 file (if multiple files)
|
// create virtual hdf5 file (if multiple files)
|
||||||
if (dataProcessor[0]->GetFilesInAcquisition() > 1 ||
|
if (dataProcessor[0]->GetFilesInAcquisition() > 1 ||
|
||||||
(numPorts.x * numPorts.y) > 1) {
|
(numPorts.x * numPorts.y) > 1) {
|
||||||
virtualFileAndDatasetNames =
|
virtualFileName =
|
||||||
dataProcessor[0]->CreateVirtualFile(
|
dataProcessor[0]->CreateVirtualFile(
|
||||||
filePath, fileName, fileIndex, overwriteEnable,
|
filePath, fileName, fileIndex, overwriteEnable,
|
||||||
silentMode, modulePos, numUDPInterfaces, framesPerFile,
|
silentMode, modulePos, numUDPInterfaces, framesPerFile,
|
||||||
@ -929,8 +950,7 @@ void Implementation::StartMasterWriter() {
|
|||||||
// link file in master
|
// link file in master
|
||||||
if (masterFileWriteEnable) {
|
if (masterFileWriteEnable) {
|
||||||
dataProcessor[0]->LinkFileInMaster(
|
dataProcessor[0]->LinkFileInMaster(
|
||||||
masterFileName, virtualFileAndDatasetNames[0],
|
masterFileName, virtualFileName, silentMode, &hdf5LibMutex);
|
||||||
virtualFileAndDatasetNames[1], silentMode, &hdf5LibMutex);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1003,6 +1023,7 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
|||||||
&silentMode));
|
&silentMode));
|
||||||
listener[i]->SetGeneralData(generalData);
|
listener[i]->SetGeneralData(generalData);
|
||||||
listener[i]->SetActivate(activated);
|
listener[i]->SetActivate(activated);
|
||||||
|
listener[i]->SetBunchSize(bunchSize);
|
||||||
|
|
||||||
int ctbAnalogDataBytes = 0;
|
int ctbAnalogDataBytes = 0;
|
||||||
if (detType == CHIPTESTBOARD) {
|
if (detType == CHIPTESTBOARD) {
|
||||||
@ -1017,6 +1038,7 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
|||||||
dataProcessor[i]->SetGeneralData(generalData);
|
dataProcessor[i]->SetGeneralData(generalData);
|
||||||
dataProcessor[i]->SetActivate(activated);
|
dataProcessor[i]->SetActivate(activated);
|
||||||
dataProcessor[i]->SetReceiverROI(portRois[i]);
|
dataProcessor[i]->SetReceiverROI(portRois[i]);
|
||||||
|
dataProcessor[i]->SetBunchSize(bunchSize);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
listener.clear();
|
listener.clear();
|
||||||
dataProcessor.clear();
|
dataProcessor.clear();
|
||||||
@ -1032,7 +1054,7 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
|||||||
flip = (i == 1 ? true : false);
|
flip = (i == 1 ? true : false);
|
||||||
}
|
}
|
||||||
dataStreamer.push_back(sls::make_unique<DataStreamer>(
|
dataStreamer.push_back(sls::make_unique<DataStreamer>(
|
||||||
i, fifo[i].get(), &dynamicRange, &detectorRoi,
|
i, detType, fifo[i].get(), &dynamicRange, &detectorRoi,
|
||||||
&fileIndex, flip, numPorts, &quadEnable,
|
&fileIndex, flip, numPorts, &quadEnable,
|
||||||
&numberOfTotalFrames));
|
&numberOfTotalFrames));
|
||||||
dataStreamer[i]->SetGeneralData(generalData);
|
dataStreamer[i]->SetGeneralData(generalData);
|
||||||
@ -1041,6 +1063,7 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
|||||||
streamingHwm);
|
streamingHwm);
|
||||||
dataStreamer[i]->SetAdditionalJsonHeader(
|
dataStreamer[i]->SetAdditionalJsonHeader(
|
||||||
additionalJsonHeader);
|
additionalJsonHeader);
|
||||||
|
dataStreamer[i]->SetBunchSize(bunchSize);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
if (dataStreamEnable) {
|
if (dataStreamEnable) {
|
||||||
dataStreamer.clear();
|
dataStreamer.clear();
|
||||||
@ -1159,7 +1182,7 @@ void Implementation::setDataStreamEnable(const bool enable) {
|
|||||||
flip = (i == 1 ? true : false);
|
flip = (i == 1 ? true : false);
|
||||||
}
|
}
|
||||||
dataStreamer.push_back(sls::make_unique<DataStreamer>(
|
dataStreamer.push_back(sls::make_unique<DataStreamer>(
|
||||||
i, fifo[i].get(), &dynamicRange, &detectorRoi,
|
i, detType, fifo[i].get(), &dynamicRange, &detectorRoi,
|
||||||
&fileIndex, flip, numPorts, &quadEnable,
|
&fileIndex, flip, numPorts, &quadEnable,
|
||||||
&numberOfTotalFrames));
|
&numberOfTotalFrames));
|
||||||
dataStreamer[i]->SetGeneralData(generalData);
|
dataStreamer[i]->SetGeneralData(generalData);
|
||||||
@ -1168,6 +1191,7 @@ void Implementation::setDataStreamEnable(const bool enable) {
|
|||||||
streamingHwm);
|
streamingHwm);
|
||||||
dataStreamer[i]->SetAdditionalJsonHeader(
|
dataStreamer[i]->SetAdditionalJsonHeader(
|
||||||
additionalJsonHeader);
|
additionalJsonHeader);
|
||||||
|
dataStreamer[i]->SetBunchSize(bunchSize);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
dataStreamer.clear();
|
dataStreamer.clear();
|
||||||
dataStreamEnable = false;
|
dataStreamEnable = false;
|
||||||
|
@ -59,6 +59,8 @@ class Implementation : private virtual slsDetectorDefs {
|
|||||||
ROI getReceiverROI() const;
|
ROI getReceiverROI() const;
|
||||||
void setReceiverROI(const ROI arg);
|
void setReceiverROI(const ROI arg);
|
||||||
void setReceiverROIMetadata(const ROI arg);
|
void setReceiverROIMetadata(const ROI arg);
|
||||||
|
size_t getBunchSize() const;
|
||||||
|
void setBunchSize(const size_t i);
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
@ -311,6 +313,7 @@ class Implementation : private virtual slsDetectorDefs {
|
|||||||
std::array<ROI, 2> portRois{};
|
std::array<ROI, 2> portRois{};
|
||||||
// receiver roi for complete detector for metadata
|
// receiver roi for complete detector for metadata
|
||||||
ROI receiverRoiMetadata{};
|
ROI receiverRoiMetadata{};
|
||||||
|
size_t bunchSize{0};
|
||||||
|
|
||||||
// file parameters
|
// file parameters
|
||||||
fileFormat fileFormatType{BINARY};
|
fileFormat fileFormatType{BINARY};
|
||||||
|
@ -32,6 +32,7 @@ Listener::Listener(int ind, detectorType dtype, Fifo *f,
|
|||||||
actualUDPSocketBufferSize(as), framesPerFile(fpf), frameDiscardMode(fdp),
|
actualUDPSocketBufferSize(as), framesPerFile(fpf), frameDiscardMode(fdp),
|
||||||
detectorDataStream(detds), silentMode(sm) {
|
detectorDataStream(detds), silentMode(sm) {
|
||||||
LOG(logDEBUG) << "Listener " << ind << " created";
|
LOG(logDEBUG) << "Listener " << ind << " created";
|
||||||
|
vetoThread = (myDetectorType == GOTTHARD2 && index != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Listener::~Listener() = default;
|
Listener::~Listener() = default;
|
||||||
@ -85,7 +86,7 @@ void Listener::ResetParametersforNewAcquisition() {
|
|||||||
lastCaughtFrameIndex = 0;
|
lastCaughtFrameIndex = 0;
|
||||||
carryOverFlag = false;
|
carryOverFlag = false;
|
||||||
uint32_t packetSize = generalData->packetSize;
|
uint32_t packetSize = generalData->packetSize;
|
||||||
if (myDetectorType == GOTTHARD2 && index != 0) {
|
if (vetoThread) {
|
||||||
packetSize = generalData->vetoPacketSize;
|
packetSize = generalData->vetoPacketSize;
|
||||||
}
|
}
|
||||||
carryOverPacket = make_unique<char[]>(packetSize);
|
carryOverPacket = make_unique<char[]>(packetSize);
|
||||||
@ -98,6 +99,12 @@ void Listener::ResetParametersforNewAcquisition() {
|
|||||||
// reset fifo statistic
|
// reset fifo statistic
|
||||||
fifo->GetMaxLevelForFifoBound();
|
fifo->GetMaxLevelForFifoBound();
|
||||||
fifo->GetMinLevelForFifoFree();
|
fifo->GetMinLevelForFifoFree();
|
||||||
|
|
||||||
|
fifoBunchSizeBytes = generalData->imageSize;
|
||||||
|
if (vetoThread) {
|
||||||
|
fifoBunchSizeBytes = generalData->vetoDataSize;
|
||||||
|
}
|
||||||
|
fifoBunchSizeBytes += generalData->fifoBufferHeaderSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Listener::RecordFirstIndex(uint64_t fnum) {
|
void Listener::RecordFirstIndex(uint64_t fnum) {
|
||||||
@ -119,6 +126,10 @@ void Listener::SetGeneralData(GeneralData *g) { generalData = g; }
|
|||||||
|
|
||||||
void Listener::SetActivate(bool enable) { activated = enable; }
|
void Listener::SetActivate(bool enable) { activated = enable; }
|
||||||
|
|
||||||
|
void Listener::SetBunchSize(size_t value) {
|
||||||
|
fifoBunchSize = value;
|
||||||
|
}
|
||||||
|
|
||||||
void Listener::CreateUDPSockets() {
|
void Listener::CreateUDPSockets() {
|
||||||
if (!activated || !(*detectorDataStream)) {
|
if (!activated || !(*detectorDataStream)) {
|
||||||
return;
|
return;
|
||||||
@ -135,7 +146,7 @@ void Listener::CreateUDPSockets() {
|
|||||||
ShutDownUDPSocket();
|
ShutDownUDPSocket();
|
||||||
|
|
||||||
uint32_t packetSize = generalData->packetSize;
|
uint32_t packetSize = generalData->packetSize;
|
||||||
if (myDetectorType == GOTTHARD2 && index != 0) {
|
if (vetoThread) {
|
||||||
packetSize = generalData->vetoPacketSize;
|
packetSize = generalData->vetoPacketSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,7 +195,7 @@ void Listener::CreateDummySocketForUDPSocketBufferSize(int s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t packetSize = generalData->packetSize;
|
uint32_t packetSize = generalData->packetSize;
|
||||||
if (myDetectorType == GOTTHARD2 && index != 0) {
|
if (vetoThread) {
|
||||||
packetSize = generalData->vetoPacketSize;
|
packetSize = generalData->vetoPacketSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,55 +231,42 @@ void Listener::SetHardCodedPosition(uint16_t r, uint16_t c) {
|
|||||||
|
|
||||||
void Listener::ThreadExecution() {
|
void Listener::ThreadExecution() {
|
||||||
char *buffer;
|
char *buffer;
|
||||||
int rc = 0;
|
|
||||||
|
|
||||||
fifo->GetNewAddress(buffer);
|
fifo->GetNewAddress(buffer);
|
||||||
LOG(logDEBUG5) << "Listener " << index
|
LOG(logDEBUG1) << "Listener " << index
|
||||||
<< ", "
|
<< ", "
|
||||||
"pop 0x"
|
"pop 0x"
|
||||||
<< std::hex << (void *)(buffer) << std::dec << ":" << buffer;
|
<< std::hex << (void *)(buffer) << std::dec << ":" << buffer;
|
||||||
|
|
||||||
// udpsocket doesnt exist
|
|
||||||
if (activated && *detectorDataStream && !udpSocketAlive && !carryOverFlag) {
|
|
||||||
// LOG(logERROR) << "Listening_Thread " << index << ": UDP Socket not
|
|
||||||
// created or shut down earlier";
|
|
||||||
(*((uint32_t *)buffer)) = 0;
|
|
||||||
StopListening(buffer);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get data
|
// get data
|
||||||
if ((*status != TRANSMITTING &&
|
char* tempBuffer = buffer;
|
||||||
(!activated || !(*detectorDataStream) || udpSocketAlive)) ||
|
for (size_t iFrame = 0; iFrame != fifoBunchSize; iFrame ++) {
|
||||||
carryOverFlag) {
|
|
||||||
rc = ListenToAnImage(buffer);
|
// end of acquisition or not activated
|
||||||
}
|
if ((*status == TRANSMITTING || !udpSocketAlive) && !carryOverFlag) {
|
||||||
|
(*((uint32_t *)tempBuffer)) = DUMMY_PACKET_VALUE;
|
||||||
// error check, (should not be here) if not transmitting yet (previous if)
|
|
||||||
// rc should be > 0
|
|
||||||
if (rc == 0) {
|
|
||||||
if (!udpSocketAlive) {
|
|
||||||
(*((uint32_t *)buffer)) = 0;
|
|
||||||
StopListening(buffer);
|
StopListening(buffer);
|
||||||
} else
|
return;
|
||||||
fifo->FreeAddress(buffer);
|
}
|
||||||
return;
|
int rc = ListenToAnImage(tempBuffer);
|
||||||
}
|
|
||||||
|
|
||||||
// discarding image
|
// socket closed or discarding image (free retake)
|
||||||
else if (rc < 0) {
|
// weird frame numbers (print and rc = 0), then retake
|
||||||
fifo->FreeAddress(buffer);
|
if (rc <= 0) {
|
||||||
return;
|
if (udpSocketAlive) {
|
||||||
|
--iFrame;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
(*((uint32_t *)tempBuffer)) = rc;
|
||||||
|
tempBuffer += fifoBunchSizeBytes;
|
||||||
|
numFramesStatistic++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(*((uint32_t *)buffer)) = rc;
|
|
||||||
|
|
||||||
// push into fifo
|
// push into fifo
|
||||||
fifo->PushAddress(buffer);
|
fifo->PushAddress(buffer);
|
||||||
|
|
||||||
// Statistics
|
// Statistics
|
||||||
if (!(*silentMode)) {
|
if (!(*silentMode)) {
|
||||||
numFramesStatistic++;
|
|
||||||
if (numFramesStatistic >=
|
if (numFramesStatistic >=
|
||||||
// second condition also for infinite #number of frames
|
// second condition also for infinite #number of frames
|
||||||
(((*framesPerFile) == 0) ? STATISTIC_FRAMENUMBER_INFINITE
|
(((*framesPerFile) == 0) ? STATISTIC_FRAMENUMBER_INFINITE
|
||||||
@ -278,12 +276,10 @@ void Listener::ThreadExecution() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Listener::StopListening(char *buf) {
|
void Listener::StopListening(char *buf) {
|
||||||
(*((uint32_t *)buf)) = DUMMY_PACKET_VALUE;
|
|
||||||
fifo->PushAddress(buf);
|
fifo->PushAddress(buf);
|
||||||
StopRunning();
|
StopRunning();
|
||||||
LOG(logDEBUG1) << index << ": Listening Packets (" << *udpPortNumber
|
LOG(logDEBUG1) << index << ": Listening Completed (" << *udpPortNumber
|
||||||
<< ") : " << numPacketsCaught;
|
<< ") : " << numPacketsCaught;
|
||||||
LOG(logDEBUG1) << index << ": Listening Completed";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* buf includes the fifo header and packet header */
|
/* buf includes the fifo header and packet header */
|
||||||
@ -300,7 +296,7 @@ uint32_t Listener::ListenToAnImage(char *buf) {
|
|||||||
uint32_t hsize = generalData->headerSizeinPacket;
|
uint32_t hsize = generalData->headerSizeinPacket;
|
||||||
uint32_t fifohsize = generalData->fifoBufferHeaderSize;
|
uint32_t fifohsize = generalData->fifoBufferHeaderSize;
|
||||||
bool standardheader = generalData->standardheader;
|
bool standardheader = generalData->standardheader;
|
||||||
if (myDetectorType == GOTTHARD2 && index != 0) {
|
if (vetoThread) {
|
||||||
dsize = generalData->vetoDataSize;
|
dsize = generalData->vetoDataSize;
|
||||||
imageSize = generalData->vetoImageSize;
|
imageSize = generalData->vetoImageSize;
|
||||||
packetSize = generalData->vetoPacketSize;
|
packetSize = generalData->vetoPacketSize;
|
||||||
@ -317,15 +313,6 @@ uint32_t Listener::ListenToAnImage(char *buf) {
|
|||||||
memset(buf, 0, fifohsize);
|
memset(buf, 0, fifohsize);
|
||||||
new_header = (sls_receiver_header *)(buf + FIFO_HEADER_NUMBYTES);
|
new_header = (sls_receiver_header *)(buf + FIFO_HEADER_NUMBYTES);
|
||||||
|
|
||||||
// deactivated port (eiger)
|
|
||||||
if (!(*detectorDataStream)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
// deactivated (eiger)
|
|
||||||
if (!activated) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// look for carry over
|
// look for carry over
|
||||||
if (carryOverFlag) {
|
if (carryOverFlag) {
|
||||||
LOG(logDEBUG3) << index << "carry flag";
|
LOG(logDEBUG3) << index << "carry flag";
|
||||||
@ -350,6 +337,7 @@ uint32_t Listener::ListenToAnImage(char *buf) {
|
|||||||
<< "(Weird), With carry flag: Frame number " << fnum
|
<< "(Weird), With carry flag: Frame number " << fnum
|
||||||
<< " less than current frame number " << currentFrameIndex;
|
<< " less than current frame number " << currentFrameIndex;
|
||||||
carryOverFlag = false;
|
carryOverFlag = false;
|
||||||
|
exit(-1);//***************************
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
switch (*frameDiscardMode) {
|
switch (*frameDiscardMode) {
|
||||||
@ -514,7 +502,7 @@ uint32_t Listener::ListenToAnImage(char *buf) {
|
|||||||
|
|
||||||
lastCaughtFrameIndex = fnum;
|
lastCaughtFrameIndex = fnum;
|
||||||
|
|
||||||
LOG(logDEBUG1) << "Listening " << index
|
LOG(logDEBUG) << "Listening " << index
|
||||||
<< ": currentfindex:" << currentFrameIndex
|
<< ": currentfindex:" << currentFrameIndex
|
||||||
<< ", fnum:" << fnum << ", pnum:" << pnum
|
<< ", fnum:" << fnum << ", pnum:" << pnum
|
||||||
<< ", numpackets:" << numpackets;
|
<< ", numpackets:" << numpackets;
|
||||||
|
@ -65,6 +65,8 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
void ResetParametersforNewAcquisition();
|
void ResetParametersforNewAcquisition();
|
||||||
void SetGeneralData(GeneralData *g);
|
void SetGeneralData(GeneralData *g);
|
||||||
void SetActivate(bool enable);
|
void SetActivate(bool enable);
|
||||||
|
void SetBunchSize(size_t value);
|
||||||
|
|
||||||
void CreateUDPSockets();
|
void CreateUDPSockets();
|
||||||
void ShutDownUDPSocket();
|
void ShutDownUDPSocket();
|
||||||
|
|
||||||
@ -130,6 +132,7 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
bool activated{false};
|
bool activated{false};
|
||||||
bool *detectorDataStream;
|
bool *detectorDataStream;
|
||||||
bool *silentMode;
|
bool *silentMode;
|
||||||
|
bool vetoThread{false};
|
||||||
|
|
||||||
/** row hardcoded as 1D or 2d,
|
/** row hardcoded as 1D or 2d,
|
||||||
* if detector does not send them yet or
|
* if detector does not send them yet or
|
||||||
@ -164,6 +167,10 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
std::unique_ptr<char[]> listeningPacket;
|
std::unique_ptr<char[]> listeningPacket;
|
||||||
std::atomic<bool> udpSocketAlive{false};
|
std::atomic<bool> udpSocketAlive{false};
|
||||||
|
|
||||||
|
size_t fifoBunchSize{0};
|
||||||
|
/** size in memory including headers */
|
||||||
|
size_t fifoBunchSizeBytes{0};
|
||||||
|
|
||||||
// for print progress during acquisition*/
|
// for print progress during acquisition*/
|
||||||
uint32_t numPacketsStatistic{0};
|
uint32_t numPacketsStatistic{0};
|
||||||
uint32_t numFramesStatistic{0};
|
uint32_t numFramesStatistic{0};
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
#include "MasterAttributes.h"
|
#include "MasterAttributes.h"
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
|
||||||
namespace sls {
|
namespace sls {
|
||||||
|
|
||||||
@ -39,7 +41,7 @@ void MasterAttributes::GetBinaryAttributes(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
void MasterAttributes::WriteHDF5Attributes(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5Attributes(H5::H5File *fd, H5::Group *group) {
|
||||||
WriteCommonHDF5Attributes(fd, group);
|
WriteCommonHDF5Attributes(fd, group);
|
||||||
switch (detType) {
|
switch (detType) {
|
||||||
case slsDetectorDefs::GOTTHARD:
|
case slsDetectorDefs::GOTTHARD:
|
||||||
@ -167,40 +169,40 @@ void MasterAttributes::GetFinalBinaryAttributes(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
void MasterAttributes::WriteCommonHDF5Attributes(H5File *fd, Group *group) {
|
void MasterAttributes::WriteCommonHDF5Attributes(H5::H5File *fd, H5::Group *group) {
|
||||||
char c[1024]{};
|
char c[1024]{};
|
||||||
// version
|
// version
|
||||||
{
|
{
|
||||||
double version = BINARY_WRITER_VERSION;
|
double version = BINARY_WRITER_VERSION;
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
Attribute attribute =
|
H5::Attribute attribute =
|
||||||
fd->createAttribute("Version", PredType::NATIVE_DOUBLE, dataspace);
|
fd->createAttribute("Version", H5::PredType::NATIVE_DOUBLE, dataspace);
|
||||||
attribute.write(PredType::NATIVE_DOUBLE, &version);
|
attribute.write(H5::PredType::NATIVE_DOUBLE, &version);
|
||||||
}
|
}
|
||||||
// timestamp
|
// timestamp
|
||||||
{
|
{
|
||||||
time_t t = time(nullptr);
|
time_t t = std::time(nullptr);
|
||||||
StrType strdatatype(PredType::C_S1, 256);
|
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("Timestamp", strdatatype, dataspace);
|
group->createDataSet("Timestamp", strdatatype, dataspace);
|
||||||
strcpy_safe(c, std::string(ctime(&t)));
|
strcpy_safe(c, std::string(ctime(&t)));
|
||||||
dataset.write(c, strdatatype);
|
dataset.write(c, strdatatype);
|
||||||
}
|
}
|
||||||
// detector type
|
// detector type
|
||||||
{
|
{
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
StrType strdatatype(PredType::C_S1, 256);
|
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("Detector Type", strdatatype, dataspace);
|
group->createDataSet("Detector Type", strdatatype, dataspace);
|
||||||
strcpy_safe(c, ToString(detType));
|
strcpy_safe(c, ToString(detType));
|
||||||
dataset.write(c, strdatatype);
|
dataset.write(c, strdatatype);
|
||||||
}
|
}
|
||||||
// timing mode
|
// timing mode
|
||||||
{
|
{
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
StrType strdatatype(PredType::C_S1, 256);
|
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("Timing Mode", strdatatype, dataspace);
|
group->createDataSet("Timing Mode", strdatatype, dataspace);
|
||||||
strcpy_safe(c, ToString(timingMode));
|
strcpy_safe(c, ToString(timingMode));
|
||||||
dataset.write(c, strdatatype);
|
dataset.write(c, strdatatype);
|
||||||
@ -208,27 +210,27 @@ void MasterAttributes::WriteCommonHDF5Attributes(H5File *fd, Group *group) {
|
|||||||
// TODO: make this into an array?
|
// TODO: make this into an array?
|
||||||
// geometry x
|
// geometry x
|
||||||
{
|
{
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset = group->createDataSet("Geometry in x axis",
|
H5::DataSet dataset = group->createDataSet("Geometry in x axis",
|
||||||
PredType::NATIVE_INT, dataspace);
|
H5::PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&geometry.x, PredType::NATIVE_INT);
|
dataset.write(&geometry.x, H5::PredType::NATIVE_INT);
|
||||||
}
|
}
|
||||||
// geometry y
|
// geometry y
|
||||||
{
|
{
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset = group->createDataSet("Geometry in y axis",
|
H5::DataSet dataset = group->createDataSet("Geometry in y axis",
|
||||||
PredType::NATIVE_INT, dataspace);
|
H5::PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&geometry.y, PredType::NATIVE_INT);
|
dataset.write(&geometry.y, H5::PredType::NATIVE_INT);
|
||||||
}
|
}
|
||||||
// Image Size
|
// Image Size
|
||||||
{
|
{
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("Image Size", PredType::NATIVE_INT, dataspace);
|
group->createDataSet("Image Size", H5::PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&imageSize, PredType::NATIVE_INT);
|
dataset.write(&imageSize, H5::PredType::NATIVE_INT);
|
||||||
DataSpace dataspaceAttr = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspaceAttr = H5::DataSpace(H5S_SCALAR);
|
||||||
StrType strdatatype(PredType::C_S1, 256);
|
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||||
Attribute attribute =
|
H5::Attribute attribute =
|
||||||
dataset.createAttribute("Unit", strdatatype, dataspaceAttr);
|
dataset.createAttribute("Unit", strdatatype, dataspaceAttr);
|
||||||
strcpy_safe(c, "bytes");
|
strcpy_safe(c, "bytes");
|
||||||
attribute.write(strdatatype, c);
|
attribute.write(strdatatype, c);
|
||||||
@ -236,335 +238,335 @@ void MasterAttributes::WriteCommonHDF5Attributes(H5File *fd, Group *group) {
|
|||||||
// TODO: make this into an array?
|
// TODO: make this into an array?
|
||||||
// npixels x
|
// npixels x
|
||||||
{
|
{
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset = group->createDataSet("Number of pixels in x axis",
|
H5::DataSet dataset = group->createDataSet("Number of pixels in x axis",
|
||||||
PredType::NATIVE_INT, dataspace);
|
H5::PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&nPixels.x, PredType::NATIVE_INT);
|
dataset.write(&nPixels.x, H5::PredType::NATIVE_INT);
|
||||||
}
|
}
|
||||||
// npixels y
|
// npixels y
|
||||||
{
|
{
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset = group->createDataSet("Number of pixels in y axis",
|
H5::DataSet dataset = group->createDataSet("Number of pixels in y axis",
|
||||||
PredType::NATIVE_INT, dataspace);
|
H5::PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&nPixels.y, PredType::NATIVE_INT);
|
dataset.write(&nPixels.y, H5::PredType::NATIVE_INT);
|
||||||
}
|
}
|
||||||
// Maximum frames per file
|
// Maximum frames per file
|
||||||
{
|
{
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset = group->createDataSet("Maximum frames per file",
|
H5::DataSet dataset = group->createDataSet("Maximum frames per file",
|
||||||
PredType::NATIVE_INT, dataspace);
|
H5::PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&maxFramesPerFile, PredType::NATIVE_INT);
|
dataset.write(&maxFramesPerFile, H5::PredType::NATIVE_INT);
|
||||||
}
|
}
|
||||||
// Frame Discard Policy
|
// Frame Discard Policy
|
||||||
{
|
{
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
StrType strdatatype(PredType::C_S1, 256);
|
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||||
DataSet dataset = group->createDataSet("Frame Discard Policy",
|
H5::DataSet dataset = group->createDataSet("Frame Discard Policy",
|
||||||
strdatatype, dataspace);
|
strdatatype, dataspace);
|
||||||
strcpy_safe(c, ToString(frameDiscardMode));
|
strcpy_safe(c, ToString(frameDiscardMode));
|
||||||
dataset.write(c, strdatatype);
|
dataset.write(c, strdatatype);
|
||||||
}
|
}
|
||||||
// Frame Padding
|
// Frame Padding
|
||||||
{
|
{
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset = group->createDataSet("Frame Padding",
|
H5::DataSet dataset = group->createDataSet("Frame Padding",
|
||||||
PredType::NATIVE_INT, dataspace);
|
H5::PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&framePadding, PredType::NATIVE_INT);
|
dataset.write(&framePadding, H5::PredType::NATIVE_INT);
|
||||||
}
|
}
|
||||||
// Scan Parameters
|
// Scan Parameters
|
||||||
{
|
{
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
StrType strdatatype(PredType::C_S1, 256);
|
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("Scan Parameters", strdatatype, dataspace);
|
group->createDataSet("Scan Parameters", strdatatype, dataspace);
|
||||||
strcpy_safe(c, ToString(scanParams));
|
strcpy_safe(c, ToString(scanParams));
|
||||||
dataset.write(c, strdatatype);
|
dataset.write(c, strdatatype);
|
||||||
}
|
}
|
||||||
// Total Frames
|
// Total Frames
|
||||||
{
|
{
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset = group->createDataSet("Total Frames",
|
H5::DataSet dataset = group->createDataSet("Total Frames",
|
||||||
PredType::STD_U64LE, dataspace);
|
H5::PredType::STD_U64LE, dataspace);
|
||||||
dataset.write(&totalFrames, PredType::STD_U64LE);
|
dataset.write(&totalFrames, H5::PredType::STD_U64LE);
|
||||||
}
|
}
|
||||||
// Receiver Roi xmin
|
// Receiver Roi xmin
|
||||||
{
|
{
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset = group->createDataSet("receiver roi xmin",
|
H5::DataSet dataset = group->createDataSet("receiver roi xmin",
|
||||||
PredType::NATIVE_INT, dataspace);
|
H5::PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&receiverRoi.xmin, PredType::NATIVE_INT);
|
dataset.write(&receiverRoi.xmin, H5::PredType::NATIVE_INT);
|
||||||
}
|
}
|
||||||
// Receiver Roi xmax
|
// Receiver Roi xmax
|
||||||
{
|
{
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset = group->createDataSet("receiver roi xmax",
|
H5::DataSet dataset = group->createDataSet("receiver roi xmax",
|
||||||
PredType::NATIVE_INT, dataspace);
|
H5::PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&receiverRoi.xmax, PredType::NATIVE_INT);
|
dataset.write(&receiverRoi.xmax, H5::PredType::NATIVE_INT);
|
||||||
}
|
}
|
||||||
// Receiver Roi ymin
|
// Receiver Roi ymin
|
||||||
{
|
{
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset = group->createDataSet("receiver roi ymin",
|
H5::DataSet dataset = group->createDataSet("receiver roi ymin",
|
||||||
PredType::NATIVE_INT, dataspace);
|
H5::PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&receiverRoi.ymin, PredType::NATIVE_INT);
|
dataset.write(&receiverRoi.ymin, H5::PredType::NATIVE_INT);
|
||||||
}
|
}
|
||||||
// Receiver Roi ymax
|
// Receiver Roi ymax
|
||||||
{
|
{
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset = group->createDataSet("receiver roi ymax",
|
H5::DataSet dataset = group->createDataSet("receiver roi ymax",
|
||||||
PredType::NATIVE_INT, dataspace);
|
H5::PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&receiverRoi.ymax, PredType::NATIVE_INT);
|
dataset.write(&receiverRoi.ymax, H5::PredType::NATIVE_INT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteFinalHDF5Attributes(H5File *fd, Group *group) {
|
void MasterAttributes::WriteFinalHDF5Attributes(H5::H5File *fd, H5::Group *group) {
|
||||||
char c[1024]{};
|
char c[1024]{};
|
||||||
// Total Frames in file
|
// Total Frames in file
|
||||||
{
|
{
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset = group->createDataSet("Frames in File",
|
H5::DataSet dataset = group->createDataSet("Frames in File",
|
||||||
PredType::STD_U64LE, dataspace);
|
H5::PredType::STD_U64LE, dataspace);
|
||||||
dataset.write(&framesInFile, PredType::STD_U64LE);
|
dataset.write(&framesInFile, H5::PredType::STD_U64LE);
|
||||||
}
|
}
|
||||||
// additional json header
|
// additional json header
|
||||||
if (!additionalJsonHeader.empty()) {
|
if (!additionalJsonHeader.empty()) {
|
||||||
std::string json = ToString(additionalJsonHeader);
|
std::string json = ToString(additionalJsonHeader);
|
||||||
StrType strdatatype(PredType::C_S1, json.length());
|
H5::StrType strdatatype(H5::PredType::C_S1, json.length());
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset = group->createDataSet("Additional JSON Header",
|
H5::DataSet dataset = group->createDataSet("Additional JSON Header",
|
||||||
strdatatype, dataspace);
|
strdatatype, dataspace);
|
||||||
strcpy_safe(c, ToString(additionalJsonHeader));
|
strcpy_safe(c, ToString(additionalJsonHeader));
|
||||||
dataset.write(c, strdatatype);
|
dataset.write(c, strdatatype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteHDF5Exptime(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5Exptime(H5::H5File *fd, H5::Group *group) {
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
StrType strdatatype(PredType::C_S1, 256);
|
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("Exposure Time", strdatatype, dataspace);
|
group->createDataSet("Exposure Time", strdatatype, dataspace);
|
||||||
char c[1024]{};
|
char c[1024]{};
|
||||||
strcpy_safe(c, ToString(exptime));
|
strcpy_safe(c, ToString(exptime));
|
||||||
dataset.write(c, strdatatype);
|
dataset.write(c, strdatatype);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteHDF5Period(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5Period(H5::H5File *fd, H5::Group *group) {
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
StrType strdatatype(PredType::C_S1, 256);
|
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("Acquisition Period", strdatatype, dataspace);
|
group->createDataSet("Acquisition Period", strdatatype, dataspace);
|
||||||
char c[1024]{};
|
char c[1024]{};
|
||||||
strcpy_safe(c, ToString(period));
|
strcpy_safe(c, ToString(period));
|
||||||
dataset.write(c, strdatatype);
|
dataset.write(c, strdatatype);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteHDF5DynamicRange(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5DynamicRange(H5::H5File *fd, H5::Group *group) {
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("Dynamic Range", PredType::NATIVE_INT, dataspace);
|
group->createDataSet("Dynamic Range", H5::PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&dynamicRange, PredType::NATIVE_INT);
|
dataset.write(&dynamicRange, H5::PredType::NATIVE_INT);
|
||||||
DataSpace dataspaceAttr = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspaceAttr = H5::DataSpace(H5S_SCALAR);
|
||||||
StrType strdatatype(PredType::C_S1, 256);
|
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||||
Attribute attribute =
|
H5::Attribute attribute =
|
||||||
dataset.createAttribute("Unit", strdatatype, dataspaceAttr);
|
dataset.createAttribute("Unit", strdatatype, dataspaceAttr);
|
||||||
char c[1024] = "bits";
|
char c[1024] = "bits";
|
||||||
attribute.write(strdatatype, c);
|
attribute.write(strdatatype, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteHDF5TenGiga(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5TenGiga(H5::H5File *fd, H5::Group *group) {
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset = group->createDataSet("Ten Giga Enable",
|
H5::DataSet dataset = group->createDataSet("Ten Giga Enable",
|
||||||
PredType::NATIVE_INT, dataspace);
|
H5::PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&tenGiga, PredType::NATIVE_INT);
|
dataset.write(&tenGiga, H5::PredType::NATIVE_INT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteHDF5ROI(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5ROI(H5::H5File *fd, H5::Group *group) {
|
||||||
// Roi xmin
|
// Roi xmin
|
||||||
{
|
{
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("roi xmin", PredType::NATIVE_INT, dataspace);
|
group->createDataSet("roi xmin", H5::PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&detectorRoi.xmin, PredType::NATIVE_INT);
|
dataset.write(&detectorRoi.xmin, H5::PredType::NATIVE_INT);
|
||||||
}
|
}
|
||||||
// Roi xmax
|
// Roi xmax
|
||||||
{
|
{
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("roi xmax", PredType::NATIVE_INT, dataspace);
|
group->createDataSet("roi xmax", H5::PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&detectorRoi.xmax, PredType::NATIVE_INT);
|
dataset.write(&detectorRoi.xmax, H5::PredType::NATIVE_INT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteHDF5NumUDPInterfaces(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5NumUDPInterfaces(H5::H5File *fd, H5::Group *group) {
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset = group->createDataSet("Number of UDP Interfaces",
|
H5::DataSet dataset = group->createDataSet("Number of UDP Interfaces",
|
||||||
PredType::NATIVE_INT, dataspace);
|
H5::PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&numUDPInterfaces, PredType::NATIVE_INT);
|
dataset.write(&numUDPInterfaces, H5::PredType::NATIVE_INT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteHDF5ReadNRows(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5ReadNRows(H5::H5File *fd, H5::Group *group) {
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("Number of rows", PredType::NATIVE_INT, dataspace);
|
group->createDataSet("Number of rows", H5::PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&readNRows, PredType::NATIVE_INT);
|
dataset.write(&readNRows, H5::PredType::NATIVE_INT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteHDF5ThresholdEnergy(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5ThresholdEnergy(H5::H5File *fd, H5::Group *group) {
|
||||||
char c[1024]{};
|
char c[1024]{};
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset = group->createDataSet("Threshold Energy",
|
H5::DataSet dataset = group->createDataSet("Threshold Energy",
|
||||||
PredType::NATIVE_INT, dataspace);
|
H5::PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&thresholdEnergyeV, PredType::NATIVE_INT);
|
dataset.write(&thresholdEnergyeV, H5::PredType::NATIVE_INT);
|
||||||
DataSpace dataspaceAttr = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspaceAttr = H5::DataSpace(H5S_SCALAR);
|
||||||
StrType strdatatype(PredType::C_S1, 256);
|
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||||
Attribute attribute =
|
H5::Attribute attribute =
|
||||||
dataset.createAttribute("Unit", strdatatype, dataspaceAttr);
|
dataset.createAttribute("Unit", strdatatype, dataspaceAttr);
|
||||||
strcpy_safe(c, "eV");
|
strcpy_safe(c, "eV");
|
||||||
attribute.write(strdatatype, c);
|
attribute.write(strdatatype, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteHDF5ThresholdEnergies(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5ThresholdEnergies(H5::H5File *fd, H5::Group *group) {
|
||||||
char c[1024]{};
|
char c[1024]{};
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
StrType strdatatype(PredType::C_S1, 1024);
|
H5::StrType strdatatype(H5::PredType::C_S1, 1024);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("Threshold Energies", strdatatype, dataspace);
|
group->createDataSet("Threshold Energies", strdatatype, dataspace);
|
||||||
strcpy_safe(c, ToString(thresholdAllEnergyeV));
|
strcpy_safe(c, ToString(thresholdAllEnergyeV));
|
||||||
dataset.write(c, strdatatype);
|
dataset.write(c, strdatatype);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteHDF5SubExpTime(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5SubExpTime(H5::H5File *fd, H5::Group *group) {
|
||||||
char c[1024]{};
|
char c[1024]{};
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
StrType strdatatype(PredType::C_S1, 256);
|
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("Sub Exposure Time", strdatatype, dataspace);
|
group->createDataSet("Sub Exposure Time", strdatatype, dataspace);
|
||||||
strcpy_safe(c, ToString(subExptime));
|
strcpy_safe(c, ToString(subExptime));
|
||||||
dataset.write(c, strdatatype);
|
dataset.write(c, strdatatype);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteHDF5SubPeriod(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5SubPeriod(H5::H5File *fd, H5::Group *group) {
|
||||||
char c[1024]{};
|
char c[1024]{};
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
StrType strdatatype(PredType::C_S1, 256);
|
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("Sub Period", strdatatype, dataspace);
|
group->createDataSet("Sub Period", strdatatype, dataspace);
|
||||||
strcpy_safe(c, ToString(subPeriod));
|
strcpy_safe(c, ToString(subPeriod));
|
||||||
dataset.write(c, strdatatype);
|
dataset.write(c, strdatatype);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteHDF5SubQuad(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5SubQuad(H5::H5File *fd, H5::Group *group) {
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("Quad", PredType::NATIVE_INT, dataspace);
|
group->createDataSet("Quad", H5::PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&quad, PredType::NATIVE_INT);
|
dataset.write(&quad, H5::PredType::NATIVE_INT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteHDF5RateCorrections(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5RateCorrections(H5::H5File *fd, H5::Group *group) {
|
||||||
char c[1024]{};
|
char c[1024]{};
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
StrType strdatatype(PredType::C_S1, 1024);
|
H5::StrType strdatatype(H5::PredType::C_S1, 1024);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("Rate Corrections", strdatatype, dataspace);
|
group->createDataSet("Rate Corrections", strdatatype, dataspace);
|
||||||
strcpy_safe(c, ToString(ratecorr));
|
strcpy_safe(c, ToString(ratecorr));
|
||||||
dataset.write(c, strdatatype);
|
dataset.write(c, strdatatype);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteHDF5CounterMask(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5CounterMask(H5::H5File *fd, H5::Group *group) {
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("Counter Mask", PredType::STD_U32LE, dataspace);
|
group->createDataSet("Counter Mask", H5::PredType::STD_U32LE, dataspace);
|
||||||
dataset.write(&counterMask, PredType::STD_U32LE);
|
dataset.write(&counterMask, H5::PredType::STD_U32LE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteHDF5ExptimeArray(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5ExptimeArray(H5::H5File *fd, H5::Group *group) {
|
||||||
for (int i = 0; i != 3; ++i) {
|
for (int i = 0; i != 3; ++i) {
|
||||||
char c[1024]{};
|
char c[1024]{};
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
StrType strdatatype(PredType::C_S1, 256);
|
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("Exposure Time1", strdatatype, dataspace);
|
group->createDataSet("Exposure Time1", strdatatype, dataspace);
|
||||||
strcpy_safe(c, ToString(exptimeArray[i]));
|
strcpy_safe(c, ToString(exptimeArray[i]));
|
||||||
dataset.write(c, strdatatype);
|
dataset.write(c, strdatatype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteHDF5GateDelayArray(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5GateDelayArray(H5::H5File *fd, H5::Group *group) {
|
||||||
for (int i = 0; i != 3; ++i) {
|
for (int i = 0; i != 3; ++i) {
|
||||||
char c[1024]{};
|
char c[1024]{};
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
StrType strdatatype(PredType::C_S1, 256);
|
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("Gate Delay1", strdatatype, dataspace);
|
group->createDataSet("Gate Delay1", strdatatype, dataspace);
|
||||||
strcpy_safe(c, ToString(gateDelayArray[i]));
|
strcpy_safe(c, ToString(gateDelayArray[i]));
|
||||||
dataset.write(c, strdatatype);
|
dataset.write(c, strdatatype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteHDF5Gates(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5Gates(H5::H5File *fd, H5::Group *group) {
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("Gates", PredType::STD_U32LE, dataspace);
|
group->createDataSet("Gates", H5::PredType::STD_U32LE, dataspace);
|
||||||
dataset.write(&gates, PredType::STD_U32LE);
|
dataset.write(&gates, H5::PredType::STD_U32LE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteHDF5BurstMode(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5BurstMode(H5::H5File *fd, H5::Group *group) {
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
StrType strdatatype(PredType::C_S1, 256);
|
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("Burst Mode", strdatatype, dataspace);
|
group->createDataSet("Burst Mode", strdatatype, dataspace);
|
||||||
char c[1024]{};
|
char c[1024]{};
|
||||||
strcpy_safe(c, ToString(burstMode));
|
strcpy_safe(c, ToString(burstMode));
|
||||||
dataset.write(c, strdatatype);
|
dataset.write(c, strdatatype);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteHDF5AdcMask(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5AdcMask(H5::H5File *fd, H5::Group *group) {
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("ADC Mask", PredType::NATIVE_INT, dataspace);
|
group->createDataSet("ADC Mask", H5::PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&adcmask, PredType::NATIVE_INT);
|
dataset.write(&adcmask, H5::PredType::NATIVE_INT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteHDF5AnalogFlag(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5AnalogFlag(H5::H5File *fd, H5::Group *group) {
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("Analog Flag", PredType::NATIVE_INT, dataspace);
|
group->createDataSet("Analog Flag", H5::PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&analog, PredType::NATIVE_INT);
|
dataset.write(&analog, H5::PredType::NATIVE_INT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteHDF5AnalogSamples(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5AnalogSamples(H5::H5File *fd, H5::Group *group) {
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("Analog Samples", PredType::NATIVE_INT, dataspace);
|
group->createDataSet("Analog Samples", H5::PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&analogSamples, PredType::NATIVE_INT);
|
dataset.write(&analogSamples, H5::PredType::NATIVE_INT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteHDF5DigitalFlag(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5DigitalFlag(H5::H5File *fd, H5::Group *group) {
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("Digital Flag", PredType::NATIVE_INT, dataspace);
|
group->createDataSet("Digital Flag", H5::PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&digital, PredType::NATIVE_INT);
|
dataset.write(&digital, H5::PredType::NATIVE_INT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteHDF5DigitalSamples(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5DigitalSamples(H5::H5File *fd, H5::Group *group) {
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset = group->createDataSet("Digital Samples",
|
H5::DataSet dataset = group->createDataSet("Digital Samples",
|
||||||
PredType::NATIVE_INT, dataspace);
|
H5::PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&digitalSamples, PredType::NATIVE_INT);
|
dataset.write(&digitalSamples, H5::PredType::NATIVE_INT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteHDF5DbitOffset(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5DbitOffset(H5::H5File *fd, H5::Group *group) {
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset =
|
H5::DataSet dataset =
|
||||||
group->createDataSet("Dbit Offset", PredType::NATIVE_INT, dataspace);
|
group->createDataSet("Dbit Offset", H5::PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&dbitoffset, PredType::NATIVE_INT);
|
dataset.write(&dbitoffset, H5::PredType::NATIVE_INT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MasterAttributes::WriteHDF5DbitList(H5File *fd, Group *group) {
|
void MasterAttributes::WriteHDF5DbitList(H5::H5File *fd, H5::Group *group) {
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset = group->createDataSet("Dbit Bitset List",
|
H5::DataSet dataset = group->createDataSet("Dbit Bitset List",
|
||||||
PredType::STD_U64LE, dataspace);
|
H5::PredType::STD_U64LE, dataspace);
|
||||||
dataset.write(&dbitlist, PredType::STD_U64LE);
|
dataset.write(&dbitlist, H5::PredType::STD_U64LE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -584,7 +586,7 @@ void MasterAttributes::GetGotthardBinaryAttributes(
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
void MasterAttributes::WriteGotthardHDF5Attributes(H5File *fd, Group *group) {
|
void MasterAttributes::WriteGotthardHDF5Attributes(H5::H5File *fd, H5::Group *group) {
|
||||||
MasterAttributes::WriteHDF5Exptime(fd, group);
|
MasterAttributes::WriteHDF5Exptime(fd, group);
|
||||||
MasterAttributes::WriteHDF5Period(fd, group);
|
MasterAttributes::WriteHDF5Period(fd, group);
|
||||||
MasterAttributes::WriteHDF5ROI(fd, group);
|
MasterAttributes::WriteHDF5ROI(fd, group);
|
||||||
@ -604,7 +606,7 @@ void MasterAttributes::GetJungfrauBinaryAttributes(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
void MasterAttributes::WriteJungfrauHDF5Attributes(H5File *fd, Group *group) {
|
void MasterAttributes::WriteJungfrauHDF5Attributes(H5::H5File *fd, H5::Group *group) {
|
||||||
MasterAttributes::WriteHDF5Exptime(fd, group);
|
MasterAttributes::WriteHDF5Exptime(fd, group);
|
||||||
MasterAttributes::WriteHDF5Period(fd, group);
|
MasterAttributes::WriteHDF5Period(fd, group);
|
||||||
MasterAttributes::WriteHDF5NumUDPInterfaces(fd, group);
|
MasterAttributes::WriteHDF5NumUDPInterfaces(fd, group);
|
||||||
@ -637,7 +639,7 @@ void MasterAttributes::GetEigerBinaryAttributes(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
void MasterAttributes::WriteEigerHDF5Attributes(H5File *fd, Group *group) {
|
void MasterAttributes::WriteEigerHDF5Attributes(H5::H5File *fd, H5::Group *group) {
|
||||||
MasterAttributes::WriteHDF5DynamicRange(fd, group);
|
MasterAttributes::WriteHDF5DynamicRange(fd, group);
|
||||||
MasterAttributes::WriteHDF5TenGiga(fd, group);
|
MasterAttributes::WriteHDF5TenGiga(fd, group);
|
||||||
MasterAttributes::WriteHDF5Exptime(fd, group);
|
MasterAttributes::WriteHDF5Exptime(fd, group);
|
||||||
@ -676,7 +678,7 @@ void MasterAttributes::GetMythen3BinaryAttributes(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
void MasterAttributes::WriteMythen3HDF5Attributes(H5File *fd, Group *group) {
|
void MasterAttributes::WriteMythen3HDF5Attributes(H5::H5File *fd, H5::Group *group) {
|
||||||
MasterAttributes::WriteHDF5DynamicRange(fd, group);
|
MasterAttributes::WriteHDF5DynamicRange(fd, group);
|
||||||
MasterAttributes::WriteHDF5TenGiga(fd, group);
|
MasterAttributes::WriteHDF5TenGiga(fd, group);
|
||||||
MasterAttributes::WriteHDF5Period(fd, group);
|
MasterAttributes::WriteHDF5Period(fd, group);
|
||||||
@ -699,7 +701,7 @@ void MasterAttributes::GetGotthard2BinaryAttributes(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
void MasterAttributes::WriteGotthard2HDF5Attributes(H5File *fd, Group *group) {
|
void MasterAttributes::WriteGotthard2HDF5Attributes(H5::H5File *fd, H5::Group *group) {
|
||||||
MasterAttributes::WriteHDF5Exptime(fd, group);
|
MasterAttributes::WriteHDF5Exptime(fd, group);
|
||||||
MasterAttributes::WriteHDF5Period(fd, group);
|
MasterAttributes::WriteHDF5Period(fd, group);
|
||||||
MasterAttributes::WriteHDF5BurstMode(fd, group);
|
MasterAttributes::WriteHDF5BurstMode(fd, group);
|
||||||
@ -721,7 +723,7 @@ void MasterAttributes::GetMoenchBinaryAttributes(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
void MasterAttributes::WriteMoenchHDF5Attributes(H5File *fd, Group *group) {
|
void MasterAttributes::WriteMoenchHDF5Attributes(H5::H5File *fd, H5::Group *group) {
|
||||||
MasterAttributes::WriteHDF5Exptime(fd, group);
|
MasterAttributes::WriteHDF5Exptime(fd, group);
|
||||||
MasterAttributes::WriteHDF5Period(fd, group);
|
MasterAttributes::WriteHDF5Period(fd, group);
|
||||||
MasterAttributes::WriteHDF5TenGiga(fd, group);
|
MasterAttributes::WriteHDF5TenGiga(fd, group);
|
||||||
@ -755,7 +757,7 @@ void MasterAttributes::GetCtbBinaryAttributes(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
void MasterAttributes::WriteCtbHDF5Attributes(H5File *fd, Group *group) {
|
void MasterAttributes::WriteCtbHDF5Attributes(H5::H5File *fd, H5::Group *group) {
|
||||||
MasterAttributes::WriteHDF5Exptime(fd, group);
|
MasterAttributes::WriteHDF5Exptime(fd, group);
|
||||||
MasterAttributes::WriteHDF5Period(fd, group);
|
MasterAttributes::WriteHDF5Period(fd, group);
|
||||||
MasterAttributes::WriteHDF5TenGiga(fd, group);
|
MasterAttributes::WriteHDF5TenGiga(fd, group);
|
||||||
|
@ -11,16 +11,16 @@
|
|||||||
#include <rapidjson/stringbuffer.h>
|
#include <rapidjson/stringbuffer.h>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
|
#ifdef HDF5C
|
||||||
|
#include "H5Cpp.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
namespace sls {
|
namespace sls {
|
||||||
|
|
||||||
using ns = std::chrono::nanoseconds;
|
using ns = std::chrono::nanoseconds;
|
||||||
|
|
||||||
#ifdef HDF5C
|
|
||||||
#include "H5Cpp.h"
|
|
||||||
#ifndef H5_NO_NAMESPACE
|
|
||||||
using namespace H5;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class MasterAttributes {
|
class MasterAttributes {
|
||||||
public:
|
public:
|
||||||
@ -71,7 +71,7 @@ class MasterAttributes {
|
|||||||
void
|
void
|
||||||
GetBinaryAttributes(rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
GetBinaryAttributes(rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
void WriteHDF5Attributes(H5File *fd, Group *group);
|
void WriteHDF5Attributes(H5::H5File *fd, H5::Group *group);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void GetCommonBinaryAttributes(
|
void GetCommonBinaryAttributes(
|
||||||
@ -79,75 +79,75 @@ class MasterAttributes {
|
|||||||
void GetFinalBinaryAttributes(
|
void GetFinalBinaryAttributes(
|
||||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
void WriteCommonHDF5Attributes(H5File *fd, Group *group);
|
void WriteCommonHDF5Attributes(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteFinalHDF5Attributes(H5File *fd, Group *group);
|
void WriteFinalHDF5Attributes(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteHDF5Exptime(H5File *fd, Group *group);
|
void WriteHDF5Exptime(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteHDF5Period(H5File *fd, Group *group);
|
void WriteHDF5Period(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteHDF5DynamicRange(H5File *fd, Group *group);
|
void WriteHDF5DynamicRange(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteHDF5TenGiga(H5File *fd, Group *group);
|
void WriteHDF5TenGiga(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteHDF5ROI(H5File *fd, Group *group);
|
void WriteHDF5ROI(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteHDF5NumUDPInterfaces(H5File *fd, Group *group);
|
void WriteHDF5NumUDPInterfaces(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteHDF5ReadNRows(H5File *fd, Group *group);
|
void WriteHDF5ReadNRows(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteHDF5ThresholdEnergy(H5File *fd, Group *group);
|
void WriteHDF5ThresholdEnergy(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteHDF5ThresholdEnergies(H5File *fd, Group *group);
|
void WriteHDF5ThresholdEnergies(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteHDF5SubExpTime(H5File *fd, Group *group);
|
void WriteHDF5SubExpTime(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteHDF5SubPeriod(H5File *fd, Group *group);
|
void WriteHDF5SubPeriod(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteHDF5SubQuad(H5File *fd, Group *group);
|
void WriteHDF5SubQuad(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteHDF5RateCorrections(H5File *fd, Group *group);
|
void WriteHDF5RateCorrections(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteHDF5CounterMask(H5File *fd, Group *group);
|
void WriteHDF5CounterMask(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteHDF5ExptimeArray(H5File *fd, Group *group);
|
void WriteHDF5ExptimeArray(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteHDF5GateDelayArray(H5File *fd, Group *group);
|
void WriteHDF5GateDelayArray(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteHDF5Gates(H5File *fd, Group *group);
|
void WriteHDF5Gates(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteHDF5BurstMode(H5File *fd, Group *group);
|
void WriteHDF5BurstMode(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteHDF5AdcMask(H5File *fd, Group *group);
|
void WriteHDF5AdcMask(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteHDF5AnalogFlag(H5File *fd, Group *group);
|
void WriteHDF5AnalogFlag(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteHDF5AnalogSamples(H5File *fd, Group *group);
|
void WriteHDF5AnalogSamples(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteHDF5DigitalFlag(H5File *fd, Group *group);
|
void WriteHDF5DigitalFlag(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteHDF5DigitalSamples(H5File *fd, Group *group);
|
void WriteHDF5DigitalSamples(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteHDF5DbitOffset(H5File *fd, Group *group);
|
void WriteHDF5DbitOffset(H5::H5File *fd, H5::Group *group);
|
||||||
void WriteHDF5DbitList(H5File *fd, Group *group);
|
void WriteHDF5DbitList(H5::H5File *fd, H5::Group *group);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void GetGotthardBinaryAttributes(
|
void GetGotthardBinaryAttributes(
|
||||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
void WriteGotthardHDF5Attributes(H5File *fd, Group *group);
|
void WriteGotthardHDF5Attributes(H5::H5File *fd, H5::Group *group);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void GetJungfrauBinaryAttributes(
|
void GetJungfrauBinaryAttributes(
|
||||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
void WriteJungfrauHDF5Attributes(H5File *fd, Group *group);
|
void WriteJungfrauHDF5Attributes(H5::H5File *fd, H5::Group *group);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void GetEigerBinaryAttributes(
|
void GetEigerBinaryAttributes(
|
||||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
void WriteEigerHDF5Attributes(H5File *fd, Group *group);
|
void WriteEigerHDF5Attributes(H5::H5File *fd, H5::Group *group);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void GetMythen3BinaryAttributes(
|
void GetMythen3BinaryAttributes(
|
||||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
void WriteMythen3HDF5Attributes(H5File *fd, Group *group);
|
void WriteMythen3HDF5Attributes(H5::H5File *fd, H5::Group *group);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void GetGotthard2BinaryAttributes(
|
void GetGotthard2BinaryAttributes(
|
||||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
void WriteGotthard2HDF5Attributes(H5File *fd, Group *group);
|
void WriteGotthard2HDF5Attributes(H5::H5File *fd, H5::Group *group);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void GetMoenchBinaryAttributes(
|
void GetMoenchBinaryAttributes(
|
||||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
void WriteMoenchHDF5Attributes(H5File *fd, Group *group);
|
void WriteMoenchHDF5Attributes(H5::H5File *fd, H5::Group *group);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
GetCtbBinaryAttributes(rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
GetCtbBinaryAttributes(rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
void WriteCtbHDF5Attributes(H5File *fd, Group *group);
|
void WriteCtbHDF5Attributes(H5::H5File *fd, H5::Group *group);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -47,32 +47,31 @@ std::string CreateMasterBinaryFile(const std::string &filePath,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
void LinkHDF5FileInMaster(const std::string &masterFileName,
|
void LinkHDF5FileInMaster(std::string &masterFileName,
|
||||||
const std::string &dataFilename,
|
std::string &dataFilename,
|
||||||
const std::string &dataSetname,
|
std::vector<std::string> parameterNames,
|
||||||
const std::vector<std::string> parameterNames,
|
|
||||||
const bool silentMode, std::mutex *hdf5LibMutex) {
|
const bool silentMode, std::mutex *hdf5LibMutex) {
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(*hdf5LibMutex);
|
std::lock_guard<std::mutex> lock(*hdf5LibMutex);
|
||||||
std::unique_ptr<H5File> fd{nullptr};
|
std::unique_ptr<H5::H5File> fd{nullptr};
|
||||||
try {
|
try {
|
||||||
Exception::dontPrint(); // to handle errors
|
H5::Exception::dontPrint(); // to handle errors
|
||||||
|
|
||||||
FileAccPropList flist;
|
H5::FileAccPropList flist;
|
||||||
flist.setFcloseDegree(H5F_CLOSE_STRONG);
|
flist.setFcloseDegree(H5F_CLOSE_STRONG);
|
||||||
|
|
||||||
// open master file
|
// open master file
|
||||||
H5File masterfd(masterFileName.c_str(), H5F_ACC_RDWR,
|
H5::H5File masterfd(masterFileName.c_str(), H5F_ACC_RDWR,
|
||||||
FileCreatPropList::DEFAULT, flist);
|
H5::FileCreatPropList::DEFAULT, flist);
|
||||||
|
|
||||||
// open data file
|
// open data file
|
||||||
fd = make_unique<H5File>(dataFilename.c_str(), H5F_ACC_RDONLY,
|
fd = make_unique<H5::H5File>(dataFilename.c_str(), H5F_ACC_RDONLY,
|
||||||
FileCreatPropList::DEFAULT, flist);
|
H5::FileCreatPropList::DEFAULT, flist);
|
||||||
|
|
||||||
// create link for data dataset
|
// create link for data dataset
|
||||||
DataSet dset = fd->openDataSet(dataSetname.c_str());
|
H5::DataSet dset = fd->openDataSet(DATASET_NAME);
|
||||||
std::string linkname = std::string("/entry/data/") + dataSetname;
|
std::string linkname = std::string("/entry/data/") + std::string(DATASET_NAME);
|
||||||
if (H5Lcreate_external(dataFilename.c_str(), dataSetname.c_str(),
|
if (H5Lcreate_external(dataFilename.c_str(), DATASET_NAME,
|
||||||
masterfd.getLocId(), linkname.c_str(),
|
masterfd.getLocId(), linkname.c_str(),
|
||||||
H5P_DEFAULT, H5P_DEFAULT) < 0) {
|
H5P_DEFAULT, H5P_DEFAULT) < 0) {
|
||||||
throw RuntimeError(
|
throw RuntimeError(
|
||||||
@ -81,7 +80,7 @@ void LinkHDF5FileInMaster(const std::string &masterFileName,
|
|||||||
|
|
||||||
// create link for parameter datasets
|
// create link for parameter datasets
|
||||||
for (unsigned int i = 0; i < parameterNames.size(); ++i) {
|
for (unsigned int i = 0; i < parameterNames.size(); ++i) {
|
||||||
DataSet pDset = fd->openDataSet(parameterNames[i].c_str());
|
H5::DataSet pDset = fd->openDataSet(parameterNames[i].c_str());
|
||||||
linkname = std::string("/entry/data/") + parameterNames[i];
|
linkname = std::string("/entry/data/") + parameterNames[i];
|
||||||
if (H5Lcreate_external(dataFilename.c_str(),
|
if (H5Lcreate_external(dataFilename.c_str(),
|
||||||
parameterNames[i].c_str(),
|
parameterNames[i].c_str(),
|
||||||
@ -93,7 +92,7 @@ void LinkHDF5FileInMaster(const std::string &masterFileName,
|
|||||||
}
|
}
|
||||||
fd->close();
|
fd->close();
|
||||||
masterfd.close();
|
masterfd.close();
|
||||||
} catch (const Exception &error) {
|
} catch (const H5::Exception &error) {
|
||||||
error.printErrorStack();
|
error.printErrorStack();
|
||||||
if (fd != nullptr)
|
if (fd != nullptr)
|
||||||
fd->close();
|
fd->close();
|
||||||
@ -118,38 +117,38 @@ std::string CreateMasterHDF5File(const std::string &filePath,
|
|||||||
|
|
||||||
std::lock_guard<std::mutex> lock(*hdf5LibMutex);
|
std::lock_guard<std::mutex> lock(*hdf5LibMutex);
|
||||||
|
|
||||||
std::unique_ptr<H5File> fd{nullptr};
|
std::unique_ptr<H5::H5File> fd{nullptr};
|
||||||
try {
|
try {
|
||||||
Exception::dontPrint(); // to handle errors
|
H5::Exception::dontPrint(); // to handle errors
|
||||||
|
|
||||||
FileAccPropList flist;
|
H5::FileAccPropList flist;
|
||||||
flist.setFcloseDegree(H5F_CLOSE_STRONG);
|
flist.setFcloseDegree(H5F_CLOSE_STRONG);
|
||||||
|
|
||||||
unsigned int createFlags = H5F_ACC_EXCL;
|
unsigned int createFlags = H5F_ACC_EXCL;
|
||||||
if (overWriteEnable) {
|
if (overWriteEnable) {
|
||||||
createFlags = H5F_ACC_TRUNC;
|
createFlags = H5F_ACC_TRUNC;
|
||||||
}
|
}
|
||||||
fd = make_unique<H5File>(fileName.c_str(), createFlags,
|
fd = make_unique<H5::H5File>(fileName.c_str(), createFlags,
|
||||||
FileCreatPropList::DEFAULT, flist);
|
H5::FileCreatPropList::DEFAULT, flist);
|
||||||
|
|
||||||
// attributes - version
|
// attributes - version
|
||||||
double dValue = HDF5_WRITER_VERSION;
|
double dValue = HDF5_WRITER_VERSION;
|
||||||
DataSpace dataspace_attr = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace_attr = H5::DataSpace(H5S_SCALAR);
|
||||||
Attribute attribute = fd->createAttribute(
|
H5::Attribute attribute = fd->createAttribute(
|
||||||
"version", PredType::NATIVE_DOUBLE, dataspace_attr);
|
"version", H5::PredType::NATIVE_DOUBLE, dataspace_attr);
|
||||||
attribute.write(PredType::NATIVE_DOUBLE, &dValue);
|
attribute.write(H5::PredType::NATIVE_DOUBLE, &dValue);
|
||||||
|
|
||||||
// Create a group in the file
|
// Create a group in the file
|
||||||
Group group1(fd->createGroup("entry"));
|
H5::Group group1(fd->createGroup("entry"));
|
||||||
Group group2(group1.createGroup("data"));
|
H5::Group group2(group1.createGroup("data"));
|
||||||
Group group3(group1.createGroup("instrument"));
|
H5::Group group3(group1.createGroup("instrument"));
|
||||||
Group group4(group3.createGroup("beam"));
|
H5::Group group4(group3.createGroup("beam"));
|
||||||
Group group5(group3.createGroup("detector"));
|
H5::Group group5(group3.createGroup("detector"));
|
||||||
Group group6(group1.createGroup("sample"));
|
H5::Group group6(group1.createGroup("sample"));
|
||||||
|
|
||||||
attr->WriteHDF5Attributes(fd.get(), &group5);
|
attr->WriteHDF5Attributes(fd.get(), &group5);
|
||||||
fd->close();
|
fd->close();
|
||||||
} catch (const Exception &error) {
|
} catch (const H5::Exception &error) {
|
||||||
error.printErrorStack();
|
error.printErrorStack();
|
||||||
if (fd != nullptr)
|
if (fd != nullptr)
|
||||||
fd->close();
|
fd->close();
|
||||||
@ -162,16 +161,16 @@ std::string CreateMasterHDF5File(const std::string &filePath,
|
|||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::array<std::string, 2> CreateVirtualHDF5File(
|
std::string CreateVirtualHDF5File(
|
||||||
const std::string &filePath, const std::string &fileNamePrefix,
|
const std::string &filePath, const std::string &fileNamePrefix,
|
||||||
const uint64_t fileIndex, const bool overWriteEnable, const bool silentMode,
|
const uint64_t fileIndex, const bool overWriteEnable, const bool silentMode,
|
||||||
const int modulePos, const int numUnitsPerReadout,
|
const int modulePos, const int numUnitsPerReadout,
|
||||||
const uint32_t maxFramesPerFile, const uint64_t numImages,
|
const uint32_t maxFramesPerFile,
|
||||||
const uint32_t nPixelsX, const uint32_t nPixelsY,
|
const uint32_t nPixelsX, const uint32_t nPixelsY,
|
||||||
const uint32_t dynamicRange, const uint64_t numImagesCaught,
|
const uint32_t dynamicRange, const uint64_t numImagesCaught,
|
||||||
const int numModX, const int numModY, const DataType dataType,
|
const int numModX, const int numModY, const H5::DataType dataType,
|
||||||
const std::vector<std::string> parameterNames,
|
const std::vector<std::string> parameterNames,
|
||||||
const std::vector<DataType> parameterDataTypes, std::mutex *hdf5LibMutex,
|
const std::vector<H5::DataType> parameterDataTypes, std::mutex *hdf5LibMutex,
|
||||||
bool gotthard25um) {
|
bool gotthard25um) {
|
||||||
|
|
||||||
// virtual file name
|
// virtual file name
|
||||||
@ -180,8 +179,6 @@ std::array<std::string, 2> CreateVirtualHDF5File(
|
|||||||
<< "_" << fileIndex << ".h5";
|
<< "_" << fileIndex << ".h5";
|
||||||
std::string fileName = osfn.str();
|
std::string fileName = osfn.str();
|
||||||
|
|
||||||
std::string dataSetName = "data";
|
|
||||||
|
|
||||||
unsigned int paraSize = parameterNames.size();
|
unsigned int paraSize = parameterNames.size();
|
||||||
uint64_t numModZ = numModX;
|
uint64_t numModZ = numModX;
|
||||||
uint32_t nDimy = nPixelsY;
|
uint32_t nDimy = nPixelsY;
|
||||||
@ -189,42 +186,42 @@ std::array<std::string, 2> CreateVirtualHDF5File(
|
|||||||
|
|
||||||
std::lock_guard<std::mutex> lock(*hdf5LibMutex);
|
std::lock_guard<std::mutex> lock(*hdf5LibMutex);
|
||||||
|
|
||||||
std::unique_ptr<H5File> fd{nullptr};
|
std::unique_ptr<H5::H5File> fd{nullptr};
|
||||||
try {
|
try {
|
||||||
Exception::dontPrint(); // to handle errors
|
H5::Exception::dontPrint(); // to handle errors
|
||||||
|
|
||||||
// file
|
// file
|
||||||
FileAccPropList fapl;
|
H5::FileAccPropList fapl;
|
||||||
fapl.setFcloseDegree(H5F_CLOSE_STRONG);
|
fapl.setFcloseDegree(H5F_CLOSE_STRONG);
|
||||||
if (!overWriteEnable)
|
if (!overWriteEnable)
|
||||||
fd = make_unique<H5File>(fileName.c_str(), H5F_ACC_EXCL,
|
fd = make_unique<H5::H5File>(fileName.c_str(), H5F_ACC_EXCL,
|
||||||
FileCreatPropList::DEFAULT, fapl);
|
H5::FileCreatPropList::DEFAULT, fapl);
|
||||||
else
|
else
|
||||||
fd = make_unique<H5File>(fileName.c_str(), H5F_ACC_TRUNC,
|
fd = make_unique<H5::H5File>(fileName.c_str(), H5F_ACC_TRUNC,
|
||||||
FileCreatPropList::DEFAULT, fapl);
|
H5::FileCreatPropList::DEFAULT, fapl);
|
||||||
|
|
||||||
// attributes - version
|
// attributes - version
|
||||||
double dValue = HDF5_WRITER_VERSION;
|
double dValue = HDF5_WRITER_VERSION;
|
||||||
DataSpace dataspace_attr = DataSpace(H5S_SCALAR);
|
H5::DataSpace dataspace_attr = H5::DataSpace(H5S_SCALAR);
|
||||||
Attribute attribute = fd->createAttribute(
|
H5::Attribute attribute = fd->createAttribute(
|
||||||
"version", PredType::NATIVE_DOUBLE, dataspace_attr);
|
"version", H5::PredType::NATIVE_DOUBLE, dataspace_attr);
|
||||||
attribute.write(PredType::NATIVE_DOUBLE, &dValue);
|
attribute.write(H5::PredType::NATIVE_DOUBLE, &dValue);
|
||||||
|
|
||||||
// virtual dataspace
|
// virtual dataspace
|
||||||
hsize_t vdsDims[3] = {numImagesCaught, numModY * nDimy,
|
hsize_t vdsDims[3] = {numImagesCaught, numModY * nDimy,
|
||||||
numModZ * nDimz};
|
numModZ * nDimz};
|
||||||
DataSpace vdsDataSpace(3, vdsDims, nullptr);
|
H5::DataSpace vdsDataSpace(3, vdsDims, nullptr);
|
||||||
hsize_t vdsDimsPara[2] = {numImagesCaught,
|
hsize_t vdsDimsPara[2] = {numImagesCaught,
|
||||||
(unsigned int)numModY * numModZ};
|
(unsigned int)numModY * numModZ};
|
||||||
DataSpace vdsDataSpacePara(2, vdsDimsPara, nullptr);
|
H5::DataSpace vdsDataSpacePara(2, vdsDimsPara, nullptr);
|
||||||
|
|
||||||
// property list (fill value and datatype)
|
// property list (fill value and datatype)
|
||||||
int fill_value = -1;
|
int fill_value = -1;
|
||||||
DSetCreatPropList plist;
|
H5::DSetCreatPropList plist;
|
||||||
plist.setFillValue(dataType, &fill_value);
|
plist.setFillValue(dataType, &fill_value);
|
||||||
|
|
||||||
// property list for parameters (datatype)
|
// property list for parameters (datatype)
|
||||||
std::vector<DSetCreatPropList> plistPara(paraSize);
|
std::vector<H5::DSetCreatPropList> plistPara(paraSize);
|
||||||
|
|
||||||
// hyperslab (files)
|
// hyperslab (files)
|
||||||
int numFiles = numImagesCaught / maxFramesPerFile;
|
int numFiles = numImagesCaught / maxFramesPerFile;
|
||||||
@ -286,24 +283,17 @@ std::array<std::string, 2> CreateVirtualHDF5File(
|
|||||||
p + 1, srcFileName.length() - p));
|
p + 1, srcFileName.length() - p));
|
||||||
}
|
}
|
||||||
|
|
||||||
// source dataset name
|
|
||||||
std::ostringstream osfn;
|
|
||||||
osfn << "/data";
|
|
||||||
if (numImages > 1)
|
|
||||||
osfn << "_f" << std::setfill('0') << std::setw(12) << iFile;
|
|
||||||
std::string srcDatasetName = osfn.str();
|
|
||||||
|
|
||||||
// source dataspace
|
// source dataspace
|
||||||
hsize_t srcDims[3] = {nDimx, nDimy, nDimz};
|
hsize_t srcDims[3] = {nDimx, nDimy, nDimz};
|
||||||
hsize_t srcDimsMax[3] = {H5S_UNLIMITED, nDimy, nDimz};
|
hsize_t srcDimsMax[3] = {H5S_UNLIMITED, nDimy, nDimz};
|
||||||
DataSpace srcDataSpace(3, srcDims, srcDimsMax);
|
H5::DataSpace srcDataSpace(3, srcDims, srcDimsMax);
|
||||||
hsize_t srcDimsPara[1] = {nDimx};
|
hsize_t srcDimsPara[1] = {nDimx};
|
||||||
hsize_t srcDimsMaxPara[1] = {H5S_UNLIMITED};
|
hsize_t srcDimsMaxPara[1] = {H5S_UNLIMITED};
|
||||||
DataSpace srcDataSpacePara(1, srcDimsPara, srcDimsMaxPara);
|
H5::DataSpace srcDataSpacePara(1, srcDimsPara, srcDimsMaxPara);
|
||||||
|
|
||||||
// mapping of property list
|
// mapping of property list
|
||||||
plist.setVirtual(vdsDataSpace, relative_srcFileName.c_str(),
|
plist.setVirtual(vdsDataSpace, relative_srcFileName.c_str(),
|
||||||
srcDatasetName.c_str(), srcDataSpace);
|
DATASET_NAME, srcDataSpace);
|
||||||
for (unsigned int p = 0; p < paraSize; ++p) {
|
for (unsigned int p = 0; p < paraSize; ++p) {
|
||||||
plistPara[p].setVirtual(
|
plistPara[p].setVirtual(
|
||||||
vdsDataSpacePara, relative_srcFileName.c_str(),
|
vdsDataSpacePara, relative_srcFileName.c_str(),
|
||||||
@ -325,17 +315,17 @@ std::array<std::string, 2> CreateVirtualHDF5File(
|
|||||||
framesSaved += nDimx;
|
framesSaved += nDimx;
|
||||||
}
|
}
|
||||||
// datasets
|
// datasets
|
||||||
DataSet vdsDataSet(fd->createDataSet(dataSetName.c_str(), dataType,
|
H5::DataSet vdsDataSet(fd->createDataSet(DATASET_NAME, dataType,
|
||||||
vdsDataSpace, plist));
|
vdsDataSpace, plist));
|
||||||
|
|
||||||
for (unsigned int p = 0; p < paraSize; ++p) {
|
for (unsigned int p = 0; p < paraSize; ++p) {
|
||||||
DataSet vdsDataSetPara(fd->createDataSet(
|
H5::DataSet vdsDataSetPara(fd->createDataSet(
|
||||||
parameterNames[p].c_str(), parameterDataTypes[p],
|
parameterNames[p].c_str(), parameterDataTypes[p],
|
||||||
vdsDataSpacePara, plistPara[p]));
|
vdsDataSpacePara, plistPara[p]));
|
||||||
}
|
}
|
||||||
|
|
||||||
fd->close();
|
fd->close();
|
||||||
} catch (const Exception &error) {
|
} catch (const H5::Exception &error) {
|
||||||
error.printErrorStack();
|
error.printErrorStack();
|
||||||
if (fd) {
|
if (fd) {
|
||||||
fd->close();
|
fd->close();
|
||||||
@ -346,7 +336,7 @@ std::array<std::string, 2> CreateVirtualHDF5File(
|
|||||||
if (!silentMode) {
|
if (!silentMode) {
|
||||||
LOG(logINFO) << "Virtual File: " << fileName;
|
LOG(logINFO) << "Virtual File: " << fileName;
|
||||||
}
|
}
|
||||||
return std::array<std::string, 2>{fileName, dataSetName};
|
return fileName;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -4,17 +4,13 @@
|
|||||||
|
|
||||||
#include "MasterAttributes.h"
|
#include "MasterAttributes.h"
|
||||||
|
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
namespace sls {
|
namespace sls {
|
||||||
|
|
||||||
namespace masterFileUtility {
|
namespace masterFileUtility {
|
||||||
|
|
||||||
#ifdef HDF5C
|
|
||||||
#include "H5Cpp.h"
|
|
||||||
#include <mutex>
|
|
||||||
#ifndef H5_NO_NAMESPACE
|
|
||||||
using namespace H5;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
std::string CreateMasterBinaryFile(const std::string &filePath,
|
std::string CreateMasterBinaryFile(const std::string &filePath,
|
||||||
@ -25,10 +21,9 @@ std::string CreateMasterBinaryFile(const std::string &filePath,
|
|||||||
MasterAttributes *attr);
|
MasterAttributes *attr);
|
||||||
|
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
void LinkHDF5FileInMaster(const std::string &masterFileName,
|
void LinkHDF5FileInMaster(std::string &masterFileName,
|
||||||
const std::string &dataFilename,
|
std::string &dataFilename,
|
||||||
const std::string &dataSetname,
|
std::vector<std::string> parameterNames,
|
||||||
const std::vector<std::string> parameterNames,
|
|
||||||
const bool silentMode, std::mutex *hdf5LibMutex);
|
const bool silentMode, std::mutex *hdf5LibMutex);
|
||||||
|
|
||||||
std::string CreateMasterHDF5File(const std::string &filePath,
|
std::string CreateMasterHDF5File(const std::string &filePath,
|
||||||
@ -38,16 +33,16 @@ std::string CreateMasterHDF5File(const std::string &filePath,
|
|||||||
const bool silentMode, MasterAttributes *attr,
|
const bool silentMode, MasterAttributes *attr,
|
||||||
std::mutex *hdf5LibMutex);
|
std::mutex *hdf5LibMutex);
|
||||||
|
|
||||||
std::array<std::string, 2> CreateVirtualHDF5File(
|
std::string CreateVirtualHDF5File(
|
||||||
const std::string &filePath, const std::string &fileNamePrefix,
|
const std::string &filePath, const std::string &fileNamePrefix,
|
||||||
const uint64_t fileIndex, const bool overWriteEnable, const bool silentMode,
|
const uint64_t fileIndex, const bool overWriteEnable, const bool silentMode,
|
||||||
const int modulePos, const int numUnitsPerReadout,
|
const int modulePos, const int numUnitsPerReadout,
|
||||||
const uint32_t maxFramesPerFile, const uint64_t numImages,
|
const uint32_t maxFramesPerFile,
|
||||||
const uint32_t nPixelsX, const uint32_t nPixelsY,
|
const uint32_t nPixelsX, const uint32_t nPixelsY,
|
||||||
const uint32_t dynamicRange, const uint64_t numImagesCaught,
|
const uint32_t dynamicRange, const uint64_t numImagesCaught,
|
||||||
const int numModX, const int numModY, const DataType dataType,
|
const int numModX, const int numModY, const H5::DataType dataType,
|
||||||
const std::vector<std::string> parameterNames,
|
const std::vector<std::string> parameterNames,
|
||||||
const std::vector<DataType> parameterDataTypes, std::mutex *hdf5LibMutex,
|
const std::vector<H5::DataType> parameterDataTypes, std::mutex *hdf5LibMutex,
|
||||||
bool gotthard25um);
|
bool gotthard25um);
|
||||||
#endif
|
#endif
|
||||||
} // namespace masterFileUtility
|
} // namespace masterFileUtility
|
||||||
|
@ -37,10 +37,9 @@ namespace sls {
|
|||||||
#define FILE_BUFFER_SIZE (16 * 1024 * 1024) // 16mb
|
#define FILE_BUFFER_SIZE (16 * 1024 * 1024) // 16mb
|
||||||
|
|
||||||
// fifo
|
// fifo
|
||||||
#define FIFO_HEADER_NUMBYTES (8)
|
#define FIFO_HEADER_NUMBYTES (16)
|
||||||
#define FIFO_DATASIZE_NUMBYTES (4)
|
#define FIFO_DATASIZE_NUMBYTES (4)
|
||||||
#define FIFO_PADDING_NUMBYTES \
|
#define FIFO_HEADER_STREAM_ENABLE (8)
|
||||||
(4) // for 8 byte alignment due to sls_receiver_header structure
|
|
||||||
|
|
||||||
// hdf5
|
// hdf5
|
||||||
#define MAX_CHUNKED_IMAGES (1)
|
#define MAX_CHUNKED_IMAGES (1)
|
||||||
@ -59,4 +58,7 @@ namespace sls {
|
|||||||
#define TCP_PRIORITY (10)
|
#define TCP_PRIORITY (10)
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HDF5C
|
||||||
|
#define DATASET_NAME "/data"
|
||||||
|
#endif
|
||||||
} // namespace sls
|
} // namespace sls
|
||||||
|
@ -379,6 +379,8 @@ enum detFuncs {
|
|||||||
F_RECEIVER_GET_RECEIVER_ROI,
|
F_RECEIVER_GET_RECEIVER_ROI,
|
||||||
F_RECEIVER_SET_RECEIVER_ROI,
|
F_RECEIVER_SET_RECEIVER_ROI,
|
||||||
F_RECEIVER_SET_RECEIVER_ROI_METADATA,
|
F_RECEIVER_SET_RECEIVER_ROI_METADATA,
|
||||||
|
F_GET_RECEIVER_BUNCH_SIZE,
|
||||||
|
F_SET_RECEIVER_BUNCH_SIZE,
|
||||||
|
|
||||||
NUM_REC_FUNCTIONS
|
NUM_REC_FUNCTIONS
|
||||||
};
|
};
|
||||||
@ -756,6 +758,8 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
|||||||
case F_RECEIVER_GET_RECEIVER_ROI: return "F_RECEIVER_GET_RECEIVER_ROI";
|
case F_RECEIVER_GET_RECEIVER_ROI: return "F_RECEIVER_GET_RECEIVER_ROI";
|
||||||
case F_RECEIVER_SET_RECEIVER_ROI: return "F_RECEIVER_SET_RECEIVER_ROI";
|
case F_RECEIVER_SET_RECEIVER_ROI: return "F_RECEIVER_SET_RECEIVER_ROI";
|
||||||
case F_RECEIVER_SET_RECEIVER_ROI_METADATA: return "F_RECEIVER_SET_RECEIVER_ROI_METADATA";
|
case F_RECEIVER_SET_RECEIVER_ROI_METADATA: return "F_RECEIVER_SET_RECEIVER_ROI_METADATA";
|
||||||
|
case F_GET_RECEIVER_BUNCH_SIZE: return "F_GET_RECEIVER_BUNCH_SIZE";
|
||||||
|
case F_SET_RECEIVER_BUNCH_SIZE: return "F_SET_RECEIVER_BUNCH_SIZE";
|
||||||
|
|
||||||
case NUM_REC_FUNCTIONS: return "NUM_REC_FUNCTIONS";
|
case NUM_REC_FUNCTIONS: return "NUM_REC_FUNCTIONS";
|
||||||
default: return "Unknown Function";
|
default: return "Unknown Function";
|
||||||
|
@ -2,9 +2,6 @@
|
|||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
/** API versions */
|
/** API versions */
|
||||||
#define GITBRANCH "developer"
|
#define GITBRANCH "developer"
|
||||||
#define APILIB 0x220408
|
|
||||||
#define APIRECEIVER 0x220408
|
|
||||||
#define APIGUI 0x220328
|
|
||||||
#define APICTB 0x220524
|
#define APICTB 0x220524
|
||||||
#define APIGOTTHARD 0x220524
|
#define APIGOTTHARD 0x220524
|
||||||
#define APIJUNGFRAU 0x220524
|
#define APIJUNGFRAU 0x220524
|
||||||
@ -12,3 +9,6 @@
|
|||||||
#define APIEIGER 0x220524
|
#define APIEIGER 0x220524
|
||||||
#define APIGOTTHARD2 0x220602
|
#define APIGOTTHARD2 0x220602
|
||||||
#define APIMYTHEN3 0x220607
|
#define APIMYTHEN3 0x220607
|
||||||
|
#define APILIB 0x220609
|
||||||
|
#define APIRECEIVER 0x220609
|
||||||
|
#define APIGUI 0x220609
|
||||||
|
Reference in New Issue
Block a user