mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 05:17:13 +02:00
feature: tau is now read from calib file. if not there, it is set to defalt in server value, but switched off. load trimbits will not touch rate correction
This commit is contained in:
Binary file not shown.
@ -495,7 +495,7 @@ int pulseChip(int n){
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int setRateCorrection(int64_t custom_tau_in_nsec){//in nanosec (will never be -1)
|
int64_t setRateCorrection(int64_t custom_tau_in_nsec){//in nanosec (will never be -1)
|
||||||
|
|
||||||
//deactivating rate correction
|
//deactivating rate correction
|
||||||
if(custom_tau_in_nsec==0){
|
if(custom_tau_in_nsec==0){
|
||||||
@ -521,6 +521,7 @@ int setRateCorrection(int64_t custom_tau_in_nsec){//in nanosec (will never be -1
|
|||||||
}
|
}
|
||||||
//activating rate correction
|
//activating rate correction
|
||||||
Feb_Control_SetRateCorrectionVariable(1);
|
Feb_Control_SetRateCorrectionVariable(1);
|
||||||
|
printf("Rate Correction Value set to %lld ns\n",(long long int)Feb_Control_Get_RateTable_Tau_in_nsec());
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
Feb_Control_PrintCorrectedValues();
|
Feb_Control_PrintCorrectedValues();
|
||||||
#endif
|
#endif
|
||||||
@ -542,7 +543,7 @@ int getDefaultSettingsTau_in_nsec(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int setModule(sls_detector_module myMod, int* gain, int* offset,int* delay){
|
int setModule(sls_detector_module myMod, int* gain, int* offset,int* delay, int64_t tau_ns){
|
||||||
int retval[2];
|
int retval[2];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -553,18 +554,44 @@ int setModule(sls_detector_module myMod, int* gain, int* offset,int* delay){
|
|||||||
//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){
|
||||||
detectorGain[i] = gain[i];
|
detectorGain[i] = gain[i];
|
||||||
printf("gain[%d]:%d\n",i,detectorGain[i]);
|
printf("gain[%d]:%d\n",i,detectorGain[i]);
|
||||||
}else cprintf(RED,"gain not set\n");
|
}else cprintf(RED,"gain not changed\n");
|
||||||
}
|
}
|
||||||
for(i=0;i<NOFFSET;i++){
|
for(i=0;i<NOFFSET;i++){
|
||||||
if(offset[i]>=0){
|
if(offset[i]>=0){
|
||||||
detectorOffset[i] = offset[i];
|
detectorOffset[i] = offset[i];
|
||||||
printf("offset[%d]:%d\n",i,detectorOffset[i]);
|
printf("offset[%d]:%d\n",i,detectorOffset[i]);
|
||||||
}else cprintf(RED,"offset not set\n");
|
}else cprintf(RED,"offset not changed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(setIODelay(*delay, -1)!= (*delay)){
|
if(setIODelay(*delay, -1)!= (*delay)){
|
||||||
|
@ -2669,6 +2669,7 @@ int slsDetector::setModule(int reg, int imod){
|
|||||||
int* g=0;
|
int* g=0;
|
||||||
int* o=0;
|
int* o=0;
|
||||||
int* iod=0;
|
int* iod=0;
|
||||||
|
int64_t tau=-1;
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << "slsDetector set module " << std::endl;
|
std::cout << "slsDetector set module " << std::endl;
|
||||||
@ -2737,14 +2738,14 @@ int slsDetector::setModule(int reg, int imod){
|
|||||||
ads[i]=-1;
|
ads[i]=-1;
|
||||||
myModule.adcs=ads;
|
myModule.adcs=ads;
|
||||||
}
|
}
|
||||||
ret=setModule(myModule,g,o,iod);
|
ret=setModule(myModule,g,o,iod,tau);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int slsDetector::setModule(sls_detector_module module, int* gainval, int* offsetval, int* iodelay){
|
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;
|
||||||
@ -2770,6 +2771,8 @@ int slsDetector::setModule(sls_detector_module module, int* gainval, int* offset
|
|||||||
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->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
if (ret!=FAIL) {
|
if (ret!=FAIL) {
|
||||||
@ -3136,6 +3139,7 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
|
|||||||
offsetval=new int[thisDetector->nOffset];
|
offsetval=new int[thisDetector->nOffset];
|
||||||
if(thisDetector->myDetectorType == EIGER)
|
if(thisDetector->myDetectorType == EIGER)
|
||||||
iodelay = new int;
|
iodelay = new int;
|
||||||
|
int64_t tau=-1;
|
||||||
|
|
||||||
|
|
||||||
int ret=0;
|
int ret=0;
|
||||||
@ -3323,7 +3327,7 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
|
|||||||
#endif
|
#endif
|
||||||
//extra gain and offset
|
//extra gain and offset
|
||||||
if(thisDetector->nGain)
|
if(thisDetector->nGain)
|
||||||
ret = readCalibrationFile(calfname,gainval, offsetval,thisDetector->myDetectorType );
|
ret = readCalibrationFile(calfname,gainval, offsetval, tau, thisDetector->myDetectorType );
|
||||||
//normal gain and offset inside sls_detector_module
|
//normal gain and offset inside sls_detector_module
|
||||||
else
|
else
|
||||||
ret = readCalibrationFile(calfname,myMod->gain, myMod->offset);
|
ret = readCalibrationFile(calfname,myMod->gain, myMod->offset);
|
||||||
@ -3338,7 +3342,7 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
|
|||||||
#endif
|
#endif
|
||||||
//extra gain and offset
|
//extra gain and offset
|
||||||
if(thisDetector->nGain)
|
if(thisDetector->nGain)
|
||||||
ret = readCalibrationFile(calfname,gainval, offsetval,thisDetector->myDetectorType );
|
ret = readCalibrationFile(calfname,gainval, offsetval, tau, thisDetector->myDetectorType );
|
||||||
//normal gain and offset inside sls_detector_module
|
//normal gain and offset inside sls_detector_module
|
||||||
else
|
else
|
||||||
ret = readCalibrationFile(calfname,myMod->gain, myMod->offset);
|
ret = readCalibrationFile(calfname,myMod->gain, myMod->offset);
|
||||||
@ -3351,7 +3355,7 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
|
|||||||
}
|
}
|
||||||
|
|
||||||
//if everything worked, set module****
|
//if everything worked, set module****
|
||||||
setModule(*myMod,gainval,offsetval,iodelay);
|
setModule(*myMod,gainval,offsetval,iodelay, tau);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6218,6 +6222,9 @@ int slsDetector::writeSettingsFile(string fname, int imod, int* iodelay){
|
|||||||
int slsDetector::loadSettingsFile(string fname, int imod) {
|
int slsDetector::loadSettingsFile(string fname, int imod) {
|
||||||
|
|
||||||
sls_detector_module *myMod=NULL;
|
sls_detector_module *myMod=NULL;
|
||||||
|
|
||||||
|
//tau set to -2 to not affect in any way (-1 for set settings)
|
||||||
|
int64_t tau =-2;
|
||||||
int* gainval=0; int* offsetval=0;
|
int* gainval=0; int* offsetval=0;
|
||||||
int *iodelay=0;
|
int *iodelay=0;
|
||||||
if(thisDetector->nGain){
|
if(thisDetector->nGain){
|
||||||
@ -6257,8 +6264,8 @@ int slsDetector::loadSettingsFile(string fname, int imod) {
|
|||||||
myMod->module=im;
|
myMod->module=im;
|
||||||
//settings is saved in myMod.reg for all except mythen
|
//settings is saved in myMod.reg for all except mythen
|
||||||
if(thisDetector->myDetectorType!=MYTHEN)
|
if(thisDetector->myDetectorType!=MYTHEN)
|
||||||
myMod->reg=thisDetector->currentSettings;
|
myMod->reg=thisDetector->currentSettings;
|
||||||
setModule(*myMod,gainval,offsetval,iodelay);
|
setModule(*myMod,gainval,offsetval,iodelay,tau);
|
||||||
deleteModule(myMod);
|
deleteModule(myMod);
|
||||||
if(gainval) delete[] gainval;
|
if(gainval) delete[] gainval;
|
||||||
if(offsetval) delete[] offsetval;
|
if(offsetval) delete[] offsetval;
|
||||||
@ -6343,6 +6350,7 @@ int slsDetector::loadCalibrationFile(string fname, int imod) {
|
|||||||
sls_detector_module *myMod=NULL;
|
sls_detector_module *myMod=NULL;
|
||||||
string fn=fname;
|
string fn=fname;
|
||||||
|
|
||||||
|
int64_t tau = -1;
|
||||||
int* gainval=0; int* offsetval=0;
|
int* gainval=0; int* offsetval=0;
|
||||||
int* iodelay=0;
|
int* iodelay=0;
|
||||||
if(thisDetector->nGain){
|
if(thisDetector->nGain){
|
||||||
@ -6380,14 +6388,14 @@ int slsDetector::loadCalibrationFile(string fname, int imod) {
|
|||||||
*iodelay = (int)setDAC(-1,IO_DELAY,0);
|
*iodelay = (int)setDAC(-1,IO_DELAY,0);
|
||||||
//extra gain and offset
|
//extra gain and offset
|
||||||
if(thisDetector->nGain){
|
if(thisDetector->nGain){
|
||||||
if(readCalibrationFile(fn,gainval, offsetval,thisDetector->myDetectorType)==FAIL)
|
if(readCalibrationFile(fn,gainval, offsetval,tau, thisDetector->myDetectorType)==FAIL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
} //normal gain and offset inside sls_detector_module
|
} //normal gain and offset inside sls_detector_module
|
||||||
else{
|
else{
|
||||||
if(readCalibrationFile(fn,myMod->gain, myMod->offset)==FAIL)
|
if(readCalibrationFile(fn,myMod->gain, myMod->offset)==FAIL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
setModule(*myMod,gainval,offsetval,iodelay);
|
setModule(*myMod,gainval,offsetval,iodelay,tau);
|
||||||
|
|
||||||
deleteModule(myMod);
|
deleteModule(myMod);
|
||||||
if(gainval) delete[]gainval;
|
if(gainval) delete[]gainval;
|
||||||
@ -6419,7 +6427,7 @@ int slsDetector::saveCalibrationFile(string fname, int imod) {
|
|||||||
if ((myMod=getModule(im))) {
|
if ((myMod=getModule(im))) {
|
||||||
//extra gain and offset
|
//extra gain and offset
|
||||||
if(thisDetector->nGain)
|
if(thisDetector->nGain)
|
||||||
ret=writeCalibrationFile(ostfn.str(),gain, offset,thisDetector->myDetectorType);
|
ret=writeCalibrationFile(ostfn.str(),gain, offset,(int64_t)thisDetector->tDead, thisDetector->myDetectorType);
|
||||||
//normal gain and offset inside sls_detector_module
|
//normal gain and offset inside sls_detector_module
|
||||||
else
|
else
|
||||||
ret=writeCalibrationFile(ostfn.str(),myMod->gain, myMod->offset);
|
ret=writeCalibrationFile(ostfn.str(),myMod->gain, myMod->offset);
|
||||||
|
@ -910,10 +910,11 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
\param gainval pointer to extra gain values
|
\param gainval pointer to extra gain values
|
||||||
\param offsetval pointer to extra offset values
|
\param offsetval pointer to extra offset values
|
||||||
\param iodelay iodelay (detector specific)
|
\param iodelay iodelay (detector specific)
|
||||||
|
\param tau tau (detector specific)
|
||||||
\returns current register value
|
\returns current register value
|
||||||
\sa ::sls_detector_module
|
\sa ::sls_detector_module
|
||||||
*/
|
*/
|
||||||
int setModule(sls_detector_module module, int* gainval, int* offsetval,int* iodelay);
|
int setModule(sls_detector_module module, int* gainval, int* offsetval,int* iodelay, int64_t tau);
|
||||||
//virtual int setModule(sls_detector_module module);
|
//virtual int setModule(sls_detector_module module);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,7 +69,7 @@ int energyConversion::writeCalibrationFile(string fname, double gain, double off
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int energyConversion::readCalibrationFile(string fname, int *gain, int *offset, detectorType myDetectorType){
|
int energyConversion::readCalibrationFile(string fname, int *gain, int *offset, int64_t &tau, detectorType myDetectorType){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -87,6 +87,7 @@ int energyConversion::readCalibrationFile(string fname, int *gain, int *offset,
|
|||||||
#endif
|
#endif
|
||||||
infile.open(fname.c_str(), ios_base::in);
|
infile.open(fname.c_str(), ios_base::in);
|
||||||
if (infile.is_open()) {
|
if (infile.is_open()) {
|
||||||
|
//get gain and offset
|
||||||
for (ig=0; ig<4; ig++) {
|
for (ig=0; ig<4; ig++) {
|
||||||
//while ( (getline(infile,str)) > -1) {
|
//while ( (getline(infile,str)) > -1) {
|
||||||
getline(infile,str);
|
getline(infile,str);
|
||||||
@ -101,6 +102,16 @@ int energyConversion::readCalibrationFile(string fname, int *gain, int *offset,
|
|||||||
if (ig>=4)
|
if (ig>=4)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
//get tau
|
||||||
|
if (myDetectorType == EIGER) {
|
||||||
|
if(getline(infile,str)){
|
||||||
|
istringstream ssstr(str);
|
||||||
|
ssstr >> tau;
|
||||||
|
#ifdef VERBOSE
|
||||||
|
std::cout<< "tau:" << tau << std::endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
infile.close();
|
infile.close();
|
||||||
cout << "Calibration file loaded: " << fname << endl;
|
cout << "Calibration file loaded: " << fname << endl;
|
||||||
} else {
|
} else {
|
||||||
@ -124,7 +135,7 @@ int energyConversion::readCalibrationFile(string fname, int *gain, int *offset,
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int energyConversion::writeCalibrationFile(string fname, int *gain, int *offset, detectorType myDetectorType){
|
int energyConversion::writeCalibrationFile(string fname, int *gain, int *offset, int64_t tau, detectorType myDetectorType){
|
||||||
//std::cout<< "Function not yet implemented " << std::endl;
|
//std::cout<< "Function not yet implemented " << std::endl;
|
||||||
ofstream outfile;
|
ofstream outfile;
|
||||||
switch (myDetectorType) {
|
switch (myDetectorType) {
|
||||||
@ -136,6 +147,7 @@ int energyConversion::writeCalibrationFile(string fname, int *gain, int *offset,
|
|||||||
if (outfile.is_open()) {
|
if (outfile.is_open()) {
|
||||||
for (int ig=0; ig<4; ig++)
|
for (int ig=0; ig<4; ig++)
|
||||||
outfile << ((double)offset[ig]/1000) << " " << ((double)gain[ig]/1000) << std::endl;
|
outfile << ((double)offset[ig]/1000) << " " << ((double)gain[ig]/1000) << std::endl;
|
||||||
|
outfile << tau << std::endl;
|
||||||
} else {
|
} else {
|
||||||
std::cout<< "Could not open calibration file "<< fname << " for writing" << std::endl;
|
std::cout<< "Could not open calibration file "<< fname << " for writing" << std::endl;
|
||||||
#ifndef MYROOT
|
#ifndef MYROOT
|
||||||
|
@ -55,16 +55,19 @@ class energyConversion
|
|||||||
\param fname file to be read
|
\param fname file to be read
|
||||||
\param gain reference to the gain variable
|
\param gain reference to the gain variable
|
||||||
\offset reference to the offset variable
|
\offset reference to the offset variable
|
||||||
|
\tau tau
|
||||||
|
\tau tau
|
||||||
*/
|
*/
|
||||||
static int readCalibrationFile(string fname, int *gain, int *offset, detectorType myDetectorType);
|
static int readCalibrationFile(string fname, int *gain, int *offset, int64_t &tau, detectorType myDetectorType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
writes a calibration file
|
writes a calibration file
|
||||||
\param fname file to be written
|
\param fname file to be written
|
||||||
\param gain
|
\param gain
|
||||||
\param offset
|
\param offset
|
||||||
|
\param tau
|
||||||
*/
|
*/
|
||||||
static int writeCalibrationFile(string fname, int *gain, int *offset, detectorType myDetectorType);
|
static int writeCalibrationFile(string fname, int *gain, int *offset, int64_t tau, detectorType myDetectorType);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ int setCounterBit(int val);
|
|||||||
int pulsePixel(int n, int x, int y);
|
int pulsePixel(int n, int x, int y);
|
||||||
int pulsePixelNMove(int n, int x, int y);
|
int pulsePixelNMove(int n, int x, int y);
|
||||||
int pulseChip(int n);
|
int pulseChip(int n);
|
||||||
int 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();
|
||||||
#endif
|
#endif
|
||||||
@ -70,7 +70,7 @@ int getChip(sls_detector_chip *myChip);
|
|||||||
|
|
||||||
|
|
||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
int setModule(sls_detector_module myMod, int* gain, int* offset,int* delay);
|
int setModule(sls_detector_module myMod, int* gain, int* offset,int* delay, int64_t tau_ns);
|
||||||
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);
|
||||||
|
@ -1809,6 +1809,7 @@ int set_module(int file_des) {
|
|||||||
int *myGain = (int*)malloc(getNumberOfGainsPerModule()*sizeof(int));
|
int *myGain = (int*)malloc(getNumberOfGainsPerModule()*sizeof(int));
|
||||||
int *myOffset = (int*)malloc(getNumberOfOffsetsPerModule()*sizeof(int));
|
int *myOffset = (int*)malloc(getNumberOfOffsetsPerModule()*sizeof(int));
|
||||||
int *myIODelay = (int*)malloc(sizeof(int));
|
int *myIODelay = (int*)malloc(sizeof(int));
|
||||||
|
int64_t myTau=-1;
|
||||||
#endif
|
#endif
|
||||||
int *myChip=(int*)malloc(getNumberOfChipsPerModule()*sizeof(int));
|
int *myChip=(int*)malloc(getNumberOfChipsPerModule()*sizeof(int));
|
||||||
int *myChan=(int*)malloc(getNumberOfChannelsPerModule()*sizeof(int));
|
int *myChan=(int*)malloc(getNumberOfChannelsPerModule()*sizeof(int));
|
||||||
@ -1864,6 +1865,7 @@ int set_module(int file_des) {
|
|||||||
n = receiveData(file_des,myGain,sizeof(int)*getNumberOfGainsPerModule(),INT32);
|
n = receiveData(file_des,myGain,sizeof(int)*getNumberOfGainsPerModule(),INT32);
|
||||||
n = receiveData(file_des,myOffset,sizeof(int)*getNumberOfOffsetsPerModule(),INT32);
|
n = receiveData(file_des,myOffset,sizeof(int)*getNumberOfOffsetsPerModule(),INT32);
|
||||||
n = receiveData(file_des,myIODelay,sizeof(int),INT32);
|
n = receiveData(file_des,myIODelay,sizeof(int),INT32);
|
||||||
|
n = receiveData(file_des,&myTau,sizeof(myTau),INT64);
|
||||||
#endif
|
#endif
|
||||||
if (ret>=0)
|
if (ret>=0)
|
||||||
ret=OK;
|
ret=OK;
|
||||||
@ -1879,7 +1881,8 @@ int set_module(int file_des) {
|
|||||||
printf("gain[%d]:%d\t%f\n",i,myGain[i],((double)myGain[i]/1000));
|
printf("gain[%d]:%d\t%f\n",i,myGain[i],((double)myGain[i]/1000));
|
||||||
for(i=0;i<getNumberOfOffsetsPerModule();i++)
|
for(i=0;i<getNumberOfOffsetsPerModule();i++)
|
||||||
printf("offset[%d]:%d\t%f\n",i,myOffset[i],((double)myOffset[i]/1000));
|
printf("offset[%d]:%d\t%f\n",i,myOffset[i],((double)myOffset[i]/1000));
|
||||||
printf("IO Delay:%d\n",i,*myIODelay);
|
printf("IO Delay:%d\n",*myIODelay);
|
||||||
|
printf("Tau:%lld\n",(long long int)myTau);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1902,25 +1905,24 @@ 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);
|
ret=setModule(myModule, myGain, myOffset,myIODelay,myTau);
|
||||||
//rate correction
|
//rate correction errors
|
||||||
if(getRateCorrectionEnable()){
|
switch(ret){
|
||||||
int64_t tau_ns = getDefaultSettingsTau_in_nsec();
|
case -1:
|
||||||
if(tau_ns < 0){
|
sprintf(mess,"Cannot set Rate correction. Rate correction Deactivated, settings %d not recognized by detector\n",thisSettings);
|
||||||
sprintf(mess,"Cannot set Rate correction. Rate correction Deactivated, settings %d not recognized by detector\n",thisSettings);
|
cprintf(RED,"%s",mess);
|
||||||
cprintf(RED,"%s",mess);
|
ret = FAIL;
|
||||||
ret = FAIL;
|
break;
|
||||||
setRateCorrection(0);
|
case -2:
|
||||||
}
|
strcpy(mess,"Could not set Rate correction. Rate correction Deactivated, (tau/subexptime) must be < 0.0015\n");
|
||||||
retval = setRateCorrection(tau_ns); //tau_ns will not be -1 here
|
cprintf(RED,"%s",mess);
|
||||||
if(tau_ns != retval){
|
ret = FAIL;
|
||||||
if(retval == -1)
|
break;
|
||||||
strcpy(mess,"Could not set Rate correction. Rate correction Deactivated, (tau/subexptime) must be < 0.0015\n");
|
case -3:
|
||||||
else
|
strcpy(mess,"Could not set Rate correction. Rate correction Deactivated\n");
|
||||||
strcpy(mess,"Could not set Rate correction. Rate correction Deactivated\n");
|
cprintf(RED,"%s",mess);
|
||||||
cprintf(RED,"%s",mess);
|
ret = FAIL;
|
||||||
ret = FAIL;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ret=setModule(myModule);
|
ret=setModule(myModule);
|
||||||
|
Reference in New Issue
Block a user