diff --git a/slsDetectorGui/include/qCloneWidget.h b/slsDetectorGui/include/qCloneWidget.h index 11fa81419..391645dde 100755 --- a/slsDetectorGui/include/qCloneWidget.h +++ b/slsDetectorGui/include/qCloneWidget.h @@ -16,7 +16,7 @@ class qCloneWidget : public QMainWindow, private Ui::ClonePlotObject { Q_OBJECT public: - qCloneWidget(QWidget *parent, SlsQt1DPlot *p1, SlsQt2DPlot *p2, SlsQt2DPlot *gp, + qCloneWidget(QWidget *parent, SlsQt1DPlot *p1, SlsQt2DPlot *p2, SlsQt1DPlot *gp1, SlsQt2DPlot *gp, QString title, QString filePath, QString fileName, int64_t aIndex, bool displayStats, QString min, QString max, QString sum); @@ -37,6 +37,7 @@ class qCloneWidget : public QMainWindow, private Ui::ClonePlotObject { int id; SlsQt1DPlot *plot1d{nullptr}; SlsQt2DPlot *plot2d{nullptr}; + SlsQt1DPlot *gainplot1d{nullptr}; SlsQt2DPlot *gainplot2d{nullptr}; QString filePath{"/"}; QString fileName{"run"}; diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index 988be9d42..af7987ea2 100755 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -11,10 +11,10 @@ int qCloneWidget::NumClones{0}; -qCloneWidget::qCloneWidget(QWidget *parent, SlsQt1DPlot* p1, SlsQt2DPlot* p2, SlsQt2DPlot* gp, +qCloneWidget::qCloneWidget(QWidget *parent, SlsQt1DPlot* p1, SlsQt2DPlot* p2, SlsQt1DPlot *gp1, SlsQt2DPlot* gp, QString title, QString fPath, QString fName, int64_t aIndex, bool displayStats, QString min, QString max, QString sum): - QMainWindow(parent), plot1d(p1), plot2d(p2), gainplot2d(gp), filePath(fPath), fileName(fName), acqIndex(aIndex) { + QMainWindow(parent), plot1d(p1), plot2d(p2), gainplot1d(gp1), gainplot2d(gp), filePath(fPath), fileName(fName), acqIndex(aIndex) { setupUi(this); id = qCloneWidget::NumClones++; SetupWidgetWindow(title); @@ -26,6 +26,8 @@ qCloneWidget::~qCloneWidget() { delete plot1d; if (plot2d) delete plot2d; + if (gainplot1d) + delete gainplot1d; if (gainplot2d) delete gainplot2d; } @@ -40,7 +42,13 @@ void qCloneWidget::SetupWidgetWindow(QString title) { // 1d if (plot1d != nullptr) { - plotLayout->addWidget(plot1d); + if (gainplot1d == nullptr) { + plotLayout->addWidget(plot1d); + } else { + int ratio = qDefs::DATA_GAIN_PLOT_RATIO - 1; + plotLayout->addWidget(plot1d, 0, 0, ratio, ratio); + plotLayout->addWidget(gainplot1d, ratio, 0, 1, ratio, Qt::AlignTop); + } } // 2d else { @@ -92,6 +100,10 @@ void qCloneWidget::SavePlot() { } void qCloneWidget::resizeEvent(QResizeEvent *event) { + if (gainplot1d != nullptr) { + gainplot1d->setFixedWidth(plot1d->width()); + gainplot1d->setFixedHeight(plot1d->height() / qDefs::DATA_GAIN_PLOT_RATIO); + } if (gainplot2d != nullptr) { gainplot2d->setFixedWidth(plot2d->width() / qDefs::DATA_GAIN_PLOT_RATIO); gainplot2d->setFixedHeight(plot2d->height() / qDefs::DATA_GAIN_PLOT_RATIO); diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 6f4b8934d..3b4927012 100755 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -193,7 +193,7 @@ void qDrawPlot::SetupPlots() { // set ticks to just 3 QList majorTicks({0, 1, 2, 3}); QwtScaleDiv div( 0, 3, QList(), QList(), majorTicks); - gainplot1d->setAxisScaleDiv( QwtPlot::yLeft, div ); + gainplot1d->setAxisScaleDiv( QwtPlot::yLeft, div); //gainplot1d->axisScaleDraw(QwtPlot::xBottom)->enableComponent(QwtScaleDraw::Ticks, false); //gainplot1d->axisScaleDraw(QwtPlot::yLeft)->enableComponent(QwtScaleDraw::Labels, false); gainhist1d->setItemAttribute(QwtPlotItem::Legend, false); @@ -244,7 +244,7 @@ void qDrawPlot::SetupPlots() { //gainplot2d->enableAxis(1, false); gainplot2d->enableAxis(QwtPlot::xBottom, false); // set ticks to just 3 - gainplot2d->setAxisScaleDiv( QwtPlot::yRight, div ); + gainplot2d->setAxisScaleDiv( QwtPlot::yRight, div); gainplot2d->hide(); // layout of plots @@ -495,6 +495,7 @@ void qDrawPlot::ClonePlot() { SlsQt1DPlot* cloneplot1D = nullptr; SlsQt2DPlot* cloneplot2D = nullptr; + SlsQt1DPlot* clonegainplot1D = nullptr; SlsQt2DPlot* clonegainplot2D = nullptr; if (is1d) { @@ -516,6 +517,24 @@ void qDrawPlot::ClonePlot() { cloneplotHists1D.append(h); h->Attach(cloneplot1D); } + if (isGainDataExtracted) { + SlsQtH1D *h = new SlsQtH1D("", nPixelsX, datax1d, gainDatay1d); + h->SetLineColor(0); + h->setStyleLinesorDots(isLines); + h->setSymbolMarkers(isMarkers); + h->setItemAttribute(QwtPlotItem::Legend, false); + clonegainplot1D = new SlsQt1DPlot(); + clonegainplot1D->SetTitleFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal)); + clonegainplot1D->SetYFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal)); + clonegainplot1D->SetTitle(""); + clonegainplot1D->SetYTitle("Gain"); + // set ticks to just 3 + QList majorTicks({0, 1, 2, 3}); + QwtScaleDiv div( 0, 3, QList(), QList(), majorTicks); + clonegainplot1D->setAxisScaleDiv( QwtPlot::yLeft, div); + h->Attach(clonegainplot1D); + + } } else { FILE_LOG(logDEBUG) << "Cloning 2D Image"; cloneplot2D = new SlsQt2DPlot(); @@ -533,19 +552,31 @@ void qDrawPlot::ClonePlot() { if (isGainDataExtracted) { clonegainplot2D = new SlsQt2DPlot(); - clonegainplot2D->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal)); + clonegainplot2D->SetTitleFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal)); + clonegainplot2D->SetTitle("Gain"); + clonegainplot2D->SetZTitle(""); + clonegainplot2D->enableAxis(QwtPlot::yLeft, false); + clonegainplot2D->enableAxis(QwtPlot::xBottom, false); + // set ticks to just 3 + QList majorTicks({0, 1, 2, 3}); + QwtScaleDiv div( 0, 3, QList(), QList(), majorTicks); + clonegainplot2D->setAxisScaleDiv( QwtPlot::yRight, div); + clonegainplot2D->enableAxis(0, false); clonegainplot2D->enableAxis(1, false); clonegainplot2D->enableAxis(2, false); clonegainplot2D->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5, nPixelsY - 0.5, gainData); - clonegainplot2D->SetTitle(""); } } - qCloneWidget* q = new qCloneWidget(this, cloneplot1D, cloneplot2D, clonegainplot2D, - boxPlot->title(), fileSavePath, fileSaveName, currentAcqIndex, + qCloneWidget* q = new qCloneWidget(this, cloneplot1D, cloneplot2D, clonegainplot1D, + clonegainplot2D, boxPlot->title(), fileSavePath, fileSaveName, currentAcqIndex, displayStatistics, lblMinDisp->text(), lblMaxDisp->text(), lblSumDisp->text()); - q->show(); + q->show(); + if (clonegainplot1D != nullptr) { + clonegainplot1D->setFixedWidth(cloneplot1D->width()); + //clonegainplot1D->setFixedHeight(cloneplot1D->height());// / qDefs::DATA_GAIN_PLOT_RATIO - 1); + } } void qDrawPlot::SavePlot() { diff --git a/slsDetectorServers/gotthard2DetectorServer/CMakeLists.txt b/slsDetectorServers/gotthard2DetectorServer/CMakeLists.txt index 655d0a602..20542efd7 100644 --- a/slsDetectorServers/gotthard2DetectorServer/CMakeLists.txt +++ b/slsDetectorServers/gotthard2DetectorServer/CMakeLists.txt @@ -23,7 +23,7 @@ target_include_directories(gotthard2DetectorServer_virtual ) target_compile_definitions(gotthard2DetectorServer_virtual - PUBLIC GOTTHARD2D VIRTUAL STOP_SERVER DEBUG1 + PUBLIC GOTTHARD2D VIRTUAL STOP_SERVER #DEBUG1 ) target_link_libraries(gotthard2DetectorServer_virtual diff --git a/slsDetectorServers/gotthard2DetectorServer/Makefile b/slsDetectorServers/gotthard2DetectorServer/Makefile index 13135a08e..e7227daf1 100755 --- a/slsDetectorServers/gotthard2DetectorServer/Makefile +++ b/slsDetectorServers/gotthard2DetectorServer/Makefile @@ -5,7 +5,7 @@ support_lib = ../../slsSupportLib/include/ CROSS = nios2-buildroot-linux-gnu- CC = $(CROSS)gcc -CFLAGS += -Wall -DGOTTHARD2D -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) -DDEBUG1 #-DVERBOSEI #-DVERBOSE +CFLAGS += -Wall -DGOTTHARD2D -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE LDLIBS += -lm PROGS = gotthard2DetectorServer DESTDIR ?= bin diff --git a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer index 83d731e55..aa774f950 100755 Binary files a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer and b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer differ diff --git a/slsSupportLib/include/versionAPI.h b/slsSupportLib/include/versionAPI.h index 47138b7e8..63331671f 100644 --- a/slsSupportLib/include/versionAPI.h +++ b/slsSupportLib/include/versionAPI.h @@ -9,4 +9,4 @@ #define APIRECEIVER 0x200227 #define APIGUI 0x200227 #define APICTB 0x200227 -#define APIGOTTHARD2 0x200303 +#define APIGOTTHARD2 0x200304