mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
Changed everywhere from float to double, even mythenDetectorServer and the standalone files
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@206 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
@ -38,8 +38,8 @@ const int noneSelected=-1;
|
||||
sls_detector_module *detectorModules=NULL;
|
||||
int *detectorChips=NULL;
|
||||
int *detectorChans=NULL;
|
||||
float *detectorDacs=NULL;
|
||||
float *detectorAdcs=NULL;
|
||||
double *detectorDacs=NULL;
|
||||
double *detectorAdcs=NULL;
|
||||
//int numberOfProbes;
|
||||
|
||||
|
||||
@ -61,8 +61,8 @@ int initDetector() {
|
||||
detectorChips=malloc(n*NCHIP*sizeof(int));
|
||||
|
||||
detectorChans=malloc(n*NCHIP*NCHAN*sizeof(int));
|
||||
detectorDacs=malloc(n*NDAC*sizeof(float));
|
||||
detectorAdcs=malloc(n*NADC*sizeof(float));
|
||||
detectorDacs=malloc(n*NDAC*sizeof(double));
|
||||
detectorAdcs=malloc(n*NADC*sizeof(double));
|
||||
#ifdef VERBOSE
|
||||
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);
|
||||
@ -640,15 +640,15 @@ int set_one_dac(int imod) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
float initDACbyIndex(int ind,float val, int imod) {
|
||||
double initDACbyIndex(int ind,double val, int imod) {
|
||||
int v;
|
||||
const float partref[NDAC]=PARTREF;
|
||||
const float partr1[NDAC]=PARTR1;
|
||||
const float partr2[NDAC]=PARTR2;
|
||||
const double partref[NDAC]=PARTREF;
|
||||
const double partr1[NDAC]=PARTR1;
|
||||
const double partr2[NDAC]=PARTR2;
|
||||
|
||||
float ref=partref[ind];
|
||||
float r1=partr1[ind];
|
||||
float r2=partr2[ind];
|
||||
double ref=partref[ind];
|
||||
double r1=partr1[ind];
|
||||
double r2=partr2[ind];
|
||||
|
||||
|
||||
v=(val+(val-ref)*r1/r2)*DAC_DR/DAC_MAX;
|
||||
@ -657,10 +657,10 @@ float initDACbyIndex(int ind,float val, int imod) {
|
||||
return (v*DAC_MAX/DAC_DR+ref*r1/r2)/(1+r1/r2);
|
||||
}
|
||||
|
||||
float initDACbyIndexDACU(int ind, int val, int imod) {
|
||||
double initDACbyIndexDACU(int ind, int val, int imod) {
|
||||
|
||||
const float daccs[NDAC]=DACCS;
|
||||
const float dacaddr[NDAC]=DACADDR;
|
||||
const double daccs[NDAC]=DACCS;
|
||||
const double dacaddr[NDAC]=DACADDR;
|
||||
|
||||
int cs=daccs[ind];
|
||||
int addr=dacaddr[ind];
|
||||
@ -706,9 +706,9 @@ float initDACbyIndexDACU(int ind, int val, int imod) {
|
||||
}
|
||||
|
||||
int getThresholdEnergy() {
|
||||
float g[3]=DEFAULTGAIN;
|
||||
float o[3]=DEFAULTOFFSET;
|
||||
float myg=-1, myo=-1;
|
||||
double g[3]=DEFAULTGAIN;
|
||||
double o[3]=DEFAULTOFFSET;
|
||||
double myg=-1, myo=-1;
|
||||
// int dacu;
|
||||
int imod;
|
||||
int ethr=-1;
|
||||
@ -764,9 +764,9 @@ int getThresholdEnergy() {
|
||||
}
|
||||
|
||||
int setThresholdEnergy(int ethr) {
|
||||
float g[3]=DEFAULTGAIN;
|
||||
float o[3]=DEFAULTOFFSET;
|
||||
float myg=-1, myo=-1;
|
||||
double g[3]=DEFAULTGAIN;
|
||||
double o[3]=DEFAULTOFFSET;
|
||||
double myg=-1, myo=-1;
|
||||
int dacu;
|
||||
int imod;
|
||||
int ret=ethr;
|
||||
@ -803,7 +803,7 @@ int setThresholdEnergy(int ethr) {
|
||||
myg=-1;
|
||||
}
|
||||
if (myg>0 && myo>0) {
|
||||
dacu=myo-myg*((float)ethr)/1000.;
|
||||
dacu=myo-myg*((double)ethr)/1000.;
|
||||
#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);
|
||||
#endif
|
||||
@ -820,7 +820,7 @@ int setThresholdEnergy(int ethr) {
|
||||
|
||||
|
||||
|
||||
float getDACbyIndexDACU(int ind, int imod) {
|
||||
double getDACbyIndexDACU(int ind, int imod) {
|
||||
/*
|
||||
if (detectorDacs) {
|
||||
if (imod<getNModBoard())
|
||||
|
@ -100,9 +100,9 @@ int set_one_dac(int imod);
|
||||
int initDAC(int dac_cs, int dac_addr, int value,int imod );
|
||||
int initDACs(int* v,int imod );
|
||||
int setSettings(int i);
|
||||
float initDACbyIndex(int ind,float val, int imod);
|
||||
float initDACbyIndexDACU(int ind,int val, int imod);
|
||||
float getDACbyIndexDACU(int ind, int imod);
|
||||
double initDACbyIndex(int ind,double val, int imod);
|
||||
double initDACbyIndexDACU(int ind,int val, int imod);
|
||||
double getDACbyIndexDACU(int ind, int imod);
|
||||
int getThresholdEnergy();
|
||||
int setThresholdEnergy(int ethr);
|
||||
/* Initialization*/
|
||||
|
@ -842,13 +842,13 @@ int read_register(int file_des) {
|
||||
|
||||
int set_dac(int file_des) {
|
||||
|
||||
float retval;
|
||||
double retval;
|
||||
int ret=OK;
|
||||
int arg[2];
|
||||
enum dacIndex ind;
|
||||
int imod;
|
||||
int n;
|
||||
float val;
|
||||
double val;
|
||||
int idac=0;
|
||||
|
||||
sprintf(mess,"Can't set DAC\n");
|
||||
@ -954,7 +954,7 @@ add possible potentiometers like in chiptest board!!!!!!!!!!!!!!!
|
||||
|
||||
int get_adc(int file_des) {
|
||||
|
||||
float retval;
|
||||
double retval;
|
||||
int ret=OK;
|
||||
int arg[2];
|
||||
enum dacIndex ind;
|
||||
@ -1312,8 +1312,8 @@ int set_module(int file_des) {
|
||||
sls_detector_module myModule;
|
||||
int *myChip=malloc(NCHIP*sizeof(int));
|
||||
int *myChan=malloc(NCHIP*NCHAN*sizeof(int));
|
||||
float *myDac=malloc(NDAC*sizeof(int));
|
||||
float *myAdc=malloc(NADC*sizeof(int));
|
||||
double *myDac=malloc(NDAC*sizeof(int));
|
||||
double *myAdc=malloc(NADC*sizeof(int));
|
||||
int retval, n;
|
||||
int ret=OK;
|
||||
int dr;//, ow;
|
||||
@ -1431,8 +1431,8 @@ int get_module(int file_des) {
|
||||
sls_detector_module myModule;
|
||||
int *myChip=malloc(NCHIP*sizeof(int));
|
||||
int *myChan=malloc(NCHIP*NCHAN*sizeof(int));
|
||||
float *myDac=malloc(NDAC*sizeof(int));
|
||||
float *myAdc=malloc(NADC*sizeof(int));
|
||||
double *myDac=malloc(NDAC*sizeof(int));
|
||||
double *myAdc=malloc(NADC*sizeof(int));
|
||||
|
||||
|
||||
if (myDac)
|
||||
|
@ -168,11 +168,11 @@ int choose_vthresh_and_vtrim(int countlim, int nsigma, int im) {
|
||||
|
||||
int *fifodata;
|
||||
|
||||
float vthreshmean, vthreshSTDev;
|
||||
double vthreshmean, vthreshSTDev;
|
||||
int *thrmi, *thrma;
|
||||
float c;
|
||||
float b=BVTRIM;
|
||||
float a=AVTRIM;
|
||||
double c;
|
||||
double b=BVTRIM;
|
||||
double a=AVTRIM;
|
||||
int *trim;
|
||||
int ich, imod, ichan;
|
||||
int nvalid=0;
|
||||
@ -447,7 +447,7 @@ int trim_with_level(int countlim, int im) {
|
||||
int kth_smallest(int *a, int n, int k)
|
||||
{
|
||||
register int i,j,l,m ;
|
||||
register float x ;
|
||||
register double x ;
|
||||
|
||||
l=0 ; m=n-1 ;
|
||||
while (l<m) {
|
||||
@ -474,7 +474,7 @@ int kth_smallest(int *a, int n, int k)
|
||||
int median(int *a,int n) {
|
||||
|
||||
int i=0, k=n/2;
|
||||
float k1=0.5*n;
|
||||
double k1=0.5*n;
|
||||
|
||||
//discard zeroes and 0xffffff
|
||||
for (i=0; i<n; i++) {
|
||||
@ -506,7 +506,7 @@ int ave(int *a, int n)
|
||||
{
|
||||
int av=0,i;
|
||||
for (i=0; i<n; i++)
|
||||
av=av+((float)*(a+i))/((float)n);
|
||||
av=av+((double)*(a+i))/((double)n);
|
||||
return av;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user