diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui index 9d700034d..5e383bb75 100644 --- a/slsDetectorGui/forms/form_tab_dataoutput.ui +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -31,287 +31,12 @@ Form - - - - 20 - 160 - 731 - 171 - - - - Options - - - - - 15 - 25 - 701 - 66 - - - - - 3 - - - - - Flat field corrections. - #flatfield# filename - - - Flat Field Correction File: - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - false - - - Qt::ClickFocus - - - Flat field corrections. - #flatfield# filename - - - - - - - false - - - - 0 - 0 - - - - Flat field corrections. - #flatfield# filename - - - Browse - - - - :/icons/images/browse.png:/icons/images/browse.png - - - - - - - false - - - Custom dead time: - - - - - - - false - - - Auto - - - - - - - false - - - - 0 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - ns - - - 6 - - - 2000000000.000000000000000 - - - - - - - false - - - Rate Correction: - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - - - 15 - 95 - 701 - 66 - - - - - 3 - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 310 - 20 - - - - - - - - Discard Bad Channels - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - false - - - Angular Conversion - - - - - - - <nobr> -Compression using Root. Available only for Gotthard in Expert Mode. -</nobr><br><nobr> - #r_compression# -</nobr> - - - Compression - - - - - - - false - - - <nobr> -Compression using Root. Available only for Gotthard in Expert Mode. -</nobr><br><nobr> - #r_compression# -</nobr> - - - 10GbE - - - - - - - 20 - 25 - 731 + 15 + 30 + 747 116 @@ -331,7 +56,7 @@ Directory where one saves the data. 5 10 - 721 + 731 96 @@ -354,7 +79,7 @@ Directory where one saves the data. 10 10 - 701 + 716 86 @@ -514,6 +239,388 @@ Directory where one saves the data. + + + + 15 + 160 + 746 + 170 + + + + Options + + + + + 17 + 21 + 192 + 137 + + + + + 6 + + + + + false + + + <nobr> +Compression using Root. Available only for Gotthard in Expert Mode. +</nobr><br><nobr> + #r_compression# +</nobr> + + + 10GbE + + + + + + + <nobr> +Compression using Root. Available only for Gotthard in Expert Mode. +</nobr><br><nobr> + #r_compression# +</nobr> + + + Compression + + + + + + + false + + + Angular Conversion + + + + + + + Discard Bad Channels + + + + + + + + + 255 + 21 + 476 + 66 + + + + + 6 + + + + + false + + + Auto + + + + + + + false + + + + 0 + 0 + + + + Flat field corrections. + #flatfield# filename + + + Browse + + + + :/icons/images/browse.png:/icons/images/browse.png + + + + + + + Flat field corrections. + #flatfield# filename + + + Flat Field File: + + + + + + + false + + + + 0 + 0 + + + + + 100 + 0 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + ns + + + 6 + + + 2000000000.000000000000000 + + + + + + + false + + + Rate: + + + + + + + false + + + Qt::ClickFocus + + + Flat field corrections. + #flatfield# filename + + + + + + + false + + + Custom dead time: + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + + + 230 + 21 + 20 + 134 + + + + QFrame::Raised + + + Qt::Vertical + + + + + + 244 + 92 + 491 + 72 + + + + + + 11 + 4 + 475 + 62 + + + + + + + + 200 + 16777215 + + + + + Continous + + + + + Store in RAM + + + + + + + + + 105 + 16777215 + + + + Clock Divider: + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + + 200 + 16777215 + + + + + Full Speed + + + + + Half Speed + + + + + Quarter Speed + + + + + Super Slow Speed + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + + 105 + 16777215 + + + + Flags: + + + + + + + + Parallel + + + + + Non Parallel + + + + + Safe + + + + + + + + dispReadOutputDir diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h index 7f29b5164..7fd11da7e 100644 --- a/slsDetectorGui/include/qTabDataOutput.h +++ b/slsDetectorGui/include/qTabDataOutput.h @@ -67,6 +67,14 @@ private: QPalette *red1; QPalette *black1; + /** enum for the Eiger clock divider */ + enum {FullSpeed, HalfSpeed, QuarterSpeed, SuperSlowSpeed, NumberofSpeeds}; + /** enum for the Eiger readout flags1 */ + enum {Continous, Storeinram}; + /** enum for the Eiger readout flags2 */ + enum {Parallel, NonParallel, Safe}; + + /** methods */ /** Sets up the widget */ void SetupWidgetWindow(); @@ -81,6 +89,11 @@ private: /** Get Compression */ void GetCompression(); + /** update speed */ + void updateSpeedFromServer(); + + /** update flags */ + void updateFlagsFromServer(); private slots: @@ -120,6 +133,12 @@ void SetCompression(bool enable); /** enable 10GbE */ void EnableTenGigabitEthernet(bool enable, int get=0); +/** set speed */ +void setSpeed(); + +/** set flags */ +void setFlags(); + signals: /**signal to enable/disable positions in Actions*/ void AngularConversionSignal(bool); diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 9af47f7a4..3465bddc9 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -47,6 +47,7 @@ qTabDataOutput::~qTabDataOutput(){ void qTabDataOutput::SetupWidgetWindow(){ // Detector Type detType=myDet->getDetectorsType(); + widgetEiger->setVisible(false); //rate correction - not for charge integrating detectors if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::EIGER)) @@ -55,8 +56,11 @@ void qTabDataOutput::SetupWidgetWindow(){ if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::GOTTHARD)) chkAngular->setEnabled(true); - if(detType == slsDetectorDefs::EIGER) + if(detType == slsDetectorDefs::EIGER){ chkTenGiga->setEnabled(true); + widgetEiger->setVisible(true); + + } /** error message **/ red = QPalette(); @@ -118,9 +122,6 @@ void qTabDataOutput::SetupWidgetWindow(){ #ifdef VERBOSE cout << "Getting bad channel correction:" << myDet->getBadChannelCorrection() << endl; #endif - - - disconnect(chkDiscardBad, SIGNAL(toggled(bool))); if(myDet->getBadChannelCorrection()) chkDiscardBad->setChecked(true); @@ -162,7 +163,16 @@ void qTabDataOutput::Initialization(){ //compression connect(chkCompression, SIGNAL(toggled(bool)), this, SLOT(SetCompression(bool))); //10GbE - connect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(EnableTenGigabitEthernet(bool))); + connect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(EnableTenGigabitEthernet(bool))); + + //eiger + if(widgetEiger->isVisible()){ + //speed + connect(comboEigerClkDivider,SIGNAL(currentIndexChanged(int)), this, SLOT(setSpeed())); + //flags + connect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(setFlags())); + connect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(setFlags())); + } } @@ -762,6 +772,133 @@ void qTabDataOutput::EnableTenGigabitEthernet(bool enable,int get){ //------------------------------------------------------------------------------------------------------------------------------------------------- +void qTabDataOutput::setSpeed(){ +#ifdef VERBOSE + cout << endl << "Setting Speed" << endl; +#endif + if(widgetEiger->isVisible()){ + myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER,comboEigerClkDivider->currentIndex()); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::setSpeed"); + updateSpeedFromServer(); + } + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabDataOutput::setFlags(){ +#ifdef VERBOSE + cout << endl << "Setting Readout Flags" << endl; +#endif + slsDetectorDefs::readOutFlags val = slsDetectorDefs::GET_READOUT_FLAGS; + if(widgetEiger->isVisible()){ + + //set to continous or storeinram + switch(comboEigerFlags1->currentIndex()){ + case Storeinram: val = slsDetectorDefs::STORE_IN_RAM; break; + default: val = slsDetectorDefs::CONTINOUS_RO; break; + } + myDet->setReadOutFlags(val); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::setFlags"); + + //set to parallel, nonparallel or safe + switch(comboEigerFlags2->currentIndex()){ + case Parallel: val = slsDetectorDefs::PARALLEL; break; + case Safe: val = slsDetectorDefs::SAFE; break; + default: val = slsDetectorDefs::NONPARALLEL; break; + } + myDet->setReadOutFlags(val); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::setFlags"); + + //update flags + updateFlagsFromServer(); + } + +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabDataOutput::updateSpeedFromServer(){ + int ret; + if(widgetEiger->isVisible()){ + disconnect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(setSpeed())); + + //get speed + ret = myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER, -1); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::updateSpeedFromServer"); + + //valid speed + if(ret >= 0 && ret < NumberofSpeeds) + comboEigerClkDivider->setCurrentIndex(ret); + + //invalid speed + else{ + qDefs::Message(qDefs::WARNING,"Inconsistent value from clock divider.\n" + "Setting it for all detectors involved to half speed.","qTabDataOutput::updateSpeedFromServer"); + //set to default + comboEigerClkDivider->setCurrentIndex(HalfSpeed); + myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER,HalfSpeed); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::updateSpeedFromServer"); + + } + connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(setSpeed())); + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabDataOutput::updateFlagsFromServer(){ + int ret; + if(widgetEiger->isVisible()){ + disconnect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(setFlags())); + disconnect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(setFlags())); + + //get speed + ret = myDet->setReadOutFlags(slsDetectorDefs::GET_READOUT_FLAGS); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::updateFlagsFromServer"); + + //invalid flags + if(ret==-1){ + qDefs::Message(qDefs::WARNING,"Inconsistent value for readout flags.\n" + "Setting it for all detectors involved to continous nonparallel mode.", + "qTabDataOutput::updateFlagsFromServer"); + //set to default + comboEigerFlags1->setCurrentIndex(Continous); + myDet->setReadOutFlags(slsDetectorDefs::CONTINOUS_RO); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::updateFlagsFromServer"); + comboEigerFlags2->setCurrentIndex(NonParallel); + myDet->setReadOutFlags(slsDetectorDefs::NONPARALLEL); + qDefs::checkErrorMessage(myDet,"qTabDataOutput::updateFlagsFromServer"); + } + + //valid flags + else{ + if(ret & slsDetectorDefs::STORE_IN_RAM) + comboEigerFlags1->setCurrentIndex(Storeinram); + else if(ret & slsDetectorDefs::CONTINOUS_RO) + comboEigerFlags1->setCurrentIndex(Continous); + if(ret & slsDetectorDefs::PARALLEL) + comboEigerFlags2->setCurrentIndex(Parallel); + else if(ret & slsDetectorDefs::NONPARALLEL) + comboEigerFlags2->setCurrentIndex(NonParallel); + else if(ret & slsDetectorDefs::SAFE) + comboEigerFlags2->setCurrentIndex(Safe); + } + + connect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(setFlags())); + connect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(setFlags())); + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qTabDataOutput::Refresh(){ #ifdef VERBOSE cout << endl << "**Updating DataOutput Tab" << endl; @@ -843,9 +980,24 @@ void qTabDataOutput::Refresh(){ EnableTenGigabitEthernet(-1,1); } + //Eiger specific + if(widgetEiger->isVisible()){ + //speed +#ifdef VERBOSE + cout << "Getting Speed" << endl; +#endif + updateSpeedFromServer(); + //flags +#ifdef VERBOSE + cout << "Getting Readout Flags" << endl; +#endif + updateFlagsFromServer(); + } + + #ifdef VERBOSE cout << "**Updated DataOutput Tab" << endl << endl; #endif