mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-11 07:10:02 +02:00
Guidetector (#54)
* WIP * dacWidget * main WIP * advanced WIP * WIP * WIP * WIP * WIP * WIP * WIP * works * updated gui to chrono * review fixes * unitque ptrs in gui
This commit is contained in:
parent
7a4c1161ab
commit
aafe049a9b
@ -219,39 +219,27 @@
|
||||
<property name="nativeMenuBar">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuUtilities">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>&Utilities</string>
|
||||
</property>
|
||||
<addaction name="actionOpenSetup"/>
|
||||
<addaction name="actionSaveSetup"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionOpenConfiguration"/>
|
||||
<addaction name="actionSaveConfiguration"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionLoadTrimbits"/>
|
||||
<addaction name="actionSaveTrimbits"/>
|
||||
<addaction name="separator"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuModes">
|
||||
<property name="title">
|
||||
<string>&Modes</string>
|
||||
</property>
|
||||
<addaction name="actionDebug"/>
|
||||
<addaction name="actionExpert"/>
|
||||
<addaction name="actionDockable"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuHelp">
|
||||
<property name="title">
|
||||
<string>&Help</string>
|
||||
</property>
|
||||
<addaction name="actionAbout"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuUtilities">
|
||||
<property name="title">
|
||||
<string>Utilities</string>
|
||||
</property>
|
||||
<addaction name="actionConfigurationLoad"/>
|
||||
<addaction name="actionTrimbitsLoad"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuModes">
|
||||
<property name="title">
|
||||
<string>Modes</string>
|
||||
</property>
|
||||
<addaction name="actionDebug"/>
|
||||
<addaction name="actionExpert"/>
|
||||
<addaction name="actionDockable"/>
|
||||
</widget>
|
||||
<addaction name="menuUtilities"/>
|
||||
<addaction name="menuModes"/>
|
||||
<addaction name="menuHelp"/>
|
||||
@ -477,40 +465,38 @@ p, li { white-space: pre-wrap; }
|
||||
<string>&About</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionConfigurationLoad">
|
||||
<property name="text">
|
||||
<string>Load Configuration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionTrimbitsLoad">
|
||||
<property name="text">
|
||||
<string>Load Trimbits</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDebug">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Debug</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExpert">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Expert</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDockable">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>D&ockable Windows</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLoadTrimbits">
|
||||
<property name="text">
|
||||
<string>&Load &Trimbits</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSaveTrimbits">
|
||||
<property name="text">
|
||||
<string>&Save &Trimbits</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLoadCalibration">
|
||||
<property name="text">
|
||||
<string>&Load C&alibration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSaveCalibration">
|
||||
<property name="text">
|
||||
<string>&Save C&alibration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionListenGuiClient">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Listen to Gui Client</string>
|
||||
<string>Dockable Windows</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
|
@ -54,7 +54,7 @@
|
||||
<enum>QTabWidget::North</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="elideMode">
|
||||
<enum>Qt::ElideLeft</enum>
|
||||
@ -418,7 +418,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Receiver UDP IP:</string>
|
||||
<string>Destination UDP IP:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -799,7 +799,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Receiver UDP Port:</string>
|
||||
<string>Destination UDP Port:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -942,7 +942,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Readout UDP MAC:</string>
|
||||
<string>Sourceadout UDP MAC:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -987,7 +987,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Receiver UDP MAC:</string>
|
||||
<string>Destination UDP MAC:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1000,7 +1000,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Readout UDP IP:</string>
|
||||
<string>Source UDP IP:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -55,6 +55,9 @@
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>The file path can be different depending on the Module chosen.</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
@ -532,31 +535,21 @@ Compression using Root. Available only for Gotthard in Expert Mode.
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridEiger">
|
||||
<item row="1" column="2">
|
||||
<widget class="QComboBox" name="comboEigerFlags1">
|
||||
<property name="minimumSize">
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Continous</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Store in RAM</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QComboBox" name="comboEigerClkDivider">
|
||||
@ -589,7 +582,7 @@ Compression using Root. Available only for Gotthard in Expert Mode.
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<item row="1" column="4">
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -618,8 +611,21 @@ Compression using Root. Available only for Gotthard in Expert Mode.
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QComboBox" name="comboEigerFlags2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblClkDivider">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>105</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clock Divider:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QComboBox" name="comboEigerParallelFlag">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@ -642,56 +648,6 @@ Compression using Root. Available only for Gotthard in Expert Mode.
|
||||
<string>Non Parallel</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Safe</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblClkDivider">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>105</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clock Divider:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@ -730,8 +686,6 @@ Compression using Root. Available only for Gotthard in Expert Mode.
|
||||
<tabstop>radioCustomDeadtime</tabstop>
|
||||
<tabstop>spinCustomDeadTime</tabstop>
|
||||
<tabstop>comboEigerClkDivider</tabstop>
|
||||
<tabstop>comboEigerFlags1</tabstop>
|
||||
<tabstop>comboEigerFlags2</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../include/icons.qrc"/>
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include "ui_form_dac.h"
|
||||
|
||||
class multiSlsDetector;
|
||||
#include "Detector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#include <string>
|
||||
@ -11,7 +11,7 @@ class qDacWidget:public QWidget, private Ui::WidgetDacObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qDacWidget(QWidget *parent, multiSlsDetector* detector, bool d, std::string n, slsDetectorDefs::dacIndex i, bool t);
|
||||
qDacWidget(QWidget *parent, sls::Detector* detector, bool d, std::string n, slsDetectorDefs::dacIndex i, bool t);
|
||||
~qDacWidget();
|
||||
void SetDetectorIndex(int id);
|
||||
|
||||
@ -25,7 +25,7 @@ private:
|
||||
void GetAdc();
|
||||
void Refresh();
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *det;
|
||||
bool isDac{true};
|
||||
slsDetectorDefs::dacIndex index;
|
||||
bool isMillideg{false};
|
||||
|
@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "multiSlsDetector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#include <QAbstractButton>
|
||||
@ -10,6 +9,15 @@
|
||||
#include <ostream>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <chrono>
|
||||
using std::chrono::duration;
|
||||
using std::chrono::duration_cast;
|
||||
using std::chrono::nanoseconds;
|
||||
using std::chrono::microseconds;
|
||||
using std::chrono::milliseconds;
|
||||
using std::chrono::seconds;
|
||||
using std::chrono::minutes;
|
||||
using std::chrono::hours;
|
||||
|
||||
#define CATCH_DISPLAY(m, s) catch(...) { qDefs::DisplayExceptions(m, s); }
|
||||
#define CATCH_HANDLE(...) catch(...) { qDefs::HandleExceptions(__VA_ARGS__); }
|
||||
@ -145,98 +153,81 @@ class qDefs : public QWidget {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* returns the value in ns to send to server as the
|
||||
* server class slsdetector accepts in ns.
|
||||
* @param unit unit of time
|
||||
* @param value time
|
||||
* returns time value in ns
|
||||
*/
|
||||
static double getNSTime(timeUnit unit, double value) {
|
||||
double valueNS = value;
|
||||
switch (unit) {
|
||||
/** returns the time in a user friendly time unit */
|
||||
static std::pair<double, timeUnit> getUserFriendlyTime(nanoseconds tns) {
|
||||
if (tns < microseconds(1)) {
|
||||
return std::make_pair(tns.count(), NANOSECONDS);
|
||||
}
|
||||
if (tns < milliseconds(1)) {
|
||||
return std::make_pair(
|
||||
duration_cast<duration<double, std::micro>>(tns).count(),
|
||||
MICROSECONDS);
|
||||
}
|
||||
if (tns < seconds(1)) {
|
||||
return std::make_pair(
|
||||
duration_cast<duration<double, std::milli>>(tns).count(),
|
||||
MILLISECONDS);
|
||||
}
|
||||
if (tns < minutes(1)) {
|
||||
return std::make_pair(duration_cast<duration<double>>(tns).count(),
|
||||
SECONDS);
|
||||
}
|
||||
if (tns < hours(1)) {
|
||||
return std::make_pair(
|
||||
duration_cast<duration<double, std::ratio<60>>>(tns).count(),
|
||||
MINUTES);
|
||||
}
|
||||
return std::make_pair(
|
||||
duration_cast<duration<double, std::ratio<3600>>>(tns).count(), HOURS);
|
||||
}
|
||||
|
||||
/** returns the value in ns */
|
||||
static nanoseconds getNSTime(std::pair<double, timeUnit> time) {
|
||||
switch (time.second) {
|
||||
case HOURS:
|
||||
valueNS *= 60;
|
||||
return std::chrono::duration_cast<std::chrono::nanoseconds>(
|
||||
std::chrono::duration<double, std::ratio<3600>>(time.first));
|
||||
case MINUTES:
|
||||
valueNS *= 60;
|
||||
return std::chrono::duration_cast<std::chrono::nanoseconds>(
|
||||
std::chrono::duration<double, std::ratio<60>>(time.first));
|
||||
case SECONDS:
|
||||
valueNS *= 1000;
|
||||
return std::chrono::duration_cast<std::chrono::nanoseconds>(
|
||||
std::chrono::duration<double>(time.first));
|
||||
case MILLISECONDS:
|
||||
valueNS *= 1000;
|
||||
return std::chrono::duration_cast<std::chrono::nanoseconds>(
|
||||
std::chrono::duration<double, std::milli>(time.first));
|
||||
case MICROSECONDS:
|
||||
valueNS *= 1000;
|
||||
case NANOSECONDS:
|
||||
return std::chrono::duration_cast<std::chrono::nanoseconds>(
|
||||
std::chrono::duration<double, std::micro>(time.first));
|
||||
default:
|
||||
break;
|
||||
return std::chrono::duration_cast<std::chrono::nanoseconds>(
|
||||
std::chrono::duration<double, std::nano>(time.first));
|
||||
}
|
||||
return valueNS;
|
||||
};
|
||||
|
||||
/**
|
||||
* returns the value in ms
|
||||
* @param unit unit of time
|
||||
* @param value time
|
||||
* returns time value in ms
|
||||
*/
|
||||
static double getMSTime(timeUnit unit, double value) {
|
||||
double valueMS = value;
|
||||
switch (unit) {
|
||||
case NANOSECONDS:
|
||||
valueMS /= 1000;
|
||||
case MICROSECONDS:
|
||||
valueMS /= 1000;
|
||||
return valueMS;
|
||||
}
|
||||
|
||||
/** returns the value in ms */
|
||||
static milliseconds getMSTime(std::pair<double, timeUnit> time) {
|
||||
switch (time.second) {
|
||||
case HOURS:
|
||||
valueMS *= 60;
|
||||
return std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
std::chrono::duration<double, std::ratio<3600>>(time.first));
|
||||
case MINUTES:
|
||||
valueMS *= 60;
|
||||
return std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
std::chrono::duration<double, std::ratio<60>>(time.first));
|
||||
case SECONDS:
|
||||
valueMS *= 1000;
|
||||
return std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
std::chrono::duration<double>(time.first));
|
||||
case MILLISECONDS:
|
||||
return std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
std::chrono::duration<double, std::milli>(time.first));
|
||||
case MICROSECONDS:
|
||||
return std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
std::chrono::duration<double, std::micro>(time.first));
|
||||
default:
|
||||
break;
|
||||
return std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
std::chrono::duration<double, std::nano>(time.first));
|
||||
}
|
||||
return valueMS;
|
||||
};
|
||||
|
||||
/**
|
||||
* returns the time in the appropriate time unit
|
||||
* @param value time in seconds
|
||||
* returns the time in an appropriate time and unit
|
||||
*/
|
||||
static std::pair<double, timeUnit> getCorrectTime(double value) {
|
||||
timeUnit unit;
|
||||
int intUnit = (int)SECONDS;
|
||||
|
||||
/**0 ms*/
|
||||
if (!value) {
|
||||
unit = MILLISECONDS;
|
||||
return std::make_pair(value, unit);
|
||||
}
|
||||
|
||||
/** hr, min, sec */
|
||||
if (value >= 1) {
|
||||
double newVal = value;
|
||||
while ((newVal >= 1) && (intUnit >= (int)HOURS)) {
|
||||
/** value retains the old value */
|
||||
value = newVal;
|
||||
newVal = value / (double)60;
|
||||
intUnit--;
|
||||
}
|
||||
/** returning the previous value*/
|
||||
unit = (timeUnit)(intUnit + 1);
|
||||
return std::make_pair(value, unit);
|
||||
}
|
||||
/** ms, us, ns */
|
||||
else {
|
||||
while ((value < 1) && (intUnit < (int)NANOSECONDS)) {
|
||||
value = value * (double)1000;
|
||||
intUnit++;
|
||||
}
|
||||
unit = (timeUnit)(intUnit);
|
||||
return std::make_pair(value, unit);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* displays an warning,error,info message
|
||||
|
@ -13,7 +13,7 @@ class qTabDebugging;
|
||||
class qTabDeveloper;
|
||||
class qTabMessages;
|
||||
|
||||
class multiSlsDetector;
|
||||
#include "Detector.h"
|
||||
|
||||
#include <QTabWidget>
|
||||
class QResizeEvent;
|
||||
@ -70,17 +70,17 @@ class qDetectorMain : public QMainWindow, private Ui::DetectorMainObject {
|
||||
NumberOfTabs
|
||||
};
|
||||
slsDetectorDefs::detectorType detType;
|
||||
multiSlsDetector* myDet;
|
||||
qDrawPlot* myPlot;
|
||||
MyTabWidget* tabs;
|
||||
qTabMeasurement* tabMeasurement;
|
||||
qTabDataOutput* tabDataOutput;
|
||||
qTabPlot* tabPlot;
|
||||
qTabSettings* tabSettings;
|
||||
qTabAdvanced* tabAdvanced;
|
||||
qTabDebugging* tabDebugging;
|
||||
qTabDeveloper* tabDeveloper;
|
||||
qTabMessages* tabMessages;
|
||||
std::unique_ptr<sls::Detector> det;
|
||||
std::unique_ptr<qDrawPlot> plot;
|
||||
std::unique_ptr<MyTabWidget> tabs;
|
||||
std::unique_ptr<qTabMeasurement> tabMeasurement;
|
||||
std::unique_ptr<qTabDataOutput> tabDataOutput;
|
||||
std::unique_ptr<qTabPlot> tabPlot;
|
||||
std::unique_ptr<qTabSettings> tabSettings;
|
||||
std::unique_ptr<qTabAdvanced> tabAdvanced;
|
||||
std::unique_ptr<qTabDebugging> tabDebugging;
|
||||
std::unique_ptr<qTabDeveloper> tabDeveloper;
|
||||
std::unique_ptr<qTabMessages> tabMessages;
|
||||
int isDeveloper;
|
||||
int heightPlotWindow;
|
||||
int heightCentralWidget;
|
||||
|
@ -3,20 +3,24 @@
|
||||
#include "ui_form_plot.h"
|
||||
|
||||
#include "qDefs.h"
|
||||
class detectorData;
|
||||
class SlsQt1DPlot;
|
||||
class SlsQtH1D;
|
||||
class SlsQt2DPlot;
|
||||
class qCloneWidget;
|
||||
class QResizeEvent;
|
||||
|
||||
class detectorData;
|
||||
#include "Detector.h"
|
||||
|
||||
class QResizeEvent;
|
||||
#include <QFutureWatcher>
|
||||
|
||||
#include <mutex>
|
||||
|
||||
class qDrawPlot : public QWidget, private Ui::PlotObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qDrawPlot(QWidget *parent, multiSlsDetector *detector);
|
||||
qDrawPlot(QWidget *parent, sls::Detector *detector);
|
||||
~qDrawPlot();
|
||||
bool GetIsRunning();
|
||||
void SetRunning(bool enable);
|
||||
@ -88,7 +92,7 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
||||
void Update2dXYRange();
|
||||
|
||||
static const int NUM_PEDESTAL_FRAMES = 20;
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *det;
|
||||
slsDetectorDefs::detectorType detType;
|
||||
|
||||
SlsQt1DPlot *plot1d{nullptr};
|
||||
|
@ -2,20 +2,20 @@
|
||||
|
||||
#include "ui_form_tab_advanced.h"
|
||||
|
||||
class multiSlsDetector;
|
||||
#include "Detector.h"
|
||||
|
||||
class qTabAdvanced:public QWidget, private Ui::TabAdvancedObject{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qTabAdvanced(QWidget *parent, multiSlsDetector* detector);
|
||||
qTabAdvanced(QWidget *parent, sls::Detector* detector);
|
||||
~qTabAdvanced();
|
||||
|
||||
public slots:
|
||||
void Refresh();
|
||||
|
||||
private slots:
|
||||
void SetDetector(int index);
|
||||
void SetDetector();
|
||||
void SetControlPort(int port);
|
||||
void SetStopPort(int port);
|
||||
void SetDetectorUDPIP();
|
||||
@ -60,7 +60,7 @@ private:
|
||||
void GetSubExposureTime();
|
||||
void GetSubDeadTime();
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *det;
|
||||
};
|
||||
|
||||
|
||||
|
@ -2,13 +2,13 @@
|
||||
|
||||
#include "ui_form_tab_dataoutput.h"
|
||||
|
||||
class multiSlsDetector;
|
||||
#include "Detector.h"
|
||||
|
||||
class qTabDataOutput:public QWidget, private Ui::TabDataOutputObject{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qTabDataOutput(QWidget *parent, multiSlsDetector* detector);
|
||||
qTabDataOutput(QWidget *parent, sls::Detector* detector);
|
||||
~qTabDataOutput();
|
||||
void Refresh();
|
||||
|
||||
@ -38,7 +38,7 @@ public:
|
||||
void GetSpeed();
|
||||
void GetFlags();
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *det;
|
||||
// Button group for radiobuttons for rate
|
||||
QButtonGroup *btnGroupRate;
|
||||
// enum for the Eiger clock divider
|
||||
@ -48,12 +48,7 @@ public:
|
||||
QUARTERSPEED,
|
||||
NUMBEROFSPEEDS
|
||||
};
|
||||
// enum for the Eiger readout flags1
|
||||
enum {
|
||||
CONTINUOUS,
|
||||
STOREINRAM
|
||||
};
|
||||
// enum for the Eiger readout flags2
|
||||
// enum for the Eiger Parallel flag
|
||||
enum {
|
||||
PARALLEL,
|
||||
NONPARALLEL
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include "ui_form_tab_debugging.h"
|
||||
|
||||
class multiSlsDetector;
|
||||
#include "Detector.h"
|
||||
|
||||
class QTreeWidget;
|
||||
class QTreeWidgetItem;
|
||||
@ -11,7 +11,7 @@ class qTabDebugging:public QWidget, private Ui::TabDebuggingObject{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qTabDebugging(QWidget *parent, multiSlsDetector* detector);
|
||||
qTabDebugging(QWidget *parent, sls::Detector* detector);
|
||||
~qTabDebugging();
|
||||
void Refresh();
|
||||
|
||||
@ -26,7 +26,7 @@ private:
|
||||
void Initialization();
|
||||
void PopulateDetectors();
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *det;
|
||||
/** Tree Widget displaying the detectors, modules */
|
||||
QTreeWidget *treeDet;
|
||||
QLabel *lblDetectorHostname;
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "ui_form_tab_developer.h"
|
||||
class qDacWidget;
|
||||
|
||||
class multiSlsDetector;
|
||||
#include "Detector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#include <string>
|
||||
@ -13,7 +13,7 @@ class qTabDeveloper:public QWidget, private Ui::TabDeveloperObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qTabDeveloper(QWidget *parent, multiSlsDetector* detector);
|
||||
qTabDeveloper(QWidget *parent, sls::Detector* detector);
|
||||
~qTabDeveloper();
|
||||
|
||||
public slots:
|
||||
@ -29,7 +29,7 @@ private:
|
||||
void GetHighVoltage();
|
||||
slsDetectorDefs::dacIndex getSLSIndex(slsDetectorDefs::detectorType detType, int index);
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *det;
|
||||
std::vector<qDacWidget*> dacWidgets;
|
||||
std::vector<qDacWidget*> adcWidgets;
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
class qDrawPlot;
|
||||
|
||||
class multiSlsDetector;
|
||||
#include "Detector.h"
|
||||
|
||||
class QStandardItemModel;
|
||||
|
||||
@ -12,7 +12,7 @@ class qTabMeasurement:public QWidget, private Ui::TabMeasurementObject{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qTabMeasurement(QWidget *parent, multiSlsDetector* detector, qDrawPlot* plot);
|
||||
qTabMeasurement(QWidget *parent, sls::Detector* detector, qDrawPlot* p);
|
||||
~qTabMeasurement();
|
||||
|
||||
void Refresh();
|
||||
@ -66,8 +66,8 @@ signals:
|
||||
void EnableTabsSignal(bool);
|
||||
void FileNameChangedSignal(QString);
|
||||
private:
|
||||
multiSlsDetector *myDet;
|
||||
qDrawPlot *myPlot;
|
||||
sls::Detector *det;
|
||||
qDrawPlot *plot;
|
||||
// enum for the timing mode
|
||||
enum{
|
||||
AUTO,
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
class qDrawPlot;
|
||||
|
||||
class multiSlsDetector;
|
||||
#include "Detector.h"
|
||||
|
||||
class QButtonGroup;
|
||||
|
||||
@ -12,7 +12,7 @@ class qTabPlot:public QWidget, private Ui::TabPlotObject{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qTabPlot(QWidget *parent,multiSlsDetector* detector, qDrawPlot* plot);
|
||||
qTabPlot(QWidget *parent, sls::Detector* detector, qDrawPlot* p);
|
||||
~qTabPlot();
|
||||
void SetScanArgument();
|
||||
void Refresh();
|
||||
@ -45,8 +45,8 @@ private:
|
||||
void SetXYRange();
|
||||
void MaintainAspectRatio(int dimension);
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
qDrawPlot *myPlot;
|
||||
sls::Detector *det;
|
||||
qDrawPlot *plot;
|
||||
bool is1d;
|
||||
|
||||
QButtonGroup *btnGroupPlotType{nullptr};
|
||||
|
@ -2,13 +2,13 @@
|
||||
|
||||
#include "ui_form_tab_settings.h"
|
||||
|
||||
class multiSlsDetector;
|
||||
#include "Detector.h"
|
||||
|
||||
class qTabSettings: public QWidget, private Ui::TabSettingsObject{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qTabSettings(QWidget *parent, multiSlsDetector* detector);
|
||||
qTabSettings(QWidget *parent, sls::Detector* detector);
|
||||
~qTabSettings();
|
||||
void Refresh();
|
||||
|
||||
@ -26,7 +26,7 @@ private:
|
||||
void GetDynamicRange();
|
||||
void GetThresholdEnergy();
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
sls::Detector *det;
|
||||
enum {
|
||||
STANDARD,
|
||||
FAST,
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
qDacWidget::qDacWidget(QWidget *parent, multiSlsDetector *detector, bool d, std::string n, slsDetectorDefs::dacIndex i, bool t) :
|
||||
QWidget(parent), myDet(detector), isDac(d), index(i), isMillideg(t) {
|
||||
qDacWidget::qDacWidget(QWidget *parent, sls::Detector *detector, bool d, std::string n, slsDetectorDefs::dacIndex i, bool t) :
|
||||
QWidget(parent), det(detector), isDac(d), index(i), isMillideg(t) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow(n);
|
||||
}
|
||||
@ -43,10 +43,10 @@ void qDacWidget::GetDac() {
|
||||
disconnect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac()));
|
||||
try {
|
||||
// dac units
|
||||
auto retval = myDet->setDAC(-1, index, 0, detectorIndex);
|
||||
auto retval = det->getDAC(index, 0, {detectorIndex}).squash(-1);
|
||||
spinDac->setValue(retval);
|
||||
// mv
|
||||
retval = myDet->setDAC(-1, index, 1, detectorIndex);
|
||||
retval = det->getDAC(index, 1, {detectorIndex}).squash(-1);
|
||||
lblDacmV->setText(QString("%1mV").arg(retval -10));
|
||||
} CATCH_DISPLAY(std::string("Could not get dac ") + std::to_string(index), "qDacWidget::GetDac")
|
||||
|
||||
@ -59,7 +59,7 @@ void qDacWidget::SetDac() {
|
||||
FILE_LOG(logINFO) << "Setting dac:" << lblDac->text().toAscii().data() << " : " << val;
|
||||
|
||||
try {
|
||||
myDet->setDAC(val, index, 0, detectorIndex);
|
||||
det->setDAC(val, index, 0, {detectorIndex});
|
||||
} CATCH_DISPLAY (std::string("Could not set dac ") + std::to_string(index), "qDacWidget::SetDac")
|
||||
|
||||
// update mV anyway
|
||||
@ -70,7 +70,7 @@ void qDacWidget::GetAdc() {
|
||||
FILE_LOG(logDEBUG) << "Getting ADC " << index;
|
||||
|
||||
try {
|
||||
auto retval = myDet->getADC(index, detectorIndex);
|
||||
auto retval = det->getTemperature(index, {detectorIndex}).squash(-1);
|
||||
if (retval == -1 && detectorIndex == -1) {
|
||||
spinDac->setValue(-1);
|
||||
} else {
|
||||
|
@ -115,51 +115,28 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app,
|
||||
SetUpWidgetWindow();
|
||||
}
|
||||
|
||||
qDetectorMain::~qDetectorMain() {
|
||||
if (myDet)
|
||||
delete myDet;
|
||||
if (myPlot)
|
||||
delete myPlot;
|
||||
if (tabs)
|
||||
delete tabs;
|
||||
if (tabMeasurement)
|
||||
delete tabMeasurement;
|
||||
if (tabDataOutput)
|
||||
delete tabDataOutput;
|
||||
if (tabPlot)
|
||||
delete tabPlot;
|
||||
if (tabSettings)
|
||||
delete tabSettings;
|
||||
if (tabAdvanced)
|
||||
delete tabAdvanced;
|
||||
if (tabDebugging)
|
||||
delete tabDebugging;
|
||||
if (tabDeveloper)
|
||||
delete tabDeveloper;
|
||||
if (tabMessages)
|
||||
delete tabMessages;
|
||||
}
|
||||
qDetectorMain::~qDetectorMain() {}
|
||||
|
||||
void qDetectorMain::SetUpWidgetWindow() {
|
||||
setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
|
||||
// plot setup
|
||||
myPlot = new qDrawPlot(dockWidgetPlot, myDet);
|
||||
plot = sls::make_unique<qDrawPlot>(dockWidgetPlot, det.get());
|
||||
FILE_LOG(logDEBUG) << "DockPlot ready";
|
||||
dockWidgetPlot->setWidget(myPlot);
|
||||
dockWidgetPlot->setWidget(plot.get());
|
||||
|
||||
// tabs setup
|
||||
tabs = new MyTabWidget(this);
|
||||
layoutTabs->addWidget(tabs);
|
||||
tabs = sls::make_unique<MyTabWidget>(this);
|
||||
layoutTabs->addWidget(tabs.get());
|
||||
|
||||
// creating all the other tab widgets
|
||||
tabMeasurement = new qTabMeasurement(this, myDet, myPlot);
|
||||
tabDataOutput = new qTabDataOutput(this, myDet);
|
||||
tabPlot = new qTabPlot(this, myDet, myPlot);
|
||||
tabSettings = new qTabSettings(this, myDet);
|
||||
tabAdvanced = new qTabAdvanced(this, myDet);
|
||||
tabDebugging = new qTabDebugging(this, myDet);
|
||||
tabDeveloper = new qTabDeveloper(this, myDet);
|
||||
tabMeasurement = sls::make_unique<qTabMeasurement>(this, det.get(), plot.get());
|
||||
tabDataOutput = sls::make_unique<qTabDataOutput>(this, det.get());
|
||||
tabPlot = sls::make_unique<qTabPlot>(this, det.get(), plot.get());
|
||||
tabSettings = sls::make_unique<qTabSettings>(this, det.get());
|
||||
tabAdvanced = sls::make_unique<qTabAdvanced>(this, det.get());
|
||||
tabDebugging = sls::make_unique<qTabDebugging>(this, det.get());
|
||||
tabDeveloper = sls::make_unique<qTabDeveloper>(this, det.get());
|
||||
|
||||
// creating the scroll area widgets for the tabs
|
||||
QScrollArea *scroll[NumberOfTabs];
|
||||
@ -168,13 +145,13 @@ void qDetectorMain::SetUpWidgetWindow() {
|
||||
scroll[i]->setFrameShape(QFrame::NoFrame);
|
||||
}
|
||||
// setting the tab widgets to the scrollareas
|
||||
scroll[MEASUREMENT]->setWidget(tabMeasurement);
|
||||
scroll[DATAOUTPUT]->setWidget(tabDataOutput);
|
||||
scroll[PLOT]->setWidget(tabPlot);
|
||||
scroll[SETTINGS]->setWidget(tabSettings);
|
||||
scroll[ADVANCED]->setWidget(tabAdvanced);
|
||||
scroll[DEBUGGING]->setWidget(tabDebugging);
|
||||
scroll[DEVELOPER]->setWidget(tabDeveloper);
|
||||
scroll[MEASUREMENT]->setWidget(tabMeasurement.get());
|
||||
scroll[DATAOUTPUT]->setWidget(tabDataOutput.get());
|
||||
scroll[PLOT]->setWidget(tabPlot.get());
|
||||
scroll[SETTINGS]->setWidget(tabSettings.get());
|
||||
scroll[ADVANCED]->setWidget(tabAdvanced.get());
|
||||
scroll[DEBUGGING]->setWidget(tabDebugging.get());
|
||||
scroll[DEVELOPER]->setWidget(tabDeveloper.get());
|
||||
// inserting all the tabs
|
||||
tabs->insertTab(MEASUREMENT, scroll[MEASUREMENT], "Measurement");
|
||||
tabs->insertTab(DATAOUTPUT, scroll[DATAOUTPUT], "Data Output");
|
||||
@ -184,17 +161,17 @@ void qDetectorMain::SetUpWidgetWindow() {
|
||||
tabs->insertTab(DEBUGGING, scroll[DEBUGGING], "Debugging");
|
||||
tabs->insertTab(DEVELOPER, scroll[DEVELOPER], "Developer");
|
||||
// no scroll buttons this way
|
||||
tabs->insertTab(MESSAGES, tabMessages, "Terminal");
|
||||
tabs->insertTab(MESSAGES, tabMessages.get(), "Terminal");
|
||||
|
||||
// swap tabs so that messages is last tab
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabMeasurement), MEASUREMENT);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabSettings), SETTINGS);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabDataOutput), DATAOUTPUT);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabPlot), PLOT);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabAdvanced), ADVANCED);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabDebugging), DEBUGGING);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabDeveloper), DEVELOPER);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabMessages), MESSAGES);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabMeasurement.get()), MEASUREMENT);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabSettings.get()), SETTINGS);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabDataOutput.get()), DATAOUTPUT);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabPlot.get()), PLOT);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabAdvanced.get()), ADVANCED);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabDebugging.get()), DEBUGGING);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabDeveloper.get()), DEVELOPER);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabMessages.get()), MESSAGES);
|
||||
tabs->setCurrentIndex(MEASUREMENT);
|
||||
|
||||
// other tab properties
|
||||
@ -213,8 +190,7 @@ void qDetectorMain::SetUpWidgetWindow() {
|
||||
tabs->setTabEnabled(DEBUGGING, false);
|
||||
tabs->setTabEnabled(ADVANCED, false);
|
||||
tabs->setTabEnabled(DEVELOPER, isDeveloper);
|
||||
actionLoadTrimbits->setVisible(false);
|
||||
actionSaveTrimbits->setVisible(false);
|
||||
actionTrimbitsLoad->setVisible(false);
|
||||
|
||||
dockWidgetPlot->setFloating(false);
|
||||
dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||
@ -232,40 +208,37 @@ void qDetectorMain::SetUpWidgetWindow() {
|
||||
void qDetectorMain::SetUpDetector(const std::string fName, int multiID) {
|
||||
|
||||
// instantiate detector and set window title
|
||||
myDet = new multiSlsDetector(multiID);
|
||||
det = sls::make_unique<sls::Detector>(multiID);
|
||||
|
||||
// create messages tab to capture config file loading logs
|
||||
tabMessages = new qTabMessages(this);
|
||||
tabMessages = sls::make_unique<qTabMessages>(this);
|
||||
|
||||
// loads the config file at startup
|
||||
if (!fName.empty())
|
||||
LoadConfigFile(fName);
|
||||
|
||||
// validate detector type (for GUI) and update menu
|
||||
detType = myDet->getDetectorTypeAsEnum();
|
||||
detType = det->getDetectorType().tsquash("Different detector type for all modules.");
|
||||
actionTrimbitsLoad->setEnabled(false);
|
||||
switch (detType) {
|
||||
case slsDetectorDefs::EIGER:
|
||||
actionTrimbitsLoad->setEnabled(true);
|
||||
break;
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
case slsDetectorDefs::JUNGFRAU:
|
||||
actionLoadTrimbits->setText("Load Settings");
|
||||
actionSaveTrimbits->setText("Save Settings");
|
||||
break;
|
||||
case slsDetectorDefs::MOENCH:
|
||||
actionLoadTrimbits->setEnabled(false);
|
||||
actionSaveTrimbits->setEnabled(false);
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
std::string errorMess =
|
||||
myDet->getHostname() + std::string(" has ") +
|
||||
myDet->getDetectorTypeAsString() + std::string(" detector type (") +
|
||||
std::to_string(detType) + std::string("). Exiting GUI.");
|
||||
sls::ToString(det->getHostname(), ',') + " has " +
|
||||
slsDetectorDefs::detectorTypeToString(det->getDetectorType().squash()) + " detector type (" +
|
||||
std::to_string(detType) + "). Exiting GUI.";
|
||||
throw sls::RuntimeError(errorMess.c_str());
|
||||
}
|
||||
|
||||
std::string title =
|
||||
"SLS Detector GUI : " + myDet->getDetectorTypeAsString() + " - " +
|
||||
myDet->getHostname();
|
||||
"SLS Detector GUI : " + slsDetectorDefs::detectorTypeToString(det->getDetectorType().squash()) + " - " +
|
||||
sls::ToString(det->getHostname(), ',');
|
||||
FILE_LOG(logINFO) << title;
|
||||
setWindowTitle(QString(title.c_str()));
|
||||
}
|
||||
@ -274,16 +247,16 @@ void qDetectorMain::Initialization() {
|
||||
// Dockable Plot
|
||||
connect(dockWidgetPlot, SIGNAL(topLevelChanged(bool)), this, SLOT(ResizeMainWindow(bool)));
|
||||
// tabs
|
||||
connect(tabs,SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*)));
|
||||
connect(tabs.get(),SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*)));
|
||||
// Measurement tab
|
||||
connect(tabMeasurement, SIGNAL(EnableTabsSignal(bool)), this, SLOT(EnableTabs(bool)));
|
||||
connect(tabMeasurement, SIGNAL(FileNameChangedSignal(QString)), myPlot, SLOT(SetSaveFileName(QString)));
|
||||
connect(tabMeasurement.get(), SIGNAL(EnableTabsSignal(bool)), this, SLOT(EnableTabs(bool)));
|
||||
connect(tabMeasurement.get(), SIGNAL(FileNameChangedSignal(QString)), plot.get(), SLOT(SetSaveFileName(QString)));
|
||||
// Plot tab
|
||||
connect(tabPlot, SIGNAL(DisableZoomSignal(bool)), this, SLOT(SetZoomToolTip(bool)));
|
||||
connect(tabPlot.get(), SIGNAL(DisableZoomSignal(bool)), this, SLOT(SetZoomToolTip(bool)));
|
||||
|
||||
// Plotting
|
||||
connect(myPlot, SIGNAL(AcquireFinishedSignal()), tabMeasurement, SLOT(AcquireFinished()));
|
||||
connect(myPlot, SIGNAL(AbortSignal()), tabMeasurement, SLOT(AbortAcquire()));
|
||||
connect(plot.get(), SIGNAL(AcquireFinishedSignal()), tabMeasurement.get(), SLOT(AcquireFinished()));
|
||||
connect(plot.get(), SIGNAL(AbortSignal()), tabMeasurement.get(), SLOT(AbortAcquire()));
|
||||
|
||||
// menubar
|
||||
// Modes Menu
|
||||
@ -324,7 +297,7 @@ void qDetectorMain::LoadConfigFile(const std::string fName) {
|
||||
FILE_LOG(logWARNING) << "File not recognized";
|
||||
} else {
|
||||
try {
|
||||
myDet->readConfigurationFile(fName);
|
||||
det->loadConfig(fName);
|
||||
} CATCH_DISPLAY ("Could not load config file.", "qDetectorMain::LoadConfigFile")
|
||||
}
|
||||
}
|
||||
@ -346,8 +319,7 @@ void qDetectorMain::EnableModes(QAction *action) {
|
||||
enable = actionExpert->isChecked();
|
||||
|
||||
tabs->setTabEnabled(ADVANCED, enable);
|
||||
actionLoadTrimbits->setVisible(enable && detType != slsDetectorDefs::MOENCH);
|
||||
actionSaveTrimbits->setVisible(enable && detType != slsDetectorDefs::MOENCH);
|
||||
actionTrimbitsLoad->setVisible(enable && detType == slsDetectorDefs::EIGER);
|
||||
FILE_LOG(logINFO) << "Expert Mode: "
|
||||
<< slsDetectorDefs::stringEnable(enable);
|
||||
}
|
||||
@ -369,53 +341,17 @@ void qDetectorMain::EnableModes(QAction *action) {
|
||||
void qDetectorMain::ExecuteUtilities(QAction *action) {
|
||||
bool refreshTabs = false;
|
||||
try {
|
||||
if (action == actionOpenSetup) {
|
||||
FILE_LOG(logDEBUG) << "Loading Setup";
|
||||
QString fName = QString(myDet->getFilePath().c_str());
|
||||
fName = QFileDialog::getOpenFileName(
|
||||
this, tr("Load Detector Setup"), fName,
|
||||
tr("Detector Setup files (*.det);;All Files(*)"));
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()) {
|
||||
refreshTabs = true;
|
||||
myDet->retrieveDetectorSetup(
|
||||
std::string(fName.toAscii().constData()));
|
||||
qDefs::Message(
|
||||
qDefs::INFORMATION,
|
||||
"The Setup Parameters have been loaded successfully.",
|
||||
"qDetectorMain::ExecuteUtilities");
|
||||
FILE_LOG(logINFO) << "Setup Parameters loaded successfully";
|
||||
}
|
||||
}
|
||||
|
||||
else if (action == actionSaveSetup) {
|
||||
FILE_LOG(logDEBUG) << "Saving Setup";
|
||||
QString fName = QString(myDet->getFilePath().c_str());
|
||||
fName = QFileDialog::getSaveFileName(
|
||||
this, tr("Save Current Detector Setup"), fName,
|
||||
tr("Detector Setup files (*.det);;All Files(*) "));
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()) {
|
||||
myDet->dumpDetectorSetup(
|
||||
std::string(fName.toAscii().constData()));
|
||||
qDefs::Message(
|
||||
qDefs::INFORMATION,
|
||||
"The Setup Parameters have been saved successfully.",
|
||||
"qDetectorMain::ExecuteUtilities");
|
||||
FILE_LOG(logINFO) << "Setup Parameters saved successfully";
|
||||
}
|
||||
}
|
||||
|
||||
else if (action == actionOpenConfiguration) {
|
||||
if (action == actionConfigurationLoad) {
|
||||
FILE_LOG(logDEBUG) << "Loading Configuration";
|
||||
QString fName = QString(myDet->getFilePath().c_str());
|
||||
QString fName = QString(det->getFilePath().squash("/tmp/").c_str());
|
||||
fName = QFileDialog::getOpenFileName(
|
||||
this, tr("Load Detector Configuration"), fName,
|
||||
tr("Configuration files (*.config);;All Files(*)"));
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()) {
|
||||
refreshTabs = true;
|
||||
myDet->readConfigurationFile(
|
||||
det->loadConfig(
|
||||
std::string(fName.toAscii().constData()));
|
||||
qDefs::Message(qDefs::INFORMATION,
|
||||
"The Configuration Parameters have been "
|
||||
@ -426,107 +362,30 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
|
||||
}
|
||||
}
|
||||
|
||||
else if (action == actionSaveConfiguration) {
|
||||
FILE_LOG(logDEBUG) << "Saving Configuration";
|
||||
QString fName = QString(myDet->getFilePath().c_str());
|
||||
fName = QFileDialog::getSaveFileName(
|
||||
this, tr("Save Current Detector Configuration"), fName,
|
||||
tr("Configuration files (*.config) ;;All Files(*)"));
|
||||
else if (action == actionTrimbitsLoad) {
|
||||
QString fName = QString((det->getSettingsDir().squash("/tmp/")).c_str());
|
||||
FILE_LOG(logDEBUG) << "Loading Trimbits";
|
||||
// so that even nonexisting files can be selected
|
||||
QFileDialog *fileDialog = new QFileDialog(
|
||||
this, tr("Load Detector Trimbits"), fName,
|
||||
tr("Trimbit files (*.trim noise.sn*);;All Files(*)"));
|
||||
fileDialog->setFileMode(QFileDialog::AnyFile);
|
||||
if (fileDialog->exec() == QDialog::Accepted)
|
||||
fName = fileDialog->selectedFiles()[0];
|
||||
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()) {
|
||||
myDet->writeConfigurationFile(
|
||||
det->loadTrimbits(
|
||||
std::string(fName.toAscii().constData()));
|
||||
qDefs::Message(qDefs::INFORMATION,
|
||||
"The Configuration Parameters have been saved "
|
||||
"successfully.",
|
||||
"qDetectorMain::ExecuteUtilities");
|
||||
FILE_LOG(logINFO)
|
||||
<< "Configuration Parameters saved successfully";
|
||||
qDefs::Message(
|
||||
qDefs::INFORMATION,
|
||||
"The Trimbits have been loaded successfully.",
|
||||
"qDetectorMain::ExecuteUtilities");
|
||||
FILE_LOG(logINFO) << "Trimbits loaded successfully";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (action == actionLoadTrimbits) {
|
||||
QString fName = QString((myDet->getSettingsDir()).c_str());
|
||||
// gotthard
|
||||
if (actionLoadTrimbits->text().contains("Settings")) {
|
||||
FILE_LOG(logDEBUG) << "Loading Settings";
|
||||
fName = QFileDialog::getOpenFileName(
|
||||
this, tr("Load Detector Settings"), fName,
|
||||
tr("Settings files (*.settings settings.sn*);;All "
|
||||
"Files(*)"));
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()) {
|
||||
myDet->loadSettingsFile(
|
||||
std::string(fName.toAscii().constData()), -1);
|
||||
qDefs::Message(
|
||||
qDefs::INFORMATION,
|
||||
"The Settings have been loaded successfully.",
|
||||
"qDetectorMain::ExecuteUtilities");
|
||||
FILE_LOG(logINFO) << "Settings loaded successfully";
|
||||
}
|
||||
|
||||
} // mythen and eiger
|
||||
else {
|
||||
FILE_LOG(logDEBUG) << "Loading Trimbits";
|
||||
// so that even nonexisting files can be selected
|
||||
QFileDialog *fileDialog = new QFileDialog(
|
||||
this, tr("Load Detector Trimbits"), fName,
|
||||
tr("Trimbit files (*.trim noise.sn*);;All Files(*)"));
|
||||
fileDialog->setFileMode(QFileDialog::AnyFile);
|
||||
if (fileDialog->exec() == QDialog::Accepted)
|
||||
fName = fileDialog->selectedFiles()[0];
|
||||
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()) {
|
||||
myDet->loadSettingsFile(
|
||||
std::string(fName.toAscii().constData()), -1);
|
||||
qDefs::Message(
|
||||
qDefs::INFORMATION,
|
||||
"The Trimbits have been loaded successfully.",
|
||||
"qDetectorMain::ExecuteUtilities");
|
||||
FILE_LOG(logINFO) << "Trimbits loaded successfully";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (action == actionSaveTrimbits) {
|
||||
// gotthard
|
||||
if (actionLoadTrimbits->text().contains("Settings")) {
|
||||
FILE_LOG(logDEBUG) << "Saving Settings";
|
||||
// different output directory so as not to overwrite
|
||||
QString fName = QString((myDet->getSettingsDir()).c_str());
|
||||
fName = QFileDialog::getSaveFileName(
|
||||
this, tr("Save Current Detector Settings"), fName,
|
||||
tr("Settings files (*.settings settings.sn*);;All "
|
||||
"Files(*) "));
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()) {
|
||||
myDet->saveSettingsFile(
|
||||
std::string(fName.toAscii().constData()), -1);
|
||||
qDefs::Message(qDefs::INFORMATION,
|
||||
"The Settings have been saved successfully.",
|
||||
"qDetectorMain::ExecuteUtilities");
|
||||
FILE_LOG(logINFO) << "Settings saved successfully";
|
||||
}
|
||||
} // mythen and eiger
|
||||
else {
|
||||
FILE_LOG(logDEBUG) << "Saving Trimbits";
|
||||
// different output directory so as not to overwrite
|
||||
QString fName = QString((myDet->getSettingsDir()).c_str());
|
||||
fName = QFileDialog::getSaveFileName(
|
||||
this, tr("Save Current Detector Trimbits"), fName,
|
||||
tr("Trimbit files (*.trim noise.sn*) ;;All Files(*)"));
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()) {
|
||||
myDet->saveSettingsFile(
|
||||
std::string(fName.toAscii().constData()), -1);
|
||||
qDefs::Message(qDefs::INFORMATION,
|
||||
"The Trimbits have been saved successfully.",
|
||||
"qDetectorMain::ExecuteUtilities");
|
||||
FILE_LOG(logINFO) << "Trimbits saved successfully";
|
||||
}
|
||||
}
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not execute utilities.", "qDetectorMain::ExecuteUtilities")
|
||||
|
||||
Refresh(tabs->currentIndex());
|
||||
@ -552,7 +411,7 @@ void qDetectorMain::ExecuteHelp(QAction *action) {
|
||||
std::string guiVersion = std::to_string(APIGUI);
|
||||
std::string clientVersion = "unknown";
|
||||
try {
|
||||
clientVersion = std::to_string(myDet->getId(slsDetectorDefs::THIS_SOFTWARE_VERSION));
|
||||
clientVersion = std::to_string(det->getClientVersion());
|
||||
} CATCH_DISPLAY ("Could not get client version.", "qDetectorMain::ExecuteHelp")
|
||||
|
||||
qDefs::Message(qDefs::INFORMATION,
|
||||
@ -660,10 +519,7 @@ void qDetectorMain::EnableTabs(bool enable) {
|
||||
tabs->setTabEnabled(MESSAGES, enable);
|
||||
|
||||
// actions check
|
||||
actionOpenSetup->setEnabled(enable);
|
||||
actionSaveSetup->setEnabled(enable);
|
||||
actionOpenConfiguration->setEnabled(enable);
|
||||
actionSaveConfiguration->setEnabled(enable);
|
||||
actionConfigurationLoad->setEnabled(enable);
|
||||
actionDebug->setEnabled(enable);
|
||||
actionExpert->setEnabled(enable);
|
||||
|
||||
@ -673,8 +529,7 @@ void qDetectorMain::EnableTabs(bool enable) {
|
||||
// expert
|
||||
bool expertTab = enable && (actionExpert->isChecked());
|
||||
tabs->setTabEnabled(ADVANCED, expertTab);
|
||||
actionLoadTrimbits->setVisible(expertTab && detType != slsDetectorDefs::MOENCH);
|
||||
actionSaveTrimbits->setVisible(expertTab && detType != slsDetectorDefs::MOENCH);
|
||||
actionTrimbitsLoad->setVisible(expertTab && detType == slsDetectorDefs::EIGER);
|
||||
|
||||
// moved to here, so that its all in order, instead of signals and different
|
||||
// threads
|
||||
@ -690,7 +545,7 @@ void qDetectorMain::EnableTabs(bool enable) {
|
||||
tabDeveloper->Refresh();
|
||||
|
||||
tabPlot->Refresh();
|
||||
myPlot->StartAcquisition();
|
||||
plot->StartAcquisition();
|
||||
} else { // to enable scan box
|
||||
tabPlot->Refresh();
|
||||
// to start adc timer
|
||||
|
@ -5,13 +5,15 @@
|
||||
#include "detectorData.h"
|
||||
#include "qCloneWidget.h"
|
||||
|
||||
#include "detectorData.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QPainter>
|
||||
#include <QtConcurrentRun>
|
||||
#include <QResizeEvent>
|
||||
|
||||
|
||||
qDrawPlot::qDrawPlot(QWidget *parent, multiSlsDetector *detector) : QWidget(parent), myDet(detector) {
|
||||
qDrawPlot::qDrawPlot(QWidget *parent, sls::Detector *detector) : QWidget(parent), det(detector) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
FILE_LOG(logINFO) << "Plots ready";
|
||||
@ -48,12 +50,12 @@ qDrawPlot::~qDrawPlot() {
|
||||
}
|
||||
|
||||
void qDrawPlot::SetupWidgetWindow() {
|
||||
detType = myDet->getDetectorTypeAsEnum();
|
||||
detType = det->getDetectorType().squash();
|
||||
// save
|
||||
try {
|
||||
std::string temp = myDet->getFilePath();
|
||||
std::string temp = det->getFilePath().squash("/tmp/");
|
||||
fileSavePath = QString(temp.c_str());
|
||||
temp = myDet->getFileName();
|
||||
temp = det->getFileNamePrefix().squash("xxx");
|
||||
fileSaveName = QString(temp.c_str());
|
||||
} catch (const std::exception &e) {
|
||||
qDefs::ExceptionMessage("Could not get file path or file name.", e.what(), "qDrawPlot::SetupWidgetWindow");
|
||||
@ -63,7 +65,7 @@ void qDrawPlot::SetupWidgetWindow() {
|
||||
|
||||
SetupPlots();
|
||||
SetDataCallBack(true);
|
||||
myDet->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack), this);
|
||||
det->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack), this);
|
||||
// future watcher to watch result of AcquireThread only because it uses signals/slots to handle acquire exception
|
||||
acqResultWatcher = new QFutureWatcher<std::string>();
|
||||
|
||||
@ -79,23 +81,27 @@ void qDrawPlot::SetupPlots() {
|
||||
setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
|
||||
// default image size
|
||||
slsDetectorDefs::xy res = myDet->getNumberOfChannels();
|
||||
slsDetectorDefs::xy res = det->getDetectorSize();
|
||||
nPixelsX = res.x;
|
||||
nPixelsY = res.y;
|
||||
switch(detType) {
|
||||
case slsDetectorDefs::MOENCH:
|
||||
npixelsy_jctb = (myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES, -1) * 2)/25;// for moench 03
|
||||
nPixelsX = npixelsx_jctb;
|
||||
nPixelsY = npixelsy_jctb;
|
||||
try{
|
||||
npixelsy_jctb = (det->getNumberOfAnalogSamples().tsquash("Inconsistent values for number of analog samples") * 2)/25;// for moench 03
|
||||
nPixelsX = npixelsx_jctb;
|
||||
nPixelsY = npixelsy_jctb;
|
||||
} CATCH_DISPLAY ("Could not get number of analog samples.", "qDrawPlot::SetupPlots")
|
||||
break;
|
||||
case slsDetectorDefs::EIGER:
|
||||
if (myDet->getQuad()) {
|
||||
nPixelsX /= 2;
|
||||
nPixelsY *= 2;
|
||||
if (nPixelsX != nPixelsY) {
|
||||
--nPixelsX;
|
||||
try{
|
||||
if (det->getQuad().tsquash("Inconsistent values for quad type")) {
|
||||
nPixelsX /= 2;
|
||||
nPixelsY *= 2;
|
||||
if (nPixelsX != nPixelsY) {
|
||||
--nPixelsX;
|
||||
}
|
||||
}
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get quad.", "qDrawPlot::SetupPlots")
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -310,10 +316,10 @@ void qDrawPlot::SetDataCallBack(bool enable) {
|
||||
FILE_LOG(logINFO) << "Setting data call back to " << std::boolalpha << enable << std::noboolalpha;
|
||||
if (enable) {
|
||||
isPlot = true;
|
||||
myDet->registerDataCallback(&(GetDataCallBack), this);
|
||||
det->registerDataCallback(&(GetDataCallBack), this);
|
||||
} else {
|
||||
isPlot = false;
|
||||
myDet->registerDataCallback(nullptr, this);
|
||||
det->registerDataCallback(nullptr, this);
|
||||
}
|
||||
|
||||
}
|
||||
@ -527,25 +533,13 @@ void qDrawPlot::StartAcquisition() {
|
||||
progress = 0;
|
||||
currentFrame = 0;
|
||||
boxPlot->setTitle("Old Plot");
|
||||
// check acquiring flag (from previous exit) or if running
|
||||
try{
|
||||
if (myDet->getAcquiringFlag()) {
|
||||
if (myDet->getRunStatus() != slsDetectorDefs::IDLE) {
|
||||
qDefs::Message(qDefs::WARNING, "Could not start acquisition as it is already in progress.\nClick start when finished.", "qDrawPlot::StartAcquisition");
|
||||
emit AbortSignal();
|
||||
return;
|
||||
} else {
|
||||
myDet->setAcquiringFlag(false);
|
||||
}
|
||||
det->clearAcquiringFlag(); // (from previous exit) or if running
|
||||
|
||||
}
|
||||
} CATCH_DISPLAY("Could not get detector stats.", "qDrawPlot::StartAcquisition");
|
||||
|
||||
// ensure data streaming in receiver (if plot enabled)
|
||||
if (isPlot) {
|
||||
try {
|
||||
if (myDet->enableDataStreamingFromReceiver() != 1) {
|
||||
myDet->enableDataStreamingFromReceiver(1);
|
||||
if (!det->getRxZmqDataStream().squash(false)) {
|
||||
det->setRxZmqDataStream(true);
|
||||
}
|
||||
} CATCH_DISPLAY("Could not enable data streaming in Receiver.", "qDrawPlot::StartAcquisition");
|
||||
}
|
||||
@ -571,8 +565,7 @@ void qDrawPlot::AcquireFinished() {
|
||||
FILE_LOG(logERROR) << "Acquisition Finished with an exception: " << mess;
|
||||
qDefs::ExceptionMessage("Acquire unsuccessful.", mess, "qDrawPlot::AcquireFinished");
|
||||
try{
|
||||
myDet->stopAcquisition();
|
||||
myDet->stopReceiver();
|
||||
det->stopAcquisition();
|
||||
} CATCH_DISPLAY("Could not stop acquisition and receiver.", "qDrawPlot::AcquireFinished");
|
||||
emit AbortSignal();
|
||||
}
|
||||
@ -582,7 +575,7 @@ void qDrawPlot::AcquireFinished() {
|
||||
std::string qDrawPlot::AcquireThread() {
|
||||
FILE_LOG(logDEBUG) << "Acquire Thread";
|
||||
try {
|
||||
myDet->acquire();
|
||||
det->acquire();
|
||||
} catch (const std::exception &e) {
|
||||
return std::string(e.what());
|
||||
}
|
||||
|
@ -1,10 +1,11 @@
|
||||
#include "qTabAdvanced.h"
|
||||
#include "qDefs.h"
|
||||
#include "network_utils.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
qTabAdvanced::qTabAdvanced(QWidget *parent, multiSlsDetector *detector)
|
||||
: QWidget(parent), myDet(detector) {
|
||||
qTabAdvanced::qTabAdvanced(QWidget *parent, sls::Detector *detector)
|
||||
: QWidget(parent), det(detector) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
FILE_LOG(logDEBUG) << "Advanced ready";
|
||||
@ -14,7 +15,7 @@ qTabAdvanced::~qTabAdvanced() {}
|
||||
|
||||
void qTabAdvanced::SetupWidgetWindow() {
|
||||
// enabling according to det type
|
||||
switch (myDet->getDetectorTypeAsEnum()) {
|
||||
switch (det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::EIGER:
|
||||
tab_trimming->setEnabled(true);
|
||||
lblSubExpTime->setEnabled(true);
|
||||
@ -55,7 +56,7 @@ void qTabAdvanced::Initialization() {
|
||||
|
||||
// network
|
||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetDetector(int)));
|
||||
SLOT(SetDetector()));
|
||||
connect(spinControlPort, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetControlPort(int)));
|
||||
connect(spinStopPort, SIGNAL(valueChanged(int)), this,
|
||||
@ -109,20 +110,21 @@ void qTabAdvanced::Initialization() {
|
||||
void qTabAdvanced::PopulateDetectors() {
|
||||
FILE_LOG(logDEBUG) << "Populating detectors";
|
||||
disconnect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetDetector(int)));
|
||||
SLOT(SetDetector()));
|
||||
disconnect(comboReadout, SIGNAL(currentIndexChanged(int)), this, SLOT(GetROI()));
|
||||
|
||||
comboDetector->clear();
|
||||
comboReadout->clear();
|
||||
for (unsigned int i = 0; i < myDet->size(); ++i) {
|
||||
comboDetector->addItem(QString(myDet->getHostname(i).c_str()));
|
||||
comboReadout->addItem(QString(myDet->getHostname(i).c_str()));
|
||||
auto res = det->getHostname();
|
||||
for (auto &it : res) {
|
||||
comboDetector->addItem(QString(it.c_str()));
|
||||
comboReadout->addItem(QString(it.c_str()));
|
||||
}
|
||||
comboDetector->setCurrentIndex(0);
|
||||
comboReadout->setCurrentIndex(0);
|
||||
|
||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetDetector(int)));
|
||||
SLOT(SetDetector()));
|
||||
connect(comboReadout, SIGNAL(currentIndexChanged(int)), this, SLOT(GetROI()));
|
||||
}
|
||||
|
||||
@ -132,7 +134,7 @@ void qTabAdvanced::GetControlPort() {
|
||||
SLOT(SetControlPort(int)));
|
||||
|
||||
try {
|
||||
int retval = myDet->setControlPort(-1, comboDetector->currentIndex());
|
||||
int retval = det->getControlPort({comboDetector->currentIndex()})[0];
|
||||
spinControlPort->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get detector control port.", "qTabAdvanced::GetControlPort")
|
||||
|
||||
@ -146,7 +148,7 @@ void qTabAdvanced::GetStopPort() {
|
||||
SLOT(SetStopPort(int)));
|
||||
|
||||
try {
|
||||
int retval = myDet->setStopPort(-1, comboDetector->currentIndex());
|
||||
int retval = det->getStopPort({comboDetector->currentIndex()})[0];
|
||||
spinStopPort->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get detector stop port.", "qTabAdvanced::GetStopPort")
|
||||
|
||||
@ -160,7 +162,7 @@ void qTabAdvanced::GetDetectorUDPIP() {
|
||||
SLOT(SetDetectorUDPIP()));
|
||||
|
||||
try {
|
||||
auto retval = myDet->getDetectorIP(comboDetector->currentIndex());
|
||||
auto retval = det->getSourceUDPIP({comboDetector->currentIndex()})[0].str();
|
||||
dispDetectorUDPIP->setText(QString(retval.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get detector UDP IP.", "qTabAdvanced::GetDetectorUDPIP")
|
||||
|
||||
@ -174,7 +176,7 @@ void qTabAdvanced::GetDetectorUDPMAC() {
|
||||
SLOT(SetDetectorUDPMAC()));
|
||||
|
||||
try {
|
||||
auto retval = myDet->getDetectorMAC(comboDetector->currentIndex());
|
||||
auto retval = det->getSourceUDPMAC({comboDetector->currentIndex()})[0].str();
|
||||
dispDetectorUDPMAC->setText(QString(retval.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get detector UDP MAC.", "qTabAdvanced::GetDetectorUDPMAC")
|
||||
|
||||
@ -189,7 +191,7 @@ void qTabAdvanced::GetCltZMQPort() {
|
||||
|
||||
try {
|
||||
int retval =
|
||||
myDet->getClientStreamingPort(comboDetector->currentIndex());
|
||||
det->getClientZmqPort({comboDetector->currentIndex()})[0];
|
||||
spinZMQPort->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get client zmq port.", "qTabAdvanced::GetCltZMQPort")
|
||||
|
||||
@ -203,7 +205,7 @@ void qTabAdvanced::GetCltZMQIP() {
|
||||
|
||||
try {
|
||||
auto retval =
|
||||
myDet->getClientStreamingIP(comboDetector->currentIndex());
|
||||
det->getClientZmqIp({comboDetector->currentIndex()})[0];
|
||||
dispZMQIP->setText(QString(retval.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get client zmq ip.", "qTabAdvanced::GetCltZMQIP")
|
||||
|
||||
@ -216,7 +218,7 @@ void qTabAdvanced::GetRxrHostname() {
|
||||
SLOT(SetRxrHostname()));
|
||||
|
||||
try {
|
||||
auto retval = myDet->getReceiverHostname(comboDetector->currentIndex());
|
||||
auto retval = det->getRxHostname({comboDetector->currentIndex()})[0];
|
||||
dispRxrHostname->setText(QString(retval.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get receiver hostname.", "qTabAdvanced::GetRxrHostname")
|
||||
|
||||
@ -230,7 +232,7 @@ void qTabAdvanced::GetRxrTCPPort() {
|
||||
SLOT(SetRxrTCPPort(int)));
|
||||
|
||||
try {
|
||||
int retval = myDet->getReceiverPort(comboDetector->currentIndex());
|
||||
int retval = det->getRxPort({comboDetector->currentIndex()})[0];
|
||||
spinRxrTCPPort->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get receiver tcp port.", "qTabAdvanced::GetRxrTCPPort")
|
||||
|
||||
@ -244,7 +246,7 @@ void qTabAdvanced::GetRxrUDPPort() {
|
||||
SLOT(SetRxrUDPPort(int)));
|
||||
|
||||
try {
|
||||
int retval = myDet->getReceiverUDPPort(comboDetector->currentIndex());
|
||||
int retval = det->getDestinationUDPPort({comboDetector->currentIndex()})[0];
|
||||
spinRxrUDPPort->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get receiver udp port.", "qTabAdvanced::GetRxrUDPPort")
|
||||
|
||||
@ -258,7 +260,7 @@ void qTabAdvanced::GetRxrUDPIP() {
|
||||
SLOT(SetRxrUDPIP()));
|
||||
|
||||
try {
|
||||
auto retval = myDet->getReceiverUDPIP(comboDetector->currentIndex());
|
||||
auto retval = det->getDestinationUDPIP({comboDetector->currentIndex()})[0].str();
|
||||
dispRxrUDPIP->setText(QString(retval.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get receiver udp ip.", "qTabAdvanced::GetRxrUDPIP")
|
||||
|
||||
@ -271,7 +273,7 @@ void qTabAdvanced::GetRxrUDPMAC() {
|
||||
SLOT(SetRxrUDPMAC()));
|
||||
|
||||
try {
|
||||
auto retval = myDet->getReceiverUDPMAC(comboDetector->currentIndex());
|
||||
auto retval = det->getDestinationUDPMAC({comboDetector->currentIndex()})[0].str();
|
||||
dispRxrUDPMAC->setText(QString(retval.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get receiver udp mac.", "qTabAdvanced::GetRxrUDPMAC")
|
||||
|
||||
@ -286,7 +288,7 @@ void qTabAdvanced::GetRxrZMQPort() {
|
||||
|
||||
try {
|
||||
int retval =
|
||||
myDet->getReceiverStreamingPort(comboDetector->currentIndex());
|
||||
det->getRxZmqPort({comboDetector->currentIndex()})[0];
|
||||
spinRxrZMQPort->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get receiver zmq port.", "qTabAdvanced::GetRxrZMQPort")
|
||||
|
||||
@ -301,14 +303,14 @@ void qTabAdvanced::GetRxrZMQIP() {
|
||||
|
||||
try {
|
||||
auto retval =
|
||||
myDet->getReceiverStreamingIP(comboDetector->currentIndex());
|
||||
det->getRxZmqIP({comboDetector->currentIndex()})[0];
|
||||
dispRxrZMQIP->setText(QString(retval.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get receiver zmq ip.", "qTabAdvanced::GetRxrZMQIP")
|
||||
|
||||
connect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP()));
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetDetector(int index) {
|
||||
void qTabAdvanced::SetDetector() {
|
||||
FILE_LOG(logDEBUG) << "Set Detector: "
|
||||
<< comboDetector->currentText().toAscii().data();
|
||||
|
||||
@ -326,13 +328,13 @@ void qTabAdvanced::SetDetector(int index) {
|
||||
GetRxrZMQPort();
|
||||
GetRxrZMQIP();
|
||||
|
||||
FILE_LOG(logDEBUG) << myDet->printReceiverConfiguration();
|
||||
FILE_LOG(logDEBUG) << det->printRxConfiguration();
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetControlPort(int port) {
|
||||
FILE_LOG(logINFO) << "Setting Control Port:" << port;
|
||||
try {
|
||||
myDet->setControlPort(port, comboDetector->currentIndex());
|
||||
det->setControlPort(port, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE("Could not set control port.", "qTabAdvanced::SetControlPort",
|
||||
this, &qTabAdvanced::GetControlPort)
|
||||
}
|
||||
@ -340,7 +342,7 @@ void qTabAdvanced::SetControlPort(int port) {
|
||||
void qTabAdvanced::SetStopPort(int port) {
|
||||
FILE_LOG(logINFO) << "Setting Stop Port:" << port;
|
||||
try {
|
||||
myDet->setStopPort(port, comboDetector->currentIndex());
|
||||
det->setStopPort(port, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set stop port.", "qTabAdvanced::SetStopPort", this,
|
||||
&qTabAdvanced::GetStopPort)
|
||||
}
|
||||
@ -349,7 +351,7 @@ void qTabAdvanced::SetDetectorUDPIP() {
|
||||
std::string s = dispDetectorUDPIP->text().toAscii().constData();
|
||||
FILE_LOG(logINFO) << "Setting Detector UDP IP:" << s;
|
||||
try {
|
||||
myDet->setDetectorIP(s, comboDetector->currentIndex());
|
||||
det->setSourceUDPIP(s, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Detector UDP IP.",
|
||||
"qTabAdvanced::SetDetectorUDPIP", this,
|
||||
&qTabAdvanced::GetDetectorUDPIP)
|
||||
@ -359,7 +361,7 @@ void qTabAdvanced::SetDetectorUDPMAC() {
|
||||
std::string s = dispDetectorUDPMAC->text().toAscii().constData();
|
||||
FILE_LOG(logINFO) << "Setting Detector UDP MAC:" << s;
|
||||
try {
|
||||
myDet->setDetectorMAC(s, comboDetector->currentIndex());
|
||||
det->setSourceUDPMAC(s, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Detector UDP MAC.",
|
||||
"qTabAdvanced::SetDetectorUDPMAC", this,
|
||||
&qTabAdvanced::GetDetectorUDPMAC)
|
||||
@ -368,8 +370,7 @@ void qTabAdvanced::SetDetectorUDPMAC() {
|
||||
void qTabAdvanced::SetCltZMQPort(int port) {
|
||||
FILE_LOG(logINFO) << "Setting Client ZMQ Port:" << port;
|
||||
try {
|
||||
myDet->setClientDataStreamingInPort(port,
|
||||
comboDetector->currentIndex());
|
||||
det->setClientZmqPort(port, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Client ZMQ port.",
|
||||
"qTabAdvanced::SetCltZMQPort", this,
|
||||
&qTabAdvanced::GetCltZMQPort)
|
||||
@ -379,7 +380,7 @@ void qTabAdvanced::SetCltZMQIP() {
|
||||
std::string s = dispZMQIP->text().toAscii().constData();
|
||||
FILE_LOG(logINFO) << "Setting Client ZMQ IP:" << s;
|
||||
try {
|
||||
myDet->setClientDataStreamingInIP(s, comboDetector->currentIndex());
|
||||
det->setClientZmqIp(s, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Client ZMQ IP.",
|
||||
"qTabAdvanced::SetCltZMQIP", this,
|
||||
&qTabAdvanced::GetCltZMQIP)
|
||||
@ -389,19 +390,19 @@ void qTabAdvanced::SetRxrHostname() {
|
||||
std::string s = dispZMQIP->text().toAscii().constData();
|
||||
FILE_LOG(logINFO) << "Setting Receiver Hostname:" << s;
|
||||
try {
|
||||
myDet->setReceiverHostname(s, comboDetector->currentIndex());
|
||||
det->setRxHostname(s, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Client ZMQ IP.",
|
||||
"qTabAdvanced::SetRxrHostname", this,
|
||||
&qTabAdvanced::GetRxrHostname)
|
||||
|
||||
// update all network widgets (receiver mainly)
|
||||
SetDetector(comboDetector->currentIndex());
|
||||
SetDetector();
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetRxrTCPPort(int port) {
|
||||
FILE_LOG(logINFO) << "Setting Receiver TCP Port:" << port;
|
||||
try {
|
||||
myDet->setReceiverPort(port, comboDetector->currentIndex());
|
||||
det->setRxPort(port, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Receiver TCP port.",
|
||||
"qTabAdvanced::SetRxrTCPPort", this,
|
||||
&qTabAdvanced::GetRxrTCPPort)
|
||||
@ -410,7 +411,7 @@ void qTabAdvanced::SetRxrTCPPort(int port) {
|
||||
void qTabAdvanced::SetRxrUDPPort(int port) {
|
||||
FILE_LOG(logINFO) << "Setting Receiver UDP Port:" << port;
|
||||
try {
|
||||
myDet->setReceiverUDPPort(port, comboDetector->currentIndex());
|
||||
det->setRxPort(port, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Receiver UDP port.",
|
||||
"qTabAdvanced::SetRxrUDPPort", this,
|
||||
&qTabAdvanced::GetRxrUDPPort)
|
||||
@ -420,7 +421,7 @@ void qTabAdvanced::SetRxrUDPIP() {
|
||||
std::string s = dispRxrUDPIP->text().toAscii().constData();
|
||||
FILE_LOG(logINFO) << "Setting Receiver UDP IP:" << s;
|
||||
try {
|
||||
myDet->setReceiverUDPIP(s, comboDetector->currentIndex());
|
||||
det->setDestinationUDPIP(s, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Receiver UDP IP.",
|
||||
"qTabAdvanced::SetRxrUDPIP", this,
|
||||
&qTabAdvanced::GetRxrUDPIP)
|
||||
@ -430,7 +431,7 @@ void qTabAdvanced::SetRxrUDPMAC() {
|
||||
std::string s = dispRxrUDPMAC->text().toAscii().constData();
|
||||
FILE_LOG(logINFO) << "Setting Receiver UDP MAC:" << s;
|
||||
try {
|
||||
myDet->setReceiverUDPMAC(s, comboDetector->currentIndex());
|
||||
det->setDestinationUDPMAC(s, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Receiver UDP MAC.",
|
||||
"qTabAdvanced::SetRxrUDPMAC", this,
|
||||
&qTabAdvanced::GetRxrUDPMAC)
|
||||
@ -439,8 +440,7 @@ void qTabAdvanced::SetRxrUDPMAC() {
|
||||
void qTabAdvanced::SetRxrZMQPort(int port) {
|
||||
FILE_LOG(logINFO) << "Setting Receiver ZMQ Port:" << port;
|
||||
try {
|
||||
myDet->setReceiverDataStreamingOutPort(port,
|
||||
comboDetector->currentIndex());
|
||||
det->setRxZmqPort(port, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Receiver ZMQ port.",
|
||||
"qTabAdvanced::SetRxrZMQPort", this,
|
||||
&qTabAdvanced::GetRxrZMQPort)
|
||||
@ -450,7 +450,7 @@ void qTabAdvanced::SetRxrZMQIP() {
|
||||
std::string s = dispRxrZMQIP->text().toAscii().constData();
|
||||
FILE_LOG(logINFO) << "Setting Receiver ZMQ IP:" << s;
|
||||
try {
|
||||
myDet->setReceiverDataStreamingOutIP(s, comboDetector->currentIndex());
|
||||
det->setRxZmqIP(s, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Receiver ZMQ IP.",
|
||||
"qTabAdvanced::SetRxrZMQIP", this,
|
||||
&qTabAdvanced::GetRxrZMQIP)
|
||||
@ -459,7 +459,7 @@ void qTabAdvanced::SetRxrZMQIP() {
|
||||
void qTabAdvanced::GetROI() {
|
||||
FILE_LOG(logDEBUG) << "Getting ROI";
|
||||
try {
|
||||
slsDetectorDefs::ROI roi = myDet->getROI(comboReadout->currentIndex());
|
||||
slsDetectorDefs::ROI roi = det->getROI({comboReadout->currentIndex()})[0];
|
||||
spinXmin->setValue(roi.xmin);
|
||||
spinXmax->setValue(roi.xmax);
|
||||
} CATCH_DISPLAY ("Could not get ROI.", "qTabAdvanced::GetROI")
|
||||
@ -482,7 +482,7 @@ void qTabAdvanced::SetROI() {
|
||||
// set roi
|
||||
FILE_LOG(logINFO) << "Setting ROI: [" << roi.xmin << ", " << roi.xmax << "]";
|
||||
try {
|
||||
myDet->setROI(roi, comboReadout->currentIndex());
|
||||
det->setROI(roi, {comboReadout->currentIndex()});
|
||||
} CATCH_DISPLAY ("Could not set these ROIs.",
|
||||
"qTabAdvanced::SetROI")
|
||||
|
||||
@ -496,7 +496,7 @@ void qTabAdvanced::GetAllTrimbits() {
|
||||
SLOT(SetAllTrimbits()));
|
||||
|
||||
try {
|
||||
int retval = myDet->setAllTrimbits(-1);
|
||||
int retval = det->getAllTrimbits().squash(-1);
|
||||
spinSetAllTrimbits->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get all trimbits.", "qTabAdvanced::GetAllTrimbits")
|
||||
|
||||
@ -509,7 +509,7 @@ void qTabAdvanced::SetAllTrimbits() {
|
||||
FILE_LOG(logINFO) << "Setting all trimbits:" << value;
|
||||
|
||||
try {
|
||||
myDet->setAllTrimbits(value);
|
||||
det->setAllTrimbits(value);
|
||||
} CATCH_HANDLE("Could not set all trimbits.", "qTabAdvanced::SetAllTrimbits",
|
||||
this, &qTabAdvanced::GetAllTrimbits)
|
||||
}
|
||||
@ -520,7 +520,7 @@ void qTabAdvanced::GetNumStoragecells() {
|
||||
SLOT(SetNumStoragecells(int)));
|
||||
|
||||
try {
|
||||
auto retval = myDet->setTimer(slsDetectorDefs::STORAGE_CELL_NUMBER);
|
||||
auto retval = det->getNumberOfAdditionalStorageCells().tsquash("Inconsistent values for number of addditional storage cells.");
|
||||
spinNumStoragecells->setValue(retval);
|
||||
} CATCH_DISPLAY (
|
||||
"Could not get number of additional storage cells.",
|
||||
@ -534,7 +534,7 @@ void qTabAdvanced::SetNumStoragecells(int value) {
|
||||
FILE_LOG(logINFO) << "Setting number of additional stoarge cells: "
|
||||
<< value;
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::STORAGE_CELL_NUMBER, value, -1);
|
||||
det->setNumberOfAdditionalStorageCells(value);
|
||||
} CATCH_HANDLE (
|
||||
"Could not set number of additional storage cells.",
|
||||
"qTabAdvanced::SetNumStoragecells", this,
|
||||
@ -547,24 +547,14 @@ void qTabAdvanced::GetSubExposureTime() {
|
||||
SLOT(SetSubExposureTime()));
|
||||
disconnect(comboSubExpTimeUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetSubExposureTime()));
|
||||
|
||||
try {
|
||||
int64_t retval =
|
||||
myDet->setTimer(slsDetectorDefs::SUBFRAME_ACQUISITION_TIME);
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING,
|
||||
"Subexptime is inconsistent for all detectors.",
|
||||
"qTabAdvanced::GetSubExposureTime");
|
||||
spinSubExpTime->setValue(-1);
|
||||
} else {
|
||||
double value = (double)(retval * (1E-9));
|
||||
auto time = qDefs::getCorrectTime(value);
|
||||
spinSubExpTime->setValue(time.first);
|
||||
comboSubExpTimeUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
}
|
||||
auto retval =
|
||||
det->getSubExptime().tsquash("Subexptime is inconsistent for all detectors.");
|
||||
auto time = qDefs::getUserFriendlyTime(retval);
|
||||
spinSubExpTime->setValue(time.first);
|
||||
comboSubExpTimeUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
} CATCH_DISPLAY ("Could not get sub exposure time.",
|
||||
"qTabSettings::GetSubExposureTime")
|
||||
|
||||
connect(spinSubExpTime, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(SetSubExposureTime()));
|
||||
connect(comboSubExpTimeUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
@ -572,17 +562,14 @@ void qTabAdvanced::GetSubExposureTime() {
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetSubExposureTime() {
|
||||
double timeNS =
|
||||
qDefs::getNSTime((qDefs::timeUnit)comboSubExpTimeUnit->currentIndex(),
|
||||
spinSubExpTime->value());
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(spinSubExpTime->value(), static_cast<qDefs::timeUnit>(comboSubExpTimeUnit->currentIndex())));
|
||||
FILE_LOG(logINFO)
|
||||
<< "Setting sub frame acquisition time to " << timeNS << " ns"
|
||||
<< "Setting sub frame acquisition time to " << timeNS.count() << " ns"
|
||||
<< "/" << spinSubExpTime->value()
|
||||
<< qDefs::getUnitString(
|
||||
(qDefs::timeUnit)comboSubExpTimeUnit->currentIndex());
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::SUBFRAME_ACQUISITION_TIME,
|
||||
(int64_t)timeNS, -1);
|
||||
det->setSubExptime(timeNS);
|
||||
} CATCH_DISPLAY ("Could not set sub exposure time.",
|
||||
"qTabAdvanced::SetSubExposureTime")
|
||||
|
||||
@ -595,24 +582,14 @@ void qTabAdvanced::GetSubDeadTime() {
|
||||
SLOT(SetSubDeadTime()));
|
||||
disconnect(comboSubDeadTimeUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetSubDeadTime()));
|
||||
|
||||
try {
|
||||
int64_t retval = myDet->setTimer(slsDetectorDefs::SUBFRAME_DEADTIME);
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING,
|
||||
"Sub dead time is inconsistent for all detectors.",
|
||||
"qTabAdvanced::GetSubDeadTime");
|
||||
spinSubDeadTime->setValue(-1);
|
||||
} else {
|
||||
double value = (double)(retval * (1E-9));
|
||||
auto time = qDefs::getCorrectTime(value);
|
||||
spinSubDeadTime->setValue(time.first);
|
||||
comboSubDeadTimeUnit->setCurrentIndex(
|
||||
static_cast<int>(time.second));
|
||||
}
|
||||
auto retval = det->getSubDeadTime().tsquash("Sub dead time is inconsistent for all detectors.");
|
||||
auto time = qDefs::getUserFriendlyTime(retval);
|
||||
spinSubDeadTime->setValue(time.first);
|
||||
comboSubDeadTimeUnit->setCurrentIndex(
|
||||
static_cast<int>(time.second));
|
||||
} CATCH_DISPLAY ("Could not get sub dead time.",
|
||||
"qTabSettings::GetSubDeadTime")
|
||||
|
||||
connect(spinSubDeadTime, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(SetSubDeadTime()));
|
||||
connect(comboSubDeadTimeUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
@ -620,20 +597,17 @@ void qTabAdvanced::GetSubDeadTime() {
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetSubDeadTime() {
|
||||
double timeNS =
|
||||
qDefs::getNSTime((qDefs::timeUnit)comboSubDeadTimeUnit->currentIndex(),
|
||||
spinSubDeadTime->value());
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(spinSubDeadTime->value(), static_cast<qDefs::timeUnit>(comboSubDeadTimeUnit->currentIndex())));
|
||||
|
||||
FILE_LOG(logINFO)
|
||||
<< "Setting sub frame dead time to " << timeNS << " ns"
|
||||
<< "Setting sub frame dead time to " << timeNS.count() << " ns"
|
||||
<< "/" << spinSubDeadTime->value()
|
||||
<< qDefs::getUnitString(
|
||||
(qDefs::timeUnit)comboSubDeadTimeUnit->currentIndex());
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::SUBFRAME_DEADTIME, (int64_t)timeNS,
|
||||
-1);
|
||||
det->setSubDeadTime(timeNS);
|
||||
} CATCH_DISPLAY ("Could not set sub dead time.",
|
||||
"qTabAdvanced::SetSubDeadTime")
|
||||
|
||||
GetSubDeadTime();
|
||||
}
|
||||
|
||||
@ -646,7 +620,7 @@ void qTabAdvanced::Refresh() {
|
||||
}
|
||||
|
||||
// update all network widgets
|
||||
SetDetector(comboDetector->currentIndex());
|
||||
SetDetector();
|
||||
|
||||
// roi
|
||||
if (tab_roi->isEnabled()) {
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <string>
|
||||
|
||||
|
||||
qTabDataOutput::qTabDataOutput(QWidget *parent, multiSlsDetector *detector) : QWidget(parent), myDet(detector), btnGroupRate(nullptr) {
|
||||
qTabDataOutput::qTabDataOutput(QWidget *parent, sls::Detector *detector) : QWidget(parent), det(detector), btnGroupRate(nullptr) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
FILE_LOG(logDEBUG) << "DataOutput ready";
|
||||
@ -28,7 +28,7 @@ void qTabDataOutput::SetupWidgetWindow() {
|
||||
btnGroupRate->addButton(radioCustomDeadtime, 1);
|
||||
|
||||
// enabling according to det type
|
||||
switch(myDet->getDetectorTypeAsEnum()) {
|
||||
switch(det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::EIGER:
|
||||
chkTenGiga->setEnabled(true);
|
||||
chkRate->setEnabled(true);
|
||||
@ -70,8 +70,7 @@ void qTabDataOutput::Initialization() {
|
||||
// flags, speed
|
||||
if (widgetEiger->isEnabled()) {
|
||||
connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed(int)));
|
||||
connect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
connect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
connect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,9 +79,11 @@ void qTabDataOutput::PopulateDetectors() {
|
||||
|
||||
comboDetector->clear();
|
||||
comboDetector->addItem("All");
|
||||
if (myDet->size() > 1) {
|
||||
for (unsigned int i = 0; i < myDet->size(); ++i)
|
||||
comboDetector->addItem(QString(myDet->getHostname(i).c_str()));
|
||||
if (det->size() > 1) {
|
||||
auto res = det->getHostname();
|
||||
for (auto &it : res) {
|
||||
comboDetector->addItem(QString(it.c_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,8 +91,10 @@ void qTabDataOutput::EnableBrowse() {
|
||||
FILE_LOG(logDEBUG) << "Getting browse enable";
|
||||
try {
|
||||
btnOutputBrowse->setEnabled(false); // exception default
|
||||
std::string receiverHostname = myDet->getReceiverHostname(comboDetector->currentIndex() - 1);
|
||||
if (receiverHostname == "localhost") {
|
||||
std::string rxHostname = det->getRxHostname({comboDetector->currentIndex() - 1}).squash("none");
|
||||
if (rxHostname == "none") {
|
||||
btnOutputBrowse->setEnabled(false);
|
||||
} else if (rxHostname == "localhost") {
|
||||
btnOutputBrowse->setEnabled(true);
|
||||
} else {
|
||||
std::string hostname;
|
||||
@ -101,7 +104,7 @@ void qTabDataOutput::EnableBrowse() {
|
||||
hostname.assign(host);
|
||||
}
|
||||
// client pc (hostname) same as reciever hostname
|
||||
if (hostname == receiverHostname) {
|
||||
if (hostname == rxHostname) {
|
||||
btnOutputBrowse->setEnabled(true);
|
||||
} else {
|
||||
btnOutputBrowse->setEnabled(false);
|
||||
@ -114,34 +117,26 @@ void qTabDataOutput::GetFileWrite() {
|
||||
FILE_LOG(logDEBUG) << "Getting file write enable";
|
||||
try {
|
||||
boxFileWriteEnabled->setEnabled(true); // exception default
|
||||
int retval = myDet->getFileWrite();
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "File write is inconsistent for all detectors.", "qTabDataOutput::GetFileWrite");
|
||||
boxFileWriteEnabled->setEnabled(true);
|
||||
} else {
|
||||
boxFileWriteEnabled->setEnabled(retval == 0 ? false : true);
|
||||
}
|
||||
auto retval = det->getFileWrite().tsquash("File write is inconsistent for all detectors.");
|
||||
boxFileWriteEnabled->setEnabled(retval);
|
||||
} CATCH_DISPLAY("Could not get file enable.", "qTabDataOutput::GetFileWrite")
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetFileName() {
|
||||
FILE_LOG(logDEBUG) << "Getting file name";
|
||||
try {
|
||||
auto retval = myDet->getFileName();
|
||||
auto retval = det->getFileNamePrefix().tsquash("File name is inconsistent for all detectors.");
|
||||
dispFileName->setText(QString(retval.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get file name prefix.", "qTabDataOutput::GetFileName")
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetOutputDir() {
|
||||
FILE_LOG(logDEBUG) << "Getting file path";
|
||||
|
||||
disconnect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir()));
|
||||
|
||||
try {
|
||||
std::string path = myDet->getFilePath(comboDetector->currentIndex() - 1);
|
||||
std::string path = det->getFilePath({comboDetector->currentIndex() - 1}).tsquash("File path is different for all detectors.");
|
||||
dispOutputDir->setText(QString(path.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get file path.", "qTabDataOutput::GetOutputDir")
|
||||
|
||||
connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir()));
|
||||
}
|
||||
|
||||
@ -170,7 +165,7 @@ void qTabDataOutput::SetOutputDir() {
|
||||
}
|
||||
std::string spath = std::string(path.toAscii().constData());
|
||||
try {
|
||||
myDet->setFilePath(spath, comboDetector->currentIndex() - 1);
|
||||
det->setFilePath(spath, {comboDetector->currentIndex() - 1});
|
||||
} CATCH_HANDLE ("Could not set output file path.", "qTabDataOutput::SetOutputDir", this, &qTabDataOutput::GetOutputDir)
|
||||
}
|
||||
}
|
||||
@ -178,44 +173,33 @@ void qTabDataOutput::SetOutputDir() {
|
||||
void qTabDataOutput::GetFileFormat() {
|
||||
FILE_LOG(logDEBUG) << "Getting File Format";
|
||||
disconnect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int)));
|
||||
|
||||
try {
|
||||
auto retval = myDet->getFileFormat();
|
||||
auto retval = det->getFileFormat().tsquash("File format is inconsistent for all detectors.");
|
||||
switch(retval) {
|
||||
case slsDetectorDefs::GET_FILE_FORMAT:
|
||||
qDefs::Message(qDefs::WARNING, "File Format is inconsistent for all detectors.", "qTabDataOutput::GetFileFormat");
|
||||
break;
|
||||
case slsDetectorDefs::BINARY:
|
||||
case slsDetectorDefs::HDF5:
|
||||
comboFileFormat->setCurrentIndex(static_cast<int>(retval));
|
||||
break;
|
||||
default:
|
||||
qDefs::Message(qDefs::WARNING, std::string("Unknown file format: ") + std::to_string(static_cast<int>(retval)), "qTabDataOutput::GetFileFormat");
|
||||
break;
|
||||
throw sls::RuntimeError(std::string("Unknown file format: ") + std::to_string(static_cast<int>(retval)));
|
||||
}
|
||||
} CATCH_DISPLAY("Could not get file format.", "qTabDataOutput::GetFileFormat")
|
||||
|
||||
connect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int)));
|
||||
}
|
||||
|
||||
void qTabDataOutput::SetFileFormat(int format) {
|
||||
FILE_LOG(logINFO) << "Setting File Format to " << comboFileFormat->currentText().toAscii().data();
|
||||
try {
|
||||
myDet->setFileFormat((slsDetectorDefs::fileFormat)comboFileFormat->currentIndex());
|
||||
det->setFileFormat(static_cast<slsDetectorDefs::fileFormat>(comboFileFormat->currentIndex()));
|
||||
} CATCH_HANDLE ("Could not set file format.", "qTabDataOutput::SetFileFormat", this, &qTabDataOutput::GetFileFormat)
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetFileOverwrite() {
|
||||
FILE_LOG(logDEBUG) << "Getting File Over Write Enable";
|
||||
disconnect(chkOverwriteEnable, SIGNAL(toggled(bool)), this, SLOT(SetOverwriteEnable(bool)));
|
||||
|
||||
try {
|
||||
int retval = myDet->getFileOverWrite();
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "File over write is inconsistent for all detectors.", "qTabDataOutput::GetFileOverwrite");
|
||||
} else {
|
||||
chkOverwriteEnable->setChecked(retval == 0 ? false : true);
|
||||
}
|
||||
auto retval = det->getFileOverWrite().tsquash("File over write is inconsistent for all detectors.");
|
||||
chkOverwriteEnable->setChecked(retval);
|
||||
} CATCH_DISPLAY ("Could not get file over write enable.", "qTabDataOutput::GetFileOverwrite")
|
||||
|
||||
connect(chkOverwriteEnable, SIGNAL(toggled(bool)), this, SLOT(SetOverwriteEnable(bool)));
|
||||
@ -223,33 +207,25 @@ void qTabDataOutput::GetFileOverwrite() {
|
||||
|
||||
void qTabDataOutput::SetOverwriteEnable(bool enable) {
|
||||
FILE_LOG(logINFO) << "Setting File Over Write Enable to " << enable;
|
||||
|
||||
try {
|
||||
myDet->setFileOverWrite(enable);
|
||||
det->setFileOverWrite(enable);
|
||||
} CATCH_HANDLE ("Could not set file over write enable.", "qTabDataOutput::SetOverwriteEnable", this, &qTabDataOutput::GetFileOverwrite)
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetTenGigaEnable() {
|
||||
FILE_LOG(logDEBUG) << "Getting 10GbE enable";
|
||||
disconnect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(SetTenGigaEnable(bool)));
|
||||
|
||||
try {
|
||||
int retval = myDet->enableTenGigabitEthernet();
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "10GbE enable is inconsistent for all detectors.", "qTabDataOutput::GetTenGigaEnable");
|
||||
} else {
|
||||
chkTenGiga->setChecked(retval == 0 ? false : true);
|
||||
}
|
||||
auto retval = det->getTenGiga().tsquash("10GbE enable is inconsistent for all detectors.");
|
||||
chkTenGiga->setChecked(retval);
|
||||
} CATCH_DISPLAY ("Could not get 10GbE enable.", "qTabDataOutput::GetTenGigaEnable")
|
||||
|
||||
connect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(SetTenGigaEnable(bool)));
|
||||
}
|
||||
|
||||
void qTabDataOutput::SetTenGigaEnable(bool enable) {
|
||||
FILE_LOG(logINFO) << "Setting 10GbE to " << enable;
|
||||
|
||||
try {
|
||||
myDet->enableTenGigabitEthernet(enable);
|
||||
det->setTenGiga(enable);
|
||||
} CATCH_HANDLE ("Could not set 10GbE enable.", "qTabDataOutput::SetTenGigaEnable", this, &qTabDataOutput::GetTenGigaEnable)
|
||||
}
|
||||
|
||||
@ -258,19 +234,13 @@ void qTabDataOutput::GetRateCorrection() {
|
||||
disconnect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection()));
|
||||
disconnect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection()));
|
||||
disconnect(spinCustomDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
|
||||
|
||||
try {
|
||||
int64_t retval = myDet->getRateCorrection();
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "Rate correction (enable/tau) is inconsistent for all detectors.", "qTabDataOutput::GetRateCorrection");
|
||||
spinCustomDeadTime->setValue(-1);
|
||||
} else {
|
||||
chkRate->setChecked(retval == 0 ? false : true);
|
||||
if (retval != 0)
|
||||
spinCustomDeadTime->setValue(retval);
|
||||
}
|
||||
spinCustomDeadTime->setValue(-1);
|
||||
int64_t retval = det->getRateCorrection().tsquash("Rate correction (enable/tau) is inconsistent for all detectors.").count();
|
||||
chkRate->setChecked(retval == 0 ? false : true);
|
||||
if (retval != 0)
|
||||
spinCustomDeadTime->setValue(retval);
|
||||
} CATCH_DISPLAY("Could not get rate correction.", "qTabDataOutput::GetRateCorrection")
|
||||
|
||||
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection()));
|
||||
connect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection()));
|
||||
connect(spinCustomDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
|
||||
@ -285,7 +255,7 @@ void qTabDataOutput::EnableRateCorrection() {
|
||||
FILE_LOG(logINFO) << "Disabling Rate correction";
|
||||
// disable
|
||||
try {
|
||||
myDet->setRateCorrection(0);
|
||||
det->setRateCorrection(sls::ns(0));
|
||||
} CATCH_HANDLE ("Could not switch off rate correction.", "qTabDataOutput::EnableRateCorrection", this, &qTabDataOutput::GetRateCorrection)
|
||||
}
|
||||
|
||||
@ -294,122 +264,69 @@ void qTabDataOutput::SetRateCorrection() {
|
||||
if (!chkRate->isChecked()) {
|
||||
return;
|
||||
}
|
||||
// get default or custom value
|
||||
int64_t deadtime = -1;
|
||||
if (radioCustomDeadtime->isChecked()) {
|
||||
deadtime = spinCustomDeadTime->value();
|
||||
}
|
||||
FILE_LOG(logINFO) << "Setting Rate Correction with dead time: " << deadtime;
|
||||
|
||||
try {
|
||||
myDet->setRateCorrection(deadtime);
|
||||
// custom dead time
|
||||
if (radioCustomDeadtime->isChecked()) {
|
||||
int64_t deadtime = spinCustomDeadTime->value();
|
||||
FILE_LOG(logINFO) << "Setting Rate Correction with custom dead time: " << deadtime;
|
||||
det->setRateCorrection(sls::ns(deadtime));
|
||||
}
|
||||
// default dead time
|
||||
else {
|
||||
FILE_LOG(logINFO) << "Setting Rate Correction with default dead time";
|
||||
det->setDefaultRateCorrection();
|
||||
}
|
||||
} CATCH_HANDLE ("Could not set rate correction.", "qTabDataOutput::SetRateCorrection", this, &qTabDataOutput::GetRateCorrection)
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetSpeed() {
|
||||
FILE_LOG(logDEBUG) << "Getting Speed";
|
||||
disconnect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed(int)));
|
||||
|
||||
try {
|
||||
int retval = myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER);
|
||||
int retval = det->getSpeed().tsquash("Speed is inconsistent for all detectors.");
|
||||
switch(retval) {
|
||||
case -1:
|
||||
qDefs::Message(qDefs::WARNING, "Speed is inconsistent for all detectors.", "qTabDataOutput::GetSpeed");
|
||||
break;
|
||||
case FULLSPEED:
|
||||
case HALFSPEED:
|
||||
case QUARTERSPEED:
|
||||
comboEigerClkDivider->setCurrentIndex(retval);
|
||||
break;
|
||||
default:
|
||||
qDefs::Message(qDefs::WARNING, std::string("Unknown speed: ") + std::to_string(retval), "qTabDataOutput::GetFileFormat");
|
||||
break;
|
||||
throw sls::RuntimeError(std::string("Unknown speed: ") + std::to_string(retval));
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get speed.", "qTabDataOutput::GetSpeed")
|
||||
|
||||
connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed(int)));
|
||||
}
|
||||
|
||||
void qTabDataOutput::SetSpeed(int speed) {
|
||||
FILE_LOG(logINFO) << "Setting Speed to " << comboEigerClkDivider->currentText().toAscii().data();;
|
||||
try {
|
||||
myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER, speed);
|
||||
det->setSpeed(speed);
|
||||
} CATCH_HANDLE ("Could not set speed.", "qTabDataOutput::SetSpeed", this, &qTabDataOutput::GetSpeed)
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetFlags() {
|
||||
FILE_LOG(logDEBUG) << "Getting readout flags";
|
||||
disconnect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
disconnect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
|
||||
disconnect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
try {
|
||||
int retval = myDet->setReadOutFlags(slsDetectorDefs::GET_READOUT_FLAGS);
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "Readout flags are inconsistent for all detectors.", "qTabDataOutput::GetFlags");
|
||||
} else {
|
||||
// store in ram or continuous
|
||||
if (retval & slsDetectorDefs::STORE_IN_RAM)
|
||||
comboEigerFlags1->setCurrentIndex(STOREINRAM);
|
||||
else if (retval & slsDetectorDefs::CONTINOUS_RO)
|
||||
comboEigerFlags1->setCurrentIndex(CONTINUOUS);
|
||||
else {
|
||||
qDefs::Message(qDefs::WARNING, std::string("Unknown flag (Not Store in ram or Continous): ") + std::to_string(retval), "qTabDataOutput::GetFlags");
|
||||
}
|
||||
|
||||
// parallel or non parallel
|
||||
if (retval & slsDetectorDefs::PARALLEL)
|
||||
comboEigerFlags2->setCurrentIndex(PARALLEL);
|
||||
else if (retval & slsDetectorDefs::NONPARALLEL)
|
||||
comboEigerFlags2->setCurrentIndex(NONPARALLEL);
|
||||
else {
|
||||
qDefs::Message(qDefs::WARNING, std::string("Unknown flag (Not Parallel or Non Parallel): ") + std::to_string(retval), "qTabDataOutput::GetFlags");
|
||||
}
|
||||
}
|
||||
auto retval = det->getParallelMode().tsquash("Parallel Flag is inconsistent for all detectors.");
|
||||
// parallel or non parallel
|
||||
if (retval)
|
||||
comboEigerParallelFlag->setCurrentIndex(PARALLEL);
|
||||
else
|
||||
comboEigerParallelFlag->setCurrentIndex(NONPARALLEL);
|
||||
} CATCH_DISPLAY ("Could not get speed.", "qTabDataOutput::GetSpeed")
|
||||
|
||||
connect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
connect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
connect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
}
|
||||
|
||||
|
||||
void qTabDataOutput::SetFlags() {
|
||||
auto flag1 = slsDetectorDefs::GET_READOUT_FLAGS;
|
||||
auto flag2 = slsDetectorDefs::GET_READOUT_FLAGS;
|
||||
|
||||
//set to continous or storeinram
|
||||
switch (comboEigerFlags1->currentIndex()) {
|
||||
case STOREINRAM:
|
||||
flag1 = slsDetectorDefs::STORE_IN_RAM;
|
||||
break;
|
||||
default:
|
||||
flag1 = slsDetectorDefs::CONTINOUS_RO;
|
||||
break;
|
||||
}
|
||||
|
||||
//set to parallel or nonparallel
|
||||
switch (comboEigerFlags2->currentIndex()) {
|
||||
case PARALLEL:
|
||||
flag2 = slsDetectorDefs::PARALLEL;
|
||||
break;
|
||||
default:
|
||||
flag2 = slsDetectorDefs::NONPARALLEL;
|
||||
break;
|
||||
}
|
||||
|
||||
auto mode = comboEigerParallelFlag->currentIndex() == PARALLEL ? true : false;
|
||||
try {
|
||||
FILE_LOG(logINFO) << "Setting Readout Flags to " << comboEigerFlags1->currentText().toAscii().data();
|
||||
myDet->setReadOutFlags(flag1);
|
||||
FILE_LOG(logINFO) << "Setting Readout Flags to " << comboEigerFlags2->currentText().toAscii().data();
|
||||
myDet->setReadOutFlags(flag2);
|
||||
FILE_LOG(logINFO) << "Setting Readout Flags to " << comboEigerParallelFlag->currentText().toAscii().data();
|
||||
det->setParallelMode(mode);
|
||||
} CATCH_HANDLE ("Could not set readout flags.", "qTabDataOutput::SetFlags", this, &qTabDataOutput::GetFlags)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void qTabDataOutput::Refresh() {
|
||||
FILE_LOG(logDEBUG) << "**Updating DataOutput Tab";
|
||||
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
qTabDebugging::qTabDebugging(QWidget *parent, multiSlsDetector *detector) :
|
||||
QWidget(parent), myDet(detector), treeDet(nullptr), lblDetectorHostname(nullptr), lblDetectorFirmware(nullptr), lblDetectorSoftware(nullptr) {
|
||||
qTabDebugging::qTabDebugging(QWidget *parent, sls::Detector *detector) :
|
||||
QWidget(parent), det(detector), treeDet(nullptr), lblDetectorHostname(nullptr), lblDetectorFirmware(nullptr), lblDetectorSoftware(nullptr) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
FILE_LOG(logDEBUG) << "Debugging ready";
|
||||
@ -28,7 +28,7 @@ qTabDebugging::~qTabDebugging() {
|
||||
|
||||
void qTabDebugging::SetupWidgetWindow() {
|
||||
// enabling according to det type
|
||||
if (myDet->getDetectorTypeAsEnum() == slsDetectorDefs::EIGER) {
|
||||
if (det->getDetectorType().squash() == slsDetectorDefs::EIGER) {
|
||||
lblDetector->setText("Half Module:");
|
||||
chkDetectorFirmware->setEnabled(false);
|
||||
chkDetectorBus->setEnabled(false);
|
||||
@ -55,8 +55,9 @@ void qTabDebugging::PopulateDetectors() {
|
||||
FILE_LOG(logDEBUG) << "Populating detectors";
|
||||
|
||||
comboDetector->clear();
|
||||
for (unsigned int i = 0; i < myDet->size(); ++i) {
|
||||
comboDetector->addItem(QString(myDet->getHostname(i).c_str()));
|
||||
auto res = det->getHostname();
|
||||
for (auto &it : res) {
|
||||
comboDetector->addItem(QString(it.c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,7 +65,7 @@ void qTabDebugging::GetDetectorStatus() {
|
||||
FILE_LOG(logDEBUG) << "Getting Status";
|
||||
|
||||
try {
|
||||
std::string status = slsDetectorDefs::runStatusType(myDet->getRunStatus(comboDetector->currentIndex()));
|
||||
std::string status = slsDetectorDefs::runStatusType(det->getDetectorStatus({comboDetector->currentIndex()})[0]);
|
||||
lblStatus->setText(QString(status.c_str()).toUpper());
|
||||
} CATCH_DISPLAY ("Could not get detector status.", "qTabDebugging::GetDetectorStatus")
|
||||
}
|
||||
@ -87,9 +88,9 @@ void qTabDebugging::GetInfo() {
|
||||
//to make sure the size is constant
|
||||
lblDetectorFirmware->setFixedWidth(100);
|
||||
layout->addWidget(dispFrame, 0, 1);
|
||||
QString detName = QString(myDet->getDetectorTypeAsString().c_str());
|
||||
QString detName = QString(slsDetectorDefs::detectorTypeToString(det->getDetectorType().squash()).c_str());
|
||||
|
||||
switch (myDet->getDetectorTypeAsEnum()) {
|
||||
switch (det->getDetectorType().squash()) {
|
||||
|
||||
case slsDetectorDefs::EIGER:
|
||||
formLayout->addWidget(new QLabel("Half Module:"), 0, 0);
|
||||
@ -148,7 +149,7 @@ void qTabDebugging::GetInfo() {
|
||||
void qTabDebugging::SetParameters(QTreeWidgetItem *item) {
|
||||
// eiger: if half module clicked, others: true always
|
||||
bool ignoreOrHalfModuleClicked = true;
|
||||
if (myDet->getDetectorTypeAsEnum() == slsDetectorDefs::EIGER) {
|
||||
if (det->getDetectorType().squash() == slsDetectorDefs::EIGER) {
|
||||
if (!(item->text(0).contains("Half Module"))) {
|
||||
ignoreOrHalfModuleClicked = false;
|
||||
}
|
||||
@ -161,9 +162,9 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item) {
|
||||
break;
|
||||
}
|
||||
try {
|
||||
auto retval = std::string("0x") + std::to_string((unsigned long)myDet->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION, comboDetector->currentIndex()));
|
||||
auto retval = std::string("0x") + std::to_string((unsigned long)det->getFirmwareVersion({comboDetector->currentIndex()})[0]);
|
||||
lblDetectorFirmware->setText(QString(retval.c_str()));
|
||||
retval = std::string("0x") + std::to_string((unsigned long)myDet->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION, comboDetector->currentIndex()));
|
||||
retval = std::string("0x") + std::to_string((unsigned long)det->getDetectorServerVersion({comboDetector->currentIndex()})[0]);
|
||||
lblDetectorSoftware->setText(QString(retval.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get versions.", "qTabDebugging::SetParameters")
|
||||
}
|
||||
@ -174,7 +175,7 @@ void qTabDebugging::TestDetector() {
|
||||
|
||||
try {
|
||||
QString moduleName = "Module";
|
||||
if (myDet->getDetectorTypeAsEnum() == slsDetectorDefs::EIGER) {
|
||||
if (det->getDetectorType().squash() == slsDetectorDefs::EIGER) {
|
||||
moduleName = "Half Module";
|
||||
}
|
||||
|
||||
@ -183,7 +184,7 @@ void qTabDebugging::TestDetector() {
|
||||
|
||||
//detector firmware
|
||||
if (chkDetectorFirmware->isChecked()) {
|
||||
auto retval = myDet->digitalTest(slsDetectorDefs::DETECTOR_FIRMWARE_TEST, comboDetector->currentIndex());
|
||||
auto retval = det->executeFirmwareTest({comboDetector->currentIndex()})[0];
|
||||
if (retval == slsDetectorDefs::FAIL) {
|
||||
message.append(QString("<nobr>%1 Firmware: FAIL</nobr><br>").arg(moduleName));
|
||||
FILE_LOG(logERROR) << "Firmware fail";
|
||||
@ -195,7 +196,7 @@ void qTabDebugging::TestDetector() {
|
||||
|
||||
//detector CPU-FPGA bus
|
||||
if (chkDetectorBus->isChecked()) {
|
||||
auto retval = myDet->digitalTest(slsDetectorDefs::DETECTOR_BUS_TEST, comboDetector->currentIndex());
|
||||
auto retval = det->executeBusTest({comboDetector->currentIndex()})[0];
|
||||
if (retval == slsDetectorDefs::FAIL) {
|
||||
message.append(QString("<nobr>%1 Bus: FAIL</nobr><br>").arg(moduleName));
|
||||
FILE_LOG(logERROR) << "Bus Test fail";
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
qTabDeveloper::qTabDeveloper(QWidget *parent, multiSlsDetector *detector) : QWidget(parent), myDet(detector) {
|
||||
qTabDeveloper::qTabDeveloper(QWidget *parent, sls::Detector *detector) : QWidget(parent), det(detector) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
FILE_LOG(logDEBUG) << "Developer ready";
|
||||
@ -21,74 +21,74 @@ void qTabDeveloper::SetupWidgetWindow() {
|
||||
spinHV->hide();
|
||||
|
||||
try{
|
||||
slsDetectorDefs::detectorType detType = myDet->getDetectorTypeAsEnum();
|
||||
slsDetectorDefs::detectorType detType = det->getDetectorType().squash();
|
||||
switch (detType) {
|
||||
case slsDetectorDefs::EIGER:
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v SvP: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v SvN ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Vrf: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Vrs: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Vtr: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Vtgstv: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v cal: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Vcp ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Vcn: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Vis: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v rxb_lb: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v rxb_rb: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Vcmp_ll: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Vcmp_lr: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Vcmp_rl: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Vcmp_rr: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v threshold: ", getSLSIndex(detType, tempid++), false));
|
||||
adcWidgets.push_back(new qDacWidget(this, myDet, false, "Temperature FPGA Ext: ", getSLSIndex(detType, tempid++), true));
|
||||
adcWidgets.push_back(new qDacWidget(this, myDet, false, "Temperature 10GE: ", getSLSIndex(detType, tempid++), true));
|
||||
adcWidgets.push_back(new qDacWidget(this, myDet, false, "Temperature DCDC: ", getSLSIndex(detType, tempid++), true));
|
||||
adcWidgets.push_back(new qDacWidget(this, myDet, false, "Temperature SODL: ", getSLSIndex(detType, tempid++), true));
|
||||
adcWidgets.push_back(new qDacWidget(this, myDet, false, "Temperature SODR: ", getSLSIndex(detType, tempid++), true));
|
||||
adcWidgets.push_back(new qDacWidget(this, myDet, false, "Temperature FPGA: ", getSLSIndex(detType, tempid++), true));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v SvP: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v SvN ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Vrf: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Vrs: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Vtr: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Vtgstv: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v cal: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Vcp ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Vcn: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Vis: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v rxb_lb: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v rxb_rb: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Vcmp_ll: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Vcmp_lr: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Vcmp_rl: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Vcmp_rr: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v threshold: ", getSLSIndex(detType, tempid++), false));
|
||||
adcWidgets.push_back(new qDacWidget(this, det, false, "Temperature FPGA Ext: ", getSLSIndex(detType, tempid++), true));
|
||||
adcWidgets.push_back(new qDacWidget(this, det, false, "Temperature 10GE: ", getSLSIndex(detType, tempid++), true));
|
||||
adcWidgets.push_back(new qDacWidget(this, det, false, "Temperature DCDC: ", getSLSIndex(detType, tempid++), true));
|
||||
adcWidgets.push_back(new qDacWidget(this, det, false, "Temperature SODL: ", getSLSIndex(detType, tempid++), true));
|
||||
adcWidgets.push_back(new qDacWidget(this, det, false, "Temperature SODR: ", getSLSIndex(detType, tempid++), true));
|
||||
adcWidgets.push_back(new qDacWidget(this, det, false, "Temperature FPGA: ", getSLSIndex(detType, tempid++), true));
|
||||
break;
|
||||
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
comboHV->show();
|
||||
lblComboHV->show();
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Reference: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Cascode n: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Cascode p: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Comp. Output: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Cascode out ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Comp. Input: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Comp. Ref: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "i Base Test: ", getSLSIndex(detType, tempid++), false));
|
||||
adcWidgets.push_back(new qDacWidget(this, myDet, false, "Temperature ADC: ", getSLSIndex(detType, tempid++), false));
|
||||
adcWidgets.push_back(new qDacWidget(this, myDet, false, "Temperature FPGA: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Reference: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Cascode n: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Cascode p: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Comp. Output: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Cascode out ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Comp. Input: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Comp. Ref: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "i Base Test: ", getSLSIndex(detType, tempid++), false));
|
||||
adcWidgets.push_back(new qDacWidget(this, det, false, "Temperature ADC: ", getSLSIndex(detType, tempid++), false));
|
||||
adcWidgets.push_back(new qDacWidget(this, det, false, "Temperature FPGA: ", getSLSIndex(detType, tempid++), false));
|
||||
break;
|
||||
|
||||
case slsDetectorDefs::JUNGFRAU:
|
||||
lblSpinHV->show();
|
||||
spinHV->show();
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v vb comp: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v vdd prot: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v vin com: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v vref prech: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v vb pixbuf: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v vb ds: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v vref ds: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "i vref comp: ", getSLSIndex(detType, tempid++), false));
|
||||
adcWidgets.push_back(new qDacWidget(this, myDet, false, "Temperature ADC/FPGA: ", getSLSIndex(detType, tempid++), true));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v vb comp: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v vdd prot: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v vin com: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v vref prech: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v vb pixbuf: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v vb ds: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v vref ds: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "i vref comp: ", getSLSIndex(detType, tempid++), false));
|
||||
adcWidgets.push_back(new qDacWidget(this, det, false, "Temperature ADC/FPGA: ", getSLSIndex(detType, tempid++), true));
|
||||
break;
|
||||
|
||||
case slsDetectorDefs::MOENCH:
|
||||
lblSpinHV->show();
|
||||
spinHV->show();
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Dac 0: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Dac 1: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Dac 2: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Dac 3: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Dac 4: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Dac 5: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "v Dac 6: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, myDet, true, "i Dac 7: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Dac 0: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Dac 1: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Dac 2: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Dac 3: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Dac 4: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Dac 5: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Dac 6: ", getSLSIndex(detType, tempid++), false));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "i Dac 7: ", getSLSIndex(detType, tempid++), false));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -124,9 +124,11 @@ void qTabDeveloper::PopulateDetectors() {
|
||||
|
||||
comboDetector->clear();
|
||||
comboDetector->addItem("All");
|
||||
if (myDet->size() > 1) {
|
||||
for (unsigned int i = 0; i < myDet->size(); ++i)
|
||||
comboDetector->addItem(QString(myDet->getHostname(i).c_str()));
|
||||
auto res = det->getHostname();
|
||||
if (det->size() > 1) {
|
||||
for (auto &it : res) {
|
||||
comboDetector->addItem(QString(it.c_str()));
|
||||
}
|
||||
}
|
||||
comboDetector->setCurrentIndex(0);
|
||||
}
|
||||
@ -135,25 +137,22 @@ void qTabDeveloper::GetHighVoltage() {
|
||||
// not enabled for eiger
|
||||
if (!comboHV->isVisible() && !spinHV->isVisible())
|
||||
return;
|
||||
|
||||
FILE_LOG(logDEBUG) << "Getting High Voltage";
|
||||
disconnect(spinHV, SIGNAL(editingFinished()), this, SLOT(SetHighVoltage()));
|
||||
disconnect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage()));
|
||||
|
||||
try {
|
||||
// dac units
|
||||
auto retval = myDet->setDAC(-1, slsDetectorDefs::HIGH_VOLTAGE, 0, comboDetector->currentIndex() - 1);
|
||||
auto retval = det->getHighVoltage({comboDetector->currentIndex() - 1}).tsquash("Inconsistent values for high voltage.");
|
||||
//spinHV
|
||||
if (spinHV->isVisible()) {
|
||||
if (retval != 0 && retval != -1 && retval < HV_MIN && retval > HV_MAX) {
|
||||
qDefs::Message(qDefs::WARNING, std::string("Unknown High Voltage: ") + std::to_string(retval), "qTabDeveloper::GetHighVoltage");
|
||||
} else{
|
||||
spinHV->setValue(retval);
|
||||
}
|
||||
} else {
|
||||
if (retval != 0 && retval < HV_MIN && retval > HV_MAX) {
|
||||
throw sls::RuntimeError(std::string("Unknown High Voltage: ") + std::to_string(retval));
|
||||
}
|
||||
spinHV->setValue(retval);
|
||||
}
|
||||
// combo HV
|
||||
else {
|
||||
switch (retval) {
|
||||
case -1:
|
||||
qDefs::Message(qDefs::WARNING, "Different values for high voltage.", "qTabDeveloper::GetHighVoltage");
|
||||
break;
|
||||
case 0:
|
||||
comboHV->setCurrentIndex(HV_0);
|
||||
break;
|
||||
@ -176,13 +175,10 @@ void qTabDeveloper::GetHighVoltage() {
|
||||
comboHV->setCurrentIndex(HV_200);
|
||||
break;
|
||||
default:
|
||||
qDefs::Message(qDefs::WARNING, std::string("Unknown High Voltage: ") + std::to_string(retval), "qTabDeveloper::GetHighVoltage");
|
||||
break;
|
||||
throw sls::RuntimeError(std::string("Unknown High Voltage: ") + std::to_string(retval));
|
||||
}
|
||||
}
|
||||
|
||||
} CATCH_DISPLAY ("Could not get high voltage.", "qTabDeveloper::GetHighVoltage")
|
||||
|
||||
connect(spinHV, SIGNAL(editingFinished()), this, SLOT(SetHighVoltage()));
|
||||
connect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage()));
|
||||
}
|
||||
@ -192,7 +188,7 @@ void qTabDeveloper::SetHighVoltage() {
|
||||
FILE_LOG(logINFO) << "Setting high voltage:" << val;
|
||||
|
||||
try {
|
||||
myDet->setDAC(val, slsDetectorDefs::HIGH_VOLTAGE, 0, comboDetector->currentIndex() - 1);
|
||||
det->setHighVoltage({comboDetector->currentIndex() - 1});
|
||||
} CATCH_HANDLE ("Could not set high voltage.", "qTabDeveloper::SetHighVoltage",
|
||||
this, &qTabDeveloper::GetHighVoltage)
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
qTabMeasurement::qTabMeasurement(QWidget *parent, multiSlsDetector *detector, qDrawPlot *plot) : QWidget(parent), myDet(detector), myPlot(plot),
|
||||
qTabMeasurement::qTabMeasurement(QWidget *parent, sls::Detector *detector, qDrawPlot *p) : QWidget(parent), det(detector), plot(p),
|
||||
progressTimer(nullptr) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
@ -43,7 +43,7 @@ void qTabMeasurement::SetupWidgetWindow() {
|
||||
spinDelay->setEnabled(true);
|
||||
comboDelayUnit->setEnabled(true);
|
||||
// enabling according to det type
|
||||
switch(myDet->getDetectorTypeAsEnum()) {
|
||||
switch(det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::MOENCH:
|
||||
lblNumSamples->setEnabled(true);
|
||||
spinNumSamples->setEnabled(true);
|
||||
@ -111,7 +111,7 @@ void qTabMeasurement::SetupTimingMode() {
|
||||
item[i] = model->itemFromIndex(index[i]);
|
||||
}
|
||||
|
||||
if (myDet->getDetectorTypeAsEnum() != slsDetectorDefs::EIGER) {
|
||||
if (det->getDetectorType().squash() != slsDetectorDefs::EIGER) {
|
||||
item[(int)GATED]->setEnabled(false);
|
||||
item[(int)BURST_TRIGGER]->setEnabled(false);
|
||||
}
|
||||
@ -156,7 +156,7 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
|
||||
lblExpTime->setEnabled(true);
|
||||
spinExpTime->setEnabled(true);
|
||||
comboExpUnit->setEnabled(true);
|
||||
if (myDet->getDetectorTypeAsEnum() == slsDetectorDefs::EIGER) {
|
||||
if (det->getDetectorType().squash() == slsDetectorDefs::EIGER) {
|
||||
spinNumFrames->setValue(1);
|
||||
} else {
|
||||
// #frames, period, delay
|
||||
@ -198,14 +198,10 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
|
||||
void qTabMeasurement::GetTimingMode() {
|
||||
FILE_LOG(logDEBUG) << "Getting timing mode";
|
||||
connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));
|
||||
|
||||
try {
|
||||
auto oldMode = comboTimingMode->currentIndex();
|
||||
auto retval = myDet->setTimingMode();
|
||||
auto retval = det->getTimingMode().tsquash("Inconsistent timing mode for all detectors.");
|
||||
switch(retval) {
|
||||
case slsDetectorDefs::GET_TIMING_MODE:
|
||||
qDefs::Message(qDefs::WARNING, "Timing Mode is inconsistent for all detectors.", "qTabMeasurement::GetTimingMode");
|
||||
break;
|
||||
case slsDetectorDefs::AUTO_TIMING:
|
||||
case slsDetectorDefs::TRIGGER_EXPOSURE:
|
||||
case slsDetectorDefs::GATED:
|
||||
@ -217,19 +213,16 @@ void qTabMeasurement::GetTimingMode() {
|
||||
}
|
||||
break;
|
||||
default:
|
||||
qDefs::Message(qDefs::WARNING, std::string("Unknown timing mode: ")+ std::to_string(retval), "qTabMeasurement::GetTimingMode");
|
||||
break;
|
||||
throw sls::RuntimeError(std::string("Unknown timing mode: ")+ std::to_string(retval));
|
||||
}
|
||||
} CATCH_DISPLAY("Could not get timing mode.", "qTabMeasurement::GetTimingMode")
|
||||
|
||||
disconnect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetTimingMode(int val) {
|
||||
FILE_LOG(logINFO) << "Setting timing mode:" << comboTimingMode->currentText().toAscii().data();
|
||||
|
||||
try {
|
||||
myDet->setTimingMode(static_cast<slsDetectorDefs::timingMode>(val));
|
||||
det->setTimingMode(static_cast<slsDetectorDefs::timingMode>(val));
|
||||
EnableWidgetsforTimingMode();
|
||||
} CATCH_HANDLE("Could not set timing mode.", "qTabMeasurement::SetTimingMode", this, &qTabMeasurement::GetTimingMode)
|
||||
}
|
||||
@ -242,74 +235,51 @@ void qTabMeasurement::SetNumMeasurements(int val) {
|
||||
void qTabMeasurement::GetNumFrames() {
|
||||
FILE_LOG(logDEBUG) << "Getting number of frames";
|
||||
disconnect(spinNumFrames, SIGNAL(valueChanged(int)), this, SLOT(SetNumFrames(int)));
|
||||
|
||||
try {
|
||||
auto retval = myDet->setTimer(slsDetectorDefs::FRAME_NUMBER);
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "Number of frames is inconsistent for all detectors.", "qTabMeasurement::GetNumFrames");
|
||||
}
|
||||
auto retval = det->getNumberOfFrames().tsquash("Inconsistent number of frames for all detectors.");
|
||||
spinNumFrames->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get number of frames.", "qTabMeasurement::GetNumFrames")
|
||||
|
||||
connect(spinNumFrames, SIGNAL(valueChanged(int)), this, SLOT(SetNumFrames(int)));
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetNumFrames(int val) {
|
||||
FILE_LOG(logINFO) << "Setting number of frames to " << val;
|
||||
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::FRAME_NUMBER, val);
|
||||
det->setNumberOfFrames(val);
|
||||
} CATCH_HANDLE("Could not set number of frames.", "qTabMeasurement::SetNumFrames", this, &qTabMeasurement::GetNumFrames)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetNumTriggers() {
|
||||
FILE_LOG(logDEBUG) << "Getting number of triggers";
|
||||
disconnect(spinNumTriggers, SIGNAL(valueChanged(int)), this, SLOT(SetNumTriggers(int)));
|
||||
|
||||
try {
|
||||
auto retval = myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER);
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "Number of triggers is inconsistent for all detectors.", "qTabMeasurement::GetNumTriggers");
|
||||
}
|
||||
auto retval = det->getNumberOfTriggers().tsquash("Inconsistent number of triggers for all detectors.");
|
||||
spinNumTriggers->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get number of frames.", "qTabMeasurement::GetNumTriggers")
|
||||
|
||||
connect(spinNumTriggers, SIGNAL(valueChanged(int)), this, SLOT(SetNumTriggers(int)));
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetNumTriggers(int val) {
|
||||
FILE_LOG(logINFO) << "Setting number of triggers to " << val;
|
||||
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER, val);
|
||||
det->setNumberOfTriggers(val);
|
||||
} CATCH_HANDLE("Could not set number of triggers.", "qTabMeasurement::SetNumTriggers", this, &qTabMeasurement::GetNumTriggers)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetNumSamples() {
|
||||
FILE_LOG(logDEBUG) << "Getting number of samples";
|
||||
disconnect(spinNumSamples, SIGNAL(valueChanged(int)), this, SLOT(SetNumSamples(int)));
|
||||
|
||||
try {
|
||||
auto retval = myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES);
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "Number of analog samples is inconsistent for all detectors.", "qTabMeasurement::GetNumSamples");
|
||||
}
|
||||
retval = myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES);
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "Number of digital samples is inconsistent for all detectors.", "qTabMeasurement::GetNumSamples");
|
||||
}
|
||||
auto retval = det->getNumberOfAnalogSamples().tsquash("Inconsistent number of analog samples for all detectors.");
|
||||
spinNumSamples->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get number of samples.", "qTabMeasurement::GetNumSamples")
|
||||
|
||||
connect(spinNumSamples, SIGNAL(valueChanged(int)), this, SLOT(SetNumSamples(int)));
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetNumSamples(int val) {
|
||||
FILE_LOG(logINFO) << "Setting number of samples to " << val;
|
||||
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES, val);
|
||||
myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES, val);
|
||||
det->setNumberOfAnalogSamples(val);
|
||||
} CATCH_HANDLE("Could not set number of samples.", "qTabMeasurement::SetNumSamples", this, &qTabMeasurement::GetNumSamples)
|
||||
}
|
||||
|
||||
@ -317,21 +287,14 @@ void qTabMeasurement::GetExposureTime() {
|
||||
FILE_LOG(logDEBUG) << "Getting exposure time";
|
||||
disconnect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime()));
|
||||
disconnect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime()));
|
||||
|
||||
try {
|
||||
auto retval = myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME);
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "Exposure Time is inconsistent for all detectors.", "qTabMeasurement::GetExposureTime");
|
||||
spinExpTime->setValue(-1);
|
||||
} else {
|
||||
auto time = qDefs::getCorrectTime(static_cast<double>(retval) * (1E-9));
|
||||
spinExpTime->setValue(time.first);
|
||||
comboExpUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
|
||||
CheckAcqPeriodGreaterThanExp();
|
||||
}
|
||||
spinExpTime->setValue(-1);
|
||||
auto retval = det->getExptime().tsquash("Inconsistent exposure time for all detectors.");
|
||||
auto time = qDefs::getUserFriendlyTime(retval);
|
||||
spinExpTime->setValue(time.first);
|
||||
comboExpUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
CheckAcqPeriodGreaterThanExp();
|
||||
} CATCH_DISPLAY ("Could not get exposure time.", "qTabMeasurement::GetExposureTime")
|
||||
|
||||
connect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime()));
|
||||
connect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime()));
|
||||
}
|
||||
@ -340,10 +303,9 @@ void qTabMeasurement::SetExposureTime() {
|
||||
auto val = spinExpTime->value();
|
||||
auto unit = static_cast<qDefs::timeUnit>(comboExpUnit->currentIndex());
|
||||
FILE_LOG(logINFO) << "Setting exposure time to " << val << " " << qDefs::getUnitString(unit);
|
||||
|
||||
try {
|
||||
double timeNS = qDefs::getNSTime(unit, val);
|
||||
myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME, std::lround(timeNS));
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(val, unit));
|
||||
det->setExptime(timeNS);
|
||||
CheckAcqPeriodGreaterThanExp();
|
||||
} CATCH_HANDLE("Could not set exposure time.", "qTabMeasurement::SetExposureTime", this, &qTabMeasurement::GetExposureTime)
|
||||
}
|
||||
@ -352,21 +314,14 @@ void qTabMeasurement::GetAcquisitionPeriod() {
|
||||
FILE_LOG(logDEBUG) << "Getting acquisition period";
|
||||
disconnect(spinPeriod, SIGNAL(valueChanged(double)), this, SLOT(SetAcquisitionPeriod()));
|
||||
disconnect(comboPeriodUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetAcquisitionPeriod()));
|
||||
|
||||
try {
|
||||
auto retval = myDet->setTimer(slsDetectorDefs::FRAME_PERIOD);
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "Acquisition Period is inconsistent for all detectors.", "qTabMeasurement::GetAcquisitionPeriod");
|
||||
spinPeriod->setValue(-1);
|
||||
} else {
|
||||
auto time = qDefs::getCorrectTime(static_cast<double>(retval) * (1E-9));
|
||||
spinPeriod->setValue(time.first);
|
||||
comboPeriodUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
|
||||
CheckAcqPeriodGreaterThanExp();
|
||||
}
|
||||
spinPeriod->setValue(-1);
|
||||
auto retval = det->getPeriod().tsquash("Inconsistent acquisition period for all detectors.");
|
||||
auto time = qDefs::getUserFriendlyTime(retval);
|
||||
spinPeriod->setValue(time.first);
|
||||
comboPeriodUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
CheckAcqPeriodGreaterThanExp();
|
||||
} CATCH_DISPLAY ("Could not get acquisition period.", "qTabMeasurement::GetAcquisitionPeriod")
|
||||
|
||||
connect(spinPeriod, SIGNAL(valueChanged(double)), this, SLOT(SetAcquisitionPeriod()));
|
||||
connect(comboPeriodUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetAcquisitionPeriod()));
|
||||
}
|
||||
@ -375,10 +330,9 @@ void qTabMeasurement::SetAcquisitionPeriod() {
|
||||
auto val = spinPeriod->value();
|
||||
auto unit = static_cast<qDefs::timeUnit>(comboPeriodUnit->currentIndex());
|
||||
FILE_LOG(logINFO) << "Setting acquisition period to " << val << " " << qDefs::getUnitString(unit);
|
||||
|
||||
try {
|
||||
double timeNS = qDefs::getNSTime(unit, val);
|
||||
myDet->setTimer(slsDetectorDefs::FRAME_PERIOD, std::lround(timeNS));
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(val, unit));
|
||||
det->setPeriod(timeNS);
|
||||
CheckAcqPeriodGreaterThanExp();
|
||||
} CATCH_HANDLE("Could not set acquisition period.", "qTabMeasurement::SetAcquisitionPeriod", this, &qTabMeasurement::GetAcquisitionPeriod)
|
||||
}
|
||||
@ -387,8 +341,8 @@ void qTabMeasurement::CheckAcqPeriodGreaterThanExp() {
|
||||
FILE_LOG(logDEBUG) << "Checking period >= exptime";
|
||||
bool error = false;
|
||||
if (lblPeriod->isEnabled()) {
|
||||
double exptimeNS = qDefs::getNSTime(static_cast<qDefs::timeUnit>(comboExpUnit->currentIndex()), spinExpTime->value());
|
||||
double acqtimeNS = qDefs::getNSTime(static_cast<qDefs::timeUnit>(comboPeriodUnit->currentIndex()), spinPeriod->value());
|
||||
auto exptimeNS = qDefs::getNSTime(std::make_pair(spinExpTime->value(), static_cast<qDefs::timeUnit>(comboExpUnit->currentIndex())));
|
||||
auto acqtimeNS = qDefs::getNSTime(std::make_pair(spinPeriod->value(), static_cast<qDefs::timeUnit>(comboPeriodUnit->currentIndex())));
|
||||
if (exptimeNS > acqtimeNS) {
|
||||
error = true;
|
||||
spinPeriod->setToolTip(errPeriodTip);
|
||||
@ -410,21 +364,13 @@ void qTabMeasurement::GetDelay() {
|
||||
FILE_LOG(logDEBUG) << "Getting delay";
|
||||
disconnect(spinDelay, SIGNAL(valueChanged(double)), this, SLOT(SetDelay()));
|
||||
disconnect(comboDelayUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetDelay()));
|
||||
|
||||
try {
|
||||
auto retval = myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER);
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "Delay is inconsistent for all detectors.", "qTabMeasurement::GetDelay");
|
||||
spinDelay->setValue(-1);
|
||||
} else {
|
||||
auto time = qDefs::getCorrectTime(static_cast<double>(retval) * (1E-9));
|
||||
spinDelay->setValue(time.first);
|
||||
comboDelayUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
|
||||
CheckAcqPeriodGreaterThanExp();
|
||||
}
|
||||
spinDelay->setValue(-1);
|
||||
auto retval = det->getDelayAfterTrigger().tsquash("Inconsistent delay for all detectors.");
|
||||
auto time = qDefs::getUserFriendlyTime(retval);
|
||||
spinDelay->setValue(time.first);
|
||||
comboDelayUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
} CATCH_DISPLAY ("Could not get delay.", "qTabMeasurement::GetDelay")
|
||||
|
||||
connect(spinDelay, SIGNAL(valueChanged(double)), this, SLOT(SetDelay()));
|
||||
connect(comboDelayUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetDelay()));
|
||||
}
|
||||
@ -433,61 +379,45 @@ void qTabMeasurement::SetDelay() {
|
||||
auto val = spinDelay->value();
|
||||
auto unit = static_cast<qDefs::timeUnit>(comboDelayUnit->currentIndex());
|
||||
FILE_LOG(logINFO) << "Setting delay to " << val << " " << qDefs::getUnitString(unit);
|
||||
|
||||
try {
|
||||
double timeNS = qDefs::getNSTime(unit, val);
|
||||
myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER, std::lround(timeNS));
|
||||
CheckAcqPeriodGreaterThanExp();
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(val, unit));
|
||||
det->setDelayAfterTrigger(timeNS);
|
||||
} CATCH_HANDLE("Could not set delay.", "qTabMeasurement::SetDelay", this, &qTabMeasurement::GetDelay)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetFileWrite() {
|
||||
FILE_LOG(logDEBUG) << "Getting File Write Enable";
|
||||
disconnect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool)));
|
||||
|
||||
try {
|
||||
dispFileName->setEnabled(true); // default, even when exception
|
||||
lblIndex->setEnabled(true);
|
||||
spinIndex->setEnabled(true);
|
||||
int retval = myDet->getFileWrite();
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "File write is inconsistent for all detectors.", "qTabMeasurement::GetFileWrite");
|
||||
dispFileName->setEnabled(true);
|
||||
lblIndex->setEnabled(true);
|
||||
spinIndex->setEnabled(true);
|
||||
} else {
|
||||
bool enable = (retval == 0 ? false : true);
|
||||
chkFile->setChecked(enable);
|
||||
dispFileName->setEnabled(enable);
|
||||
lblIndex->setEnabled(enable);
|
||||
spinIndex->setEnabled(enable);
|
||||
}
|
||||
auto retval = det->getFileWrite().tsquash("Inconsistent file write for all detectors.");
|
||||
chkFile->setChecked(retval);
|
||||
dispFileName->setEnabled(retval);
|
||||
lblIndex->setEnabled(retval);
|
||||
spinIndex->setEnabled(retval);
|
||||
} CATCH_DISPLAY ("Could not get file over write enable.", "qTabMeasurement::GetFileWrite")
|
||||
|
||||
connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool)));
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetFileWrite(bool val) {
|
||||
FILE_LOG(logINFO) << "Set File Write to " << val;
|
||||
|
||||
try {
|
||||
myDet->setFileWrite(val);
|
||||
bool enable = chkFile->isChecked();
|
||||
dispFileName->setEnabled(enable);
|
||||
lblIndex->setEnabled(enable);
|
||||
spinIndex->setEnabled(enable);
|
||||
det->setFileWrite(val);
|
||||
dispFileName->setEnabled(val);
|
||||
lblIndex->setEnabled(val);
|
||||
spinIndex->setEnabled(val);
|
||||
} CATCH_HANDLE("Could not set file write enable.", "qTabMeasurement::SetFileWrite", this, &qTabMeasurement::GetFileWrite)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetFileName() {
|
||||
FILE_LOG(logDEBUG) << "Getting file name prefix";
|
||||
disconnect(dispFileName, SIGNAL(editingFinished()), this, SLOT(SetFileName()));
|
||||
|
||||
try {
|
||||
auto retval = myDet->getFileName();
|
||||
auto retval = det->getFileNamePrefix().tsquash("Inconsistent file name prefix for all detectors.");
|
||||
dispFileName->setText(QString(retval.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get file name prefix.", "qTabMeasurement::GetFileName")
|
||||
|
||||
connect(dispFileName, SIGNAL(editingFinished()), this, SLOT(SetFileName()));
|
||||
}
|
||||
|
||||
@ -495,7 +425,7 @@ void qTabMeasurement::SetFileName() {
|
||||
std::string val = std::string(dispFileName->text().toAscii().constData());
|
||||
FILE_LOG(logINFO) << "Setting File Name Prefix:" << val;
|
||||
try {
|
||||
myDet->setFileName(val);
|
||||
det->setFileNamePrefix(val);
|
||||
} CATCH_HANDLE("Could not set file name prefix.", "qTabMeasurement::SetFileName", this, &qTabMeasurement::GetFileName)
|
||||
|
||||
emit FileNameChangedSignal(dispFileName->text());
|
||||
@ -504,43 +434,34 @@ void qTabMeasurement::SetFileName() {
|
||||
void qTabMeasurement::GetRunIndex() {
|
||||
FILE_LOG(logDEBUG) << "Getting Acquisition File index";
|
||||
disconnect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(SetRunIndex(int)));
|
||||
|
||||
try {
|
||||
auto retval = myDet->getFileIndex();
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "Acquisition File Index is inconsistent for all detectors.", "qTabMeasurement::GetRunIndex");
|
||||
}
|
||||
auto retval = det->getAcquisitonIndex().tsquash("Inconsistent file index for all detectors.");
|
||||
spinIndex->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get acquisition file index.", "qTabMeasurement::GetRunIndex")
|
||||
|
||||
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(SetRunIndex(int)));
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetRunIndex(int val) {
|
||||
FILE_LOG(logINFO) << "Setting Acquisition File Index to " << val;
|
||||
|
||||
try {
|
||||
myDet->setFileIndex(val);
|
||||
det->setAcquisitionIndex(val);
|
||||
} CATCH_HANDLE("Could not set acquisition file index.", "qTabMeasurement::SetRunIndex", this, &qTabMeasurement::GetRunIndex)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetStartingFrameNumber() {
|
||||
FILE_LOG(logDEBUG) << "Getting Starting Frame Number";
|
||||
disconnect(spinStartingFrameNumber, SIGNAL(valueChanged(int)), this, SLOT(SetStartingFrameNumber(int)));
|
||||
|
||||
try {
|
||||
auto retval = myDet->getStartingFrameNumber();
|
||||
auto retval = det->getStartingFrameNumber().tsquash("Inconsistent starting frame number for all detectors.");
|
||||
spinStartingFrameNumber->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get starting frame number.", "qTabMeasurement::GetStartingFrameNumber")
|
||||
|
||||
connect(spinStartingFrameNumber, SIGNAL(valueChanged(int)), this, SLOT(SetStartingFrameNumber(int)));
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetStartingFrameNumber(int val) {
|
||||
FILE_LOG(logINFO) << "Setting Starting frame number to " << val;
|
||||
|
||||
try {
|
||||
myDet->setStartingFrameNumber(val);
|
||||
det->setStartingFrameNumber(val);
|
||||
} CATCH_HANDLE("Could not set starting frame number.", "qTabMeasurement::SetStartingFrameNumber", this, &qTabMeasurement::GetStartingFrameNumber)
|
||||
}
|
||||
|
||||
@ -553,28 +474,19 @@ void qTabMeasurement::ResetProgress() {
|
||||
|
||||
void qTabMeasurement::UpdateProgress() {
|
||||
FILE_LOG(logDEBUG) << "Updating progress";
|
||||
progressBar->setValue(myPlot->GetProgress());
|
||||
lblCurrentFrame->setText(QString::number(myPlot->GetCurrentFrameIndex()));
|
||||
progressBar->setValue(plot->GetProgress());
|
||||
lblCurrentFrame->setText(QString::number(plot->GetCurrentFrameIndex()));
|
||||
lblCurrentMeasurement->setText(QString::number(currentMeasurement));
|
||||
}
|
||||
|
||||
int qTabMeasurement::VerifyOutputDirectoryError() {
|
||||
try {
|
||||
auto retval = myDet->getFilePath();
|
||||
// multi
|
||||
if (retval.find('+') == std::string::npos) {
|
||||
myDet->setFilePath(retval);
|
||||
}
|
||||
//single
|
||||
else {
|
||||
const auto &paths = sls::split(retval, '+');
|
||||
for (size_t det = 0; det < paths.size(); ++det) {
|
||||
myDet->setFilePath(paths[det], det);
|
||||
}
|
||||
auto retval = det->getFilePath();
|
||||
for (auto &it : retval) {
|
||||
det->setFilePath(it);
|
||||
}
|
||||
return slsDetectorDefs::OK;
|
||||
} CATCH_DISPLAY ("Could not set path.", "qTabMeasurement::VerifyOutputDirectoryError")
|
||||
|
||||
return slsDetectorDefs::FAIL; // for exception
|
||||
}
|
||||
|
||||
@ -597,7 +509,7 @@ void qTabMeasurement::StartAcquisition() {
|
||||
}
|
||||
|
||||
FILE_LOG(logINFOBLUE) << "Starting Acquisition";
|
||||
myPlot->SetRunning(true);
|
||||
plot->SetRunning(true);
|
||||
isAcquisitionStopped = false;
|
||||
currentMeasurement = 0;
|
||||
ResetProgress();
|
||||
@ -612,7 +524,7 @@ void qTabMeasurement::StopAcquisition() {
|
||||
FILE_LOG(logINFORED) << "Stopping Acquisition";
|
||||
try{
|
||||
isAcquisitionStopped = true;
|
||||
myDet->stopAcquisition();
|
||||
det->stopAcquisition();
|
||||
} CATCH_DISPLAY("Could not stop acquisition.", "qTabMeasurement::StopAcquisition")
|
||||
}
|
||||
|
||||
@ -629,13 +541,13 @@ void qTabMeasurement::AcquireFinished() {
|
||||
// next measurement if acq is not stopped
|
||||
if (!isAcquisitionStopped && ((currentMeasurement + 1) < numMeasurements)) {
|
||||
++currentMeasurement;
|
||||
myPlot->StartAcquisition();
|
||||
plot->StartAcquisition();
|
||||
}
|
||||
// end of acquisition
|
||||
else {
|
||||
progressTimer->stop();
|
||||
Enable(1);
|
||||
myPlot->SetRunning(false);
|
||||
plot->SetRunning(false);
|
||||
btnStart->setEnabled(true);
|
||||
emit EnableTabsSignal(true);
|
||||
}
|
||||
@ -659,7 +571,7 @@ void qTabMeasurement::Enable(bool enable) {
|
||||
void qTabMeasurement::Refresh() {
|
||||
FILE_LOG(logDEBUG) << "**Updating Measurement Tab";
|
||||
|
||||
if (!myPlot->GetIsRunning()) {
|
||||
if (!plot->GetIsRunning()) {
|
||||
GetTimingMode();
|
||||
GetNumFrames();
|
||||
GetExposureTime();
|
||||
|
@ -19,8 +19,8 @@ QString qTabPlot::defaultImageYAxisTitle("Pixel");
|
||||
QString qTabPlot::defaultImageZAxisTitle("Intensity");
|
||||
|
||||
|
||||
qTabPlot::qTabPlot(QWidget *parent, multiSlsDetector *detector, qDrawPlot *plot) :
|
||||
QWidget(parent), myDet(detector), myPlot(plot), is1d(false) {
|
||||
qTabPlot::qTabPlot(QWidget *parent, sls::Detector *detector, qDrawPlot *p) :
|
||||
QWidget(parent), det(detector), plot(p), is1d(false) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
FILE_LOG(logDEBUG) << "Plot ready";
|
||||
@ -57,7 +57,7 @@ void qTabPlot::SetupWidgetWindow() {
|
||||
|
||||
// enabling according to det type
|
||||
is1d = false;
|
||||
switch(myDet->getDetectorTypeAsEnum()) {
|
||||
switch(det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
is1d = true;
|
||||
break;
|
||||
@ -95,27 +95,27 @@ void qTabPlot::Initialization() {
|
||||
|
||||
// 1D options
|
||||
connect(chkSuperimpose, SIGNAL(toggled(bool)), this, SLOT(EnablePersistency(bool)));
|
||||
connect(spinPersistency, SIGNAL(valueChanged(int)), myPlot, SLOT(SetPersistency(int)));
|
||||
connect(chkPoints, SIGNAL(toggled(bool)), myPlot, SLOT(SetMarkers(bool)));
|
||||
connect(chkLines, SIGNAL(toggled(bool)), myPlot, SLOT(SetLines(bool)));
|
||||
connect(chk1DLog, SIGNAL(toggled(bool)), myPlot, SLOT(Set1dLogY(bool)));
|
||||
connect(chkStatistics, SIGNAL(toggled(bool)), myPlot, SLOT(DisplayStatistics(bool)));
|
||||
connect(spinPersistency, SIGNAL(valueChanged(int)), plot, SLOT(SetPersistency(int)));
|
||||
connect(chkPoints, SIGNAL(toggled(bool)), plot, SLOT(SetMarkers(bool)));
|
||||
connect(chkLines, SIGNAL(toggled(bool)), plot, SLOT(SetLines(bool)));
|
||||
connect(chk1DLog, SIGNAL(toggled(bool)), plot, SLOT(Set1dLogY(bool)));
|
||||
connect(chkStatistics, SIGNAL(toggled(bool)), plot, SLOT(DisplayStatistics(bool)));
|
||||
|
||||
// 2D Plot box
|
||||
connect(chkInterpolate, SIGNAL(toggled(bool)), myPlot, SLOT(SetInterpolate(bool)));
|
||||
connect(chkContour, SIGNAL(toggled(bool)), myPlot, SLOT(SetContour(bool)));
|
||||
connect(chkLogz, SIGNAL(toggled(bool)), myPlot, SLOT(SetLogz(bool)));
|
||||
connect(chkStatistics_2, SIGNAL(toggled(bool)), myPlot, SLOT(DisplayStatistics(bool)));
|
||||
connect(chkInterpolate, SIGNAL(toggled(bool)), plot, SLOT(SetInterpolate(bool)));
|
||||
connect(chkContour, SIGNAL(toggled(bool)), plot, SLOT(SetContour(bool)));
|
||||
connect(chkLogz, SIGNAL(toggled(bool)), plot, SLOT(SetLogz(bool)));
|
||||
connect(chkStatistics_2, SIGNAL(toggled(bool)), plot, SLOT(DisplayStatistics(bool)));
|
||||
//pedstal
|
||||
connect(chkPedestal, SIGNAL(toggled(bool)), myPlot, SLOT(SetPedestal(bool)));
|
||||
connect(btnRecalPedestal, SIGNAL(clicked()), myPlot, SLOT(RecalculatePedestal()));
|
||||
connect(chkPedestal_2, SIGNAL(toggled(bool)), myPlot, SLOT(SetPedestal(bool)));
|
||||
connect(btnRecalPedestal_2, SIGNAL(clicked()), myPlot, SLOT(RecalculatePedestal()));
|
||||
connect(chkPedestal, SIGNAL(toggled(bool)), plot, SLOT(SetPedestal(bool)));
|
||||
connect(btnRecalPedestal, SIGNAL(clicked()), plot, SLOT(RecalculatePedestal()));
|
||||
connect(chkPedestal_2, SIGNAL(toggled(bool)), plot, SLOT(SetPedestal(bool)));
|
||||
connect(btnRecalPedestal_2, SIGNAL(clicked()), plot, SLOT(RecalculatePedestal()));
|
||||
//accumulate
|
||||
connect(chkAccumulate, SIGNAL(toggled(bool)), myPlot, SLOT(SetAccumulate(bool)));
|
||||
connect(btnResetAccumulate, SIGNAL(clicked()), myPlot, SLOT(ResetAccumulate()));
|
||||
connect(chkAccumulate_2, SIGNAL(toggled(bool)), myPlot, SLOT(SetAccumulate(bool)));
|
||||
connect(btnResetAccumulate_2, SIGNAL(clicked()), myPlot, SLOT(ResetAccumulate()));
|
||||
connect(chkAccumulate, SIGNAL(toggled(bool)), plot, SLOT(SetAccumulate(bool)));
|
||||
connect(btnResetAccumulate, SIGNAL(clicked()), plot, SLOT(ResetAccumulate()));
|
||||
connect(chkAccumulate_2, SIGNAL(toggled(bool)), plot, SLOT(SetAccumulate(bool)));
|
||||
connect(btnResetAccumulate_2, SIGNAL(clicked()), plot, SLOT(ResetAccumulate()));
|
||||
//binary
|
||||
connect(chkBinary, SIGNAL(toggled(bool)), this, SLOT(SetBinary()));
|
||||
connect(chkBinary_2, SIGNAL(toggled(bool)), this, SLOT(SetBinary()));
|
||||
@ -125,14 +125,14 @@ void qTabPlot::Initialization() {
|
||||
connect(spinTo_2, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
|
||||
//gainplot
|
||||
if (chkGainPlot->isEnabled())
|
||||
connect(chkGainPlot, SIGNAL(toggled(bool)), myPlot, SLOT(EnableGainPlot(bool)));
|
||||
connect(chkGainPlot, SIGNAL(toggled(bool)), plot, SLOT(EnableGainPlot(bool)));
|
||||
// gap pixels
|
||||
if (chkGapPixels->isEnabled())
|
||||
connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
|
||||
|
||||
// Save, clone
|
||||
connect(btnSave, SIGNAL(clicked()), myPlot, SLOT(SavePlot()));
|
||||
connect(btnClone, SIGNAL(clicked()), myPlot, SLOT(ClonePlot()));
|
||||
connect(btnSave, SIGNAL(clicked()), plot, SLOT(SavePlot()));
|
||||
connect(btnClone, SIGNAL(clicked()), plot, SLOT(ClonePlot()));
|
||||
|
||||
// Plot Axis
|
||||
connect(chkTitle, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||
@ -171,7 +171,7 @@ void qTabPlot::Select1DPlot(bool enable) {
|
||||
chkZMax->setEnabled(!enable);
|
||||
dispZMin->setEnabled(!enable);
|
||||
dispZMax->setEnabled(!enable);
|
||||
myPlot->Select1dPlot(enable);
|
||||
plot->Select1dPlot(enable);
|
||||
SetTitles();
|
||||
SetXYRange();
|
||||
if (!is1d) {
|
||||
@ -201,7 +201,7 @@ void qTabPlot::SetPlot() {
|
||||
}
|
||||
}
|
||||
|
||||
myPlot->SetDataCallBack(plotEnable);
|
||||
plot->SetDataCallBack(plotEnable);
|
||||
}
|
||||
|
||||
void qTabPlot::Set1DPlotOptionsRight() {
|
||||
@ -249,9 +249,9 @@ void qTabPlot::EnablePersistency(bool enable) {
|
||||
lblPersistency->setEnabled(enable);
|
||||
spinPersistency->setEnabled(enable);
|
||||
if (enable)
|
||||
myPlot->SetPersistency(spinPersistency->value());
|
||||
plot->SetPersistency(spinPersistency->value());
|
||||
else
|
||||
myPlot->SetPersistency(0);
|
||||
plot->SetPersistency(0);
|
||||
}
|
||||
|
||||
void qTabPlot::SetBinary() {
|
||||
@ -263,38 +263,31 @@ void qTabPlot::SetBinary() {
|
||||
lblTo->setEnabled(binary1D);
|
||||
spinFrom->setEnabled(binary1D);
|
||||
spinTo->setEnabled(binary1D);
|
||||
myPlot->SetBinary(binary1D, spinFrom->value(), spinTo->value());
|
||||
plot->SetBinary(binary1D, spinFrom->value(), spinTo->value());
|
||||
} else {
|
||||
FILE_LOG(logINFO) << "Binary Plot " << (binary2D ? "enabled" : "disabled");
|
||||
lblFrom_2->setEnabled(binary2D);
|
||||
lblTo_2->setEnabled(binary2D);
|
||||
spinFrom_2->setEnabled(binary2D);
|
||||
spinTo_2->setEnabled(binary2D);
|
||||
myPlot->SetBinary(binary2D, spinFrom_2->value(), spinTo_2->value());
|
||||
plot->SetBinary(binary2D, spinFrom_2->value(), spinTo_2->value());
|
||||
}
|
||||
}
|
||||
|
||||
void qTabPlot::GetGapPixels() {
|
||||
FILE_LOG(logDEBUG) << "Getting gap pixels";
|
||||
disconnect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
|
||||
|
||||
try {
|
||||
auto retval = myDet->enableGapPixels(-1);
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "Gap pixels enable is inconsistent for all detectors.", "qTabPlot::GetGapPixels");
|
||||
} else {
|
||||
chkGapPixels->setChecked(retval == 0 ? false : true);
|
||||
}
|
||||
auto retval = det->getRxAddGapPixels().tsquash("Inconsistent gap pixels enabled for all detectors.");
|
||||
chkGapPixels->setChecked(retval);
|
||||
} CATCH_DISPLAY ("Could not get gap pixels enable.", "qTabPlot::GetGapPixels")
|
||||
|
||||
connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
|
||||
}
|
||||
|
||||
void qTabPlot::SetGapPixels(bool enable) {
|
||||
FILE_LOG(logINFO) << "Setting Gap Pixels Enable to " << enable;
|
||||
|
||||
try {
|
||||
myDet->enableGapPixels(enable);
|
||||
det->setRxAddGapPixels(enable);
|
||||
} CATCH_HANDLE("Could not set gap pixels enable.", "qTabPlot::SetGapPixels", this, &qTabPlot::GetGapPixels)
|
||||
}
|
||||
|
||||
@ -311,31 +304,31 @@ void qTabPlot::SetTitles() {
|
||||
|
||||
// title
|
||||
if (!chkTitle->isChecked() || dispTitle->text().isEmpty()) {
|
||||
myPlot->SetPlotTitlePrefix("");
|
||||
plot->SetPlotTitlePrefix("");
|
||||
dispTitle->setText("");
|
||||
} else {
|
||||
myPlot->SetPlotTitlePrefix(dispTitle->text());
|
||||
plot->SetPlotTitlePrefix(dispTitle->text());
|
||||
}
|
||||
// x
|
||||
if (!chkXAxis->isChecked() || dispXAxis->text().isEmpty()) {
|
||||
dispXAxis->setText(is1d ? defaultHistXAxisTitle : defaultImageXAxisTitle);
|
||||
myPlot->SetXAxisTitle(is1d ? defaultHistXAxisTitle : defaultImageXAxisTitle);
|
||||
plot->SetXAxisTitle(is1d ? defaultHistXAxisTitle : defaultImageXAxisTitle);
|
||||
} else {
|
||||
myPlot->SetXAxisTitle(dispXAxis->text());
|
||||
plot->SetXAxisTitle(dispXAxis->text());
|
||||
}
|
||||
// y
|
||||
if (!chkYAxis->isChecked() || dispYAxis->text().isEmpty()) {
|
||||
dispYAxis->setText(is1d ? defaultHistYAxisTitle : defaultImageYAxisTitle);
|
||||
myPlot->SetYAxisTitle(is1d ? defaultHistYAxisTitle : defaultImageYAxisTitle);
|
||||
plot->SetYAxisTitle(is1d ? defaultHistYAxisTitle : defaultImageYAxisTitle);
|
||||
} else {
|
||||
myPlot->SetYAxisTitle(dispYAxis->text());
|
||||
plot->SetYAxisTitle(dispYAxis->text());
|
||||
}
|
||||
// z
|
||||
if (!chkZAxis->isChecked() || dispZAxis->text().isEmpty()) {
|
||||
myPlot->SetZAxisTitle(defaultImageZAxisTitle);
|
||||
plot->SetZAxisTitle(defaultImageZAxisTitle);
|
||||
dispZAxis->setText(defaultImageZAxisTitle);
|
||||
} else {
|
||||
myPlot->SetZAxisTitle(dispZAxis->text());
|
||||
plot->SetZAxisTitle(dispZAxis->text());
|
||||
}
|
||||
|
||||
connect(chkTitle, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||
@ -395,7 +388,7 @@ void qTabPlot::SetXYRange() {
|
||||
}
|
||||
}
|
||||
|
||||
myPlot->SetXYRangeChanged(disablezoom, xyRange, isRange);
|
||||
plot->SetXYRangeChanged(disablezoom, xyRange, isRange);
|
||||
emit DisableZoomSignal(disablezoom);
|
||||
}
|
||||
|
||||
@ -417,20 +410,20 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
|
||||
chkYMin->setChecked(true);
|
||||
chkYMax->setChecked(true);
|
||||
if (dispXMin->text().isEmpty())
|
||||
dispXMin->setText(QString::number(myPlot->GetXMinimum()));
|
||||
dispXMin->setText(QString::number(plot->GetXMinimum()));
|
||||
if (dispXMax->text().isEmpty())
|
||||
dispXMax->setText(QString::number(myPlot->GetXMaximum()));
|
||||
dispXMax->setText(QString::number(plot->GetXMaximum()));
|
||||
if (dispYMin->text().isEmpty())
|
||||
dispYMin->setText(QString::number(myPlot->GetYMinimum()));
|
||||
dispYMin->setText(QString::number(plot->GetYMinimum()));
|
||||
if (dispYMax->text().isEmpty())
|
||||
dispYMax->setText(QString::number(myPlot->GetYMaximum()));
|
||||
dispYMax->setText(QString::number(plot->GetYMaximum()));
|
||||
|
||||
// calculate ideal aspect ratio with previous limits
|
||||
double ranges[4];
|
||||
ranges[qDefs::XMIN] = myPlot->GetXMinimum();
|
||||
ranges[qDefs::XMAX] = myPlot->GetXMaximum();
|
||||
ranges[qDefs::YMIN] = myPlot->GetYMinimum();
|
||||
ranges[qDefs::YMAX] = myPlot->GetYMaximum();
|
||||
ranges[qDefs::XMIN] = plot->GetXMinimum();
|
||||
ranges[qDefs::XMAX] = plot->GetXMaximum();
|
||||
ranges[qDefs::YMIN] = plot->GetYMinimum();
|
||||
ranges[qDefs::YMAX] = plot->GetYMaximum();
|
||||
double idealAspectratio = (ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) / (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]);
|
||||
FILE_LOG(logDEBUG) << "Ideal Aspect ratio: " << idealAspectratio << " for x(" << ranges[qDefs::XMIN] << " - " << ranges[qDefs::XMAX] << "), y(" << ranges[qDefs::YMIN] << " - " << ranges[qDefs::YMAX] << ")";
|
||||
|
||||
@ -454,7 +447,7 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
|
||||
double newval = 0;
|
||||
if (dimension == static_cast<int>(slsDetectorDefs::X)) {
|
||||
newval = idealAspectratio * (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]) + ranges[qDefs::XMIN];
|
||||
if (newval <= myPlot->GetXMaximum()) {
|
||||
if (newval <= plot->GetXMaximum()) {
|
||||
ranges[qDefs::XMAX] = newval;
|
||||
dispXMax->setText(QString::number(newval));
|
||||
FILE_LOG(logDEBUG) << "New XMax: " << newval;
|
||||
@ -468,7 +461,7 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
|
||||
// adjust y
|
||||
else {
|
||||
newval = ((ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) / idealAspectratio) + ranges[qDefs::YMIN];
|
||||
if (newval <= myPlot->GetYMaximum()) {
|
||||
if (newval <= plot->GetYMaximum()) {
|
||||
ranges[qDefs::YMAX] = newval;
|
||||
dispYMax->setText(QString::number(newval));
|
||||
FILE_LOG(logDEBUG) << "New YMax: " << newval;
|
||||
@ -491,7 +484,7 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
|
||||
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
||||
|
||||
bool isRange[4] {true, true, true, true};
|
||||
myPlot->SetXYRangeChanged(true, ranges, isRange);
|
||||
plot->SetXYRangeChanged(true, ranges, isRange);
|
||||
emit DisableZoomSignal(true);
|
||||
}
|
||||
|
||||
@ -509,7 +502,7 @@ void qTabPlot::SetZRange() {
|
||||
FILE_LOG(logDEBUG) << "Setting zmax to " << val;
|
||||
zRange[1] = val;
|
||||
}
|
||||
myPlot->SetZRange(zRange, isZRange);
|
||||
plot->SetZRange(zRange, isZRange);
|
||||
}
|
||||
|
||||
void qTabPlot::GetStreamingFrequency() {
|
||||
@ -518,26 +511,18 @@ void qTabPlot::GetStreamingFrequency() {
|
||||
disconnect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
||||
disconnect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
||||
disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
||||
|
||||
try {
|
||||
int freq = myDet->setReceiverStreamingFrequency(-1);
|
||||
if (freq < 0) {
|
||||
qDefs::Message(qDefs::WARNING, "Streaming frequency is inconsistent for all detectors.", "qTabPlot::GetStreamingFrequency");
|
||||
}
|
||||
int freq = det->getRxZmqFrequency().tsquash("Inconsistent receiver zmq streaming frequency for all detectors.");
|
||||
// time interval
|
||||
else if (freq == 0) {
|
||||
if (freq == 0) {
|
||||
comboFrequency->setCurrentIndex(0);
|
||||
stackedTimeInterval->setCurrentIndex(0);
|
||||
try {
|
||||
int timeMs = myDet->setReceiverStreamingTimer(-1);
|
||||
if (freq < 0) {
|
||||
qDefs::Message(qDefs::WARNING, "Streaming timer is inconsistent for all detectors.", "qTabPlot::GetStreamingFrequency");
|
||||
} else {
|
||||
double timeS = static_cast<double>(timeMs) / 1000.00;
|
||||
auto time = qDefs::getCorrectTime(timeS);
|
||||
spinTimeGap->setValue(time.first);
|
||||
comboTimeGapUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
}
|
||||
int timeMs = det->getRxZmqTimer().tsquash("Inconsistent receiver zmq streaming timer for all detectors.");
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(static_cast<double>(timeMs), qDefs::MILLISECONDS));
|
||||
auto time = qDefs::getUserFriendlyTime(timeNS);
|
||||
spinTimeGap->setValue(time.first);
|
||||
comboTimeGapUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
} CATCH_DISPLAY ("Could not get streaming timer.", "qTabPlot::GetStreamingFrequency")
|
||||
}
|
||||
// every nth frame
|
||||
@ -547,12 +532,10 @@ void qTabPlot::GetStreamingFrequency() {
|
||||
spinNthFrame->setValue(freq);
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get streaming frequency.", "qTabPlot::GetStreamingFrequency")
|
||||
|
||||
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
||||
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
||||
connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
||||
connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
||||
|
||||
}
|
||||
|
||||
void qTabPlot::SetStreamingFrequency() {
|
||||
@ -564,11 +547,11 @@ void qTabPlot::SetStreamingFrequency() {
|
||||
try {
|
||||
if (frequency) {
|
||||
FILE_LOG(logINFO) << "Setting Streaming Frequency to " << freqVal;
|
||||
myDet->setReceiverStreamingFrequency(freqVal);
|
||||
det->setRxZmqFrequency(freqVal);
|
||||
} else {
|
||||
FILE_LOG(logINFO) << "Setting Streaming Timer to " << timeVal << " " << qDefs::getUnitString(timeUnit);
|
||||
double timeMS = qDefs::getMSTime(timeUnit, timeVal);
|
||||
myDet->setReceiverStreamingTimer(timeMS);
|
||||
auto timeMS = qDefs::getMSTime(std::make_pair(timeVal, timeUnit));
|
||||
det->setRxZmqTimer(timeMS.count());
|
||||
}
|
||||
} CATCH_HANDLE("Could not set streaming frequency/ timer.", "qTabPlot::SetStreamingFrequency", this, &qTabPlot::GetStreamingFrequency)
|
||||
}
|
||||
@ -576,7 +559,7 @@ void qTabPlot::SetStreamingFrequency() {
|
||||
void qTabPlot::Refresh() {
|
||||
FILE_LOG(logDEBUG) << "**Updating Plot Tab";
|
||||
|
||||
if (!myPlot->GetIsRunning()) {
|
||||
if (!plot->GetIsRunning()) {
|
||||
boxPlotType->setEnabled(true);
|
||||
|
||||
// streaming frequency
|
||||
@ -585,7 +568,7 @@ void qTabPlot::Refresh() {
|
||||
}
|
||||
GetStreamingFrequency();
|
||||
// gain plot, gap pixels enable
|
||||
switch(myDet->getDetectorTypeAsEnum()) {
|
||||
switch(det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::EIGER:
|
||||
chkGapPixels->setEnabled(true);
|
||||
GetGapPixels();
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
qTabSettings::qTabSettings(QWidget *parent, multiSlsDetector *detector): QWidget(parent), myDet(detector) {
|
||||
qTabSettings::qTabSettings(QWidget *parent, sls::Detector *detector): QWidget(parent), det(detector) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
FILE_LOG(logDEBUG) << "Settings ready";
|
||||
@ -17,7 +17,7 @@ qTabSettings::~qTabSettings() {}
|
||||
void qTabSettings::SetupWidgetWindow() {
|
||||
|
||||
// enabling according to det type
|
||||
switch(myDet->getDetectorTypeAsEnum()) {
|
||||
switch(det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::MOENCH:
|
||||
lblSettings->setEnabled(false);
|
||||
comboSettings->setEnabled(false);
|
||||
@ -57,7 +57,7 @@ void qTabSettings::SetupDetectorSettings() {
|
||||
item[i] = model->itemFromIndex(index[i]);
|
||||
item[i]->setEnabled(false);
|
||||
}
|
||||
switch (myDet->getDetectorTypeAsEnum()) {
|
||||
switch (det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::EIGER:
|
||||
item[(int)STANDARD]->setEnabled(true);
|
||||
item[(int)HIGHGAIN]->setEnabled(true);
|
||||
@ -106,13 +106,9 @@ void qTabSettings::Initialization() {
|
||||
void qTabSettings::GetSettings() {
|
||||
FILE_LOG(logDEBUG) << "Getting settings";
|
||||
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSettings(int)));
|
||||
|
||||
try{
|
||||
auto retval = myDet->getSettings(-1);
|
||||
auto retval = det->getSettings().tsquash("Inconsistent settings for all detectors.");
|
||||
switch (retval) {
|
||||
case -1:
|
||||
qDefs::Message(qDefs::WARNING, "Settings are inconsistent for all detectors.", "qTabSettings::GetSettings");
|
||||
break;
|
||||
case slsDetectorDefs::UNDEFINED:
|
||||
comboSettings->setCurrentIndex(UNDEFINED);
|
||||
break;
|
||||
@ -121,26 +117,22 @@ void qTabSettings::GetSettings() {
|
||||
break;
|
||||
default:
|
||||
if ((int)retval < -1 || (int)retval >= NUMSETTINGS) {
|
||||
qDefs::Message(qDefs::WARNING, std::string("Unknown settings: ") + std::to_string(retval), "qTabSettings::GetSettings");
|
||||
} else {
|
||||
comboSettings->setCurrentIndex(retval);
|
||||
throw sls::RuntimeError(std::string("Unknown settings: ") + std::to_string(retval));
|
||||
}
|
||||
comboSettings->setCurrentIndex(retval);
|
||||
break;
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get settings.", "qTabSettings::GetSettings")
|
||||
|
||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSettings(int)));
|
||||
}
|
||||
|
||||
void qTabSettings::SetSettings(int index) {
|
||||
// settings
|
||||
auto val = static_cast<slsDetectorDefs::detectorSettings>(index);
|
||||
FILE_LOG(logINFO) << "Setting Settings to " << myDet->slsDetectorDefs::getDetectorSettings(val);
|
||||
|
||||
FILE_LOG(logINFO) << "Setting Settings to " << slsDetectorDefs::getDetectorSettings(val);
|
||||
try {
|
||||
myDet->setSettings(val);
|
||||
det->setSettings(val);
|
||||
} CATCH_HANDLE ("Could not set settings.", "qTabSettings::SetSettings", this, &qTabSettings::GetSettings)
|
||||
|
||||
// threshold
|
||||
if (spinThreshold->isEnabled()) {
|
||||
SetThresholdEnergy(spinThreshold->value());
|
||||
@ -150,15 +142,10 @@ void qTabSettings::SetSettings(int index) {
|
||||
void qTabSettings::GetDynamicRange() {
|
||||
FILE_LOG(logDEBUG) << "Getting dynamic range";
|
||||
disconnect(comboDynamicRange, SIGNAL(activated(int)), this, SLOT(SetDynamicRange(int)));
|
||||
|
||||
try {
|
||||
auto retval = myDet->setDynamicRange(-1);
|
||||
|
||||
try {
|
||||
auto retval = det->getDynamicRange().tsquash("Inconsistent dynamic range for all detectors.");
|
||||
// set the final value on gui
|
||||
switch (retval) {
|
||||
case -1:
|
||||
qDefs::Message(qDefs::WARNING, "Dynamic Range is inconsistent for all detectors.", "qTabSettings::GetDynamicRange");
|
||||
break;
|
||||
case 32:
|
||||
comboDynamicRange->setCurrentIndex(DYNAMICRANGE_32);
|
||||
break;
|
||||
@ -172,11 +159,9 @@ void qTabSettings::GetDynamicRange() {
|
||||
comboDynamicRange->setCurrentIndex(DYNAMICRANGE_4);
|
||||
break;
|
||||
default:
|
||||
qDefs::Message(qDefs::WARNING, std::string("Unknown dynamic range: ") + std::to_string(retval), "qTabSettings::GetDynamicRange");
|
||||
break;
|
||||
throw sls::RuntimeError(std::string("Unknown dynamic range: ") + std::to_string(retval));
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get dynamic range.", "qTabSettings::GetDynamicRange")
|
||||
|
||||
connect(comboDynamicRange, SIGNAL(activated(int)), this,SLOT(SetDynamicRange(int)));
|
||||
}
|
||||
|
||||
@ -185,20 +170,19 @@ void qTabSettings::SetDynamicRange(int index) {
|
||||
try {
|
||||
switch (index) {
|
||||
case DYNAMICRANGE_32:
|
||||
myDet->setDynamicRange(32);
|
||||
det->setDynamicRange(32);
|
||||
break;
|
||||
case DYNAMICRANGE_16:
|
||||
myDet->setDynamicRange(16);
|
||||
det->setDynamicRange(16);
|
||||
break;
|
||||
case DYNAMICRANGE_8:
|
||||
myDet->setDynamicRange(8);
|
||||
det->setDynamicRange(8);
|
||||
break;
|
||||
case DYNAMICRANGE_4:
|
||||
myDet->setDynamicRange(4);
|
||||
det->setDynamicRange(4);
|
||||
break;
|
||||
default:
|
||||
qDefs::Message(qDefs::WARNING, std::string("Unknown dynamic range: ") + std::to_string(index), "qTabSettings::SetDynamicRange");
|
||||
break;
|
||||
throw sls::RuntimeError(std::string("Unknown dynamic range: ") + std::to_string(index));
|
||||
}
|
||||
} CATCH_HANDLE ("Could not set dynamic range.", "qTabSettings::SetDynamicRange", this, &qTabSettings::GetDynamicRange)
|
||||
}
|
||||
@ -206,27 +190,18 @@ void qTabSettings::SetDynamicRange(int index) {
|
||||
void qTabSettings::GetThresholdEnergy() {
|
||||
FILE_LOG(logDEBUG) << "Getting theshold energy";
|
||||
disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetThresholdEnergy(int)));
|
||||
|
||||
try {
|
||||
auto retval = myDet->getThresholdEnergy();
|
||||
/*if (retval == -1) { commenting out as default is -1, handle this when API changes
|
||||
qDefs::Message(qDefs::WARNING, "Threshold Energy is inconsistent for all detectors.", "qTabDataOutput::GetThresholdEnergy");
|
||||
spinThreshold->setValue(-1);
|
||||
} else {
|
||||
spinThreshold->setValue(retval);
|
||||
}*/
|
||||
auto retval = det->getThresholdEnergy().tsquash("Inconsistent threhsold energy for all detectors.");
|
||||
spinThreshold->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get threshold energy.", "qTabDataOutput::GetThresholdEnergy")
|
||||
|
||||
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetThresholdEnergy(int)));
|
||||
}
|
||||
|
||||
void qTabSettings::SetThresholdEnergy(int index) {
|
||||
FILE_LOG(logINFO) << "Setting Threshold Energy to " << index << " eV";
|
||||
try {
|
||||
myDet->setThresholdEnergy(index);
|
||||
det->setThresholdEnergy(index);
|
||||
} CATCH_DISPLAY ("Could not get threshold energy.", "qTabSettings::SetThresholdEnergy")
|
||||
|
||||
// set the right value anyway (due to tolerance)
|
||||
GetThresholdEnergy();
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ class Detector {
|
||||
Result<int64_t> getReceiverVersion(Positions pos = {}) const;
|
||||
|
||||
Result<defs::detectorType> getDetectorType(Positions pos = {}) const;
|
||||
|
||||
|
||||
/** Gets the total number of detectors */
|
||||
int size() const;
|
||||
|
||||
@ -233,7 +233,7 @@ class Detector {
|
||||
*/
|
||||
void stopAcquisition();
|
||||
|
||||
/**
|
||||
/** TODO: initially was getting acq flag, if set, check if detctor idle, then set, else exception & abort
|
||||
* Clears the acquiring flag. This has to be done manually
|
||||
* after an acquisition was aborted.
|
||||
*/
|
||||
@ -249,7 +249,7 @@ class Detector {
|
||||
Result<uint64_t> getStartingFrameNumber(Positions pos = {}) const;
|
||||
|
||||
/** [Eiger][Jungfrau] */
|
||||
void setStartingFrameNumber(uint64_t value, Positions pos);
|
||||
void setStartingFrameNumber(uint64_t value, Positions pos = {});
|
||||
|
||||
/** [Eiger] Sends an internal software trigger to the detector */
|
||||
void sendSoftwareTrigger(Positions pos = {});
|
||||
@ -655,10 +655,12 @@ class Detector {
|
||||
/** [Eiger] deadtime in ns, 0 = disabled */
|
||||
Result<ns> getRateCorrection(Positions pos = {}) const;
|
||||
|
||||
/** [Eiger] Sets default rate correction from trimbit file */
|
||||
void setDefaultRateCorrection(Positions pos = {});
|
||||
|
||||
/** //TODO: default, get, set
|
||||
* [Eiger] Set Rate correction
|
||||
* 0 disable correction, < 0: default dead time from trimbit file, > 0
|
||||
* custom deadtime (advanced)
|
||||
* 0 disable correction, > 0 custom deadtime, cannot be -1
|
||||
*/
|
||||
void setRateCorrection(ns dead_time, Positions pos = {});
|
||||
|
||||
|
@ -1552,11 +1552,16 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
*/
|
||||
int setAutoComparatorDisableMode(int ival = -1, int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Set Default Rate correction from trimbit file ( Eiger)
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
*/
|
||||
void setDefaultRateCorrection(int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Set Rate correction ( Eiger)
|
||||
* @param t dead time in ns - if 0 disable correction,
|
||||
* if >0 set dead time to t, if < 0 set deadtime to default dead time
|
||||
* for current settings
|
||||
* if >0 set dead time to t, cannot be < 0
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
*/
|
||||
void setRateCorrection(int64_t t = 0, int detPos = -1); //
|
||||
|
@ -1280,10 +1280,15 @@ class slsDetector : public virtual slsDetectorDefs {
|
||||
*/
|
||||
sls_detector_module getModule();
|
||||
|
||||
/**
|
||||
* Set Default Rate correction from trimbit file(Eiger)
|
||||
*/
|
||||
void setDefaultRateCorrection();
|
||||
|
||||
/**
|
||||
* Set Rate correction (Eiger)
|
||||
* @param t dead time in ns - if 0 disable correction,
|
||||
* if >0 set dead time to t, if < 0 set deadtime to default dead time
|
||||
* if >0 set dead time to t, cannot be < 0
|
||||
* for current settings
|
||||
*/
|
||||
void setRateCorrection(int64_t t = 0);
|
||||
|
@ -250,14 +250,14 @@ void Detector::setTimingMode(defs::timingMode value, Positions pos) {
|
||||
void Detector::acquire() { pimpl->acquire(); }
|
||||
|
||||
void Detector::startAcquisition() {
|
||||
if (getUseReceiverFlag({}).squash())
|
||||
if (getUseReceiverFlag().squash(true))
|
||||
pimpl->Parallel(&slsDetector::startReceiver, {});
|
||||
pimpl->Parallel(&slsDetector::startAcquisition, {});
|
||||
}
|
||||
|
||||
void Detector::stopAcquisition() {
|
||||
pimpl->Parallel(&slsDetector::stopAcquisition, {});
|
||||
if (getUseReceiverFlag({}).squash()) // TODO: problem for acquire()
|
||||
if (getUseReceiverFlag().squash(true))
|
||||
pimpl->Parallel(&slsDetector::stopReceiver, {});
|
||||
}
|
||||
|
||||
@ -768,9 +768,9 @@ void Detector::setRxAddGapPixels(bool enable) {
|
||||
Result<bool> Detector::getParallelMode(Positions pos) const {
|
||||
auto res = pimpl->Parallel(&slsDetector::setReadOutFlags, pos,
|
||||
defs::GET_READOUT_FLAGS);
|
||||
Result<bool> booleanRes;
|
||||
for (unsigned int i = 0; i < res.size(); ++i) {
|
||||
booleanRes[i] = (res[i] & defs::PARALLEL) ? true : false;
|
||||
Result<bool> booleanRes(res.size());
|
||||
for (size_t i = 0; i < res.size(); ++i) {
|
||||
booleanRes[i] = res[i] & defs::PARALLEL;
|
||||
}
|
||||
return booleanRes;
|
||||
}
|
||||
@ -783,9 +783,9 @@ void Detector::setParallelMode(bool value, Positions pos) {
|
||||
Result<bool> Detector::getOverFlowMode(Positions pos) const {
|
||||
auto res = pimpl->Parallel(&slsDetector::setReadOutFlags, pos,
|
||||
defs::GET_READOUT_FLAGS);
|
||||
Result<bool> booleanRes;
|
||||
for (unsigned int i = 0; i < res.size(); ++i) {
|
||||
booleanRes[i] = (res[i] & defs::SHOW_OVERFLOW) ? true : false;
|
||||
Result<bool> booleanRes(res.size());
|
||||
for (size_t i = 0; i < res.size(); ++i) {
|
||||
booleanRes[i] = res[i] & defs::SHOW_OVERFLOW;
|
||||
}
|
||||
return booleanRes;
|
||||
}
|
||||
@ -824,6 +824,10 @@ Result<ns> Detector::getRateCorrection(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getRateCorrection, pos);
|
||||
}
|
||||
|
||||
void Detector::setDefaultRateCorrection(Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setDefaultRateCorrection, pos);
|
||||
}
|
||||
|
||||
void Detector::setRateCorrection(ns dead_time, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setRateCorrection, pos, dead_time.count());
|
||||
}
|
||||
|
@ -2358,7 +2358,20 @@ int multiSlsDetector::setAutoComparatorDisableMode(int ival, int detPos) {
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
void multiSlsDetector::setDefaultRateCorrection(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
detectors[detPos]->setDefaultRateCorrection();
|
||||
}
|
||||
|
||||
// multi
|
||||
parallelCall(&slsDetector::setDefaultRateCorrection);
|
||||
}
|
||||
|
||||
void multiSlsDetector::setRateCorrection(int64_t t, int detPos) {
|
||||
if (t < 0) {
|
||||
throw sls::RuntimeError("Dead time has to be greater or equal to 0");
|
||||
}
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
detectors[detPos]->setRateCorrection(t);
|
||||
|
@ -2719,6 +2719,13 @@ sls_detector_module slsDetector::getModule() {
|
||||
return myMod;
|
||||
}
|
||||
|
||||
void slsDetector::setDefaultRateCorrection() {
|
||||
FILE_LOG(logDEBUG1) << "Setting Default Rate Correction";
|
||||
int64_t arg = -1;
|
||||
sendToDetector(F_SET_RATE_CORRECT, arg, nullptr);
|
||||
shm()->deadTime = -1;
|
||||
}
|
||||
|
||||
void slsDetector::setRateCorrection(int64_t t) {
|
||||
FILE_LOG(logDEBUG1) << "Setting Rate Correction to " << t;
|
||||
sendToDetector(F_SET_RATE_CORRECT, t, nullptr);
|
||||
|
@ -7,7 +7,6 @@
|
||||
#define APICTB 0x190821
|
||||
#define APIGOTTHARD 0x190821
|
||||
#define APIJUNGFRAU 0x190821
|
||||
#define APIEIGER 0x190821
|
||||
#define APIMYTHEN3 0x190822
|
||||
|
||||
#define APIEIGER 0x190823
|
||||
#define APIGOTTHARD2 0x190826
|
||||
|
Loading…
x
Reference in New Issue
Block a user