mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-03 19:30:04 +02:00
fixed dimensions, fixed rate corr bug, moved rate corr to server because config resets memory and ratecorr depends on client variables
This commit is contained in:
parent
342d4f8c30
commit
4939e47305
@ -100,7 +100,8 @@ enum {
|
|||||||
F_PULSE_PIXEL_AND_MOVE, /** < pulse pixel n number of times and move relatively by x and y */
|
F_PULSE_PIXEL_AND_MOVE, /** < pulse pixel n number of times and move relatively by x and y */
|
||||||
F_PULSE_CHIP, /** < pulse chip n number of times */
|
F_PULSE_CHIP, /** < pulse chip n number of times */
|
||||||
|
|
||||||
F_SET_RATE_CORRECT /** < set/reset rate correction tau */
|
F_SET_RATE_CORRECT, /** < set/reset rate correction tau */
|
||||||
|
F_GET_RATE_CORRECT, /** < get rate correction tau */
|
||||||
|
|
||||||
/* Always append functions hereafter!!! */
|
/* Always append functions hereafter!!! */
|
||||||
|
|
||||||
|
Binary file not shown.
@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer
|
Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer
|
||||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git/eigerDetectorServer
|
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git/eigerDetectorServer
|
||||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||||
Repsitory UUID: 769ba51f2796ac8088f29a6cdb87955befbbdae2
|
Repsitory UUID: f65bc993ef8b3548b52e677b3f42ae6229611d73
|
||||||
Revision: 201
|
Revision: 203
|
||||||
Branch: developer
|
Branch: developer
|
||||||
Last Changed Author: Dhanya_Maliakal
|
Last Changed Author: Dhanya_Maliakal
|
||||||
Last Changed Rev: 326
|
Last Changed Rev: 327
|
||||||
Last Changed Date: 2016-07-05 17:24:44 +0200
|
Last Changed Date: 2016-07-12 16:45:00 +0200
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
//#define SVNPATH ""
|
//#define SVNPATH ""
|
||||||
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git/eigerDetectorServer"
|
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git/eigerDetectorServer"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUID "769ba51f2796ac8088f29a6cdb87955befbbdae2"
|
#define SVNREPUUID "f65bc993ef8b3548b52e677b3f42ae6229611d73"
|
||||||
//#define SVNREV 0x326
|
//#define SVNREV 0x327
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTH "Dhanya_Maliakal"
|
#define SVNAUTH "Dhanya_Maliakal"
|
||||||
#define SVNREV 0x326
|
#define SVNREV 0x327
|
||||||
#define SVNDATE 0x20160705
|
#define SVNDATE 0x20160712
|
||||||
//
|
//
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
#include "FebControl.h"
|
#include "FebControl.h"
|
||||||
#include "Beb.h"
|
#include "Beb.h"
|
||||||
|
|
||||||
|
int default_tau_from_file= -1;
|
||||||
|
|
||||||
#define BEB_NUM 34
|
#define BEB_NUM 34
|
||||||
|
|
||||||
enum detectorSettings thisSettings;
|
enum detectorSettings thisSettings;
|
||||||
@ -535,16 +537,21 @@ int getRateCorrectionEnable(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
int getDefaultSettingsTau_in_nsec(){
|
int getDefaultSettingsTau_in_nsec(){
|
||||||
switch(thisSettings){
|
return default_tau_from_file;
|
||||||
case STANDARD: return STANDARD_TAU;
|
|
||||||
case HIGHGAIN: return HIGHGAIN_TAU;
|
|
||||||
case LOWGAIN: return LOWGAIN_TAU;
|
|
||||||
default: return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t getCurrentTau(){
|
||||||
|
if(!getRateCorrectionEnable())
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return Feb_Control_Get_RateTable_Tau_in_nsec();
|
||||||
|
}
|
||||||
|
|
||||||
int setModule(sls_detector_module myMod, int* gain, int* offset,int* delay, int64_t tau_ns){
|
void setDefaultSettingsTau_in_nsec(int t){
|
||||||
|
default_tau_from_file = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
int setModule(sls_detector_module myMod, int* gain, int* offset,int* delay){
|
||||||
int retval[2];
|
int retval[2];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -555,32 +562,6 @@ int setModule(sls_detector_module myMod, int* gain, int* offset,int* delay, int6
|
|||||||
//set the settings variable
|
//set the settings variable
|
||||||
setSettings( (enum detectorSettings)myMod.reg,-1);
|
setSettings( (enum detectorSettings)myMod.reg,-1);
|
||||||
|
|
||||||
|
|
||||||
//rate correction (ignore -2: from load settings)
|
|
||||||
if(tau_ns > -2){
|
|
||||||
//set settings, with no tau in calib file
|
|
||||||
if(tau_ns == -1){
|
|
||||||
tau_ns = getDefaultSettingsTau_in_nsec();
|
|
||||||
//incorrect settings
|
|
||||||
if(tau_ns < 0)
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
//set the tau for all
|
|
||||||
int64_t rate_retval = setRateCorrection(tau_ns); //tau_ns will not be -1 here
|
|
||||||
if(tau_ns != rate_retval){
|
|
||||||
if(rate_retval == -1)
|
|
||||||
return -2;
|
|
||||||
else
|
|
||||||
return -3;
|
|
||||||
}
|
|
||||||
//set settings, with no tau in calib file :
|
|
||||||
//only setting tau, rate correction should be off
|
|
||||||
//(in previous "error" returns, its switched off anyway)
|
|
||||||
if(tau_ns == -1)
|
|
||||||
setRateCorrection(0);
|
|
||||||
}else cprintf(RED,"rate not changed\n");
|
|
||||||
|
|
||||||
|
|
||||||
//set the gains and offset variables locally
|
//set the gains and offset variables locally
|
||||||
for(i=0;i<NGAIN;i++){
|
for(i=0;i<NGAIN;i++){
|
||||||
if(gain[i]>=0){
|
if(gain[i]>=0){
|
||||||
@ -629,7 +610,7 @@ int setModule(sls_detector_module myMod, int* gain, int* offset,int* delay, int6
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return thisSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -728,6 +709,9 @@ enum detectorSettings setSettings(enum detectorSettings sett, int imod){
|
|||||||
return thisSettings;
|
return thisSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum detectorSettings getSettings(){
|
||||||
|
return thisSettings;
|
||||||
|
}
|
||||||
|
|
||||||
int startReceiver(int d){
|
int startReceiver(int d){
|
||||||
printf("Going to prepare for acquisition with counter_bit:%d\n",Feb_Control_Get_Counter_Bit());
|
printf("Going to prepare for acquisition with counter_bit:%d\n",Feb_Control_Get_Counter_Bit());
|
||||||
|
@ -40,12 +40,5 @@
|
|||||||
|
|
||||||
enum detDacIndex{SVP,VTR,VRF,VRS,SVN,VTGSTV,VCMP_LL,VCMP_LR,CAL,VCMP_RL,RXB_RB,RXB_LB,VCMP_RR,VCP,VCN,VIS,VTHRESHOLD};
|
enum detDacIndex{SVP,VTR,VRF,VRS,SVN,VTGSTV,VCMP_LL,VCMP_LR,CAL,VCMP_RL,RXB_RB,RXB_LB,VCMP_RR,VCP,VCN,VIS,VTHRESHOLD};
|
||||||
|
|
||||||
enum defaultTauValues{
|
|
||||||
HIGHGAIN_TAU=410,
|
|
||||||
STANDARD_TAU=290,
|
|
||||||
LOWGAIN_TAU=180};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* SLSDETECTORSERVER_DEFS_H_ */
|
#endif /* SLSDETECTORSERVER_DEFS_H_ */
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorsPackage/slsDetectorSoftware
|
Path: slsDetectorsPackage/slsDetectorSoftware
|
||||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||||
Repsitory UUID: 769ba51f2796ac8088f29a6cdb87955befbbdae2
|
Repsitory UUID: f65bc993ef8b3548b52e677b3f42ae6229611d73
|
||||||
Revision: 1103
|
Revision: 1109
|
||||||
Branch: developer
|
Branch: developer
|
||||||
Last Changed Author: Dhanya_Maliakal
|
Last Changed Author: Dhanya_Maliakal
|
||||||
Last Changed Rev: 1103
|
Last Changed Rev: 1109
|
||||||
Last Changed Date: 2016-07-05 17:24:44 +0200
|
Last Changed Date: 2016-07-12 16:45:00 +0200
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorsPackage/slsDetectorSoftware/gotthardDetectorServer
|
Path: slsDetectorsPackage/slsDetectorSoftware/gotthardDetectorServer
|
||||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git/gotthardDetectorServer
|
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git/gotthardDetectorServer
|
||||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||||
Repsitory UUID: 769ba51f2796ac8088f29a6cdb87955befbbdae2
|
Repsitory UUID: f65bc993ef8b3548b52e677b3f42ae6229611d73
|
||||||
Revision: 193
|
Revision: 194
|
||||||
Branch: developer
|
Branch: developer
|
||||||
Last Changed Author: Dhanya_Maliakal
|
Last Changed Author: Dhanya_Maliakal
|
||||||
Last Changed Rev: 326
|
Last Changed Rev: 327
|
||||||
Last Changed Date: 2016-07-05 17:24:44 +0200
|
Last Changed Date: 2016-07-12 16:45:00 +0200
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
//#define SVNPATH ""
|
//#define SVNPATH ""
|
||||||
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git/gotthardDetectorServer"
|
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git/gotthardDetectorServer"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUID "769ba51f2796ac8088f29a6cdb87955befbbdae2"
|
#define SVNREPUUID "f65bc993ef8b3548b52e677b3f42ae6229611d73"
|
||||||
//#define SVNREV 0x326
|
//#define SVNREV 0x327
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTH "Dhanya_Maliakal"
|
#define SVNAUTH "Dhanya_Maliakal"
|
||||||
#define SVNREV 0x326
|
#define SVNREV 0x327
|
||||||
#define SVNDATE 0x20160705
|
#define SVNDATE 0x20160712
|
||||||
//
|
//
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorsPackage/slsDetectorSoftware/moenchDetectorServer
|
Path: slsDetectorsPackage/slsDetectorSoftware/moenchDetectorServer
|
||||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git/moenchDetectorServer
|
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git/moenchDetectorServer
|
||||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||||
Repsitory UUID: 769ba51f2796ac8088f29a6cdb87955befbbdae2
|
Repsitory UUID: f65bc993ef8b3548b52e677b3f42ae6229611d73
|
||||||
Revision: 76
|
Revision: 77
|
||||||
Branch: developer
|
Branch: developer
|
||||||
Last Changed Author: Dhanya_Maliakal
|
Last Changed Author: Dhanya_Maliakal
|
||||||
Last Changed Rev: 326
|
Last Changed Rev: 327
|
||||||
Last Changed Date: 2016-07-05 17:24:44 +0200
|
Last Changed Date: 2016-07-12 16:45:00 +0200
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
//#define SVNPATH ""
|
//#define SVNPATH ""
|
||||||
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git/moenchDetectorServer"
|
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git/moenchDetectorServer"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUID "769ba51f2796ac8088f29a6cdb87955befbbdae2"
|
#define SVNREPUUID "f65bc993ef8b3548b52e677b3f42ae6229611d73"
|
||||||
//#define SVNREV 0x326
|
//#define SVNREV 0x327
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTH "Dhanya_Maliakal"
|
#define SVNAUTH "Dhanya_Maliakal"
|
||||||
#define SVNREV 0x326
|
#define SVNREV 0x327
|
||||||
#define SVNDATE 0x20160705
|
#define SVNDATE 0x20160712
|
||||||
//
|
//
|
||||||
|
@ -421,7 +421,8 @@ void multiSlsDetector::updateOffsets(){
|
|||||||
|
|
||||||
for (int i=0; i<thisMultiDetector->numberOfDetectors; i++) {
|
for (int i=0; i<thisMultiDetector->numberOfDetectors; i++) {
|
||||||
if (detectors[i]) {
|
if (detectors[i]) {
|
||||||
cout<<"offsetY:"<<offsetY<<" prevChanY:"<<prevChanY<<" totalchan:"<< detectors[i]->getTotalNumberOfChannels(Y) <<" maxChanY:"<<maxChanY<<endl;
|
cout<<"offsetX:"<<offsetX<<" prevChanX:"<<prevChanX<<" offsetY:"<<offsetY<<" prevChanY:"<<prevChanY<<endl;
|
||||||
|
//cout<<" totalchan:"<< detectors[i]->getTotalNumberOfChannels(Y) <<" maxChanY:"<<maxChanY<<endl;
|
||||||
//incrementing in both direction
|
//incrementing in both direction
|
||||||
if(firstTime){
|
if(firstTime){
|
||||||
//incrementing in both directions
|
//incrementing in both directions
|
||||||
@ -453,7 +454,7 @@ void multiSlsDetector::updateOffsets(){
|
|||||||
if((maxChanX > 0) && ((offsetX + prevChanX + detectors[i]->getTotalNumberOfChannels(X)) > maxChanX))
|
if((maxChanX > 0) && ((offsetX + prevChanX + detectors[i]->getTotalNumberOfChannels(X)) > maxChanX))
|
||||||
cout<<"\nDetector[" << i << "] exceeds maximum channels allowed for complete detector set in X dimension!" << endl;
|
cout<<"\nDetector[" << i << "] exceeds maximum channels allowed for complete detector set in X dimension!" << endl;
|
||||||
offsetY = 0;
|
offsetY = 0;
|
||||||
prevChanY = 0;
|
prevChanY = detectors[i]->getTotalNumberOfChannels(Y);;
|
||||||
numY = 0; //assuming symmetry with this statement. whats on 1st column should be on 2nd column
|
numY = 0; //assuming symmetry with this statement. whats on 1st column should be on 2nd column
|
||||||
maxY = 0;
|
maxY = 0;
|
||||||
offsetX += prevChanX;
|
offsetX += prevChanX;
|
||||||
@ -1740,15 +1741,6 @@ int64_t multiSlsDetector::setTimer(timerIndex index, int64_t t){
|
|||||||
// check return values!!!
|
// check return values!!!
|
||||||
|
|
||||||
thisMultiDetector->timerValue[index]=ret1;
|
thisMultiDetector->timerValue[index]=ret1;
|
||||||
|
|
||||||
|
|
||||||
if (getDetectorsType() == EIGER) {
|
|
||||||
//if subexptime set, update rate correction in server and update result in multi client
|
|
||||||
double r;
|
|
||||||
if((index == SUBFRAME_ACQUISITION_TIME) && (t>=0) && getRateCorrection(r)){
|
|
||||||
setRateCorrection(r);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret1;
|
return ret1;
|
||||||
};
|
};
|
||||||
@ -2547,19 +2539,31 @@ int multiSlsDetector::flatFieldCorrect(double* datain, double *errin, double* da
|
|||||||
|
|
||||||
|
|
||||||
int multiSlsDetector::setRateCorrection(double t){
|
int multiSlsDetector::setRateCorrection(double t){
|
||||||
// double tdead[]=defaultTDead;
|
|
||||||
|
|
||||||
if (getDetectorsType() == MYTHEN){
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Setting rate correction with dead time "<< thisMultiDetector->tDead << std::endl;
|
std::cout<< "Setting rate correction with dead time "<< thisMultiDetector->tDead << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (t==0) {
|
|
||||||
thisMultiDetector->correctionMask&=~(1<<RATE_CORRECTION);
|
if (getDetectorsType() == EIGER){
|
||||||
return thisMultiDetector->correctionMask&(1<<RATE_CORRECTION);
|
int ret = OK, ret1= OK;
|
||||||
} else
|
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
|
||||||
thisMultiDetector->correctionMask|=(1<<RATE_CORRECTION);
|
if (detectors[idet]) {
|
||||||
|
ret=detectors[idet]->setRateCorrection(t);
|
||||||
|
if(detectors[idet]->getErrorMask())
|
||||||
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
if (ret1 != OK)
|
||||||
|
ret1=FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret1; //only success/fail
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//mythen, others
|
||||||
|
if (t==0) {
|
||||||
|
thisMultiDetector->correctionMask&=~(1<<RATE_CORRECTION);
|
||||||
|
return thisMultiDetector->correctionMask&(1<<RATE_CORRECTION);
|
||||||
|
} else
|
||||||
|
thisMultiDetector->correctionMask|=(1<<RATE_CORRECTION);
|
||||||
|
|
||||||
int ret, ret1=-100;
|
int ret, ret1=-100;
|
||||||
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
|
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
|
||||||
@ -2574,76 +2578,62 @@ int multiSlsDetector::setRateCorrection(double t){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getDetectorsType() != MYTHEN){
|
|
||||||
if (ret1==0)
|
|
||||||
thisMultiDetector->correctionMask&=~(1<<RATE_CORRECTION);
|
|
||||||
else
|
|
||||||
thisMultiDetector->correctionMask|=(1<<RATE_CORRECTION);
|
|
||||||
}
|
|
||||||
|
|
||||||
return thisMultiDetector->correctionMask&(1<<RATE_CORRECTION);
|
return thisMultiDetector->correctionMask&(1<<RATE_CORRECTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int multiSlsDetector::getRateCorrection(double &t){
|
int multiSlsDetector::getRateCorrection(double &t){
|
||||||
|
|
||||||
if (getDetectorsType() != MYTHEN){
|
if (getDetectorsType() == EIGER){
|
||||||
t = getRateCorrectionTau();
|
t = getRateCorrectionTau();
|
||||||
return getRateCorrection();
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thisMultiDetector->correctionMask&(1<<RATE_CORRECTION)) {
|
if (thisMultiDetector->correctionMask&(1<<RATE_CORRECTION)) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Rate correction is enabled with dead time "<< thisMultiDetector->tDead << std::endl;
|
std::cout<< "Rate correction is enabled with dead time "<< thisMultiDetector->tDead << std::endl;
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
} else
|
} else
|
||||||
t=0;
|
t=0;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Rate correction is disabled " << std::endl;
|
std::cout<< "Rate correction is disabled " << std::endl;
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
double multiSlsDetector::getRateCorrectionTau(){
|
double multiSlsDetector::getRateCorrectionTau(){
|
||||||
|
|
||||||
double ret1=-100,ret;
|
double ret1=-100,ret;
|
||||||
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
|
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
|
||||||
if (detectors[idet]) {
|
if (detectors[idet]) {
|
||||||
ret=detectors[idet]->getRateCorrectionTau();
|
ret=detectors[idet]->getRateCorrectionTau();
|
||||||
if (ret1==-100)
|
if (ret1==-100)
|
||||||
ret1=ret;
|
ret1=ret;
|
||||||
else if (ret!=ret1){
|
else if (ret!=ret1){
|
||||||
std::cout<< "Rate correction is different for different readouts " << std::endl;
|
std::cout<< "Rate correction is different for different readouts " << std::endl;
|
||||||
if(getDetectorsType() == EIGER)
|
ret1=-1;
|
||||||
ret1=-2;
|
}
|
||||||
else
|
}
|
||||||
ret1=-1; //same settings also return -1
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getDetectorsType() != MYTHEN){
|
if (getDetectorsType() == EIGER)
|
||||||
//if set by the slsDetector
|
return ret1;
|
||||||
if(ret1 == 0)
|
|
||||||
thisMultiDetector->correctionMask&=~(1<<RATE_CORRECTION);
|
|
||||||
else
|
|
||||||
thisMultiDetector->correctionMask|=(1<<RATE_CORRECTION);
|
|
||||||
return ret1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//only mythen
|
|
||||||
if (thisMultiDetector->correctionMask&(1<<RATE_CORRECTION)) {
|
|
||||||
|
//only mythen
|
||||||
|
if (thisMultiDetector->correctionMask&(1<<RATE_CORRECTION)) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Rate correction is enabled with dead time "<< thisMultiDetector->tDead << std::endl;
|
std::cout<< "Rate correction is enabled with dead time "<< thisMultiDetector->tDead << std::endl;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Rate correction is disabled " << std::endl;
|
std::cout<< "Rate correction is disabled " << std::endl;
|
||||||
#endif
|
#endif
|
||||||
ret1=0;
|
ret1=0;
|
||||||
}
|
}
|
||||||
return ret1;
|
return ret1;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2651,6 +2641,10 @@ double multiSlsDetector::getRateCorrectionTau(){
|
|||||||
|
|
||||||
int multiSlsDetector::getRateCorrection(){
|
int multiSlsDetector::getRateCorrection(){
|
||||||
|
|
||||||
|
if (getDetectorsType() == EIGER){
|
||||||
|
return getRateCorrectionTau();
|
||||||
|
}
|
||||||
|
|
||||||
if (thisMultiDetector->correctionMask&(1<<RATE_CORRECTION)) {
|
if (thisMultiDetector->correctionMask&(1<<RATE_CORRECTION)) {
|
||||||
return 1;
|
return 1;
|
||||||
} else
|
} else
|
||||||
@ -4313,8 +4307,8 @@ int multiSlsDetector::readConfigurationFile(string const fname){
|
|||||||
|
|
||||||
infile.close();
|
infile.close();
|
||||||
|
|
||||||
if(getDetectorsType() != MYTHEN)
|
//if(getDetectorsType() != MYTHEN)
|
||||||
printReceiverConfiguration();
|
// printReceiverConfiguration();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
std::cout<< "Error opening configuration file " << fname << " for reading" << std::endl;
|
std::cout<< "Error opening configuration file " << fname << " for reading" << std::endl;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorsPackage/slsDetectorSoftware/mythenDetectorServer
|
Path: slsDetectorsPackage/slsDetectorSoftware/mythenDetectorServer
|
||||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git/mythenDetectorServer
|
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git/mythenDetectorServer
|
||||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||||
Repsitory UUID: 769ba51f2796ac8088f29a6cdb87955befbbdae2
|
Repsitory UUID: f65bc993ef8b3548b52e677b3f42ae6229611d73
|
||||||
Revision: 102
|
Revision: 103
|
||||||
Branch: developer
|
Branch: developer
|
||||||
Last Changed Author: Dhanya_Maliakal
|
Last Changed Author: Dhanya_Maliakal
|
||||||
Last Changed Rev: 326
|
Last Changed Rev: 327
|
||||||
Last Changed Date: 2016-07-05 17:24:44 +0200
|
Last Changed Date: 2016-07-12 16:45:00 +0200
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
//#define SVNPATH ""
|
//#define SVNPATH ""
|
||||||
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git/mythenDetectorServer"
|
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git/mythenDetectorServer"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUID "769ba51f2796ac8088f29a6cdb87955befbbdae2"
|
#define SVNREPUUID "f65bc993ef8b3548b52e677b3f42ae6229611d73"
|
||||||
//#define SVNREV 0x326
|
//#define SVNREV 0x327
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTH "Dhanya_Maliakal"
|
#define SVNAUTH "Dhanya_Maliakal"
|
||||||
#define SVNREV 0x326
|
#define SVNREV 0x327
|
||||||
#define SVNDATE 0x20160705
|
#define SVNDATE 0x20160712
|
||||||
//
|
//
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
//#define SVNPATH ""
|
//#define SVNPATH ""
|
||||||
#define SVNURLLIB "git@git.psi.ch:sls_detectors_software/sls_detector_software.git"
|
#define SVNURLLIB "git@git.psi.ch:sls_detectors_software/sls_detector_software.git"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUIDLIB "769ba51f2796ac8088f29a6cdb87955befbbdae2"
|
#define SVNREPUUIDLIB "f65bc993ef8b3548b52e677b3f42ae6229611d73"
|
||||||
//#define SVNREV 0x1103
|
//#define SVNREV 0x1109
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTHLIB "Dhanya_Maliakal"
|
#define SVNAUTHLIB "Dhanya_Maliakal"
|
||||||
#define SVNREVLIB 0x1103
|
#define SVNREVLIB 0x1109
|
||||||
#define SVNDATELIB 0x20160705
|
#define SVNDATELIB 0x20160712
|
||||||
//
|
//
|
||||||
|
@ -2752,111 +2752,105 @@ int slsDetector::setModule(int reg, int imod){
|
|||||||
|
|
||||||
int slsDetector::setModule(sls_detector_module module, int* gainval, int* offsetval, int* iodelay, int64_t tau){
|
int slsDetector::setModule(sls_detector_module module, int* gainval, int* offsetval, int* iodelay, int64_t tau){
|
||||||
|
|
||||||
int fnum=F_SET_MODULE;
|
int fnum=F_SET_MODULE;
|
||||||
int retval;
|
int retval;
|
||||||
int ret=FAIL;
|
int ret=FAIL;
|
||||||
char mess[100];
|
char mess[100];
|
||||||
|
|
||||||
int imod=module.module;
|
int imod=module.module;
|
||||||
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << "slsDetector set module " << std::endl;
|
std::cout << "slsDetector set module " << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (connectControl() == OK){
|
if (connectControl() == OK){
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
sendModule(&module);
|
sendModule(&module);
|
||||||
|
|
||||||
//extra gain and offset - eiger
|
//extra gain and offset - eiger
|
||||||
if((thisDetector->nGain) && (gainval))
|
if((thisDetector->nGain) && (gainval))
|
||||||
controlSocket->SendDataOnly(gainval,sizeof(int)*thisDetector->nGain);
|
controlSocket->SendDataOnly(gainval,sizeof(int)*thisDetector->nGain);
|
||||||
if((thisDetector->nOffset) && (offsetval))
|
if((thisDetector->nOffset) && (offsetval))
|
||||||
controlSocket->SendDataOnly(offsetval,sizeof(int)*thisDetector->nOffset);
|
controlSocket->SendDataOnly(offsetval,sizeof(int)*thisDetector->nOffset);
|
||||||
if(thisDetector->myDetectorType == EIGER)
|
if(thisDetector->myDetectorType == EIGER){
|
||||||
controlSocket->SendDataOnly(iodelay,sizeof(int));
|
controlSocket->SendDataOnly(iodelay,sizeof(int));
|
||||||
if(thisDetector->myDetectorType == EIGER)
|
controlSocket->SendDataOnly(&tau,sizeof(tau));
|
||||||
controlSocket->SendDataOnly(&tau,sizeof(tau));
|
}
|
||||||
|
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
if (ret!=FAIL) {
|
if (ret!=FAIL)
|
||||||
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||||
} else {
|
else {
|
||||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||||
}
|
}
|
||||||
disconnectControl();
|
disconnectControl();
|
||||||
if (ret==FORCE_UPDATE)
|
if (ret==FORCE_UPDATE)
|
||||||
updateDetector();
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ret == FAIL && thisDetector->myDetectorType == EIGER && strcasestr(mess,"Rate")){
|
|
||||||
setErrorMask((getErrorMask())|(COULD_NOT_SET_RATE_CORRECTION));
|
|
||||||
if(strcasestr(mess,"tau/subexptime"))
|
|
||||||
setErrorMask((getErrorMask())|(RATE_CORRECTION_TAU_SUBEXPOSURE));
|
|
||||||
thisDetector->correctionMask&=~(1<<RATE_CORRECTION);
|
|
||||||
thisDetector->tDead = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ret!=FAIL) {
|
if (ret!=FAIL) {
|
||||||
if (detectorModules) {
|
if (detectorModules) {
|
||||||
if (imod>=0 && imod<thisDetector->nMod[X]*thisDetector->nMod[Y]) {
|
if (imod>=0 && imod<thisDetector->nMod[X]*thisDetector->nMod[Y]) {
|
||||||
(detectorModules+imod)->nchan=module.nchan;
|
(detectorModules+imod)->nchan=module.nchan;
|
||||||
(detectorModules+imod)->nchip=module.nchip;
|
(detectorModules+imod)->nchip=module.nchip;
|
||||||
(detectorModules+imod)->ndac=module.ndac;
|
(detectorModules+imod)->ndac=module.ndac;
|
||||||
(detectorModules+imod)->nadc=module.nadc;
|
(detectorModules+imod)->nadc=module.nadc;
|
||||||
thisDetector->nChips=module.nchip;
|
thisDetector->nChips=module.nchip;
|
||||||
thisDetector->nChans=module.nchan/module.nchip;
|
thisDetector->nChans=module.nchan/module.nchip;
|
||||||
thisDetector->nDacs=module.ndac;
|
thisDetector->nDacs=module.ndac;
|
||||||
thisDetector->nAdcs=module.nadc;
|
thisDetector->nAdcs=module.nadc;
|
||||||
|
|
||||||
if(thisDetector->myDetectorType != JUNGFRAU){
|
if(thisDetector->myDetectorType != JUNGFRAU){
|
||||||
for (int ichip=0; ichip<thisDetector->nChips; ichip++) {
|
for (int ichip=0; ichip<thisDetector->nChips; ichip++) {
|
||||||
if (chipregs)
|
if (chipregs)
|
||||||
chipregs[ichip+thisDetector->nChips*imod]=module.chipregs[ichip];
|
chipregs[ichip+thisDetector->nChips*imod]=module.chipregs[ichip];
|
||||||
|
|
||||||
if (chanregs) {
|
if (chanregs) {
|
||||||
for (int i=0; i<thisDetector->nChans; i++) {
|
for (int i=0; i<thisDetector->nChans; i++) {
|
||||||
chanregs[i+ichip*thisDetector->nChans+thisDetector->nChips*thisDetector->nChans*imod]=module.chanregs[ichip*thisDetector->nChans+i];
|
chanregs[i+ichip*thisDetector->nChans+thisDetector->nChips*thisDetector->nChans*imod]=module.chanregs[ichip*thisDetector->nChans+i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (adcs) {
|
||||||
|
for (int i=0; i<thisDetector->nAdcs; i++)
|
||||||
|
adcs[i+imod*thisDetector->nAdcs]=module.adcs[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dacs) {
|
||||||
|
for (int i=0; i<thisDetector->nDacs; i++)
|
||||||
|
dacs[i+imod*thisDetector->nDacs]=module.dacs[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
(detectorModules+imod)->gain=module.gain;
|
||||||
|
(detectorModules+imod)->offset=module.offset;
|
||||||
|
(detectorModules+imod)->serialnumber=module.serialnumber;
|
||||||
|
(detectorModules+imod)->reg=module.reg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (adcs) {
|
|
||||||
for (int i=0; i<thisDetector->nAdcs; i++)
|
if ((thisDetector->nGain) && (gainval) && (gain)) {
|
||||||
adcs[i+imod*thisDetector->nAdcs]=module.adcs[i];
|
for (int i=0; i<thisDetector->nGain; i++)
|
||||||
|
gain[i+imod*thisDetector->nGain]=gainval[i];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (dacs) {
|
if ((thisDetector->nOffset) && (offsetval) && (offset)) {
|
||||||
for (int i=0; i<thisDetector->nDacs; i++)
|
for (int i=0; i<thisDetector->nOffset; i++)
|
||||||
dacs[i+imod*thisDetector->nDacs]=module.dacs[i];
|
offset[i+imod*thisDetector->nOffset]=offsetval[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
(detectorModules+imod)->gain=module.gain;
|
|
||||||
(detectorModules+imod)->offset=module.offset;
|
|
||||||
(detectorModules+imod)->serialnumber=module.serialnumber;
|
|
||||||
(detectorModules+imod)->reg=module.reg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((thisDetector->nGain) && (gainval) && (gain)) {
|
|
||||||
for (int i=0; i<thisDetector->nGain; i++)
|
|
||||||
gain[i+imod*thisDetector->nGain]=gainval[i];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((thisDetector->nOffset) && (offsetval) && (offset)) {
|
|
||||||
for (int i=0; i<thisDetector->nOffset; i++)
|
|
||||||
offset[i+imod*thisDetector->nOffset]=offsetval[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Module register returned "<< retval << std::endl;
|
std::cout<< "Module register returned "<< retval << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -3956,7 +3950,10 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
|
|||||||
setTotalProgress();
|
setTotalProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double r;
|
||||||
|
if((index == SUBFRAME_ACQUISITION_TIME) && (thisDetector->myDetectorType == EIGER) && (t>=0) && getRateCorrection(r)){
|
||||||
|
setRateCorrection(r);
|
||||||
|
}
|
||||||
|
|
||||||
//send acquisiton period/frame number to receiver
|
//send acquisiton period/frame number to receiver
|
||||||
if((index==FRAME_NUMBER)||(index==FRAME_PERIOD)||(index==CYCLES_NUMBER)){
|
if((index==FRAME_NUMBER)||(index==FRAME_PERIOD)||(index==CYCLES_NUMBER)){
|
||||||
@ -5001,110 +4998,126 @@ int slsDetector::flatFieldCorrect(double* datain, double *errin, double* dataout
|
|||||||
|
|
||||||
int slsDetector::setRateCorrection(double t){
|
int slsDetector::setRateCorrection(double t){
|
||||||
|
|
||||||
if (getDetectorsType() == MYTHEN){
|
if (getDetectorsType() == EIGER){
|
||||||
double tdead[]=defaultTDead;
|
int fnum=F_SET_RATE_CORRECT;
|
||||||
if (t==0) {
|
int ret=FAIL;
|
||||||
|
char mess[1000]="";
|
||||||
|
int64_t arg = t;
|
||||||
|
int64_t retval = -1;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "unsetting rate correction" << std::endl;
|
std::cout<< "Setting Rate Correction to " << arg << endl;
|
||||||
#endif
|
#endif
|
||||||
thisDetector->correctionMask&=~(1<<RATE_CORRECTION);
|
if (setOnline(ONLINE_FLAG)==ONLINE_FLAG) {
|
||||||
} else {
|
if (connectControl() == OK){
|
||||||
thisDetector->correctionMask|=(1<<RATE_CORRECTION);
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
if (t>0)
|
controlSocket->SendDataOnly(&arg,sizeof(arg));
|
||||||
thisDetector->tDead=t;
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
else {
|
if (ret==FAIL) {
|
||||||
if (thisDetector->currentSettings<3 && thisDetector->currentSettings>-1)
|
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||||
thisDetector->tDead=tdead[thisDetector->currentSettings];
|
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||||
else
|
setErrorMask((getErrorMask())|(COULD_NOT_SET_RATE_CORRECTION));
|
||||||
thisDetector->tDead=0;
|
if(strcasestr(mess,"tau/subexptime"))
|
||||||
}
|
setErrorMask((getErrorMask())|(RATE_CORRECTION_TAU_SUBEXPOSURE));
|
||||||
#ifdef VERBOSE
|
|
||||||
std::cout<< "Setting rate correction with dead time "<< thisDetector->tDead << std::endl;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return thisDetector->correctionMask&(1<<RATE_CORRECTION);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int fnum=F_SET_RATE_CORRECT;
|
|
||||||
int ret=FAIL;
|
|
||||||
char mess[1000]="";
|
|
||||||
int64_t arg = t;
|
|
||||||
int64_t retval = -1;
|
|
||||||
#ifdef VERBOSE
|
|
||||||
std::cout<< "Setting Rate Correction to " << arg << endl;
|
|
||||||
#endif
|
|
||||||
if (setOnline(ONLINE_FLAG)==ONLINE_FLAG) {
|
|
||||||
if (connectControl() == OK){
|
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
|
||||||
controlSocket->SendDataOnly(&arg,sizeof(arg));
|
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
|
||||||
if (ret!=FAIL) {
|
|
||||||
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
|
||||||
if(retval<0){
|
|
||||||
thisDetector->correctionMask&=~(1<<RATE_CORRECTION);
|
|
||||||
thisDetector->tDead = 0;
|
|
||||||
}else{
|
|
||||||
if(retval>0){
|
|
||||||
thisDetector->correctionMask|=(1<<RATE_CORRECTION);
|
|
||||||
if(t < 0)
|
|
||||||
thisDetector->tDead = -1;
|
|
||||||
else
|
|
||||||
thisDetector->tDead = (double)retval;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
thisDetector->correctionMask&=~(1<<RATE_CORRECTION);
|
|
||||||
thisDetector->tDead = (double)retval;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
disconnectControl();
|
||||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
if (ret==FORCE_UPDATE)
|
||||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
updateDetector();
|
||||||
setErrorMask((getErrorMask())|(COULD_NOT_SET_RATE_CORRECTION));
|
|
||||||
if(strcasestr(mess,"tau/subexptime"))
|
|
||||||
setErrorMask((getErrorMask())|(RATE_CORRECTION_TAU_SUBEXPOSURE));
|
|
||||||
thisDetector->correctionMask&=~(1<<RATE_CORRECTION);
|
|
||||||
thisDetector->tDead = 0;
|
|
||||||
}
|
}
|
||||||
disconnectControl();
|
|
||||||
if (ret==FORCE_UPDATE)
|
|
||||||
updateDetector();
|
|
||||||
}
|
}
|
||||||
|
return ret; //only success/fail
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//mythen
|
||||||
|
double tdead[]=defaultTDead;
|
||||||
|
if (t==0) {
|
||||||
|
#ifdef VERBOSE
|
||||||
|
std::cout<< "unsetting rate correction" << std::endl;
|
||||||
|
#endif
|
||||||
|
thisDetector->correctionMask&=~(1<<RATE_CORRECTION);
|
||||||
|
} else {
|
||||||
|
thisDetector->correctionMask|=(1<<RATE_CORRECTION);
|
||||||
|
if (t>0)
|
||||||
|
thisDetector->tDead=t;
|
||||||
|
else {
|
||||||
|
if (thisDetector->currentSettings<3 && thisDetector->currentSettings>-1)
|
||||||
|
thisDetector->tDead=tdead[thisDetector->currentSettings];
|
||||||
|
else
|
||||||
|
thisDetector->tDead=0;
|
||||||
|
}
|
||||||
|
#ifdef VERBOSE
|
||||||
|
std::cout<< "Setting rate correction with dead time "<< thisDetector->tDead << std::endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
return thisDetector->correctionMask&(1<<RATE_CORRECTION);
|
return thisDetector->correctionMask&(1<<RATE_CORRECTION);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int slsDetector::getRateCorrection(double &t){
|
int slsDetector::getRateCorrection(double &t){
|
||||||
|
|
||||||
if (thisDetector->correctionMask&(1<<RATE_CORRECTION)) {
|
if (thisDetector->myDetectorType == EIGER){
|
||||||
|
t = getRateCorrectionTau();
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (thisDetector->correctionMask&(1<<RATE_CORRECTION)) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Rate correction is enabled with dead time "<< thisDetector->tDead << std::endl;
|
std::cout<< "Rate correction is enabled with dead time "<< thisDetector->tDead << std::endl;
|
||||||
#endif
|
#endif
|
||||||
t=thisDetector->tDead;
|
t=thisDetector->tDead;
|
||||||
return 1;
|
return 1;
|
||||||
} else
|
} else
|
||||||
t=0;
|
t=0;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Rate correction is disabled " << std::endl;
|
std::cout<< "Rate correction is disabled " << std::endl;
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
double slsDetector::getRateCorrectionTau(){
|
double slsDetector::getRateCorrectionTau(){
|
||||||
|
|
||||||
if (thisDetector->correctionMask&(1<<RATE_CORRECTION)) {
|
if(thisDetector->myDetectorType == EIGER){
|
||||||
|
int fnum=F_GET_RATE_CORRECT;
|
||||||
|
int ret=FAIL;
|
||||||
|
char mess[1000]="";
|
||||||
|
int64_t retval = -1;
|
||||||
|
#ifdef VERBOSE
|
||||||
|
std::cout<< "Setting Rate Correction to " << arg << endl;
|
||||||
|
#endif
|
||||||
|
if (setOnline(ONLINE_FLAG)==ONLINE_FLAG) {
|
||||||
|
if (connectControl() == OK){
|
||||||
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
|
if (ret!=FAIL)
|
||||||
|
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||||
|
else {
|
||||||
|
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||||
|
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||||
|
}
|
||||||
|
disconnectControl();
|
||||||
|
if (ret==FORCE_UPDATE)
|
||||||
|
updateDetector();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return double(retval);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//mythen only
|
||||||
|
if (thisDetector->correctionMask&(1<<RATE_CORRECTION)) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Rate correction is enabled with dead time "<< thisDetector->tDead << std::endl;
|
std::cout<< "Rate correction is enabled with dead time "<< thisDetector->tDead << std::endl;
|
||||||
#endif
|
#endif
|
||||||
return thisDetector->tDead;
|
return thisDetector->tDead;
|
||||||
//return 1;
|
//return 1;
|
||||||
} else
|
} else
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Rate correction is disabled " << std::endl;
|
std::cout<< "Rate correction is disabled " << std::endl;
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -5113,6 +5126,11 @@ double slsDetector::getRateCorrectionTau(){
|
|||||||
|
|
||||||
int slsDetector::getRateCorrection(){
|
int slsDetector::getRateCorrection(){
|
||||||
|
|
||||||
|
if (thisDetector->myDetectorType == EIGER){
|
||||||
|
double t = getRateCorrectionTau();
|
||||||
|
return (int)t;
|
||||||
|
}
|
||||||
|
|
||||||
if (thisDetector->correctionMask&(1<<RATE_CORRECTION)) {
|
if (thisDetector->correctionMask&(1<<RATE_CORRECTION)) {
|
||||||
return 1;
|
return 1;
|
||||||
} else
|
} else
|
||||||
|
@ -54,6 +54,8 @@ int pulseChip(int n);
|
|||||||
int64_t setRateCorrection(int64_t custom_tau_in_nsec);
|
int64_t setRateCorrection(int64_t custom_tau_in_nsec);
|
||||||
int getRateCorrectionEnable();
|
int getRateCorrectionEnable();
|
||||||
int getDefaultSettingsTau_in_nsec();
|
int getDefaultSettingsTau_in_nsec();
|
||||||
|
void setDefaultSettingsTau_in_nsec(int t);
|
||||||
|
int64_t getCurrentTau();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MYTHEND) || defined(GOTTHARDD)
|
#if defined(MYTHEND) || defined(GOTTHARDD)
|
||||||
@ -70,7 +72,7 @@ int getChip(sls_detector_chip *myChip);
|
|||||||
|
|
||||||
|
|
||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
int setModule(sls_detector_module myMod, int* gain, int* offset,int* delay, int64_t tau_ns);
|
int setModule(sls_detector_module myMod, int* gain, int* offset,int* delay);
|
||||||
int getModule(sls_detector_module *myMod, int* gain, int* offset);
|
int getModule(sls_detector_module *myMod, int* gain, int* offset);
|
||||||
#else
|
#else
|
||||||
int setModule(sls_detector_module myMod);
|
int setModule(sls_detector_module myMod);
|
||||||
@ -79,6 +81,7 @@ int getModule(sls_detector_module *myMod);
|
|||||||
|
|
||||||
|
|
||||||
enum detectorSettings setSettings(enum detectorSettings sett, int imod);
|
enum detectorSettings setSettings(enum detectorSettings sett, int imod);
|
||||||
|
enum detectorSettings getSettings();
|
||||||
|
|
||||||
#if defined(MYTHEND) || defined(EIGERD)
|
#if defined(MYTHEND) || defined(EIGERD)
|
||||||
int getThresholdEnergy(int imod);
|
int getThresholdEnergy(int imod);
|
||||||
|
@ -180,7 +180,8 @@ int function_table() {
|
|||||||
flist[F_PULSE_PIXEL]=&pulse_pixel;
|
flist[F_PULSE_PIXEL]=&pulse_pixel;
|
||||||
flist[F_PULSE_PIXEL_AND_MOVE]=&pulse_pixel_and_move;
|
flist[F_PULSE_PIXEL_AND_MOVE]=&pulse_pixel_and_move;
|
||||||
flist[F_PULSE_CHIP]=&pulse_chip;
|
flist[F_PULSE_CHIP]=&pulse_chip;
|
||||||
flist[F_SET_RATE_CORRECT]=&rate_correct;
|
flist[F_SET_RATE_CORRECT]=&set_rate_correct;
|
||||||
|
flist[F_GET_RATE_CORRECT]=&get_rate_correct;
|
||||||
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -1803,6 +1804,8 @@ int set_module(int file_des) {
|
|||||||
int retval, n;
|
int retval, n;
|
||||||
int ret=OK,ret1=OK;
|
int ret=OK,ret1=OK;
|
||||||
|
|
||||||
|
strcpy(mess,"could not set module.");
|
||||||
|
|
||||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
sls_detector_module myModule;
|
sls_detector_module myModule;
|
||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
@ -1905,29 +1908,43 @@ int set_module(int file_des) {
|
|||||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||||
} else {
|
} else {
|
||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
ret=setModule(myModule, myGain, myOffset,myIODelay,myTau);
|
ret=setModule(myModule, myGain, myOffset,myIODelay);
|
||||||
//rate correction errors
|
//rate correction
|
||||||
switch(ret){
|
if(myTau > -2){ //ignore -2: from load settings)
|
||||||
case -1:
|
|
||||||
sprintf(mess,"Cannot set Rate correction. Rate correction Deactivated, settings %d not recognized by detector\n",thisSettings);
|
//set default tau value (-1 or a normal value)
|
||||||
cprintf(RED,"%s",mess);
|
setDefaultSettingsTau_in_nsec(myTau);
|
||||||
ret = FAIL;
|
|
||||||
break;
|
//switch off rate correction: no value read from load calib/load settings)
|
||||||
case -2:
|
if(myTau == -1){
|
||||||
strcpy(mess,"Could not set Rate correction. Rate correction Deactivated, (tau/subexptime) must be < 0.0015\n");
|
ret = FAIL;
|
||||||
cprintf(RED,"%s",mess);
|
if(getRateCorrectionEnable()){
|
||||||
ret = FAIL;
|
setRateCorrection(0);
|
||||||
break;
|
strcat(mess," Cannot set Rate correction. No default tau provided. Deactivating Rate Correction\n");
|
||||||
case -3:
|
}else{
|
||||||
strcpy(mess,"Could not set Rate correction. Rate correction Deactivated\n");
|
strcat(mess," Cannot set Rate correction. No default tau provided\n");
|
||||||
cprintf(RED,"%s",mess);
|
}
|
||||||
ret = FAIL;
|
cprintf(RED,"%s",mess);
|
||||||
break;
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//normal tau value (only if enabled)
|
||||||
|
else if (getRateCorrectionEnable()){
|
||||||
|
int64_t retvalTau = setRateCorrection(myTau); //myTau will not be -1 here
|
||||||
|
if(myTau != retvalTau){
|
||||||
|
if(retvalTau == -1)
|
||||||
|
strcat(mess," Rate correction Deactivated, (tau/subexptime) must be < 0.0015\n");
|
||||||
|
cprintf(RED,"%s",mess);
|
||||||
|
ret=FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
retval = getSettings();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
ret=setModule(myModule);
|
ret=setModule(myModule);
|
||||||
#endif
|
|
||||||
retval = ret;
|
retval = ret;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -3863,10 +3880,9 @@ int pulse_chip(int file_des) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int rate_correct(int file_des) {
|
int set_rate_correct(int file_des) {
|
||||||
int64_t tau_ns=-1;
|
int64_t tau_ns=-1;
|
||||||
int n;
|
int n;
|
||||||
int64_t retval=-1;
|
|
||||||
int ret=OK,ret1=OK;
|
int ret=OK,ret1=OK;
|
||||||
|
|
||||||
sprintf(mess,"can't set/unset rate correction\n");
|
sprintf(mess,"can't set/unset rate correction\n");
|
||||||
@ -3886,30 +3902,39 @@ int rate_correct(int file_des) {
|
|||||||
|
|
||||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
|
|
||||||
//tau = -1, use default tau of settings
|
|
||||||
if((ret==OK)&&(tau_ns<0)){
|
|
||||||
tau_ns = getDefaultSettingsTau_in_nsec();
|
|
||||||
if(tau_ns < 0){
|
|
||||||
ret = FAIL;
|
|
||||||
sprintf(mess,"Cannot set rate correction. Settings %d not recognized by detector\n",thisSettings);
|
|
||||||
cprintf(RED,"%s",mess);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (ret==OK) {
|
if (ret==OK) {
|
||||||
printf("Setting rate correction to %lld ns\n",tau_ns);
|
printf("Setting rate correction to %lld ns\n",tau_ns);
|
||||||
|
|
||||||
if (differentClients==1 && lockStatus==1 && tau_ns!=-1) {
|
if (differentClients==1 && lockStatus==1) {
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||||
} else {
|
} else {
|
||||||
retval = setRateCorrection(tau_ns); //tau_ns will not be -1 here
|
|
||||||
if(tau_ns != retval){
|
//tau = -1, use default tau of settings
|
||||||
if(retval == -1)
|
if((ret==OK)&&(tau_ns<0)){
|
||||||
strcpy(mess,"Rate correction Deactivated, (tau/subexptime) must be < 0.0015\n");
|
tau_ns = getDefaultSettingsTau_in_nsec();
|
||||||
|
}
|
||||||
|
//still negative (not set)
|
||||||
|
if(tau_ns < 0){
|
||||||
|
ret = FAIL;
|
||||||
|
if(getRateCorrectionEnable()){
|
||||||
|
setRateCorrection(0);
|
||||||
|
strcpy(mess,"Cannot set rate correction as default tau not provided. Switching off Rate Correction\n");
|
||||||
|
}else{
|
||||||
|
strcpy(mess,"Cannot set rate correction as default tau not provided\n");
|
||||||
|
}
|
||||||
cprintf(RED,"%s",mess);
|
cprintf(RED,"%s",mess);
|
||||||
ret=FAIL;
|
}
|
||||||
|
|
||||||
|
//set rate
|
||||||
|
else{
|
||||||
|
int64_t retval = setRateCorrection(tau_ns); //tau_ns will not be -1 here
|
||||||
|
if(tau_ns != retval){
|
||||||
|
if(retval == -1)
|
||||||
|
strcpy(mess,"Rate correction Deactivated, (tau/subexptime) must be < 0.0015\n");
|
||||||
|
cprintf(RED,"%s",mess);
|
||||||
|
ret=FAIL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3923,8 +3948,45 @@ int rate_correct(int file_des) {
|
|||||||
n = sendData(file_des,&ret1,sizeof(ret),INT32);
|
n = sendData(file_des,&ret1,sizeof(ret),INT32);
|
||||||
if (ret==FAIL) {
|
if (ret==FAIL) {
|
||||||
n = sendData(file_des,mess,sizeof(mess),OTHER);
|
n = sendData(file_des,mess,sizeof(mess),OTHER);
|
||||||
} else {
|
}
|
||||||
n = sendData(file_des,&retval,sizeof(retval),INT64);
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int get_rate_correct(int file_des) {
|
||||||
|
int64_t retval=-1;
|
||||||
|
int ret=OK,ret1=OK;
|
||||||
|
|
||||||
|
sprintf(mess,"can't get rate correction\n");
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef EIGERD
|
||||||
|
sprintf(mess,"Rate Correction not implemented for this detector\n");
|
||||||
|
cprintf(RED,"%s",mess);
|
||||||
|
ret=FAIL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
|
|
||||||
|
if (ret==OK) {
|
||||||
|
retval = getCurrentTau();
|
||||||
|
printf("Getting rate correction %lld\n",(long long int)retval);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if ((ret==OK) && (differentClients))
|
||||||
|
ret=FORCE_UPDATE;
|
||||||
|
|
||||||
|
|
||||||
|
//ret could be swapped during sendData
|
||||||
|
ret1 = ret;
|
||||||
|
sendData(file_des,&ret1,sizeof(ret),INT32);
|
||||||
|
if (ret==FAIL) {
|
||||||
|
sendData(file_des,mess,sizeof(mess),OTHER);
|
||||||
|
} else {
|
||||||
|
sendData(file_des,&retval,sizeof(retval),INT64);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -87,7 +87,7 @@ int set_counter_bit(int);
|
|||||||
int pulse_pixel(int);
|
int pulse_pixel(int);
|
||||||
int pulse_pixel_and_move(int);
|
int pulse_pixel_and_move(int);
|
||||||
int pulse_chip(int);
|
int pulse_chip(int);
|
||||||
int rate_correct(int);
|
int set_rate_correct(int);
|
||||||
|
int get_rate_correct(int);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user