Undoing all float to double changes

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@217 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d 2012-08-13 13:21:07 +00:00
parent 3229c849ab
commit dbfc814768

View File

@ -38,8 +38,8 @@ const int noneSelected=-1;
sls_detector_module *detectorModules=NULL; sls_detector_module *detectorModules=NULL;
int *detectorChips=NULL; int *detectorChips=NULL;
int *detectorChans=NULL; int *detectorChans=NULL;
double *detectorDacs=NULL; float *detectorDacs=NULL;
double *detectorAdcs=NULL; float *detectorAdcs=NULL;
//int numberOfProbes; //int numberOfProbes;
@ -61,8 +61,8 @@ int initDetector() {
detectorChips=malloc(n*NCHIP*sizeof(int)); detectorChips=malloc(n*NCHIP*sizeof(int));
detectorChans=malloc(n*NCHIP*NCHAN*sizeof(int)); detectorChans=malloc(n*NCHIP*NCHAN*sizeof(int));
detectorDacs=malloc(n*NDAC*sizeof(double)); detectorDacs=malloc(n*NDAC*sizeof(float));
detectorAdcs=malloc(n*NADC*sizeof(double)); detectorAdcs=malloc(n*NADC*sizeof(float));
#ifdef VERBOSE #ifdef VERBOSE
printf("modules from 0x%x to 0x%x\n",detectorModules, detectorModules+n); printf("modules from 0x%x to 0x%x\n",detectorModules, detectorModules+n);
printf("chips from 0x%x to 0x%x\n",detectorChips, detectorChips+n*NCHIP); printf("chips from 0x%x to 0x%x\n",detectorChips, detectorChips+n*NCHIP);
@ -640,15 +640,15 @@ int set_one_dac(int imod) {
return OK; return OK;
} }
double initDACbyIndex(int ind,double val, int imod) { float initDACbyIndex(int ind,float val, int imod) {
int v; int v;
const double partref[NDAC]=PARTREF; const float partref[NDAC]=PARTREF;
const double partr1[NDAC]=PARTR1; const float partr1[NDAC]=PARTR1;
const double partr2[NDAC]=PARTR2; const float partr2[NDAC]=PARTR2;
double ref=partref[ind]; float ref=partref[ind];
double r1=partr1[ind]; float r1=partr1[ind];
double r2=partr2[ind]; float r2=partr2[ind];
v=(val+(val-ref)*r1/r2)*DAC_DR/DAC_MAX; v=(val+(val-ref)*r1/r2)*DAC_DR/DAC_MAX;
@ -657,10 +657,10 @@ double initDACbyIndex(int ind,double val, int imod) {
return (v*DAC_MAX/DAC_DR+ref*r1/r2)/(1+r1/r2); return (v*DAC_MAX/DAC_DR+ref*r1/r2)/(1+r1/r2);
} }
double initDACbyIndexDACU(int ind, int val, int imod) { float initDACbyIndexDACU(int ind, int val, int imod) {
const double daccs[NDAC]=DACCS; const float daccs[NDAC]=DACCS;
const double dacaddr[NDAC]=DACADDR; const float dacaddr[NDAC]=DACADDR;
int cs=daccs[ind]; int cs=daccs[ind];
int addr=dacaddr[ind]; int addr=dacaddr[ind];
@ -706,9 +706,9 @@ double initDACbyIndexDACU(int ind, int val, int imod) {
} }
int getThresholdEnergy() { int getThresholdEnergy() {
double g[3]=DEFAULTGAIN; float g[3]=DEFAULTGAIN;
double o[3]=DEFAULTOFFSET; float o[3]=DEFAULTOFFSET;
double myg=-1, myo=-1; float myg=-1, myo=-1;
// int dacu; // int dacu;
int imod; int imod;
int ethr=-1; int ethr=-1;
@ -764,9 +764,9 @@ int getThresholdEnergy() {
} }
int setThresholdEnergy(int ethr) { int setThresholdEnergy(int ethr) {
double g[3]=DEFAULTGAIN; float g[3]=DEFAULTGAIN;
double o[3]=DEFAULTOFFSET; float o[3]=DEFAULTOFFSET;
double myg=-1, myo=-1; float myg=-1, myo=-1;
int dacu; int dacu;
int imod; int imod;
int ret=ethr; int ret=ethr;
@ -803,7 +803,7 @@ int setThresholdEnergy(int ethr) {
myg=-1; myg=-1;
} }
if (myg>0 && myo>0) { if (myg>0 && myo>0) {
dacu=myo-myg*((double)ethr)/1000.; dacu=myo-myg*((float)ethr)/1000.;
#ifdef VERBOSE #ifdef VERBOSE
printf("module %d (%x): gain %f, off %f, energy %d eV, dac %d\n",imod,(detectorModules+imod),(detectorModules+imod)->gain,(detectorModules+imod)->offset, ethr,dacu); printf("module %d (%x): gain %f, off %f, energy %d eV, dac %d\n",imod,(detectorModules+imod),(detectorModules+imod)->gain,(detectorModules+imod)->offset, ethr,dacu);
#endif #endif
@ -820,7 +820,7 @@ int setThresholdEnergy(int ethr) {
double getDACbyIndexDACU(int ind, int imod) { float getDACbyIndexDACU(int ind, int imod) {
/* /*
if (detectorDacs) { if (detectorDacs) {
if (imod<getNModBoard()) if (imod<getNModBoard())