mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 08:10:02 +02:00
rate correction for eiger implemented
This commit is contained in:
parent
f0c4a4a7e4
commit
9067da5e88
@ -49,8 +49,8 @@ double Feb_Control_exposure_time_in_sec;
|
||||
int Feb_Control_subframe_exposure_time_in_10nsec;
|
||||
double Feb_Control_exposure_period_in_sec;
|
||||
|
||||
int Feb_Control_RateTable_Tau_in_nsec = -1;
|
||||
int Feb_Control_RateTable_Subexptime_in_nsec = -1;
|
||||
int64_t Feb_Control_RateTable_Tau_in_nsec = -1;
|
||||
int64_t Feb_Control_RateTable_Subexptime_in_nsec = -1;
|
||||
|
||||
unsigned int Feb_Control_trimbit_size;
|
||||
unsigned int* Feb_Control_last_downloaded_trimbits;
|
||||
@ -1797,10 +1797,11 @@ int Feb_Control_PulseChip(int npulses){
|
||||
|
||||
|
||||
|
||||
int Feb_Control_Get_RateTable_Tau_in_nsec(){ return Feb_Control_RateTable_Tau_in_nsec;}
|
||||
int Feb_Control_Get_RateTable_Subexptime_in_nsec(){ return Feb_Control_RateTable_Subexptime_in_nsec;}
|
||||
int64_t Feb_Control_Get_RateTable_Tau_in_nsec(){ return Feb_Control_RateTable_Tau_in_nsec;}
|
||||
int64_t Feb_Control_Get_RateTable_Subexptime_in_nsec(){ return Feb_Control_RateTable_Subexptime_in_nsec;}
|
||||
|
||||
int Feb_Control_SetRateCorrectionTau(int tau_in_Nsec){
|
||||
//returns -1 if slope is too high
|
||||
int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec){
|
||||
|
||||
double sub_expure_time_in_sec = (double)(Feb_Control_GetSubFrameExposureTime())/(double)1e9;
|
||||
double tau_in_sec = (double)tau_in_Nsec/(double)1e9;
|
||||
@ -1814,9 +1815,9 @@ int Feb_Control_SetRateCorrectionTau(int tau_in_Nsec){
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf("\tCalculating table for tau of %f ns.\n", tau_in_Nsec);
|
||||
|
||||
for(int i=0;i<np;i++)
|
||||
printf("\tCalculating table for tau of %lld ns.\n", tau_in_Nsec);
|
||||
int i;
|
||||
for(i=0;i<np;i++)
|
||||
Feb_Control_rate_meas[i] = i*exp(-i/sub_expure_time_in_sec*tau_in_sec);
|
||||
|
||||
/*
|
||||
@ -1839,21 +1840,21 @@ int Feb_Control_SetRateCorrectionTau(int tau_in_Nsec){
|
||||
|
||||
b0[0] = 0;
|
||||
m[0] = 1;
|
||||
|
||||
for(int b=1;b<1024;b++){
|
||||
int b;
|
||||
for(b=1;b<1024;b++){
|
||||
if(m[b-1]<14.5){
|
||||
double s=0,sx=0,sy=0,sxx=0,sxy=0;
|
||||
for(;;next_i++){
|
||||
if(next_i>=np){
|
||||
cprintf(BG_RED,"Error bin problem ???\n");
|
||||
return 0;
|
||||
cprintf(RED,"Error: (tau/subexptime) must be < 0.0015 \n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
double x = Feb_Control_rate_meas[next_i] - b*4;
|
||||
double y = next_i;
|
||||
printf("Start Loop x: %f,\t y: %f,\t s: %f,\t sx: %f,\t sy: %f,\t sxx: %f,\t sxy: %f,\t "
|
||||
/*printf("Start Loop x: %f,\t y: %f,\t s: %f,\t sx: %f,\t sy: %f,\t sxx: %f,\t sxy: %f,\t "
|
||||
"next_i: %d,\t b: %d,\t Feb_Control_rate_meas[next_i]: %f\n",
|
||||
x, y, s, sx, sy, sxx, sxy, next_i, b, Feb_Control_rate_meas[next_i]);
|
||||
x, y, s, sx, sy, sxx, sxy, next_i, b, Feb_Control_rate_meas[next_i]);*/
|
||||
|
||||
if(x < -0.5) continue;
|
||||
if(x > 3.5) break;
|
||||
@ -1862,9 +1863,9 @@ int Feb_Control_SetRateCorrectionTau(int tau_in_Nsec){
|
||||
sy += y;
|
||||
sxx += x*x;
|
||||
sxy += x*y;
|
||||
printf("End Loop x: %f,\t y: %f,\t s: %f,\t sx: %f,\t sy: %f,\t sxx: %f,\t sxy: %f,\t "
|
||||
/*printf("End Loop x: %f,\t y: %f,\t s: %f,\t sx: %f,\t sy: %f,\t sxx: %f,\t sxy: %f,\t "
|
||||
"next_i: %d,\t b: %d,\t Feb_Control_rate_meas[next_i]: %f\n",
|
||||
x, y, s, sx, sy, sxx, sxy, next_i, b, Feb_Control_rate_meas[next_i]);
|
||||
x, y, s, sx, sy, sxx, sxy, next_i, b, Feb_Control_rate_meas[next_i]);*/
|
||||
}
|
||||
double delta = s*sxx - sx*sx;
|
||||
b0[b] = (sxx*sy - sx*sxy)/delta;
|
||||
@ -1872,20 +1873,20 @@ int Feb_Control_SetRateCorrectionTau(int tau_in_Nsec){
|
||||
|
||||
if(m[b]<0||m[b]>15)
|
||||
m[b]=15;
|
||||
printf("After Loop s: %f,\t sx: %f,\t sy: %f,\t sxx: %f,\t sxy: %f,\t "
|
||||
/*printf("After Loop s: %f,\t sx: %f,\t sy: %f,\t sxx: %f,\t sxy: %f,\t "
|
||||
"next_i: %d,\t b: %d,\t Feb_Control_rate_meas[next_i]: %f\n",
|
||||
s, sx, sy, sxx, sxy, next_i, b, Feb_Control_rate_meas[next_i]);
|
||||
s, sx, sy, sxx, sxy, next_i, b, Feb_Control_rate_meas[next_i]);*/
|
||||
// cout<<s<<" "<<sx<<" "<<sy<<" "<<sxx<<" "<<" "<<sxy<<" "<<delta<<" "<<m[b]<<" "<<b0[b]<<endl;
|
||||
}else{
|
||||
b0[b] = b0[b-1] + 4*m[b-1];
|
||||
m[b] = m[b-1];
|
||||
printf("else\n");
|
||||
/*printf("else\n");*/
|
||||
}
|
||||
Feb_Control_rate_correction_table[b] = (((int)(m[b]+0.5)&0xf)<<14) | ((int)(b0[b]+0.5)&0x3fff);
|
||||
printf("After Loop 4*b: %d\tbase:%d\tslope:%d\n",4*b, (int)(b0[b]+0.5), (int)(m[b]+0.5) );
|
||||
/*printf("After Loop 4*b: %d\tbase:%d\tslope:%d\n",4*b, (int)(b0[b]+0.5), (int)(m[b]+0.5) );*/
|
||||
}
|
||||
|
||||
if(SetRateCorrectionTable(Feb_Control_rate_correction_table)){
|
||||
if(Feb_Control_SetRateCorrectionTable(Feb_Control_rate_correction_table)){
|
||||
Feb_Control_RateTable_Tau_in_nsec = tau_in_Nsec;
|
||||
Feb_Control_RateTable_Subexptime_in_nsec = Feb_Control_GetSubFrameExposureTime();
|
||||
return 1;
|
||||
@ -1931,12 +1932,13 @@ int Feb_Control_SetRateCorrectionTable(unsigned int *table){
|
||||
}
|
||||
|
||||
|
||||
int Feb_Control_GetRateCorrectionVariable(){ return (Feb_Control_subFrameMode&DAQ_NEXPOSURERS_ACTIVATE_RATE_CORRECTION);}
|
||||
|
||||
|
||||
void Feb_Control_SetRateCorrectionVariable(int activate_rate_correction){
|
||||
if(activate_rate_correction){
|
||||
Feb_Control_subFrameMode |= DAQ_NEXPOSURERS_ACTIVATE_RATE_CORRECTION;
|
||||
printf("Rate correction activated.\n");
|
||||
printf("Note, the rate correction will only be applied when the detector is run in auto summing 12 bit mode.\n");
|
||||
printf("Rate correction activated. Note: the rate correction applied only when run in auto summing mode.\n");
|
||||
}else{
|
||||
Feb_Control_subFrameMode &= ~DAQ_NEXPOSURERS_ACTIVATE_RATE_CORRECTION;
|
||||
printf("Rate correction deactivated.\n");
|
||||
|
@ -184,11 +184,12 @@ int Feb_Control_GetModuleNumber();
|
||||
int Feb_Control_ClockRowClock(unsigned int ntimes);
|
||||
int Feb_Control_PulseChip(int npulses);
|
||||
|
||||
int Feb_Control_Get_RateTable_Tau_in_nsec();
|
||||
int Feb_Control_Get_RateTable_Subexptime_in_nsec();
|
||||
int Feb_Control_SetRateCorrectionTau(double tau_in_Nsec);
|
||||
int64_t Feb_Control_Get_RateTable_Tau_in_nsec();
|
||||
int64_t Feb_Control_Get_RateTable_Subexptime_in_nsec();
|
||||
int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec);
|
||||
int Feb_Control_SetRateCorrectionTable(unsigned int *table);
|
||||
int Feb_Control_GetRateCorrectionVariable();
|
||||
void Feb_Control_SetRateCorrectionVariable(int activate_rate_correction);
|
||||
int Feb_Control_PrintCorrectedValues();
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
Binary file not shown.
@ -489,36 +489,37 @@ int pulseChip(int n){
|
||||
return OK;
|
||||
}
|
||||
|
||||
int setRateCorrection(int n){
|
||||
if(n>=0){
|
||||
if(n>0){
|
||||
int tau_in_nsec = Feb_Control_Get_RateTable_Tau_in_nsec();
|
||||
int subexp_in_nsec = Feb_Control_Get_RateTable_Subexptime_in_nsec();
|
||||
//same setting
|
||||
if(tau_in_nsec == n) && (subexp_in_nsec == Feb_Control_GetSubFrameExposureTime()){
|
||||
printf("Same Tau %dns, Same subexptime %dns = Same setting, not rewriting rate correction table\n");
|
||||
}
|
||||
//different setting, calculate table
|
||||
else if(!Feb_Control_SetRateCorrectionTau(n)){
|
||||
cprintf(RED,"Rate correction failed. Deactivating rate correction\n");
|
||||
SetRateCorrectionVariable(0);
|
||||
return 0;
|
||||
}
|
||||
//activating rate correction
|
||||
SetRateCorrectionVariable(1);
|
||||
Feb_Control_PrintCorrectedValues();
|
||||
}else{
|
||||
//deactivating rate correction
|
||||
SetRateCorrectionVariable(0);
|
||||
}
|
||||
int setRateCorrection(int64_t custom_tau_in_nsec){//in nanosec (will never be -1)
|
||||
|
||||
//deactivating rate correction
|
||||
if(custom_tau_in_nsec==0){
|
||||
Feb_Control_SetRateCorrectionVariable(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//return tau if it is a valid value (written to memory properly)
|
||||
int tau_in_nsec = Feb_Control_GetTau_in_nsec();
|
||||
if(tau_in_nsec>=0)
|
||||
return tau_in_nsec;
|
||||
else
|
||||
return 0;
|
||||
int64_t tau_in_nsec = Feb_Control_Get_RateTable_Tau_in_nsec();
|
||||
int64_t subexp_in_nsec = Feb_Control_Get_RateTable_Subexptime_in_nsec();
|
||||
//same setting
|
||||
if((tau_in_nsec == custom_tau_in_nsec) && (subexp_in_nsec == Feb_Control_GetSubFrameExposureTime())){
|
||||
printf("Rate Table already created before: Same Tau %lldns, Same subexptime %lldns\n",
|
||||
tau_in_nsec,subexp_in_nsec);
|
||||
}
|
||||
//different setting, calculate table
|
||||
else{
|
||||
int ret = Feb_Control_SetRateCorrectionTau(custom_tau_in_nsec);
|
||||
if(ret<=0){
|
||||
cprintf(RED,"Rate correction failed. Deactivating rate correction\n");
|
||||
Feb_Control_SetRateCorrectionVariable(0);
|
||||
return ret;//-1 is for tau/subexptime error, 0 for all other errors
|
||||
}
|
||||
}
|
||||
//activating rate correction
|
||||
Feb_Control_SetRateCorrectionVariable(1);
|
||||
#ifdef VERBOSE
|
||||
Feb_Control_PrintCorrectedValues();
|
||||
#endif
|
||||
|
||||
return Feb_Control_Get_RateTable_Tau_in_nsec();
|
||||
}
|
||||
|
||||
|
||||
@ -576,6 +577,7 @@ int setModule(sls_detector_module myMod, int* gain, int* offset){
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -40,4 +40,12 @@
|
||||
|
||||
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_ */
|
||||
|
@ -1143,6 +1143,7 @@ slsDetectorDefs::detectorSettings multiSlsDetector::setSettings(detectorSettings
|
||||
|
||||
}
|
||||
thisMultiDetector->currentSettings=ret1;
|
||||
|
||||
return ret1;
|
||||
|
||||
}
|
||||
@ -1629,6 +1630,15 @@ int64_t multiSlsDetector::setTimer(timerIndex index, int64_t t){
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
@ -2417,6 +2427,9 @@ int multiSlsDetector::setRateCorrection(double t){
|
||||
// double tdead[]=defaultTDead;
|
||||
|
||||
if (getDetectorsType() == MYTHEN){
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Setting rate correction with dead time "<< thisMultiDetector->tDead << std::endl;
|
||||
#endif
|
||||
if (t==0) {
|
||||
thisMultiDetector->correctionMask&=~(1<<RATE_CORRECTION);
|
||||
return thisMultiDetector->correctionMask&(1<<RATE_CORRECTION);
|
||||
@ -2438,22 +2451,13 @@ int multiSlsDetector::setRateCorrection(double t){
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
if(getDetectorsType() == MYTHEN)
|
||||
std::cout<< "Setting rate correction with dead time "<< thisMultiDetector->tDead << std::endl;
|
||||
#endif
|
||||
|
||||
//mismatch between detectors
|
||||
if(ret1 == -1)
|
||||
return ret1;
|
||||
|
||||
if (getDetectorsType() != MYTHEN){
|
||||
if (ret1==0) {
|
||||
if (ret1<=0)
|
||||
thisMultiDetector->correctionMask&=~(1<<RATE_CORRECTION);
|
||||
return thisMultiDetector->correctionMask&(1<<RATE_CORRECTION);
|
||||
} else
|
||||
else
|
||||
thisMultiDetector->correctionMask|=(1<<RATE_CORRECTION);
|
||||
}
|
||||
|
||||
return thisMultiDetector->correctionMask&(1<<RATE_CORRECTION);
|
||||
}
|
||||
|
||||
@ -2464,6 +2468,10 @@ int multiSlsDetector::getRateCorrection(double &t){
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Rate correction is enabled with dead time "<< thisMultiDetector->tDead << std::endl;
|
||||
#endif
|
||||
|
||||
if (getDetectorsType() != MYTHEN)
|
||||
t = getRateCorrectionTau();
|
||||
|
||||
return 1;
|
||||
} else
|
||||
t=0;
|
||||
|
@ -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") {
|
||||
|
@ -51,7 +51,7 @@ int setCounterBit(int val);
|
||||
int pulsePixel(int n, int x, int y);
|
||||
int pulsePixelNMove(int n, int x, int y);
|
||||
int pulseChip(int n);
|
||||
int setRateCorrection(int n);
|
||||
int setRateCorrection(int64_t custom_tau_in_nsec);
|
||||
#endif
|
||||
|
||||
#if defined(MYTHEND) || defined(GOTTHARDD)
|
||||
|
@ -32,6 +32,7 @@ const enum detectorType myDetectorType=PICASSO;
|
||||
const enum detectorType myDetectorType=GENERIC;
|
||||
#endif
|
||||
|
||||
extern enum detectorSettings thisSettings;
|
||||
|
||||
//global variables for optimized readout
|
||||
char mess[MAX_STR_LENGTH];
|
||||
@ -1792,8 +1793,13 @@ int get_chip(int file_des) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int set_module(int file_des) {
|
||||
int retval, n,i;
|
||||
int retval, n;
|
||||
int ret=OK,ret1=OK;
|
||||
|
||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||
@ -1862,15 +1868,28 @@ int set_module(int file_des) {
|
||||
ret=FAIL;
|
||||
|
||||
|
||||
//#ifdef VERBOSE
|
||||
#ifdef VERBOSE
|
||||
printf("module number is %d,register is %d, nchan %d, nchip %d, ndac %d, nadc %d, gain %f, offset %f\n",myModule.module, myModule.reg, myModule.nchan, myModule.nchip, myModule.ndac, myModule.nadc, myModule.gain,myModule.offset);
|
||||
#ifdef EIGERD
|
||||
int i;
|
||||
for(i=0;i<getNumberOfGainsPerModule();i++)
|
||||
printf("gain[%d]:%d\t%f\n",i,myGain[i],((double)myGain[i]/1000));
|
||||
for(i=0;i<getNumberOfOffsetsPerModule();i++)
|
||||
printf("offset[%d]:%d\t%f\n",i,myOffset[i],((double)myOffset[i]/1000));
|
||||
#endif
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
switch(myModule.reg){
|
||||
case STANDARD:
|
||||
case HIGHGAIN:
|
||||
case LOWGAIN:
|
||||
break;
|
||||
default:
|
||||
sprintf(mess,"This setting %d does not exist for this detector\n",myModule.reg);
|
||||
ret = FAIL;
|
||||
cprintf(RED,"%s",mess);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (ret==OK) {
|
||||
@ -3841,16 +3860,31 @@ int rate_correct(int file_des) {
|
||||
#endif
|
||||
|
||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||
//tau = -1, use default tau of settings
|
||||
if((ret==OK)&&(tau_ns<0)){
|
||||
switch(thisSettings){
|
||||
case STANDARD: tau_ns = STANDARD_TAU; break;
|
||||
case HIGHGAIN: tau_ns = HIGHGAIN_TAU; break;
|
||||
case LOWGAIN: tau_ns = LOWGAIN_TAU; break;
|
||||
default:
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Cannot set rate correction. Settings %d not recognized by detector\n",thisSettings);
|
||||
cprintf(RED,"%s",mess);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ret==OK) {
|
||||
#ifdef VERBOSE
|
||||
printf("setting rate correction to %lld ns\n",tau_ns);
|
||||
#endif
|
||||
printf("Setting rate correction to %lld ns\n",tau_ns);
|
||||
|
||||
if (differentClients==1 && lockStatus==1 && tau_ns!=-1) {
|
||||
ret=FAIL;
|
||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||
} else {
|
||||
retval = setRateCorrection(tau_ns);
|
||||
if((tau_ns >= 0) && (retval != tau_ns)){
|
||||
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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user