mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-10 14:50:02 +02:00
clang format on gui
This commit is contained in:
parent
bd6529a64c
commit
9ede0629ef
10
slsDetectorGui/include/qCloneWidget.h
Executable file → Normal file
10
slsDetectorGui/include/qCloneWidget.h
Executable file → Normal file
@ -16,10 +16,10 @@ class qCloneWidget : public QMainWindow, private Ui::ClonePlotObject {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qCloneWidget(QWidget *parent, SlsQt1DPlot *p1, SlsQt2DPlot *p2, SlsQt1DPlot *gp1, SlsQt2DPlot *gp,
|
qCloneWidget(QWidget *parent, SlsQt1DPlot *p1, SlsQt2DPlot *p2,
|
||||||
QString title, QString filePath, QString fileName,
|
SlsQt1DPlot *gp1, SlsQt2DPlot *gp, QString title,
|
||||||
int64_t aIndex, bool displayStats, QString min, QString max,
|
QString filePath, QString fileName, int64_t aIndex,
|
||||||
QString sum);
|
bool displayStats, QString min, QString max, QString sum);
|
||||||
|
|
||||||
~qCloneWidget();
|
~qCloneWidget();
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ class qCloneWidget : public QMainWindow, private Ui::ClonePlotObject {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *event);
|
void resizeEvent(QResizeEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetupWidgetWindow(QString title);
|
void SetupWidgetWindow(QString title);
|
||||||
void DisplayStats(bool enable, QString min, QString max, QString sum);
|
void DisplayStats(bool enable, QString min, QString max, QString sum);
|
||||||
|
38
slsDetectorGui/include/qDacWidget.h
Executable file → Normal file
38
slsDetectorGui/include/qDacWidget.h
Executable file → Normal file
@ -7,27 +7,27 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class qDacWidget:public QWidget, private Ui::WidgetDacObject {
|
class qDacWidget : public QWidget, private Ui::WidgetDacObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qDacWidget(QWidget *parent, sls::Detector* detector, bool d, std::string n, slsDetectorDefs::dacIndex i);
|
qDacWidget(QWidget *parent, sls::Detector *detector, bool d, std::string n,
|
||||||
~qDacWidget();
|
slsDetectorDefs::dacIndex i);
|
||||||
void SetDetectorIndex(int id);
|
~qDacWidget();
|
||||||
|
void SetDetectorIndex(int id);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void SetDac();
|
void SetDac();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetupWidgetWindow(std::string name);
|
void SetupWidgetWindow(std::string name);
|
||||||
void Initialization();
|
void Initialization();
|
||||||
void GetDac();
|
void GetDac();
|
||||||
void GetAdc();
|
void GetAdc();
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
|
||||||
sls::Detector *det;
|
sls::Detector *det;
|
||||||
bool isDac{true};
|
bool isDac{true};
|
||||||
slsDetectorDefs::dacIndex index;
|
slsDetectorDefs::dacIndex index;
|
||||||
int detectorIndex{-1};
|
int detectorIndex{-1};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
83
slsDetectorGui/include/qDefs.h
Executable file → Normal file
83
slsDetectorGui/include/qDefs.h
Executable file → Normal file
@ -5,22 +5,28 @@
|
|||||||
#include <QAbstractButton>
|
#include <QAbstractButton>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <chrono>
|
|
||||||
using std::chrono::duration;
|
using std::chrono::duration;
|
||||||
using std::chrono::duration_cast;
|
using std::chrono::duration_cast;
|
||||||
using std::chrono::nanoseconds;
|
using std::chrono::hours;
|
||||||
using std::chrono::microseconds;
|
using std::chrono::microseconds;
|
||||||
using std::chrono::milliseconds;
|
using std::chrono::milliseconds;
|
||||||
using std::chrono::seconds;
|
|
||||||
using std::chrono::minutes;
|
using std::chrono::minutes;
|
||||||
using std::chrono::hours;
|
using std::chrono::nanoseconds;
|
||||||
|
using std::chrono::seconds;
|
||||||
|
|
||||||
#define CATCH_DISPLAY(m, s) catch(...) { qDefs::DisplayExceptions(m, s); }
|
#define CATCH_DISPLAY(m, s) \
|
||||||
#define CATCH_HANDLE(...) catch(...) { qDefs::HandleExceptions(__VA_ARGS__); }
|
catch (...) { \
|
||||||
|
qDefs::DisplayExceptions(m, s); \
|
||||||
|
}
|
||||||
|
#define CATCH_HANDLE(...) \
|
||||||
|
catch (...) { \
|
||||||
|
qDefs::HandleExceptions(__VA_ARGS__); \
|
||||||
|
}
|
||||||
|
|
||||||
class qDefs : public QWidget {
|
class qDefs : public QWidget {
|
||||||
public:
|
public:
|
||||||
@ -29,9 +35,9 @@ class qDefs : public QWidget {
|
|||||||
*/
|
*/
|
||||||
qDefs(){};
|
qDefs(){};
|
||||||
|
|
||||||
static const int Q_FONT_SIZE=9;
|
static const int Q_FONT_SIZE = 9;
|
||||||
static const int DATA_GAIN_PLOT_RATIO=5;
|
static const int DATA_GAIN_PLOT_RATIO = 5;
|
||||||
static const int MIN_HEIGHT_GAIN_PLOT_1D=75;
|
static const int MIN_HEIGHT_GAIN_PLOT_1D = 75;
|
||||||
|
|
||||||
static void DisplayExceptions(std::string emsg, std::string src) {
|
static void DisplayExceptions(std::string emsg, std::string src) {
|
||||||
try {
|
try {
|
||||||
@ -47,8 +53,8 @@ class qDefs : public QWidget {
|
|||||||
|
|
||||||
template <class CT> struct NonDeduced { using type = CT; };
|
template <class CT> struct NonDeduced { using type = CT; };
|
||||||
template <class S, typename RT, typename... CT>
|
template <class S, typename RT, typename... CT>
|
||||||
static void HandleExceptions(const std::string emsg, const std::string src, S* s,
|
static void HandleExceptions(const std::string emsg, const std::string src,
|
||||||
RT (S::*somefunc)(CT...),
|
S *s, RT (S::*somefunc)(CT...),
|
||||||
typename NonDeduced<CT>::type... Args) {
|
typename NonDeduced<CT>::type... Args) {
|
||||||
try {
|
try {
|
||||||
throw;
|
throw;
|
||||||
@ -72,15 +78,22 @@ class qDefs : public QWidget {
|
|||||||
QF_NUM_FUNCTIONS
|
QF_NUM_FUNCTIONS
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char* getQFunctionNameFromEnum(enum qFuncNames func) {
|
static const char *getQFunctionNameFromEnum(enum qFuncNames func) {
|
||||||
switch (func) {
|
switch (func) {
|
||||||
case QF_GET_DETECTOR_STATUS: return "QF_GET_DETECTOR_STATUS";
|
case QF_GET_DETECTOR_STATUS:
|
||||||
case QF_START_ACQUISITION: return "QF_START_ACQUISITION";
|
return "QF_GET_DETECTOR_STATUS";
|
||||||
case QF_STOP_ACQUISITION: return "QF_STOP_ACQUISITION";
|
case QF_START_ACQUISITION:
|
||||||
case QF_START_AND_READ_ALL: return "QF_START_AND_READ_ALL";
|
return "QF_START_ACQUISITION";
|
||||||
case QF_EXIT_SERVER: return "QF_EXIT_SERVER";
|
case QF_STOP_ACQUISITION:
|
||||||
case QF_NUM_FUNCTIONS: return "QF_NUM_FUNCTIONS";
|
return "QF_STOP_ACQUISITION";
|
||||||
default: return "Unknown Function";
|
case QF_START_AND_READ_ALL:
|
||||||
|
return "QF_START_AND_READ_ALL";
|
||||||
|
case QF_EXIT_SERVER:
|
||||||
|
return "QF_EXIT_SERVER";
|
||||||
|
case QF_NUM_FUNCTIONS:
|
||||||
|
return "QF_NUM_FUNCTIONS";
|
||||||
|
default:
|
||||||
|
return "Unknown Function";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -111,11 +124,16 @@ class qDefs : public QWidget {
|
|||||||
|
|
||||||
static std::string getRangeAsString(enum range r) {
|
static std::string getRangeAsString(enum range r) {
|
||||||
switch (r) {
|
switch (r) {
|
||||||
case XMIN: return "XMIN";
|
case XMIN:
|
||||||
case XMAX: return "XMAX";
|
return "XMIN";
|
||||||
case YMIN: return "YMIN";
|
case XMAX:
|
||||||
case YMAX: return "YMAX";
|
return "XMAX";
|
||||||
default: return "Unknown";
|
case YMIN:
|
||||||
|
return "YMIN";
|
||||||
|
case YMAX:
|
||||||
|
return "YMAX";
|
||||||
|
default:
|
||||||
|
return "Unknown";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -190,7 +208,8 @@ class qDefs : public QWidget {
|
|||||||
MINUTES);
|
MINUTES);
|
||||||
}
|
}
|
||||||
return std::make_pair(
|
return std::make_pair(
|
||||||
duration_cast<duration<double, std::ratio<3600>>>(tns).count(), HOURS);
|
duration_cast<duration<double, std::ratio<3600>>>(tns).count(),
|
||||||
|
HOURS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** returns the value in ns */
|
/** returns the value in ns */
|
||||||
@ -296,10 +315,12 @@ class qDefs : public QWidget {
|
|||||||
/**
|
/**
|
||||||
* Wrap exception message
|
* Wrap exception message
|
||||||
*/
|
*/
|
||||||
static int ExceptionMessage(std::string message,
|
static int ExceptionMessage(std::string message,
|
||||||
std::string exceptionMessage,
|
std::string exceptionMessage,
|
||||||
std::string source) {
|
std::string source) {
|
||||||
return Message(qDefs::WARNING, message + std::string("\nCaught exception:\n") + exceptionMessage, source);
|
return Message(qDefs::WARNING,
|
||||||
}
|
message + std::string("\nCaught exception:\n") +
|
||||||
|
exceptionMessage,
|
||||||
|
source);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
3
slsDetectorGui/include/qDetectorMain.h
Executable file → Normal file
3
slsDetectorGui/include/qDetectorMain.h
Executable file → Normal file
@ -20,7 +20,8 @@ class qTabMessages;
|
|||||||
class QScrollArea;
|
class QScrollArea;
|
||||||
class QResizeEvent;
|
class QResizeEvent;
|
||||||
|
|
||||||
/** To Over-ride the QTabWidget class to get the tabBar protected methodTabWidget */
|
/** To Over-ride the QTabWidget class to get the tabBar protected
|
||||||
|
* methodTabWidget */
|
||||||
class MyTabWidget : public QTabWidget {
|
class MyTabWidget : public QTabWidget {
|
||||||
public:
|
public:
|
||||||
MyTabWidget(QWidget *parent = 0) { setParent(parent); }
|
MyTabWidget(QWidget *parent = 0) { setParent(parent); }
|
||||||
|
49
slsDetectorGui/include/qDrawPlot.h
Executable file → Normal file
49
slsDetectorGui/include/qDrawPlot.h
Executable file → Normal file
@ -19,7 +19,7 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qDrawPlot(QWidget *parent, sls::Detector *detector);
|
qDrawPlot(QWidget *parent, sls::Detector *detector);
|
||||||
~qDrawPlot();
|
~qDrawPlot();
|
||||||
bool GetIsRunning();
|
bool GetIsRunning();
|
||||||
void SetRunning(bool enable);
|
void SetRunning(bool enable);
|
||||||
@ -30,8 +30,8 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
|||||||
void SetXAxisTitle(QString title);
|
void SetXAxisTitle(QString title);
|
||||||
void SetYAxisTitle(QString title);
|
void SetYAxisTitle(QString title);
|
||||||
void SetZAxisTitle(QString title);
|
void SetZAxisTitle(QString title);
|
||||||
void SetXYRangeChanged(bool disable, double* xy, bool* isXY);
|
void SetXYRangeChanged(bool disable, double *xy, bool *isXY);
|
||||||
void SetZRange(double* z, bool* isZ);
|
void SetZRange(double *z, bool *isZ);
|
||||||
double GetXMinimum();
|
double GetXMinimum();
|
||||||
double GetXMaximum();
|
double GetXMaximum();
|
||||||
double GetYMinimum();
|
double GetYMinimum();
|
||||||
@ -56,7 +56,7 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
|||||||
void SetNumDiscardBits(int value);
|
void SetNumDiscardBits(int value);
|
||||||
void EnableGainPlot(bool enable);
|
void EnableGainPlot(bool enable);
|
||||||
void ClonePlot();
|
void ClonePlot();
|
||||||
void SavePlot();
|
void SavePlot();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *event);
|
void resizeEvent(QResizeEvent *event);
|
||||||
@ -65,7 +65,7 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
|||||||
void SetSaveFileName(QString val);
|
void SetSaveFileName(QString val);
|
||||||
void AcquireThread();
|
void AcquireThread();
|
||||||
void UpdatePlot();
|
void UpdatePlot();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void StartAcquireSignal();
|
void StartAcquireSignal();
|
||||||
void AcquireFinishedSignal();
|
void AcquireFinishedSignal();
|
||||||
@ -75,40 +75,45 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
|||||||
private:
|
private:
|
||||||
void SetupWidgetWindow();
|
void SetupWidgetWindow();
|
||||||
void Initialization();
|
void Initialization();
|
||||||
void SetupPlots();
|
void SetupPlots();
|
||||||
void GetStatistics(double &min, double &max, double &sum);
|
void GetStatistics(double &min, double &max, double &sum);
|
||||||
void DetachHists();
|
void DetachHists();
|
||||||
static void GetAcquisitionFinishedCallBack(double currentProgress, int detectorStatus, void *this_pointer);
|
static void GetAcquisitionFinishedCallBack(double currentProgress,
|
||||||
static void GetDataCallBack(detectorData *data, uint64_t frameIndex, uint32_t subFrameIndex, void *this_pointer);
|
int detectorStatus,
|
||||||
|
void *this_pointer);
|
||||||
|
static void GetDataCallBack(detectorData *data, uint64_t frameIndex,
|
||||||
|
uint32_t subFrameIndex, void *this_pointer);
|
||||||
void AcquisitionFinished(double currentProgress, int detectorStatus);
|
void AcquisitionFinished(double currentProgress, int detectorStatus);
|
||||||
void GetData(detectorData *data, uint64_t frameIndex, uint32_t subFrameIndex);
|
void GetData(detectorData *data, uint64_t frameIndex,
|
||||||
void toDoublePixelData(double *dest, char *source, int size, int databytes, int dr, double *gaindest = NULL);
|
uint32_t subFrameIndex);
|
||||||
void Get1dData(double* rawData);
|
void toDoublePixelData(double *dest, char *source, int size, int databytes,
|
||||||
void Get2dData(double* rawData);
|
int dr, double *gaindest = NULL);
|
||||||
|
void Get1dData(double *rawData);
|
||||||
|
void Get2dData(double *rawData);
|
||||||
void Update1dPlot();
|
void Update1dPlot();
|
||||||
void Update2dPlot();
|
void Update2dPlot();
|
||||||
void Update1dXYRange();
|
void Update1dXYRange();
|
||||||
void Update2dXYRange();
|
void Update2dXYRange();
|
||||||
|
|
||||||
static const int NUM_PEDESTAL_FRAMES = 20;
|
static const int NUM_PEDESTAL_FRAMES = 20;
|
||||||
sls::Detector *det;
|
sls::Detector *det;
|
||||||
slsDetectorDefs::detectorType detType;
|
slsDetectorDefs::detectorType detType;
|
||||||
|
|
||||||
SlsQt1DPlot *plot1d{nullptr};
|
SlsQt1DPlot *plot1d{nullptr};
|
||||||
QVector<SlsQtH1D *> hists1d;
|
QVector<SlsQtH1D *> hists1d;
|
||||||
SlsQt1DPlot *gainplot1d{nullptr};
|
SlsQt1DPlot *gainplot1d{nullptr};
|
||||||
SlsQtH1D * gainhist1d{nullptr};
|
SlsQtH1D *gainhist1d{nullptr};
|
||||||
SlsQt2DPlot *plot2d{nullptr};
|
SlsQt2DPlot *plot2d{nullptr};
|
||||||
SlsQt2DPlot *gainplot2d{nullptr};
|
SlsQt2DPlot *gainplot2d{nullptr};
|
||||||
|
|
||||||
bool is1d{true};
|
bool is1d{true};
|
||||||
bool isRunning{false};
|
bool isRunning{false};
|
||||||
|
|
||||||
// titles
|
// titles
|
||||||
QString plotTitlePrefix{""};
|
QString plotTitlePrefix{""};
|
||||||
QString xTitle1d{"Channel Number"};
|
QString xTitle1d{"Channel Number"};
|
||||||
QString yTitle1d{"Counts"};
|
QString yTitle1d{"Counts"};
|
||||||
QString xTitle2d{"Pixel"};
|
QString xTitle2d{"Pixel"};
|
||||||
QString yTitle2d{"Pixel"};
|
QString yTitle2d{"Pixel"};
|
||||||
QString zTitle2d{"Intensity"};
|
QString zTitle2d{"Intensity"};
|
||||||
QString plotTitle{""};
|
QString plotTitle{""};
|
||||||
@ -119,7 +124,7 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
|||||||
double zRange[2]{0, 1};
|
double zRange[2]{0, 1};
|
||||||
bool isZRange[2]{false, false};
|
bool isZRange[2]{false, false};
|
||||||
|
|
||||||
// data
|
// data
|
||||||
int nHists{1};
|
int nHists{1};
|
||||||
double *datax1d{nullptr};
|
double *datax1d{nullptr};
|
||||||
std::vector<double *> datay1d;
|
std::vector<double *> datay1d;
|
||||||
@ -127,9 +132,9 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
|||||||
double *data2d{nullptr};
|
double *data2d{nullptr};
|
||||||
double *gainData{nullptr};
|
double *gainData{nullptr};
|
||||||
|
|
||||||
//options
|
// options
|
||||||
bool isPlot{true};
|
bool isPlot{true};
|
||||||
bool isBinary{false};
|
bool isBinary{false};
|
||||||
int binaryFrom{0};
|
int binaryFrom{0};
|
||||||
int binaryTo{0};
|
int binaryTo{0};
|
||||||
int persistency{0};
|
int persistency{0};
|
||||||
|
106
slsDetectorGui/include/qTabAdvanced.h
Executable file → Normal file
106
slsDetectorGui/include/qTabAdvanced.h
Executable file → Normal file
@ -6,64 +6,62 @@ class qDrawPlot;
|
|||||||
|
|
||||||
#include "Detector.h"
|
#include "Detector.h"
|
||||||
|
|
||||||
class qTabAdvanced:public QWidget, private Ui::TabAdvancedObject{
|
class qTabAdvanced : public QWidget, private Ui::TabAdvancedObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qTabAdvanced(QWidget *parent, sls::Detector* detector, qDrawPlot* p);
|
qTabAdvanced(QWidget *parent, sls::Detector *detector, qDrawPlot *p);
|
||||||
~qTabAdvanced();
|
~qTabAdvanced();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void SetDetector();
|
void SetDetector();
|
||||||
void SetControlPort(int port);
|
void SetControlPort(int port);
|
||||||
void SetStopPort(int port);
|
void SetStopPort(int port);
|
||||||
void SetDetectorUDPIP();
|
void SetDetectorUDPIP();
|
||||||
void SetDetectorUDPMAC();
|
void SetDetectorUDPMAC();
|
||||||
void SetCltZMQPort(int port);
|
void SetCltZMQPort(int port);
|
||||||
void SetCltZMQIP();
|
void SetCltZMQIP();
|
||||||
void SetRxrHostname();
|
void SetRxrHostname();
|
||||||
void SetRxrTCPPort(int port);
|
void SetRxrTCPPort(int port);
|
||||||
void SetRxrUDPPort(int port);
|
void SetRxrUDPPort(int port);
|
||||||
void SetRxrUDPIP();
|
void SetRxrUDPIP();
|
||||||
void SetRxrUDPMAC();
|
void SetRxrUDPMAC();
|
||||||
void SetRxrZMQPort(int port);
|
void SetRxrZMQPort(int port);
|
||||||
void SetRxrZMQIP();
|
void SetRxrZMQIP();
|
||||||
void GetROI();
|
void GetROI();
|
||||||
void ClearROI();
|
void ClearROI();
|
||||||
void SetROI();
|
void SetROI();
|
||||||
void SetAllTrimbits();
|
void SetAllTrimbits();
|
||||||
void SetNumStoragecells(int value);
|
void SetNumStoragecells(int value);
|
||||||
void SetSubExposureTime();
|
void SetSubExposureTime();
|
||||||
void SetSubDeadTime();
|
void SetSubDeadTime();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetupWidgetWindow();
|
void SetupWidgetWindow();
|
||||||
void Initialization();
|
void Initialization();
|
||||||
void PopulateDetectors();
|
void PopulateDetectors();
|
||||||
|
|
||||||
void GetControlPort();
|
void GetControlPort();
|
||||||
void GetStopPort();
|
void GetStopPort();
|
||||||
void GetDetectorUDPIP();
|
void GetDetectorUDPIP();
|
||||||
void GetDetectorUDPMAC();
|
void GetDetectorUDPMAC();
|
||||||
void GetCltZMQPort();
|
void GetCltZMQPort();
|
||||||
void GetCltZMQIP();
|
void GetCltZMQIP();
|
||||||
void GetRxrHostname();
|
void GetRxrHostname();
|
||||||
void GetRxrTCPPort();
|
void GetRxrTCPPort();
|
||||||
void GetRxrUDPPort();
|
void GetRxrUDPPort();
|
||||||
void GetRxrUDPIP();
|
void GetRxrUDPIP();
|
||||||
void GetRxrUDPMAC();
|
void GetRxrUDPMAC();
|
||||||
void GetRxrZMQPort();
|
void GetRxrZMQPort();
|
||||||
void GetRxrZMQIP();
|
void GetRxrZMQIP();
|
||||||
void GetAllTrimbits();
|
void GetAllTrimbits();
|
||||||
void GetNumStoragecells();
|
void GetNumStoragecells();
|
||||||
void GetSubExposureTime();
|
void GetSubExposureTime();
|
||||||
void GetSubDeadTime();
|
void GetSubDeadTime();
|
||||||
|
|
||||||
sls::Detector *det;
|
sls::Detector *det;
|
||||||
qDrawPlot *plot;
|
qDrawPlot *plot;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
74
slsDetectorGui/include/qTabDataOutput.h
Executable file → Normal file
74
slsDetectorGui/include/qTabDataOutput.h
Executable file → Normal file
@ -4,47 +4,43 @@
|
|||||||
|
|
||||||
#include "Detector.h"
|
#include "Detector.h"
|
||||||
|
|
||||||
class qTabDataOutput:public QWidget, private Ui::TabDataOutputObject{
|
class qTabDataOutput : public QWidget, private Ui::TabDataOutputObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qTabDataOutput(QWidget *parent, sls::Detector* detector);
|
qTabDataOutput(QWidget *parent, sls::Detector *detector);
|
||||||
~qTabDataOutput();
|
~qTabDataOutput();
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void GetOutputDir();
|
void GetOutputDir();
|
||||||
void BrowseOutputDir();
|
void BrowseOutputDir();
|
||||||
void SetOutputDir();
|
void SetOutputDir();
|
||||||
void SetFileFormat(int format);
|
void SetFileFormat(int format);
|
||||||
void SetOverwriteEnable(bool enable);
|
void SetOverwriteEnable(bool enable);
|
||||||
void SetTenGigaEnable(bool enable);
|
void SetTenGigaEnable(bool enable);
|
||||||
void EnableRateCorrection();
|
void EnableRateCorrection();
|
||||||
void SetRateCorrection();
|
void SetRateCorrection();
|
||||||
void SetSpeed(int speed);
|
void SetSpeed(int speed);
|
||||||
void SetFlags();
|
void SetFlags();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetupWidgetWindow();
|
void SetupWidgetWindow();
|
||||||
void Initialization();
|
void Initialization();
|
||||||
void PopulateDetectors();
|
void PopulateDetectors();
|
||||||
void EnableBrowse();
|
void EnableBrowse();
|
||||||
void GetFileWrite();
|
void GetFileWrite();
|
||||||
void GetFileName();
|
void GetFileName();
|
||||||
void GetFileFormat();
|
void GetFileFormat();
|
||||||
void GetFileOverwrite();
|
void GetFileOverwrite();
|
||||||
void GetTenGigaEnable();
|
void GetTenGigaEnable();
|
||||||
void GetRateCorrection();
|
void GetRateCorrection();
|
||||||
void GetSpeed();
|
void GetSpeed();
|
||||||
void GetFlags();
|
void GetFlags();
|
||||||
|
|
||||||
sls::Detector *det;
|
sls::Detector *det;
|
||||||
// Button group for radiobuttons for rate
|
// Button group for radiobuttons for rate
|
||||||
QButtonGroup *btnGroupRate;
|
QButtonGroup *btnGroupRate;
|
||||||
// enum for the Eiger Parallel flag
|
// enum for the Eiger Parallel flag
|
||||||
enum {
|
enum { PARALLEL, NONPARALLEL };
|
||||||
PARALLEL,
|
|
||||||
NONPARALLEL
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
43
slsDetectorGui/include/qTabDebugging.h
Executable file → Normal file
43
slsDetectorGui/include/qTabDebugging.h
Executable file → Normal file
@ -7,30 +7,29 @@
|
|||||||
class QTreeWidget;
|
class QTreeWidget;
|
||||||
class QTreeWidgetItem;
|
class QTreeWidgetItem;
|
||||||
|
|
||||||
class qTabDebugging:public QWidget, private Ui::TabDebuggingObject{
|
class qTabDebugging : public QWidget, private Ui::TabDebuggingObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qTabDebugging(QWidget *parent, sls::Detector* detector);
|
qTabDebugging(QWidget *parent, sls::Detector *detector);
|
||||||
~qTabDebugging();
|
~qTabDebugging();
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void GetDetectorStatus();
|
void GetDetectorStatus();
|
||||||
void GetInfo();
|
void GetInfo();
|
||||||
void SetParameters(QTreeWidgetItem *item);
|
void SetParameters(QTreeWidgetItem *item);
|
||||||
void TestDetector();
|
void TestDetector();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetupWidgetWindow();
|
void SetupWidgetWindow();
|
||||||
void Initialization();
|
void Initialization();
|
||||||
void PopulateDetectors();
|
void PopulateDetectors();
|
||||||
|
|
||||||
sls::Detector *det;
|
sls::Detector *det;
|
||||||
/** Tree Widget displaying the detectors, modules */
|
/** Tree Widget displaying the detectors, modules */
|
||||||
QTreeWidget *treeDet;
|
QTreeWidget *treeDet;
|
||||||
QLabel *lblDetectorHostname;
|
QLabel *lblDetectorHostname;
|
||||||
QLabel *lblDetectorFirmware;
|
QLabel *lblDetectorFirmware;
|
||||||
QLabel *lblDetectorSoftware;
|
QLabel *lblDetectorSoftware;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
56
slsDetectorGui/include/qTabDeveloper.h
Executable file → Normal file
56
slsDetectorGui/include/qTabDeveloper.h
Executable file → Normal file
@ -9,41 +9,33 @@ class qDacWidget;
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class qTabDeveloper:public QWidget, private Ui::TabDeveloperObject {
|
class qTabDeveloper : public QWidget, private Ui::TabDeveloperObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qTabDeveloper(QWidget *parent, sls::Detector* detector);
|
qTabDeveloper(QWidget *parent, sls::Detector *detector);
|
||||||
~qTabDeveloper();
|
~qTabDeveloper();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void SetHighVoltage();
|
void SetHighVoltage();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetupWidgetWindow();
|
void SetupWidgetWindow();
|
||||||
void Initialization();
|
void Initialization();
|
||||||
void PopulateDetectors();
|
void PopulateDetectors();
|
||||||
void GetHighVoltage();
|
void GetHighVoltage();
|
||||||
slsDetectorDefs::dacIndex getSLSIndex(slsDetectorDefs::detectorType detType, int index);
|
slsDetectorDefs::dacIndex getSLSIndex(slsDetectorDefs::detectorType detType,
|
||||||
|
int index);
|
||||||
|
|
||||||
sls::Detector *det;
|
sls::Detector *det;
|
||||||
std::vector<qDacWidget*> dacWidgets;
|
std::vector<qDacWidget *> dacWidgets;
|
||||||
std::vector<qDacWidget*> adcWidgets;
|
std::vector<qDacWidget *> adcWidgets;
|
||||||
|
|
||||||
enum hvVals {
|
enum hvVals { HV_0, HV_90, HV_110, HV_120, HV_150, HV_180, HV_200 };
|
||||||
HV_0,
|
int hvmin;
|
||||||
HV_90,
|
static const int HV_MIN = 60;
|
||||||
HV_110,
|
static const int HV_MAX = 200;
|
||||||
HV_120,
|
|
||||||
HV_150,
|
|
||||||
HV_180,
|
|
||||||
HV_200
|
|
||||||
};
|
|
||||||
int hvmin;
|
|
||||||
static const int HV_MIN = 60;
|
|
||||||
static const int HV_MAX = 200;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
153
slsDetectorGui/include/qTabMeasurement.h
Executable file → Normal file
153
slsDetectorGui/include/qTabMeasurement.h
Executable file → Normal file
@ -8,92 +8,87 @@ class qDrawPlot;
|
|||||||
|
|
||||||
class QStandardItemModel;
|
class QStandardItemModel;
|
||||||
|
|
||||||
class qTabMeasurement:public QWidget, private Ui::TabMeasurementObject{
|
class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qTabMeasurement(QWidget *parent, sls::Detector* detector, qDrawPlot* p);
|
qTabMeasurement(QWidget *parent, sls::Detector *detector, qDrawPlot *p);
|
||||||
~qTabMeasurement();
|
~qTabMeasurement();
|
||||||
|
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void AcquireFinished();
|
void AcquireFinished();
|
||||||
void AbortAcquire();
|
void AbortAcquire();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void SetTimingMode(int val);
|
void SetTimingMode(int val);
|
||||||
void SetNumMeasurements(int val);
|
void SetNumMeasurements(int val);
|
||||||
void SetNumFrames(int val);
|
void SetNumFrames(int val);
|
||||||
void SetNumTriggers(int val);
|
void SetNumTriggers(int val);
|
||||||
void SetNumBursts(int val);
|
void SetNumBursts(int val);
|
||||||
void SetNumSamples(int val);
|
void SetNumSamples(int val);
|
||||||
void SetExposureTime();
|
void SetExposureTime();
|
||||||
void SetAcquisitionPeriod();
|
void SetAcquisitionPeriod();
|
||||||
void SetDelay();
|
void SetDelay();
|
||||||
void SetBurstPeriod();
|
void SetBurstPeriod();
|
||||||
void SetFileWrite(bool val);
|
void SetFileWrite(bool val);
|
||||||
void SetFileName();
|
void SetFileName();
|
||||||
void SetRunIndex(int val);
|
void SetRunIndex(int val);
|
||||||
void SetStartingFrameNumber(int val);
|
void SetStartingFrameNumber(int val);
|
||||||
void UpdateProgress();
|
void UpdateProgress();
|
||||||
void StartAcquisition();
|
void StartAcquisition();
|
||||||
void StopAcquisition();
|
void StopAcquisition();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetupWidgetWindow();
|
void SetupWidgetWindow();
|
||||||
void Initialization();
|
void Initialization();
|
||||||
/** default, show trigger and delay,
|
/** default, show trigger and delay,
|
||||||
* otherwise for gotthard2 in auto timing mode and burst mode,
|
* otherwise for gotthard2 in auto timing mode and burst mode,
|
||||||
* show bursts and burst period
|
* show bursts and burst period
|
||||||
*/
|
*/
|
||||||
void ShowTriggerDelay();
|
void ShowTriggerDelay();
|
||||||
void SetupTimingMode();
|
void SetupTimingMode();
|
||||||
void EnableWidgetsforTimingMode();
|
void EnableWidgetsforTimingMode();
|
||||||
|
|
||||||
void GetTimingMode();
|
void GetTimingMode();
|
||||||
void GetNumFrames();
|
void GetNumFrames();
|
||||||
void GetNumTriggers();
|
void GetNumTriggers();
|
||||||
void GetNumBursts();
|
void GetNumBursts();
|
||||||
void GetNumSamples();
|
void GetNumSamples();
|
||||||
void GetExposureTime();
|
void GetExposureTime();
|
||||||
void GetAcquisitionPeriod();
|
void GetAcquisitionPeriod();
|
||||||
void CheckAcqPeriodGreaterThanExp();
|
void CheckAcqPeriodGreaterThanExp();
|
||||||
void GetDelay();
|
void GetDelay();
|
||||||
void GetBurstPeriod();
|
void GetBurstPeriod();
|
||||||
void GetFileWrite();
|
void GetFileWrite();
|
||||||
void GetFileName();
|
void GetFileName();
|
||||||
void GetRunIndex();
|
void GetRunIndex();
|
||||||
void GetStartingFrameNumber();
|
void GetStartingFrameNumber();
|
||||||
|
|
||||||
void ResetProgress();
|
void ResetProgress();
|
||||||
|
|
||||||
void Enable(bool enable);
|
void Enable(bool enable);
|
||||||
int VerifyOutputDirectoryError();
|
int VerifyOutputDirectoryError();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void EnableTabsSignal(bool);
|
void EnableTabsSignal(bool);
|
||||||
void FileNameChangedSignal(QString);
|
void FileNameChangedSignal(QString);
|
||||||
private:
|
|
||||||
sls::Detector *det;
|
private:
|
||||||
qDrawPlot *plot;
|
sls::Detector *det;
|
||||||
// enum for the timing mode
|
qDrawPlot *plot;
|
||||||
enum{
|
// enum for the timing mode
|
||||||
AUTO,
|
enum { AUTO, TRIGGER, GATED, BURST_TRIGGER, NUMTIMINGMODES };
|
||||||
TRIGGER,
|
QTimer *progressTimer;
|
||||||
GATED,
|
// tool tip variables
|
||||||
BURST_TRIGGER,
|
QString acqPeriodTip;
|
||||||
NUMTIMINGMODES
|
QString errPeriodTip;
|
||||||
};
|
QPalette red;
|
||||||
QTimer *progressTimer;
|
bool delayImplemented;
|
||||||
//tool tip variables
|
bool sampleImplemented;
|
||||||
QString acqPeriodTip;
|
bool startingFnumImplemented;
|
||||||
QString errPeriodTip;
|
bool isAcquisitionStopped{false};
|
||||||
QPalette red;
|
int numMeasurements{1};
|
||||||
bool delayImplemented;
|
int currentMeasurement{0};
|
||||||
bool sampleImplemented;
|
|
||||||
bool startingFnumImplemented;
|
|
||||||
bool isAcquisitionStopped{false};
|
|
||||||
int numMeasurements{1};
|
|
||||||
int currentMeasurement{0};
|
|
||||||
};
|
};
|
||||||
|
45
slsDetectorGui/include/qTabMessages.h
Executable file → Normal file
45
slsDetectorGui/include/qTabMessages.h
Executable file → Normal file
@ -5,32 +5,31 @@
|
|||||||
class QProcess;
|
class QProcess;
|
||||||
class QKeyEvent;
|
class QKeyEvent;
|
||||||
|
|
||||||
class qTabMessages:public QWidget, private Ui::TabMessagesObject {
|
class qTabMessages : public QWidget, private Ui::TabMessagesObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qTabMessages(QWidget* parent);
|
qTabMessages(QWidget *parent);
|
||||||
~qTabMessages();
|
~qTabMessages();
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void keyPressEvent(QKeyEvent* event);
|
void keyPressEvent(QKeyEvent *event);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ExecuteCommand();
|
void ExecuteCommand();
|
||||||
void SaveLog();
|
void SaveLog();
|
||||||
void ClearLog();
|
void ClearLog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetupWidgetWindow();
|
void SetupWidgetWindow();
|
||||||
void Initialization();
|
void Initialization();
|
||||||
void PrintNextLine();
|
void PrintNextLine();
|
||||||
void GetLastCommand();
|
void GetLastCommand();
|
||||||
void ClearCommand();
|
void ClearCommand();
|
||||||
void AppendOutput();
|
void AppendOutput();
|
||||||
void AppendError();
|
void AppendError();
|
||||||
|
|
||||||
QProcess* process;
|
QProcess *process;
|
||||||
QStringList lastCommand;
|
QStringList lastCommand;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
88
slsDetectorGui/include/qTabPlot.h
Executable file → Normal file
88
slsDetectorGui/include/qTabPlot.h
Executable file → Normal file
@ -8,56 +8,54 @@ class qDrawPlot;
|
|||||||
|
|
||||||
class QButtonGroup;
|
class QButtonGroup;
|
||||||
|
|
||||||
class qTabPlot:public QWidget, private Ui::TabPlotObject{
|
class qTabPlot : public QWidget, private Ui::TabPlotObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qTabPlot(QWidget *parent, sls::Detector* detector, qDrawPlot* p);
|
qTabPlot(QWidget *parent, sls::Detector *detector, qDrawPlot *p);
|
||||||
~qTabPlot();
|
~qTabPlot();
|
||||||
void SetScanArgument();
|
void SetScanArgument();
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void SetPlot();
|
void SetPlot();
|
||||||
void Set1DPlotOptionsRight();
|
void Set1DPlotOptionsRight();
|
||||||
void Set1DPlotOptionsLeft();
|
void Set1DPlotOptionsLeft();
|
||||||
void Set2DPlotOptionsRight();
|
void Set2DPlotOptionsRight();
|
||||||
void Set2DPlotOptionsLeft();
|
void Set2DPlotOptionsLeft();
|
||||||
void EnablePersistency(bool enable);
|
void EnablePersistency(bool enable);
|
||||||
void SetBinary();
|
void SetBinary();
|
||||||
void SetGapPixels(bool enable);
|
void SetGapPixels(bool enable);
|
||||||
void SetTitles();
|
void SetTitles();
|
||||||
void SetXRange();
|
void SetXRange();
|
||||||
void SetYRange();
|
void SetYRange();
|
||||||
void CheckAspectRatio();
|
void CheckAspectRatio();
|
||||||
void SetZRange();
|
void SetZRange();
|
||||||
void SetStreamingFrequency();
|
void SetStreamingFrequency();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void DisableZoomSignal(bool);
|
void DisableZoomSignal(bool);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetupWidgetWindow();
|
void SetupWidgetWindow();
|
||||||
void Initialization();
|
void Initialization();
|
||||||
void Select1DPlot(bool enable);
|
void Select1DPlot(bool enable);
|
||||||
void GetGapPixels();
|
void GetGapPixels();
|
||||||
void GetStreamingFrequency();
|
void GetStreamingFrequency();
|
||||||
void SetXYRange();
|
void SetXYRange();
|
||||||
void MaintainAspectRatio(int dimension);
|
void MaintainAspectRatio(int dimension);
|
||||||
|
|
||||||
sls::Detector *det;
|
sls::Detector *det;
|
||||||
qDrawPlot *plot;
|
qDrawPlot *plot;
|
||||||
bool is1d;
|
bool is1d;
|
||||||
|
|
||||||
QButtonGroup *btnGroupPlotType{nullptr};
|
QButtonGroup *btnGroupPlotType{nullptr};
|
||||||
|
|
||||||
/** default plot and axis titles */
|
/** default plot and axis titles */
|
||||||
static QString defaultPlotTitle;
|
static QString defaultPlotTitle;
|
||||||
static QString defaultHistXAxisTitle;
|
static QString defaultHistXAxisTitle;
|
||||||
static QString defaultHistYAxisTitle;
|
static QString defaultHistYAxisTitle;
|
||||||
static QString defaultImageXAxisTitle;
|
static QString defaultImageXAxisTitle;
|
||||||
static QString defaultImageYAxisTitle;
|
static QString defaultImageYAxisTitle;
|
||||||
static QString defaultImageZAxisTitle;
|
static QString defaultImageZAxisTitle;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
81
slsDetectorGui/include/qTabSettings.h
Executable file → Normal file
81
slsDetectorGui/include/qTabSettings.h
Executable file → Normal file
@ -4,43 +4,43 @@
|
|||||||
|
|
||||||
#include "Detector.h"
|
#include "Detector.h"
|
||||||
|
|
||||||
class qTabSettings: public QWidget, private Ui::TabSettingsObject{
|
class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qTabSettings(QWidget *parent, sls::Detector* detector);
|
qTabSettings(QWidget *parent, sls::Detector *detector);
|
||||||
~qTabSettings();
|
~qTabSettings();
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void SetSettings(int index);
|
void SetSettings(int index);
|
||||||
void SetDynamicRange(int index);
|
void SetDynamicRange(int index);
|
||||||
void SetThresholdEnergy(int index);
|
void SetThresholdEnergy(int index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetupWidgetWindow();
|
void SetupWidgetWindow();
|
||||||
void SetupDetectorSettings();
|
void SetupDetectorSettings();
|
||||||
void Initialization();
|
void Initialization();
|
||||||
|
|
||||||
void GetSettings();
|
void GetSettings();
|
||||||
void GetDynamicRange();
|
void GetDynamicRange();
|
||||||
void GetThresholdEnergy();
|
void GetThresholdEnergy();
|
||||||
|
|
||||||
sls::Detector *det;
|
sls::Detector *det;
|
||||||
enum {
|
enum {
|
||||||
STANDARD,
|
STANDARD,
|
||||||
FAST,
|
FAST,
|
||||||
HIGHGAIN,
|
HIGHGAIN,
|
||||||
DYNAMICGAIN,
|
DYNAMICGAIN,
|
||||||
LOWGAIN,
|
LOWGAIN,
|
||||||
MEDIUMGAIN,
|
MEDIUMGAIN,
|
||||||
VERYHIGHGAIN,
|
VERYHIGHGAIN,
|
||||||
DYNAMICHG0,
|
DYNAMICHG0,
|
||||||
FIXGAIN1,
|
FIXGAIN1,
|
||||||
FIXGAIN2,
|
FIXGAIN2,
|
||||||
FORCESWITCHG1,
|
FORCESWITCHG1,
|
||||||
FORCESWITCHG2,
|
FORCESWITCHG2,
|
||||||
VERLOWGAIN,
|
VERLOWGAIN,
|
||||||
G1_HIGHGAIN,
|
G1_HIGHGAIN,
|
||||||
G1_LOWGAIN,
|
G1_LOWGAIN,
|
||||||
G2_HIGHCAP_HIGHGAIN,
|
G2_HIGHCAP_HIGHGAIN,
|
||||||
@ -48,15 +48,10 @@ private:
|
|||||||
G2_LOWCAP_HIGHGAIN,
|
G2_LOWCAP_HIGHGAIN,
|
||||||
G2_LOWCAP_LOWGAIN,
|
G2_LOWCAP_LOWGAIN,
|
||||||
G4_HIGHGAIN,
|
G4_HIGHGAIN,
|
||||||
G4_LOWGAIN,
|
G4_LOWGAIN,
|
||||||
UNDEFINED,
|
UNDEFINED,
|
||||||
UNINITIALIZED,
|
UNINITIALIZED,
|
||||||
NUMSETTINGS
|
NUMSETTINGS
|
||||||
};
|
};
|
||||||
enum {
|
enum { DYNAMICRANGE_32, DYNAMICRANGE_16, DYNAMICRANGE_8, DYNAMICRANGE_4 };
|
||||||
DYNAMICRANGE_32,
|
|
||||||
DYNAMICRANGE_16,
|
|
||||||
DYNAMICRANGE_8,
|
|
||||||
DYNAMICRANGE_4
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
258
slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h
Executable file → Normal file
258
slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h
Executable file → Normal file
@ -3,181 +3,179 @@
|
|||||||
* @author Ian Johnson
|
* @author Ian Johnson
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* Modifications:
|
* Modifications:
|
||||||
* 19.06.2012: {Some functions have been added by Dhanya to enable zooming in and out
|
* 19.06.2012: {Some functions have been added by Dhanya to enable zooming in
|
||||||
* without using mouse control:
|
* and out without using mouse control: DisableZoom, SetXMinMax,SetYMinMax,
|
||||||
* DisableZoom,
|
|
||||||
* SetXMinMax,SetYMinMax,
|
|
||||||
* GetXMinimum,GetXMaximum,GetYMinimum,GetYMaximum}
|
* GetXMinimum,GetXMaximum,GetYMinimum,GetYMaximum}
|
||||||
* */
|
* */
|
||||||
|
|
||||||
#ifndef SLSQT1DPLOT_H
|
#ifndef SLSQT1DPLOT_H
|
||||||
#define SLSQT1DPLOT_H
|
#define SLSQT1DPLOT_H
|
||||||
|
|
||||||
|
typedef double double32_t;
|
||||||
typedef double double32_t;
|
typedef float float32_t;
|
||||||
typedef float float32_t;
|
typedef int int32_t;
|
||||||
typedef int int32_t;
|
|
||||||
|
|
||||||
#include "ansi.h"
|
#include "ansi.h"
|
||||||
|
|
||||||
|
#include "SlsQt1DZoomer.h"
|
||||||
|
#include <iostream>
|
||||||
#include <qwt_plot.h>
|
#include <qwt_plot.h>
|
||||||
#include <qwt_plot_curve.h>
|
#include <qwt_plot_curve.h>
|
||||||
#include <qwt_plot_marker.h>
|
#include <qwt_plot_marker.h>
|
||||||
#include <qwt_scale_div.h>
|
#include <qwt_scale_div.h>
|
||||||
#include "SlsQt1DZoomer.h"
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
|
|
||||||
class QPen;
|
class QPen;
|
||||||
class SlsQt1DPlot;
|
class SlsQt1DPlot;
|
||||||
class QwtSymbol;
|
class QwtSymbol;
|
||||||
|
|
||||||
class SlsQtH1D:public QwtPlotCurve{
|
class SlsQtH1D : public QwtPlotCurve {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SlsQtH1D(QString title, int n, double xmin, double xmax, double* data=0);
|
SlsQtH1D(QString title, int n, double xmin, double xmax, double *data = 0);
|
||||||
SlsQtH1D(QString title, int n, double* data_x, double* data_y);
|
SlsQtH1D(QString title, int n, double *data_x, double *data_y);
|
||||||
~SlsQtH1D();
|
~SlsQtH1D();
|
||||||
|
|
||||||
void Attach(SlsQt1DPlot* p);
|
void Attach(SlsQt1DPlot *p);
|
||||||
void Detach(SlsQt1DPlot* p);
|
void Detach(SlsQt1DPlot *p);
|
||||||
|
|
||||||
int SetLineColor(int c=-1);
|
int SetLineColor(int c = -1);
|
||||||
int SetLineWidth(int w=1);
|
int SetLineWidth(int w = 1);
|
||||||
void SetLineStyle(int s=0);
|
void SetLineStyle(int s = 0);
|
||||||
void setStyleLinesorDots(bool isLines);
|
void setStyleLinesorDots(bool isLines);
|
||||||
void setSymbolMarkers(bool isMarker);
|
void setSymbolMarkers(bool isMarker);
|
||||||
|
|
||||||
void SetData(int n, double xmin, double xmax, double* d=0);
|
void SetData(int n, double xmin, double xmax, double *d = 0);
|
||||||
void SetData(int n, double* dx, double* dy);
|
void SetData(int n, double *dx, double *dy);
|
||||||
|
|
||||||
double* GetX() {return x;}
|
double *GetX() { return x; }
|
||||||
double* GetY() {return y;}
|
double *GetY() { return y; }
|
||||||
int GetNBinsX() {return ndata;}
|
int GetNBinsX() { return ndata; }
|
||||||
|
|
||||||
double FillBin(int bx, double v=1);
|
double FillBin(int bx, double v = 1);
|
||||||
double Fill(double x, double v=1);
|
double Fill(double x, double v = 1);
|
||||||
double SetBinContent(int bx,double v);
|
double SetBinContent(int bx, double v);
|
||||||
double SetContent(double x,double v);
|
double SetContent(double x, double v);
|
||||||
int FindBinIndex(double px);
|
int FindBinIndex(double px);
|
||||||
|
|
||||||
double GetXMin() {return x[0];}
|
double GetXMin() { return x[0]; }
|
||||||
double GetFirstXgtZero() {return firstXgt0;}
|
double GetFirstXgtZero() { return firstXgt0; }
|
||||||
double GetXMax() {return x[ndata-1];}
|
double GetXMax() { return x[ndata - 1]; }
|
||||||
double GetYMin() {return ymin;}
|
double GetYMin() { return ymin; }
|
||||||
double GetFirstYgtZero() {return firstYgt0;}
|
double GetFirstYgtZero() { return firstYgt0; }
|
||||||
double GetYMax() {return ymax;}
|
double GetYMax() { return ymax; }
|
||||||
|
|
||||||
SlsQtH1D* Add(double v);
|
SlsQtH1D *Add(double v);
|
||||||
|
|
||||||
|
private:
|
||||||
|
int ndata;
|
||||||
|
int n_array;
|
||||||
|
double dx;
|
||||||
|
double *x{nullptr}, *y{nullptr};
|
||||||
|
double ymin, ymax;
|
||||||
|
double firstXgt0, firstYgt0;
|
||||||
|
void Initailize();
|
||||||
|
int SetUpArrays(int n);
|
||||||
|
int CheckIndex(int bx);
|
||||||
|
|
||||||
|
QPen *pen_ptr{nullptr};
|
||||||
private:
|
|
||||||
int ndata;
|
|
||||||
int n_array;
|
|
||||||
double dx;
|
|
||||||
double *x{nullptr},*y{nullptr};
|
|
||||||
double ymin,ymax;
|
|
||||||
double firstXgt0,firstYgt0;
|
|
||||||
void Initailize();
|
|
||||||
int SetUpArrays(int n);
|
|
||||||
int CheckIndex(int bx);
|
|
||||||
|
|
||||||
QPen* pen_ptr{nullptr};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SlsQtH1DList {
|
||||||
|
public:
|
||||||
|
SlsQtH1DList(SlsQtH1D *hist = 0);
|
||||||
|
~SlsQtH1DList();
|
||||||
|
|
||||||
class SlsQtH1DList{
|
SlsQtH1D *Add(SlsQtH1D *h);
|
||||||
public:
|
void Remove(SlsQtH1D *h);
|
||||||
SlsQtH1DList(SlsQtH1D* hist=0);
|
void Print();
|
||||||
~SlsQtH1DList();
|
|
||||||
|
|
||||||
SlsQtH1D* Add(SlsQtH1D* h);
|
SlsQtH1D *Hist() { return the_hist; } // if no hist returns 0
|
||||||
void Remove(SlsQtH1D* h);
|
SlsQtH1DList *Next() { return the_next; }
|
||||||
void Print();
|
|
||||||
|
|
||||||
SlsQtH1D* Hist() {return the_hist;} //if no hist returns 0
|
private:
|
||||||
SlsQtH1DList* Next() {return the_next;}
|
SlsQtH1DList *the_next;
|
||||||
|
SlsQtH1D *the_hist;
|
||||||
|
|
||||||
private:
|
|
||||||
SlsQtH1DList* the_next;
|
|
||||||
SlsQtH1D* the_hist;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class SlsQt1DPlot:public QwtPlot{
|
class SlsQt1DPlot : public QwtPlot {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SlsQt1DPlot(QWidget* = NULL);
|
SlsQt1DPlot(QWidget * = NULL);
|
||||||
~SlsQt1DPlot();
|
~SlsQt1DPlot();
|
||||||
|
|
||||||
void SetTitle(QString title);
|
|
||||||
void SetXTitle(QString title);
|
|
||||||
void SetYTitle(QString title);
|
|
||||||
void SetTitleFont(const QFont& f);
|
|
||||||
void SetXFont(const QFont& f);
|
|
||||||
void SetYFont(const QFont& f);
|
|
||||||
|
|
||||||
void InsertHLine(double y);
|
|
||||||
void RemoveHLine();
|
|
||||||
void InsertVLine(double v);
|
|
||||||
void RemoveVLine();
|
|
||||||
|
|
||||||
|
void SetTitle(QString title);
|
||||||
|
void SetXTitle(QString title);
|
||||||
|
void SetYTitle(QString title);
|
||||||
|
void SetTitleFont(const QFont &f);
|
||||||
|
void SetXFont(const QFont &f);
|
||||||
|
void SetYFont(const QFont &f);
|
||||||
|
|
||||||
/** This group of functions have been added by Dhanya on 19.06.2012 to be able to
|
void InsertHLine(double y);
|
||||||
use zooming functionality without mouse control*/
|
void RemoveHLine();
|
||||||
void DisableZoom(bool disable);
|
void InsertVLine(double v);
|
||||||
void EnableXAutoScaling() {setAxisAutoScale(QwtPlot::xBottom, true);Update();};
|
void RemoveVLine();
|
||||||
void EnableYAutoScaling() {setAxisAutoScale(QwtPlot::yLeft, true);Update();};
|
|
||||||
void SetYStep (int step) {ystep = step;};
|
|
||||||
void SetXMinMax(double min,double max){setAxisScale(QwtPlot::xBottom,min,max);};
|
|
||||||
void SetYMinMax(double min,double max){setAxisScale(QwtPlot::yLeft,min,max);};
|
|
||||||
double GetXMinimum(){return hist_list->Hist()->GetXMin();};
|
|
||||||
double GetXMaximum(){return hist_list->Hist()->GetXMax();};
|
|
||||||
double GetYMinimum(){return hist_list->Hist()->GetYMin();};
|
|
||||||
double GetYMaximum(){return hist_list->Hist()->GetYMax();};
|
|
||||||
/**---*/
|
|
||||||
|
|
||||||
|
/** This group of functions have been added by Dhanya on 19.06.2012 to be
|
||||||
|
able to use zooming functionality without mouse control*/
|
||||||
|
void DisableZoom(bool disable);
|
||||||
|
void EnableXAutoScaling() {
|
||||||
|
setAxisAutoScale(QwtPlot::xBottom, true);
|
||||||
|
Update();
|
||||||
|
};
|
||||||
|
void EnableYAutoScaling() {
|
||||||
|
setAxisAutoScale(QwtPlot::yLeft, true);
|
||||||
|
Update();
|
||||||
|
};
|
||||||
|
void SetYStep(int step) { ystep = step; };
|
||||||
|
void SetXMinMax(double min, double max) {
|
||||||
|
setAxisScale(QwtPlot::xBottom, min, max);
|
||||||
|
};
|
||||||
|
void SetYMinMax(double min, double max) {
|
||||||
|
setAxisScale(QwtPlot::yLeft, min, max);
|
||||||
|
};
|
||||||
|
double GetXMinimum() { return hist_list->Hist()->GetXMin(); };
|
||||||
|
double GetXMaximum() { return hist_list->Hist()->GetXMax(); };
|
||||||
|
double GetYMinimum() { return hist_list->Hist()->GetYMin(); };
|
||||||
|
double GetYMaximum() { return hist_list->Hist()->GetYMax(); };
|
||||||
|
/**---*/
|
||||||
|
|
||||||
void SetZoom(double xmin,double ymin,double x_width,double y_width);
|
void SetZoom(double xmin, double ymin, double x_width, double y_width);
|
||||||
void SetZoomBase(double xmin,double ymin,double x_width, double y_width){ zoomer->SetZoomBase(xmin,ymin,x_width,y_width);}
|
void SetZoomBase(double xmin, double ymin, double x_width, double y_width) {
|
||||||
|
zoomer->SetZoomBase(xmin, ymin, x_width, y_width);
|
||||||
|
}
|
||||||
|
|
||||||
void alignScales();
|
void alignScales();
|
||||||
|
|
||||||
void SetLogX(bool yes=1);
|
void SetLogX(bool yes = 1);
|
||||||
void SetLogY(bool yes=1);
|
void SetLogY(bool yes = 1);
|
||||||
private:
|
|
||||||
|
|
||||||
SlsQtH1DList* hist_list{nullptr};
|
|
||||||
SlsQt1DZoomer* zoomer{nullptr};
|
|
||||||
QwtPlotPanner* panner{nullptr};
|
|
||||||
|
|
||||||
QwtPlotMarker *hline{nullptr};
|
private:
|
||||||
QwtPlotMarker *vline{nullptr};
|
SlsQtH1DList *hist_list{nullptr};
|
||||||
bool disableZoom{false};
|
SlsQt1DZoomer *zoomer{nullptr};
|
||||||
int ystep{0};
|
QwtPlotPanner *panner{nullptr};
|
||||||
|
|
||||||
void SetupZoom();
|
|
||||||
void UnknownStuff();
|
|
||||||
//void alignScales();
|
|
||||||
|
|
||||||
void CalculateNResetZoomBase();
|
|
||||||
void NewHistogramAttached(SlsQtH1D* h);
|
|
||||||
void HistogramDetached(SlsQtH1D* h);
|
|
||||||
|
|
||||||
void SetLog(int axisId, bool yes);
|
QwtPlotMarker *hline{nullptr};
|
||||||
|
QwtPlotMarker *vline{nullptr};
|
||||||
friend void SlsQtH1D::Attach(SlsQt1DPlot* p);
|
bool disableZoom{false};
|
||||||
friend void SlsQtH1D::Detach(SlsQt1DPlot* p);
|
int ystep{0};
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void UnZoom();
|
|
||||||
void Update();
|
|
||||||
|
|
||||||
|
void SetupZoom();
|
||||||
|
void UnknownStuff();
|
||||||
|
// void alignScales();
|
||||||
|
|
||||||
|
void CalculateNResetZoomBase();
|
||||||
|
void NewHistogramAttached(SlsQtH1D *h);
|
||||||
|
void HistogramDetached(SlsQtH1D *h);
|
||||||
|
|
||||||
|
void SetLog(int axisId, bool yes);
|
||||||
|
|
||||||
|
friend void SlsQtH1D::Attach(SlsQt1DPlot *p);
|
||||||
|
friend void SlsQtH1D::Detach(SlsQt1DPlot *p);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void UnZoom();
|
||||||
|
void Update();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
71
slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h
Executable file → Normal file
71
slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h
Executable file → Normal file
@ -7,54 +7,51 @@
|
|||||||
#ifndef SLSQT1DZOOMER_H
|
#ifndef SLSQT1DZOOMER_H
|
||||||
#define SLSQT1DZOOMER_H
|
#define SLSQT1DZOOMER_H
|
||||||
|
|
||||||
#include <qwt_plot_zoomer.h>
|
|
||||||
#include <qwt_plot_panner.h>
|
|
||||||
#include <qwt_global.h>
|
#include <qwt_global.h>
|
||||||
|
#include <qwt_plot_panner.h>
|
||||||
|
#include <qwt_plot_zoomer.h>
|
||||||
|
|
||||||
class SlsQtH1D;
|
class SlsQtH1D;
|
||||||
|
|
||||||
class SlsQt1DZoomer:public QwtPlotZoomer{
|
class SlsQt1DZoomer : public QwtPlotZoomer {
|
||||||
private:
|
private:
|
||||||
double x0,x1,y0,y1;
|
double x0, x1, y0, y1;
|
||||||
double firstXgt0,firstYgt0;
|
double firstXgt0, firstYgt0;
|
||||||
bool xIsLog,yIsLog;
|
bool xIsLog, yIsLog;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SlsQt1DZoomer(QWidget *canvas):QwtPlotZoomer(canvas){
|
SlsQt1DZoomer(QWidget *canvas) : QwtPlotZoomer(canvas) {
|
||||||
setTrackerMode(AlwaysOn);
|
setTrackerMode(AlwaysOn);
|
||||||
xIsLog=yIsLog=0;
|
xIsLog = yIsLog = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
double x() {return x0;}
|
double x() { return x0; }
|
||||||
double x_firstGreaterThan0() {return firstXgt0;}
|
double x_firstGreaterThan0() { return firstXgt0; }
|
||||||
double w() {return x1-x0;}
|
double w() { return x1 - x0; }
|
||||||
|
|
||||||
double y() {return y0;}
|
double y() { return y0; }
|
||||||
double y_firstGreaterThan0() {return firstYgt0;}
|
double y_firstGreaterThan0() { return firstYgt0; }
|
||||||
double h() {return y1-y0;}
|
double h() { return y1 - y0; }
|
||||||
|
|
||||||
void SetZoomBase(double xmin,double ymin,double x_width, double y_width);
|
void SetZoomBase(double xmin, double ymin, double x_width, double y_width);
|
||||||
void SetZoomBase(SlsQtH1D* h);
|
void SetZoomBase(SlsQtH1D *h);
|
||||||
void ExtendZoomBase(SlsQtH1D* h);
|
void ExtendZoomBase(SlsQtH1D *h);
|
||||||
void ResetZoomBase();
|
void ResetZoomBase();
|
||||||
|
|
||||||
bool IsLogX(){ return xIsLog;}
|
bool IsLogX() { return xIsLog; }
|
||||||
bool IsLogY(){ return yIsLog;}
|
bool IsLogY() { return yIsLog; }
|
||||||
bool SetLogX(bool yes) { return xIsLog=yes;}
|
bool SetLogX(bool yes) { return xIsLog = yes; }
|
||||||
bool SetLogY(bool yes) { return yIsLog=yes;}
|
bool SetLogY(bool yes) { return yIsLog = yes; }
|
||||||
|
|
||||||
|
using QwtPlotPicker::trackerText;
|
||||||
|
virtual QwtText trackerText(const QPoint &pos) const {
|
||||||
using QwtPlotPicker::trackerText;
|
|
||||||
virtual QwtText trackerText(const QPoint &pos) const{
|
|
||||||
|
|
||||||
QColor bg(Qt::white);
|
|
||||||
bg.setAlpha(200);
|
|
||||||
QwtText text = QwtPlotPicker::trackerText(pos);
|
|
||||||
text.setBackgroundBrush( QBrush( bg ));
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
QColor bg(Qt::white);
|
||||||
|
bg.setAlpha(200);
|
||||||
|
QwtText text = QwtPlotPicker::trackerText(pos);
|
||||||
|
text.setBackgroundBrush(QBrush(bg));
|
||||||
|
return text;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
191
slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h
Executable file → Normal file
191
slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h
Executable file → Normal file
@ -4,132 +4,131 @@
|
|||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef SLSQT2DHIST_H
|
#ifndef SLSQT2DHIST_H
|
||||||
#define SLSQT2DHIST_H
|
#define SLSQT2DHIST_H
|
||||||
|
|
||||||
|
|
||||||
#if QT_VERSION >= 0x040000
|
#if QT_VERSION >= 0x040000
|
||||||
#include <qprintdialog.h>
|
#include <qprintdialog.h>
|
||||||
#endif
|
#endif
|
||||||
#include <qwt_color_map.h>
|
#include <qwt_color_map.h>
|
||||||
#include <qwt_plot_spectrogram.h>
|
#include <qwt_plot_spectrogram.h>
|
||||||
#include <qwt_scale_widget.h>
|
|
||||||
#include <qwt_scale_draw.h>
|
#include <qwt_scale_draw.h>
|
||||||
|
#include <qwt_scale_widget.h>
|
||||||
|
|
||||||
|
class SlsQt2DHist : public QwtRasterData {
|
||||||
|
|
||||||
class SlsQt2DHist: public QwtRasterData{
|
private:
|
||||||
|
double x_min, x_max, y_min, y_max;
|
||||||
private:
|
double x_width, y_width;
|
||||||
|
|
||||||
double x_min,x_max,y_min,y_max;
|
int nx, ny, nb;
|
||||||
double x_width,y_width;
|
double *data{nullptr};
|
||||||
|
double z_min, z_mean, z_max;
|
||||||
|
bool z_mean_has_been_calculated;
|
||||||
|
|
||||||
int nx,ny,nb;
|
int nx_array, ny_array;
|
||||||
double *data{nullptr};
|
|
||||||
double z_min,z_mean,z_max;
|
|
||||||
bool z_mean_has_been_calculated;
|
|
||||||
|
|
||||||
int nx_array,ny_array;
|
|
||||||
|
|
||||||
bool interp;
|
bool interp;
|
||||||
|
|
||||||
static double value_between_points(double p1,double v1,double p2,double v2,double p){ //linear extrap
|
static double value_between_points(double p1, double v1, double p2,
|
||||||
return (v2-v1)/(p2-p1)*(p-p1)+v1;
|
double v2, double p) { // linear extrap
|
||||||
}
|
return (v2 - v1) / (p2 - p1) * (p - p1) + v1;
|
||||||
|
}
|
||||||
public:
|
|
||||||
SlsQt2DHist(int nbinsx=10, double xmin=0, double xmax=10, int nbinsy=10, double ymin=0, double ymax=10, double* d=0,double zmin=0,double zmax=-1);
|
|
||||||
virtual ~SlsQt2DHist();
|
|
||||||
|
|
||||||
double GetXMin() {return x_min;}
|
public:
|
||||||
double GetXMax() {return x_max;}
|
SlsQt2DHist(int nbinsx = 10, double xmin = 0, double xmax = 10,
|
||||||
double GetXBinWidth() {return x_width;}
|
int nbinsy = 10, double ymin = 0, double ymax = 10,
|
||||||
double GetYMin() {return y_min;}
|
double *d = 0, double zmin = 0, double zmax = -1);
|
||||||
double GetYMax() {return y_max;}
|
virtual ~SlsQt2DHist();
|
||||||
double GetYBinWidth() {return y_width;}
|
|
||||||
double GetMinimum() {return z_min;}
|
|
||||||
double GetMaximum() {return z_max;}
|
|
||||||
double GetMean();
|
|
||||||
|
|
||||||
int GetNBinsX(){return nx;}
|
double GetXMin() { return x_min; }
|
||||||
int GetNBinsY(){return ny;}
|
double GetXMax() { return x_max; }
|
||||||
double GetBinValue(int bx,int by);
|
double GetXBinWidth() { return x_width; }
|
||||||
int GetBinIndex(int bx,int by);
|
double GetYMin() { return y_min; }
|
||||||
double* GetDataPtr(){return data;}
|
double GetYMax() { return y_max; }
|
||||||
|
double GetYBinWidth() { return y_width; }
|
||||||
|
double GetMinimum() { return z_min; }
|
||||||
|
double GetMaximum() { return z_max; }
|
||||||
|
double GetMean();
|
||||||
|
|
||||||
void Interpolate(bool on=1) {interp=on;}
|
int GetNBinsX() { return nx; }
|
||||||
void SetBinValue(int bx,int by,double v);
|
int GetNBinsY() { return ny; }
|
||||||
void SetData(int nbinsx, double xmin, double xmax, int nbinsy,double ymin, double ymax,double *d,double zmin=0, double zmax=-1);
|
double GetBinValue(int bx, int by);
|
||||||
|
int GetBinIndex(int bx, int by);
|
||||||
double SetMinimumToFirstGreaterThanZero();
|
double *GetDataPtr() { return data; }
|
||||||
void SetMinimum(double zmin) {z_min=zmin;}
|
|
||||||
void SetMaximum(double zmax) {z_max=zmax;}
|
|
||||||
void SetMinMax(double zmin=0,double zmax=-1);
|
|
||||||
|
|
||||||
int FindBinIndex(double x, double y);
|
void Interpolate(bool on = 1) { interp = on; }
|
||||||
|
void SetBinValue(int bx, int by, double v);
|
||||||
|
void SetData(int nbinsx, double xmin, double xmax, int nbinsy, double ymin,
|
||||||
|
double ymax, double *d, double zmin = 0, double zmax = -1);
|
||||||
|
|
||||||
|
double SetMinimumToFirstGreaterThanZero();
|
||||||
|
void SetMinimum(double zmin) { z_min = zmin; }
|
||||||
|
void SetMaximum(double zmax) { z_max = zmax; }
|
||||||
|
void SetMinMax(double zmin = 0, double zmax = -1);
|
||||||
|
|
||||||
|
int FindBinIndex(double x, double y);
|
||||||
|
|
||||||
virtual QwtRasterData *copy() const{
|
virtual QwtRasterData *copy() const {
|
||||||
//this function does not create a new SlsQt2DHistData instance,
|
// this function does not create a new SlsQt2DHistData instance,
|
||||||
//just passes a pointer so that data is common to both the copy and the original instance
|
// just passes a pointer so that data is common to both the copy and the
|
||||||
return (QwtRasterData*) this;
|
// original instance
|
||||||
}
|
return (QwtRasterData *)this;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual QwtInterval range() const { return QwtInterval(z_min, z_max); }
|
||||||
virtual QwtInterval range() const{ return QwtInterval(z_min,z_max);}
|
virtual QwtInterval interval(Qt::Axis axis) const {
|
||||||
virtual QwtInterval interval(Qt::Axis axis) const {
|
switch (axis) {
|
||||||
switch (axis){
|
case Qt::ZAxis:
|
||||||
case Qt::ZAxis:
|
return QwtInterval(z_min, z_max);
|
||||||
return QwtInterval(z_min,z_max);
|
case Qt::XAxis:
|
||||||
case Qt::XAxis:
|
return QwtInterval(x_min, x_max);
|
||||||
return QwtInterval(x_min,x_max);
|
case Qt::YAxis:
|
||||||
case Qt::YAxis:
|
return QwtInterval(y_min, y_max);
|
||||||
return QwtInterval(y_min,y_max);
|
default:
|
||||||
default:
|
return QwtInterval(z_min, z_max);
|
||||||
return QwtInterval(z_min,z_max);
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
|
virtual double value(double x, double y) const {
|
||||||
|
// if(!interp){ //default is box like plot
|
||||||
|
int index =
|
||||||
|
int((x - x_min) / x_width) + int((y - y_min) / y_width) * nx;
|
||||||
|
if (index < 0 || index > nb)
|
||||||
|
index = nb;
|
||||||
|
if (!interp)
|
||||||
|
return data[index];
|
||||||
|
//}
|
||||||
|
|
||||||
|
int x_int = int((x - x_min) / x_width - 0.5);
|
||||||
|
if (x_int < 0)
|
||||||
|
x_int = 0;
|
||||||
|
else if (x_int > nx - 2)
|
||||||
|
x_int = nx - 2;
|
||||||
|
int y_int = int((y - y_min) / y_width - 0.5);
|
||||||
|
if (y_int < 0)
|
||||||
|
y_int = 0;
|
||||||
|
else if (y_int > ny - 2)
|
||||||
|
y_int = ny - 2;
|
||||||
|
|
||||||
|
int b00 = x_int * ny + y_int;
|
||||||
|
int b01 = x_int * ny + y_int + 1;
|
||||||
|
int b10 = (x_int + 1) * ny + y_int;
|
||||||
|
int b11 = (x_int + 1) * ny + y_int + 1;
|
||||||
|
|
||||||
virtual double value(double x, double y) const{
|
// vertical extrap
|
||||||
//if(!interp){ //default is box like plot
|
double y0 = y_min + (y_int + 0.5) * y_width;
|
||||||
int index = int((x-x_min)/x_width) + int((y-y_min)/y_width)*nx;
|
double y1 = y_min + (y_int + 1.5) * y_width;
|
||||||
if(index<0||index>nb) index = nb;
|
double left_v = value_between_points(y0, data[b00], y1, data[b01], y);
|
||||||
if(!interp) return data[index];
|
double right_v = value_between_points(y0, data[b10], y1, data[b11], y);
|
||||||
//}
|
// horazontal extrap
|
||||||
|
|
||||||
|
return 0.5;
|
||||||
int x_int = int((x-x_min)/x_width-0.5);
|
|
||||||
if(x_int<0) x_int = 0; else if(x_int>nx-2) x_int = nx-2;
|
|
||||||
int y_int = int((y-y_min)/y_width-0.5);
|
|
||||||
if(y_int<0) y_int = 0; else if(y_int>ny-2) y_int = ny-2;
|
|
||||||
|
|
||||||
int b00 = x_int*ny + y_int;
|
return value_between_points(x_min + (x_int + 0.5) * x_width, left_v,
|
||||||
int b01 = x_int*ny + y_int+1;
|
x_min + (x_int + 1.5) * x_width, right_v,
|
||||||
int b10 = (x_int+1)*ny + y_int;
|
x);
|
||||||
int b11 = (x_int+1)*ny + y_int+1;
|
}
|
||||||
|
|
||||||
//vertical extrap
|
|
||||||
double y0 = y_min+(y_int+0.5)*y_width;
|
|
||||||
double y1 = y_min+(y_int+1.5)*y_width;
|
|
||||||
double left_v = value_between_points(y0,data[b00],y1,data[b01],y);
|
|
||||||
double right_v = value_between_points(y0,data[b10],y1,data[b11],y);
|
|
||||||
//horazontal extrap
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return 0.5;
|
|
||||||
|
|
||||||
|
|
||||||
return value_between_points(x_min+(x_int+0.5)*x_width,left_v,
|
|
||||||
x_min+(x_int+1.5)*x_width,right_v,x);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
105
slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h
Executable file → Normal file
105
slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h
Executable file → Normal file
@ -1,93 +1,92 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <qwt_plot.h>
|
|
||||||
#include <qlist.h>
|
#include <qlist.h>
|
||||||
|
#include <qwt_plot.h>
|
||||||
#include <qwt_plot_spectrogram.h>
|
#include <qwt_plot_spectrogram.h>
|
||||||
|
|
||||||
#include "SlsQt2DZoomer.h"
|
#include "SlsQt2DHist.h"
|
||||||
#include "SlsQt2DHist.h"
|
#include "SlsQt2DZoomer.h"
|
||||||
|
|
||||||
|
class QwtPlotPanner;
|
||||||
|
class QwtScaleWidget;
|
||||||
|
class QwtLinearColorMap;
|
||||||
|
|
||||||
class QwtPlotPanner;
|
class SlsQt2DPlot : public QwtPlot {
|
||||||
class QwtScaleWidget;
|
|
||||||
class QwtLinearColorMap;
|
|
||||||
|
|
||||||
|
|
||||||
class SlsQt2DPlot: public QwtPlot{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SlsQt2DPlot(QWidget * = NULL);
|
SlsQt2DPlot(QWidget * = NULL);
|
||||||
~SlsQt2DPlot();
|
~SlsQt2DPlot();
|
||||||
void SetTitle(QString title);
|
void SetTitle(QString title);
|
||||||
void SetXTitle(QString title);
|
void SetXTitle(QString title);
|
||||||
void SetYTitle(QString title);
|
void SetYTitle(QString title);
|
||||||
void SetZTitle(QString title);
|
void SetZTitle(QString title);
|
||||||
void SetTitleFont(const QFont& f);
|
void SetTitleFont(const QFont &f);
|
||||||
void SetXFont(const QFont& f);
|
void SetXFont(const QFont &f);
|
||||||
void SetYFont(const QFont& f);
|
void SetYFont(const QFont &f);
|
||||||
void SetZFont(const QFont& f);
|
void SetZFont(const QFont &f);
|
||||||
|
|
||||||
void UnZoom(bool replot=true);
|
void UnZoom(bool replot = true);
|
||||||
void SetZoom(double xmin,double ymin,double x_width,double y_width);
|
void SetZoom(double xmin, double ymin, double x_width, double y_width);
|
||||||
void DisableZoom(bool disable);
|
void DisableZoom(bool disable);
|
||||||
void EnableXAutoScaling() {setAxisAutoScale(QwtPlot::xBottom, true);};
|
void EnableXAutoScaling() { setAxisAutoScale(QwtPlot::xBottom, true); };
|
||||||
void EnableYAutoScaling() {setAxisAutoScale(QwtPlot::yLeft, true);};
|
void EnableYAutoScaling() { setAxisAutoScale(QwtPlot::yLeft, true); };
|
||||||
void SetXMinMax(double min,double max){setAxisScale(QwtPlot::xBottom,min,max);};
|
void SetXMinMax(double min, double max) {
|
||||||
void SetYMinMax(double min,double max){setAxisScale(QwtPlot::yLeft,min,max);};
|
setAxisScale(QwtPlot::xBottom, min, max);
|
||||||
double GetXMinimum(){return hist->GetXMin();};
|
};
|
||||||
double GetXMaximum(){return hist->GetXMax();};
|
void SetYMinMax(double min, double max) {
|
||||||
double GetYMinimum(){return hist->GetYMin();};
|
setAxisScale(QwtPlot::yLeft, min, max);
|
||||||
double GetYMaximum(){return hist->GetYMax();};
|
};
|
||||||
double GetZMinimum(){ return hist->GetMinimum();}
|
double GetXMinimum() { return hist->GetXMin(); };
|
||||||
double GetZMaximum(){ return hist->GetMaximum();}
|
double GetXMaximum() { return hist->GetXMax(); };
|
||||||
void SetZMinMax(double zmin=0,double zmax=-1);
|
double GetYMinimum() { return hist->GetYMin(); };
|
||||||
void SetZMinimumToFirstGreaterThanZero(){hist->SetMinimumToFirstGreaterThanZero();}
|
double GetYMaximum() { return hist->GetYMax(); };
|
||||||
double GetZMean() { return hist->GetMean();}
|
double GetZMinimum() { return hist->GetMinimum(); }
|
||||||
|
double GetZMaximum() { return hist->GetMaximum(); }
|
||||||
|
void SetZMinMax(double zmin = 0, double zmax = -1);
|
||||||
|
void SetZMinimumToFirstGreaterThanZero() {
|
||||||
|
hist->SetMinimumToFirstGreaterThanZero();
|
||||||
|
}
|
||||||
|
double GetZMean() { return hist->GetMean(); }
|
||||||
|
|
||||||
void SetData(int nbinsx, double xmin, double xmax, int nbinsy,double ymin, double ymax,double *d,double zmin=0, double zmax=-1){
|
void SetData(int nbinsx, double xmin, double xmax, int nbinsy, double ymin,
|
||||||
hist->SetData(nbinsx,xmin,xmax,nbinsy,ymin,ymax,d,zmin,zmax);
|
double ymax, double *d, double zmin = 0, double zmax = -1) {
|
||||||
|
hist->SetData(nbinsx, xmin, xmax, nbinsy, ymin, ymax, d, zmin, zmax);
|
||||||
}
|
}
|
||||||
|
|
||||||
double* GetDataPtr() {return hist->GetDataPtr();}
|
double *GetDataPtr() { return hist->GetDataPtr(); }
|
||||||
int GetBinIndex(int bx,int by) {return hist->GetBinIndex(bx,by);}
|
int GetBinIndex(int bx, int by) { return hist->GetBinIndex(bx, by); }
|
||||||
int FindBinIndex(double x,double y) {return hist->FindBinIndex(x,y);}
|
int FindBinIndex(double x, double y) { return hist->FindBinIndex(x, y); }
|
||||||
void SetBinValue(int bx,int by,double v) { hist->SetBinValue(bx,by,v);}
|
void SetBinValue(int bx, int by, double v) { hist->SetBinValue(bx, by, v); }
|
||||||
double GetBinValue(int bx,int by) {return hist->GetBinValue(bx,by);}
|
double GetBinValue(int bx, int by) { return hist->GetBinValue(bx, by); }
|
||||||
void FillTestPlot(int i=0);
|
void FillTestPlot(int i = 0);
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
void SetInterpolate(bool enable);
|
void SetInterpolate(bool enable);
|
||||||
void SetContour(bool enable);
|
void SetContour(bool enable);
|
||||||
void SetLogz(bool enable, bool isMin, bool isMax, double min, double max);
|
void SetLogz(bool enable, bool isMin, bool isMax, double min, double max);
|
||||||
void SetZRange(bool isMin, bool isMax, double min, double max);
|
void SetZRange(bool isMin, bool isMax, double min, double max);
|
||||||
void LogZ(bool on=1);
|
void LogZ(bool on = 1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void showSpectrogram(bool on);
|
void showSpectrogram(bool on);
|
||||||
|
|
||||||
|
private:
|
||||||
private:
|
|
||||||
void SetupZoom();
|
void SetupZoom();
|
||||||
void SetupColorMap();
|
void SetupColorMap();
|
||||||
QwtLinearColorMap* myColourMap(QVector<double> colourStops);
|
QwtLinearColorMap *myColourMap(QVector<double> colourStops);
|
||||||
QwtLinearColorMap* myColourMap(int log=0);
|
QwtLinearColorMap *myColourMap(int log = 0);
|
||||||
|
|
||||||
QwtPlotSpectrogram *d_spectrogram{nullptr};
|
QwtPlotSpectrogram *d_spectrogram{nullptr};
|
||||||
SlsQt2DHist* hist{nullptr};
|
SlsQt2DHist *hist{nullptr};
|
||||||
SlsQt2DZoomer* zoomer{nullptr};
|
SlsQt2DZoomer *zoomer{nullptr};
|
||||||
QwtPlotPanner* panner{nullptr};
|
QwtPlotPanner *panner{nullptr};
|
||||||
QwtScaleWidget *rightAxis{nullptr};
|
QwtScaleWidget *rightAxis{nullptr};
|
||||||
|
|
||||||
QwtLinearColorMap* colorMapLinearScale{nullptr};
|
QwtLinearColorMap *colorMapLinearScale{nullptr};
|
||||||
QwtLinearColorMap* colorMapLogScale{nullptr};
|
QwtLinearColorMap *colorMapLogScale{nullptr};
|
||||||
QList<double> contourLevelsLinear;
|
QList<double> contourLevelsLinear;
|
||||||
QList<double> contourLevelsLog;
|
QList<double> contourLevelsLog;
|
||||||
bool disableZoom{false};
|
bool disableZoom{false};
|
||||||
int isLog;
|
int isLog;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
74
slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h
Executable file → Normal file
74
slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h
Executable file → Normal file
@ -5,60 +5,50 @@
|
|||||||
* Dhanya-05.12.2012- included an additional header
|
* Dhanya-05.12.2012- included an additional header
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef SLSQT2DZOOMER_H
|
#ifndef SLSQT2DZOOMER_H
|
||||||
#define SLSQT2DZOOMER_H
|
#define SLSQT2DZOOMER_H
|
||||||
|
|
||||||
|
/**included by Dhanya on 05.12.2012 to avoid compile time errors with the latest
|
||||||
|
* gcc*/
|
||||||
/**included by Dhanya on 05.12.2012 to avoid compile time errors with the latest gcc*/
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
/**end of Change by Dhanya*/
|
/**end of Change by Dhanya*/
|
||||||
|
|
||||||
#include <qwt_plot_zoomer.h>
|
|
||||||
#include <qwt_plot_panner.h>
|
#include <qwt_plot_panner.h>
|
||||||
|
#include <qwt_plot_zoomer.h>
|
||||||
|
|
||||||
#include "SlsQt2DHist.h"
|
#include "SlsQt2DHist.h"
|
||||||
|
|
||||||
class SlsQt2DZoomer:public QwtPlotZoomer{
|
class SlsQt2DZoomer : public QwtPlotZoomer {
|
||||||
private:
|
private:
|
||||||
SlsQt2DHist* hist;
|
SlsQt2DHist *hist;
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
SlsQt2DZoomer(QWidget *canvas):QwtPlotZoomer(canvas){
|
|
||||||
setTrackerMode(AlwaysOn);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetHist(SlsQt2DHist* h){
|
|
||||||
hist=h;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual QwtText trackerTextF(const QPointF &pos) const{
|
|
||||||
QColor bg(Qt::white);
|
|
||||||
bg.setAlpha(200);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//QwtText text = QwtPlotZoomer::trackerText(pos);
|
|
||||||
|
|
||||||
static QwtText text;
|
|
||||||
if(hist){
|
|
||||||
static char t[200];
|
|
||||||
sprintf(t,"%3.2f, %3.2f, %3.2f",pos.x(),pos.y(),hist->value(pos.x(),pos.y()));
|
|
||||||
text.setText(t);
|
|
||||||
}else {
|
|
||||||
|
|
||||||
QPoint p=pos.toPoint();
|
|
||||||
QwtText text = QwtPlotZoomer::trackerText(p);
|
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
SlsQt2DZoomer(QWidget *canvas) : QwtPlotZoomer(canvas) {
|
||||||
|
setTrackerMode(AlwaysOn);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetHist(SlsQt2DHist *h) { hist = h; }
|
||||||
|
|
||||||
|
virtual QwtText trackerTextF(const QPointF &pos) const {
|
||||||
|
QColor bg(Qt::white);
|
||||||
|
bg.setAlpha(200);
|
||||||
|
|
||||||
|
// QwtText text = QwtPlotZoomer::trackerText(pos);
|
||||||
|
|
||||||
|
static QwtText text;
|
||||||
|
if (hist) {
|
||||||
|
static char t[200];
|
||||||
|
sprintf(t, "%3.2f, %3.2f, %3.2f", pos.x(), pos.y(),
|
||||||
|
hist->value(pos.x(), pos.y()));
|
||||||
|
text.setText(t);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
QPoint p = pos.toPoint();
|
||||||
|
QwtText text = QwtPlotZoomer::trackerText(p);
|
||||||
|
}
|
||||||
|
text.setBackgroundBrush(QBrush(bg));
|
||||||
|
return text;
|
||||||
}
|
}
|
||||||
text.setBackgroundBrush( QBrush( bg ));
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
160
slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx
Executable file → Normal file
160
slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx
Executable file → Normal file
@ -5,6 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SlsQt1DPlot.h"
|
#include "SlsQt1DPlot.h"
|
||||||
|
#include "qwt_symbol.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <qwt_legend.h>
|
#include <qwt_legend.h>
|
||||||
#include <qwt_math.h>
|
#include <qwt_math.h>
|
||||||
@ -14,19 +15,18 @@
|
|||||||
#include <qwt_scale_draw.h>
|
#include <qwt_scale_draw.h>
|
||||||
#include <qwt_scale_engine.h>
|
#include <qwt_scale_engine.h>
|
||||||
#include <qwt_scale_widget.h>
|
#include <qwt_scale_widget.h>
|
||||||
#include "qwt_symbol.h"
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#define QwtLog10ScaleEngine QwtLogScaleEngine // hmm
|
||||||
|
|
||||||
#define QwtLog10ScaleEngine QwtLogScaleEngine //hmm
|
SlsQtH1D::SlsQtH1D(QString title, int n, double min, double max, double *data)
|
||||||
|
: QwtPlotCurve(title), x(nullptr), y(nullptr), pen_ptr(nullptr) {
|
||||||
|
|
||||||
SlsQtH1D::SlsQtH1D(QString title, int n, double min, double max, double *data) : QwtPlotCurve(title), x(nullptr), y(nullptr), pen_ptr(nullptr) {
|
|
||||||
Initailize();
|
Initailize();
|
||||||
SetData(n, min, max, data);
|
SetData(n, min, max, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
SlsQtH1D::SlsQtH1D(QString title, int n, double *data_x, double *data_y) : QwtPlotCurve(title) {
|
SlsQtH1D::SlsQtH1D(QString title, int n, double *data_x, double *data_y)
|
||||||
|
: QwtPlotCurve(title) {
|
||||||
Initailize();
|
Initailize();
|
||||||
SetData(n, data_x, data_y);
|
SetData(n, data_x, data_y);
|
||||||
}
|
}
|
||||||
@ -39,12 +39,12 @@ void SlsQtH1D::Initailize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SlsQtH1D::~SlsQtH1D() {
|
SlsQtH1D::~SlsQtH1D() {
|
||||||
|
|
||||||
delete [] x;
|
delete[] x;
|
||||||
|
|
||||||
delete [] y;
|
delete[] y;
|
||||||
|
|
||||||
delete pen_ptr;
|
delete pen_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQtH1D::Attach(SlsQt1DPlot *p) {
|
void SlsQtH1D::Attach(SlsQt1DPlot *p) {
|
||||||
@ -128,18 +128,17 @@ void SlsQtH1D::SetLineStyle(int s) {
|
|||||||
setPen(*pen_ptr);
|
setPen(*pen_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQtH1D::setStyleLinesorDots(bool isLines) {
|
void SlsQtH1D::setStyleLinesorDots(bool isLines) {
|
||||||
setStyle(isLines ? QwtPlotCurve::Lines : QwtPlotCurve::Dots);
|
setStyle(isLines ? QwtPlotCurve::Lines : QwtPlotCurve::Dots);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQtH1D::setSymbolMarkers(bool isMarker) {
|
void SlsQtH1D::setSymbolMarkers(bool isMarker) {
|
||||||
QwtSymbol* marker = new QwtSymbol();
|
QwtSymbol *marker = new QwtSymbol();
|
||||||
if (isMarker) {
|
if (isMarker) {
|
||||||
marker->setStyle(QwtSymbol::Cross);
|
marker->setStyle(QwtSymbol::Cross);
|
||||||
marker->setSize(5, 5);
|
marker->setSize(5, 5);
|
||||||
}
|
}
|
||||||
setSymbol(marker);
|
setSymbol(marker);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQtH1D::SetData(int n, double xmin, double xmax, double *data) {
|
void SlsQtH1D::SetData(int n, double xmin, double xmax, double *data) {
|
||||||
@ -170,9 +169,7 @@ void SlsQtH1D::SetData(int n, double xmin, double xmax, double *data) {
|
|||||||
firstYgt0 = y[i];
|
firstYgt0 = y[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
setRawSamples(x, y, ndata);
|
setRawSamples(x, y, ndata);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQtH1D::SetData(int n, double *data_x, double *data_y) {
|
void SlsQtH1D::SetData(int n, double *data_x, double *data_y) {
|
||||||
@ -181,7 +178,7 @@ void SlsQtH1D::SetData(int n, double *data_x, double *data_y) {
|
|||||||
n = SetUpArrays(n);
|
n = SetUpArrays(n);
|
||||||
|
|
||||||
ndata = n;
|
ndata = n;
|
||||||
dx = -1; //signifies not regular intervals
|
dx = -1; // signifies not regular intervals
|
||||||
|
|
||||||
ymin = ymax = data_y ? data_y[0] : 0;
|
ymin = ymax = data_y ? data_y[0] : 0;
|
||||||
|
|
||||||
@ -202,18 +199,17 @@ void SlsQtH1D::SetData(int n, double *data_x, double *data_y) {
|
|||||||
firstYgt0 = y[b];
|
firstYgt0 = y[b];
|
||||||
}
|
}
|
||||||
setRawSamples(x, y, ndata);
|
setRawSamples(x, y, ndata);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int SlsQtH1D::SetUpArrays(int n) {
|
int SlsQtH1D::SetUpArrays(int n) {
|
||||||
n = n < 1 ? 1 : n; //overflow bin
|
n = n < 1 ? 1 : n; // overflow bin
|
||||||
|
|
||||||
if (n + 1 > n_array) {
|
if (n + 1 > n_array) {
|
||||||
n_array = n + 1;
|
n_array = n + 1;
|
||||||
|
|
||||||
delete x;
|
delete x;
|
||||||
|
|
||||||
delete y;
|
delete y;
|
||||||
x = new double[n_array];
|
x = new double[n_array];
|
||||||
y = new double[n_array];
|
y = new double[n_array];
|
||||||
}
|
}
|
||||||
@ -225,7 +221,9 @@ double SlsQtH1D::FillBin(int bx, double v) {
|
|||||||
bx = CheckIndex(bx);
|
bx = CheckIndex(bx);
|
||||||
return SetBinContent(bx, y[bx] + v);
|
return SetBinContent(bx, y[bx] + v);
|
||||||
}
|
}
|
||||||
double SlsQtH1D::Fill(double x, double v) { return FillBin(FindBinIndex(x), v); }
|
double SlsQtH1D::Fill(double x, double v) {
|
||||||
|
return FillBin(FindBinIndex(x), v);
|
||||||
|
}
|
||||||
|
|
||||||
double SlsQtH1D::SetBinContent(int bx, double v) {
|
double SlsQtH1D::SetBinContent(int bx, double v) {
|
||||||
bx = CheckIndex(bx);
|
bx = CheckIndex(bx);
|
||||||
@ -241,13 +239,15 @@ double SlsQtH1D::SetBinContent(int bx, double v) {
|
|||||||
return y[bx];
|
return y[bx];
|
||||||
}
|
}
|
||||||
|
|
||||||
double SlsQtH1D::SetContent(double x, double v) { return SetBinContent(FindBinIndex(x), v); }
|
double SlsQtH1D::SetContent(double x, double v) {
|
||||||
|
return SetBinContent(FindBinIndex(x), v);
|
||||||
|
}
|
||||||
|
|
||||||
int SlsQtH1D::FindBinIndex(double px) {
|
int SlsQtH1D::FindBinIndex(double px) {
|
||||||
if (dx > 0)
|
if (dx > 0)
|
||||||
CheckIndex(int((px - x[0]) / dx));
|
CheckIndex(int((px - x[0]) / dx));
|
||||||
|
|
||||||
//find closest bin
|
// find closest bin
|
||||||
int b = 0;
|
int b = 0;
|
||||||
for (; b < ndata; b++)
|
for (; b < ndata; b++)
|
||||||
if (x[b] > px)
|
if (x[b] > px)
|
||||||
@ -261,7 +261,9 @@ int SlsQtH1D::FindBinIndex(double px) {
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SlsQtH1D::CheckIndex(int bx) { return (bx < 0 || bx > ndata) ? ndata : bx; } //ndata is the overflow bin
|
int SlsQtH1D::CheckIndex(int bx) {
|
||||||
|
return (bx < 0 || bx > ndata) ? ndata : bx;
|
||||||
|
} // ndata is the overflow bin
|
||||||
|
|
||||||
SlsQtH1D *SlsQtH1D::Add(double v) {
|
SlsQtH1D *SlsQtH1D::Add(double v) {
|
||||||
for (int bx = 0; bx < ndata; bx++)
|
for (int bx = 0; bx < ndata; bx++)
|
||||||
@ -269,23 +271,20 @@ SlsQtH1D *SlsQtH1D::Add(double v) {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//1d hist list stuff
|
// 1d hist list stuff
|
||||||
SlsQtH1DList::SlsQtH1DList(SlsQtH1D *hist) {
|
SlsQtH1DList::SlsQtH1DList(SlsQtH1D *hist) {
|
||||||
the_hist = hist;
|
the_hist = hist;
|
||||||
the_next = 0;
|
the_next = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SlsQtH1DList::~SlsQtH1DList() {
|
SlsQtH1DList::~SlsQtH1DList() { delete the_next; }
|
||||||
|
|
||||||
delete the_next;
|
|
||||||
}
|
|
||||||
|
|
||||||
SlsQtH1D *SlsQtH1DList::Add(SlsQtH1D *hist) {
|
SlsQtH1D *SlsQtH1DList::Add(SlsQtH1D *hist) {
|
||||||
SlsQtH1DList *hl = this;
|
SlsQtH1DList *hl = this;
|
||||||
|
|
||||||
while (hl) {
|
while (hl) {
|
||||||
if (hist == hl->the_hist)
|
if (hist == hl->the_hist)
|
||||||
return hist; //already added
|
return hist; // already added
|
||||||
if (!hl->the_next)
|
if (!hl->the_next)
|
||||||
break;
|
break;
|
||||||
hl = hl->the_next;
|
hl = hl->the_next;
|
||||||
@ -304,7 +303,8 @@ void SlsQtH1DList::Print() {
|
|||||||
SlsQtH1DList *hl = this;
|
SlsQtH1DList *hl = this;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (hl) {
|
while (hl) {
|
||||||
std::cout << " " << i++ << ") " << hl << " " << hl->the_hist << " " << hl->the_next << '\n';
|
std::cout << " " << i++ << ") " << hl << " " << hl->the_hist << " "
|
||||||
|
<< hl->the_next << '\n';
|
||||||
hl = hl->the_next;
|
hl = hl->the_next;
|
||||||
if (i > 10)
|
if (i > 10)
|
||||||
break;
|
break;
|
||||||
@ -313,10 +313,10 @@ void SlsQtH1DList::Print() {
|
|||||||
|
|
||||||
void SlsQtH1DList::Remove(SlsQtH1D *hist) {
|
void SlsQtH1DList::Remove(SlsQtH1D *hist) {
|
||||||
SlsQtH1DList *hl = this;
|
SlsQtH1DList *hl = this;
|
||||||
while (hl) { //every match will be removed
|
while (hl) { // every match will be removed
|
||||||
if (hl->the_hist != hist)
|
if (hl->the_hist != hist)
|
||||||
hl = hl->the_next;
|
hl = hl->the_next;
|
||||||
else { //match
|
else { // match
|
||||||
if (!hl->the_next)
|
if (!hl->the_next)
|
||||||
hl->the_hist = 0; // first the_hist is zero when there's no next
|
hl->the_hist = 0; // first the_hist is zero when there's no next
|
||||||
else {
|
else {
|
||||||
@ -330,7 +330,7 @@ void SlsQtH1DList::Remove(SlsQtH1D *hist) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//1d plot stuff
|
// 1d plot stuff
|
||||||
SlsQt1DPlot::SlsQt1DPlot(QWidget *parent) : QwtPlot(parent) {
|
SlsQt1DPlot::SlsQt1DPlot(QWidget *parent) : QwtPlot(parent) {
|
||||||
// n_histograms_attached=0;
|
// n_histograms_attached=0;
|
||||||
hline = vline = 0;
|
hline = vline = 0;
|
||||||
@ -352,16 +352,16 @@ SlsQt1DPlot::SlsQt1DPlot(QWidget *parent) : QwtPlot(parent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SlsQt1DPlot::~SlsQt1DPlot() {
|
SlsQt1DPlot::~SlsQt1DPlot() {
|
||||||
|
|
||||||
delete hist_list;
|
delete hist_list;
|
||||||
|
|
||||||
delete hline;
|
delete hline;
|
||||||
|
|
||||||
delete vline;
|
delete vline;
|
||||||
|
|
||||||
delete zoomer;
|
delete zoomer;
|
||||||
|
|
||||||
delete panner;
|
delete panner;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt1DPlot::CalculateNResetZoomBase() {
|
void SlsQt1DPlot::CalculateNResetZoomBase() {
|
||||||
@ -378,8 +378,8 @@ void SlsQt1DPlot::CalculateNResetZoomBase() {
|
|||||||
void SlsQt1DPlot::NewHistogramAttached(SlsQtH1D *h) {
|
void SlsQt1DPlot::NewHistogramAttached(SlsQtH1D *h) {
|
||||||
hist_list->Add(h);
|
hist_list->Add(h);
|
||||||
CalculateNResetZoomBase();
|
CalculateNResetZoomBase();
|
||||||
//commented out by dhanya to take off zooming every hist in 1d plots
|
// commented out by dhanya to take off zooming every hist in 1d plots
|
||||||
//if(!hist_list->Next()) UnZoom();
|
// if(!hist_list->Next()) UnZoom();
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,13 +389,9 @@ void SlsQt1DPlot::HistogramDetached(SlsQtH1D *h) {
|
|||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt1DPlot::Update() {
|
void SlsQt1DPlot::Update() { replot(); }
|
||||||
replot();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SlsQt1DPlot::SetTitle(QString title) {
|
void SlsQt1DPlot::SetTitle(QString title) { setTitle(title); }
|
||||||
setTitle(title);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SlsQt1DPlot::SetXTitle(QString title) {
|
void SlsQt1DPlot::SetXTitle(QString title) {
|
||||||
setAxisTitle(QwtPlot::xBottom, title);
|
setAxisTitle(QwtPlot::xBottom, title);
|
||||||
@ -405,20 +401,20 @@ void SlsQt1DPlot::SetYTitle(QString title) {
|
|||||||
setAxisTitle(QwtPlot::yLeft, title);
|
setAxisTitle(QwtPlot::yLeft, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt1DPlot::SetTitleFont(const QFont& f) {
|
void SlsQt1DPlot::SetTitleFont(const QFont &f) {
|
||||||
QwtText t("");
|
QwtText t("");
|
||||||
t.setFont(f);
|
t.setFont(f);
|
||||||
t.setRenderFlags( Qt::AlignLeft | Qt::AlignVCenter);
|
t.setRenderFlags(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
setTitle(t);
|
setTitle(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt1DPlot::SetXFont(const QFont& f) {
|
void SlsQt1DPlot::SetXFont(const QFont &f) {
|
||||||
QwtText t("");
|
QwtText t("");
|
||||||
t.setFont(f);
|
t.setFont(f);
|
||||||
setAxisTitle(QwtPlot::xBottom, t);
|
setAxisTitle(QwtPlot::xBottom, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt1DPlot::SetYFont(const QFont& f) {
|
void SlsQt1DPlot::SetYFont(const QFont &f) {
|
||||||
QwtText t("");
|
QwtText t("");
|
||||||
t.setFont(f);
|
t.setFont(f);
|
||||||
setAxisTitle(QwtPlot::yLeft, t);
|
setAxisTitle(QwtPlot::yLeft, t);
|
||||||
@ -432,9 +428,10 @@ void SlsQt1DPlot::SetLog(int axisId, bool yes) {
|
|||||||
if (axisId == QwtPlot::yLeft)
|
if (axisId == QwtPlot::yLeft)
|
||||||
zoomer->SetLogY(yes);
|
zoomer->SetLogY(yes);
|
||||||
|
|
||||||
zoomer->ResetZoomBase(); //needs to be done before setting Engine
|
zoomer->ResetZoomBase(); // needs to be done before setting Engine
|
||||||
|
|
||||||
//the old ones are deleted by in the setAxisScaleFunction() function see: 128 of file qwt_plot_axis.cpp
|
// the old ones are deleted by in the setAxisScaleFunction() function see:
|
||||||
|
// 128 of file qwt_plot_axis.cpp
|
||||||
if (yes)
|
if (yes)
|
||||||
setAxisScaleEngine(axisId, new QwtLog10ScaleEngine());
|
setAxisScaleEngine(axisId, new QwtLog10ScaleEngine());
|
||||||
else
|
else
|
||||||
@ -450,11 +447,13 @@ void SlsQt1DPlot::UnZoom() {
|
|||||||
setAxisScale(QwtPlot::xBottom, zoomer->x(), zoomer->x() + zoomer->w());
|
setAxisScale(QwtPlot::xBottom, zoomer->x(), zoomer->x() + zoomer->w());
|
||||||
setAxisScale(QwtPlot::yLeft, zoomer->y(), zoomer->y() + zoomer->h());
|
setAxisScale(QwtPlot::yLeft, zoomer->y(), zoomer->y() + zoomer->h());
|
||||||
|
|
||||||
zoomer->setZoomBase(); //Call replot for the attached plot before initializing the zoomer with its scales.
|
zoomer->setZoomBase(); // Call replot for the attached plot before
|
||||||
|
// initializing the zoomer with its scales.
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt1DPlot::SetZoom(double xmin, double ymin, double x_width, double y_width) {
|
void SlsQt1DPlot::SetZoom(double xmin, double ymin, double x_width,
|
||||||
|
double y_width) {
|
||||||
setAxisScale(QwtPlot::xBottom, xmin, xmin + x_width);
|
setAxisScale(QwtPlot::xBottom, xmin, xmin + x_width);
|
||||||
setAxisScale(QwtPlot::yLeft, ymin, ymin + y_width);
|
setAxisScale(QwtPlot::yLeft, ymin, ymin + y_width);
|
||||||
Update();
|
Update();
|
||||||
@ -503,9 +502,11 @@ void SlsQt1DPlot::SetupZoom() {
|
|||||||
zoomer = new SlsQt1DZoomer(canvas());
|
zoomer = new SlsQt1DZoomer(canvas());
|
||||||
|
|
||||||
#if QT_VERSION < 0x040000
|
#if QT_VERSION < 0x040000
|
||||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlButton);
|
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton,
|
||||||
|
Qt::ControlButton);
|
||||||
#else
|
#else
|
||||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier);
|
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton,
|
||||||
|
Qt::ControlModifier);
|
||||||
#endif
|
#endif
|
||||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton);
|
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton);
|
||||||
|
|
||||||
@ -546,32 +547,39 @@ void SlsQt1DPlot::alignScales() {
|
|||||||
|
|
||||||
void SlsQt1DPlot::UnknownStuff() {
|
void SlsQt1DPlot::UnknownStuff() {
|
||||||
// We don't need the cache here
|
// We don't need the cache here
|
||||||
((QwtPlotCanvas *)canvas())->setPaintAttribute(QwtPlotCanvas::BackingStore, false);
|
((QwtPlotCanvas *)canvas())
|
||||||
|
->setPaintAttribute(QwtPlotCanvas::BackingStore, false);
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
// Qt::WA_PaintOnScreen is only supported for X11, but leads
|
// Qt::WA_PaintOnScreen is only supported for X11, but leads
|
||||||
// to substantial bugs with Qt 4.2.x/Windows
|
// to substantial bugs with Qt 4.2.x/Windows
|
||||||
canvas()->setAttribute(Qt::WA_PaintOnScreen, true);
|
canvas()->setAttribute(Qt::WA_PaintOnScreen, true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Added by Dhanya on 19.06.2012 to disable zooming when any of the axes range has been set
|
// Added by Dhanya on 19.06.2012 to disable zooming when any of the axes range
|
||||||
|
// has been set
|
||||||
void SlsQt1DPlot::DisableZoom(bool disable) {
|
void SlsQt1DPlot::DisableZoom(bool disable) {
|
||||||
if (disableZoom != disable) {
|
if (disableZoom != disable) {
|
||||||
disableZoom = disable;
|
disableZoom = disable;
|
||||||
if (disable) {
|
if (disable) {
|
||||||
if (zoomer) {
|
if (zoomer) {
|
||||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::NoButton);
|
zoomer->setMousePattern(QwtEventPattern::MouseSelect1,
|
||||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::NoButton, Qt::ControlModifier);
|
Qt::NoButton);
|
||||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::NoButton);
|
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
|
||||||
|
Qt::NoButton, Qt::ControlModifier);
|
||||||
|
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
|
||||||
|
Qt::NoButton);
|
||||||
}
|
}
|
||||||
if (panner)
|
if (panner)
|
||||||
panner->setMouseButton(Qt::NoButton);
|
panner->setMouseButton(Qt::NoButton);
|
||||||
} else {
|
} else {
|
||||||
if (zoomer) {
|
if (zoomer) {
|
||||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::LeftButton);
|
zoomer->setMousePattern(QwtEventPattern::MouseSelect1,
|
||||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier);
|
Qt::LeftButton);
|
||||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton);
|
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
|
||||||
|
Qt::RightButton, Qt::ControlModifier);
|
||||||
|
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
|
||||||
|
Qt::RightButton);
|
||||||
}
|
}
|
||||||
if (panner)
|
if (panner)
|
||||||
panner->setMouseButton(Qt::MidButton);
|
panner->setMouseButton(Qt::MidButton);
|
||||||
|
136
slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cxx
Executable file → Normal file
136
slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cxx
Executable file → Normal file
@ -4,7 +4,6 @@
|
|||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <qwt_plot.h>
|
#include <qwt_plot.h>
|
||||||
@ -13,78 +12,89 @@
|
|||||||
#include "SlsQt1DPlot.h"
|
#include "SlsQt1DPlot.h"
|
||||||
#include "SlsQt1DZoomer.h"
|
#include "SlsQt1DZoomer.h"
|
||||||
|
|
||||||
|
void SlsQt1DZoomer::ResetZoomBase() {
|
||||||
void SlsQt1DZoomer::ResetZoomBase(){
|
SetZoomBase(x0, y0, x1 - x0,
|
||||||
SetZoomBase(x0,y0,x1-x0,y1-y0); //for going between log and nonlog plots
|
y1 - y0); // for going between log and nonlog plots
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt1DZoomer::SetZoomBase(double xmin,double ymin,double x_width, double y_width){
|
void SlsQt1DZoomer::SetZoomBase(double xmin, double ymin, double x_width,
|
||||||
if(xIsLog&&xmin<=0){
|
double y_width) {
|
||||||
double xmax = xmin+x_width;
|
if (xIsLog && xmin <= 0) {
|
||||||
xmin = firstXgt0*0.98;
|
double xmax = xmin + x_width;
|
||||||
if(xmax<=xmin) x_width=firstXgt0;
|
xmin = firstXgt0 * 0.98;
|
||||||
else x_width=xmax-xmin;
|
if (xmax <= xmin)
|
||||||
}
|
x_width = firstXgt0;
|
||||||
if(yIsLog&&ymin<=0){
|
else
|
||||||
double ymax = ymin+y_width;
|
x_width = xmax - xmin;
|
||||||
ymin = firstYgt0*0.98;
|
|
||||||
if(ymax<=ymin) y_width=firstYgt0;
|
|
||||||
else y_width=ymax-ymin;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(plot()){
|
|
||||||
if(xIsLog){
|
|
||||||
double xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom).lowerBound();
|
|
||||||
double xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom).upperBound();
|
|
||||||
if(xmin_curr<xmin)
|
|
||||||
xmin_curr=xmin;
|
|
||||||
if(xmax_curr>xmin+x_width)
|
|
||||||
xmax_curr=xmin+x_width;
|
|
||||||
plot()->setAxisScale(QwtPlot::xBottom,xmin_curr,xmax_curr);
|
|
||||||
}
|
}
|
||||||
if(yIsLog){
|
if (yIsLog && ymin <= 0) {
|
||||||
double ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft).lowerBound();
|
double ymax = ymin + y_width;
|
||||||
double ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft).upperBound();
|
ymin = firstYgt0 * 0.98;
|
||||||
if(ymin_curr<ymin)
|
if (ymax <= ymin)
|
||||||
ymin_curr=ymin;
|
y_width = firstYgt0;
|
||||||
if(ymax_curr>ymin+y_width)
|
else
|
||||||
ymax_curr=ymin+y_width;
|
y_width = ymax - ymin;
|
||||||
plot()->setAxisScale(QwtPlot::yLeft,ymin_curr,ymax_curr);
|
|
||||||
}
|
}
|
||||||
plot()->replot();
|
|
||||||
}
|
|
||||||
setZoomBase(QRectF(xmin,ymin,x_width,y_width));
|
|
||||||
|
|
||||||
|
if (plot()) {
|
||||||
|
if (xIsLog) {
|
||||||
|
double xmin_curr =
|
||||||
|
plot()->axisScaleDiv(QwtPlot::xBottom).lowerBound();
|
||||||
|
double xmax_curr =
|
||||||
|
plot()->axisScaleDiv(QwtPlot::xBottom).upperBound();
|
||||||
|
if (xmin_curr < xmin)
|
||||||
|
xmin_curr = xmin;
|
||||||
|
if (xmax_curr > xmin + x_width)
|
||||||
|
xmax_curr = xmin + x_width;
|
||||||
|
plot()->setAxisScale(QwtPlot::xBottom, xmin_curr, xmax_curr);
|
||||||
|
}
|
||||||
|
if (yIsLog) {
|
||||||
|
double ymin_curr =
|
||||||
|
plot()->axisScaleDiv(QwtPlot::yLeft).lowerBound();
|
||||||
|
double ymax_curr =
|
||||||
|
plot()->axisScaleDiv(QwtPlot::yLeft).upperBound();
|
||||||
|
if (ymin_curr < ymin)
|
||||||
|
ymin_curr = ymin;
|
||||||
|
if (ymax_curr > ymin + y_width)
|
||||||
|
ymax_curr = ymin + y_width;
|
||||||
|
plot()->setAxisScale(QwtPlot::yLeft, ymin_curr, ymax_curr);
|
||||||
|
}
|
||||||
|
plot()->replot();
|
||||||
|
}
|
||||||
|
setZoomBase(QRectF(xmin, ymin, x_width, y_width));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt1DZoomer::SetZoomBase(SlsQtH1D* h){
|
void SlsQt1DZoomer::SetZoomBase(SlsQtH1D *h) {
|
||||||
x0 = h->GetXMin()<0 ? h->GetXMin()*1.02 : h->GetXMin()/1.02;
|
x0 = h->GetXMin() < 0 ? h->GetXMin() * 1.02 : h->GetXMin() / 1.02;
|
||||||
x1 = h->GetXMax()<0 ? h->GetXMax()/1.02 : h->GetXMax()*1.02;
|
x1 = h->GetXMax() < 0 ? h->GetXMax() / 1.02 : h->GetXMax() * 1.02;
|
||||||
y0 = h->GetYMin()<0 ? h->GetYMin()*1.02 : h->GetYMin()/1.02;
|
y0 = h->GetYMin() < 0 ? h->GetYMin() * 1.02 : h->GetYMin() / 1.02;
|
||||||
y1 = h->GetYMax()<0 ? h->GetYMax()/1.02 : h->GetYMax()*1.02;
|
y1 = h->GetYMax() < 0 ? h->GetYMax() / 1.02 : h->GetYMax() * 1.02;
|
||||||
|
|
||||||
firstXgt0 = h->GetFirstXgtZero(); //for log plots
|
firstXgt0 = h->GetFirstXgtZero(); // for log plots
|
||||||
firstYgt0 = h->GetFirstYgtZero(); //for log plots
|
firstYgt0 = h->GetFirstYgtZero(); // for log plots
|
||||||
|
|
||||||
ResetZoomBase();
|
ResetZoomBase();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt1DZoomer::ExtendZoomBase(SlsQtH1D* h){
|
void SlsQt1DZoomer::ExtendZoomBase(SlsQtH1D *h) {
|
||||||
double h_x0 = h->GetXMin()<0 ? h->GetXMin()*1.02 : h->GetXMin()/1.02;
|
double h_x0 = h->GetXMin() < 0 ? h->GetXMin() * 1.02 : h->GetXMin() / 1.02;
|
||||||
double h_x1 = h->GetXMax()<0 ? h->GetXMax()/1.02 : h->GetXMax()*1.02;
|
double h_x1 = h->GetXMax() < 0 ? h->GetXMax() / 1.02 : h->GetXMax() * 1.02;
|
||||||
double h_y0 = h->GetYMin()<0 ? h->GetYMin()*1.02 : h->GetYMin()/1.02;
|
double h_y0 = h->GetYMin() < 0 ? h->GetYMin() * 1.02 : h->GetYMin() / 1.02;
|
||||||
double h_y1 = h->GetYMax()<0 ? h->GetYMax()/1.02 : h->GetYMax()*1.02;
|
double h_y1 = h->GetYMax() < 0 ? h->GetYMax() / 1.02 : h->GetYMax() * 1.02;
|
||||||
|
|
||||||
if(h_x0<x0) x0 = h_x0;
|
|
||||||
if(h_x1>x1) x1 = h_x1;
|
|
||||||
if(h_y0<y0) y0 = h_y0;
|
|
||||||
if(h_y1>y1) y1 = h_y1;
|
|
||||||
|
|
||||||
if(h->GetFirstXgtZero()<firstXgt0) firstXgt0 = h->GetFirstXgtZero();
|
if (h_x0 < x0)
|
||||||
if(h->GetFirstYgtZero()<firstYgt0) firstYgt0 = h->GetFirstYgtZero();
|
x0 = h_x0;
|
||||||
|
if (h_x1 > x1)
|
||||||
ResetZoomBase();
|
x1 = h_x1;
|
||||||
|
if (h_y0 < y0)
|
||||||
|
y0 = h_y0;
|
||||||
|
if (h_y1 > y1)
|
||||||
|
y1 = h_y1;
|
||||||
|
|
||||||
|
if (h->GetFirstXgtZero() < firstXgt0)
|
||||||
|
firstXgt0 = h->GetFirstXgtZero();
|
||||||
|
if (h->GetFirstYgtZero() < firstYgt0)
|
||||||
|
firstYgt0 = h->GetFirstYgtZero();
|
||||||
|
|
||||||
|
ResetZoomBase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
232
slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx
Executable file → Normal file
232
slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx
Executable file → Normal file
@ -4,125 +4,145 @@
|
|||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ansi.h"
|
|
||||||
#include <iostream>
|
|
||||||
#include <cmath>
|
|
||||||
#include "SlsQt2DHist.h"
|
#include "SlsQt2DHist.h"
|
||||||
|
#include "ansi.h"
|
||||||
|
#include <cmath>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
|
||||||
SlsQt2DHist::SlsQt2DHist(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double* d,double zmin,double zmax):QwtRasterData(){
|
SlsQt2DHist::SlsQt2DHist(int nbinsx, double xmin, double xmax, int nbinsy,
|
||||||
x_min=0;x_max=0;y_min=0;y_max=0;
|
double ymin, double ymax, double *d, double zmin,
|
||||||
interp=0;
|
double zmax)
|
||||||
nx_array=ny_array=0;data=0;
|
: QwtRasterData() {
|
||||||
SetData(nbinsx,xmin,xmax,nbinsy,ymin,ymax,d,zmin,zmax);
|
x_min = 0;
|
||||||
|
x_max = 0;
|
||||||
|
y_min = 0;
|
||||||
|
y_max = 0;
|
||||||
|
interp = 0;
|
||||||
|
nx_array = ny_array = 0;
|
||||||
|
data = 0;
|
||||||
|
SetData(nbinsx, xmin, xmax, nbinsy, ymin, ymax, d, zmin, zmax);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SlsQt2DHist::~SlsQt2DHist() { delete[] data; }
|
||||||
|
|
||||||
SlsQt2DHist::~SlsQt2DHist(){ delete [] data;}
|
int SlsQt2DHist::GetBinIndex(int bx, int by) {
|
||||||
|
int b = bx * ny + by;
|
||||||
int SlsQt2DHist::GetBinIndex(int bx, int by){
|
if (b < 0 || b >= nb) {
|
||||||
int b = bx*ny+by;
|
cout << "GetBinIndex:: Incorrect indicies bx and by returning overflow "
|
||||||
if(b<0 || b>=nb){
|
"bin;"
|
||||||
cout<<"GetBinIndex:: Incorrect indicies bx and by returning overflow bin;"<<endl;
|
<< endl;
|
||||||
return nb;
|
return nb;
|
||||||
}
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
||||||
int SlsQt2DHist::FindBinIndex(double x, double y){
|
|
||||||
return GetBinIndex(int((x-x_min)/x_width),int((y-y_min)/y_width));
|
|
||||||
}
|
|
||||||
|
|
||||||
double SlsQt2DHist::GetBinValue(int bx,int by){
|
|
||||||
return data[GetBinIndex(bx,by)];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SlsQt2DHist::SetBinValue(int bx,int by,double v){
|
|
||||||
z_mean_has_been_calculated = 0;
|
|
||||||
data[GetBinIndex(bx,by)] = v;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SlsQt2DHist::SetData(int nbinsx, double xmin, double xmax, int nbinsy,double ymin, double ymax, double *d,double zmin,double zmax){
|
|
||||||
z_mean_has_been_calculated = 0;
|
|
||||||
if(xmax<xmin||ymax<ymin) cout<<"Warning input range invalid."<<endl;
|
|
||||||
|
|
||||||
x_width = (xmax - xmin)/nbinsx;
|
|
||||||
y_width = (ymax - ymin)/nbinsy;
|
|
||||||
|
|
||||||
if(x_min!=xmin||x_max!=xmax||y_min!=ymin||y_max!=ymax){
|
|
||||||
x_min=xmin;x_max=xmax;
|
|
||||||
y_min=ymin;y_max=ymax;
|
|
||||||
setInterval( Qt::XAxis,QwtInterval(xmin,xmax));
|
|
||||||
setInterval( Qt::YAxis,QwtInterval(ymin,ymax));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(nbinsx*nbinsy<1){
|
|
||||||
cout<<"Exitting: SlsQt2DHist::SetData() number of bins must be greater than zero."<<endl;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(nbinsx*nbinsy>nx_array*ny_array){
|
|
||||||
delete [] data;
|
|
||||||
data = new double [nbinsx*nbinsy+1]; //one for under/overflow bin
|
|
||||||
nx_array = nbinsx;
|
|
||||||
ny_array = nbinsy;
|
|
||||||
}
|
|
||||||
nx=nbinsx;
|
|
||||||
ny=nbinsy;
|
|
||||||
nb=nx*ny;
|
|
||||||
data[nb]=0;//set over flow to zero
|
|
||||||
if(d){
|
|
||||||
memcpy(data,d,nb*sizeof(double));
|
|
||||||
SetMinMax(zmin,zmax);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SlsQt2DHist::SetMinMax(double zmin,double zmax){
|
|
||||||
/* if(zmin<zmax){ edited out to test*/
|
|
||||||
if(zmax != -1){
|
|
||||||
z_min=zmin;
|
|
||||||
z_max=zmax;
|
|
||||||
}else{
|
|
||||||
z_mean_has_been_calculated = 1;
|
|
||||||
z_min=data[0];
|
|
||||||
z_mean=0;
|
|
||||||
z_max=data[0];
|
|
||||||
for(int i=0;i<nb;i++){
|
|
||||||
if(data[i]<z_min) z_min=data[i];
|
|
||||||
if(data[i]>z_max) z_max=data[i];
|
|
||||||
z_mean+=data[i];
|
|
||||||
}
|
}
|
||||||
z_mean/=nb;
|
return b;
|
||||||
if(z_min>0) z_min/=1.02; else z_min*=1.02;
|
|
||||||
if(z_max>0) z_max*=1.02; else z_max/=1.02;
|
|
||||||
}
|
|
||||||
setInterval( Qt::ZAxis,QwtInterval(z_min,z_max));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double SlsQt2DHist::GetMean(){
|
int SlsQt2DHist::FindBinIndex(double x, double y) {
|
||||||
if(!z_mean_has_been_calculated){
|
return GetBinIndex(int((x - x_min) / x_width), int((y - y_min) / y_width));
|
||||||
z_mean_has_been_calculated = 1;
|
|
||||||
z_mean=0;
|
|
||||||
for(int i=0;i<nb;i++) z_mean+=data[i];
|
|
||||||
z_mean/=nb;
|
|
||||||
}
|
|
||||||
|
|
||||||
return z_mean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double SlsQt2DHist::SetMinimumToFirstGreaterThanZero(){
|
double SlsQt2DHist::GetBinValue(int bx, int by) {
|
||||||
z_min=fabs(z_max)+1;
|
return data[GetBinIndex(bx, by)];
|
||||||
for(int i=0;i<nb;i++){
|
|
||||||
if(data[i]>0 && data[i]<z_min) z_min=data[i];
|
|
||||||
}
|
|
||||||
setInterval( Qt::ZAxis,QwtInterval(z_min,z_max));
|
|
||||||
|
|
||||||
|
|
||||||
return z_min;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SlsQt2DHist::SetBinValue(int bx, int by, double v) {
|
||||||
|
z_mean_has_been_calculated = 0;
|
||||||
|
data[GetBinIndex(bx, by)] = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SlsQt2DHist::SetData(int nbinsx, double xmin, double xmax, int nbinsy,
|
||||||
|
double ymin, double ymax, double *d, double zmin,
|
||||||
|
double zmax) {
|
||||||
|
z_mean_has_been_calculated = 0;
|
||||||
|
if (xmax < xmin || ymax < ymin)
|
||||||
|
cout << "Warning input range invalid." << endl;
|
||||||
|
|
||||||
|
x_width = (xmax - xmin) / nbinsx;
|
||||||
|
y_width = (ymax - ymin) / nbinsy;
|
||||||
|
|
||||||
|
if (x_min != xmin || x_max != xmax || y_min != ymin || y_max != ymax) {
|
||||||
|
x_min = xmin;
|
||||||
|
x_max = xmax;
|
||||||
|
y_min = ymin;
|
||||||
|
y_max = ymax;
|
||||||
|
setInterval(Qt::XAxis, QwtInterval(xmin, xmax));
|
||||||
|
setInterval(Qt::YAxis, QwtInterval(ymin, ymax));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nbinsx * nbinsy < 1) {
|
||||||
|
cout << "Exitting: SlsQt2DHist::SetData() number of bins must be "
|
||||||
|
"greater than zero."
|
||||||
|
<< endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nbinsx * nbinsy > nx_array * ny_array) {
|
||||||
|
delete[] data;
|
||||||
|
data = new double[nbinsx * nbinsy + 1]; // one for under/overflow bin
|
||||||
|
nx_array = nbinsx;
|
||||||
|
ny_array = nbinsy;
|
||||||
|
}
|
||||||
|
nx = nbinsx;
|
||||||
|
ny = nbinsy;
|
||||||
|
nb = nx * ny;
|
||||||
|
data[nb] = 0; // set over flow to zero
|
||||||
|
if (d) {
|
||||||
|
memcpy(data, d, nb * sizeof(double));
|
||||||
|
SetMinMax(zmin, zmax);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SlsQt2DHist::SetMinMax(double zmin, double zmax) {
|
||||||
|
/* if(zmin<zmax){ edited out to test*/
|
||||||
|
if (zmax != -1) {
|
||||||
|
z_min = zmin;
|
||||||
|
z_max = zmax;
|
||||||
|
} else {
|
||||||
|
z_mean_has_been_calculated = 1;
|
||||||
|
z_min = data[0];
|
||||||
|
z_mean = 0;
|
||||||
|
z_max = data[0];
|
||||||
|
for (int i = 0; i < nb; i++) {
|
||||||
|
if (data[i] < z_min)
|
||||||
|
z_min = data[i];
|
||||||
|
if (data[i] > z_max)
|
||||||
|
z_max = data[i];
|
||||||
|
z_mean += data[i];
|
||||||
|
}
|
||||||
|
z_mean /= nb;
|
||||||
|
if (z_min > 0)
|
||||||
|
z_min /= 1.02;
|
||||||
|
else
|
||||||
|
z_min *= 1.02;
|
||||||
|
if (z_max > 0)
|
||||||
|
z_max *= 1.02;
|
||||||
|
else
|
||||||
|
z_max /= 1.02;
|
||||||
|
}
|
||||||
|
setInterval(Qt::ZAxis, QwtInterval(z_min, z_max));
|
||||||
|
}
|
||||||
|
|
||||||
|
double SlsQt2DHist::GetMean() {
|
||||||
|
if (!z_mean_has_been_calculated) {
|
||||||
|
z_mean_has_been_calculated = 1;
|
||||||
|
z_mean = 0;
|
||||||
|
for (int i = 0; i < nb; i++)
|
||||||
|
z_mean += data[i];
|
||||||
|
z_mean /= nb;
|
||||||
|
}
|
||||||
|
|
||||||
|
return z_mean;
|
||||||
|
}
|
||||||
|
|
||||||
|
double SlsQt2DHist::SetMinimumToFirstGreaterThanZero() {
|
||||||
|
z_min = fabs(z_max) + 1;
|
||||||
|
for (int i = 0; i < nb; i++) {
|
||||||
|
if (data[i] > 0 && data[i] < z_min)
|
||||||
|
z_min = data[i];
|
||||||
|
}
|
||||||
|
setInterval(Qt::ZAxis, QwtInterval(z_min, z_max));
|
||||||
|
|
||||||
|
return z_min;
|
||||||
|
}
|
||||||
|
123
slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx
Executable file → Normal file
123
slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx
Executable file → Normal file
@ -19,11 +19,7 @@
|
|||||||
#include <qwt_scale_engine.h>
|
#include <qwt_scale_engine.h>
|
||||||
#include <qwt_scale_widget.h>
|
#include <qwt_scale_widget.h>
|
||||||
|
|
||||||
|
#define QwtLog10ScaleEngine QwtLogScaleEngine // hmm remove?
|
||||||
|
|
||||||
|
|
||||||
#define QwtLog10ScaleEngine QwtLogScaleEngine //hmm remove?
|
|
||||||
|
|
||||||
|
|
||||||
SlsQt2DPlot::SlsQt2DPlot(QWidget *parent) : QwtPlot(parent) {
|
SlsQt2DPlot::SlsQt2DPlot(QWidget *parent) : QwtPlot(parent) {
|
||||||
isLog = 0;
|
isLog = 0;
|
||||||
@ -40,55 +36,52 @@ SlsQt2DPlot::SlsQt2DPlot(QWidget *parent) : QwtPlot(parent) {
|
|||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SlsQt2DPlot::~SlsQt2DPlot() {
|
SlsQt2DPlot::~SlsQt2DPlot() {
|
||||||
if (d_spectrogram) {
|
if (d_spectrogram) {
|
||||||
d_spectrogram->detach();
|
d_spectrogram->detach();
|
||||||
//delete d_spectrogram;
|
// delete d_spectrogram;
|
||||||
}
|
}
|
||||||
delete hist;
|
delete hist;
|
||||||
delete colorMapLinearScale;
|
delete colorMapLinearScale;
|
||||||
delete colorMapLogScale;
|
delete colorMapLogScale;
|
||||||
delete zoomer;
|
delete zoomer;
|
||||||
delete panner;
|
delete panner;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt2DPlot::SetTitle(QString title) {
|
void SlsQt2DPlot::SetTitle(QString title) { setTitle(title); }
|
||||||
setTitle(title);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SlsQt2DPlot::SetXTitle(QString title) {
|
void SlsQt2DPlot::SetXTitle(QString title) {
|
||||||
setAxisTitle(QwtPlot::xBottom, title);
|
setAxisTitle(QwtPlot::xBottom, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt2DPlot::SetYTitle(QString title) {
|
void SlsQt2DPlot::SetYTitle(QString title) {
|
||||||
setAxisTitle(QwtPlot::yLeft, title);
|
setAxisTitle(QwtPlot::yLeft, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt2DPlot::SetZTitle(QString title) {
|
void SlsQt2DPlot::SetZTitle(QString title) {
|
||||||
setAxisTitle(QwtPlot::yRight, title);
|
setAxisTitle(QwtPlot::yRight, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt2DPlot::SetTitleFont(const QFont& f) {
|
void SlsQt2DPlot::SetTitleFont(const QFont &f) {
|
||||||
QwtText t("");
|
QwtText t("");
|
||||||
t.setFont(f);
|
t.setFont(f);
|
||||||
t.setRenderFlags( Qt::AlignLeft | Qt::AlignVCenter);
|
t.setRenderFlags(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
setTitle(t);
|
setTitle(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt2DPlot::SetXFont(const QFont& f) {
|
void SlsQt2DPlot::SetXFont(const QFont &f) {
|
||||||
QwtText t("");
|
QwtText t("");
|
||||||
t.setFont(f);
|
t.setFont(f);
|
||||||
setAxisTitle(QwtPlot::xBottom, t);
|
setAxisTitle(QwtPlot::xBottom, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt2DPlot::SetYFont(const QFont& f) {
|
void SlsQt2DPlot::SetYFont(const QFont &f) {
|
||||||
QwtText t("");
|
QwtText t("");
|
||||||
t.setFont(f);
|
t.setFont(f);
|
||||||
setAxisTitle(QwtPlot::yLeft, t);
|
setAxisTitle(QwtPlot::yLeft, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt2DPlot::SetZFont(const QFont& f) {
|
void SlsQt2DPlot::SetZFont(const QFont &f) {
|
||||||
QwtText t("");
|
QwtText t("");
|
||||||
t.setFont(f);
|
t.setFont(f);
|
||||||
setAxisTitle(QwtPlot::yRight, t);
|
setAxisTitle(QwtPlot::yRight, t);
|
||||||
@ -105,7 +98,6 @@ void SlsQt2DPlot::SetupColorMap() {
|
|||||||
for (double level = 0.5; level < 10.0; level += 1.0)
|
for (double level = 0.5; level < 10.0; level += 1.0)
|
||||||
(contourLevelsLog) += (pow(10, 2 * level / 10.0) - 1) / 99.0 * 10;
|
(contourLevelsLog) += (pow(10, 2 * level / 10.0) - 1) / 99.0 * 10;
|
||||||
|
|
||||||
|
|
||||||
// A color bar on the right axis
|
// A color bar on the right axis
|
||||||
rightAxis = axisWidget(QwtPlot::yRight);
|
rightAxis = axisWidget(QwtPlot::yRight);
|
||||||
|
|
||||||
@ -124,7 +116,8 @@ void SlsQt2DPlot::FillTestPlot(int mode) {
|
|||||||
double dmax = sqrt(pow(nx / 2.0 - 0.5, 2) + pow(ny / 2.0 - 0.5, 2));
|
double dmax = sqrt(pow(nx / 2.0 - 0.5, 2) + pow(ny / 2.0 - 0.5, 2));
|
||||||
for (int i = 0; i < nx; i++) {
|
for (int i = 0; i < nx; i++) {
|
||||||
for (int j = 0; j < ny; j++) {
|
for (int j = 0; j < ny; j++) {
|
||||||
double d = sqrt(pow(nx / 2.0 - (i + 0.5), 2) + pow(ny / 2.0 - (j + 0.5), 2));
|
double d = sqrt(pow(nx / 2.0 - (i + 0.5), 2) +
|
||||||
|
pow(ny / 2.0 - (j + 0.5), 2));
|
||||||
|
|
||||||
if (mode % 3)
|
if (mode % 3)
|
||||||
the_data[i + j * nx] = 10 * d / dmax;
|
the_data[i + j * nx] = 10 * d / dmax;
|
||||||
@ -146,9 +139,11 @@ void SlsQt2DPlot::SetupZoom() {
|
|||||||
zoomer->SetHist(hist);
|
zoomer->SetHist(hist);
|
||||||
|
|
||||||
#if QT_VERSION < 0x040000
|
#if QT_VERSION < 0x040000
|
||||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlButton);
|
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton,
|
||||||
|
Qt::ControlButton);
|
||||||
#else
|
#else
|
||||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier);
|
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton,
|
||||||
|
Qt::ControlModifier);
|
||||||
#endif
|
#endif
|
||||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton);
|
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton);
|
||||||
|
|
||||||
@ -169,27 +164,31 @@ void SlsQt2DPlot::SetupZoom() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*void SlsQt2DPlot::CompletelyUnZoom(){
|
/*void SlsQt2DPlot::CompletelyUnZoom(){
|
||||||
setAxisScale(QwtPlot::xBottom,hist->GetXMin(),hist->GetXMin()+(hist->GetXMax()-hist->GetXMin()));
|
setAxisScale(QwtPlot::xBottom,hist->GetXMin(),hist->GetXMin()+(hist->GetXMax()-hist->GetXMin()));
|
||||||
setAxisScale(QwtPlot::yLeft,hist->GetYMin(),hist->GetYMin()+(hist->GetYMax()-hist->GetYMin()));
|
setAxisScale(QwtPlot::yLeft,hist->GetYMin(),hist->GetYMin()+(hist->GetYMax()-hist->GetYMin()));
|
||||||
zoomer->setZoomBase();
|
zoomer->setZoomBase();
|
||||||
//replot();
|
//replot();
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
void SlsQt2DPlot::UnZoom(bool replot) {
|
void SlsQt2DPlot::UnZoom(bool replot) {
|
||||||
|
|
||||||
zoomer->setZoomBase(QRectF(hist->GetXMin(), hist->GetYMin(), hist->GetXMax() - hist->GetXMin(), hist->GetYMax() - hist->GetYMin()));
|
zoomer->setZoomBase(QRectF(hist->GetXMin(), hist->GetYMin(),
|
||||||
zoomer->setZoomBase(replot); //Call replot for the attached plot before initializing the zoomer with its scales.
|
hist->GetXMax() - hist->GetXMin(),
|
||||||
|
hist->GetYMax() - hist->GetYMin()));
|
||||||
|
zoomer->setZoomBase(replot); // Call replot for the attached plot before
|
||||||
|
// initializing the zoomer with its scales.
|
||||||
// zoomer->zoom(0);
|
// zoomer->zoom(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt2DPlot::SetZoom(double xmin, double ymin, double x_width, double y_width) {
|
void SlsQt2DPlot::SetZoom(double xmin, double ymin, double x_width,
|
||||||
|
double y_width) {
|
||||||
zoomer->setZoomBase(QRectF(xmin, ymin, x_width, y_width));
|
zoomer->setZoomBase(QRectF(xmin, ymin, x_width, y_width));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt2DPlot::DisableZoom(bool disable) {
|
void SlsQt2DPlot::DisableZoom(bool disable) {
|
||||||
if (disableZoom != disable) {
|
if (disableZoom != disable) {
|
||||||
disableZoom = disable;
|
disableZoom = disable;
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
if (disable)
|
if (disable)
|
||||||
std::cout << "Disabling zoom\n";
|
std::cout << "Disabling zoom\n";
|
||||||
@ -198,25 +197,33 @@ void SlsQt2DPlot::DisableZoom(bool disable) {
|
|||||||
#endif
|
#endif
|
||||||
if (disable) {
|
if (disable) {
|
||||||
if (zoomer) {
|
if (zoomer) {
|
||||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::NoButton);
|
zoomer->setMousePattern(QwtEventPattern::MouseSelect1,
|
||||||
|
Qt::NoButton);
|
||||||
#if QT_VERSION < 0x040000
|
#if QT_VERSION < 0x040000
|
||||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::NoButton, Qt::ControlButton);
|
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
|
||||||
|
Qt::NoButton, Qt::ControlButton);
|
||||||
#else
|
#else
|
||||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::NoButton, Qt::ControlModifier);
|
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
|
||||||
|
Qt::NoButton, Qt::ControlModifier);
|
||||||
#endif
|
#endif
|
||||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::NoButton);
|
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
|
||||||
|
Qt::NoButton);
|
||||||
}
|
}
|
||||||
if (panner)
|
if (panner)
|
||||||
panner->setMouseButton(Qt::NoButton);
|
panner->setMouseButton(Qt::NoButton);
|
||||||
} else {
|
} else {
|
||||||
if (zoomer) {
|
if (zoomer) {
|
||||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::LeftButton);
|
zoomer->setMousePattern(QwtEventPattern::MouseSelect1,
|
||||||
|
Qt::LeftButton);
|
||||||
#if QT_VERSION < 0x040000
|
#if QT_VERSION < 0x040000
|
||||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlButton);
|
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
|
||||||
|
Qt::RightButton, Qt::ControlButton);
|
||||||
#else
|
#else
|
||||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier);
|
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
|
||||||
|
Qt::RightButton, Qt::ControlModifier);
|
||||||
#endif
|
#endif
|
||||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton);
|
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
|
||||||
|
Qt::RightButton);
|
||||||
}
|
}
|
||||||
if (panner)
|
if (panner)
|
||||||
panner->setMouseButton(Qt::MidButton);
|
panner->setMouseButton(Qt::MidButton);
|
||||||
@ -224,7 +231,6 @@ void SlsQt2DPlot::DisableZoom(bool disable) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SlsQt2DPlot::SetZMinMax(double zmin, double zmax) {
|
void SlsQt2DPlot::SetZMinMax(double zmin, double zmax) {
|
||||||
hist->SetMinMax(zmin, zmax);
|
hist->SetMinMax(zmin, zmax);
|
||||||
}
|
}
|
||||||
@ -294,24 +300,25 @@ void SlsQt2DPlot::SetContour(bool enable) {
|
|||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt2DPlot::SetLogz(bool enable, bool isMin, bool isMax, double min, double max) {
|
void SlsQt2DPlot::SetLogz(bool enable, bool isMin, bool isMax, double min,
|
||||||
LogZ(enable);
|
double max) {
|
||||||
SetZRange(isMin, isMax, min, max);
|
LogZ(enable);
|
||||||
|
SetZRange(isMin, isMax, min, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt2DPlot::SetZRange(bool isMin, bool isMax, double min, double max){
|
void SlsQt2DPlot::SetZRange(bool isMin, bool isMax, double min, double max) {
|
||||||
if(isLog) {
|
if (isLog) {
|
||||||
SetZMinimumToFirstGreaterThanZero();
|
SetZMinimumToFirstGreaterThanZero();
|
||||||
}
|
}
|
||||||
|
|
||||||
// set zmin and zmax
|
// set zmin and zmax
|
||||||
if (isMin || isMax) {
|
if (isMin || isMax) {
|
||||||
double zmin = (isMin ? min : GetZMinimum());
|
double zmin = (isMin ? min : GetZMinimum());
|
||||||
double zmax = (isMax ? max : GetZMaximum());
|
double zmax = (isMax ? max : GetZMaximum());
|
||||||
SetZMinMax(zmin, zmax);
|
SetZMinMax(zmin, zmax);
|
||||||
}
|
}
|
||||||
|
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlsQt2DPlot::LogZ(bool on) {
|
void SlsQt2DPlot::LogZ(bool on) {
|
||||||
|
91
slsDetectorGui/src/qCloneWidget.cpp
Executable file → Normal file
91
slsDetectorGui/src/qCloneWidget.cpp
Executable file → Normal file
@ -1,7 +1,7 @@
|
|||||||
#include "qCloneWidget.h"
|
#include "qCloneWidget.h"
|
||||||
#include "qDefs.h"
|
|
||||||
#include "SlsQt1DPlot.h"
|
#include "SlsQt1DPlot.h"
|
||||||
#include "SlsQt2DPlot.h"
|
#include "SlsQt2DPlot.h"
|
||||||
|
#include "qDefs.h"
|
||||||
|
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
@ -11,35 +11,39 @@
|
|||||||
|
|
||||||
int qCloneWidget::NumClones{0};
|
int qCloneWidget::NumClones{0};
|
||||||
|
|
||||||
qCloneWidget::qCloneWidget(QWidget *parent, SlsQt1DPlot* p1, SlsQt2DPlot* p2, SlsQt1DPlot *gp1, SlsQt2DPlot* gp,
|
qCloneWidget::qCloneWidget(QWidget *parent, SlsQt1DPlot *p1, SlsQt2DPlot *p2,
|
||||||
QString title, QString fPath, QString fName, int64_t aIndex,
|
SlsQt1DPlot *gp1, SlsQt2DPlot *gp, QString title,
|
||||||
bool displayStats, QString min, QString max, QString sum):
|
QString fPath, QString fName, int64_t aIndex,
|
||||||
QMainWindow(parent), plot1d(p1), plot2d(p2), gainplot1d(gp1), gainplot2d(gp), filePath(fPath), fileName(fName), acqIndex(aIndex) {
|
bool displayStats, QString min, QString max,
|
||||||
setupUi(this);
|
QString sum)
|
||||||
id = qCloneWidget::NumClones++;
|
: QMainWindow(parent), plot1d(p1), plot2d(p2), gainplot1d(gp1),
|
||||||
|
gainplot2d(gp), filePath(fPath), fileName(fName), acqIndex(aIndex) {
|
||||||
|
setupUi(this);
|
||||||
|
id = qCloneWidget::NumClones++;
|
||||||
SetupWidgetWindow(title);
|
SetupWidgetWindow(title);
|
||||||
DisplayStats(displayStats, min, max, sum);
|
DisplayStats(displayStats, min, max, sum);
|
||||||
}
|
}
|
||||||
|
|
||||||
qCloneWidget::~qCloneWidget() {
|
qCloneWidget::~qCloneWidget() {
|
||||||
|
|
||||||
delete plot1d;
|
delete plot1d;
|
||||||
|
|
||||||
delete plot2d;
|
delete plot2d;
|
||||||
|
|
||||||
delete gainplot1d;
|
delete gainplot1d;
|
||||||
|
|
||||||
delete gainplot2d;
|
delete gainplot2d;
|
||||||
}
|
}
|
||||||
|
|
||||||
void qCloneWidget::SetupWidgetWindow(QString title) {
|
void qCloneWidget::SetupWidgetWindow(QString title) {
|
||||||
|
|
||||||
std::string winTitle = std::string("Snapshot:") + std::to_string(id) + std::string(" - ") + NowTime();
|
std::string winTitle = std::string("Snapshot:") + std::to_string(id) +
|
||||||
|
std::string(" - ") + NowTime();
|
||||||
setWindowTitle(QString(winTitle.c_str()));
|
setWindowTitle(QString(winTitle.c_str()));
|
||||||
|
|
||||||
boxPlot->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
boxPlot->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||||
boxPlot->setTitle(title);
|
boxPlot->setTitle(title);
|
||||||
|
|
||||||
// 1d
|
// 1d
|
||||||
if (plot1d != nullptr) {
|
if (plot1d != nullptr) {
|
||||||
if (gainplot1d == nullptr) {
|
if (gainplot1d == nullptr) {
|
||||||
@ -49,7 +53,7 @@ void qCloneWidget::SetupWidgetWindow(QString title) {
|
|||||||
plotLayout->addWidget(plot1d, 0, 0, ratio, ratio);
|
plotLayout->addWidget(plot1d, 0, 0, ratio, ratio);
|
||||||
plotLayout->addWidget(gainplot1d, ratio, 0, 1, ratio, Qt::AlignTop);
|
plotLayout->addWidget(gainplot1d, ratio, 0, 1, ratio, Qt::AlignTop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 2d
|
// 2d
|
||||||
else {
|
else {
|
||||||
if (gainplot2d == nullptr) {
|
if (gainplot2d == nullptr) {
|
||||||
@ -57,7 +61,8 @@ void qCloneWidget::SetupWidgetWindow(QString title) {
|
|||||||
} else {
|
} else {
|
||||||
int ratio = qDefs::DATA_GAIN_PLOT_RATIO - 1;
|
int ratio = qDefs::DATA_GAIN_PLOT_RATIO - 1;
|
||||||
plotLayout->addWidget(plot2d, 0, 0, ratio, ratio);
|
plotLayout->addWidget(plot2d, 0, 0, ratio, ratio);
|
||||||
plotLayout->addWidget(gainplot2d, 0, ratio, 1, 1, Qt::AlignRight | Qt::AlignTop);
|
plotLayout->addWidget(gainplot2d, 0, ratio, 1, 1,
|
||||||
|
Qt::AlignRight | Qt::AlignTop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
connect(actionSaveClone, SIGNAL(triggered()), this, SLOT(SavePlot()));
|
connect(actionSaveClone, SIGNAL(triggered()), this, SLOT(SavePlot()));
|
||||||
@ -65,15 +70,19 @@ void qCloneWidget::SetupWidgetWindow(QString title) {
|
|||||||
if (gainplot1d != nullptr) {
|
if (gainplot1d != nullptr) {
|
||||||
gainplot1d->setMinimumHeight(qDefs::MIN_HEIGHT_GAIN_PLOT_1D);
|
gainplot1d->setMinimumHeight(qDefs::MIN_HEIGHT_GAIN_PLOT_1D);
|
||||||
gainplot1d->setFixedWidth(plot1d->width());
|
gainplot1d->setFixedWidth(plot1d->width());
|
||||||
// gainplot1d->setFixedHeight(plot1d->height() / qDefs::DATA_GAIN_PLOT_RATIO - 1);
|
// gainplot1d->setFixedHeight(plot1d->height() /
|
||||||
|
// qDefs::DATA_GAIN_PLOT_RATIO - 1);
|
||||||
}
|
}
|
||||||
if (gainplot2d != nullptr) {
|
if (gainplot2d != nullptr) {
|
||||||
gainplot2d->setFixedWidth(plot2d->width() / qDefs::DATA_GAIN_PLOT_RATIO);
|
gainplot2d->setFixedWidth(plot2d->width() /
|
||||||
gainplot2d->setFixedHeight(plot2d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
qDefs::DATA_GAIN_PLOT_RATIO);
|
||||||
|
gainplot2d->setFixedHeight(plot2d->height() /
|
||||||
|
qDefs::DATA_GAIN_PLOT_RATIO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void qCloneWidget::DisplayStats(bool enable, QString min, QString max, QString sum) {
|
void qCloneWidget::DisplayStats(bool enable, QString min, QString max,
|
||||||
|
QString sum) {
|
||||||
if (enable) {
|
if (enable) {
|
||||||
lblMinDisp->setText(QString("%1").arg(min));
|
lblMinDisp->setText(QString("%1").arg(min));
|
||||||
lblMaxDisp->setText(QString("%1").arg(max));
|
lblMaxDisp->setText(QString("%1").arg(max));
|
||||||
@ -87,21 +96,32 @@ void qCloneWidget::DisplayStats(bool enable, QString min, QString max, QString s
|
|||||||
void qCloneWidget::SavePlot() {
|
void qCloneWidget::SavePlot() {
|
||||||
char cID[10];
|
char cID[10];
|
||||||
sprintf(cID, "%d", id);
|
sprintf(cID, "%d", id);
|
||||||
//title
|
// title
|
||||||
QString fName = filePath + QString('/') + fileName + QString("_clone") + QString("%1").arg(id) + QString("_acq") + QString("%1").arg(acqIndex) + QString(".png");
|
QString fName = filePath + QString('/') + fileName + QString("_clone") +
|
||||||
|
QString("%1").arg(id) + QString("_acq") +
|
||||||
|
QString("%1").arg(acqIndex) + QString(".png");
|
||||||
FILE_LOG(logINFO) << "Saving Clone:" << fName.toAscii().constData();
|
FILE_LOG(logINFO) << "Saving Clone:" << fName.toAscii().constData();
|
||||||
//save
|
// save
|
||||||
QImage img(centralwidget->size().width(), centralwidget->size().height(), QImage::Format_RGB32);
|
QImage img(centralwidget->size().width(), centralwidget->size().height(),
|
||||||
|
QImage::Format_RGB32);
|
||||||
QPainter painter(&img);
|
QPainter painter(&img);
|
||||||
centralwidget->render(&painter);
|
centralwidget->render(&painter);
|
||||||
|
|
||||||
fName = QFileDialog::getSaveFileName(this, tr("Save Snapshot "), fName, tr("PNG Files (*.png);;XPM Files(*.xpm);;JPEG Files(*.jpg)"), 0, QFileDialog::ShowDirsOnly);
|
fName = QFileDialog::getSaveFileName(
|
||||||
|
this, tr("Save Snapshot "), fName,
|
||||||
|
tr("PNG Files (*.png);;XPM Files(*.xpm);;JPEG Files(*.jpg)"), 0,
|
||||||
|
QFileDialog::ShowDirsOnly);
|
||||||
if (!fName.isEmpty()) {
|
if (!fName.isEmpty()) {
|
||||||
if ((img.save(fName))) {
|
if ((img.save(fName))) {
|
||||||
qDefs::Message(qDefs::INFORMATION, "The SnapShot has been successfully saved", "qCloneWidget::SavePlot");
|
qDefs::Message(qDefs::INFORMATION,
|
||||||
|
"The SnapShot has been successfully saved",
|
||||||
|
"qCloneWidget::SavePlot");
|
||||||
FILE_LOG(logINFO) << "The SnapShot has been successfully saved";
|
FILE_LOG(logINFO) << "The SnapShot has been successfully saved";
|
||||||
} else {
|
} else {
|
||||||
qDefs::Message(qDefs::WARNING, "Attempt to save snapshot failed.\n Formats: .png, .jpg, .xpm.", "qCloneWidget::SavePlot");
|
qDefs::Message(
|
||||||
|
qDefs::WARNING,
|
||||||
|
"Attempt to save snapshot failed.\n Formats: .png, .jpg, .xpm.",
|
||||||
|
"qCloneWidget::SavePlot");
|
||||||
FILE_LOG(logWARNING) << "Attempt to save snapshot failed";
|
FILE_LOG(logWARNING) << "Attempt to save snapshot failed";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -110,11 +130,14 @@ void qCloneWidget::SavePlot() {
|
|||||||
void qCloneWidget::resizeEvent(QResizeEvent *event) {
|
void qCloneWidget::resizeEvent(QResizeEvent *event) {
|
||||||
if (gainplot1d != nullptr) {
|
if (gainplot1d != nullptr) {
|
||||||
gainplot1d->setFixedWidth(plot1d->width());
|
gainplot1d->setFixedWidth(plot1d->width());
|
||||||
gainplot1d->setFixedHeight(plot1d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
gainplot1d->setFixedHeight(plot1d->height() /
|
||||||
|
qDefs::DATA_GAIN_PLOT_RATIO);
|
||||||
}
|
}
|
||||||
if (gainplot2d != nullptr) {
|
if (gainplot2d != nullptr) {
|
||||||
gainplot2d->setFixedWidth(plot2d->width() / qDefs::DATA_GAIN_PLOT_RATIO);
|
gainplot2d->setFixedWidth(plot2d->width() /
|
||||||
gainplot2d->setFixedHeight(plot2d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
qDefs::DATA_GAIN_PLOT_RATIO);
|
||||||
|
gainplot2d->setFixedHeight(plot2d->height() /
|
||||||
|
qDefs::DATA_GAIN_PLOT_RATIO);
|
||||||
}
|
}
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
116
slsDetectorGui/src/qDacWidget.cpp
Executable file → Normal file
116
slsDetectorGui/src/qDacWidget.cpp
Executable file → Normal file
@ -3,88 +3,92 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
qDacWidget::qDacWidget(QWidget *parent, sls::Detector *detector, bool d, std::string n, slsDetectorDefs::dacIndex i) :
|
qDacWidget::qDacWidget(QWidget *parent, sls::Detector *detector, bool d,
|
||||||
QWidget(parent), det(detector), isDac(d), index(i){
|
std::string n, slsDetectorDefs::dacIndex i)
|
||||||
setupUi(this);
|
: QWidget(parent), det(detector), isDac(d), index(i) {
|
||||||
SetupWidgetWindow(n);
|
setupUi(this);
|
||||||
|
SetupWidgetWindow(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDacWidget::~qDacWidget() {}
|
qDacWidget::~qDacWidget() {}
|
||||||
|
|
||||||
void qDacWidget::SetupWidgetWindow(std::string name) {
|
void qDacWidget::SetupWidgetWindow(std::string name) {
|
||||||
lblDac->setText(name.c_str());
|
lblDac->setText(name.c_str());
|
||||||
if (isDac) {
|
if (isDac) {
|
||||||
spinDac->setDecimals(0);
|
spinDac->setDecimals(0);
|
||||||
} else {
|
} else {
|
||||||
spinDac->setSuffix(0x00b0 + QString("C"));
|
spinDac->setSuffix(0x00b0 + QString("C"));
|
||||||
spinDac->setReadOnly(true);
|
spinDac->setReadOnly(true);
|
||||||
lblDacmV->setMinimumWidth(0);
|
lblDacmV->setMinimumWidth(0);
|
||||||
lblDacmV->setMaximumWidth(0);
|
lblDacmV->setMaximumWidth(0);
|
||||||
}
|
}
|
||||||
Initialization();
|
Initialization();
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void qDacWidget::Initialization() {
|
void qDacWidget::Initialization() {
|
||||||
if (isDac) {
|
if (isDac) {
|
||||||
connect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac()));
|
connect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDacWidget::SetDetectorIndex(int id) {
|
void qDacWidget::SetDetectorIndex(int id) {
|
||||||
detectorIndex = id;
|
detectorIndex = id;
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDacWidget::GetDac() {
|
void qDacWidget::GetDac() {
|
||||||
FILE_LOG(logDEBUG) << "Getting Dac " << index;
|
FILE_LOG(logDEBUG) << "Getting Dac " << index;
|
||||||
|
|
||||||
disconnect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac()));
|
disconnect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac()));
|
||||||
try {
|
try {
|
||||||
// dac units
|
// dac units
|
||||||
auto retval = det->getDAC(index, 0, {detectorIndex}).squash(-1);
|
auto retval = det->getDAC(index, 0, {detectorIndex}).squash(-1);
|
||||||
spinDac->setValue(retval);
|
spinDac->setValue(retval);
|
||||||
// mv
|
// mv
|
||||||
retval = det->getDAC(index, 1, {detectorIndex}).squash(-1);
|
retval = det->getDAC(index, 1, {detectorIndex}).squash(-1);
|
||||||
lblDacmV->setText(QString("%1mV").arg(retval -10));
|
lblDacmV->setText(QString("%1mV").arg(retval - 10));
|
||||||
} CATCH_DISPLAY(std::string("Could not get dac ") + std::to_string(index), "qDacWidget::GetDac")
|
}
|
||||||
|
CATCH_DISPLAY(std::string("Could not get dac ") + std::to_string(index),
|
||||||
|
"qDacWidget::GetDac")
|
||||||
|
|
||||||
connect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac()));
|
connect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void qDacWidget::SetDac() {
|
void qDacWidget::SetDac() {
|
||||||
int val = (int)spinDac->value();
|
int val = (int)spinDac->value();
|
||||||
FILE_LOG(logINFO) << "Setting dac:" << lblDac->text().toAscii().data() << " : " << val;
|
FILE_LOG(logINFO) << "Setting dac:" << lblDac->text().toAscii().data()
|
||||||
|
<< " : " << val;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
det->setDAC(index, val, 0, {detectorIndex});
|
det->setDAC(index, val, 0, {detectorIndex});
|
||||||
} CATCH_DISPLAY (std::string("Could not set dac ") + std::to_string(index), "qDacWidget::SetDac")
|
}
|
||||||
|
CATCH_DISPLAY(std::string("Could not set dac ") + std::to_string(index),
|
||||||
// update mV anyway
|
"qDacWidget::SetDac")
|
||||||
|
|
||||||
|
// update mV anyway
|
||||||
GetDac();
|
GetDac();
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDacWidget::GetAdc() {
|
void qDacWidget::GetAdc() {
|
||||||
FILE_LOG(logDEBUG) << "Getting ADC " << index;
|
FILE_LOG(logDEBUG) << "Getting ADC " << index;
|
||||||
|
|
||||||
try {
|
|
||||||
auto retval = det->getTemperature(index, {detectorIndex}).squash(-1);
|
|
||||||
if (retval == -1 && detectorIndex == -1) {
|
|
||||||
spinDac->setValue(-1);
|
|
||||||
} else {
|
|
||||||
spinDac->setValue(retval);
|
|
||||||
}
|
|
||||||
} CATCH_DISPLAY (std::string("Could not get adc ") + std::to_string(index), "qDacWidget::GetAdc")
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
auto retval = det->getTemperature(index, {detectorIndex}).squash(-1);
|
||||||
|
if (retval == -1 && detectorIndex == -1) {
|
||||||
|
spinDac->setValue(-1);
|
||||||
|
} else {
|
||||||
|
spinDac->setValue(retval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CATCH_DISPLAY(std::string("Could not get adc ") + std::to_string(index),
|
||||||
|
"qDacWidget::GetAdc")
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDacWidget::Refresh() {
|
void qDacWidget::Refresh() {
|
||||||
if (isDac) {
|
if (isDac) {
|
||||||
GetDac();
|
GetDac();
|
||||||
} else {
|
} else {
|
||||||
GetAdc();
|
GetAdc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
126
slsDetectorGui/src/qDetectorMain.cpp
Executable file → Normal file
126
slsDetectorGui/src/qDetectorMain.cpp
Executable file → Normal file
@ -1,25 +1,24 @@
|
|||||||
#include "qDetectorMain.h"
|
#include "qDetectorMain.h"
|
||||||
#include "qDefs.h"
|
#include "qDefs.h"
|
||||||
#include "qDrawPlot.h"
|
#include "qDrawPlot.h"
|
||||||
#include "qTabMeasurement.h"
|
|
||||||
#include "qTabDataOutput.h"
|
|
||||||
#include "qTabPlot.h"
|
|
||||||
#include "qTabAdvanced.h"
|
#include "qTabAdvanced.h"
|
||||||
#include "qTabSettings.h"
|
#include "qTabDataOutput.h"
|
||||||
#include "qTabDebugging.h"
|
#include "qTabDebugging.h"
|
||||||
#include "qTabDeveloper.h"
|
#include "qTabDeveloper.h"
|
||||||
|
#include "qTabMeasurement.h"
|
||||||
#include "qTabMessages.h"
|
#include "qTabMessages.h"
|
||||||
|
#include "qTabPlot.h"
|
||||||
|
#include "qTabSettings.h"
|
||||||
|
|
||||||
#include "versionAPI.h"
|
|
||||||
#include "ToString.h"
|
#include "ToString.h"
|
||||||
|
#include "versionAPI.h"
|
||||||
|
|
||||||
#include <QResizeEvent>
|
|
||||||
#include <QScrollArea>
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QPlastiqueStyle>
|
#include <QPlastiqueStyle>
|
||||||
|
#include <QResizeEvent>
|
||||||
|
#include <QScrollArea>
|
||||||
#include <QSizePolicy>
|
#include <QSizePolicy>
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -94,10 +93,9 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
app.setStyle(new QPlastiqueStyle);
|
app.setStyle(new QPlastiqueStyle);
|
||||||
//app.setWindowIcon(QIcon(":/icons/images/mountain.png"));
|
// app.setWindowIcon(QIcon(":/icons/images/mountain.png"));
|
||||||
try {
|
try {
|
||||||
qDetectorMain det(multiId, fname, isDeveloper);
|
qDetectorMain det(multiId, fname, isDeveloper);
|
||||||
det.show();
|
det.show();
|
||||||
@ -133,7 +131,8 @@ void qDetectorMain::SetUpWidgetWindow() {
|
|||||||
layoutTabs->addWidget(tabs.get());
|
layoutTabs->addWidget(tabs.get());
|
||||||
|
|
||||||
// creating all the other tab widgets
|
// creating all the other tab widgets
|
||||||
tabMeasurement = sls::make_unique<qTabMeasurement>(this, det.get(), plot.get());
|
tabMeasurement =
|
||||||
|
sls::make_unique<qTabMeasurement>(this, det.get(), plot.get());
|
||||||
tabDataOutput = sls::make_unique<qTabDataOutput>(this, det.get());
|
tabDataOutput = sls::make_unique<qTabDataOutput>(this, det.get());
|
||||||
tabPlot = sls::make_unique<qTabPlot>(this, det.get(), plot.get());
|
tabPlot = sls::make_unique<qTabPlot>(this, det.get(), plot.get());
|
||||||
tabSettings = sls::make_unique<qTabSettings>(this, det.get());
|
tabSettings = sls::make_unique<qTabSettings>(this, det.get());
|
||||||
@ -219,7 +218,8 @@ void qDetectorMain::SetUpDetector(const std::string fName, int multiID) {
|
|||||||
LoadConfigFile(fName);
|
LoadConfigFile(fName);
|
||||||
|
|
||||||
// validate detector type (for GUI) and update menu
|
// validate detector type (for GUI) and update menu
|
||||||
detType = det->getDetectorType().tsquash("Different detector type for all modules.");
|
detType = det->getDetectorType().tsquash(
|
||||||
|
"Different detector type for all modules.");
|
||||||
actionLoadTrimbits->setEnabled(false);
|
actionLoadTrimbits->setEnabled(false);
|
||||||
switch (detType) {
|
switch (detType) {
|
||||||
case slsDetectorDefs::EIGER:
|
case slsDetectorDefs::EIGER:
|
||||||
@ -230,18 +230,20 @@ void qDetectorMain::SetUpDetector(const std::string fName, int multiID) {
|
|||||||
case slsDetectorDefs::MOENCH:
|
case slsDetectorDefs::MOENCH:
|
||||||
case slsDetectorDefs::MYTHEN3:
|
case slsDetectorDefs::MYTHEN3:
|
||||||
case slsDetectorDefs::GOTTHARD2:
|
case slsDetectorDefs::GOTTHARD2:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << det->getHostname() << " has " <<
|
os << det->getHostname() << " has "
|
||||||
sls::ToString(det->getDetectorType().squash()) << " detector type (" <<
|
<< sls::ToString(det->getDetectorType().squash())
|
||||||
std::to_string(detType) << "). Exiting GUI.";
|
<< " detector type (" << std::to_string(detType)
|
||||||
|
<< "). Exiting GUI.";
|
||||||
std::string errorMess = os.str();
|
std::string errorMess = os.str();
|
||||||
throw sls::RuntimeError(errorMess.c_str());
|
throw sls::RuntimeError(errorMess.c_str());
|
||||||
}
|
}
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "SLS Detector GUI : " << sls::ToString(det->getDetectorType().squash())
|
os << "SLS Detector GUI : "
|
||||||
<< " - " << det->getHostname();
|
<< sls::ToString(det->getDetectorType().squash()) << " - "
|
||||||
|
<< det->getHostname();
|
||||||
std::string title = os.str();
|
std::string title = os.str();
|
||||||
FILE_LOG(logINFO) << title;
|
FILE_LOG(logINFO) << title;
|
||||||
setWindowTitle(QString(title.c_str()));
|
setWindowTitle(QString(title.c_str()));
|
||||||
@ -249,27 +251,36 @@ void qDetectorMain::SetUpDetector(const std::string fName, int multiID) {
|
|||||||
|
|
||||||
void qDetectorMain::Initialization() {
|
void qDetectorMain::Initialization() {
|
||||||
// Dockable Plot
|
// Dockable Plot
|
||||||
connect(dockWidgetPlot, SIGNAL(topLevelChanged(bool)), this, SLOT(ResizeMainWindow(bool)));
|
connect(dockWidgetPlot, SIGNAL(topLevelChanged(bool)), this,
|
||||||
|
SLOT(ResizeMainWindow(bool)));
|
||||||
// tabs
|
// tabs
|
||||||
connect(tabs.get(),SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*)));
|
connect(tabs.get(), SIGNAL(currentChanged(int)), this,
|
||||||
|
SLOT(Refresh(int))); //( QWidget*)));
|
||||||
// Measurement tab
|
// Measurement tab
|
||||||
connect(tabMeasurement.get(), SIGNAL(EnableTabsSignal(bool)), this, SLOT(EnableTabs(bool)));
|
connect(tabMeasurement.get(), SIGNAL(EnableTabsSignal(bool)), this,
|
||||||
connect(tabMeasurement.get(), SIGNAL(FileNameChangedSignal(QString)), plot.get(), SLOT(SetSaveFileName(QString)));
|
SLOT(EnableTabs(bool)));
|
||||||
|
connect(tabMeasurement.get(), SIGNAL(FileNameChangedSignal(QString)),
|
||||||
|
plot.get(), SLOT(SetSaveFileName(QString)));
|
||||||
// Plot tab
|
// Plot tab
|
||||||
connect(tabPlot.get(), SIGNAL(DisableZoomSignal(bool)), this, SLOT(SetZoomToolTip(bool)));
|
connect(tabPlot.get(), SIGNAL(DisableZoomSignal(bool)), this,
|
||||||
|
SLOT(SetZoomToolTip(bool)));
|
||||||
|
|
||||||
// Plotting
|
// Plotting
|
||||||
connect(plot.get(), SIGNAL(AcquireFinishedSignal()), tabMeasurement.get(), SLOT(AcquireFinished()));
|
connect(plot.get(), SIGNAL(AcquireFinishedSignal()), tabMeasurement.get(),
|
||||||
connect(plot.get(), SIGNAL(AbortSignal()), tabMeasurement.get(), SLOT(AbortAcquire()));
|
SLOT(AcquireFinished()));
|
||||||
|
connect(plot.get(), SIGNAL(AbortSignal()), tabMeasurement.get(),
|
||||||
|
SLOT(AbortAcquire()));
|
||||||
|
|
||||||
// menubar
|
// menubar
|
||||||
// Modes Menu
|
// Modes Menu
|
||||||
connect(menuModes, SIGNAL(triggered(QAction *)), this, SLOT(EnableModes(QAction *)));
|
connect(menuModes, SIGNAL(triggered(QAction *)), this,
|
||||||
|
SLOT(EnableModes(QAction *)));
|
||||||
// Utilities Menu
|
// Utilities Menu
|
||||||
connect(menuUtilities, SIGNAL(triggered(QAction *)), this, SLOT(ExecuteUtilities(QAction *)));
|
connect(menuUtilities, SIGNAL(triggered(QAction *)), this,
|
||||||
|
SLOT(ExecuteUtilities(QAction *)));
|
||||||
// Help Menu
|
// Help Menu
|
||||||
connect(menuHelp, SIGNAL(triggered(QAction *)), this, SLOT(ExecuteHelp(QAction *)));
|
connect(menuHelp, SIGNAL(triggered(QAction *)), this,
|
||||||
|
SLOT(ExecuteHelp(QAction *)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDetectorMain::LoadConfigFile(const std::string fName) {
|
void qDetectorMain::LoadConfigFile(const std::string fName) {
|
||||||
@ -302,7 +313,9 @@ void qDetectorMain::LoadConfigFile(const std::string fName) {
|
|||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
det->loadConfig(fName);
|
det->loadConfig(fName);
|
||||||
} CATCH_DISPLAY ("Could not load config file.", "qDetectorMain::LoadConfigFile")
|
}
|
||||||
|
CATCH_DISPLAY("Could not load config file.",
|
||||||
|
"qDetectorMain::LoadConfigFile")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,8 +326,7 @@ void qDetectorMain::EnableModes(QAction *action) {
|
|||||||
if (action == actionDebug) {
|
if (action == actionDebug) {
|
||||||
enable = actionDebug->isChecked();
|
enable = actionDebug->isChecked();
|
||||||
tabs->setTabEnabled(DEBUGGING, enable);
|
tabs->setTabEnabled(DEBUGGING, enable);
|
||||||
FILE_LOG(logINFO) << "Debug Mode: "
|
FILE_LOG(logINFO) << "Debug Mode: " << qDefs::stringEnable(enable);
|
||||||
<< qDefs::stringEnable(enable);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,9 +335,9 @@ void qDetectorMain::EnableModes(QAction *action) {
|
|||||||
enable = actionExpert->isChecked();
|
enable = actionExpert->isChecked();
|
||||||
|
|
||||||
tabs->setTabEnabled(ADVANCED, enable);
|
tabs->setTabEnabled(ADVANCED, enable);
|
||||||
actionLoadTrimbits->setVisible(enable && detType == slsDetectorDefs::EIGER);
|
actionLoadTrimbits->setVisible(enable &&
|
||||||
FILE_LOG(logINFO) << "Expert Mode: "
|
detType == slsDetectorDefs::EIGER);
|
||||||
<< qDefs::stringEnable(enable);
|
FILE_LOG(logINFO) << "Expert Mode: " << qDefs::stringEnable(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set DockableMode
|
// Set DockableMode
|
||||||
@ -337,8 +349,7 @@ void qDetectorMain::EnableModes(QAction *action) {
|
|||||||
dockWidgetPlot->setFloating(false);
|
dockWidgetPlot->setFloating(false);
|
||||||
dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||||
}
|
}
|
||||||
FILE_LOG(logINFO) << "Dockable Mode: "
|
FILE_LOG(logINFO) << "Dockable Mode: " << qDefs::stringEnable(enable);
|
||||||
<< qDefs::stringEnable(enable);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,8 +366,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
|
|||||||
// Gets called when cancelled as well
|
// Gets called when cancelled as well
|
||||||
if (!fName.isEmpty()) {
|
if (!fName.isEmpty()) {
|
||||||
refreshTabs = true;
|
refreshTabs = true;
|
||||||
det->loadConfig(
|
det->loadConfig(std::string(fName.toAscii().constData()));
|
||||||
std::string(fName.toAscii().constData()));
|
|
||||||
qDefs::Message(qDefs::INFORMATION,
|
qDefs::Message(qDefs::INFORMATION,
|
||||||
"The Configuration Parameters have been "
|
"The Configuration Parameters have been "
|
||||||
"configured successfully.",
|
"configured successfully.",
|
||||||
@ -375,19 +385,18 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
|
|||||||
// Gets called when cancelled as well
|
// Gets called when cancelled as well
|
||||||
if (!fName.isEmpty()) {
|
if (!fName.isEmpty()) {
|
||||||
refreshTabs = true;
|
refreshTabs = true;
|
||||||
det->loadParameters(
|
det->loadParameters(std::string(fName.toAscii().constData()));
|
||||||
std::string(fName.toAscii().constData()));
|
|
||||||
qDefs::Message(qDefs::INFORMATION,
|
qDefs::Message(qDefs::INFORMATION,
|
||||||
"The Detector Parameters have been "
|
"The Detector Parameters have been "
|
||||||
"configured successfully.",
|
"configured successfully.",
|
||||||
"qDetectorMain::ExecuteUtilities");
|
"qDetectorMain::ExecuteUtilities");
|
||||||
FILE_LOG(logINFO)
|
FILE_LOG(logINFO) << "Parameters loaded successfully";
|
||||||
<< "Parameters loaded successfully";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (action == actionLoadTrimbits) {
|
else if (action == actionLoadTrimbits) {
|
||||||
QString fName = QString((det->getSettingsPath().squash("/tmp/")).c_str());
|
QString fName =
|
||||||
|
QString((det->getSettingsPath().squash("/tmp/")).c_str());
|
||||||
FILE_LOG(logDEBUG) << "Loading Trimbits";
|
FILE_LOG(logDEBUG) << "Loading Trimbits";
|
||||||
// so that even nonexisting files can be selected
|
// so that even nonexisting files can be selected
|
||||||
QFileDialog *fileDialog = new QFileDialog(
|
QFileDialog *fileDialog = new QFileDialog(
|
||||||
@ -399,18 +408,16 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
|
|||||||
|
|
||||||
// Gets called when cancelled as well
|
// Gets called when cancelled as well
|
||||||
if (!fName.isEmpty()) {
|
if (!fName.isEmpty()) {
|
||||||
det->loadTrimbits(
|
det->loadTrimbits(std::string(fName.toAscii().constData()));
|
||||||
std::string(fName.toAscii().constData()));
|
qDefs::Message(qDefs::INFORMATION,
|
||||||
qDefs::Message(
|
"The Trimbits have been loaded successfully.",
|
||||||
qDefs::INFORMATION,
|
"qDetectorMain::ExecuteUtilities");
|
||||||
"The Trimbits have been loaded successfully.",
|
|
||||||
"qDetectorMain::ExecuteUtilities");
|
|
||||||
FILE_LOG(logINFO) << "Trimbits loaded successfully";
|
FILE_LOG(logINFO) << "Trimbits loaded successfully";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} CATCH_DISPLAY ("Could not execute utilities.", "qDetectorMain::ExecuteUtilities")
|
CATCH_DISPLAY("Could not execute utilities.",
|
||||||
|
"qDetectorMain::ExecuteUtilities")
|
||||||
|
|
||||||
Refresh(tabs->currentIndex());
|
Refresh(tabs->currentIndex());
|
||||||
if (refreshTabs) {
|
if (refreshTabs) {
|
||||||
@ -429,13 +436,16 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
|
|||||||
|
|
||||||
void qDetectorMain::ExecuteHelp(QAction *action) {
|
void qDetectorMain::ExecuteHelp(QAction *action) {
|
||||||
if (action == actionAbout) {
|
if (action == actionAbout) {
|
||||||
FILE_LOG(logINFO) << "About Common GUI for Jungfrau, Eiger, Mythen3, Gotthard, Gotthard2 and Moench detectors";
|
FILE_LOG(logINFO) << "About Common GUI for Jungfrau, Eiger, Mythen3, "
|
||||||
|
"Gotthard, Gotthard2 and Moench detectors";
|
||||||
|
|
||||||
std::string guiVersion = std::to_string(APIGUI);
|
std::string guiVersion = std::to_string(APIGUI);
|
||||||
std::string clientVersion = "unknown";
|
std::string clientVersion = "unknown";
|
||||||
try {
|
try {
|
||||||
clientVersion = std::to_string(det->getClientVersion());
|
clientVersion = std::to_string(det->getClientVersion());
|
||||||
} CATCH_DISPLAY ("Could not get client version.", "qDetectorMain::ExecuteHelp")
|
}
|
||||||
|
CATCH_DISPLAY("Could not get client version.",
|
||||||
|
"qDetectorMain::ExecuteHelp")
|
||||||
|
|
||||||
qDefs::Message(qDefs::INFORMATION,
|
qDefs::Message(qDefs::INFORMATION,
|
||||||
"<p style=\"font-family:verdana;\">"
|
"<p style=\"font-family:verdana;\">"
|
||||||
@ -446,7 +456,8 @@ void qDetectorMain::ExecuteHelp(QAction *action) {
|
|||||||
clientVersion +
|
clientVersion +
|
||||||
"<br><br>"
|
"<br><br>"
|
||||||
"Common GUI to control the SLS Detectors: "
|
"Common GUI to control the SLS Detectors: "
|
||||||
"Jungfrau, Eiger, Mythen3, Gotthard, Gotthard2 and Moench.<br><br>"
|
"Jungfrau, Eiger, Mythen3, Gotthard, Gotthard2 and "
|
||||||
|
"Moench.<br><br>"
|
||||||
"It can be operated in parallel with the command "
|
"It can be operated in parallel with the command "
|
||||||
"line interface:<br>"
|
"line interface:<br>"
|
||||||
"sls_detector_put,<br>sls_detector_get,<br>sls_"
|
"sls_detector_put,<br>sls_detector_get,<br>sls_"
|
||||||
@ -553,7 +564,8 @@ void qDetectorMain::EnableTabs(bool enable) {
|
|||||||
// expert
|
// expert
|
||||||
bool expertTab = enable && (actionExpert->isChecked());
|
bool expertTab = enable && (actionExpert->isChecked());
|
||||||
tabs->setTabEnabled(ADVANCED, expertTab);
|
tabs->setTabEnabled(ADVANCED, expertTab);
|
||||||
actionLoadTrimbits->setVisible(expertTab && detType == slsDetectorDefs::EIGER);
|
actionLoadTrimbits->setVisible(expertTab &&
|
||||||
|
detType == slsDetectorDefs::EIGER);
|
||||||
|
|
||||||
// moved to here, so that its all in order, instead of signals and different
|
// moved to here, so that its all in order, instead of signals and different
|
||||||
// threads
|
// threads
|
||||||
|
587
slsDetectorGui/src/qDrawPlot.cpp
Executable file → Normal file
587
slsDetectorGui/src/qDrawPlot.cpp
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
256
slsDetectorGui/src/qTabAdvanced.cpp
Executable file → Normal file
256
slsDetectorGui/src/qTabAdvanced.cpp
Executable file → Normal file
@ -1,11 +1,12 @@
|
|||||||
#include "qTabAdvanced.h"
|
#include "qTabAdvanced.h"
|
||||||
|
#include "network_utils.h"
|
||||||
#include "qDefs.h"
|
#include "qDefs.h"
|
||||||
#include "qDrawPlot.h"
|
#include "qDrawPlot.h"
|
||||||
#include "network_utils.h"
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
qTabAdvanced::qTabAdvanced(QWidget *parent, sls::Detector *detector, qDrawPlot *p)
|
qTabAdvanced::qTabAdvanced(QWidget *parent, sls::Detector *detector,
|
||||||
|
qDrawPlot *p)
|
||||||
: QWidget(parent), det(detector), plot(p) {
|
: QWidget(parent), det(detector), plot(p) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
SetupWidgetWindow();
|
SetupWidgetWindow();
|
||||||
@ -88,7 +89,8 @@ void qTabAdvanced::Initialization() {
|
|||||||
|
|
||||||
// roi
|
// roi
|
||||||
if (tab_roi->isEnabled()) {
|
if (tab_roi->isEnabled()) {
|
||||||
connect(comboReadout, SIGNAL(currentIndexChanged(int)), this, SLOT(GetROI()));
|
connect(comboReadout, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(GetROI()));
|
||||||
connect(btnSetRoi, SIGNAL(clicked()), this, SLOT(SetROI()));
|
connect(btnSetRoi, SIGNAL(clicked()), this, SLOT(SetROI()));
|
||||||
connect(btnClearRoi, SIGNAL(clicked()), this, SLOT(ClearROI()));
|
connect(btnClearRoi, SIGNAL(clicked()), this, SLOT(ClearROI()));
|
||||||
}
|
}
|
||||||
@ -114,7 +116,7 @@ void qTabAdvanced::Initialization() {
|
|||||||
// throw bits
|
// throw bits
|
||||||
if (lblDiscardBits->isEnabled()) {
|
if (lblDiscardBits->isEnabled()) {
|
||||||
connect(spinDiscardBits, SIGNAL(valueChanged(int)), plot,
|
connect(spinDiscardBits, SIGNAL(valueChanged(int)), plot,
|
||||||
SLOT(SetNumDiscardBits(int)));
|
SLOT(SetNumDiscardBits(int)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +124,8 @@ void qTabAdvanced::PopulateDetectors() {
|
|||||||
FILE_LOG(logDEBUG) << "Populating detectors";
|
FILE_LOG(logDEBUG) << "Populating detectors";
|
||||||
disconnect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
disconnect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(SetDetector()));
|
SLOT(SetDetector()));
|
||||||
disconnect(comboReadout, SIGNAL(currentIndexChanged(int)), this, SLOT(GetROI()));
|
disconnect(comboReadout, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(GetROI()));
|
||||||
|
|
||||||
comboDetector->clear();
|
comboDetector->clear();
|
||||||
comboReadout->clear();
|
comboReadout->clear();
|
||||||
@ -132,11 +135,12 @@ void qTabAdvanced::PopulateDetectors() {
|
|||||||
comboReadout->addItem(QString(it.c_str()));
|
comboReadout->addItem(QString(it.c_str()));
|
||||||
}
|
}
|
||||||
comboDetector->setCurrentIndex(0);
|
comboDetector->setCurrentIndex(0);
|
||||||
comboReadout->setCurrentIndex(0);
|
comboReadout->setCurrentIndex(0);
|
||||||
|
|
||||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(SetDetector()));
|
SLOT(SetDetector()));
|
||||||
connect(comboReadout, SIGNAL(currentIndexChanged(int)), this, SLOT(GetROI()));
|
connect(comboReadout, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(GetROI()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::GetControlPort() {
|
void qTabAdvanced::GetControlPort() {
|
||||||
@ -147,7 +151,9 @@ void qTabAdvanced::GetControlPort() {
|
|||||||
try {
|
try {
|
||||||
int retval = det->getControlPort({comboDetector->currentIndex()})[0];
|
int retval = det->getControlPort({comboDetector->currentIndex()})[0];
|
||||||
spinControlPort->setValue(retval);
|
spinControlPort->setValue(retval);
|
||||||
} CATCH_DISPLAY ("Could not get detector control port.", "qTabAdvanced::GetControlPort")
|
}
|
||||||
|
CATCH_DISPLAY("Could not get detector control port.",
|
||||||
|
"qTabAdvanced::GetControlPort")
|
||||||
|
|
||||||
connect(spinControlPort, SIGNAL(valueChanged(int)), this,
|
connect(spinControlPort, SIGNAL(valueChanged(int)), this,
|
||||||
SLOT(SetControlPort(int)));
|
SLOT(SetControlPort(int)));
|
||||||
@ -161,7 +167,9 @@ void qTabAdvanced::GetStopPort() {
|
|||||||
try {
|
try {
|
||||||
int retval = det->getStopPort({comboDetector->currentIndex()})[0];
|
int retval = det->getStopPort({comboDetector->currentIndex()})[0];
|
||||||
spinStopPort->setValue(retval);
|
spinStopPort->setValue(retval);
|
||||||
} CATCH_DISPLAY ("Could not get detector stop port.", "qTabAdvanced::GetStopPort")
|
}
|
||||||
|
CATCH_DISPLAY("Could not get detector stop port.",
|
||||||
|
"qTabAdvanced::GetStopPort")
|
||||||
|
|
||||||
connect(spinStopPort, SIGNAL(valueChanged(int)), this,
|
connect(spinStopPort, SIGNAL(valueChanged(int)), this,
|
||||||
SLOT(SetStopPort(int)));
|
SLOT(SetStopPort(int)));
|
||||||
@ -173,9 +181,12 @@ void qTabAdvanced::GetDetectorUDPIP() {
|
|||||||
SLOT(SetDetectorUDPIP()));
|
SLOT(SetDetectorUDPIP()));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
auto retval = det->getSourceUDPIP({comboDetector->currentIndex()})[0].str();
|
auto retval =
|
||||||
|
det->getSourceUDPIP({comboDetector->currentIndex()})[0].str();
|
||||||
dispDetectorUDPIP->setText(QString(retval.c_str()));
|
dispDetectorUDPIP->setText(QString(retval.c_str()));
|
||||||
} CATCH_DISPLAY ("Could not get detector UDP IP.", "qTabAdvanced::GetDetectorUDPIP")
|
}
|
||||||
|
CATCH_DISPLAY("Could not get detector UDP IP.",
|
||||||
|
"qTabAdvanced::GetDetectorUDPIP")
|
||||||
|
|
||||||
connect(dispDetectorUDPIP, SIGNAL(editingFinished()), this,
|
connect(dispDetectorUDPIP, SIGNAL(editingFinished()), this,
|
||||||
SLOT(SetDetectorUDPIP()));
|
SLOT(SetDetectorUDPIP()));
|
||||||
@ -187,9 +198,12 @@ void qTabAdvanced::GetDetectorUDPMAC() {
|
|||||||
SLOT(SetDetectorUDPMAC()));
|
SLOT(SetDetectorUDPMAC()));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
auto retval = det->getSourceUDPMAC({comboDetector->currentIndex()})[0].str();
|
auto retval =
|
||||||
|
det->getSourceUDPMAC({comboDetector->currentIndex()})[0].str();
|
||||||
dispDetectorUDPMAC->setText(QString(retval.c_str()));
|
dispDetectorUDPMAC->setText(QString(retval.c_str()));
|
||||||
} CATCH_DISPLAY ("Could not get detector UDP MAC.", "qTabAdvanced::GetDetectorUDPMAC")
|
}
|
||||||
|
CATCH_DISPLAY("Could not get detector UDP MAC.",
|
||||||
|
"qTabAdvanced::GetDetectorUDPMAC")
|
||||||
|
|
||||||
connect(dispDetectorUDPMAC, SIGNAL(editingFinished()), this,
|
connect(dispDetectorUDPMAC, SIGNAL(editingFinished()), this,
|
||||||
SLOT(SetDetectorUDPMAC()));
|
SLOT(SetDetectorUDPMAC()));
|
||||||
@ -201,10 +215,11 @@ void qTabAdvanced::GetCltZMQPort() {
|
|||||||
SLOT(SetCltZMQPort(int)));
|
SLOT(SetCltZMQPort(int)));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int retval =
|
int retval = det->getClientZmqPort({comboDetector->currentIndex()})[0];
|
||||||
det->getClientZmqPort({comboDetector->currentIndex()})[0];
|
|
||||||
spinZMQPort->setValue(retval);
|
spinZMQPort->setValue(retval);
|
||||||
} CATCH_DISPLAY ("Could not get client zmq port.", "qTabAdvanced::GetCltZMQPort")
|
}
|
||||||
|
CATCH_DISPLAY("Could not get client zmq port.",
|
||||||
|
"qTabAdvanced::GetCltZMQPort")
|
||||||
|
|
||||||
connect(spinZMQPort, SIGNAL(valueChanged(int)), this,
|
connect(spinZMQPort, SIGNAL(valueChanged(int)), this,
|
||||||
SLOT(SetCltZMQPort(int)));
|
SLOT(SetCltZMQPort(int)));
|
||||||
@ -218,7 +233,8 @@ void qTabAdvanced::GetCltZMQIP() {
|
|||||||
auto retval =
|
auto retval =
|
||||||
det->getClientZmqIp({comboDetector->currentIndex()})[0].str();
|
det->getClientZmqIp({comboDetector->currentIndex()})[0].str();
|
||||||
dispZMQIP->setText(QString(retval.c_str()));
|
dispZMQIP->setText(QString(retval.c_str()));
|
||||||
} CATCH_DISPLAY ("Could not get client zmq ip.", "qTabAdvanced::GetCltZMQIP")
|
}
|
||||||
|
CATCH_DISPLAY("Could not get client zmq ip.", "qTabAdvanced::GetCltZMQIP")
|
||||||
|
|
||||||
connect(dispZMQIP, SIGNAL(editingFinished()), this, SLOT(SetCltZMQIP()));
|
connect(dispZMQIP, SIGNAL(editingFinished()), this, SLOT(SetCltZMQIP()));
|
||||||
}
|
}
|
||||||
@ -231,7 +247,9 @@ void qTabAdvanced::GetRxrHostname() {
|
|||||||
try {
|
try {
|
||||||
auto retval = det->getRxHostname({comboDetector->currentIndex()})[0];
|
auto retval = det->getRxHostname({comboDetector->currentIndex()})[0];
|
||||||
dispRxrHostname->setText(QString(retval.c_str()));
|
dispRxrHostname->setText(QString(retval.c_str()));
|
||||||
} CATCH_DISPLAY ("Could not get receiver hostname.", "qTabAdvanced::GetRxrHostname")
|
}
|
||||||
|
CATCH_DISPLAY("Could not get receiver hostname.",
|
||||||
|
"qTabAdvanced::GetRxrHostname")
|
||||||
|
|
||||||
connect(dispRxrHostname, SIGNAL(editingFinished()), this,
|
connect(dispRxrHostname, SIGNAL(editingFinished()), this,
|
||||||
SLOT(SetRxrHostname()));
|
SLOT(SetRxrHostname()));
|
||||||
@ -245,7 +263,9 @@ void qTabAdvanced::GetRxrTCPPort() {
|
|||||||
try {
|
try {
|
||||||
int retval = det->getRxPort({comboDetector->currentIndex()})[0];
|
int retval = det->getRxPort({comboDetector->currentIndex()})[0];
|
||||||
spinRxrTCPPort->setValue(retval);
|
spinRxrTCPPort->setValue(retval);
|
||||||
} CATCH_DISPLAY ("Could not get receiver tcp port.", "qTabAdvanced::GetRxrTCPPort")
|
}
|
||||||
|
CATCH_DISPLAY("Could not get receiver tcp port.",
|
||||||
|
"qTabAdvanced::GetRxrTCPPort")
|
||||||
|
|
||||||
connect(spinRxrTCPPort, SIGNAL(valueChanged(int)), this,
|
connect(spinRxrTCPPort, SIGNAL(valueChanged(int)), this,
|
||||||
SLOT(SetRxrTCPPort(int)));
|
SLOT(SetRxrTCPPort(int)));
|
||||||
@ -257,9 +277,12 @@ void qTabAdvanced::GetRxrUDPPort() {
|
|||||||
SLOT(SetRxrUDPPort(int)));
|
SLOT(SetRxrUDPPort(int)));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int retval = det->getDestinationUDPPort({comboDetector->currentIndex()})[0];
|
int retval =
|
||||||
|
det->getDestinationUDPPort({comboDetector->currentIndex()})[0];
|
||||||
spinRxrUDPPort->setValue(retval);
|
spinRxrUDPPort->setValue(retval);
|
||||||
} CATCH_DISPLAY ("Could not get receiver udp port.", "qTabAdvanced::GetRxrUDPPort")
|
}
|
||||||
|
CATCH_DISPLAY("Could not get receiver udp port.",
|
||||||
|
"qTabAdvanced::GetRxrUDPPort")
|
||||||
|
|
||||||
connect(spinRxrUDPPort, SIGNAL(valueChanged(int)), this,
|
connect(spinRxrUDPPort, SIGNAL(valueChanged(int)), this,
|
||||||
SLOT(SetRxrUDPPort(int)));
|
SLOT(SetRxrUDPPort(int)));
|
||||||
@ -271,9 +294,11 @@ void qTabAdvanced::GetRxrUDPIP() {
|
|||||||
SLOT(SetRxrUDPIP()));
|
SLOT(SetRxrUDPIP()));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
auto retval = det->getDestinationUDPIP({comboDetector->currentIndex()})[0].str();
|
auto retval =
|
||||||
|
det->getDestinationUDPIP({comboDetector->currentIndex()})[0].str();
|
||||||
dispRxrUDPIP->setText(QString(retval.c_str()));
|
dispRxrUDPIP->setText(QString(retval.c_str()));
|
||||||
} CATCH_DISPLAY ("Could not get receiver udp ip.", "qTabAdvanced::GetRxrUDPIP")
|
}
|
||||||
|
CATCH_DISPLAY("Could not get receiver udp ip.", "qTabAdvanced::GetRxrUDPIP")
|
||||||
|
|
||||||
connect(dispRxrUDPIP, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPIP()));
|
connect(dispRxrUDPIP, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPIP()));
|
||||||
}
|
}
|
||||||
@ -284,9 +309,12 @@ void qTabAdvanced::GetRxrUDPMAC() {
|
|||||||
SLOT(SetRxrUDPMAC()));
|
SLOT(SetRxrUDPMAC()));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
auto retval = det->getDestinationUDPMAC({comboDetector->currentIndex()})[0].str();
|
auto retval =
|
||||||
|
det->getDestinationUDPMAC({comboDetector->currentIndex()})[0].str();
|
||||||
dispRxrUDPMAC->setText(QString(retval.c_str()));
|
dispRxrUDPMAC->setText(QString(retval.c_str()));
|
||||||
} CATCH_DISPLAY ("Could not get receiver udp mac.", "qTabAdvanced::GetRxrUDPMAC")
|
}
|
||||||
|
CATCH_DISPLAY("Could not get receiver udp mac.",
|
||||||
|
"qTabAdvanced::GetRxrUDPMAC")
|
||||||
|
|
||||||
connect(dispRxrUDPMAC, SIGNAL(editingFinished()), this,
|
connect(dispRxrUDPMAC, SIGNAL(editingFinished()), this,
|
||||||
SLOT(SetRxrUDPMAC()));
|
SLOT(SetRxrUDPMAC()));
|
||||||
@ -298,10 +326,11 @@ void qTabAdvanced::GetRxrZMQPort() {
|
|||||||
SLOT(SetRxrZMQPort(int)));
|
SLOT(SetRxrZMQPort(int)));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int retval =
|
int retval = det->getRxZmqPort({comboDetector->currentIndex()})[0];
|
||||||
det->getRxZmqPort({comboDetector->currentIndex()})[0];
|
|
||||||
spinRxrZMQPort->setValue(retval);
|
spinRxrZMQPort->setValue(retval);
|
||||||
} CATCH_DISPLAY ("Could not get receiver zmq port.", "qTabAdvanced::GetRxrZMQPort")
|
}
|
||||||
|
CATCH_DISPLAY("Could not get receiver zmq port.",
|
||||||
|
"qTabAdvanced::GetRxrZMQPort")
|
||||||
|
|
||||||
connect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this,
|
connect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this,
|
||||||
SLOT(SetRxrZMQPort(int)));
|
SLOT(SetRxrZMQPort(int)));
|
||||||
@ -313,10 +342,10 @@ void qTabAdvanced::GetRxrZMQIP() {
|
|||||||
SLOT(SetRxrZMQIP()));
|
SLOT(SetRxrZMQIP()));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
auto retval =
|
auto retval = det->getRxZmqIP({comboDetector->currentIndex()})[0].str();
|
||||||
det->getRxZmqIP({comboDetector->currentIndex()})[0].str();
|
|
||||||
dispRxrZMQIP->setText(QString(retval.c_str()));
|
dispRxrZMQIP->setText(QString(retval.c_str()));
|
||||||
} CATCH_DISPLAY ("Could not get receiver zmq ip.", "qTabAdvanced::GetRxrZMQIP")
|
}
|
||||||
|
CATCH_DISPLAY("Could not get receiver zmq ip.", "qTabAdvanced::GetRxrZMQIP")
|
||||||
|
|
||||||
connect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP()));
|
connect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP()));
|
||||||
}
|
}
|
||||||
@ -346,7 +375,8 @@ void qTabAdvanced::SetControlPort(int port) {
|
|||||||
FILE_LOG(logINFO) << "Setting Control Port:" << port;
|
FILE_LOG(logINFO) << "Setting Control Port:" << port;
|
||||||
try {
|
try {
|
||||||
det->setControlPort(port, {comboDetector->currentIndex()});
|
det->setControlPort(port, {comboDetector->currentIndex()});
|
||||||
} CATCH_HANDLE("Could not set control port.", "qTabAdvanced::SetControlPort",
|
}
|
||||||
|
CATCH_HANDLE("Could not set control port.", "qTabAdvanced::SetControlPort",
|
||||||
this, &qTabAdvanced::GetControlPort)
|
this, &qTabAdvanced::GetControlPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,8 +384,9 @@ void qTabAdvanced::SetStopPort(int port) {
|
|||||||
FILE_LOG(logINFO) << "Setting Stop Port:" << port;
|
FILE_LOG(logINFO) << "Setting Stop Port:" << port;
|
||||||
try {
|
try {
|
||||||
det->setStopPort(port, {comboDetector->currentIndex()});
|
det->setStopPort(port, {comboDetector->currentIndex()});
|
||||||
} CATCH_HANDLE ("Could not set stop port.", "qTabAdvanced::SetStopPort", this,
|
}
|
||||||
&qTabAdvanced::GetStopPort)
|
CATCH_HANDLE("Could not set stop port.", "qTabAdvanced::SetStopPort", this,
|
||||||
|
&qTabAdvanced::GetStopPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::SetDetectorUDPIP() {
|
void qTabAdvanced::SetDetectorUDPIP() {
|
||||||
@ -363,9 +394,10 @@ void qTabAdvanced::SetDetectorUDPIP() {
|
|||||||
FILE_LOG(logINFO) << "Setting Detector UDP IP:" << s;
|
FILE_LOG(logINFO) << "Setting Detector UDP IP:" << s;
|
||||||
try {
|
try {
|
||||||
det->setSourceUDPIP(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
det->setSourceUDPIP(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
||||||
} CATCH_HANDLE ("Could not set Detector UDP IP.",
|
}
|
||||||
"qTabAdvanced::SetDetectorUDPIP", this,
|
CATCH_HANDLE("Could not set Detector UDP IP.",
|
||||||
&qTabAdvanced::GetDetectorUDPIP)
|
"qTabAdvanced::SetDetectorUDPIP", this,
|
||||||
|
&qTabAdvanced::GetDetectorUDPIP)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::SetDetectorUDPMAC() {
|
void qTabAdvanced::SetDetectorUDPMAC() {
|
||||||
@ -373,18 +405,20 @@ void qTabAdvanced::SetDetectorUDPMAC() {
|
|||||||
FILE_LOG(logINFO) << "Setting Detector UDP MAC:" << s;
|
FILE_LOG(logINFO) << "Setting Detector UDP MAC:" << s;
|
||||||
try {
|
try {
|
||||||
det->setSourceUDPMAC(sls::MacAddr{s}, {comboDetector->currentIndex()});
|
det->setSourceUDPMAC(sls::MacAddr{s}, {comboDetector->currentIndex()});
|
||||||
} CATCH_HANDLE ("Could not set Detector UDP MAC.",
|
}
|
||||||
"qTabAdvanced::SetDetectorUDPMAC", this,
|
CATCH_HANDLE("Could not set Detector UDP MAC.",
|
||||||
&qTabAdvanced::GetDetectorUDPMAC)
|
"qTabAdvanced::SetDetectorUDPMAC", this,
|
||||||
|
&qTabAdvanced::GetDetectorUDPMAC)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::SetCltZMQPort(int port) {
|
void qTabAdvanced::SetCltZMQPort(int port) {
|
||||||
FILE_LOG(logINFO) << "Setting Client ZMQ Port:" << port;
|
FILE_LOG(logINFO) << "Setting Client ZMQ Port:" << port;
|
||||||
try {
|
try {
|
||||||
det->setClientZmqPort(port, {comboDetector->currentIndex()});
|
det->setClientZmqPort(port, {comboDetector->currentIndex()});
|
||||||
} CATCH_HANDLE ("Could not set Client ZMQ port.",
|
}
|
||||||
"qTabAdvanced::SetCltZMQPort", this,
|
CATCH_HANDLE("Could not set Client ZMQ port.",
|
||||||
&qTabAdvanced::GetCltZMQPort)
|
"qTabAdvanced::SetCltZMQPort", this,
|
||||||
|
&qTabAdvanced::GetCltZMQPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::SetCltZMQIP() {
|
void qTabAdvanced::SetCltZMQIP() {
|
||||||
@ -392,9 +426,9 @@ void qTabAdvanced::SetCltZMQIP() {
|
|||||||
FILE_LOG(logINFO) << "Setting Client ZMQ IP:" << s;
|
FILE_LOG(logINFO) << "Setting Client ZMQ IP:" << s;
|
||||||
try {
|
try {
|
||||||
det->setClientZmqIp(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
det->setClientZmqIp(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
||||||
} CATCH_HANDLE ("Could not set Client ZMQ IP.",
|
}
|
||||||
"qTabAdvanced::SetCltZMQIP", this,
|
CATCH_HANDLE("Could not set Client ZMQ IP.", "qTabAdvanced::SetCltZMQIP",
|
||||||
&qTabAdvanced::GetCltZMQIP)
|
this, &qTabAdvanced::GetCltZMQIP)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::SetRxrHostname() {
|
void qTabAdvanced::SetRxrHostname() {
|
||||||
@ -402,9 +436,9 @@ void qTabAdvanced::SetRxrHostname() {
|
|||||||
FILE_LOG(logINFO) << "Setting Receiver Hostname:" << s;
|
FILE_LOG(logINFO) << "Setting Receiver Hostname:" << s;
|
||||||
try {
|
try {
|
||||||
det->setRxHostname(s, {comboDetector->currentIndex()});
|
det->setRxHostname(s, {comboDetector->currentIndex()});
|
||||||
} CATCH_HANDLE ("Could not set Client ZMQ IP.",
|
}
|
||||||
"qTabAdvanced::SetRxrHostname", this,
|
CATCH_HANDLE("Could not set Client ZMQ IP.", "qTabAdvanced::SetRxrHostname",
|
||||||
&qTabAdvanced::GetRxrHostname)
|
this, &qTabAdvanced::GetRxrHostname)
|
||||||
|
|
||||||
// update all network widgets (receiver mainly)
|
// update all network widgets (receiver mainly)
|
||||||
SetDetector();
|
SetDetector();
|
||||||
@ -414,47 +448,53 @@ void qTabAdvanced::SetRxrTCPPort(int port) {
|
|||||||
FILE_LOG(logINFO) << "Setting Receiver TCP Port:" << port;
|
FILE_LOG(logINFO) << "Setting Receiver TCP Port:" << port;
|
||||||
try {
|
try {
|
||||||
det->setRxPort(port, {comboDetector->currentIndex()});
|
det->setRxPort(port, {comboDetector->currentIndex()});
|
||||||
} CATCH_HANDLE ("Could not set Receiver TCP port.",
|
}
|
||||||
"qTabAdvanced::SetRxrTCPPort", this,
|
CATCH_HANDLE("Could not set Receiver TCP port.",
|
||||||
&qTabAdvanced::GetRxrTCPPort)
|
"qTabAdvanced::SetRxrTCPPort", this,
|
||||||
|
&qTabAdvanced::GetRxrTCPPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::SetRxrUDPPort(int port) {
|
void qTabAdvanced::SetRxrUDPPort(int port) {
|
||||||
FILE_LOG(logINFO) << "Setting Receiver UDP Port:" << port;
|
FILE_LOG(logINFO) << "Setting Receiver UDP Port:" << port;
|
||||||
try {
|
try {
|
||||||
det->setRxPort(port, {comboDetector->currentIndex()});
|
det->setRxPort(port, {comboDetector->currentIndex()});
|
||||||
} CATCH_HANDLE ("Could not set Receiver UDP port.",
|
}
|
||||||
"qTabAdvanced::SetRxrUDPPort", this,
|
CATCH_HANDLE("Could not set Receiver UDP port.",
|
||||||
&qTabAdvanced::GetRxrUDPPort)
|
"qTabAdvanced::SetRxrUDPPort", this,
|
||||||
|
&qTabAdvanced::GetRxrUDPPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::SetRxrUDPIP() {
|
void qTabAdvanced::SetRxrUDPIP() {
|
||||||
std::string s = dispRxrUDPIP->text().toAscii().constData();
|
std::string s = dispRxrUDPIP->text().toAscii().constData();
|
||||||
FILE_LOG(logINFO) << "Setting Receiver UDP IP:" << s;
|
FILE_LOG(logINFO) << "Setting Receiver UDP IP:" << s;
|
||||||
try {
|
try {
|
||||||
det->setDestinationUDPIP(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
det->setDestinationUDPIP(sls::IpAddr{s},
|
||||||
} CATCH_HANDLE ("Could not set Receiver UDP IP.",
|
{comboDetector->currentIndex()});
|
||||||
"qTabAdvanced::SetRxrUDPIP", this,
|
}
|
||||||
&qTabAdvanced::GetRxrUDPIP)
|
CATCH_HANDLE("Could not set Receiver UDP IP.", "qTabAdvanced::SetRxrUDPIP",
|
||||||
|
this, &qTabAdvanced::GetRxrUDPIP)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::SetRxrUDPMAC() {
|
void qTabAdvanced::SetRxrUDPMAC() {
|
||||||
std::string s = dispRxrUDPMAC->text().toAscii().constData();
|
std::string s = dispRxrUDPMAC->text().toAscii().constData();
|
||||||
FILE_LOG(logINFO) << "Setting Receiver UDP MAC:" << s;
|
FILE_LOG(logINFO) << "Setting Receiver UDP MAC:" << s;
|
||||||
try {
|
try {
|
||||||
det->setDestinationUDPMAC(sls::MacAddr{s}, {comboDetector->currentIndex()});
|
det->setDestinationUDPMAC(sls::MacAddr{s},
|
||||||
} CATCH_HANDLE ("Could not set Receiver UDP MAC.",
|
{comboDetector->currentIndex()});
|
||||||
"qTabAdvanced::SetRxrUDPMAC", this,
|
}
|
||||||
&qTabAdvanced::GetRxrUDPMAC)
|
CATCH_HANDLE("Could not set Receiver UDP MAC.",
|
||||||
|
"qTabAdvanced::SetRxrUDPMAC", this,
|
||||||
|
&qTabAdvanced::GetRxrUDPMAC)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::SetRxrZMQPort(int port) {
|
void qTabAdvanced::SetRxrZMQPort(int port) {
|
||||||
FILE_LOG(logINFO) << "Setting Receiver ZMQ Port:" << port;
|
FILE_LOG(logINFO) << "Setting Receiver ZMQ Port:" << port;
|
||||||
try {
|
try {
|
||||||
det->setRxZmqPort(port, {comboDetector->currentIndex()});
|
det->setRxZmqPort(port, {comboDetector->currentIndex()});
|
||||||
} CATCH_HANDLE ("Could not set Receiver ZMQ port.",
|
}
|
||||||
"qTabAdvanced::SetRxrZMQPort", this,
|
CATCH_HANDLE("Could not set Receiver ZMQ port.",
|
||||||
&qTabAdvanced::GetRxrZMQPort)
|
"qTabAdvanced::SetRxrZMQPort", this,
|
||||||
|
&qTabAdvanced::GetRxrZMQPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::SetRxrZMQIP() {
|
void qTabAdvanced::SetRxrZMQIP() {
|
||||||
@ -462,24 +502,26 @@ void qTabAdvanced::SetRxrZMQIP() {
|
|||||||
FILE_LOG(logINFO) << "Setting Receiver ZMQ IP:" << s;
|
FILE_LOG(logINFO) << "Setting Receiver ZMQ IP:" << s;
|
||||||
try {
|
try {
|
||||||
det->setRxZmqIP(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
det->setRxZmqIP(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
||||||
} CATCH_HANDLE ("Could not set Receiver ZMQ IP.",
|
}
|
||||||
"qTabAdvanced::SetRxrZMQIP", this,
|
CATCH_HANDLE("Could not set Receiver ZMQ IP.", "qTabAdvanced::SetRxrZMQIP",
|
||||||
&qTabAdvanced::GetRxrZMQIP)
|
this, &qTabAdvanced::GetRxrZMQIP)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::GetROI() {
|
void qTabAdvanced::GetROI() {
|
||||||
FILE_LOG(logDEBUG) << "Getting ROI";
|
FILE_LOG(logDEBUG) << "Getting ROI";
|
||||||
try {
|
try {
|
||||||
slsDetectorDefs::ROI roi = det->getROI({comboReadout->currentIndex()})[0];
|
slsDetectorDefs::ROI roi =
|
||||||
|
det->getROI({comboReadout->currentIndex()})[0];
|
||||||
spinXmin->setValue(roi.xmin);
|
spinXmin->setValue(roi.xmin);
|
||||||
spinXmax->setValue(roi.xmax);
|
spinXmax->setValue(roi.xmax);
|
||||||
} CATCH_DISPLAY ("Could not get ROI.", "qTabAdvanced::GetROI")
|
}
|
||||||
|
CATCH_DISPLAY("Could not get ROI.", "qTabAdvanced::GetROI")
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::ClearROI() {
|
void qTabAdvanced::ClearROI() {
|
||||||
FILE_LOG(logINFO) << "Clearing ROI";
|
FILE_LOG(logINFO) << "Clearing ROI";
|
||||||
spinXmin->setValue(-1);
|
spinXmin->setValue(-1);
|
||||||
spinXmax->setValue(-1);
|
spinXmax->setValue(-1);
|
||||||
SetROI();
|
SetROI();
|
||||||
FILE_LOG(logDEBUG) << "ROIs cleared";
|
FILE_LOG(logDEBUG) << "ROIs cleared";
|
||||||
}
|
}
|
||||||
@ -491,11 +533,12 @@ void qTabAdvanced::SetROI() {
|
|||||||
roi.xmax = spinXmax->value();
|
roi.xmax = spinXmax->value();
|
||||||
|
|
||||||
// set roi
|
// set roi
|
||||||
FILE_LOG(logINFO) << "Setting ROI: [" << roi.xmin << ", " << roi.xmax << "]";
|
FILE_LOG(logINFO) << "Setting ROI: [" << roi.xmin << ", " << roi.xmax
|
||||||
|
<< "]";
|
||||||
try {
|
try {
|
||||||
det->setROI(roi, {comboReadout->currentIndex()});
|
det->setROI(roi, {comboReadout->currentIndex()});
|
||||||
} CATCH_DISPLAY ("Could not set these ROIs.",
|
}
|
||||||
"qTabAdvanced::SetROI")
|
CATCH_DISPLAY("Could not set these ROIs.", "qTabAdvanced::SetROI")
|
||||||
|
|
||||||
// update corrected list
|
// update corrected list
|
||||||
GetROI();
|
GetROI();
|
||||||
@ -509,7 +552,8 @@ void qTabAdvanced::GetAllTrimbits() {
|
|||||||
try {
|
try {
|
||||||
int retval = det->getAllTrimbits().squash(-1);
|
int retval = det->getAllTrimbits().squash(-1);
|
||||||
spinSetAllTrimbits->setValue(retval);
|
spinSetAllTrimbits->setValue(retval);
|
||||||
} CATCH_DISPLAY ("Could not get all trimbits.", "qTabAdvanced::GetAllTrimbits")
|
}
|
||||||
|
CATCH_DISPLAY("Could not get all trimbits.", "qTabAdvanced::GetAllTrimbits")
|
||||||
|
|
||||||
connect(spinSetAllTrimbits, SIGNAL(editingFinished()), this,
|
connect(spinSetAllTrimbits, SIGNAL(editingFinished()), this,
|
||||||
SLOT(SetAllTrimbits()));
|
SLOT(SetAllTrimbits()));
|
||||||
@ -521,7 +565,8 @@ void qTabAdvanced::SetAllTrimbits() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
det->setAllTrimbits(value);
|
det->setAllTrimbits(value);
|
||||||
} CATCH_HANDLE("Could not set all trimbits.", "qTabAdvanced::SetAllTrimbits",
|
}
|
||||||
|
CATCH_HANDLE("Could not set all trimbits.", "qTabAdvanced::SetAllTrimbits",
|
||||||
this, &qTabAdvanced::GetAllTrimbits)
|
this, &qTabAdvanced::GetAllTrimbits)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -531,11 +576,12 @@ void qTabAdvanced::GetNumStoragecells() {
|
|||||||
SLOT(SetNumStoragecells(int)));
|
SLOT(SetNumStoragecells(int)));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
auto retval = det->getNumberOfAdditionalStorageCells().tsquash("Inconsistent values for number of addditional storage cells.");
|
auto retval = det->getNumberOfAdditionalStorageCells().tsquash(
|
||||||
|
"Inconsistent values for number of addditional storage cells.");
|
||||||
spinNumStoragecells->setValue(retval);
|
spinNumStoragecells->setValue(retval);
|
||||||
} CATCH_DISPLAY (
|
}
|
||||||
"Could not get number of additional storage cells.",
|
CATCH_DISPLAY("Could not get number of additional storage cells.",
|
||||||
"qTabAdvanced::GetNumStoragecells")
|
"qTabAdvanced::GetNumStoragecells")
|
||||||
|
|
||||||
connect(spinNumStoragecells, SIGNAL(valueChanged(int)), this,
|
connect(spinNumStoragecells, SIGNAL(valueChanged(int)), this,
|
||||||
SLOT(SetNumStoragecells(int)));
|
SLOT(SetNumStoragecells(int)));
|
||||||
@ -546,10 +592,10 @@ void qTabAdvanced::SetNumStoragecells(int value) {
|
|||||||
<< value;
|
<< value;
|
||||||
try {
|
try {
|
||||||
det->setNumberOfAdditionalStorageCells(value);
|
det->setNumberOfAdditionalStorageCells(value);
|
||||||
} CATCH_HANDLE (
|
}
|
||||||
"Could not set number of additional storage cells.",
|
CATCH_HANDLE("Could not set number of additional storage cells.",
|
||||||
"qTabAdvanced::SetNumStoragecells", this,
|
"qTabAdvanced::SetNumStoragecells", this,
|
||||||
&qTabAdvanced::GetNumStoragecells)
|
&qTabAdvanced::GetNumStoragecells)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::GetSubExposureTime() {
|
void qTabAdvanced::GetSubExposureTime() {
|
||||||
@ -559,13 +605,14 @@ void qTabAdvanced::GetSubExposureTime() {
|
|||||||
disconnect(comboSubExpTimeUnit, SIGNAL(currentIndexChanged(int)), this,
|
disconnect(comboSubExpTimeUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(SetSubExposureTime()));
|
SLOT(SetSubExposureTime()));
|
||||||
try {
|
try {
|
||||||
auto retval =
|
auto retval = det->getSubExptime().tsquash(
|
||||||
det->getSubExptime().tsquash("Subexptime is inconsistent for all detectors.");
|
"Subexptime is inconsistent for all detectors.");
|
||||||
auto time = qDefs::getUserFriendlyTime(retval);
|
auto time = qDefs::getUserFriendlyTime(retval);
|
||||||
spinSubExpTime->setValue(time.first);
|
spinSubExpTime->setValue(time.first);
|
||||||
comboSubExpTimeUnit->setCurrentIndex(static_cast<int>(time.second));
|
comboSubExpTimeUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||||
} CATCH_DISPLAY ("Could not get sub exposure time.",
|
}
|
||||||
"qTabSettings::GetSubExposureTime")
|
CATCH_DISPLAY("Could not get sub exposure time.",
|
||||||
|
"qTabSettings::GetSubExposureTime")
|
||||||
connect(spinSubExpTime, SIGNAL(valueChanged(double)), this,
|
connect(spinSubExpTime, SIGNAL(valueChanged(double)), this,
|
||||||
SLOT(SetSubExposureTime()));
|
SLOT(SetSubExposureTime()));
|
||||||
connect(comboSubExpTimeUnit, SIGNAL(currentIndexChanged(int)), this,
|
connect(comboSubExpTimeUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||||
@ -573,7 +620,9 @@ void qTabAdvanced::GetSubExposureTime() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::SetSubExposureTime() {
|
void qTabAdvanced::SetSubExposureTime() {
|
||||||
auto timeNS = qDefs::getNSTime(std::make_pair(spinSubExpTime->value(), static_cast<qDefs::timeUnit>(comboSubExpTimeUnit->currentIndex())));
|
auto timeNS = qDefs::getNSTime(std::make_pair(
|
||||||
|
spinSubExpTime->value(),
|
||||||
|
static_cast<qDefs::timeUnit>(comboSubExpTimeUnit->currentIndex())));
|
||||||
FILE_LOG(logINFO)
|
FILE_LOG(logINFO)
|
||||||
<< "Setting sub frame acquisition time to " << timeNS.count() << " ns"
|
<< "Setting sub frame acquisition time to " << timeNS.count() << " ns"
|
||||||
<< "/" << spinSubExpTime->value()
|
<< "/" << spinSubExpTime->value()
|
||||||
@ -581,8 +630,9 @@ void qTabAdvanced::SetSubExposureTime() {
|
|||||||
(qDefs::timeUnit)comboSubExpTimeUnit->currentIndex());
|
(qDefs::timeUnit)comboSubExpTimeUnit->currentIndex());
|
||||||
try {
|
try {
|
||||||
det->setSubExptime(timeNS);
|
det->setSubExptime(timeNS);
|
||||||
} CATCH_DISPLAY ("Could not set sub exposure time.",
|
}
|
||||||
"qTabAdvanced::SetSubExposureTime")
|
CATCH_DISPLAY("Could not set sub exposure time.",
|
||||||
|
"qTabAdvanced::SetSubExposureTime")
|
||||||
|
|
||||||
GetSubExposureTime();
|
GetSubExposureTime();
|
||||||
}
|
}
|
||||||
@ -594,13 +644,14 @@ void qTabAdvanced::GetSubDeadTime() {
|
|||||||
disconnect(comboSubDeadTimeUnit, SIGNAL(currentIndexChanged(int)), this,
|
disconnect(comboSubDeadTimeUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(SetSubDeadTime()));
|
SLOT(SetSubDeadTime()));
|
||||||
try {
|
try {
|
||||||
auto retval = det->getSubDeadTime().tsquash("Sub dead time is inconsistent for all detectors.");
|
auto retval = det->getSubDeadTime().tsquash(
|
||||||
|
"Sub dead time is inconsistent for all detectors.");
|
||||||
auto time = qDefs::getUserFriendlyTime(retval);
|
auto time = qDefs::getUserFriendlyTime(retval);
|
||||||
spinSubDeadTime->setValue(time.first);
|
spinSubDeadTime->setValue(time.first);
|
||||||
comboSubDeadTimeUnit->setCurrentIndex(
|
comboSubDeadTimeUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||||
static_cast<int>(time.second));
|
}
|
||||||
} CATCH_DISPLAY ("Could not get sub dead time.",
|
CATCH_DISPLAY("Could not get sub dead time.",
|
||||||
"qTabSettings::GetSubDeadTime")
|
"qTabSettings::GetSubDeadTime")
|
||||||
connect(spinSubDeadTime, SIGNAL(valueChanged(double)), this,
|
connect(spinSubDeadTime, SIGNAL(valueChanged(double)), this,
|
||||||
SLOT(SetSubDeadTime()));
|
SLOT(SetSubDeadTime()));
|
||||||
connect(comboSubDeadTimeUnit, SIGNAL(currentIndexChanged(int)), this,
|
connect(comboSubDeadTimeUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||||
@ -608,7 +659,9 @@ void qTabAdvanced::GetSubDeadTime() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::SetSubDeadTime() {
|
void qTabAdvanced::SetSubDeadTime() {
|
||||||
auto timeNS = qDefs::getNSTime(std::make_pair(spinSubDeadTime->value(), static_cast<qDefs::timeUnit>(comboSubDeadTimeUnit->currentIndex())));
|
auto timeNS = qDefs::getNSTime(std::make_pair(
|
||||||
|
spinSubDeadTime->value(),
|
||||||
|
static_cast<qDefs::timeUnit>(comboSubDeadTimeUnit->currentIndex())));
|
||||||
|
|
||||||
FILE_LOG(logINFO)
|
FILE_LOG(logINFO)
|
||||||
<< "Setting sub frame dead time to " << timeNS.count() << " ns"
|
<< "Setting sub frame dead time to " << timeNS.count() << " ns"
|
||||||
@ -617,8 +670,9 @@ void qTabAdvanced::SetSubDeadTime() {
|
|||||||
(qDefs::timeUnit)comboSubDeadTimeUnit->currentIndex());
|
(qDefs::timeUnit)comboSubDeadTimeUnit->currentIndex());
|
||||||
try {
|
try {
|
||||||
det->setSubDeadTime(timeNS);
|
det->setSubDeadTime(timeNS);
|
||||||
} CATCH_DISPLAY ("Could not set sub dead time.",
|
}
|
||||||
"qTabAdvanced::SetSubDeadTime")
|
CATCH_DISPLAY("Could not set sub dead time.",
|
||||||
|
"qTabAdvanced::SetSubDeadTime")
|
||||||
GetSubDeadTime();
|
GetSubDeadTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
587
slsDetectorGui/src/qTabDataOutput.cpp
Executable file → Normal file
587
slsDetectorGui/src/qTabDataOutput.cpp
Executable file → Normal file
@ -1,342 +1,431 @@
|
|||||||
#include "qTabDataOutput.h"
|
#include "qTabDataOutput.h"
|
||||||
#include "qDefs.h"
|
#include "qDefs.h"
|
||||||
|
|
||||||
|
#include <QButtonGroup>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
#include <QButtonGroup>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
qTabDataOutput::qTabDataOutput(QWidget *parent, sls::Detector *detector)
|
||||||
qTabDataOutput::qTabDataOutput(QWidget *parent, sls::Detector *detector) : QWidget(parent), det(detector), btnGroupRate(nullptr) {
|
: QWidget(parent), det(detector), btnGroupRate(nullptr) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
SetupWidgetWindow();
|
SetupWidgetWindow();
|
||||||
FILE_LOG(logDEBUG) << "DataOutput ready";
|
FILE_LOG(logDEBUG) << "DataOutput ready";
|
||||||
}
|
}
|
||||||
|
|
||||||
qTabDataOutput::~qTabDataOutput() {
|
qTabDataOutput::~qTabDataOutput() { delete btnGroupRate; }
|
||||||
delete btnGroupRate;
|
|
||||||
}
|
|
||||||
|
|
||||||
void qTabDataOutput::SetupWidgetWindow() {
|
void qTabDataOutput::SetupWidgetWindow() {
|
||||||
// button group for rate
|
// button group for rate
|
||||||
btnGroupRate = new QButtonGroup(this);
|
btnGroupRate = new QButtonGroup(this);
|
||||||
btnGroupRate->addButton(radioDefaultDeadtime, 0);
|
btnGroupRate->addButton(radioDefaultDeadtime, 0);
|
||||||
btnGroupRate->addButton(radioCustomDeadtime, 1);
|
btnGroupRate->addButton(radioCustomDeadtime, 1);
|
||||||
|
|
||||||
// enabling according to det type
|
// enabling according to det type
|
||||||
switch(det->getDetectorType().squash()) {
|
switch (det->getDetectorType().squash()) {
|
||||||
case slsDetectorDefs::EIGER:
|
case slsDetectorDefs::EIGER:
|
||||||
chkTenGiga->setEnabled(true);
|
chkTenGiga->setEnabled(true);
|
||||||
chkRate->setEnabled(true);
|
chkRate->setEnabled(true);
|
||||||
radioDefaultDeadtime->setEnabled(true);
|
radioDefaultDeadtime->setEnabled(true);
|
||||||
radioCustomDeadtime->setEnabled(true);
|
radioCustomDeadtime->setEnabled(true);
|
||||||
// flags and speed
|
// flags and speed
|
||||||
widgetEiger->setVisible(true);
|
widgetEiger->setVisible(true);
|
||||||
widgetEiger->setEnabled(true);
|
widgetEiger->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::MOENCH:
|
case slsDetectorDefs::MOENCH:
|
||||||
chkTenGiga->setEnabled(true);
|
chkTenGiga->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
PopulateDetectors();
|
PopulateDetectors();
|
||||||
|
|
||||||
Initialization();
|
Initialization();
|
||||||
|
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::Initialization() {
|
void qTabDataOutput::Initialization() {
|
||||||
// ourdir, fileformat, overwrite enable
|
// ourdir, fileformat, overwrite enable
|
||||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(GetOutputDir()));
|
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
||||||
connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir()));
|
SLOT(GetOutputDir()));
|
||||||
connect(btnOutputBrowse, SIGNAL(clicked()), this, SLOT(BrowseOutputDir()));
|
connect(dispOutputDir, SIGNAL(editingFinished()), this,
|
||||||
connect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int)));
|
SLOT(SetOutputDir()));
|
||||||
connect(chkOverwriteEnable, SIGNAL(toggled(bool)), this, SLOT(SetOverwriteEnable(bool)));
|
connect(btnOutputBrowse, SIGNAL(clicked()), this, SLOT(BrowseOutputDir()));
|
||||||
if (chkTenGiga->isEnabled()) {
|
connect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this,
|
||||||
connect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(SetTenGigaEnable(bool)));
|
SLOT(SetFileFormat(int)));
|
||||||
}
|
connect(chkOverwriteEnable, SIGNAL(toggled(bool)), this,
|
||||||
// rate
|
SLOT(SetOverwriteEnable(bool)));
|
||||||
if (chkRate->isEnabled()) {
|
if (chkTenGiga->isEnabled()) {
|
||||||
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection()));
|
connect(chkTenGiga, SIGNAL(toggled(bool)), this,
|
||||||
connect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection()));
|
SLOT(SetTenGigaEnable(bool)));
|
||||||
connect(spinCustomDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
|
}
|
||||||
}
|
// rate
|
||||||
// flags, speed
|
if (chkRate->isEnabled()) {
|
||||||
if (widgetEiger->isEnabled()) {
|
connect(chkRate, SIGNAL(toggled(bool)), this,
|
||||||
connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed(int)));
|
SLOT(EnableRateCorrection()));
|
||||||
connect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
connect(btnGroupRate, SIGNAL(buttonClicked(int)), this,
|
||||||
}
|
SLOT(SetRateCorrection()));
|
||||||
|
connect(spinCustomDeadTime, SIGNAL(editingFinished()), this,
|
||||||
|
SLOT(SetRateCorrection()));
|
||||||
|
}
|
||||||
|
// flags, speed
|
||||||
|
if (widgetEiger->isEnabled()) {
|
||||||
|
connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(SetSpeed(int)));
|
||||||
|
connect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(SetFlags()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::PopulateDetectors() {
|
void qTabDataOutput::PopulateDetectors() {
|
||||||
FILE_LOG(logDEBUG) << "Populating detectors";
|
FILE_LOG(logDEBUG) << "Populating detectors";
|
||||||
|
|
||||||
comboDetector->clear();
|
comboDetector->clear();
|
||||||
comboDetector->addItem("All");
|
comboDetector->addItem("All");
|
||||||
if (det->size() > 1) {
|
if (det->size() > 1) {
|
||||||
auto res = det->getHostname();
|
auto res = det->getHostname();
|
||||||
for (auto &it : res) {
|
for (auto &it : res) {
|
||||||
comboDetector->addItem(QString(it.c_str()));
|
comboDetector->addItem(QString(it.c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::EnableBrowse() {
|
void qTabDataOutput::EnableBrowse() {
|
||||||
FILE_LOG(logDEBUG) << "Getting browse enable";
|
FILE_LOG(logDEBUG) << "Getting browse enable";
|
||||||
try {
|
try {
|
||||||
btnOutputBrowse->setEnabled(false); // exception default
|
btnOutputBrowse->setEnabled(false); // exception default
|
||||||
std::string rxHostname = det->getRxHostname({comboDetector->currentIndex() - 1}).squash("none");
|
std::string rxHostname =
|
||||||
if (rxHostname == "none") {
|
det->getRxHostname({comboDetector->currentIndex() - 1})
|
||||||
btnOutputBrowse->setEnabled(false);
|
.squash("none");
|
||||||
} else if (rxHostname == "localhost") {
|
if (rxHostname == "none") {
|
||||||
btnOutputBrowse->setEnabled(true);
|
btnOutputBrowse->setEnabled(false);
|
||||||
} else {
|
} else if (rxHostname == "localhost") {
|
||||||
std::string hostname;
|
btnOutputBrowse->setEnabled(true);
|
||||||
const size_t len = 15;
|
} else {
|
||||||
char host[len]{};
|
std::string hostname;
|
||||||
if (gethostname(host, len) == 0) {
|
const size_t len = 15;
|
||||||
hostname.assign(host);
|
char host[len]{};
|
||||||
}
|
if (gethostname(host, len) == 0) {
|
||||||
// client pc (hostname) same as reciever hostname
|
hostname.assign(host);
|
||||||
if (hostname == rxHostname) {
|
}
|
||||||
btnOutputBrowse->setEnabled(true);
|
// client pc (hostname) same as reciever hostname
|
||||||
} else {
|
if (hostname == rxHostname) {
|
||||||
btnOutputBrowse->setEnabled(false);
|
btnOutputBrowse->setEnabled(true);
|
||||||
}
|
} else {
|
||||||
}
|
btnOutputBrowse->setEnabled(false);
|
||||||
} CATCH_DISPLAY ("Could not get receiver hostname.", "qTabDataOutput::EnableBrowse")
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CATCH_DISPLAY("Could not get receiver hostname.",
|
||||||
|
"qTabDataOutput::EnableBrowse")
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::GetFileWrite() {
|
void qTabDataOutput::GetFileWrite() {
|
||||||
FILE_LOG(logDEBUG) << "Getting file write enable";
|
FILE_LOG(logDEBUG) << "Getting file write enable";
|
||||||
try {
|
try {
|
||||||
boxFileWriteEnabled->setEnabled(true); // exception default
|
boxFileWriteEnabled->setEnabled(true); // exception default
|
||||||
auto retval = det->getFileWrite().tsquash("File write is inconsistent for all detectors.");
|
auto retval = det->getFileWrite().tsquash(
|
||||||
boxFileWriteEnabled->setEnabled(retval);
|
"File write is inconsistent for all detectors.");
|
||||||
} CATCH_DISPLAY("Could not get file enable.", "qTabDataOutput::GetFileWrite")
|
boxFileWriteEnabled->setEnabled(retval);
|
||||||
|
}
|
||||||
|
CATCH_DISPLAY("Could not get file enable.", "qTabDataOutput::GetFileWrite")
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::GetFileName() {
|
void qTabDataOutput::GetFileName() {
|
||||||
FILE_LOG(logDEBUG) << "Getting file name";
|
FILE_LOG(logDEBUG) << "Getting file name";
|
||||||
try {
|
try {
|
||||||
auto retval = det->getFileNamePrefix().tsquash("File name is inconsistent for all detectors.");
|
auto retval = det->getFileNamePrefix().tsquash(
|
||||||
dispFileName->setText(QString(retval.c_str()));
|
"File name is inconsistent for all detectors.");
|
||||||
} CATCH_DISPLAY ("Could not get file name prefix.", "qTabDataOutput::GetFileName")
|
dispFileName->setText(QString(retval.c_str()));
|
||||||
|
}
|
||||||
|
CATCH_DISPLAY("Could not get file name prefix.",
|
||||||
|
"qTabDataOutput::GetFileName")
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::GetOutputDir() {
|
void qTabDataOutput::GetOutputDir() {
|
||||||
FILE_LOG(logDEBUG) << "Getting file path";
|
FILE_LOG(logDEBUG) << "Getting file path";
|
||||||
disconnect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir()));
|
disconnect(dispOutputDir, SIGNAL(editingFinished()), this,
|
||||||
try {
|
SLOT(SetOutputDir()));
|
||||||
std::string path = det->getFilePath({comboDetector->currentIndex() - 1}).tsquash("File path is different for all detectors.");
|
try {
|
||||||
dispOutputDir->setText(QString(path.c_str()));
|
std::string path =
|
||||||
} CATCH_DISPLAY ("Could not get file path.", "qTabDataOutput::GetOutputDir")
|
det->getFilePath({comboDetector->currentIndex() - 1})
|
||||||
connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir()));
|
.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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::BrowseOutputDir() {
|
void qTabDataOutput::BrowseOutputDir() {
|
||||||
FILE_LOG(logDEBUG) << "Browsing output directory";
|
FILE_LOG(logDEBUG) << "Browsing output directory";
|
||||||
QString directory = QFileDialog::getExistingDirectory(this, tr("Choose Output Directory "), dispOutputDir->text());
|
QString directory = QFileDialog::getExistingDirectory(
|
||||||
if (!directory.isEmpty())
|
this, tr("Choose Output Directory "), dispOutputDir->text());
|
||||||
dispOutputDir->setText(directory);
|
if (!directory.isEmpty())
|
||||||
|
dispOutputDir->setText(directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::SetOutputDir() {
|
void qTabDataOutput::SetOutputDir() {
|
||||||
QString path = dispOutputDir->text();
|
QString path = dispOutputDir->text();
|
||||||
FILE_LOG(logDEBUG) << "Setting output directory to " << path.toAscii().constData();
|
FILE_LOG(logDEBUG) << "Setting output directory to "
|
||||||
|
<< path.toAscii().constData();
|
||||||
|
|
||||||
// empty
|
// empty
|
||||||
if (path.isEmpty()) {
|
if (path.isEmpty()) {
|
||||||
qDefs::Message(qDefs::WARNING, "Invalid Output Path. Must not be empty.", "qTabDataOutput::SetOutputDir");
|
qDefs::Message(qDefs::WARNING,
|
||||||
FILE_LOG(logWARNING) << "Invalid Output Path. Must not be empty.";
|
"Invalid Output Path. Must not be empty.",
|
||||||
GetOutputDir();
|
"qTabDataOutput::SetOutputDir");
|
||||||
} else {
|
FILE_LOG(logWARNING) << "Invalid Output Path. Must not be empty.";
|
||||||
// chop off trailing '/'
|
GetOutputDir();
|
||||||
if (path.endsWith('/')) {
|
} else {
|
||||||
while (path.endsWith('/')) {
|
// chop off trailing '/'
|
||||||
path.chop(1);
|
if (path.endsWith('/')) {
|
||||||
}
|
while (path.endsWith('/')) {
|
||||||
}
|
path.chop(1);
|
||||||
std::string spath = std::string(path.toAscii().constData());
|
}
|
||||||
try {
|
}
|
||||||
det->setFilePath(spath, {comboDetector->currentIndex() - 1});
|
std::string spath = std::string(path.toAscii().constData());
|
||||||
} CATCH_HANDLE ("Could not set output file path.", "qTabDataOutput::SetOutputDir", this, &qTabDataOutput::GetOutputDir)
|
try {
|
||||||
}
|
det->setFilePath(spath, {comboDetector->currentIndex() - 1});
|
||||||
|
}
|
||||||
|
CATCH_HANDLE("Could not set output file path.",
|
||||||
|
"qTabDataOutput::SetOutputDir", this,
|
||||||
|
&qTabDataOutput::GetOutputDir)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::GetFileFormat() {
|
void qTabDataOutput::GetFileFormat() {
|
||||||
FILE_LOG(logDEBUG) << "Getting File Format";
|
FILE_LOG(logDEBUG) << "Getting File Format";
|
||||||
disconnect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int)));
|
disconnect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this,
|
||||||
try {
|
SLOT(SetFileFormat(int)));
|
||||||
auto retval = det->getFileFormat().tsquash("File format is inconsistent for all detectors.");
|
try {
|
||||||
switch(retval) {
|
auto retval = det->getFileFormat().tsquash(
|
||||||
case slsDetectorDefs::BINARY:
|
"File format is inconsistent for all detectors.");
|
||||||
case slsDetectorDefs::HDF5:
|
switch (retval) {
|
||||||
comboFileFormat->setCurrentIndex(static_cast<int>(retval));
|
case slsDetectorDefs::BINARY:
|
||||||
break;
|
case slsDetectorDefs::HDF5:
|
||||||
default:
|
comboFileFormat->setCurrentIndex(static_cast<int>(retval));
|
||||||
throw sls::RuntimeError(std::string("Unknown file format: ") + std::to_string(static_cast<int>(retval)));
|
break;
|
||||||
|
default:
|
||||||
|
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)));
|
CATCH_DISPLAY("Could not get file format.", "qTabDataOutput::GetFileFormat")
|
||||||
|
connect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(SetFileFormat(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::SetFileFormat(int format) {
|
void qTabDataOutput::SetFileFormat(int format) {
|
||||||
FILE_LOG(logINFO) << "Setting File Format to " << comboFileFormat->currentText().toAscii().data();
|
FILE_LOG(logINFO) << "Setting File Format to "
|
||||||
try {
|
<< comboFileFormat->currentText().toAscii().data();
|
||||||
det->setFileFormat(static_cast<slsDetectorDefs::fileFormat>(comboFileFormat->currentIndex()));
|
try {
|
||||||
} CATCH_HANDLE ("Could not set file format.", "qTabDataOutput::SetFileFormat", this, &qTabDataOutput::GetFileFormat)
|
det->setFileFormat(static_cast<slsDetectorDefs::fileFormat>(
|
||||||
|
comboFileFormat->currentIndex()));
|
||||||
|
}
|
||||||
|
CATCH_HANDLE("Could not set file format.", "qTabDataOutput::SetFileFormat",
|
||||||
|
this, &qTabDataOutput::GetFileFormat)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::GetFileOverwrite() {
|
void qTabDataOutput::GetFileOverwrite() {
|
||||||
FILE_LOG(logDEBUG) << "Getting File Over Write Enable";
|
FILE_LOG(logDEBUG) << "Getting File Over Write Enable";
|
||||||
disconnect(chkOverwriteEnable, SIGNAL(toggled(bool)), this, SLOT(SetOverwriteEnable(bool)));
|
disconnect(chkOverwriteEnable, SIGNAL(toggled(bool)), this,
|
||||||
try {
|
SLOT(SetOverwriteEnable(bool)));
|
||||||
auto retval = det->getFileOverWrite().tsquash("File over write is inconsistent for all detectors.");
|
try {
|
||||||
chkOverwriteEnable->setChecked(retval);
|
auto retval = det->getFileOverWrite().tsquash(
|
||||||
} CATCH_DISPLAY ("Could not get file over write enable.", "qTabDataOutput::GetFileOverwrite")
|
"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)));
|
connect(chkOverwriteEnable, SIGNAL(toggled(bool)), this,
|
||||||
|
SLOT(SetOverwriteEnable(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::SetOverwriteEnable(bool enable) {
|
void qTabDataOutput::SetOverwriteEnable(bool enable) {
|
||||||
FILE_LOG(logINFO) << "Setting File Over Write Enable to " << enable;
|
FILE_LOG(logINFO) << "Setting File Over Write Enable to " << enable;
|
||||||
try {
|
try {
|
||||||
det->setFileOverWrite(enable);
|
det->setFileOverWrite(enable);
|
||||||
} CATCH_HANDLE ("Could not set file over write enable.", "qTabDataOutput::SetOverwriteEnable", this, &qTabDataOutput::GetFileOverwrite)
|
}
|
||||||
|
CATCH_HANDLE("Could not set file over write enable.",
|
||||||
|
"qTabDataOutput::SetOverwriteEnable", this,
|
||||||
|
&qTabDataOutput::GetFileOverwrite)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::GetTenGigaEnable() {
|
void qTabDataOutput::GetTenGigaEnable() {
|
||||||
FILE_LOG(logDEBUG) << "Getting 10GbE enable";
|
FILE_LOG(logDEBUG) << "Getting 10GbE enable";
|
||||||
disconnect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(SetTenGigaEnable(bool)));
|
disconnect(chkTenGiga, SIGNAL(toggled(bool)), this,
|
||||||
try {
|
SLOT(SetTenGigaEnable(bool)));
|
||||||
auto retval = det->getTenGiga().tsquash("10GbE enable is inconsistent for all detectors.");
|
try {
|
||||||
chkTenGiga->setChecked(retval);
|
auto retval = det->getTenGiga().tsquash(
|
||||||
} CATCH_DISPLAY ("Could not get 10GbE enable.", "qTabDataOutput::GetTenGigaEnable")
|
"10GbE enable is inconsistent for all detectors.");
|
||||||
connect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(SetTenGigaEnable(bool)));
|
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) {
|
void qTabDataOutput::SetTenGigaEnable(bool enable) {
|
||||||
FILE_LOG(logINFO) << "Setting 10GbE to " << enable;
|
FILE_LOG(logINFO) << "Setting 10GbE to " << enable;
|
||||||
try {
|
try {
|
||||||
det->setTenGiga(enable);
|
det->setTenGiga(enable);
|
||||||
} CATCH_HANDLE ("Could not set 10GbE enable.", "qTabDataOutput::SetTenGigaEnable", this, &qTabDataOutput::GetTenGigaEnable)
|
}
|
||||||
|
CATCH_HANDLE("Could not set 10GbE enable.",
|
||||||
|
"qTabDataOutput::SetTenGigaEnable", this,
|
||||||
|
&qTabDataOutput::GetTenGigaEnable)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::GetRateCorrection() {
|
void qTabDataOutput::GetRateCorrection() {
|
||||||
FILE_LOG(logDEBUG) << "Getting Rate Correction";
|
FILE_LOG(logDEBUG) << "Getting Rate Correction";
|
||||||
disconnect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection()));
|
disconnect(chkRate, SIGNAL(toggled(bool)), this,
|
||||||
disconnect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection()));
|
SLOT(EnableRateCorrection()));
|
||||||
disconnect(spinCustomDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
|
disconnect(btnGroupRate, SIGNAL(buttonClicked(int)), this,
|
||||||
try {
|
SLOT(SetRateCorrection()));
|
||||||
spinCustomDeadTime->setValue(-1);
|
disconnect(spinCustomDeadTime, SIGNAL(editingFinished()), this,
|
||||||
int64_t retval = det->getRateCorrection().tsquash("Rate correction (enable/tau) is inconsistent for all detectors.").count();
|
SLOT(SetRateCorrection()));
|
||||||
chkRate->setChecked(retval == 0 ? false : true);
|
try {
|
||||||
if (retval != 0)
|
spinCustomDeadTime->setValue(-1);
|
||||||
spinCustomDeadTime->setValue(retval);
|
int64_t retval = det->getRateCorrection()
|
||||||
} CATCH_DISPLAY("Could not get rate correction.", "qTabDataOutput::GetRateCorrection")
|
.tsquash("Rate correction (enable/tau) is "
|
||||||
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection()));
|
"inconsistent for all detectors.")
|
||||||
connect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection()));
|
.count();
|
||||||
connect(spinCustomDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
|
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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::EnableRateCorrection() {
|
void qTabDataOutput::EnableRateCorrection() {
|
||||||
// enable
|
// enable
|
||||||
if (chkRate->isChecked()) {
|
if (chkRate->isChecked()) {
|
||||||
SetRateCorrection();
|
SetRateCorrection();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FILE_LOG(logINFO) << "Disabling Rate correction";
|
FILE_LOG(logINFO) << "Disabling Rate correction";
|
||||||
// disable
|
// disable
|
||||||
try {
|
try {
|
||||||
det->setRateCorrection(sls::ns(0));
|
det->setRateCorrection(sls::ns(0));
|
||||||
} CATCH_HANDLE ("Could not switch off rate correction.", "qTabDataOutput::EnableRateCorrection", this, &qTabDataOutput::GetRateCorrection)
|
}
|
||||||
|
CATCH_HANDLE("Could not switch off rate correction.",
|
||||||
|
"qTabDataOutput::EnableRateCorrection", this,
|
||||||
|
&qTabDataOutput::GetRateCorrection)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::SetRateCorrection() {
|
void qTabDataOutput::SetRateCorrection() {
|
||||||
// do nothing if rate correction is disabled
|
// do nothing if rate correction is disabled
|
||||||
if (!chkRate->isChecked()) {
|
if (!chkRate->isChecked()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// custom dead time
|
// custom dead time
|
||||||
if (radioCustomDeadtime->isChecked()) {
|
if (radioCustomDeadtime->isChecked()) {
|
||||||
int64_t deadtime = spinCustomDeadTime->value();
|
int64_t deadtime = spinCustomDeadTime->value();
|
||||||
FILE_LOG(logINFO) << "Setting Rate Correction with custom dead time: " << deadtime;
|
FILE_LOG(logINFO)
|
||||||
det->setRateCorrection(sls::ns(deadtime));
|
<< "Setting Rate Correction with custom dead time: "
|
||||||
}
|
<< deadtime;
|
||||||
// default dead time
|
det->setRateCorrection(sls::ns(deadtime));
|
||||||
else {
|
}
|
||||||
FILE_LOG(logINFO) << "Setting Rate Correction with default dead time";
|
// default dead time
|
||||||
det->setDefaultRateCorrection();
|
else {
|
||||||
}
|
FILE_LOG(logINFO)
|
||||||
} CATCH_HANDLE ("Could not set rate correction.", "qTabDataOutput::SetRateCorrection", this, &qTabDataOutput::GetRateCorrection)
|
<< "Setting Rate Correction with default dead time";
|
||||||
|
det->setDefaultRateCorrection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CATCH_HANDLE("Could not set rate correction.",
|
||||||
|
"qTabDataOutput::SetRateCorrection", this,
|
||||||
|
&qTabDataOutput::GetRateCorrection)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::GetSpeed() {
|
void qTabDataOutput::GetSpeed() {
|
||||||
FILE_LOG(logDEBUG) << "Getting Speed";
|
FILE_LOG(logDEBUG) << "Getting Speed";
|
||||||
disconnect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed(int)));
|
disconnect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this,
|
||||||
try {
|
SLOT(SetSpeed(int)));
|
||||||
auto retval = det->getSpeed().tsquash("Speed is inconsistent for all detectors.");
|
try {
|
||||||
comboEigerClkDivider->setCurrentIndex(static_cast<int>(retval));
|
auto retval =
|
||||||
} CATCH_DISPLAY ("Could not get speed.", "qTabDataOutput::GetSpeed")
|
det->getSpeed().tsquash("Speed is inconsistent for all detectors.");
|
||||||
connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed(int)));
|
comboEigerClkDivider->setCurrentIndex(static_cast<int>(retval));
|
||||||
|
}
|
||||||
|
CATCH_DISPLAY("Could not get speed.", "qTabDataOutput::GetSpeed")
|
||||||
|
connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(SetSpeed(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::SetSpeed(int speed) {
|
void qTabDataOutput::SetSpeed(int speed) {
|
||||||
FILE_LOG(logINFO) << "Setting Speed to " << comboEigerClkDivider->currentText().toAscii().data();;
|
FILE_LOG(logINFO) << "Setting Speed to "
|
||||||
try {
|
<< comboEigerClkDivider->currentText().toAscii().data();
|
||||||
|
;
|
||||||
|
try {
|
||||||
det->setSpeed(static_cast<slsDetectorDefs::speedLevel>(speed));
|
det->setSpeed(static_cast<slsDetectorDefs::speedLevel>(speed));
|
||||||
} CATCH_HANDLE ("Could not set speed.", "qTabDataOutput::SetSpeed", this, &qTabDataOutput::GetSpeed)
|
}
|
||||||
|
CATCH_HANDLE("Could not set speed.", "qTabDataOutput::SetSpeed", this,
|
||||||
|
&qTabDataOutput::GetSpeed)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::GetFlags() {
|
void qTabDataOutput::GetFlags() {
|
||||||
FILE_LOG(logDEBUG) << "Getting readout flags";
|
FILE_LOG(logDEBUG) << "Getting readout flags";
|
||||||
disconnect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
disconnect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this,
|
||||||
try {
|
SLOT(SetFlags()));
|
||||||
auto retval = det->getParallelMode().tsquash("Parallel Flag is inconsistent for all detectors.");
|
try {
|
||||||
// parallel or non parallel
|
auto retval = det->getParallelMode().tsquash(
|
||||||
if (retval)
|
"Parallel Flag is inconsistent for all detectors.");
|
||||||
comboEigerParallelFlag->setCurrentIndex(PARALLEL);
|
// parallel or non parallel
|
||||||
else
|
if (retval)
|
||||||
comboEigerParallelFlag->setCurrentIndex(NONPARALLEL);
|
comboEigerParallelFlag->setCurrentIndex(PARALLEL);
|
||||||
} CATCH_DISPLAY ("Could not get flags.", "qTabDataOutput::GetFlags")
|
else
|
||||||
connect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
comboEigerParallelFlag->setCurrentIndex(NONPARALLEL);
|
||||||
|
}
|
||||||
|
CATCH_DISPLAY("Could not get flags.", "qTabDataOutput::GetFlags")
|
||||||
|
connect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(SetFlags()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void qTabDataOutput::SetFlags() {
|
void qTabDataOutput::SetFlags() {
|
||||||
auto mode = comboEigerParallelFlag->currentIndex() == PARALLEL ? true : false;
|
auto mode =
|
||||||
try {
|
comboEigerParallelFlag->currentIndex() == PARALLEL ? true : false;
|
||||||
FILE_LOG(logINFO) << "Setting Readout Flags to " << comboEigerParallelFlag->currentText().toAscii().data();
|
try {
|
||||||
det->setParallelMode(mode);
|
FILE_LOG(logINFO)
|
||||||
} CATCH_HANDLE ("Could not set readout flags.", "qTabDataOutput::SetFlags", this, &qTabDataOutput::GetFlags)
|
<< "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() {
|
void qTabDataOutput::Refresh() {
|
||||||
FILE_LOG(logDEBUG) << "**Updating DataOutput Tab";
|
FILE_LOG(logDEBUG) << "**Updating DataOutput Tab";
|
||||||
|
|
||||||
EnableBrowse();
|
EnableBrowse();
|
||||||
GetFileWrite();
|
GetFileWrite();
|
||||||
GetFileName();
|
GetFileName();
|
||||||
GetOutputDir();
|
GetOutputDir();
|
||||||
GetFileOverwrite();
|
GetFileOverwrite();
|
||||||
GetFileFormat();
|
GetFileFormat();
|
||||||
if (chkRate->isEnabled()) {
|
if (chkRate->isEnabled()) {
|
||||||
GetRateCorrection();
|
GetRateCorrection();
|
||||||
}
|
}
|
||||||
if (chkTenGiga->isEnabled()) {
|
if (chkTenGiga->isEnabled()) {
|
||||||
GetTenGigaEnable();
|
GetTenGigaEnable();
|
||||||
}
|
}
|
||||||
if (widgetEiger->isEnabled()) {
|
if (widgetEiger->isEnabled()) {
|
||||||
GetSpeed();
|
GetSpeed();
|
||||||
GetFlags();
|
GetFlags();
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE_LOG(logDEBUG) << "**Updated DataOutput Tab";
|
FILE_LOG(logDEBUG) << "**Updated DataOutput Tab";
|
||||||
}
|
}
|
||||||
|
134
slsDetectorGui/src/qTabDebugging.cpp
Executable file → Normal file
134
slsDetectorGui/src/qTabDebugging.cpp
Executable file → Normal file
@ -9,23 +9,24 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
qTabDebugging::qTabDebugging(QWidget *parent, sls::Detector *detector) :
|
qTabDebugging::qTabDebugging(QWidget *parent, sls::Detector *detector)
|
||||||
QWidget(parent), det(detector), treeDet(nullptr), lblDetectorHostname(nullptr), lblDetectorFirmware(nullptr), lblDetectorSoftware(nullptr) {
|
: QWidget(parent), det(detector), treeDet(nullptr),
|
||||||
|
lblDetectorHostname(nullptr), lblDetectorFirmware(nullptr),
|
||||||
|
lblDetectorSoftware(nullptr) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
SetupWidgetWindow();
|
SetupWidgetWindow();
|
||||||
FILE_LOG(logDEBUG) << "Debugging ready";
|
FILE_LOG(logDEBUG) << "Debugging ready";
|
||||||
}
|
}
|
||||||
|
|
||||||
qTabDebugging::~qTabDebugging() {
|
qTabDebugging::~qTabDebugging() {
|
||||||
delete treeDet;
|
delete treeDet;
|
||||||
delete lblDetectorHostname;
|
delete lblDetectorHostname;
|
||||||
delete lblDetectorFirmware;
|
delete lblDetectorFirmware;
|
||||||
delete lblDetectorSoftware;
|
delete lblDetectorSoftware;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void qTabDebugging::SetupWidgetWindow() {
|
void qTabDebugging::SetupWidgetWindow() {
|
||||||
// enabling according to det type
|
// enabling according to det type
|
||||||
if (det->getDetectorType().squash() == slsDetectorDefs::EIGER) {
|
if (det->getDetectorType().squash() == slsDetectorDefs::EIGER) {
|
||||||
lblDetector->setText("Half Module:");
|
lblDetector->setText("Half Module:");
|
||||||
chkDetectorFirmware->setEnabled(false);
|
chkDetectorFirmware->setEnabled(false);
|
||||||
@ -40,19 +41,19 @@ void qTabDebugging::SetupWidgetWindow() {
|
|||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void qTabDebugging::Initialization() {
|
void qTabDebugging::Initialization() {
|
||||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(GetDetectorStatus()));
|
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(GetDetectorStatus()));
|
||||||
connect(btnGetInfo, SIGNAL(clicked()), this, SLOT(GetInfo()));
|
connect(btnGetInfo, SIGNAL(clicked()), this, SLOT(GetInfo()));
|
||||||
if (btnTest ->isEnabled()) {
|
if (btnTest->isEnabled()) {
|
||||||
connect(btnTest, SIGNAL(clicked()), this, SLOT(TestDetector()));
|
connect(btnTest, SIGNAL(clicked()), this, SLOT(TestDetector()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDebugging::PopulateDetectors() {
|
void qTabDebugging::PopulateDetectors() {
|
||||||
FILE_LOG(logDEBUG) << "Populating detectors";
|
FILE_LOG(logDEBUG) << "Populating detectors";
|
||||||
|
|
||||||
comboDetector->clear();
|
comboDetector->clear();
|
||||||
auto res = det->getHostname();
|
auto res = det->getHostname();
|
||||||
for (auto &it : res) {
|
for (auto &it : res) {
|
||||||
comboDetector->addItem(QString(it.c_str()));
|
comboDetector->addItem(QString(it.c_str()));
|
||||||
@ -62,13 +63,15 @@ void qTabDebugging::PopulateDetectors() {
|
|||||||
void qTabDebugging::GetDetectorStatus() {
|
void qTabDebugging::GetDetectorStatus() {
|
||||||
FILE_LOG(logDEBUG) << "Getting Status";
|
FILE_LOG(logDEBUG) << "Getting Status";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
std::string status = sls::ToString(det->getDetectorStatus({comboDetector->currentIndex()})[0]);
|
std::string status = sls::ToString(
|
||||||
|
det->getDetectorStatus({comboDetector->currentIndex()})[0]);
|
||||||
lblStatus->setText(QString(status.c_str()).toUpper());
|
lblStatus->setText(QString(status.c_str()).toUpper());
|
||||||
} CATCH_DISPLAY ("Could not get detector status.", "qTabDebugging::GetDetectorStatus")
|
}
|
||||||
|
CATCH_DISPLAY("Could not get detector status.",
|
||||||
|
"qTabDebugging::GetDetectorStatus")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void qTabDebugging::GetInfo() {
|
void qTabDebugging::GetInfo() {
|
||||||
FILE_LOG(logDEBUG) << "Getting Readout Info";
|
FILE_LOG(logDEBUG) << "Getting Readout Info";
|
||||||
|
|
||||||
@ -83,67 +86,83 @@ void qTabDebugging::GetInfo() {
|
|||||||
lblDetectorHostname = new QLabel("");
|
lblDetectorHostname = new QLabel("");
|
||||||
lblDetectorFirmware = new QLabel("");
|
lblDetectorFirmware = new QLabel("");
|
||||||
lblDetectorSoftware = new QLabel("");
|
lblDetectorSoftware = new QLabel("");
|
||||||
//to make sure the size is constant
|
// to make sure the size is constant
|
||||||
lblDetectorFirmware->setFixedWidth(100);
|
lblDetectorFirmware->setFixedWidth(100);
|
||||||
layout->addWidget(dispFrame, 0, 1);
|
layout->addWidget(dispFrame, 0, 1);
|
||||||
QString detName = QString(sls::ToString(det->getDetectorType().squash()).c_str());
|
QString detName =
|
||||||
|
QString(sls::ToString(det->getDetectorType().squash()).c_str());
|
||||||
|
|
||||||
switch (det->getDetectorType().squash()) {
|
switch (det->getDetectorType().squash()) {
|
||||||
|
|
||||||
case slsDetectorDefs::EIGER:
|
case slsDetectorDefs::EIGER:
|
||||||
formLayout->addWidget(new QLabel("Half Module:"), 0, 0);
|
formLayout->addWidget(new QLabel("Half Module:"), 0, 0);
|
||||||
formLayout->addItem(new QSpacerItem(15, 20, QSizePolicy::Fixed, QSizePolicy::Fixed), 0, 1);
|
formLayout->addItem(
|
||||||
|
new QSpacerItem(15, 20, QSizePolicy::Fixed, QSizePolicy::Fixed), 0,
|
||||||
|
1);
|
||||||
formLayout->addWidget(lblDetectorHostname, 0, 2);
|
formLayout->addWidget(lblDetectorHostname, 0, 2);
|
||||||
formLayout->addWidget(new QLabel("Half Module Firmware Version:"), 1, 0);
|
formLayout->addWidget(new QLabel("Half Module Firmware Version:"), 1,
|
||||||
|
0);
|
||||||
formLayout->addWidget(lblDetectorFirmware, 1, 2);
|
formLayout->addWidget(lblDetectorFirmware, 1, 2);
|
||||||
formLayout->addWidget(new QLabel("Half Module Software Version:"), 2, 0);
|
formLayout->addWidget(new QLabel("Half Module Software Version:"), 2,
|
||||||
|
0);
|
||||||
formLayout->addWidget(lblDetectorSoftware, 2, 2);
|
formLayout->addWidget(lblDetectorSoftware, 2, 2);
|
||||||
treeDet->setHeaderLabel("Eiger Detector");
|
treeDet->setHeaderLabel("Eiger Detector");
|
||||||
//get num modules
|
// get num modules
|
||||||
for (int i = 0; i < comboDetector->count() / 2; ++i)
|
for (int i = 0; i < comboDetector->count() / 2; ++i)
|
||||||
items.append(new QTreeWidgetItem((QTreeWidget *)0, QStringList(QString("Module %1").arg(i))));
|
items.append(new QTreeWidgetItem(
|
||||||
|
(QTreeWidget *)0, QStringList(QString("Module %1").arg(i))));
|
||||||
treeDet->insertTopLevelItems(0, items);
|
treeDet->insertTopLevelItems(0, items);
|
||||||
//gets det names
|
// gets det names
|
||||||
for (int i = 0; i < comboDetector->count(); ++i) {
|
for (int i = 0; i < comboDetector->count(); ++i) {
|
||||||
QList<QTreeWidgetItem *> childItems;
|
QList<QTreeWidgetItem *> childItems;
|
||||||
childItems.append(new QTreeWidgetItem((QTreeWidget *)0, QStringList(QString("Half Module (%1)").arg(comboDetector->itemText(i)))));
|
childItems.append(new QTreeWidgetItem(
|
||||||
|
(QTreeWidget *)0,
|
||||||
|
QStringList(QString("Half Module (%1)")
|
||||||
|
.arg(comboDetector->itemText(i)))));
|
||||||
treeDet->topLevelItem(i * 2)->insertChildren(0, childItems);
|
treeDet->topLevelItem(i * 2)->insertChildren(0, childItems);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
formLayout->addWidget(new QLabel("Module:"), 0, 0);
|
formLayout->addWidget(new QLabel("Module:"), 0, 0);
|
||||||
formLayout->addItem(new QSpacerItem(15, 20, QSizePolicy::Fixed, QSizePolicy::Fixed), 0, 1);
|
formLayout->addItem(
|
||||||
|
new QSpacerItem(15, 20, QSizePolicy::Fixed, QSizePolicy::Fixed), 0,
|
||||||
|
1);
|
||||||
formLayout->addWidget(lblDetectorHostname, 0, 2);
|
formLayout->addWidget(lblDetectorHostname, 0, 2);
|
||||||
formLayout->addWidget(new QLabel("Module Firmware Version:"), 1, 0);
|
formLayout->addWidget(new QLabel("Module Firmware Version:"), 1, 0);
|
||||||
formLayout->addWidget(lblDetectorFirmware, 1, 2);
|
formLayout->addWidget(lblDetectorFirmware, 1, 2);
|
||||||
formLayout->addWidget(new QLabel("Module Software Version:"), 2, 0);
|
formLayout->addWidget(new QLabel("Module Software Version:"), 2, 0);
|
||||||
formLayout->addWidget(lblDetectorSoftware, 2, 2);
|
formLayout->addWidget(lblDetectorSoftware, 2, 2);
|
||||||
treeDet->setHeaderLabel(QString(detName + " Detector"));
|
treeDet->setHeaderLabel(QString(detName + " Detector"));
|
||||||
//gets det names
|
// gets det names
|
||||||
for (int i = 0; i < comboDetector->count(); ++i)
|
for (int i = 0; i < comboDetector->count(); ++i)
|
||||||
items.append(new QTreeWidgetItem((QTreeWidget *)0, QStringList(QString("Module (%1)").arg(comboDetector->itemText(i)))));
|
items.append(new QTreeWidgetItem(
|
||||||
|
(QTreeWidget *)0,
|
||||||
|
QStringList(
|
||||||
|
QString("Module (%1)").arg(comboDetector->itemText(i)))));
|
||||||
treeDet->insertTopLevelItems(0, items);
|
treeDet->insertTopLevelItems(0, items);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//show and center widget
|
// show and center widget
|
||||||
int x = ((parentWidget()->width()) - (popup1->frameGeometry().width())) / 2;
|
int x = ((parentWidget()->width()) - (popup1->frameGeometry().width())) / 2;
|
||||||
int y = ((parentWidget()->height()) - (popup1->frameGeometry().height())) / 2;
|
int y =
|
||||||
|
((parentWidget()->height()) - (popup1->frameGeometry().height())) / 2;
|
||||||
QDesktopWidget *desktop = QApplication::desktop();
|
QDesktopWidget *desktop = QApplication::desktop();
|
||||||
int screen = desktop->screenNumber(this);
|
int screen = desktop->screenNumber(this);
|
||||||
popup1->setWindowModality(Qt::WindowModal);
|
popup1->setWindowModality(Qt::WindowModal);
|
||||||
popup1->move((desktop->screenGeometry(screen).x()) + x, (desktop->screenGeometry(screen).y()) + y);
|
popup1->move((desktop->screenGeometry(screen).x()) + x,
|
||||||
|
(desktop->screenGeometry(screen).y()) + y);
|
||||||
popup1->show();
|
popup1->show();
|
||||||
|
|
||||||
//put the first parameters
|
// put the first parameters
|
||||||
SetParameters(treeDet->topLevelItem(0));
|
SetParameters(treeDet->topLevelItem(0));
|
||||||
|
|
||||||
// connect to slots
|
// connect to slots
|
||||||
connect(treeDet, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(SetParameters(QTreeWidgetItem *)));
|
connect(treeDet, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this,
|
||||||
|
SLOT(SetParameters(QTreeWidgetItem *)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void qTabDebugging::SetParameters(QTreeWidgetItem *item) {
|
void qTabDebugging::SetParameters(QTreeWidgetItem *item) {
|
||||||
// eiger: if half module clicked, others: true always
|
// eiger: if half module clicked, others: true always
|
||||||
bool ignoreOrHalfModuleClicked = true;
|
bool ignoreOrHalfModuleClicked = true;
|
||||||
@ -160,11 +179,17 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
auto retval = std::string("0x") + std::to_string((unsigned long)det->getFirmwareVersion({comboDetector->currentIndex()})[0]);
|
auto retval = std::string("0x") +
|
||||||
|
std::to_string((unsigned long)det->getFirmwareVersion(
|
||||||
|
{comboDetector->currentIndex()})[0]);
|
||||||
lblDetectorFirmware->setText(QString(retval.c_str()));
|
lblDetectorFirmware->setText(QString(retval.c_str()));
|
||||||
retval = std::string("0x") + std::to_string((unsigned long)det->getDetectorServerVersion({comboDetector->currentIndex()})[0]);
|
retval =
|
||||||
|
std::string("0x") +
|
||||||
|
std::to_string((unsigned long)det->getDetectorServerVersion(
|
||||||
|
{comboDetector->currentIndex()})[0]);
|
||||||
lblDetectorSoftware->setText(QString(retval.c_str()));
|
lblDetectorSoftware->setText(QString(retval.c_str()));
|
||||||
} CATCH_DISPLAY ("Could not get versions.", "qTabDebugging::SetParameters")
|
}
|
||||||
|
CATCH_DISPLAY("Could not get versions.", "qTabDebugging::SetParameters")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,35 +203,42 @@ void qTabDebugging::TestDetector() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// construct message
|
// construct message
|
||||||
QString message = QString("<nobr>Test Results for %1:</nobr><br><br>").arg(comboDetector->currentText());
|
QString message = QString("<nobr>Test Results for %1:</nobr><br><br>")
|
||||||
|
.arg(comboDetector->currentText());
|
||||||
|
|
||||||
//detector firmware
|
// detector firmware
|
||||||
if (chkDetectorFirmware->isChecked()) {
|
if (chkDetectorFirmware->isChecked()) {
|
||||||
try {
|
try {
|
||||||
det->executeFirmwareTest({comboDetector->currentIndex()});
|
det->executeFirmwareTest({comboDetector->currentIndex()});
|
||||||
message.append(QString("<nobr>%1 Firmware: PASS</nobr><br>").arg(moduleName));
|
message.append(QString("<nobr>%1 Firmware: PASS</nobr><br>")
|
||||||
|
.arg(moduleName));
|
||||||
FILE_LOG(logINFO) << "Detector Firmware Test: Pass";
|
FILE_LOG(logINFO) << "Detector Firmware Test: Pass";
|
||||||
} CATCH_DISPLAY ("Firmware test failed.", "qTabDebugging::TestDetector")
|
}
|
||||||
|
CATCH_DISPLAY("Firmware test failed.",
|
||||||
|
"qTabDebugging::TestDetector")
|
||||||
}
|
}
|
||||||
|
|
||||||
//detector CPU-FPGA bus
|
// detector CPU-FPGA bus
|
||||||
if (chkDetectorBus->isChecked()) {
|
if (chkDetectorBus->isChecked()) {
|
||||||
try {
|
try {
|
||||||
det->executeBusTest({comboDetector->currentIndex()});
|
det->executeBusTest({comboDetector->currentIndex()});
|
||||||
message.append(QString("<nobr>%1 Bus: PASS</nobr><br>").arg(moduleName));
|
message.append(
|
||||||
|
QString("<nobr>%1 Bus: PASS</nobr><br>").arg(moduleName));
|
||||||
FILE_LOG(logINFO) << "Detector Bus Test: Pass";
|
FILE_LOG(logINFO) << "Detector Bus Test: Pass";
|
||||||
} CATCH_DISPLAY ("Bus test failed.", "qTabDebugging::TestDetector")
|
}
|
||||||
|
CATCH_DISPLAY("Bus test failed.", "qTabDebugging::TestDetector")
|
||||||
}
|
}
|
||||||
|
|
||||||
//display message
|
// display message
|
||||||
qDefs::Message(qDefs::INFORMATION, message.toAscii().constData(), "qTabDebugging::TestDetector");
|
qDefs::Message(qDefs::INFORMATION, message.toAscii().constData(),
|
||||||
} CATCH_DISPLAY ("Could not execute digital test.", "qTabDebugging::TestDetector")
|
"qTabDebugging::TestDetector");
|
||||||
|
}
|
||||||
|
CATCH_DISPLAY("Could not execute digital test.",
|
||||||
|
"qTabDebugging::TestDetector")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void qTabDebugging::Refresh() {
|
void qTabDebugging::Refresh() {
|
||||||
FILE_LOG(logDEBUG) << "**Updating Debugging Tab";
|
FILE_LOG(logDEBUG) << "**Updating Debugging Tab";
|
||||||
GetDetectorStatus();
|
GetDetectorStatus();
|
||||||
FILE_LOG(logDEBUG) << "**Updated Debugging Tab";
|
FILE_LOG(logDEBUG) << "**Updated Debugging Tab";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
976
slsDetectorGui/src/qTabDeveloper.cpp
Executable file → Normal file
976
slsDetectorGui/src/qTabDeveloper.cpp
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
1209
slsDetectorGui/src/qTabMeasurement.cpp
Executable file → Normal file
1209
slsDetectorGui/src/qTabMeasurement.cpp
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
72
slsDetectorGui/src/qTabMessages.cpp
Executable file → Normal file
72
slsDetectorGui/src/qTabMessages.cpp
Executable file → Normal file
@ -1,12 +1,12 @@
|
|||||||
#include "qTabMessages.h"
|
#include "qTabMessages.h"
|
||||||
#include "qDefs.h"
|
#include "qDefs.h"
|
||||||
|
|
||||||
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QTextStream>
|
|
||||||
#include <QDir>
|
|
||||||
#include <QProcess>
|
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QTextStream>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -37,32 +37,32 @@ void qTabMessages::Initialization() {
|
|||||||
connect(dispCommand, SIGNAL(returnPressed()), this, SLOT(ExecuteCommand()));
|
connect(dispCommand, SIGNAL(returnPressed()), this, SLOT(ExecuteCommand()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabMessages::keyPressEvent(QKeyEvent* event) {
|
void qTabMessages::keyPressEvent(QKeyEvent *event) {
|
||||||
//cout<<"inside KeyPressEvent()\n";
|
// cout<<"inside KeyPressEvent()\n";
|
||||||
if (event->key() == Qt::Key_Up) {
|
if (event->key() == Qt::Key_Up) {
|
||||||
GetLastCommand();
|
GetLastCommand();
|
||||||
}
|
} else if (event->key() == Qt::Key_Down) {
|
||||||
else if (event->key() == Qt::Key_Down) {
|
|
||||||
ClearCommand();
|
ClearCommand();
|
||||||
}
|
}
|
||||||
/* else if((event->key() == Qt::Key_Return) ||(event->key() == Qt::Key_Enter)) {
|
/* else if((event->key() == Qt::Key_Return) ||(event->key() ==
|
||||||
ExecuteCommand();
|
Qt::Key_Enter)) { ExecuteCommand();
|
||||||
}*/ else {
|
}*/
|
||||||
event->ignore();
|
else {
|
||||||
|
event->ignore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabMessages::PrintNextLine() {
|
void qTabMessages::PrintNextLine() {
|
||||||
dispLog->append(QString("<font color = \"DarkGrey\">") + QDir::current().dirName() + QString("$ ") + QString("</font>"));
|
dispLog->append(QString("<font color = \"DarkGrey\">") +
|
||||||
|
QDir::current().dirName() + QString("$ ") +
|
||||||
|
QString("</font>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabMessages::GetLastCommand() {
|
void qTabMessages::GetLastCommand() {
|
||||||
dispCommand->setText(lastCommand.join(" "));
|
dispCommand->setText(lastCommand.join(" "));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabMessages::ClearCommand() {
|
void qTabMessages::ClearCommand() { dispCommand->setText(""); }
|
||||||
dispCommand->setText("");
|
|
||||||
}
|
|
||||||
|
|
||||||
void qTabMessages::ExecuteCommand() {
|
void qTabMessages::ExecuteCommand() {
|
||||||
QStringList param = dispCommand->text().split(" ");
|
QStringList param = dispCommand->text().split(" ");
|
||||||
@ -70,16 +70,19 @@ void qTabMessages::ExecuteCommand() {
|
|||||||
lastCommand += param;
|
lastCommand += param;
|
||||||
dispCommand->clear();
|
dispCommand->clear();
|
||||||
// appending command to log without newline
|
// appending command to log without newline
|
||||||
dispLog->moveCursor (QTextCursor::End);
|
dispLog->moveCursor(QTextCursor::End);
|
||||||
dispLog->insertHtml(QString("<font color = \"DarkBlue\">") + param.join(" ") + QString("</font>"));
|
dispLog->insertHtml(QString("<font color = \"DarkBlue\">") +
|
||||||
|
param.join(" ") + QString("</font>"));
|
||||||
|
|
||||||
QString command = param.at(0);
|
QString command = param.at(0);
|
||||||
param.removeFirst();
|
param.removeFirst();
|
||||||
FILE_LOG(logINFO) << "Executing Command:[" << command.toAscii().constData() << "] with Arguments:[" << param.join(" ").toAscii().constData() << "]";
|
FILE_LOG(logINFO) << "Executing Command:[" << command.toAscii().constData()
|
||||||
|
<< "] with Arguments:["
|
||||||
|
<< param.join(" ").toAscii().constData() << "]";
|
||||||
|
|
||||||
process->setProcessChannelMode(QProcess::MergedChannels);
|
process->setProcessChannelMode(QProcess::MergedChannels);
|
||||||
process->start(command, param);
|
process->start(command, param);
|
||||||
if(!process->waitForFinished()) {
|
if (!process->waitForFinished()) {
|
||||||
AppendError();
|
AppendError();
|
||||||
} else {
|
} else {
|
||||||
AppendOutput();
|
AppendOutput();
|
||||||
@ -89,34 +92,40 @@ void qTabMessages::ExecuteCommand() {
|
|||||||
void qTabMessages::AppendOutput() {
|
void qTabMessages::AppendOutput() {
|
||||||
QByteArray result = process->readAll();
|
QByteArray result = process->readAll();
|
||||||
result.replace("\n", "<br>");
|
result.replace("\n", "<br>");
|
||||||
dispLog->append(QString("<font color = \"DarkBlue\">") + result + QString("</font>"));
|
dispLog->append(QString("<font color = \"DarkBlue\">") + result +
|
||||||
|
QString("</font>"));
|
||||||
FILE_LOG(logDEBUG) << "Command executed successfully";
|
FILE_LOG(logDEBUG) << "Command executed successfully";
|
||||||
PrintNextLine();
|
PrintNextLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabMessages::AppendError() {
|
void qTabMessages::AppendError() {
|
||||||
dispLog->append(QString("<font color = \"Red\">") + process->errorString() + QString("</font>"));
|
dispLog->append(QString("<font color = \"Red\">") + process->errorString() +
|
||||||
|
QString("</font>"));
|
||||||
FILE_LOG(logERROR) << "Error executing command";
|
FILE_LOG(logERROR) << "Error executing command";
|
||||||
PrintNextLine();
|
PrintNextLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void qTabMessages::SaveLog() {
|
void qTabMessages::SaveLog() {
|
||||||
QString fName = QDir::cleanPath(QDir::currentPath()) + "/LogFile.txt";
|
QString fName = QDir::cleanPath(QDir::currentPath()) + "/LogFile.txt";
|
||||||
fName = QFileDialog::getSaveFileName(this, tr("Save Snapshot "),
|
fName =
|
||||||
fName, tr("Text files (*.txt);;All Files(*)"));
|
QFileDialog::getSaveFileName(this, tr("Save Snapshot "), fName,
|
||||||
|
tr("Text files (*.txt);;All Files(*)"));
|
||||||
if (!fName.isEmpty()) {
|
if (!fName.isEmpty()) {
|
||||||
QFile outfile;
|
QFile outfile;
|
||||||
outfile.setFileName(fName);
|
outfile.setFileName(fName);
|
||||||
if (outfile.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
if (outfile.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||||
QTextStream out(&outfile);
|
QTextStream out(&outfile);
|
||||||
out << dispLog->toPlainText() << endl;
|
out << dispLog->toPlainText() << endl;
|
||||||
std::string mess = std::string("The Log has been successfully saved to ") + fName.toAscii().constData();
|
std::string mess =
|
||||||
|
std::string("The Log has been successfully saved to ") +
|
||||||
|
fName.toAscii().constData();
|
||||||
qDefs::Message(qDefs::INFORMATION, mess, "TabMessages::SaveLog");
|
qDefs::Message(qDefs::INFORMATION, mess, "TabMessages::SaveLog");
|
||||||
FILE_LOG(logINFO) << mess;
|
FILE_LOG(logINFO) << mess;
|
||||||
} else {
|
} else {
|
||||||
FILE_LOG(logWARNING) << "Attempt to save log file failed: " << fName.toAscii().constData();
|
FILE_LOG(logWARNING) << "Attempt to save log file failed: "
|
||||||
qDefs::Message(qDefs::WARNING, "Attempt to save log file failed.", "qTabMessages::SaveLog");
|
<< fName.toAscii().constData();
|
||||||
|
qDefs::Message(qDefs::WARNING, "Attempt to save log file failed.",
|
||||||
|
"qTabMessages::SaveLog");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dispCommand->setFocus();
|
dispCommand->setFocus();
|
||||||
@ -133,4 +142,3 @@ void qTabMessages::Refresh() {
|
|||||||
dispCommand->clear();
|
dispCommand->clear();
|
||||||
dispCommand->setFocus();
|
dispCommand->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
390
slsDetectorGui/src/qTabPlot.cpp
Executable file → Normal file
390
slsDetectorGui/src/qTabPlot.cpp
Executable file → Normal file
@ -2,10 +2,10 @@
|
|||||||
#include "qDefs.h"
|
#include "qDefs.h"
|
||||||
#include "qDrawPlot.h"
|
#include "qDrawPlot.h"
|
||||||
|
|
||||||
#include <QStandardItemModel>
|
|
||||||
#include <QStackedLayout>
|
|
||||||
#include <QButtonGroup>
|
|
||||||
#include <QAbstractButton>
|
#include <QAbstractButton>
|
||||||
|
#include <QButtonGroup>
|
||||||
|
#include <QStackedLayout>
|
||||||
|
#include <QStandardItemModel>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@ -18,17 +18,14 @@ QString qTabPlot::defaultImageXAxisTitle("Pixel");
|
|||||||
QString qTabPlot::defaultImageYAxisTitle("Pixel");
|
QString qTabPlot::defaultImageYAxisTitle("Pixel");
|
||||||
QString qTabPlot::defaultImageZAxisTitle("Intensity");
|
QString qTabPlot::defaultImageZAxisTitle("Intensity");
|
||||||
|
|
||||||
|
qTabPlot::qTabPlot(QWidget *parent, sls::Detector *detector, qDrawPlot *p)
|
||||||
qTabPlot::qTabPlot(QWidget *parent, sls::Detector *detector, qDrawPlot *p) :
|
: QWidget(parent), det(detector), plot(p), is1d(false) {
|
||||||
QWidget(parent), det(detector), plot(p), is1d(false) {
|
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
SetupWidgetWindow();
|
SetupWidgetWindow();
|
||||||
FILE_LOG(logDEBUG) << "Plot ready";
|
FILE_LOG(logDEBUG) << "Plot ready";
|
||||||
}
|
}
|
||||||
|
|
||||||
qTabPlot::~qTabPlot() {
|
qTabPlot::~qTabPlot() { delete btnGroupPlotType; }
|
||||||
delete btnGroupPlotType;
|
|
||||||
}
|
|
||||||
|
|
||||||
void qTabPlot::SetupWidgetWindow() {
|
void qTabPlot::SetupWidgetWindow() {
|
||||||
// button group for plot type
|
// button group for plot type
|
||||||
@ -56,27 +53,27 @@ void qTabPlot::SetupWidgetWindow() {
|
|||||||
|
|
||||||
// enabling according to det type
|
// enabling according to det type
|
||||||
is1d = false;
|
is1d = false;
|
||||||
switch(det->getDetectorType().squash()) {
|
switch (det->getDetectorType().squash()) {
|
||||||
case slsDetectorDefs::GOTTHARD:
|
case slsDetectorDefs::GOTTHARD:
|
||||||
case slsDetectorDefs::MYTHEN3:
|
case slsDetectorDefs::MYTHEN3:
|
||||||
is1d = true;
|
is1d = true;
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::GOTTHARD2:
|
case slsDetectorDefs::GOTTHARD2:
|
||||||
is1d = true;
|
is1d = true;
|
||||||
chkGainPlot1D->setEnabled(true);
|
chkGainPlot1D->setEnabled(true);
|
||||||
chkGainPlot1D->setChecked(true);
|
chkGainPlot1D->setChecked(true);
|
||||||
plot->EnableGainPlot(true);
|
plot->EnableGainPlot(true);
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::EIGER:
|
case slsDetectorDefs::EIGER:
|
||||||
chkGapPixels->setEnabled(true);
|
chkGapPixels->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::JUNGFRAU:
|
case slsDetectorDefs::JUNGFRAU:
|
||||||
chkGainPlot->setEnabled(true);
|
chkGainPlot->setEnabled(true);
|
||||||
chkGainPlot->setChecked(true);
|
chkGainPlot->setChecked(true);
|
||||||
plot->EnableGainPlot(true);
|
plot->EnableGainPlot(true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Select1DPlot(is1d);
|
Select1DPlot(is1d);
|
||||||
@ -86,58 +83,78 @@ void qTabPlot::SetupWidgetWindow() {
|
|||||||
|
|
||||||
void qTabPlot::Initialization() {
|
void qTabPlot::Initialization() {
|
||||||
// Plot arguments box
|
// Plot arguments box
|
||||||
connect(btnGroupPlotType, SIGNAL(buttonClicked(int)), this, SLOT(SetPlot()));
|
connect(btnGroupPlotType, SIGNAL(buttonClicked(int)), this,
|
||||||
|
SLOT(SetPlot()));
|
||||||
|
|
||||||
// Plotting frequency box
|
// Plotting frequency box
|
||||||
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this,
|
||||||
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
SLOT(SetStreamingFrequency()));
|
||||||
connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||||
connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
SLOT(SetStreamingFrequency()));
|
||||||
|
connect(spinTimeGap, SIGNAL(editingFinished()), this,
|
||||||
|
SLOT(SetStreamingFrequency()));
|
||||||
|
connect(spinNthFrame, SIGNAL(editingFinished()), this,
|
||||||
|
SLOT(SetStreamingFrequency()));
|
||||||
|
|
||||||
// navigation buttons for options
|
// navigation buttons for options
|
||||||
connect(btnRight1D, SIGNAL(clicked()), this, SLOT(Set1DPlotOptionsRight()));
|
connect(btnRight1D, SIGNAL(clicked()), this, SLOT(Set1DPlotOptionsRight()));
|
||||||
connect(btnLeft1D, SIGNAL(clicked()), this, SLOT(Set1DPlotOptionsLeft()));
|
connect(btnLeft1D, SIGNAL(clicked()), this, SLOT(Set1DPlotOptionsLeft()));
|
||||||
connect(btnRight2D, SIGNAL(clicked()), this, SLOT(Set2DPlotOptionsRight()));
|
connect(btnRight2D, SIGNAL(clicked()), this, SLOT(Set2DPlotOptionsRight()));
|
||||||
connect(btnLeft2D, SIGNAL(clicked()), this, SLOT(Set2DPlotOptionsLeft()));
|
connect(btnLeft2D, SIGNAL(clicked()), this, SLOT(Set2DPlotOptionsLeft()));
|
||||||
|
|
||||||
// 1D options
|
// 1D options
|
||||||
connect(chkSuperimpose, SIGNAL(toggled(bool)), this, SLOT(EnablePersistency(bool)));
|
connect(chkSuperimpose, SIGNAL(toggled(bool)), this,
|
||||||
connect(spinPersistency, SIGNAL(valueChanged(int)), plot, SLOT(SetPersistency(int)));
|
SLOT(EnablePersistency(bool)));
|
||||||
|
connect(spinPersistency, SIGNAL(valueChanged(int)), plot,
|
||||||
|
SLOT(SetPersistency(int)));
|
||||||
connect(chkPoints, SIGNAL(toggled(bool)), plot, SLOT(SetMarkers(bool)));
|
connect(chkPoints, SIGNAL(toggled(bool)), plot, SLOT(SetMarkers(bool)));
|
||||||
connect(chkLines, SIGNAL(toggled(bool)), plot, SLOT(SetLines(bool)));
|
connect(chkLines, SIGNAL(toggled(bool)), plot, SLOT(SetLines(bool)));
|
||||||
connect(chk1DLog, SIGNAL(toggled(bool)), plot, SLOT(Set1dLogY(bool)));
|
connect(chk1DLog, SIGNAL(toggled(bool)), plot, SLOT(Set1dLogY(bool)));
|
||||||
connect(chkStatistics, SIGNAL(toggled(bool)), plot, SLOT(DisplayStatistics(bool)));
|
connect(chkStatistics, SIGNAL(toggled(bool)), plot,
|
||||||
|
SLOT(DisplayStatistics(bool)));
|
||||||
|
|
||||||
// 2D Plot box
|
// 2D Plot box
|
||||||
connect(chkInterpolate, SIGNAL(toggled(bool)), plot, SLOT(SetInterpolate(bool)));
|
connect(chkInterpolate, SIGNAL(toggled(bool)), plot,
|
||||||
|
SLOT(SetInterpolate(bool)));
|
||||||
connect(chkContour, SIGNAL(toggled(bool)), plot, SLOT(SetContour(bool)));
|
connect(chkContour, SIGNAL(toggled(bool)), plot, SLOT(SetContour(bool)));
|
||||||
connect(chkLogz, SIGNAL(toggled(bool)), plot, SLOT(SetLogz(bool)));
|
connect(chkLogz, SIGNAL(toggled(bool)), plot, SLOT(SetLogz(bool)));
|
||||||
connect(chkStatistics_2, SIGNAL(toggled(bool)), plot, SLOT(DisplayStatistics(bool)));
|
connect(chkStatistics_2, SIGNAL(toggled(bool)), plot,
|
||||||
//pedstal
|
SLOT(DisplayStatistics(bool)));
|
||||||
|
// pedstal
|
||||||
connect(chkPedestal, SIGNAL(toggled(bool)), plot, SLOT(SetPedestal(bool)));
|
connect(chkPedestal, SIGNAL(toggled(bool)), plot, SLOT(SetPedestal(bool)));
|
||||||
connect(btnRecalPedestal, SIGNAL(clicked()), plot, SLOT(RecalculatePedestal()));
|
connect(btnRecalPedestal, SIGNAL(clicked()), plot,
|
||||||
connect(chkPedestal_2, SIGNAL(toggled(bool)), plot, SLOT(SetPedestal(bool)));
|
SLOT(RecalculatePedestal()));
|
||||||
connect(btnRecalPedestal_2, SIGNAL(clicked()), plot, SLOT(RecalculatePedestal()));
|
connect(chkPedestal_2, SIGNAL(toggled(bool)), plot,
|
||||||
//accumulate
|
SLOT(SetPedestal(bool)));
|
||||||
connect(chkAccumulate, SIGNAL(toggled(bool)), plot, SLOT(SetAccumulate(bool)));
|
connect(btnRecalPedestal_2, SIGNAL(clicked()), plot,
|
||||||
connect(btnResetAccumulate, SIGNAL(clicked()), plot, SLOT(ResetAccumulate()));
|
SLOT(RecalculatePedestal()));
|
||||||
connect(chkAccumulate_2, SIGNAL(toggled(bool)), plot, SLOT(SetAccumulate(bool)));
|
// accumulate
|
||||||
connect(btnResetAccumulate_2, SIGNAL(clicked()), plot, SLOT(ResetAccumulate()));
|
connect(chkAccumulate, SIGNAL(toggled(bool)), plot,
|
||||||
//binary
|
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, SIGNAL(toggled(bool)), this, SLOT(SetBinary()));
|
||||||
connect(chkBinary_2, SIGNAL(toggled(bool)), this, SLOT(SetBinary()));
|
connect(chkBinary_2, SIGNAL(toggled(bool)), this, SLOT(SetBinary()));
|
||||||
connect(spinFrom, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
|
connect(spinFrom, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
|
||||||
connect(spinFrom_2, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
|
connect(spinFrom_2, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
|
||||||
connect(spinTo, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
|
connect(spinTo, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
|
||||||
connect(spinTo_2, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
|
connect(spinTo_2, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
|
||||||
//gainplot
|
// gainplot
|
||||||
if (chkGainPlot->isEnabled())
|
if (chkGainPlot->isEnabled())
|
||||||
connect(chkGainPlot, SIGNAL(toggled(bool)), plot, SLOT(EnableGainPlot(bool)));
|
connect(chkGainPlot, SIGNAL(toggled(bool)), plot,
|
||||||
|
SLOT(EnableGainPlot(bool)));
|
||||||
if (chkGainPlot1D->isEnabled())
|
if (chkGainPlot1D->isEnabled())
|
||||||
connect(chkGainPlot1D, SIGNAL(toggled(bool)), plot, SLOT(EnableGainPlot(bool)));
|
connect(chkGainPlot1D, SIGNAL(toggled(bool)), plot,
|
||||||
|
SLOT(EnableGainPlot(bool)));
|
||||||
// gap pixels
|
// gap pixels
|
||||||
if (chkGapPixels->isEnabled())
|
if (chkGapPixels->isEnabled())
|
||||||
connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
|
connect(chkGapPixels, SIGNAL(toggled(bool)), this,
|
||||||
|
SLOT(SetGapPixels(bool)));
|
||||||
|
|
||||||
// Save, clone
|
// Save, clone
|
||||||
connect(btnSave, SIGNAL(clicked()), plot, SLOT(SavePlot()));
|
connect(btnSave, SIGNAL(clicked()), plot, SLOT(SavePlot()));
|
||||||
@ -148,10 +165,14 @@ void qTabPlot::Initialization() {
|
|||||||
connect(chkXAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
connect(chkXAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||||
connect(chkYAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
connect(chkYAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||||
connect(chkZAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
connect(chkZAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||||
connect(dispTitle, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
connect(dispTitle, SIGNAL(textChanged(const QString &)), this,
|
||||||
connect(dispXAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
SLOT(SetTitles()));
|
||||||
connect(dispYAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
connect(dispXAxis, SIGNAL(textChanged(const QString &)), this,
|
||||||
connect(dispZAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
SLOT(SetTitles()));
|
||||||
|
connect(dispYAxis, SIGNAL(textChanged(const QString &)), this,
|
||||||
|
SLOT(SetTitles()));
|
||||||
|
connect(dispZAxis, SIGNAL(textChanged(const QString &)), this,
|
||||||
|
SLOT(SetTitles()));
|
||||||
|
|
||||||
connect(chkXMin, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
|
connect(chkXMin, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
|
||||||
connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
|
connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
|
||||||
@ -161,7 +182,8 @@ void qTabPlot::Initialization() {
|
|||||||
connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
|
connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
|
||||||
connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
||||||
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
||||||
connect(chkAspectRatio, SIGNAL(toggled(bool)), this, SLOT(CheckAspectRatio()));
|
connect(chkAspectRatio, SIGNAL(toggled(bool)), this,
|
||||||
|
SLOT(CheckAspectRatio()));
|
||||||
|
|
||||||
connect(chkZMin, SIGNAL(toggled(bool)), this, SLOT(SetZRange()));
|
connect(chkZMin, SIGNAL(toggled(bool)), this, SLOT(SetZRange()));
|
||||||
connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(SetZRange()));
|
connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(SetZRange()));
|
||||||
@ -209,7 +231,7 @@ void qTabPlot::SetPlot() {
|
|||||||
SetZRange();
|
SetZRange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plot->SetDataCallBack(plotEnable);
|
plot->SetDataCallBack(plotEnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,7 +242,8 @@ void qTabPlot::Set1DPlotOptionsRight() {
|
|||||||
stackedWidget1D->setCurrentIndex(0);
|
stackedWidget1D->setCurrentIndex(0);
|
||||||
else
|
else
|
||||||
stackedWidget1D->setCurrentIndex(i + 1);
|
stackedWidget1D->setCurrentIndex(i + 1);
|
||||||
box1D->setTitle(QString("1D Plot Options %1").arg(stackedWidget1D->currentIndex() + 1));
|
box1D->setTitle(
|
||||||
|
QString("1D Plot Options %1").arg(stackedWidget1D->currentIndex() + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabPlot::Set1DPlotOptionsLeft() {
|
void qTabPlot::Set1DPlotOptionsLeft() {
|
||||||
@ -230,7 +253,8 @@ void qTabPlot::Set1DPlotOptionsLeft() {
|
|||||||
stackedWidget1D->setCurrentIndex(stackedWidget1D->count() - 1);
|
stackedWidget1D->setCurrentIndex(stackedWidget1D->count() - 1);
|
||||||
else
|
else
|
||||||
stackedWidget1D->setCurrentIndex(i - 1);
|
stackedWidget1D->setCurrentIndex(i - 1);
|
||||||
box1D->setTitle(QString("1D Plot Options %1").arg(stackedWidget1D->currentIndex() + 1));
|
box1D->setTitle(
|
||||||
|
QString("1D Plot Options %1").arg(stackedWidget1D->currentIndex() + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabPlot::Set2DPlotOptionsRight() {
|
void qTabPlot::Set2DPlotOptionsRight() {
|
||||||
@ -240,7 +264,8 @@ void qTabPlot::Set2DPlotOptionsRight() {
|
|||||||
stackedWidget2D->setCurrentIndex(0);
|
stackedWidget2D->setCurrentIndex(0);
|
||||||
else
|
else
|
||||||
stackedWidget2D->setCurrentIndex(i + 1);
|
stackedWidget2D->setCurrentIndex(i + 1);
|
||||||
box2D->setTitle(QString("2D Plot Options %1").arg(stackedWidget2D->currentIndex() + 1));
|
box2D->setTitle(
|
||||||
|
QString("2D Plot Options %1").arg(stackedWidget2D->currentIndex() + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabPlot::Set2DPlotOptionsLeft() {
|
void qTabPlot::Set2DPlotOptionsLeft() {
|
||||||
@ -250,7 +275,8 @@ void qTabPlot::Set2DPlotOptionsLeft() {
|
|||||||
stackedWidget2D->setCurrentIndex(stackedWidget2D->count() - 1);
|
stackedWidget2D->setCurrentIndex(stackedWidget2D->count() - 1);
|
||||||
else
|
else
|
||||||
stackedWidget2D->setCurrentIndex(i - 1);
|
stackedWidget2D->setCurrentIndex(i - 1);
|
||||||
box2D->setTitle(QString("2D Plot Options %1").arg(stackedWidget2D->currentIndex() + 1));
|
box2D->setTitle(
|
||||||
|
QString("2D Plot Options %1").arg(stackedWidget2D->currentIndex() + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabPlot::EnablePersistency(bool enable) {
|
void qTabPlot::EnablePersistency(bool enable) {
|
||||||
@ -265,16 +291,18 @@ void qTabPlot::EnablePersistency(bool enable) {
|
|||||||
|
|
||||||
void qTabPlot::SetBinary() {
|
void qTabPlot::SetBinary() {
|
||||||
bool binary1D = chkBinary->isChecked();
|
bool binary1D = chkBinary->isChecked();
|
||||||
bool binary2D = chkBinary_2->isChecked();
|
bool binary2D = chkBinary_2->isChecked();
|
||||||
if (is1d) {
|
if (is1d) {
|
||||||
FILE_LOG(logINFO) << "Binary Plot " << (binary1D ? "enabled" : "disabled");
|
FILE_LOG(logINFO) << "Binary Plot "
|
||||||
|
<< (binary1D ? "enabled" : "disabled");
|
||||||
lblFrom->setEnabled(binary1D);
|
lblFrom->setEnabled(binary1D);
|
||||||
lblTo->setEnabled(binary1D);
|
lblTo->setEnabled(binary1D);
|
||||||
spinFrom->setEnabled(binary1D);
|
spinFrom->setEnabled(binary1D);
|
||||||
spinTo->setEnabled(binary1D);
|
spinTo->setEnabled(binary1D);
|
||||||
plot->SetBinary(binary1D, spinFrom->value(), spinTo->value());
|
plot->SetBinary(binary1D, spinFrom->value(), spinTo->value());
|
||||||
} else {
|
} else {
|
||||||
FILE_LOG(logINFO) << "Binary Plot " << (binary2D ? "enabled" : "disabled");
|
FILE_LOG(logINFO) << "Binary Plot "
|
||||||
|
<< (binary2D ? "enabled" : "disabled");
|
||||||
lblFrom_2->setEnabled(binary2D);
|
lblFrom_2->setEnabled(binary2D);
|
||||||
lblTo_2->setEnabled(binary2D);
|
lblTo_2->setEnabled(binary2D);
|
||||||
spinFrom_2->setEnabled(binary2D);
|
spinFrom_2->setEnabled(binary2D);
|
||||||
@ -285,19 +313,25 @@ void qTabPlot::SetBinary() {
|
|||||||
|
|
||||||
void qTabPlot::GetGapPixels() {
|
void qTabPlot::GetGapPixels() {
|
||||||
FILE_LOG(logDEBUG) << "Getting gap pixels";
|
FILE_LOG(logDEBUG) << "Getting gap pixels";
|
||||||
disconnect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
|
disconnect(chkGapPixels, SIGNAL(toggled(bool)), this,
|
||||||
try {
|
SLOT(SetGapPixels(bool)));
|
||||||
auto retval = det->getRxAddGapPixels().tsquash("Inconsistent gap pixels enabled for all detectors.");
|
try {
|
||||||
chkGapPixels->setChecked(retval);
|
auto retval = det->getRxAddGapPixels().tsquash(
|
||||||
} CATCH_DISPLAY ("Could not get gap pixels enable.", "qTabPlot::GetGapPixels")
|
"Inconsistent gap pixels enabled for all detectors.");
|
||||||
connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
|
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) {
|
void qTabPlot::SetGapPixels(bool enable) {
|
||||||
FILE_LOG(logINFO) << "Setting Gap Pixels Enable to " << enable;
|
FILE_LOG(logINFO) << "Setting Gap Pixels Enable to " << enable;
|
||||||
try {
|
try {
|
||||||
det->setRxAddGapPixels(enable);
|
det->setRxAddGapPixels(enable);
|
||||||
} CATCH_HANDLE("Could not set gap pixels enable.", "qTabPlot::SetGapPixels", this, &qTabPlot::GetGapPixels)
|
}
|
||||||
|
CATCH_HANDLE("Could not set gap pixels enable.", "qTabPlot::SetGapPixels",
|
||||||
|
this, &qTabPlot::GetGapPixels)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabPlot::SetTitles() {
|
void qTabPlot::SetTitles() {
|
||||||
@ -306,32 +340,40 @@ void qTabPlot::SetTitles() {
|
|||||||
disconnect(chkXAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
disconnect(chkXAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||||
disconnect(chkYAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
disconnect(chkYAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||||
disconnect(chkZAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
disconnect(chkZAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||||
disconnect(dispTitle, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
disconnect(dispTitle, SIGNAL(textChanged(const QString &)), this,
|
||||||
disconnect(dispXAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
SLOT(SetTitles()));
|
||||||
disconnect(dispYAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
disconnect(dispXAxis, SIGNAL(textChanged(const QString &)), this,
|
||||||
disconnect(dispZAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
SLOT(SetTitles()));
|
||||||
|
disconnect(dispYAxis, SIGNAL(textChanged(const QString &)), this,
|
||||||
|
SLOT(SetTitles()));
|
||||||
|
disconnect(dispZAxis, SIGNAL(textChanged(const QString &)), this,
|
||||||
|
SLOT(SetTitles()));
|
||||||
|
|
||||||
// title
|
// title
|
||||||
if (!chkTitle->isChecked() || dispTitle->text().isEmpty()) {
|
if (!chkTitle->isChecked() || dispTitle->text().isEmpty()) {
|
||||||
plot->SetPlotTitlePrefix("");
|
plot->SetPlotTitlePrefix("");
|
||||||
dispTitle->setText("");
|
dispTitle->setText("");
|
||||||
} else {
|
} else {
|
||||||
plot->SetPlotTitlePrefix(dispTitle->text());
|
plot->SetPlotTitlePrefix(dispTitle->text());
|
||||||
}
|
}
|
||||||
// x
|
// x
|
||||||
if (!chkXAxis->isChecked() || dispXAxis->text().isEmpty()) {
|
if (!chkXAxis->isChecked() || dispXAxis->text().isEmpty()) {
|
||||||
dispXAxis->setText(is1d ? defaultHistXAxisTitle : defaultImageXAxisTitle);
|
dispXAxis->setText(is1d ? defaultHistXAxisTitle
|
||||||
plot->SetXAxisTitle(is1d ? defaultHistXAxisTitle : defaultImageXAxisTitle);
|
: defaultImageXAxisTitle);
|
||||||
|
plot->SetXAxisTitle(is1d ? defaultHistXAxisTitle
|
||||||
|
: defaultImageXAxisTitle);
|
||||||
} else {
|
} else {
|
||||||
plot->SetXAxisTitle(dispXAxis->text());
|
plot->SetXAxisTitle(dispXAxis->text());
|
||||||
}
|
}
|
||||||
// y
|
// y
|
||||||
if (!chkYAxis->isChecked() || dispYAxis->text().isEmpty()) {
|
if (!chkYAxis->isChecked() || dispYAxis->text().isEmpty()) {
|
||||||
dispYAxis->setText(is1d ? defaultHistYAxisTitle : defaultImageYAxisTitle);
|
dispYAxis->setText(is1d ? defaultHistYAxisTitle
|
||||||
plot->SetYAxisTitle(is1d ? defaultHistYAxisTitle : defaultImageYAxisTitle);
|
: defaultImageYAxisTitle);
|
||||||
|
plot->SetYAxisTitle(is1d ? defaultHistYAxisTitle
|
||||||
|
: defaultImageYAxisTitle);
|
||||||
} else {
|
} else {
|
||||||
plot->SetYAxisTitle(dispYAxis->text());
|
plot->SetYAxisTitle(dispYAxis->text());
|
||||||
}
|
}
|
||||||
// z
|
// z
|
||||||
if (!chkZAxis->isChecked() || dispZAxis->text().isEmpty()) {
|
if (!chkZAxis->isChecked() || dispZAxis->text().isEmpty()) {
|
||||||
plot->SetZAxisTitle(defaultImageZAxisTitle);
|
plot->SetZAxisTitle(defaultImageZAxisTitle);
|
||||||
@ -344,10 +386,14 @@ void qTabPlot::SetTitles() {
|
|||||||
connect(chkXAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
connect(chkXAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||||
connect(chkYAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
connect(chkYAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||||
connect(chkZAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
connect(chkZAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||||
connect(dispTitle, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
connect(dispTitle, SIGNAL(textChanged(const QString &)), this,
|
||||||
connect(dispXAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
SLOT(SetTitles()));
|
||||||
connect(dispYAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
connect(dispXAxis, SIGNAL(textChanged(const QString &)), this,
|
||||||
connect(dispZAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
SLOT(SetTitles()));
|
||||||
|
connect(dispYAxis, SIGNAL(textChanged(const QString &)), this,
|
||||||
|
SLOT(SetTitles()));
|
||||||
|
connect(dispZAxis, SIGNAL(textChanged(const QString &)), this,
|
||||||
|
SLOT(SetTitles()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabPlot::SetXRange() {
|
void qTabPlot::SetXRange() {
|
||||||
@ -384,13 +430,18 @@ void qTabPlot::SetXYRange() {
|
|||||||
bool isRange[4]{false, false, false, false};
|
bool isRange[4]{false, false, false, false};
|
||||||
double xyRange[4]{0, 0, 0, 0};
|
double xyRange[4]{0, 0, 0, 0};
|
||||||
|
|
||||||
QString dispVal[4] {dispXMin->text(), dispXMax->text(), dispYMin->text(), dispYMax->text()};
|
QString dispVal[4]{dispXMin->text(), dispXMax->text(), dispYMin->text(),
|
||||||
bool chkVal[4] {chkXMin->isChecked(), chkXMax->isChecked(), chkYMin->isChecked(), chkYMax->isChecked()};
|
dispYMax->text()};
|
||||||
|
bool chkVal[4]{chkXMin->isChecked(), chkXMax->isChecked(),
|
||||||
|
chkYMin->isChecked(), chkYMax->isChecked()};
|
||||||
|
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
if (chkVal[i] && !dispVal[i].isEmpty()) {
|
if (chkVal[i] && !dispVal[i].isEmpty()) {
|
||||||
double val = dispVal[i].toDouble();
|
double val = dispVal[i].toDouble();
|
||||||
FILE_LOG(logDEBUG) << "Setting " << qDefs::getRangeAsString(static_cast<qDefs::range>(i)) << " to " << val;
|
FILE_LOG(logDEBUG)
|
||||||
|
<< "Setting "
|
||||||
|
<< qDefs::getRangeAsString(static_cast<qDefs::range>(i))
|
||||||
|
<< " to " << val;
|
||||||
xyRange[i] = val;
|
xyRange[i] = val;
|
||||||
isRange[i] = true;
|
isRange[i] = true;
|
||||||
disablezoom = true;
|
disablezoom = true;
|
||||||
@ -418,13 +469,13 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
|
|||||||
chkXMax->setChecked(true);
|
chkXMax->setChecked(true);
|
||||||
chkYMin->setChecked(true);
|
chkYMin->setChecked(true);
|
||||||
chkYMax->setChecked(true);
|
chkYMax->setChecked(true);
|
||||||
if (dispXMin->text().isEmpty())
|
if (dispXMin->text().isEmpty())
|
||||||
dispXMin->setText(QString::number(plot->GetXMinimum()));
|
dispXMin->setText(QString::number(plot->GetXMinimum()));
|
||||||
if (dispXMax->text().isEmpty())
|
if (dispXMax->text().isEmpty())
|
||||||
dispXMax->setText(QString::number(plot->GetXMaximum()));
|
dispXMax->setText(QString::number(plot->GetXMaximum()));
|
||||||
if (dispYMin->text().isEmpty())
|
if (dispYMin->text().isEmpty())
|
||||||
dispYMin->setText(QString::number(plot->GetYMinimum()));
|
dispYMin->setText(QString::number(plot->GetYMinimum()));
|
||||||
if (dispYMax->text().isEmpty())
|
if (dispYMax->text().isEmpty())
|
||||||
dispYMax->setText(QString::number(plot->GetYMaximum()));
|
dispYMax->setText(QString::number(plot->GetYMaximum()));
|
||||||
|
|
||||||
// calculate ideal aspect ratio with previous limits
|
// calculate ideal aspect ratio with previous limits
|
||||||
@ -433,49 +484,68 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
|
|||||||
ranges[qDefs::XMAX] = plot->GetXMaximum();
|
ranges[qDefs::XMAX] = plot->GetXMaximum();
|
||||||
ranges[qDefs::YMIN] = plot->GetYMinimum();
|
ranges[qDefs::YMIN] = plot->GetYMinimum();
|
||||||
ranges[qDefs::YMAX] = plot->GetYMaximum();
|
ranges[qDefs::YMAX] = plot->GetYMaximum();
|
||||||
double idealAspectratio = (ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) / (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]);
|
double idealAspectratio = (ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) /
|
||||||
FILE_LOG(logDEBUG) << "Ideal Aspect ratio: " << idealAspectratio << " for x(" << ranges[qDefs::XMIN] << " - " << ranges[qDefs::XMAX] << "), y(" << ranges[qDefs::YMIN] << " - " << ranges[qDefs::YMAX] << ")";
|
(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] << ")";
|
||||||
|
|
||||||
// calculate current aspect ratio
|
// calculate current aspect ratio
|
||||||
ranges[qDefs::XMIN] = dispXMin->text().toDouble();
|
ranges[qDefs::XMIN] = dispXMin->text().toDouble();
|
||||||
ranges[qDefs::XMAX] = dispXMax->text().toDouble();
|
ranges[qDefs::XMAX] = dispXMax->text().toDouble();
|
||||||
ranges[qDefs::YMIN] = dispYMin->text().toDouble();
|
ranges[qDefs::YMIN] = dispYMin->text().toDouble();
|
||||||
ranges[qDefs::YMAX] = dispYMax->text().toDouble();
|
ranges[qDefs::YMAX] = dispYMax->text().toDouble();
|
||||||
double currentAspectRatio = (ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) / (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]);
|
double currentAspectRatio = (ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) /
|
||||||
FILE_LOG(logDEBUG) << "Current Aspect ratio: " << currentAspectRatio << " for x(" << ranges[qDefs::XMIN] << " - " << ranges[qDefs::XMAX] << "), y(" << ranges[qDefs::YMIN] << " - " << ranges[qDefs::YMAX] << ")";
|
(ranges[qDefs::YMAX] - ranges[qDefs::YMIN]);
|
||||||
|
FILE_LOG(logDEBUG) << "Current Aspect ratio: " << currentAspectRatio
|
||||||
|
<< " for x(" << ranges[qDefs::XMIN] << " - "
|
||||||
|
<< ranges[qDefs::XMAX] << "), y(" << ranges[qDefs::YMIN]
|
||||||
|
<< " - " << ranges[qDefs::YMAX] << ")";
|
||||||
|
|
||||||
if (currentAspectRatio != idealAspectratio) {
|
if (currentAspectRatio != idealAspectratio) {
|
||||||
// dimension: 1(x changed: y adjusted), 0(y changed: x adjusted), -1(aspect ratio clicked: larger one adjusted)
|
// dimension: 1(x changed: y adjusted), 0(y changed: x adjusted),
|
||||||
|
// -1(aspect ratio clicked: larger one adjusted)
|
||||||
if (dimension == -1) {
|
if (dimension == -1) {
|
||||||
dimension = ((ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) > (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]))
|
dimension = ((ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) >
|
||||||
? static_cast<int>(slsDetectorDefs::X) : static_cast<int>(slsDetectorDefs::Y);
|
(ranges[qDefs::YMAX] - ranges[qDefs::YMIN]))
|
||||||
|
? static_cast<int>(slsDetectorDefs::X)
|
||||||
|
: static_cast<int>(slsDetectorDefs::Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate new value to maintain aspect ratio
|
// calculate new value to maintain aspect ratio
|
||||||
// adjust x
|
// adjust x
|
||||||
double newval = 0;
|
double newval = 0;
|
||||||
if (dimension == static_cast<int>(slsDetectorDefs::X)) {
|
if (dimension == static_cast<int>(slsDetectorDefs::X)) {
|
||||||
newval = idealAspectratio * (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]) + ranges[qDefs::XMIN];
|
newval =
|
||||||
|
idealAspectratio * (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]) +
|
||||||
|
ranges[qDefs::XMIN];
|
||||||
if (newval <= plot->GetXMaximum()) {
|
if (newval <= plot->GetXMaximum()) {
|
||||||
ranges[qDefs::XMAX] = newval;
|
ranges[qDefs::XMAX] = newval;
|
||||||
dispXMax->setText(QString::number(newval));
|
dispXMax->setText(QString::number(newval));
|
||||||
FILE_LOG(logDEBUG) << "New XMax: " << newval;
|
FILE_LOG(logDEBUG) << "New XMax: " << newval;
|
||||||
} else {
|
} else {
|
||||||
newval = ranges[qDefs::XMAX] - (idealAspectratio * (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]));
|
newval = ranges[qDefs::XMAX] -
|
||||||
|
(idealAspectratio *
|
||||||
|
(ranges[qDefs::YMAX] - ranges[qDefs::YMIN]));
|
||||||
ranges[qDefs::XMIN] = newval;
|
ranges[qDefs::XMIN] = newval;
|
||||||
dispXMin->setText(QString::number(newval));
|
dispXMin->setText(QString::number(newval));
|
||||||
FILE_LOG(logDEBUG) << "New XMin: " << newval;
|
FILE_LOG(logDEBUG) << "New XMin: " << newval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// adjust y
|
// adjust y
|
||||||
else {
|
else {
|
||||||
newval = ((ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) / idealAspectratio) + ranges[qDefs::YMIN];
|
newval = ((ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) /
|
||||||
|
idealAspectratio) +
|
||||||
|
ranges[qDefs::YMIN];
|
||||||
if (newval <= plot->GetYMaximum()) {
|
if (newval <= plot->GetYMaximum()) {
|
||||||
ranges[qDefs::YMAX] = newval;
|
ranges[qDefs::YMAX] = newval;
|
||||||
dispYMax->setText(QString::number(newval));
|
dispYMax->setText(QString::number(newval));
|
||||||
FILE_LOG(logDEBUG) << "New YMax: " << newval;
|
FILE_LOG(logDEBUG) << "New YMax: " << newval;
|
||||||
} else {
|
} else {
|
||||||
newval = ranges[qDefs::YMAX] - ((ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) / idealAspectratio);
|
newval = ranges[qDefs::YMAX] -
|
||||||
|
((ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) /
|
||||||
|
idealAspectratio);
|
||||||
ranges[qDefs::YMIN] = newval;
|
ranges[qDefs::YMIN] = newval;
|
||||||
dispYMin->setText(QString::number(newval));
|
dispYMin->setText(QString::number(newval));
|
||||||
FILE_LOG(logDEBUG) << "New YMax: " << newval;
|
FILE_LOG(logDEBUG) << "New YMax: " << newval;
|
||||||
@ -492,14 +562,14 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
|
|||||||
connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
||||||
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
||||||
|
|
||||||
bool isRange[4] {true, true, true, true};
|
bool isRange[4]{true, true, true, true};
|
||||||
plot->SetXYRangeChanged(true, ranges, isRange);
|
plot->SetXYRangeChanged(true, ranges, isRange);
|
||||||
emit DisableZoomSignal(true);
|
emit DisableZoomSignal(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabPlot::SetZRange() {
|
void qTabPlot::SetZRange() {
|
||||||
bool isZRange[2] {chkZMin->isChecked(), chkZMax->isChecked()};
|
bool isZRange[2]{chkZMin->isChecked(), chkZMax->isChecked()};
|
||||||
double zRange[2] {0 , 0};
|
double zRange[2]{0, 0};
|
||||||
|
|
||||||
if (isZRange[0] && !dispZMin->text().isEmpty()) {
|
if (isZRange[0] && !dispZMin->text().isEmpty()) {
|
||||||
double val = dispZMin->text().toDouble();
|
double val = dispZMin->text().toDouble();
|
||||||
@ -515,24 +585,35 @@ void qTabPlot::SetZRange() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void qTabPlot::GetStreamingFrequency() {
|
void qTabPlot::GetStreamingFrequency() {
|
||||||
FILE_LOG(logDEBUG) << "Getting Streaming Frequency";
|
FILE_LOG(logDEBUG) << "Getting Streaming Frequency";
|
||||||
disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this,
|
||||||
disconnect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
SLOT(SetStreamingFrequency()));
|
||||||
disconnect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
disconnect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||||
disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
SLOT(SetStreamingFrequency()));
|
||||||
try {
|
disconnect(spinTimeGap, SIGNAL(editingFinished()), this,
|
||||||
int freq = det->getRxZmqFrequency().tsquash("Inconsistent receiver zmq streaming frequency for all detectors.");
|
SLOT(SetStreamingFrequency()));
|
||||||
|
disconnect(spinNthFrame, SIGNAL(editingFinished()), this,
|
||||||
|
SLOT(SetStreamingFrequency()));
|
||||||
|
try {
|
||||||
|
int freq = det->getRxZmqFrequency().tsquash(
|
||||||
|
"Inconsistent receiver zmq streaming frequency for all detectors.");
|
||||||
// time interval
|
// time interval
|
||||||
if (freq == 0) {
|
if (freq == 0) {
|
||||||
comboFrequency->setCurrentIndex(0);
|
comboFrequency->setCurrentIndex(0);
|
||||||
stackedTimeInterval->setCurrentIndex(0);
|
stackedTimeInterval->setCurrentIndex(0);
|
||||||
try {
|
try {
|
||||||
int timeMs = det->getRxZmqTimer().tsquash("Inconsistent receiver zmq streaming timer for all detectors.");
|
int timeMs = det->getRxZmqTimer().tsquash(
|
||||||
auto timeNS = qDefs::getNSTime(std::make_pair(static_cast<double>(timeMs), qDefs::MILLISECONDS));
|
"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);
|
auto time = qDefs::getUserFriendlyTime(timeNS);
|
||||||
spinTimeGap->setValue(time.first);
|
spinTimeGap->setValue(time.first);
|
||||||
comboTimeGapUnit->setCurrentIndex(static_cast<int>(time.second));
|
comboTimeGapUnit->setCurrentIndex(
|
||||||
} CATCH_DISPLAY ("Could not get streaming timer.", "qTabPlot::GetStreamingFrequency")
|
static_cast<int>(time.second));
|
||||||
|
}
|
||||||
|
CATCH_DISPLAY("Could not get streaming timer.",
|
||||||
|
"qTabPlot::GetStreamingFrequency")
|
||||||
}
|
}
|
||||||
// every nth frame
|
// every nth frame
|
||||||
else {
|
else {
|
||||||
@ -540,29 +621,40 @@ void qTabPlot::GetStreamingFrequency() {
|
|||||||
stackedTimeInterval->setCurrentIndex(1);
|
stackedTimeInterval->setCurrentIndex(1);
|
||||||
spinNthFrame->setValue(freq);
|
spinNthFrame->setValue(freq);
|
||||||
}
|
}
|
||||||
} CATCH_DISPLAY ("Could not get streaming frequency.", "qTabPlot::GetStreamingFrequency")
|
}
|
||||||
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
CATCH_DISPLAY("Could not get streaming frequency.",
|
||||||
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
"qTabPlot::GetStreamingFrequency")
|
||||||
connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this,
|
||||||
connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
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() {
|
void qTabPlot::SetStreamingFrequency() {
|
||||||
bool frequency = (comboFrequency->currentIndex() == 0) ? 0 : 1;
|
bool frequency = (comboFrequency->currentIndex() == 0) ? 0 : 1;
|
||||||
auto freqVal = spinNthFrame->value();
|
auto freqVal = spinNthFrame->value();
|
||||||
auto timeVal = spinTimeGap->value();
|
auto timeVal = spinTimeGap->value();
|
||||||
auto timeUnit = static_cast<qDefs::timeUnit>(comboTimeGapUnit->currentIndex());
|
auto timeUnit =
|
||||||
|
static_cast<qDefs::timeUnit>(comboTimeGapUnit->currentIndex());
|
||||||
stackedTimeInterval->setCurrentIndex(comboFrequency->currentIndex());
|
stackedTimeInterval->setCurrentIndex(comboFrequency->currentIndex());
|
||||||
try {
|
try {
|
||||||
if (frequency) {
|
if (frequency) {
|
||||||
FILE_LOG(logINFO) << "Setting Streaming Frequency to " << freqVal;
|
FILE_LOG(logINFO) << "Setting Streaming Frequency to " << freqVal;
|
||||||
det->setRxZmqFrequency(freqVal);
|
det->setRxZmqFrequency(freqVal);
|
||||||
} else {
|
} else {
|
||||||
FILE_LOG(logINFO) << "Setting Streaming Timer to " << timeVal << " " << qDefs::getUnitString(timeUnit);
|
FILE_LOG(logINFO) << "Setting Streaming Timer to " << timeVal << " "
|
||||||
|
<< qDefs::getUnitString(timeUnit);
|
||||||
auto timeMS = qDefs::getMSTime(std::make_pair(timeVal, timeUnit));
|
auto timeMS = qDefs::getMSTime(std::make_pair(timeVal, timeUnit));
|
||||||
det->setRxZmqTimer(timeMS.count());
|
det->setRxZmqTimer(timeMS.count());
|
||||||
}
|
}
|
||||||
} CATCH_HANDLE("Could not set streaming frequency/ timer.", "qTabPlot::SetStreamingFrequency", this, &qTabPlot::GetStreamingFrequency)
|
}
|
||||||
|
CATCH_HANDLE("Could not set streaming frequency/ timer.",
|
||||||
|
"qTabPlot::SetStreamingFrequency", this,
|
||||||
|
&qTabPlot::GetStreamingFrequency)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabPlot::Refresh() {
|
void qTabPlot::Refresh() {
|
||||||
@ -577,19 +669,19 @@ void qTabPlot::Refresh() {
|
|||||||
}
|
}
|
||||||
GetStreamingFrequency();
|
GetStreamingFrequency();
|
||||||
// gain plot, gap pixels enable
|
// gain plot, gap pixels enable
|
||||||
switch(det->getDetectorType().squash()) {
|
switch (det->getDetectorType().squash()) {
|
||||||
case slsDetectorDefs::EIGER:
|
case slsDetectorDefs::EIGER:
|
||||||
chkGapPixels->setEnabled(true);
|
chkGapPixels->setEnabled(true);
|
||||||
GetGapPixels();
|
GetGapPixels();
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::JUNGFRAU:
|
case slsDetectorDefs::JUNGFRAU:
|
||||||
chkGainPlot->setEnabled(true);
|
chkGainPlot->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::GOTTHARD2:
|
case slsDetectorDefs::GOTTHARD2:
|
||||||
chkGainPlot1D->setEnabled(true);
|
chkGainPlot1D->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
boxPlotType->setEnabled(false);
|
boxPlotType->setEnabled(false);
|
||||||
|
150
slsDetectorGui/src/qTabSettings.cpp
Executable file → Normal file
150
slsDetectorGui/src/qTabSettings.cpp
Executable file → Normal file
@ -8,7 +8,8 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
qTabSettings::qTabSettings(QWidget *parent, sls::Detector *detector): QWidget(parent), det(detector) {
|
qTabSettings::qTabSettings(QWidget *parent, sls::Detector *detector)
|
||||||
|
: QWidget(parent), det(detector) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
SetupWidgetWindow();
|
SetupWidgetWindow();
|
||||||
FILE_LOG(logDEBUG) << "Settings ready";
|
FILE_LOG(logDEBUG) << "Settings ready";
|
||||||
@ -18,20 +19,20 @@ qTabSettings::~qTabSettings() {}
|
|||||||
|
|
||||||
void qTabSettings::SetupWidgetWindow() {
|
void qTabSettings::SetupWidgetWindow() {
|
||||||
|
|
||||||
// enabling according to det type
|
// enabling according to det type
|
||||||
switch(det->getDetectorType().squash()) {
|
switch (det->getDetectorType().squash()) {
|
||||||
case slsDetectorDefs::MYTHEN3:
|
case slsDetectorDefs::MYTHEN3:
|
||||||
lblSettings->setEnabled(false);
|
lblSettings->setEnabled(false);
|
||||||
comboSettings->setEnabled(false);
|
comboSettings->setEnabled(false);
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::EIGER:
|
case slsDetectorDefs::EIGER:
|
||||||
lblDynamicRange->setEnabled(true);
|
lblDynamicRange->setEnabled(true);
|
||||||
comboDynamicRange->setEnabled(true);
|
comboDynamicRange->setEnabled(true);
|
||||||
lblThreshold->setEnabled(true);
|
lblThreshold->setEnabled(true);
|
||||||
spinThreshold->setEnabled(true);
|
spinThreshold->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// default settings for the disabled
|
// default settings for the disabled
|
||||||
@ -47,14 +48,16 @@ void qTabSettings::SetupWidgetWindow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void qTabSettings::SetupDetectorSettings() {
|
void qTabSettings::SetupDetectorSettings() {
|
||||||
QStandardItemModel *model = qobject_cast<QStandardItemModel *>(comboSettings->model());
|
QStandardItemModel *model =
|
||||||
|
qobject_cast<QStandardItemModel *>(comboSettings->model());
|
||||||
if (model) {
|
if (model) {
|
||||||
QModelIndex index[NUMSETTINGS];
|
QModelIndex index[NUMSETTINGS];
|
||||||
QStandardItem *item[NUMSETTINGS];
|
QStandardItem *item[NUMSETTINGS];
|
||||||
for (int i = 0; i < NUMSETTINGS; ++i) {
|
for (int i = 0; i < NUMSETTINGS; ++i) {
|
||||||
index[i] = model->index(i, comboSettings->modelColumn(), comboSettings->rootModelIndex());
|
index[i] = model->index(i, comboSettings->modelColumn(),
|
||||||
|
comboSettings->rootModelIndex());
|
||||||
item[i] = model->itemFromIndex(index[i]);
|
item[i] = model->itemFromIndex(index[i]);
|
||||||
item[i]->setEnabled(false);
|
item[i]->setEnabled(false);
|
||||||
}
|
}
|
||||||
switch (det->getDetectorType().squash()) {
|
switch (det->getDetectorType().squash()) {
|
||||||
case slsDetectorDefs::EIGER:
|
case slsDetectorDefs::EIGER:
|
||||||
@ -83,7 +86,7 @@ void qTabSettings::SetupDetectorSettings() {
|
|||||||
item[(int)DYNAMICGAIN]->setEnabled(true);
|
item[(int)DYNAMICGAIN]->setEnabled(true);
|
||||||
item[(int)FIXGAIN1]->setEnabled(true);
|
item[(int)FIXGAIN1]->setEnabled(true);
|
||||||
item[(int)FIXGAIN2]->setEnabled(true);
|
item[(int)FIXGAIN2]->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::MOENCH:
|
case slsDetectorDefs::MOENCH:
|
||||||
item[(int)G1_HIGHGAIN]->setEnabled(true);
|
item[(int)G1_HIGHGAIN]->setEnabled(true);
|
||||||
item[(int)G1_LOWGAIN]->setEnabled(true);
|
item[(int)G1_LOWGAIN]->setEnabled(true);
|
||||||
@ -93,11 +96,12 @@ void qTabSettings::SetupDetectorSettings() {
|
|||||||
item[(int)G2_LOWCAP_LOWGAIN]->setEnabled(true);
|
item[(int)G2_LOWCAP_LOWGAIN]->setEnabled(true);
|
||||||
item[(int)G4_HIGHGAIN]->setEnabled(true);
|
item[(int)G4_HIGHGAIN]->setEnabled(true);
|
||||||
item[(int)G4_LOWGAIN]->setEnabled(true);
|
item[(int)G4_LOWGAIN]->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
FILE_LOG(logDEBUG) << "Unknown detector type. Exiting GUI.";
|
FILE_LOG(logDEBUG) << "Unknown detector type. Exiting GUI.";
|
||||||
qDefs::Message(qDefs::CRITICAL,
|
qDefs::Message(qDefs::CRITICAL,
|
||||||
"Unknown detector type. Exiting GUI.", "qTabSettings::SetupDetectorSettings");
|
"Unknown detector type. Exiting GUI.",
|
||||||
|
"qTabSettings::SetupDetectorSettings");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,38 +110,46 @@ void qTabSettings::SetupDetectorSettings() {
|
|||||||
void qTabSettings::Initialization() {
|
void qTabSettings::Initialization() {
|
||||||
// Settings
|
// Settings
|
||||||
if (comboSettings->isEnabled())
|
if (comboSettings->isEnabled())
|
||||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSettings(int)));
|
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(SetSettings(int)));
|
||||||
|
|
||||||
// Dynamic Range
|
// Dynamic Range
|
||||||
if (comboDynamicRange->isEnabled())
|
if (comboDynamicRange->isEnabled())
|
||||||
connect(comboDynamicRange, SIGNAL(activated(int)), this, SLOT(SetDynamicRange(int)));
|
connect(comboDynamicRange, SIGNAL(activated(int)), this,
|
||||||
|
SLOT(SetDynamicRange(int)));
|
||||||
|
|
||||||
// Threshold
|
// Threshold
|
||||||
if (spinThreshold->isEnabled())
|
if (spinThreshold->isEnabled())
|
||||||
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetThresholdEnergy(int)));
|
connect(spinThreshold, SIGNAL(valueChanged(int)), this,
|
||||||
|
SLOT(SetThresholdEnergy(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabSettings::GetSettings() {
|
void qTabSettings::GetSettings() {
|
||||||
FILE_LOG(logDEBUG) << "Getting settings";
|
FILE_LOG(logDEBUG) << "Getting settings";
|
||||||
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSettings(int)));
|
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
||||||
try{
|
SLOT(SetSettings(int)));
|
||||||
auto retval = det->getSettings().tsquash("Inconsistent settings for all detectors.");
|
try {
|
||||||
|
auto retval = det->getSettings().tsquash(
|
||||||
|
"Inconsistent settings for all detectors.");
|
||||||
switch (retval) {
|
switch (retval) {
|
||||||
case slsDetectorDefs::UNDEFINED:
|
case slsDetectorDefs::UNDEFINED:
|
||||||
comboSettings->setCurrentIndex(UNDEFINED);
|
comboSettings->setCurrentIndex(UNDEFINED);
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::UNINITIALIZED:
|
case slsDetectorDefs::UNINITIALIZED:
|
||||||
comboSettings->setCurrentIndex(UNINITIALIZED);
|
comboSettings->setCurrentIndex(UNINITIALIZED);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if ((int)retval < -1 || (int)retval >= NUMSETTINGS) {
|
if ((int)retval < -1 || (int)retval >= NUMSETTINGS) {
|
||||||
throw sls::RuntimeError(std::string("Unknown settings: ") + std::to_string(retval));
|
throw sls::RuntimeError(std::string("Unknown settings: ") +
|
||||||
}
|
std::to_string(retval));
|
||||||
comboSettings->setCurrentIndex(retval);
|
}
|
||||||
break;
|
comboSettings->setCurrentIndex(retval);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} CATCH_DISPLAY ("Could not get settings.", "qTabSettings::GetSettings")
|
}
|
||||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSettings(int)));
|
CATCH_DISPLAY("Could not get settings.", "qTabSettings::GetSettings")
|
||||||
|
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(SetSettings(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabSettings::SetSettings(int index) {
|
void qTabSettings::SetSettings(int index) {
|
||||||
@ -146,7 +158,9 @@ void qTabSettings::SetSettings(int index) {
|
|||||||
try {
|
try {
|
||||||
FILE_LOG(logINFO) << "Setting Settings to " << sls::ToString(val);
|
FILE_LOG(logINFO) << "Setting Settings to " << sls::ToString(val);
|
||||||
det->setSettings(val);
|
det->setSettings(val);
|
||||||
} CATCH_HANDLE ("Could not set settings.", "qTabSettings::SetSettings", this, &qTabSettings::GetSettings)
|
}
|
||||||
|
CATCH_HANDLE("Could not set settings.", "qTabSettings::SetSettings", this,
|
||||||
|
&qTabSettings::GetSettings)
|
||||||
// threshold
|
// threshold
|
||||||
if (spinThreshold->isEnabled()) {
|
if (spinThreshold->isEnabled()) {
|
||||||
SetThresholdEnergy(spinThreshold->value());
|
SetThresholdEnergy(spinThreshold->value());
|
||||||
@ -155,9 +169,11 @@ void qTabSettings::SetSettings(int index) {
|
|||||||
|
|
||||||
void qTabSettings::GetDynamicRange() {
|
void qTabSettings::GetDynamicRange() {
|
||||||
FILE_LOG(logDEBUG) << "Getting dynamic range";
|
FILE_LOG(logDEBUG) << "Getting dynamic range";
|
||||||
disconnect(comboDynamicRange, SIGNAL(activated(int)), this, SLOT(SetDynamicRange(int)));
|
disconnect(comboDynamicRange, SIGNAL(activated(int)), this,
|
||||||
try {
|
SLOT(SetDynamicRange(int)));
|
||||||
auto retval = det->getDynamicRange().tsquash("Inconsistent dynamic range for all detectors.");
|
try {
|
||||||
|
auto retval = det->getDynamicRange().tsquash(
|
||||||
|
"Inconsistent dynamic range for all detectors.");
|
||||||
// set the final value on gui
|
// set the final value on gui
|
||||||
switch (retval) {
|
switch (retval) {
|
||||||
case 32:
|
case 32:
|
||||||
@ -173,14 +189,19 @@ void qTabSettings::GetDynamicRange() {
|
|||||||
comboDynamicRange->setCurrentIndex(DYNAMICRANGE_4);
|
comboDynamicRange->setCurrentIndex(DYNAMICRANGE_4);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw sls::RuntimeError(std::string("Unknown dynamic range: ") + std::to_string(retval));
|
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)));
|
CATCH_DISPLAY("Could not get dynamic range.",
|
||||||
|
"qTabSettings::GetDynamicRange")
|
||||||
|
connect(comboDynamicRange, SIGNAL(activated(int)), this,
|
||||||
|
SLOT(SetDynamicRange(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabSettings::SetDynamicRange(int index) {
|
void qTabSettings::SetDynamicRange(int index) {
|
||||||
FILE_LOG(logINFO) << "Setting dynamic range to " << comboDynamicRange->currentText().toAscii().data();
|
FILE_LOG(logINFO) << "Setting dynamic range to "
|
||||||
|
<< comboDynamicRange->currentText().toAscii().data();
|
||||||
try {
|
try {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case DYNAMICRANGE_32:
|
case DYNAMICRANGE_32:
|
||||||
@ -196,28 +217,39 @@ void qTabSettings::SetDynamicRange(int index) {
|
|||||||
det->setDynamicRange(4);
|
det->setDynamicRange(4);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw sls::RuntimeError(std::string("Unknown dynamic range: ") + std::to_string(index));
|
throw sls::RuntimeError(std::string("Unknown dynamic range: ") +
|
||||||
|
std::to_string(index));
|
||||||
}
|
}
|
||||||
} CATCH_HANDLE ("Could not set dynamic range.", "qTabSettings::SetDynamicRange", this, &qTabSettings::GetDynamicRange)
|
}
|
||||||
|
CATCH_HANDLE("Could not set dynamic range.",
|
||||||
|
"qTabSettings::SetDynamicRange", this,
|
||||||
|
&qTabSettings::GetDynamicRange)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabSettings::GetThresholdEnergy() {
|
void qTabSettings::GetThresholdEnergy() {
|
||||||
FILE_LOG(logDEBUG) << "Getting theshold energy";
|
FILE_LOG(logDEBUG) << "Getting theshold energy";
|
||||||
disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetThresholdEnergy(int)));
|
disconnect(spinThreshold, SIGNAL(valueChanged(int)), this,
|
||||||
|
SLOT(SetThresholdEnergy(int)));
|
||||||
try {
|
try {
|
||||||
auto retval = det->getThresholdEnergy().tsquash("Inconsistent threhsold energy for all detectors.");
|
auto retval = det->getThresholdEnergy().tsquash(
|
||||||
|
"Inconsistent threhsold energy for all detectors.");
|
||||||
spinThreshold->setValue(retval);
|
spinThreshold->setValue(retval);
|
||||||
} CATCH_DISPLAY ("Could not get threshold energy.", "qTabDataOutput::GetThresholdEnergy")
|
}
|
||||||
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetThresholdEnergy(int)));
|
CATCH_DISPLAY("Could not get threshold energy.",
|
||||||
|
"qTabDataOutput::GetThresholdEnergy")
|
||||||
|
connect(spinThreshold, SIGNAL(valueChanged(int)), this,
|
||||||
|
SLOT(SetThresholdEnergy(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabSettings::SetThresholdEnergy(int index) {
|
void qTabSettings::SetThresholdEnergy(int index) {
|
||||||
FILE_LOG(logINFO) << "Setting Threshold Energy to " << index << " eV";
|
FILE_LOG(logINFO) << "Setting Threshold Energy to " << index << " eV";
|
||||||
try {
|
try {
|
||||||
det->setThresholdEnergy(index);
|
det->setThresholdEnergy(index);
|
||||||
} CATCH_DISPLAY ("Could not get threshold energy.", "qTabSettings::SetThresholdEnergy")
|
}
|
||||||
|
CATCH_DISPLAY("Could not get threshold energy.",
|
||||||
|
"qTabSettings::SetThresholdEnergy")
|
||||||
// set the right value anyway (due to tolerance)
|
// set the right value anyway (due to tolerance)
|
||||||
GetThresholdEnergy();
|
GetThresholdEnergy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabSettings::Refresh() {
|
void qTabSettings::Refresh() {
|
||||||
@ -230,7 +262,7 @@ void qTabSettings::Refresh() {
|
|||||||
if (comboDynamicRange->isEnabled()) {
|
if (comboDynamicRange->isEnabled()) {
|
||||||
GetDynamicRange();
|
GetDynamicRange();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spinThreshold->isEnabled())
|
if (spinThreshold->isEnabled())
|
||||||
GetThresholdEnergy();
|
GetThresholdEnergy();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user