mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
rate correction for eiger implemented
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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") {
|
||||
|
Reference in New Issue
Block a user