mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-20 02:40:03 +02:00
finished getting dacs and adcs..need to set it
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@26 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
parent
72c52de2fe
commit
a47d0a57f6
@ -8,15 +8,27 @@
|
||||
#ifndef QTABDEVELOPER_H_
|
||||
#define QTABDEVELOPER_H_
|
||||
|
||||
/** Form Header */
|
||||
#include "ui_form_tab_developer.h"
|
||||
/** Project Class Headers */
|
||||
class multiSlsDetector;
|
||||
#include "sls_detector_defs.h"
|
||||
/** Qt Include Headers */
|
||||
#include <QWidget>
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QScrollArea>
|
||||
#include <QTimer>
|
||||
/** C++ Include Headers */
|
||||
#include <string>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
|
||||
/**
|
||||
*@short sets up the Developer parameters
|
||||
*/
|
||||
class qTabDeveloper:public QWidget, private Ui::TabDeveloperObject{
|
||||
class qTabDeveloper:public QWidget{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
@ -37,6 +49,29 @@ public:
|
||||
private:
|
||||
/** The sls detector object */
|
||||
multiSlsDetector *myDet;
|
||||
/** detector type */
|
||||
slsDetectorDefs::detectorType detType;
|
||||
/**number of dac widgets*/
|
||||
static int NUM_DAC_WIDGETS;
|
||||
/**number of adc widgets*/
|
||||
static int NUM_ADC_WIDGETS;
|
||||
|
||||
static const int ADC_TIMEOUT = 5000;
|
||||
|
||||
vector<string>dacNames;
|
||||
vector<string>adcNames;
|
||||
|
||||
|
||||
/**widgets needed*/
|
||||
QGridLayout *layout;
|
||||
QScrollArea *scroll;
|
||||
QGroupBox *boxDacs;
|
||||
QGroupBox *boxAdcs;
|
||||
QLabel *lblDacs[20];
|
||||
QLabel *lblAdcs[20];
|
||||
QDoubleSpinBox *spinDacs[20];
|
||||
QDoubleSpinBox *spinAdcs[20];
|
||||
QTimer *adcTimer;
|
||||
|
||||
/** Sets up the widget
|
||||
*/
|
||||
@ -46,6 +81,26 @@ private:
|
||||
*/
|
||||
void Initialization();
|
||||
|
||||
/** Sets up the DAC Widgets
|
||||
*/
|
||||
void CreateDACWidgets();
|
||||
|
||||
/** Sets up the ADC Widgets
|
||||
*/
|
||||
void CreateADCWidgets();
|
||||
|
||||
/** Gets the sls index to set/get dac/adc
|
||||
* @param index is the gui dac/adc index
|
||||
* returns the sls index
|
||||
*/
|
||||
slsDetectorDefs::dacIndex getSLSIndex(int index);
|
||||
|
||||
|
||||
|
||||
private slots:
|
||||
/** Refreshes the adcs
|
||||
*/
|
||||
void RefreshAdcs();
|
||||
|
||||
};
|
||||
|
||||
|
@ -99,7 +99,7 @@ FORMS = \
|
||||
forms/form_tab_advanced.ui\
|
||||
forms/form_tab_settings.ui\
|
||||
forms/form_tab_debugging.ui\
|
||||
forms/form_tab_developer.ui\
|
||||
# forms/form_tab_developer.ui\
|
||||
# forms/form_tab_messages.ui
|
||||
forms/form_action.ui\
|
||||
forms/form_scan.ui
|
||||
|
@ -484,26 +484,19 @@ void qDrawPlot::UpdatePlot(){
|
||||
}else{
|
||||
h=plot1D_hists.at(hist_num);
|
||||
h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num));
|
||||
h->SetDotStyle(plotDotted);
|
||||
}
|
||||
h->SetDotStyle(plotDotted);
|
||||
h->setTitle(GetHistTitle(hist_num));
|
||||
h->Attach(plot1D);
|
||||
|
||||
}
|
||||
// update range if required
|
||||
if(XYRangeChanged){
|
||||
if(!IsXYRange[qDefs::XMINIMUM])
|
||||
XYRangeValues[qDefs::XMINIMUM]= plot1D->GetXMinimum();
|
||||
if(!IsXYRange[qDefs::XMAXIMUM])
|
||||
XYRangeValues[qDefs::XMAXIMUM]= plot1D->GetXMaximum();
|
||||
if(!IsXYRange[qDefs::YMINIMUM])
|
||||
XYRangeValues[qDefs::YMINIMUM]= plot1D->GetYMinimum();
|
||||
if(!IsXYRange[qDefs::YMAXIMUM])
|
||||
XYRangeValues[qDefs::YMAXIMUM]= plot1D->GetYMaximum();
|
||||
|
||||
if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot1D->GetXMinimum();
|
||||
if(!IsXYRange[qDefs::XMAXIMUM]) XYRangeValues[qDefs::XMAXIMUM]= plot1D->GetXMaximum();
|
||||
if(!IsXYRange[qDefs::YMINIMUM]) XYRangeValues[qDefs::YMINIMUM]= plot1D->GetYMinimum();
|
||||
if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot1D->GetYMaximum();
|
||||
plot1D->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]);
|
||||
plot1D->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]);
|
||||
|
||||
XYRangeChanged = false;
|
||||
}
|
||||
}
|
||||
@ -521,18 +514,12 @@ void qDrawPlot::UpdatePlot(){
|
||||
}
|
||||
// update range if required
|
||||
if(XYRangeChanged){
|
||||
if(!IsXYRange[qDefs::XMINIMUM])
|
||||
XYRangeValues[qDefs::XMINIMUM]= plot2D->GetPlot()->GetXMinimum();
|
||||
if(!IsXYRange[qDefs::XMAXIMUM])
|
||||
XYRangeValues[qDefs::XMAXIMUM]= plot2D->GetPlot()->GetXMaximum();
|
||||
if(!IsXYRange[qDefs::YMINIMUM])
|
||||
XYRangeValues[qDefs::YMINIMUM]= plot2D->GetPlot()->GetYMinimum();
|
||||
if(!IsXYRange[qDefs::YMAXIMUM])
|
||||
XYRangeValues[qDefs::YMAXIMUM]= plot2D->GetPlot()->GetYMaximum();
|
||||
|
||||
if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot2D->GetPlot()->GetXMinimum();
|
||||
if(!IsXYRange[qDefs::XMAXIMUM]) XYRangeValues[qDefs::XMAXIMUM]= plot2D->GetPlot()->GetXMaximum();
|
||||
if(!IsXYRange[qDefs::YMINIMUM]) XYRangeValues[qDefs::YMINIMUM]= plot2D->GetPlot()->GetYMinimum();
|
||||
if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot2D->GetPlot()->GetYMaximum();
|
||||
plot2D->GetPlot()->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]);
|
||||
plot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]);
|
||||
|
||||
XYRangeChanged = false;
|
||||
}
|
||||
}
|
||||
|
@ -6,24 +6,33 @@
|
||||
*/
|
||||
#include "qTabDeveloper.h"
|
||||
#include "qDefs.h"
|
||||
/** Project Class Headers */
|
||||
//Project Class Headers
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
/** C++ Include Headers */
|
||||
//Qt Include Headers
|
||||
#include <QSpacerItem>
|
||||
#include <QString>
|
||||
#include <QDoubleValidator>
|
||||
//C++ Include Headers
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
int qTabDeveloper::NUM_DAC_WIDGETS(0);
|
||||
int qTabDeveloper::NUM_ADC_WIDGETS(0);
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
qTabDeveloper::qTabDeveloper(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector){
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
Initialization();
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
qTabDeveloper::~qTabDeveloper(){
|
||||
@ -31,21 +40,218 @@ qTabDeveloper::~qTabDeveloper(){
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabDeveloper::SetupWidgetWindow(){
|
||||
//Detector Type
|
||||
detType=myDet->getDetectorsType();
|
||||
|
||||
//the nu
|
||||
switch(detType){
|
||||
case slsDetectorDefs::MYTHEN:
|
||||
NUM_DAC_WIDGETS = 6;
|
||||
NUM_ADC_WIDGETS = 0;
|
||||
dacNames.push_back("v Trimbit:");
|
||||
dacNames.push_back("v Threshold:");
|
||||
dacNames.push_back("v Shaper1:");
|
||||
dacNames.push_back("v Shaper2:");
|
||||
dacNames.push_back("v Calibration:");
|
||||
dacNames.push_back("v Preamp:");
|
||||
break;
|
||||
case slsDetectorDefs::EIGER:
|
||||
NUM_DAC_WIDGETS = 16;
|
||||
NUM_ADC_WIDGETS = 0;
|
||||
break;
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
NUM_DAC_WIDGETS = 8;
|
||||
NUM_ADC_WIDGETS = 2;
|
||||
dacNames.push_back("Reference Voltage:");
|
||||
dacNames.push_back("Cascade n Voltage:");
|
||||
dacNames.push_back("Cascade p Voltage:");
|
||||
dacNames.push_back("Comp. Output Voltage:");
|
||||
dacNames.push_back("Cascade out Voltage:");
|
||||
dacNames.push_back("Comp. Input Voltage:");
|
||||
dacNames.push_back("Comp. Ref Voltage:");
|
||||
dacNames.push_back("Base Test Current:");
|
||||
|
||||
adcNames.push_back("Temperature ADC:");
|
||||
adcNames.push_back("Temperature FPGA:");
|
||||
|
||||
break;
|
||||
default:
|
||||
qDefs::ErrorMessage(string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"Developer");
|
||||
exit(-1);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//layout
|
||||
setFixedWidth(765);
|
||||
setFixedHeight(50+(NUM_DAC_WIDGETS/2)*35);
|
||||
//setHeight(340);
|
||||
scroll = new QScrollArea;
|
||||
scroll->setFrameShape(QFrame::NoFrame);
|
||||
scroll->setWidget(this);
|
||||
scroll->setWidgetResizable(true);
|
||||
|
||||
layout = new QGridLayout(scroll);
|
||||
layout->setContentsMargins(20,10,10,5);
|
||||
setLayout(layout);
|
||||
|
||||
//dacs
|
||||
boxDacs = new QGroupBox("Dacs",this);
|
||||
boxDacs->setFixedHeight(25+(NUM_DAC_WIDGETS/2)*35);
|
||||
layout->addWidget(boxDacs,0,0);
|
||||
CreateDACWidgets();
|
||||
//adcs
|
||||
if((detType==slsDetectorDefs::GOTTHARD)||(detType==slsDetectorDefs::AGIPD)){
|
||||
setFixedHeight((50+(NUM_DAC_WIDGETS/2)*35)+(50+(NUM_ADC_WIDGETS/2)*35));
|
||||
boxAdcs = new QGroupBox("ADCs",this);
|
||||
boxAdcs->setFixedHeight(25+(NUM_ADC_WIDGETS/2)*35);
|
||||
layout->addWidget(boxAdcs,1,0);
|
||||
CreateADCWidgets();
|
||||
//to make the adcs at the bottom most
|
||||
int diff = 340-height();
|
||||
setFixedHeight(340);
|
||||
layout->setVerticalSpacing(diff);
|
||||
//timer to check adcs
|
||||
adcTimer = new QTimer(this);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabDeveloper::Initialization(){
|
||||
connect(adcTimer, SIGNAL(timeout()), this, SLOT(RefreshAdcs()));
|
||||
|
||||
//for(int i=0;i<NUM_DAC_WIDGETS;i++){
|
||||
//connect(spinDacs[i], SIGNAL(editingFinished()), this, SLOT(SetFileSteps()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabDeveloper::CreateDACWidgets(){
|
||||
QGridLayout *dacLayout = new QGridLayout(boxDacs);
|
||||
|
||||
for(int i=0;i<NUM_DAC_WIDGETS;i++){
|
||||
lblDacs[i] = new QLabel(QString(dacNames[i].c_str()),boxDacs);
|
||||
spinDacs[i] = new QDoubleSpinBox(boxDacs);
|
||||
spinDacs[i]->setMaximum(10000);
|
||||
|
||||
dacLayout->addWidget(lblDacs[i],(int)(i/2),((i%2)==0)?1:4);
|
||||
dacLayout->addWidget(spinDacs[i],(int)(i/2),((i%2)==0)?2:5);
|
||||
if(!(i%2)){
|
||||
dacLayout->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed),(int)(i/2),0);
|
||||
dacLayout->addItem(new QSpacerItem(60,20,QSizePolicy::Fixed,QSizePolicy::Fixed),(int)(i/2),3);
|
||||
dacLayout->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed),(int)(i/2),6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabDeveloper::CreateADCWidgets(){
|
||||
QGridLayout *adcLayout = new QGridLayout(boxAdcs);
|
||||
|
||||
for(int i=0;i<NUM_ADC_WIDGETS;i++){
|
||||
lblAdcs[i] = new QLabel(QString(adcNames[i].c_str()),boxAdcs);
|
||||
spinAdcs[i] = new QDoubleSpinBox(boxAdcs);
|
||||
spinAdcs[i]->setMaximum(10000);
|
||||
|
||||
adcLayout->addWidget(lblAdcs[i],(int)(i/2),((i%2)==0)?1:4);
|
||||
adcLayout->addWidget(spinAdcs[i],(int)(i/2),((i%2)==0)?2:5);
|
||||
if(!(i%2)){
|
||||
adcLayout->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed),(int)(i/2),0);
|
||||
adcLayout->addItem(new QSpacerItem(60,20,QSizePolicy::Fixed,QSizePolicy::Fixed),(int)(i/2),3);
|
||||
adcLayout->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Fixed),(int)(i/2),6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){
|
||||
switch(detType){
|
||||
case slsDetectorDefs::MYTHEN:
|
||||
switch(index){
|
||||
case 0: return slsDetectorDefs::TRIMBIT_SIZE;
|
||||
case 1: return slsDetectorDefs::THRESHOLD;
|
||||
case 2: return slsDetectorDefs::SHAPER1;
|
||||
case 3: return slsDetectorDefs::SHAPER2;
|
||||
case 4: return slsDetectorDefs::CALIBRATION_PULSE;
|
||||
case 5: return slsDetectorDefs::PREAMP;
|
||||
default:
|
||||
qDefs::ErrorMessage("Unknown DAC/ADC Index. Weird Error","Developer");
|
||||
Refresh();
|
||||
break;
|
||||
}
|
||||
case slsDetectorDefs::EIGER:
|
||||
return slsDetectorDefs::HUMIDITY;
|
||||
/**fill in here*/
|
||||
break;
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
switch(index){
|
||||
case 0: return slsDetectorDefs::G_VREF_DS;
|
||||
case 1: return slsDetectorDefs::G_VCASCN_PB;
|
||||
case 2: return slsDetectorDefs::G_VCASCP_PB;
|
||||
case 3: return slsDetectorDefs::G_VOUT_CM;
|
||||
case 4: return slsDetectorDefs::G_VCASC_OUT;
|
||||
case 5: return slsDetectorDefs::G_VIN_CM;
|
||||
case 6: return slsDetectorDefs::G_VREF_COMP;
|
||||
case 7: return slsDetectorDefs::G_IB_TESTC;
|
||||
case 8: return slsDetectorDefs::TEMPERATURE_ADC;
|
||||
case 9: return slsDetectorDefs::TEMPERATURE_FPGA;
|
||||
default:
|
||||
qDefs::ErrorMessage("Unknown DAC/ADC Index. Weird Error","Developer");
|
||||
Refresh();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
qDefs::ErrorMessage(string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"Developer");
|
||||
exit(-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabDeveloper::RefreshAdcs(){
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "Updating ADCs" <<endl;
|
||||
#endif
|
||||
adcTimer->stop();
|
||||
for(int i=0;i<NUM_ADC_WIDGETS;i++)
|
||||
spinAdcs[i]->setValue(myDet->getADC(getSLSIndex(i+NUM_DAC_WIDGETS)));
|
||||
adcTimer->start(ADC_TIMEOUT);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabDeveloper::Refresh(){
|
||||
#ifdef VERBOSE
|
||||
cout << "Updating Dacs and Adcs" <<endl;
|
||||
#endif
|
||||
//dacs
|
||||
for(int i=0;i<NUM_DAC_WIDGETS;i++)
|
||||
spinDacs[i]->setValue(myDet->setDAC(-1,getSLSIndex(i)));
|
||||
|
||||
//adcs
|
||||
RefreshAdcs();
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,16 +5,16 @@
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
/** Qt Project Class Headers */
|
||||
//Qt Project Class Headers
|
||||
#include "qTabMeasurement.h"
|
||||
#include "qDefs.h"
|
||||
#include "qDrawPlot.h"
|
||||
/** Project Class Headers */
|
||||
//Project Class Headers
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
/** Qt Include Headers */
|
||||
//Qt Include Headers
|
||||
#include <QStandardItemModel>
|
||||
/** C++ Include Headers */
|
||||
//C++ Include Headers
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
@ -47,18 +47,18 @@ qTabMeasurement::~qTabMeasurement(){
|
||||
|
||||
|
||||
void qTabMeasurement::SetupWidgetWindow(){
|
||||
/** Number of measurements */
|
||||
//Number of measurements
|
||||
numMeasurement=1;
|
||||
|
||||
/** Timer to update the progress bar **/
|
||||
//Timer to update the progress bar
|
||||
progressTimer = new QTimer(this);
|
||||
//btnStartStop->setStyleSheet("color:green");
|
||||
/** Exp Time **/
|
||||
//Exp Time
|
||||
qDefs::timeUnit unit;
|
||||
double time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9))));
|
||||
spinExpTime->setValue(time);
|
||||
comboExpUnit->setCurrentIndex((int)unit);
|
||||
/** Hide the error message **/
|
||||
//Hide the error message
|
||||
red = QPalette();
|
||||
red.setColor(QPalette::Active,QPalette::WindowText,Qt::red);
|
||||
acqPeriodTip = spinPeriod->toolTip();
|
||||
@ -66,20 +66,20 @@ void qTabMeasurement::SetupWidgetWindow(){
|
||||
"<nobr> #period#</nobr><br><br>")+
|
||||
QString("<nobr><font color=\"red\"><b>Acquisition Period</b> should be"
|
||||
" greater than or equal to <b>Exposure Time</b>.</font></nobr>");
|
||||
/** File Name **/
|
||||
//File Name
|
||||
dispFileName->setText(QString(myDet->getFileName().c_str()));
|
||||
/** File Index **/
|
||||
//File Index
|
||||
spinIndex->setValue(myDet->getFileIndex());
|
||||
/** only initially **/
|
||||
//only initially
|
||||
lblProgressIndex->setText(QString::number(myDet->getFileIndex()));
|
||||
/** only initially **/
|
||||
//ly initially
|
||||
progressBar->setValue(0);
|
||||
currentMeasurement = 0;
|
||||
|
||||
/** timing mode*/
|
||||
//timing mode
|
||||
SetupTimingMode();
|
||||
|
||||
/**file write enabled/disabled*/
|
||||
//file write enabled/disabled
|
||||
myDet->enableWriteToFile(true);
|
||||
//check if file enabled
|
||||
}
|
||||
@ -89,10 +89,10 @@ void qTabMeasurement::SetupWidgetWindow(){
|
||||
|
||||
|
||||
void qTabMeasurement::SetupTimingMode(){
|
||||
/** Get timing mode from detector*/
|
||||
//Get timing mode from detector
|
||||
slsDetectorDefs::externalCommunicationMode mode = myDet->setExternalCommunicationMode();
|
||||
|
||||
/** To be able to index items on a combo box */
|
||||
//To be able to index items on a combo box
|
||||
QStandardItemModel* model = qobject_cast<QStandardItemModel*>(comboTimingMode->model());
|
||||
QModelIndex index[NumTimingModes];
|
||||
QStandardItem* item[NumTimingModes];
|
||||
@ -101,7 +101,7 @@ void qTabMeasurement::SetupTimingMode(){
|
||||
index[i] = model->index(i, comboTimingMode->modelColumn(), comboTimingMode->rootModelIndex());
|
||||
item[i] = model->itemFromIndex(index[i]);
|
||||
}
|
||||
/** Enabling/Disabling depending on the detector type */
|
||||
//Enabling/Disabling depending on the detector type
|
||||
switch(myDet->getDetectorsType()){
|
||||
case slsDetectorDefs::MYTHEN:
|
||||
item[(int)Trigger_Exp_Series]->setEnabled(true);
|
||||
@ -132,12 +132,12 @@ void qTabMeasurement::SetupTimingMode(){
|
||||
exit(-1);
|
||||
break;
|
||||
}
|
||||
/** Setting the timing mode */
|
||||
//Setting the timing mode
|
||||
if(item[mode]->isEnabled()){
|
||||
/**if the timing mode is Auto and
|
||||
* number of Frames and number of triggers is 1,
|
||||
* then the timing mode is 'None'.
|
||||
* This is for the inexperienced user */
|
||||
//if the timing mode is Auto and
|
||||
// number of Frames and number of triggers is 1,
|
||||
// then the timing mode is 'None'.
|
||||
// This is for the inexperienced user
|
||||
if(mode==slsDetectorDefs::AUTO_TIMING){
|
||||
int frames = (int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1);
|
||||
int triggers = (int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1);
|
||||
@ -149,14 +149,14 @@ void qTabMeasurement::SetupTimingMode(){
|
||||
setTimingMode((int)Auto);
|
||||
}
|
||||
}else{
|
||||
/** mode +1 since the detector class has no timingmode as "None" */
|
||||
//mode +1 since the detector class has no timingmode as "None"
|
||||
comboTimingMode->setCurrentIndex((int)mode+1);
|
||||
setTimingMode((int)mode+1);
|
||||
}
|
||||
}
|
||||
/** Mode NOT ENABLED.
|
||||
* This should not happen -only if the server and gui has a mismatch
|
||||
* on which all modes are allowed in detectors */
|
||||
// Mode NOT ENABLED.
|
||||
// This should not happen -only if the server and gui has a mismatch
|
||||
// on which all modes are allowed in detectors
|
||||
else{
|
||||
qDefs::WarningMessage("Unknown Timing Mode detected from detector."
|
||||
"\n\nSetting the following defaults:\nTiming Mode \t: None\n"
|
||||
@ -172,39 +172,39 @@ void qTabMeasurement::SetupTimingMode(){
|
||||
|
||||
|
||||
void qTabMeasurement::Initialization(int timingChange){
|
||||
/** These signals are connected only at start up. The others are reinitialized when changing timing mode*/
|
||||
//These signals are connected only at start up. The others are reinitialized when changing timing mode
|
||||
if(!timingChange){
|
||||
/** Number of Measurements**/
|
||||
//Number of Measurements
|
||||
connect(spinNumMeasurements,SIGNAL(valueChanged(int)), this, SLOT(setNumMeasurements(int)));
|
||||
/** File Name**/
|
||||
//File Name
|
||||
connect(dispFileName, SIGNAL(textChanged(const QString&)),this, SLOT(setFileName(const QString&)));
|
||||
/** File Index**/
|
||||
//File Index
|
||||
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(setRunIndex(int)));
|
||||
/** Start/Stop Acquisition**/
|
||||
//Start/Stop Acquisition
|
||||
connect(btnStartStop, SIGNAL(clicked()), this, SLOT(startStopAcquisition()));
|
||||
/** Timing Mode **/
|
||||
//Timing Mode
|
||||
connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(setTimingMode(int)));//
|
||||
/** progress bar */
|
||||
//progress bar
|
||||
connect(progressTimer, SIGNAL(timeout()), this, SLOT(UpdateProgress()));
|
||||
/** enable write to file */
|
||||
//enable write to file
|
||||
connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(EnableFileWrite(bool)));
|
||||
}
|
||||
/** Number of Frames**/
|
||||
//Number of Frames
|
||||
connect(spinNumFrames,SIGNAL(valueChanged(int)), this, SLOT(setNumFrames(int)));
|
||||
/** Exposure Time **/
|
||||
//Exposure Time
|
||||
connect(spinExpTime,SIGNAL(valueChanged(double)), this, SLOT(setExposureTime()));//..myplot
|
||||
connect(comboExpUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setExposureTime()));
|
||||
/** Frame Period between exposures**/
|
||||
//Frame Period between exposures
|
||||
connect(spinPeriod,SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod()));//..myplot
|
||||
connect(comboPeriodUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setAcquisitionPeriod()));
|
||||
/** Number of Triggers**/
|
||||
//Number of Triggers
|
||||
connect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int)));//
|
||||
/** Delay After Trigger **/
|
||||
//Delay After Trigger
|
||||
connect(spinDelay,SIGNAL(valueChanged(double)), this, SLOT(setDelay()));//
|
||||
connect(comboDelayUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay()));
|
||||
/** Number of Gates**/
|
||||
//Number of Gates
|
||||
connect(spinNumGates,SIGNAL(valueChanged(int)), this, SLOT(setNumGates(int)));//
|
||||
/** Number of Probes**/
|
||||
//Number of Probes
|
||||
connect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int)));//
|
||||
}
|
||||
|
||||
@ -213,22 +213,22 @@ void qTabMeasurement::Initialization(int timingChange){
|
||||
|
||||
|
||||
void qTabMeasurement::DeInitialization(){
|
||||
/** Number of Frames**/
|
||||
//Number of Frames
|
||||
disconnect(spinNumFrames,SIGNAL(valueChanged(int)), this, SLOT(setNumFrames(int)));
|
||||
/** Exposure Time **/
|
||||
//Exposure Time
|
||||
disconnect(spinExpTime,SIGNAL(valueChanged(double)), this, SLOT(setExposureTime()));//..myplot
|
||||
disconnect(comboExpUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setExposureTime()));
|
||||
/** Frame Period between exposures**/
|
||||
//Frame Period between exposures
|
||||
disconnect(spinPeriod,SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod()));//..myplot
|
||||
disconnect(comboPeriodUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setAcquisitionPeriod()));
|
||||
/** Number of Triggers**/
|
||||
//Number of Triggers
|
||||
disconnect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int)));
|
||||
/** Delay After Trigger **/
|
||||
//Delay After Trigger
|
||||
disconnect(spinDelay,SIGNAL(valueChanged(double)), this, SLOT(setDelay()));
|
||||
disconnect(comboDelayUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay()));
|
||||
/** Number of Gates**/
|
||||
//Number of Gates
|
||||
disconnect(spinNumGates,SIGNAL(valueChanged(int)), this, SLOT(setNumGates(int)));
|
||||
/** Number of Probes**/
|
||||
//Number of Probes
|
||||
disconnect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int)));
|
||||
}
|
||||
|
||||
@ -239,7 +239,7 @@ void qTabMeasurement::DeInitialization(){
|
||||
void qTabMeasurement::Enable(bool enable){
|
||||
frameTimeResolved->setEnabled(enable);
|
||||
frameNotTimeResolved->setEnabled(enable);
|
||||
/** Enable this always **/
|
||||
//Enable this always
|
||||
if(!enable) btnStartStop->setEnabled(true);
|
||||
}
|
||||
|
||||
@ -249,7 +249,7 @@ void qTabMeasurement::Enable(bool enable){
|
||||
|
||||
void qTabMeasurement::setNumMeasurements(int val){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting Number of Measurements to " <<val<<endl;
|
||||
cout << "Setting Number of Measurements to " << val << endl;
|
||||
#endif
|
||||
numMeasurement = val;
|
||||
myPlot->setNumMeasurements(val);
|
||||
@ -260,7 +260,7 @@ void qTabMeasurement::setNumMeasurements(int val){
|
||||
void qTabMeasurement::setFileName(const QString& fName){
|
||||
myDet->setFileName(fName.toAscii().data());
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting File name to " << myDet->getFileName()<<endl;
|
||||
cout << "Setting File name to " << myDet->getFileName() << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -271,7 +271,7 @@ void qTabMeasurement::setRunIndex(int index){
|
||||
myDet->setFileIndex(index);
|
||||
lblProgressIndex->setText(QString::number(index));
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting File Index to " << myDet->getFileIndex()<<endl;
|
||||
cout << "Setting File Index to " << myDet->getFileIndex() << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -281,13 +281,13 @@ void qTabMeasurement::setRunIndex(int index){
|
||||
void qTabMeasurement::startStopAcquisition(){
|
||||
if(!btnStartStop->text().compare("Start")){
|
||||
#ifdef VERBOSE
|
||||
cout<<endl<<endl<<"Starting Acquisition"<<endl;
|
||||
cout << endl << endl << "Starting Acquisition" << endl;
|
||||
#endif
|
||||
//btnStartStop->setStyleSheet("color:red");
|
||||
btnStartStop->setText("Stop");
|
||||
Enable(0);
|
||||
progressBar->setValue(0);
|
||||
/** the progress which keeps adding up for all the measurements*/
|
||||
//the progress which keeps adding up for all the measurements
|
||||
currentMeasurement = 0;
|
||||
progressTimer->start(100);
|
||||
|
||||
@ -348,7 +348,7 @@ void qTabMeasurement::UpdateProgress(){
|
||||
void qTabMeasurement::setNumFrames(int val){
|
||||
myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,val);
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting number of frames to " << (int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1)<<endl;
|
||||
cout << "Setting number of frames to " << (int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1) << endl;
|
||||
#endif
|
||||
|
||||
}
|
||||
@ -359,10 +359,10 @@ void qTabMeasurement::setNumFrames(int val){
|
||||
|
||||
void qTabMeasurement::setExposureTime(){
|
||||
double exptimeNS;
|
||||
/** Get the value of timer in ns **/
|
||||
//Get the value of timer in ns
|
||||
exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value());
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting acquisition time to " << exptimeNS << " clocks" << "/"<<spinExpTime->value()<<qDefs::getUnitString((qDefs::timeUnit)comboExpUnit->currentIndex())<<endl;
|
||||
cout << "Setting acquisition time to " << exptimeNS << " clocks" << "/" << spinExpTime->value() << qDefs::getUnitString((qDefs::timeUnit)comboExpUnit->currentIndex()) << endl;
|
||||
#endif
|
||||
myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,(int64_t)exptimeNS);
|
||||
|
||||
@ -390,10 +390,10 @@ void qTabMeasurement::setExposureTime(){
|
||||
|
||||
void qTabMeasurement::setAcquisitionPeriod(){
|
||||
double acqtimeNS;
|
||||
/** Get the value of timer in ns **/
|
||||
//Get the value of timer in ns
|
||||
acqtimeNS = qDefs::getNSTime((qDefs::timeUnit)comboPeriodUnit->currentIndex(),spinPeriod->value());
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting frame period between exposures to " << acqtimeNS << " clocks"<< "/"<<spinPeriod->value()<<qDefs::getUnitString((qDefs::timeUnit)comboPeriodUnit->currentIndex())<<endl;
|
||||
cout << "Setting frame period between exposures to " << acqtimeNS << " clocks"<< "/" << spinPeriod->value() << qDefs::getUnitString((qDefs::timeUnit)comboPeriodUnit->currentIndex()) << endl;
|
||||
#endif
|
||||
myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,(int64_t)acqtimeNS);
|
||||
|
||||
@ -412,7 +412,7 @@ void qTabMeasurement::setAcquisitionPeriod(){
|
||||
lblPeriod->setText("Acquisition Period:");
|
||||
}
|
||||
|
||||
/** Check if the interval between plots is ok */
|
||||
//Check if the interval between plots is ok
|
||||
emit CheckPlotIntervalSignal();
|
||||
}
|
||||
|
||||
@ -423,7 +423,7 @@ void qTabMeasurement::setAcquisitionPeriod(){
|
||||
void qTabMeasurement::setNumTriggers(int val){
|
||||
myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,val);
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting number of triggers to " << (int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1)<<endl;
|
||||
cout << "Setting number of triggers to " << (int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1) << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -433,10 +433,10 @@ void qTabMeasurement::setNumTriggers(int val){
|
||||
|
||||
void qTabMeasurement::setDelay(){
|
||||
double exptimeNS;
|
||||
/** Get the value of timer in ns **/
|
||||
//Get the value of timer in ns
|
||||
exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboDelayUnit->currentIndex(),spinDelay->value());
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting delay after trigger to " << exptimeNS << " clocks"<< "/"<<spinDelay->value()<<qDefs::getUnitString((qDefs::timeUnit)comboDelayUnit->currentIndex())<<endl;
|
||||
cout << "Setting delay after trigger to " << exptimeNS << " clocks" << "/" << spinDelay->value() << qDefs::getUnitString((qDefs::timeUnit)comboDelayUnit->currentIndex()) << endl;
|
||||
#endif
|
||||
myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,(int64_t)exptimeNS);
|
||||
}
|
||||
@ -448,7 +448,7 @@ void qTabMeasurement::setDelay(){
|
||||
void qTabMeasurement::setNumGates(int val){
|
||||
myDet->setTimer(slsDetectorDefs::GATES_NUMBER,val);
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting number of gates to " << (int)myDet->setTimer(slsDetectorDefs::GATES_NUMBER,-1)<<endl;
|
||||
cout << "Setting number of gates to " << (int)myDet->setTimer(slsDetectorDefs::GATES_NUMBER,-1) << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -459,7 +459,7 @@ void qTabMeasurement::setNumGates(int val){
|
||||
void qTabMeasurement::setNumProbes(int val){
|
||||
myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,val);
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting number of frames to " << (int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1)<<endl;
|
||||
cout << "Setting number of frames to " << (int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1) << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -469,9 +469,9 @@ void qTabMeasurement::setNumProbes(int val){
|
||||
|
||||
void qTabMeasurement::setTimingMode(int mode){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting Timing mode to " << comboTimingMode->currentText().toAscii().data()<<endl;
|
||||
cout << "Setting Timing mode to " << comboTimingMode->currentText().toAscii().data() << endl;
|
||||
#endif
|
||||
/** Default settings */
|
||||
//Default settings
|
||||
lblNumFrames->setEnabled(false); spinNumFrames->setEnabled(false);
|
||||
lblExpTime->setEnabled(false); spinExpTime->setEnabled(false); comboExpUnit->setEnabled(false);
|
||||
lblPeriod->setEnabled(false); spinPeriod->setEnabled(false); comboPeriodUnit->setEnabled(false);
|
||||
@ -482,21 +482,21 @@ void qTabMeasurement::setTimingMode(int mode){
|
||||
|
||||
bool success = false;
|
||||
switch(mode){
|
||||
case None:/** Exposure Time */
|
||||
case None://Exposure Time
|
||||
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
|
||||
setNumFrames(1);
|
||||
setNumTriggers(1);
|
||||
if(myDet->setExternalCommunicationMode(slsDetectorDefs::AUTO_TIMING)==slsDetectorDefs::AUTO_TIMING)
|
||||
success = true;
|
||||
break;
|
||||
case Auto:/** Number of Frames, Exposure Time, Acquisition Period */
|
||||
case Auto://Number of Frames, Exposure Time, Acquisition Period
|
||||
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
|
||||
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
|
||||
lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true);
|
||||
if(myDet->setExternalCommunicationMode(slsDetectorDefs::AUTO_TIMING)==slsDetectorDefs::AUTO_TIMING)
|
||||
success = true;
|
||||
break;
|
||||
case Trigger_Exp_Series:/** Number of Frames, Exposure Time, Acquisition Period, Number of Triggers, Delay */
|
||||
case Trigger_Exp_Series://Number of Frames, Exposure Time, Acquisition Period, Number of Triggers, Delay
|
||||
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
|
||||
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
|
||||
lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true);
|
||||
@ -505,13 +505,13 @@ void qTabMeasurement::setTimingMode(int mode){
|
||||
if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_EXPOSURE)==slsDetectorDefs::TRIGGER_EXPOSURE)
|
||||
success = true;
|
||||
break;
|
||||
case Trigger_Frame:/** Exposure Time, Number of Triggers */
|
||||
case Trigger_Frame://Exposure Time, Number of Triggers
|
||||
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
|
||||
lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true);
|
||||
if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_FRAME)==slsDetectorDefs::TRIGGER_FRAME)
|
||||
success = true;
|
||||
break;
|
||||
case Trigger_Readout:/** Number of Frames, Exposure Time, Acquisition Period, Delay */
|
||||
case Trigger_Readout://Number of Frames, Exposure Time, Acquisition Period, Delay
|
||||
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
|
||||
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
|
||||
lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true);
|
||||
@ -519,13 +519,13 @@ void qTabMeasurement::setTimingMode(int mode){
|
||||
if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_READOUT)==slsDetectorDefs::TRIGGER_READOUT)
|
||||
success = true;
|
||||
break;
|
||||
case Gated:/** Number of Frames, Number of Gates */
|
||||
case Gated://Number of Frames, Number of Gates
|
||||
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
|
||||
lblNumGates->setEnabled(true); spinNumGates->setEnabled(true);
|
||||
if(myDet->setExternalCommunicationMode(slsDetectorDefs::GATE_FIX_NUMBER)==slsDetectorDefs::GATE_FIX_NUMBER)
|
||||
success = true;
|
||||
break;
|
||||
case Gated_Start:/** Number of Frames, Exposure Time, Acquisition Period, Number of Triggers, Number of Gates */
|
||||
case Gated_Start://Number of Frames, Exposure Time, Acquisition Period, Number of Triggers, Number of Gates
|
||||
lblNumFrames->setEnabled(true); spinNumFrames->setEnabled(true);
|
||||
lblExpTime->setEnabled(true); spinExpTime->setEnabled(true); comboExpUnit->setEnabled(true);
|
||||
lblPeriod->setEnabled(true); spinPeriod->setEnabled(true); comboPeriodUnit->setEnabled(true);
|
||||
@ -534,13 +534,13 @@ void qTabMeasurement::setTimingMode(int mode){
|
||||
if(myDet->setExternalCommunicationMode(slsDetectorDefs::GATE_WITH_START_TRIGGER)==slsDetectorDefs::GATE_WITH_START_TRIGGER)
|
||||
success = true;
|
||||
break;
|
||||
case Trigger_Window:/** Number of Triggers */
|
||||
case Trigger_Window://Number of Triggers
|
||||
lblNumTriggers->setEnabled(true); spinNumTriggers->setEnabled(true);
|
||||
if(myDet->setExternalCommunicationMode(slsDetectorDefs::TRIGGER_WINDOW)==slsDetectorDefs::TRIGGER_WINDOW)
|
||||
success = true;
|
||||
break;
|
||||
default:
|
||||
/** This should never happen */
|
||||
//This should never happen
|
||||
qDefs::ErrorMessage("Timing mode unknown to GUI","Measurement");
|
||||
exit(-1);
|
||||
}
|
||||
@ -553,43 +553,43 @@ void qTabMeasurement::setTimingMode(int mode){
|
||||
return;
|
||||
}
|
||||
|
||||
if(mode!=None){/** Number of Probes */
|
||||
if(mode!=None){//Number of Probes
|
||||
if(myDet->getDetectorsType()==slsDetectorDefs::MYTHEN){
|
||||
lblNumProbes->setEnabled(true); spinNumProbes->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
/** To disconnect all the signals before changing their values*/
|
||||
//To disconnect all the signals before changing their values
|
||||
DeInitialization();
|
||||
|
||||
|
||||
double time;
|
||||
int val;
|
||||
qDefs::timeUnit unit;
|
||||
/**Number of Frames */
|
||||
//Number of Frames
|
||||
if(lblNumFrames->isEnabled()){
|
||||
val = (int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1);
|
||||
spinNumFrames->setValue(val);
|
||||
#ifdef VERBOSE
|
||||
cout<<"Getting number of frames : " << val <<endl;
|
||||
cout << "Getting number of frames : " << val <<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**Exposure Time */
|
||||
//Exposure Time
|
||||
if(lblExpTime->isEnabled()){
|
||||
time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9))));
|
||||
#ifdef VERBOSE
|
||||
cout<<"Getting acquisition time : " << time << qDefs::getUnitString(unit) << endl;
|
||||
cout << "Getting acquisition time : " << time << qDefs::getUnitString(unit) << endl;
|
||||
#endif
|
||||
spinExpTime->setValue(time);
|
||||
comboExpUnit->setCurrentIndex((int)unit);
|
||||
}
|
||||
|
||||
/**Frame Period between exposures */
|
||||
//Frame Period between exposures
|
||||
if(lblPeriod->isEnabled()){
|
||||
time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-9))));
|
||||
#ifdef VERBOSE
|
||||
cout<<"Getting frame period between exposures : " << time << qDefs::getUnitString(unit) << endl;
|
||||
cout << "Getting frame period between exposures : " << time << qDefs::getUnitString(unit) << endl;
|
||||
#endif
|
||||
spinPeriod->setValue(time);
|
||||
comboPeriodUnit->setCurrentIndex((int)unit);
|
||||
@ -618,44 +618,44 @@ void qTabMeasurement::setTimingMode(int mode){
|
||||
lblPeriod->setText("Acquisition Period:");
|
||||
}
|
||||
|
||||
/**Number of Triggers */
|
||||
//Number of Triggers
|
||||
if(lblNumTriggers->isEnabled()){
|
||||
val = (int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1);
|
||||
spinNumTriggers->setValue(val);
|
||||
#ifdef VERBOSE
|
||||
cout<<"Getting number of triggers : " << val <<endl;
|
||||
cout << "Getting number of triggers : " << val <<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**Delay After Trigger */
|
||||
//Delay After Trigger
|
||||
if(lblDelay->isEnabled()){
|
||||
time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::DELAY_AFTER_TRIGGER,-1)*(1E-9))));
|
||||
#ifdef VERBOSE
|
||||
cout<<"Getting delay after trigger : " << time << qDefs::getUnitString(unit) << endl;
|
||||
cout << "Getting delay after trigger : " << time << qDefs::getUnitString(unit) << endl;
|
||||
#endif
|
||||
spinDelay->setValue(time);
|
||||
comboDelayUnit->setCurrentIndex((int)unit);
|
||||
}
|
||||
|
||||
/**Number of Gates */
|
||||
//Number of Gates
|
||||
if(lblNumGates->isEnabled()){
|
||||
val = (int)myDet->setTimer(slsDetectorDefs::GATES_NUMBER,-1);
|
||||
spinNumGates->setValue(val);
|
||||
#ifdef VERBOSE
|
||||
cout<<"Getting number of gates : " << val <<endl;
|
||||
cout << "Getting number of gates : " << val << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**Number of Probes */
|
||||
// Number of Probes
|
||||
if(lblNumProbes->isEnabled()){
|
||||
val = (int)myDet->setTimer(slsDetectorDefs::PROBES_NUMBER,-1);
|
||||
spinNumProbes->setValue(val);
|
||||
#ifdef VERBOSE
|
||||
cout<<"Getting number of probes : " << val <<endl;
|
||||
cout << "Getting number of probes : " << val << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
/** To reconnect all the signals after changing their values*/
|
||||
//To reconnect all the signals after changing their values
|
||||
Initialization(1);
|
||||
|
||||
|
||||
@ -679,13 +679,13 @@ void qTabMeasurement::EnableFileWrite(bool enable){
|
||||
|
||||
|
||||
void qTabMeasurement::Refresh(){
|
||||
/** File Name **/
|
||||
//File Name
|
||||
dispFileName->setText(QString(myDet->getFileName().c_str()));
|
||||
/** File Index **/
|
||||
//File Index
|
||||
spinIndex->setValue(myDet->getFileIndex());
|
||||
/** progress label index **/
|
||||
//progress label index
|
||||
lblProgressIndex->setText(QString::number(myDet->getFileIndex()));
|
||||
/** Timing mode**/
|
||||
//Timing mode*
|
||||
SetupTimingMode();
|
||||
|
||||
// to let qdrawplot know that triggers or frames are used
|
||||
|
@ -482,6 +482,9 @@ void qTabPlot::EnableScanBox(bool enable,int id){
|
||||
radioLevel1->setChecked(!enable);
|
||||
}
|
||||
}
|
||||
/**if(boxScan->isEnabled()){
|
||||
myDet->setPlotType(i);
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -7,10 +7,10 @@
|
||||
|
||||
#include "qTabSettings.h"
|
||||
#include "qDefs.h"
|
||||
/** Project Class Headers */
|
||||
// Project Class Headers
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
/** C++ Include Headers */
|
||||
// C++ Include Headers
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
@ -34,22 +34,22 @@ qTabSettings::~qTabSettings(){
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabSettings::SetupWidgetWindow(){
|
||||
/** Detector Type*/
|
||||
// Detector Type
|
||||
detType=myDet->getDetectorsType();
|
||||
|
||||
/** Settings */
|
||||
// Settings
|
||||
SetupDetectorSettings();
|
||||
comboSettings->setCurrentIndex(myDet->getSettings(detID));
|
||||
|
||||
/**expert mode is not enabled initially*/
|
||||
//expert mode is not enabled initially
|
||||
lblThreshold->setEnabled(false);
|
||||
spinThreshold->setEnabled(false);
|
||||
|
||||
/** Number of Modules */
|
||||
// Number of Modules
|
||||
spinNumModules->setMaximum(myDet->getMaxNumberOfModules());
|
||||
spinNumModules->setValue(myDet->setNumberOfModules());
|
||||
|
||||
/** Dynamic Range */
|
||||
// Dynamic Range
|
||||
switch(myDet->setDynamicRange(-1)){
|
||||
case 32: comboDynamicRange->setCurrentIndex(0); break;
|
||||
case 16: comboDynamicRange->setCurrentIndex(1); break;
|
||||
@ -63,18 +63,18 @@ void qTabSettings::SetupWidgetWindow(){
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabSettings::SetupDetectorSettings(){
|
||||
/** Get detector settings from detector*/
|
||||
// Get detector settings from detector
|
||||
slsDetectorDefs::detectorSettings sett = myDet->getSettings(detID);
|
||||
|
||||
/** To be able to index items on a combo box */
|
||||
// To be able to index items on a combo box
|
||||
model = qobject_cast<QStandardItemModel*>(comboSettings->model());
|
||||
if (model) {
|
||||
for(int i=0;i<NumSettings;i++){
|
||||
index[i] = model->index(i, comboSettings->modelColumn(), comboSettings->rootModelIndex());
|
||||
item[i] = model->itemFromIndex(index[i]);
|
||||
}
|
||||
/** Enabling/Disabling depending on the detector type
|
||||
Undefined and uninitialized are enabled for all detectors*/
|
||||
// Enabling/Disabling depending on the detector type
|
||||
// Undefined and uninitialized are enabled for all detectors
|
||||
if(sett==slsDetectorDefs::UNDEFINED)
|
||||
item[(int)Uninitialized]->setEnabled(false);
|
||||
else if(sett==slsDetectorDefs::UNINITIALIZED)
|
||||
@ -116,9 +116,9 @@ void qTabSettings::SetupDetectorSettings(){
|
||||
exit(-1);
|
||||
break;
|
||||
}
|
||||
/** detector settings selected NOT ENABLED.
|
||||
* This should not happen -only if the server and gui has a mismatch
|
||||
* on which all modes are allowed in detectors */
|
||||
// detector settings selected NOT ENABLED.
|
||||
// This should not happen -only if the server and gui has a mismatch
|
||||
// on which all modes are allowed in detectors
|
||||
if(!(item[(int)sett]->isEnabled())){
|
||||
qDefs::ErrorMessage("Unknown Detector Settings retrieved from detector. "
|
||||
"Exiting GUI.","Settings");
|
||||
@ -127,7 +127,7 @@ void qTabSettings::SetupDetectorSettings(){
|
||||
#endif
|
||||
exit(-1);
|
||||
}
|
||||
/** Setting the detector settings */
|
||||
// Setting the detector settings
|
||||
else comboSettings->setCurrentIndex((int)sett);
|
||||
}
|
||||
}
|
||||
@ -135,33 +135,33 @@ void qTabSettings::SetupDetectorSettings(){
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabSettings::Initialization(){
|
||||
/** Settings */
|
||||
// Settings
|
||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
|
||||
/** Number of Modules */
|
||||
// Number of Modules
|
||||
connect(spinNumModules, SIGNAL(valueChanged(int)), this, SLOT(SetNumberOfModules(int)));
|
||||
/** Dynamic Range */
|
||||
// Dynamic Range
|
||||
connect(comboDynamicRange, SIGNAL(activated(int)), this, SLOT(SetDynamicRange(int)));
|
||||
/** Threshold */
|
||||
// Threshold
|
||||
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabSettings::setSettings(int index){
|
||||
/** The first time settings is changed from undefined or uninitialized to a proper setting,
|
||||
* then undefined/uninitialized should be disabled */
|
||||
// The first time settings is changed from undefined or uninitialized to a proper setting,
|
||||
// then undefined/uninitialized should be disabled
|
||||
if(item[(int)Undefined]->isEnabled()){
|
||||
/**Do not disable it if this wasnt selected again by mistake*/
|
||||
//Do not disable it if this wasnt selected again by mistake
|
||||
if(index!=(int)Undefined)
|
||||
item[(int)Undefined]->setEnabled(false);
|
||||
}else if(item[(int)Uninitialized]->isEnabled()){
|
||||
/**Do not disable it if this wasnt selected again by mistake*/
|
||||
//Do not disable it if this wasnt selected again by mistake
|
||||
if(index!=(int)Uninitialized)
|
||||
item[(int)Uninitialized]->setEnabled(false);
|
||||
}
|
||||
slsDetectorDefs::detectorSettings sett = myDet->setSettings((slsDetectorDefs::detectorSettings)index,detID);
|
||||
#ifdef VERBOSE
|
||||
cout << "Settings have been set to "<<myDet->slsDetectorBase::getDetectorSettings(sett) << endl;
|
||||
cout << "Settings have been set to " << myDet->slsDetectorBase::getDetectorSettings(sett) << endl;
|
||||
#endif
|
||||
if((detType==slsDetectorDefs::GOTTHARD)||(detType==slsDetectorDefs::AGIPD)){
|
||||
lblThreshold->setEnabled(false);
|
||||
@ -250,13 +250,13 @@ void qTabSettings::SetEnergy(){
|
||||
|
||||
|
||||
void qTabSettings::Refresh(){
|
||||
/** Settings */
|
||||
// Settings
|
||||
SetupDetectorSettings();
|
||||
comboSettings->setCurrentIndex(myDet->getSettings(detID));
|
||||
/** Number of Modules */
|
||||
// Number of Modules
|
||||
spinNumModules->setValue(myDet->setNumberOfModules());
|
||||
|
||||
/** Dynamic Range */
|
||||
// Dynamic Range
|
||||
switch(myDet->setDynamicRange(-1)){
|
||||
case 32: comboDynamicRange->setCurrentIndex(0); break;
|
||||
case 16: comboDynamicRange->setCurrentIndex(1); break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user