rate correction for eiger implemented

This commit is contained in:
Dhanya Maliakal
2016-02-10 11:22:59 +01:00
parent f0c4a4a7e4
commit 9067da5e88
10 changed files with 151 additions and 88 deletions

View File

@ -2771,6 +2771,11 @@ int slsDetector::setModule(sls_detector_module module, int* gainval, int* offset
}
}
if(ret == FAIL && thisDetector->myDetectorType == EIGER && strcasestr(mess,"tau")){
setErrorMask((getErrorMask())|(COULD_NOT_SET_RATE_CORRECTION));
thisDetector->correctionMask&=~(1<<RATE_CORRECTION);
thisDetector->tDead = 0;
}
if (ret!=FAIL) {
if (detectorModules) {
@ -5005,25 +5010,27 @@ int slsDetector::setRateCorrection(double t){
#ifdef VERBOSE
std::cout<< "Setting Rate Correction to " << arg << endl;
#endif
if (thisDetector->onlineFlag==ONLINE_FLAG) {
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)
if(retval<0){
thisDetector->correctionMask&=~(1<<RATE_CORRECTION);
else if(retval>0)
thisDetector->correctionMask|=(1<<RATE_CORRECTION);
else
thisDetector->correctionMask&=~(1<<RATE_CORRECTION);
thisDetector->tDead = (double)retval/(double)1e9;
thisDetector->tDead = 0;
}else{
if(retval>0)
thisDetector->correctionMask|=(1<<RATE_CORRECTION);
else
thisDetector->correctionMask&=~(1<<RATE_CORRECTION);
thisDetector->tDead = (double)retval/(double)1e9;
}
} else {
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector returned error: " << mess << std::endl;
setErrorMask((getErrorMask())|(COULD_NOT_SET_RATE_CORRECTION));
thisDetector->correctionMask&=~(1<<RATE_CORRECTION);
thisDetector->tDead = 0;
}
@ -5032,6 +5039,7 @@ int slsDetector::setRateCorrection(double t){
updateDetector();
}
}
return thisDetector->correctionMask&(1<<RATE_CORRECTION);
}

View File

@ -1941,7 +1941,7 @@ string slsDetectorCommand::cmdRateCorr(int narg, char *args[], int action){
}
double t;
if (myDet->getRateCorrection(t)) {
sprintf(answer,"%f",t);
sprintf(answer,"%0.9f",t);
} else {
sprintf(answer,"%f",0.);
}
@ -1954,7 +1954,7 @@ string slsDetectorCommand::helpRateCorr(int narg, char *args[], int action){
if (action==GET_ACTION || action==HELP_ACTION)
os << string("ratecorr \t returns the dead time used for rate correections in ns \n");
if (action==PUT_ACTION || action==HELP_ACTION)
os << string("ratecorr ns \t sets the deadtime correction constant in ns\n");
os << string("ratecorr ns \t sets the deadtime correction constant in ns, -1 in Eiger will set it to default tau of that settings\n");
return os.str();
}
@ -3053,7 +3053,7 @@ string slsDetectorCommand::cmdSettings(int narg, char *args[], int action) {
myDet->setOnline(ONLINE_FLAG);
if (cmd=="settings") {
if (action==PUT_ACTION)
if (action==PUT_ACTION)
myDet->setSettings(myDet->getDetectorSettings(string(args[1])));
return myDet->getDetectorSettings(myDet->getSettings());
} else if (cmd=="threshold") {