fixed the gain and offset default values uploaded for eiger

This commit is contained in:
Dhanya Maliakal 2015-10-14 10:38:39 +02:00
parent 5057fd4eef
commit 25dbaa4e09
3 changed files with 37 additions and 22 deletions

View File

@ -54,7 +54,7 @@ int dst_requested[32] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
//char Module_dac_names[16][10]= {"SvP","Vtr","Vrf","Vrs","SvN","Vtgstv","Vcmp_ll","Vcmp_lr","cal","Vcmp_rl","rxb_rb","rxb_lb","Vcmp_rr","Vcp","Vcn","Vis"};;
int default_dac_values[16] = {0,2480,3300,1400,4000,2556,1000,1000,4000,1000,1000,1000,1000,200,2000,1550};
int default_gain_values[3] = {-314800,-314800,-314800};
int default_gain_values[3] = {314800,314800,314800};
int default_offset_values[3] = {3714000,3714000,3714000};
@ -398,11 +398,18 @@ int setModule(sls_detector_module myMod, int* gain, int* offset){
setSettings( (enum detectorSettings)myMod.reg,-1);
//set the gains and offset variables locally
for(i=0;i<NGAIN;i++)
detectorGain[i] = gain[i];
for(i=0;i<NOFFSET;i++)
detectorOffset[i] = offset[i];
for(i=0;i<NGAIN;i++){
if(gain[i]>=0){
detectorGain[i] = gain[i];
printf("gain[%d]:%d\n",i,detectorGain[i]);
}else cprintf(RED,"gain not set\n");
}
for(i=0;i<NOFFSET;i++){
if(offset[i]>=0){
detectorOffset[i] = offset[i];
printf("offset[%d]:%d\n",i,detectorOffset[i]);
}else cprintf(RED,"offset not set\n");
}
//copy module locally
if (detectorModules)
copyModule(detectorModules,&myMod);
@ -432,7 +439,6 @@ int setModule(sls_detector_module myMod, int* gain, int* offset){
return FAIL;
}
//printf("set gainval[0]:%d\n",detectorGain[0]);
return 0;
}

View File

@ -3059,10 +3059,6 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
int ret=0;
if(thisDetector->nGain)
gainval = new int[thisDetector->nGain];
if(thisDetector->nOffset)
offsetval = new int[thisDetector->nOffset];
switch (isettings) {
case STANDARD:
@ -5986,7 +5982,17 @@ int slsDetector::writeSettingsFile(string fname, int imod){
int slsDetector::loadSettingsFile(string fname, int imod) {
sls_detector_module *myMod=NULL;
int* g=0; int* o=0;
int* gainval=0; int* offsetval=0;
if(thisDetector->nGain){
gainval=new int[thisDetector->nGain];
for(int i=0;i<thisDetector->nGain;i++)
gainval[i] = -1;
}
if(thisDetector->nOffset){
offsetval=new int[thisDetector->nOffset];
for(int i=0;i<thisDetector->nOffset;i++)
offsetval[i] = -1;
}
string fn=fname;
fn=fname;
int mmin=0, mmax=setNumberOfModules();
@ -6012,8 +6018,10 @@ int slsDetector::loadSettingsFile(string fname, int imod) {
//settings is saved in myMod.reg for all except mythen
if(thisDetector->myDetectorType!=MYTHEN)
myMod->reg=thisDetector->currentSettings;
setModule(*myMod,g,o);
setModule(*myMod,gainval,offsetval);
deleteModule(myMod);
if(gainval) delete[] gainval;
if(offsetval) delete[] offsetval;
} else
return FAIL;
}
@ -6090,19 +6098,20 @@ int slsDetector::loadCalibrationFile(string fname, int imod) {
sls_detector_module *myMod=NULL;
string fn=fname;
int* gainval=0, *offsetval=0;
if(thisDetector->nGain)
int* gainval=0; int* offsetval=0;
if(thisDetector->nGain){
gainval=new int[thisDetector->nGain];
if(thisDetector->nOffset)
for(int i=0;i<thisDetector->nGain;i++)
gainval[i] = -1;
}
if(thisDetector->nOffset){
offsetval=new int[thisDetector->nOffset];
for(int i=0;i<thisDetector->nOffset;i++)
offsetval[i] = -1;
}
fn=fname;
if(thisDetector->nGain)
gainval = new int[thisDetector->nGain];
if(thisDetector->nOffset)
offsetval = new int[thisDetector->nOffset];
int mmin=0, mmax=setNumberOfModules();
if (imod>=0) {
@ -6135,7 +6144,7 @@ int slsDetector::loadCalibrationFile(string fname, int imod) {
deleteModule(myMod);
if(gainval) delete[]gainval;
if(offsetval) delete offsetval;
if(offsetval) delete[] offsetval;
} else
return FAIL;
}