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:
l_maliakal_d 2012-08-02 12:58:08 +00:00
parent 3795dcedfe
commit 5aebcd4888
47 changed files with 615 additions and 611 deletions

View File

@ -362,13 +362,13 @@ int sendModule(int file_des, sls_detector_module *myMod) {
#ifdef VERBOSE #ifdef VERBOSE
printf("module %d of size %d sent\n",myMod->module, ts); printf("module %d of size %d sent\n",myMod->module, ts);
#endif #endif
ts+= sendDataOnly(file_des,myMod->dacs,sizeof(float)*nDacs); ts+= sendDataOnly(file_des,myMod->dacs,sizeof(double)*nDacs);
#ifdef VERBOSE #ifdef VERBOSE
printf("dacs %d of size %d sent\n",myMod->module, ts); printf("dacs %d of size %d sent\n",myMod->module, ts);
for (idac=0; idac< nDacs; idac++) for (idac=0; idac< nDacs; idac++)
printf("dac %d is %d\n",idac,myMod->dacs[idac]); printf("dac %d is %d\n",idac,myMod->dacs[idac]);
#endif #endif
ts+= sendDataOnly(file_des,myMod->adcs,sizeof(float)*nAdcs); ts+= sendDataOnly(file_des,myMod->adcs,sizeof(double)*nAdcs);
#ifdef VERBOSE #ifdef VERBOSE
printf("adcs %d of size %d sent\n",myMod->module, ts); printf("adcs %d of size %d sent\n",myMod->module, ts);
#endif #endif
@ -432,8 +432,8 @@ int receiveChip(int file_des, sls_detector_chip* myChip) {
int receiveModule(int file_des, sls_detector_module* myMod) { int receiveModule(int file_des, sls_detector_module* myMod) {
float *dacptr=myMod->dacs; double *dacptr=myMod->dacs;
float *adcptr=myMod->adcs; double *adcptr=myMod->adcs;
int *chipptr=myMod->chipregs, *chanptr=myMod->chanregs; int *chipptr=myMod->chipregs, *chanptr=myMod->chanregs;
int ts=0; int ts=0;
int nChips, nchipold=myMod->nchip, nchipdiff; int nChips, nchipold=myMod->nchip, nchipdiff;
@ -490,29 +490,29 @@ int receiveModule(int file_des, sls_detector_module* myMod) {
printf("received %d adcs\n",nAdcs); printf("received %d adcs\n",nAdcs);
#endif #endif
if (ndacdiff<=0) { if (ndacdiff<=0) {
ts+=receiveDataOnly(file_des,myMod->dacs, sizeof(float)*nDacs); ts+=receiveDataOnly(file_des,myMod->dacs, sizeof(double)*nDacs);
#ifdef VERBOSE #ifdef VERBOSE
printf("dacs received\n"); printf("dacs received\n");
#endif #endif
} else { } else {
dacptr=malloc(ndacdiff*sizeof(float)); dacptr=malloc(ndacdiff*sizeof(double));
myMod->ndac=ndold; myMod->ndac=ndold;
ts+=receiveDataOnly(file_des,myMod->dacs, sizeof(float)*ndold); ts+=receiveDataOnly(file_des,myMod->dacs, sizeof(double)*ndold);
ts+=receiveDataOnly(file_des,dacptr, sizeof(float)*ndacdiff); ts+=receiveDataOnly(file_des,dacptr, sizeof(double)*ndacdiff);
free(dacptr); free(dacptr);
return FAIL; return FAIL;
} }
if (nadcdiff<=0) { if (nadcdiff<=0) {
ts+=receiveDataOnly(file_des,myMod->adcs, sizeof(float)*nAdcs); ts+=receiveDataOnly(file_des,myMod->adcs, sizeof(double)*nAdcs);
#ifdef VERBOSE #ifdef VERBOSE
printf("adcs received\n"); printf("adcs received\n");
#endif #endif
} else { } else {
adcptr=malloc(nadcdiff*sizeof(float)); adcptr=malloc(nadcdiff*sizeof(double));
myMod->nadc=naold; myMod->nadc=naold;
ts+=receiveDataOnly(file_des,myMod->adcs, sizeof(float)*naold); ts+=receiveDataOnly(file_des,myMod->adcs, sizeof(double)*naold);
ts+=receiveDataOnly(file_des,adcptr, sizeof(float)*nadcdiff); ts+=receiveDataOnly(file_des,adcptr, sizeof(double)*nadcdiff);
free(adcptr); free(adcptr);
return FAIL; return FAIL;
} }

View File

@ -12,10 +12,10 @@
/** maxmimum number of detectors ina multidetector structure*/ /** maxmimum number of detectors ina multidetector structure*/
#define MAXDET 100 #define MAXDET 100
typedef float float32_t; typedef double double32_t;
typedef int int32_t; typedef int int32_t;
typedef char mystring[MAX_STR_LENGTH]; typedef char mystring[MAX_STR_LENGTH];
typedef float mysteps[MAX_SCAN_STEPS]; typedef double mysteps[MAX_SCAN_STEPS];
/** /**
\file sls_detector_defs.h \file sls_detector_defs.h
@ -102,14 +102,14 @@ typedef struct {
int nadc; /**< is the number of adcs on the module */ int nadc; /**< is the number of adcs on the module */
int reg; /**< is the module register (e.g. dynamic range?) int reg; /**< is the module register (e.g. dynamic range?)
\see moduleRegisterBit */ \see moduleRegisterBit */
float *dacs; /**< is the pointer to the array of the dac values (in V) */ double *dacs; /**< is the pointer to the array of the dac values (in V) */
float *adcs; /**< is the pointer to the array of the adc values (in V) FLAT_FIELD_CORRECTION*/ double *adcs; /**< is the pointer to the array of the adc values (in V) FLAT_FIELD_CORRECTION*/
int *chipregs; /**< is the pointer to the array of the chip registers int *chipregs; /**< is the pointer to the array of the chip registers
\see ::chipRegisterBit */ \see ::chipRegisterBit */
int *chanregs; /**< is the pointer to the array of the channel registers int *chanregs; /**< is the pointer to the array of the channel registers
\see ::channelRegisterBit */ \see ::channelRegisterBit */
float gain; /**< is the module gain (V/keV) */ double gain; /**< is the module gain (V/keV) */
float offset; /**< is the module offset (V) */ double offset; /**< is the module offset (V) */
} sls_detector_module; } sls_detector_module;
/** /**
@ -464,14 +464,14 @@ enum imageType {
/* angular conversion constant for a module */ /* angular conversion constant for a module */
/* *\/ */ /* *\/ */
/* typedef struct { */ /* typedef struct { */
/* float center; /\**< center of the module (channel at which the radius is perpendicular to the module surface) *\/ */ /* double center; /\**< center of the module (channel at which the radius is perpendicular to the module surface) *\/ */
/* float ecenter; /\**< error in the center determination *\/ */ /* double ecenter; /\**< error in the center determination *\/ */
/* float r_conversion; /\**< detector pixel size (or strip pitch) divided by the diffractometer radius *\/ */ /* double r_conversion; /\**< detector pixel size (or strip pitch) divided by the diffractometer radius *\/ */
/* float er_conversion; /\**< error in the r_conversion determination *\/ */ /* double er_conversion; /\**< error in the r_conversion determination *\/ */
/* float offset; /\**< the module offset i.e. the position of channel 0 with respect to the diffractometer 0 *\/ */ /* double offset; /\**< the module offset i.e. the position of channel 0 with respect to the diffractometer 0 *\/ */
/* float eoffset; /\**< error in the offset determination *\/ */ /* double eoffset; /\**< error in the offset determination *\/ */
/* float tilt; /\**< ossible tilt in the orthogonal direction (unused)*\/ */ /* double tilt; /\**< ossible tilt in the orthogonal direction (unused)*\/ */
/* float etilt; /\**< error in the tilt determination *\/ */ /* double etilt; /\**< error in the tilt determination *\/ */
/* } angleConversionConstant; */ /* } angleConversionConstant; */

View File

@ -291,13 +291,13 @@ int sendModule(int file_des, sls_detector_module *myMod) {
#ifdef VERBOSE #ifdef VERBOSE
printf("module %d of size %d sent\n",myMod->module, ts); printf("module %d of size %d sent\n",myMod->module, ts);
#endif #endif
ts+= sendDataOnly(file_des,myMod->dacs,sizeof(float)*nDacs); ts+= sendDataOnly(file_des,myMod->dacs,sizeof(double)*nDacs);
#ifdef VERBOSE #ifdef VERBOSE
printf("dacs %d of size %d sent\n",myMod->module, ts); printf("dacs %d of size %d sent\n",myMod->module, ts);
for (idac=0; idac< nDacs; idac++) for (idac=0; idac< nDacs; idac++)
printf("dac %d is %d\n",idac,myMod->dacs[idac]); printf("dac %d is %d\n",idac,myMod->dacs[idac]);
#endif #endif
ts+= sendDataOnly(file_des,myMod->adcs,sizeof(float)*nAdcs); ts+= sendDataOnly(file_des,myMod->adcs,sizeof(double)*nAdcs);
#ifdef VERBOSE #ifdef VERBOSE
printf("adcs %d of size %d sent\n",myMod->module, ts); printf("adcs %d of size %d sent\n",myMod->module, ts);
#endif #endif
@ -361,8 +361,8 @@ int receiveChip(int file_des, sls_detector_chip* myChip) {
int receiveModule(int file_des, sls_detector_module* myMod) { int receiveModule(int file_des, sls_detector_module* myMod) {
float *dacptr=myMod->dacs; double *dacptr=myMod->dacs;
float *adcptr=myMod->adcs; double *adcptr=myMod->adcs;
int *chipptr=myMod->chipregs, *chanptr=myMod->chanregs; int *chipptr=myMod->chipregs, *chanptr=myMod->chanregs;
int ts=0; int ts=0;
int nChips, nchipold=myMod->nchip, nchipdiff; int nChips, nchipold=myMod->nchip, nchipdiff;
@ -419,29 +419,29 @@ int receiveModule(int file_des, sls_detector_module* myMod) {
printf("received %d adcs\n",nAdcs); printf("received %d adcs\n",nAdcs);
#endif #endif
if (ndacdiff<=0) { if (ndacdiff<=0) {
ts+=receiveDataOnly(file_des,myMod->dacs, sizeof(float)*nDacs); ts+=receiveDataOnly(file_des,myMod->dacs, sizeof(double)*nDacs);
#ifdef VERBOSE #ifdef VERBOSE
printf("dacs received\n"); printf("dacs received\n");
#endif #endif
} else { } else {
dacptr=malloc(ndacdiff*sizeof(float)); dacptr=malloc(ndacdiff*sizeof(double));
myMod->ndac=ndold; myMod->ndac=ndold;
ts+=receiveDataOnly(file_des,myMod->dacs, sizeof(float)*ndold); ts+=receiveDataOnly(file_des,myMod->dacs, sizeof(double)*ndold);
ts+=receiveDataOnly(file_des,dacptr, sizeof(float)*ndacdiff); ts+=receiveDataOnly(file_des,dacptr, sizeof(double)*ndacdiff);
free(dacptr); free(dacptr);
return FAIL; return FAIL;
} }
if (nadcdiff<=0) { if (nadcdiff<=0) {
ts+=receiveDataOnly(file_des,myMod->adcs, sizeof(float)*nAdcs); ts+=receiveDataOnly(file_des,myMod->adcs, sizeof(double)*nAdcs);
#ifdef VERBOSE #ifdef VERBOSE
printf("adcs received\n"); printf("adcs received\n");
#endif #endif
} else { } else {
adcptr=malloc(nadcdiff*sizeof(float)); adcptr=malloc(nadcdiff*sizeof(double));
myMod->nadc=naold; myMod->nadc=naold;
ts+=receiveDataOnly(file_des,myMod->adcs, sizeof(float)*naold); ts+=receiveDataOnly(file_des,myMod->adcs, sizeof(double)*naold);
ts+=receiveDataOnly(file_des,adcptr, sizeof(float)*nadcdiff); ts+=receiveDataOnly(file_des,adcptr, sizeof(double)*nadcdiff);
free(adcptr); free(adcptr);
return FAIL; return FAIL;
} }

View File

@ -1208,8 +1208,8 @@ int setDACRegister(int idac, int val, int imod) {
} }
float getTemperature(int tempSensor, int imod){ double getTemperature(int tempSensor, int imod){
float val; double val;
char cTempSensor[2][100]={"ADCs/ASICs","VRs/FPGAs"}; char cTempSensor[2][100]={"ADCs/ASICs","VRs/FPGAs"};
imod=0;//ignoring more than 1 mod for now imod=0;//ignoring more than 1 mod for now
int i,j,repeats=6; int i,j,repeats=6;
@ -1236,7 +1236,7 @@ float getTemperature(int tempSensor, int imod){
} }
bus_w(TEMP_IN_REG,(T1_CLK_BIT)|(T1_CS_BIT)|(T2_CLK_BIT)|(T2_CS_BIT));//standby bus_w(TEMP_IN_REG,(T1_CLK_BIT)|(T1_CS_BIT)|(T2_CLK_BIT)|(T2_CS_BIT));//standby
val=((float)tempVal)/4.0; val=((double)tempVal)/4.0;
#ifdef VERBOSE #ifdef VERBOSE
printf("Temperature of module:%d for the %s is %.2fC\n",imod,cTempSensor[tempSensor],val); printf("Temperature of module:%d for the %s is %.2fC\n",imod,cTempSensor[tempSensor],val);

View File

@ -56,7 +56,7 @@ int setContinousReadOut(int d);
int setDACRegister(int idac, int val, int imod); int setDACRegister(int idac, int val, int imod);
float getTemperature(int tempSensor,int imod); double getTemperature(int tempSensor,int imod);
int initHighVoltage(int val,int imod); int initHighVoltage(int val,int imod);
int initConfGain(int isettings,int val,int imod); int initConfGain(int isettings,int val,int imod);

View File

@ -37,8 +37,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;
float *detectorDacs=NULL; double *detectorDacs=NULL;
float *detectorAdcs=NULL; double *detectorAdcs=NULL;
//int numberOfProbes; //int numberOfProbes;
@ -56,8 +56,8 @@ int initDetector() {
detectorModules=malloc(n*sizeof(sls_detector_module)); detectorModules=malloc(n*sizeof(sls_detector_module));
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(float)); detectorDacs=malloc(n*NDAC*sizeof(double));
detectorAdcs=malloc(n*NADC*sizeof(float)); detectorAdcs=malloc(n*NADC*sizeof(double));
#ifdef VERBOSE #ifdef VERBOSE
printf("modules from 0x%x to 0x%x\n",(unsigned int)(detectorModules), (unsigned int)(detectorModules+n)); printf("modules from 0x%x to 0x%x\n",(unsigned int)(detectorModules), (unsigned int)(detectorModules+n));
printf("chips from 0x%x to 0x%x\n",(unsigned int)(detectorChips), (unsigned int)(detectorChips+n*NCHIP)); printf("chips from 0x%x to 0x%x\n",(unsigned int)(detectorChips), (unsigned int)(detectorChips+n*NCHIP));
@ -540,15 +540,15 @@ int set_one_dac(int imod) {
return OK; return OK;
} }
float initDACbyIndex(int ind,float val, int imod) { double initDACbyIndex(int ind,double val, int imod) {
int v; int v;
const float partref[NDAC]=PARTREF; const double partref[NDAC]=PARTREF;
const float partr1[NDAC]=PARTR1; const double partr1[NDAC]=PARTR1;
const float partr2[NDAC]=PARTR2; const double partr2[NDAC]=PARTR2;
float ref=partref[ind]; double ref=partref[ind];
float r1=partr1[ind]; double r1=partr1[ind];
float r2=partr2[ind]; double r2=partr2[ind];
v=(val+(val-ref)*r1/r2)*DAC_DR/DAC_MAX; v=(val+(val-ref)*r1/r2)*DAC_DR/DAC_MAX;
@ -557,10 +557,10 @@ float initDACbyIndex(int ind,float 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);
} }
float initDACbyIndexDACU(int ind, int val, int imod) { double initDACbyIndexDACU(int ind, int val, int imod) {
// const float daccs[NDAC]=DACCS; // const double daccs[NDAC]=DACCS;
// const float dacaddr[NDAC]=DACADDR; // const double dacaddr[NDAC]=DACADDR;
// int cs=daccs[ind]; // int cs=daccs[ind];
// int addr=dacaddr[ind]; // int addr=dacaddr[ind];
@ -601,9 +601,9 @@ float initDACbyIndexDACU(int ind, int val, int imod) {
} }
int getThresholdEnergy() { int getThresholdEnergy() {
float g[3]=DEFAULTGAIN; double g[3]=DEFAULTGAIN;
float o[3]=DEFAULTOFFSET; double o[3]=DEFAULTOFFSET;
float myg=-1, myo=-1; double myg=-1, myo=-1;
// int dacu; // int dacu;
int imod; int imod;
int ethr=-1; int ethr=-1;
@ -643,7 +643,7 @@ int getThresholdEnergy() {
} }
#ifdef VERBOSE #ifdef VERBOSE
//printf("module=%d gain=%f, offset=%f, dacu=%f\n",imod, myg, myo, detectorDacs[VTHRESH+imod*NDAC]); //printf("module=%d gain=%f, offset=%f, dacu=%f\n",imod, myg, myo, detectorDacs[VTHRESH+imod*NDAC]);
printf("module=%d gain=%f, offset=%f, dacu=%f\n",imod, myg, myo,(float)(setDACRegister(VREF_DS,-1,imod)));//edited by dhanya printf("module=%d gain=%f, offset=%f, dacu=%f\n",imod, myg, myo,(double)(setDACRegister(VREF_DS,-1,imod)));//edited by dhanya
printf("Threshold energy of module %d is %d eV\n", imod, ethr); printf("Threshold energy of module %d is %d eV\n", imod, ethr);
#endif #endif
@ -659,9 +659,9 @@ int getThresholdEnergy() {
} }
int setThresholdEnergy(int ethr) { int setThresholdEnergy(int ethr) {
float g[3]=DEFAULTGAIN; double g[3]=DEFAULTGAIN;
float o[3]=DEFAULTOFFSET; double o[3]=DEFAULTOFFSET;
float myg=-1, myo=-1; double myg=-1, myo=-1;
int dacu; int dacu;
int imod; int imod;
int ret=ethr; int ret=ethr;
@ -698,7 +698,7 @@ int setThresholdEnergy(int ethr) {
myg=-1; myg=-1;
} }
if (myg>0 && myo>0) { if (myg>0 && myo>0) {
dacu=myo-myg*((float)ethr)/1000.; dacu=myo-myg*((double)ethr)/1000.;
#ifdef VERBOSE #ifdef VERBOSE
printf("module %d (%x): gain %f, off %f, energy %d eV, dac %d\n",imod,(unsigned int)((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,(unsigned int)((detectorModules+imod)),(detectorModules+imod)->gain,(detectorModules+imod)->offset, ethr,dacu);
#endif #endif
@ -715,7 +715,7 @@ int setThresholdEnergy(int ethr) {
float getDACbyIndexDACU(int ind, int imod) { double getDACbyIndexDACU(int ind, int imod) {
/* /*
if (detectorDacs) { if (detectorDacs) {
if (imod<getNModBoard()) if (imod<getNModBoard())
@ -741,7 +741,7 @@ int initDAC(int dac_addr, int value, int imod) {
return 0; return 0;
} }
float getTemperatureByModule(int tempSensor, int imod) double getTemperatureByModule(int tempSensor, int imod)
{ {
int im; int im;
//for the particular module //for the particular module

View File

@ -108,14 +108,14 @@ int set_one_dac(int imod);
int initDAC(int dac_addr, int value,int imod ); int initDAC(int dac_addr, int value,int imod );
int initDACs(int* v,int imod ); int initDACs(int* v,int imod );
int setSettings(int i,int imod); int setSettings(int i,int imod);
float initDACbyIndex(int ind,float val, int imod); double initDACbyIndex(int ind,double val, int imod);
float initDACbyIndexDACU(int ind,int val, int imod); double initDACbyIndexDACU(int ind,int val, int imod);
float getDACbyIndexDACU(int ind, int imod); double getDACbyIndexDACU(int ind, int imod);
int getThresholdEnergy(); int getThresholdEnergy();
int setThresholdEnergy(int ethr); int setThresholdEnergy(int ethr);
/* Other DAC index routines*/ /* Other DAC index routines*/
float getTemperatureByModule(int tempSensor, int imod); double getTemperatureByModule(int tempSensor, int imod);
int initHighVoltageByModule(int val, int imod); int initHighVoltageByModule(int val, int imod);
int initConfGainByModule(int isettings,int val,int imod); int initConfGainByModule(int isettings,int val,int imod);

View File

@ -899,13 +899,13 @@ int read_register(int file_des) {
int set_dac(int file_des) { int set_dac(int file_des) {
//default:all mods //default:all mods
float retval; double retval;
int ret=OK; int ret=OK;
int arg[2]; int arg[2];
enum dacIndex ind; enum dacIndex ind;
int imod; int imod;
int n; int n;
float val; double val;
int idac=0; int idac=0;
sprintf(mess,"Can't set DAC\n"); sprintf(mess,"Can't set DAC\n");
@ -1028,7 +1028,7 @@ int set_dac(int file_des) {
int get_adc(int file_des) { int get_adc(int file_des) {
//default: mod 0 //default: mod 0
float retval; double retval;
int ret=OK; int ret=OK;
int arg[2]; int arg[2];
enum dacIndex ind; enum dacIndex ind;
@ -1373,8 +1373,8 @@ int set_module(int file_des) {
sls_detector_module myModule; sls_detector_module myModule;
int *myChip=malloc(NCHIP*sizeof(int)); int *myChip=malloc(NCHIP*sizeof(int));
int *myChan=malloc(NCHIP*NCHAN*sizeof(int)); int *myChan=malloc(NCHIP*NCHAN*sizeof(int));
float *myDac=malloc(NDAC*sizeof(int)); double *myDac=malloc(NDAC*sizeof(int));
float *myAdc=malloc(NADC*sizeof(int)); double *myAdc=malloc(NADC*sizeof(int));
int retval, n; int retval, n;
int ret=OK; int ret=OK;
int dr;// ow; int dr;// ow;
@ -1492,8 +1492,8 @@ int get_module(int file_des) {
sls_detector_module myModule; sls_detector_module myModule;
int *myChip=malloc(NCHIP*sizeof(int)); int *myChip=malloc(NCHIP*sizeof(int));
int *myChan=malloc(NCHIP*NCHAN*sizeof(int)); int *myChan=malloc(NCHIP*NCHAN*sizeof(int));
float *myDac=malloc(NDAC*sizeof(int)); double *myDac=malloc(NDAC*sizeof(int));
float *myAdc=malloc(NADC*sizeof(int)); double *myAdc=malloc(NADC*sizeof(int));
if (myDac) if (myDac)

View File

@ -161,11 +161,11 @@ int choose_vthresh_and_vtrim(int countlim, int nsigma, int im) {
int *fifodata; int *fifodata;
float vthreshmean, vthreshSTDev; double vthreshmean, vthreshSTDev;
int *thrmi, *thrma; int *thrmi, *thrma;
float c; double c;
float b=BVTRIM; double b=BVTRIM;
float a=AVTRIM; double a=AVTRIM;
int *trim; int *trim;
int ich, imod, ichan; int ich, imod, ichan;
int nvalid=0; int nvalid=0;
@ -439,7 +439,7 @@ int trim_with_level(int countlim, int im) {
int kth_smallest(int *a, int n, int k) int kth_smallest(int *a, int n, int k)
{ {
register int i,j,l,m ; register int i,j,l,m ;
register float x ; register double x ;
l=0 ; m=n-1 ; l=0 ; m=n-1 ;
while (l<m) { while (l<m) {
@ -466,7 +466,7 @@ int ave(int *a, int n)
{ {
int av=0,i; int av=0,i;
for (i=0; i<n; i++) for (i=0; i<n; i++)
av=av+((float)*(a+i))/((float)n); av=av+((double)*(a+i))/((double)n);
return av; return av;
} }

View File

@ -1545,16 +1545,16 @@ int multiSlsDetector::setROI(int nroi, int *xmin, int *xmax, int *ymin, int *yma
*/ */
float* multiSlsDetector::decodeData(int *datain, float *fdata) { double* multiSlsDetector::decodeData(int *datain, double *fdata) {
float *dataout; double *dataout;
if (fdata) if (fdata)
dataout=fdata; dataout=fdata;
else else
dataout=new float[thisMultiDetector->numberOfChannels]; dataout=new double[thisMultiDetector->numberOfChannels];
// int ich=0; // int ich=0;
float *detp=dataout; double *detp=dataout;
int *datap=datain; int *datap=datain;
@ -1605,8 +1605,8 @@ float* multiSlsDetector::decodeData(int *datain, float *fdata) {
int multiSlsDetector::setFlatFieldCorrection(string fname){ int multiSlsDetector::setFlatFieldCorrection(string fname){
float data[thisMultiDetector->numberOfChannels], xmed[thisMultiDetector->numberOfChannels]; double data[thisMultiDetector->numberOfChannels], xmed[thisMultiDetector->numberOfChannels];
float ffcoefficients[thisMultiDetector->numberOfChannels], fferrors[thisMultiDetector->numberOfChannels]; double ffcoefficients[thisMultiDetector->numberOfChannels], fferrors[thisMultiDetector->numberOfChannels];
int nmed=0; int nmed=0;
int idet=0, ichdet=-1; int idet=0, ichdet=-1;
char ffffname[MAX_STR_LENGTH*2]; char ffffname[MAX_STR_LENGTH*2];
@ -1743,9 +1743,9 @@ int multiSlsDetector::setFlatFieldCorrection(string fname){
int multiSlsDetector::setFlatFieldCorrection(float *corr, float *ecorr) { int multiSlsDetector::setFlatFieldCorrection(double *corr, double *ecorr) {
int ichdet=0; int ichdet=0;
float *p, *ep; double *p, *ep;
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) { for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
if (detectors[idet]) { if (detectors[idet]) {
if (corr!=NULL) if (corr!=NULL)
@ -1771,9 +1771,9 @@ int multiSlsDetector::setFlatFieldCorrection(float *corr, float *ecorr) {
int multiSlsDetector::getFlatFieldCorrection(float *corr, float *ecorr) { int multiSlsDetector::getFlatFieldCorrection(double *corr, double *ecorr) {
int ichdet=0; int ichdet=0;
float *p, *ep; double *p, *ep;
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) { for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
if (detectors[idet]) { if (detectors[idet]) {
if (corr!=NULL) if (corr!=NULL)
@ -1862,10 +1862,10 @@ angleConversionConstant * multiSlsDetector::getAngularConversionPointer(int imod
int multiSlsDetector::flatFieldCorrect(float* datain, float *errin, float* dataout, float *errout){ int multiSlsDetector::flatFieldCorrect(double* datain, double *errin, double* dataout, double *errout){
int ichdet=0; int ichdet=0;
float *perr=errin;//*pdata, double *perr=errin;//*pdata,
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) { for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
if (detectors[idet]) { if (detectors[idet]) {
#ifdef VERBOSE #ifdef VERBOSE
@ -1887,8 +1887,8 @@ int multiSlsDetector::flatFieldCorrect(float* datain, float *errin, float* datao
int multiSlsDetector::setRateCorrection(float t){ int multiSlsDetector::setRateCorrection(double t){
// float tdead[]=defaultTDead; // double tdead[]=defaultTDead;
if (t==0) { if (t==0) {
thisMultiDetector->correctionMask&=~(1<<RATE_CORRECTION); thisMultiDetector->correctionMask&=~(1<<RATE_CORRECTION);
@ -1909,7 +1909,7 @@ int multiSlsDetector::setRateCorrection(float t){
} }
int multiSlsDetector::getRateCorrection(float &t){ int multiSlsDetector::getRateCorrection(double &t){
if (thisMultiDetector->correctionMask&(1<<RATE_CORRECTION)) { if (thisMultiDetector->correctionMask&(1<<RATE_CORRECTION)) {
#ifdef VERBOSE #ifdef VERBOSE
@ -1925,7 +1925,7 @@ int multiSlsDetector::getRateCorrection(float &t){
return 0; return 0;
}; };
float multiSlsDetector::getRateCorrectionTau(){ double multiSlsDetector::getRateCorrectionTau(){
if (thisMultiDetector->correctionMask&(1<<RATE_CORRECTION)) { if (thisMultiDetector->correctionMask&(1<<RATE_CORRECTION)) {
#ifdef VERBOSE #ifdef VERBOSE
@ -1957,10 +1957,10 @@ int multiSlsDetector::getRateCorrection(){
int multiSlsDetector::rateCorrect(float* datain, float *errin, float* dataout, float *errout){ int multiSlsDetector::rateCorrect(double* datain, double *errin, double* dataout, double *errout){
int ichdet=0; int ichdet=0;
float *perr=errin; double *perr=errin;
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) { for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
if (detectors[idet]) { if (detectors[idet]) {
if (errin) if (errin)
@ -2157,8 +2157,8 @@ int multiSlsDetector::getAngularConversion(int &direction, angleConversionCons
float multiSlsDetector::setDAC(float val, dacIndex idac, int imod) { double multiSlsDetector::setDAC(double val, dacIndex idac, int imod) {
float ret, ret1=-100; double ret, ret1=-100;
int id=-1, im=-1; int id=-1, im=-1;
int dmi=0, dma=thisMultiDetector->numberOfDetectors; int dmi=0, dma=thisMultiDetector->numberOfDetectors;
@ -2180,8 +2180,8 @@ float multiSlsDetector::setDAC(float val, dacIndex idac, int imod) {
return ret1; return ret1;
} }
float multiSlsDetector::getADC(dacIndex idac, int imod) { double multiSlsDetector::getADC(dacIndex idac, int imod) {
float ret, ret1=-100; double ret, ret1=-100;
int id=-1, im=-1; int id=-1, im=-1;
int dmi=0, dma=thisMultiDetector->numberOfDetectors; int dmi=0, dma=thisMultiDetector->numberOfDetectors;
@ -2234,8 +2234,8 @@ int multiSlsDetector::setChannel(long long reg, int ichan, int ichip, int imod)
\returns the actual value \returns the actual value
*/ */
float multiSlsDetector::setAngularConversionParameter(angleConversionParameter c, float v) { double multiSlsDetector::setAngularConversionParameter(angleConversionParameter c, double v) {
float ret=slsDetectorUtils::setAngularConversionParameter(c,v); double ret=slsDetectorUtils::setAngularConversionParameter(c,v);
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) { for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
if (detectors[idet]) { if (detectors[idet]) {
@ -2248,10 +2248,10 @@ float multiSlsDetector::setAngularConversionParameter(angleConversionParameter c
// float* multiSlsDetector::convertAngles(float pos) { // double* multiSlsDetector::convertAngles(double pos) {
// float *ang=new float[thisMultiDetector->numberOfChannels]; // double *ang=new double[thisMultiDetector->numberOfChannels];
// float *p=ang; // double *p=ang;
// int choff=0; // int choff=0;
// for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) { // for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
@ -3286,7 +3286,7 @@ int multiSlsDetector::writeConfigurationFile(string const fname){
int multiSlsDetector::writeDataFile(string fname, float *data, float *err, float *ang, char dataformat, int nch) { int multiSlsDetector::writeDataFile(string fname, double *data, double *err, double *ang, char dataformat, int nch) {
#ifdef VERBOSE #ifdef VERBOSE
cout << "using overloaded multiSlsDetector function to write formatted data file " << endl; cout << "using overloaded multiSlsDetector function to write formatted data file " << endl;
@ -3295,7 +3295,7 @@ int multiSlsDetector::writeDataFile(string fname, float *data, float *err, float
ofstream outfile; ofstream outfile;
int choff=0, off=0; //idata, int choff=0, off=0; //idata,
float *pe=err, *pa=ang; double *pe=err, *pa=ang;
int nch_left=nch, n, nd; int nch_left=nch, n, nd;
if (nch_left<=0) if (nch_left<=0)
@ -3381,7 +3381,7 @@ int multiSlsDetector::writeDataFile(string fname, int *data) {
} }
int multiSlsDetector::readDataFile(string fname, float *data, float *err, float *ang, char dataformat){ int multiSlsDetector::readDataFile(string fname, double *data, double *err, double *ang, char dataformat){
#ifdef VERBOSE #ifdef VERBOSE
cout << "using overloaded multiSlsDetector function to read formatted data file " << endl; cout << "using overloaded multiSlsDetector function to read formatted data file " << endl;
@ -3392,7 +3392,7 @@ int multiSlsDetector::readDataFile(string fname, float *data, float *err, float
//int interrupt=0; //int interrupt=0;
string str; string str;
int choff=0, off=0; int choff=0, off=0;
float *pe=err, *pa=ang; double *pe=err, *pa=ang;
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< "Opening file "<< fname << std::endl; std::cout<< "Opening file "<< fname << std::endl;

View File

@ -119,7 +119,7 @@ class multiSlsDetector : public slsDetectorUtils {
/** threaded processing flag (i.e. if data are processed and written to file in a separate thread) */ /** threaded processing flag (i.e. if data are processed and written to file in a separate thread) */
int threadedProcessing; int threadedProcessing;
/** dead time (in ns) for rate corrections */ /** dead time (in ns) for rate corrections */
float tDead; double tDead;
@ -147,17 +147,17 @@ class multiSlsDetector : public slsDetectorUtils {
/** angular direction (1 if it corresponds to the encoder direction i.e. channel 0 is 0, maxchan is positive high angle, 0 otherwise */ /** angular direction (1 if it corresponds to the encoder direction i.e. channel 0 is 0, maxchan is positive high angle, 0 otherwise */
int angDirection; int angDirection;
/** beamline fine offset (of the order of mdeg, might be adjusted for each measurements) */ /** beamline fine offset (of the order of mdeg, might be adjusted for each measurements) */
float fineOffset; double fineOffset;
/** beamline offset (might be a few degrees beacuse of encoder offset - normally it is kept fixed for a long period of time) */ /** beamline offset (might be a few degrees beacuse of encoder offset - normally it is kept fixed for a long period of time) */
float globalOffset; double globalOffset;
/** bin size for data merging */ /** bin size for data merging */
float binSize; double binSize;
/** number of positions at which the detector should acquire */ /** number of positions at which the detector should acquire */
int numberOfPositions; int numberOfPositions;
/** list of encoder positions at which the detector should acquire */ /** list of encoder positions at which the detector should acquire */
float detPositions[MAXPOS]; double detPositions[MAXPOS];
@ -309,7 +309,7 @@ class multiSlsDetector : public slsDetectorUtils {
int getMaxNumberOfChannels(){return thisMultiDetector->maxNumberOfChannels;}; int getMaxNumberOfChannels(){return thisMultiDetector->maxNumberOfChannels;};
float getScanStep(int index, int istep){return thisMultiDetector->scanSteps[index][istep];}; double getScanStep(int index, int istep){return thisMultiDetector->scanSteps[index][istep];};
/** returns the detector offset (in number of channels) /** returns the detector offset (in number of channels)
\param pos position of the detector \param pos position of the detector
\param ox reference to the offset in x \param ox reference to the offset in x
@ -622,7 +622,7 @@ class multiSlsDetector : public slsDetectorUtils {
\param ecorr if !=NULL the flat field correction errors will be filled with ecorr (1 otherwise) \param ecorr if !=NULL the flat field correction errors will be filled with ecorr (1 otherwise)
\returns 0 if ff correction disabled, >0 otherwise \returns 0 if ff correction disabled, >0 otherwise
*/ */
int setFlatFieldCorrection(float *corr, float *ecorr=NULL); int setFlatFieldCorrection(double *corr, double *ecorr=NULL);
/** /**
get flat field corrections get flat field corrections
@ -630,7 +630,7 @@ class multiSlsDetector : public slsDetectorUtils {
\param ecorr if !=NULL will be filled with the correction coefficients errors \param ecorr if !=NULL will be filled with the correction coefficients errors
\returns 0 if ff correction disabled, >0 otherwise \returns 0 if ff correction disabled, >0 otherwise
*/ */
int getFlatFieldCorrection(float *corr=NULL, float *ecorr=NULL); int getFlatFieldCorrection(double *corr=NULL, double *ecorr=NULL);
@ -644,7 +644,7 @@ class multiSlsDetector : public slsDetectorUtils {
\param t dead time in ns - if 0 disable correction, if >0 set dead time to t, if <0 set deadtime to default dead time for current settings \param t dead time in ns - if 0 disable correction, if >0 set dead time to t, if <0 set deadtime to default dead time for current settings
\returns 0 if rate correction disabled, >0 otherwise \returns 0 if rate correction disabled, >0 otherwise
*/ */
int setRateCorrection(float t=0); int setRateCorrection(double t=0);
/** /**
@ -652,14 +652,14 @@ class multiSlsDetector : public slsDetectorUtils {
\param t reference for dead time \param t reference for dead time
\returns 0 if rate correction disabled, >0 otherwise \returns 0 if rate correction disabled, >0 otherwise
*/ */
int getRateCorrection(float &t); int getRateCorrection(double &t);
/** /**
get rate correction tau get rate correction tau
\returns 0 if rate correction disabled, otherwise the tau used for the correction \returns 0 if rate correction disabled, otherwise the tau used for the correction
*/ */
float getRateCorrectionTau(); double getRateCorrectionTau();
/** /**
get rate correction get rate correction
\returns 0 if rate correction disabled, >0 otherwise \returns 0 if rate correction disabled, >0 otherwise
@ -703,17 +703,17 @@ class multiSlsDetector : public slsDetectorUtils {
int writeAngularConversion(string fname); int writeAngularConversion(string fname);
// float* convertAngles(float pos); // double* convertAngles(double pos);
/** /**
decode data from the detector converting them to an array of floats, one for each channle decode data from the detector converting them to an array of doubles, one for each channle
\param datain data from the detector \param datain data from the detector
\returns pointer to a float array with a data per channel \returns pointer to a double array with a data per channel
*/ */
float* decodeData(int *datain, float *fdata=NULL); double* decodeData(int *datain, double *fdata=NULL);
@ -728,7 +728,7 @@ class multiSlsDetector : public slsDetectorUtils {
\param fferr erro on ffcoefficient \param fferr erro on ffcoefficient
\returns 0 \returns 0
*/ */
// int flatFieldCorrect(float datain, float errin, float &dataout, float &errout, float ffcoefficient, float fferr); // int flatFieldCorrect(double datain, double errin, double &dataout, double &errout, double ffcoefficient, double fferr);
/** /**
flat field correct data flat field correct data
@ -738,7 +738,7 @@ class multiSlsDetector : public slsDetectorUtils {
\param errout error on corrected data (if not NULL) \param errout error on corrected data (if not NULL)
\returns 0 \returns 0
*/ */
int flatFieldCorrect(float* datain, float *errin, float* dataout, float *errout); int flatFieldCorrect(double* datain, double *errin, double* dataout, double *errout);
@ -752,7 +752,7 @@ class multiSlsDetector : public slsDetectorUtils {
\param t acquisition time (in ns) \param t acquisition time (in ns)
\returns 0 \returns 0
*/ */
// int rateCorrect(float datain, float errin, float &dataout, float &errout, float tau, float t); // int rateCorrect(double datain, double errin, double &dataout, double &errout, double tau, double t);
/** /**
rate correct data rate correct data
@ -762,7 +762,7 @@ class multiSlsDetector : public slsDetectorUtils {
\param errout error on corrected data (if not NULL) \param errout error on corrected data (if not NULL)
\returns 0 \returns 0
*/ */
int rateCorrect(float* datain, float *errin, float* dataout, float *errout); int rateCorrect(double* datain, double *errin, double* dataout, double *errout);
/** /**
turns off server turns off server
@ -785,7 +785,7 @@ class multiSlsDetector : public slsDetectorUtils {
/////////////////////////////////////// int setTotalProgress(); ////////////// from slsDetectorUtils! /////////////////////////////////////// int setTotalProgress(); ////////////// from slsDetectorUtils!
/** returns the current progress in % */ /** returns the current progress in % */
////////////////////////////////float getCurrentProgress();////////////// from slsDetectorUtils! ////////////////////////////////double getCurrentProgress();////////////// from slsDetectorUtils!
/** /**
@ -795,7 +795,7 @@ class multiSlsDetector : public slsDetectorUtils {
\param imod module number (if -1 alla modules) \param imod module number (if -1 alla modules)
\returns current DAC value \returns current DAC value
*/ */
float setDAC(float val, dacIndex index, int imod=-1); double setDAC(double val, dacIndex index, int imod=-1);
/** /**
set dacs value set dacs value
\param val value (in V) \param val value (in V)
@ -803,7 +803,7 @@ class multiSlsDetector : public slsDetectorUtils {
\param imod module number (if -1 alla modules) \param imod module number (if -1 alla modules)
\returns current DAC value \returns current DAC value
*/ */
float getADC(dacIndex index, int imod=0); double getADC(dacIndex index, int imod=0);
/** /**
configure channel configure channel
\param reg channel register \param reg channel register
@ -903,7 +903,7 @@ class multiSlsDetector : public slsDetectorUtils {
\returns the actual value \returns the actual value
*/ */
float setAngularConversionParameter(angleConversionParameter c, float v); double setAngularConversionParameter(angleConversionParameter c, double v);
/** /**
@ -913,13 +913,13 @@ class multiSlsDetector : public slsDetectorUtils {
\param err array of arrors on the data. If NULL no errors will be written \param err array of arrors on the data. If NULL no errors will be written
\param ang array of angular values. If NULL data will be in the form chan-val(-err) otherwise ang-val(-err) \param ang array of angular values. If NULL data will be in the form chan-val(-err) otherwise ang-val(-err)
\param dataformat format of the data: can be 'i' integer or 'f' float (default) \param dataformat format of the data: can be 'i' integer or 'f' double (default)
\param nch number of channels to be written to file. if -1 defaults to the number of installed channels of the detector \param nch number of channels to be written to file. if -1 defaults to the number of installed channels of the detector
\returns OK or FAIL if it could not write the file or data=NULL \returns OK or FAIL if it could not write the file or data=NULL
\sa mythenDetector::writeDataFile \sa mythenDetector::writeDataFile
*/ */
int writeDataFile(string fname, float *data, float *err=NULL, float *ang=NULL, char dataformat='f', int nch=-1); int writeDataFile(string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int nch=-1);
/** /**
@ -940,13 +940,13 @@ class multiSlsDetector : public slsDetectorUtils {
\param err array of arrors on the data. If NULL no errors are expected on the file \param err array of arrors on the data. If NULL no errors are expected on the file
\param ang array of angular values. If NULL data are expected in the form chan-val(-err) otherwise ang-val(-err) \param ang array of angular values. If NULL data are expected in the form chan-val(-err) otherwise ang-val(-err)
\param dataformat format of the data: can be 'i' integer or 'f' float (default) \param dataformat format of the data: can be 'i' integer or 'f' double (default)
\param nch number of channels to be written to file. if <=0 defaults to the number of installed channels of the detector \param nch number of channels to be written to file. if <=0 defaults to the number of installed channels of the detector
\returns OK or FAIL if it could not read the file or data=NULL \returns OK or FAIL if it could not read the file or data=NULL
\sa mythenDetector::readDataFile \sa mythenDetector::readDataFile
*/ */
int readDataFile(string fname, float *data, float *err=NULL, float *ang=NULL, char dataformat='f'); int readDataFile(string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f');
/** /**

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;
float *detectorDacs=NULL; double *detectorDacs=NULL;
float *detectorAdcs=NULL; double *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(float)); detectorDacs=malloc(n*NDAC*sizeof(double));
detectorAdcs=malloc(n*NADC*sizeof(float)); detectorAdcs=malloc(n*NADC*sizeof(double));
#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;
} }
float initDACbyIndex(int ind,float val, int imod) { double initDACbyIndex(int ind,double val, int imod) {
int v; int v;
const float partref[NDAC]=PARTREF; const double partref[NDAC]=PARTREF;
const float partr1[NDAC]=PARTR1; const double partr1[NDAC]=PARTR1;
const float partr2[NDAC]=PARTR2; const double partr2[NDAC]=PARTR2;
float ref=partref[ind]; double ref=partref[ind];
float r1=partr1[ind]; double r1=partr1[ind];
float r2=partr2[ind]; double 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 @@ float initDACbyIndex(int ind,float 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);
} }
float initDACbyIndexDACU(int ind, int val, int imod) { double initDACbyIndexDACU(int ind, int val, int imod) {
const float daccs[NDAC]=DACCS; const double daccs[NDAC]=DACCS;
const float dacaddr[NDAC]=DACADDR; const double dacaddr[NDAC]=DACADDR;
int cs=daccs[ind]; int cs=daccs[ind];
int addr=dacaddr[ind]; int addr=dacaddr[ind];
@ -706,9 +706,9 @@ float initDACbyIndexDACU(int ind, int val, int imod) {
} }
int getThresholdEnergy() { int getThresholdEnergy() {
float g[3]=DEFAULTGAIN; double g[3]=DEFAULTGAIN;
float o[3]=DEFAULTOFFSET; double o[3]=DEFAULTOFFSET;
float myg=-1, myo=-1; double 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) {
float g[3]=DEFAULTGAIN; double g[3]=DEFAULTGAIN;
float o[3]=DEFAULTOFFSET; double o[3]=DEFAULTOFFSET;
float myg=-1, myo=-1; double 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*((float)ethr)/1000.; dacu=myo-myg*((double)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) {
float getDACbyIndexDACU(int ind, int imod) { double getDACbyIndexDACU(int ind, int imod) {
/* /*
if (detectorDacs) { if (detectorDacs) {
if (imod<getNModBoard()) if (imod<getNModBoard())

View File

@ -100,9 +100,9 @@ int set_one_dac(int imod);
int initDAC(int dac_cs, int dac_addr, int value,int imod ); int initDAC(int dac_cs, int dac_addr, int value,int imod );
int initDACs(int* v,int imod ); int initDACs(int* v,int imod );
int setSettings(int i); int setSettings(int i);
float initDACbyIndex(int ind,float val, int imod); double initDACbyIndex(int ind,double val, int imod);
float initDACbyIndexDACU(int ind,int val, int imod); double initDACbyIndexDACU(int ind,int val, int imod);
float getDACbyIndexDACU(int ind, int imod); double getDACbyIndexDACU(int ind, int imod);
int getThresholdEnergy(); int getThresholdEnergy();
int setThresholdEnergy(int ethr); int setThresholdEnergy(int ethr);
/* Initialization*/ /* Initialization*/

View File

@ -842,13 +842,13 @@ int read_register(int file_des) {
int set_dac(int file_des) { int set_dac(int file_des) {
float retval; double retval;
int ret=OK; int ret=OK;
int arg[2]; int arg[2];
enum dacIndex ind; enum dacIndex ind;
int imod; int imod;
int n; int n;
float val; double val;
int idac=0; int idac=0;
sprintf(mess,"Can't set DAC\n"); sprintf(mess,"Can't set DAC\n");
@ -954,7 +954,7 @@ add possible potentiometers like in chiptest board!!!!!!!!!!!!!!!
int get_adc(int file_des) { int get_adc(int file_des) {
float retval; double retval;
int ret=OK; int ret=OK;
int arg[2]; int arg[2];
enum dacIndex ind; enum dacIndex ind;
@ -1312,8 +1312,8 @@ int set_module(int file_des) {
sls_detector_module myModule; sls_detector_module myModule;
int *myChip=malloc(NCHIP*sizeof(int)); int *myChip=malloc(NCHIP*sizeof(int));
int *myChan=malloc(NCHIP*NCHAN*sizeof(int)); int *myChan=malloc(NCHIP*NCHAN*sizeof(int));
float *myDac=malloc(NDAC*sizeof(int)); double *myDac=malloc(NDAC*sizeof(int));
float *myAdc=malloc(NADC*sizeof(int)); double *myAdc=malloc(NADC*sizeof(int));
int retval, n; int retval, n;
int ret=OK; int ret=OK;
int dr;//, ow; int dr;//, ow;
@ -1431,8 +1431,8 @@ int get_module(int file_des) {
sls_detector_module myModule; sls_detector_module myModule;
int *myChip=malloc(NCHIP*sizeof(int)); int *myChip=malloc(NCHIP*sizeof(int));
int *myChan=malloc(NCHIP*NCHAN*sizeof(int)); int *myChan=malloc(NCHIP*NCHAN*sizeof(int));
float *myDac=malloc(NDAC*sizeof(int)); double *myDac=malloc(NDAC*sizeof(int));
float *myAdc=malloc(NADC*sizeof(int)); double *myAdc=malloc(NADC*sizeof(int));
if (myDac) if (myDac)

View File

@ -168,11 +168,11 @@ int choose_vthresh_and_vtrim(int countlim, int nsigma, int im) {
int *fifodata; int *fifodata;
float vthreshmean, vthreshSTDev; double vthreshmean, vthreshSTDev;
int *thrmi, *thrma; int *thrmi, *thrma;
float c; double c;
float b=BVTRIM; double b=BVTRIM;
float a=AVTRIM; double a=AVTRIM;
int *trim; int *trim;
int ich, imod, ichan; int ich, imod, ichan;
int nvalid=0; int nvalid=0;
@ -447,7 +447,7 @@ int trim_with_level(int countlim, int im) {
int kth_smallest(int *a, int n, int k) int kth_smallest(int *a, int n, int k)
{ {
register int i,j,l,m ; register int i,j,l,m ;
register float x ; register double x ;
l=0 ; m=n-1 ; l=0 ; m=n-1 ;
while (l<m) { while (l<m) {
@ -474,7 +474,7 @@ int kth_smallest(int *a, int n, int k)
int median(int *a,int n) { int median(int *a,int n) {
int i=0, k=n/2; int i=0, k=n/2;
float k1=0.5*n; double k1=0.5*n;
//discard zeroes and 0xffffff //discard zeroes and 0xffffff
for (i=0; i<n; i++) { for (i=0; i<n; i++) {
@ -506,7 +506,7 @@ int ave(int *a, int n)
{ {
int av=0,i; int av=0,i;
for (i=0; i<n; i++) for (i=0; i<n; i++)
av=av+((float)*(a+i))/((float)n); av=av+((double)*(a+i))/((double)n);
return av; return av;
} }

View File

@ -59,7 +59,7 @@ int slsDetector::initSharedMemory(detectorType type, int id) {
*/ */
sz=sizeof(sharedSlsDetector)+nm*(2*nch*nc*sizeof(float)+sizeof(sls_detector_module)+sizeof(int)*nc+sizeof(float)*nd+sizeof(int)*nch*nc); sz=sizeof(sharedSlsDetector)+nm*(2*nch*nc*sizeof(double)+sizeof(sls_detector_module)+sizeof(int)*nc+sizeof(double)*nd+sizeof(int)*nch*nc);
#ifdef VERBOSE #ifdef VERBOSE
std::cout<<"Size of shared memory is "<< sz << "(type " << type << " - id " << mem_key << ")"<< std::endl; std::cout<<"Size of shared memory is "<< sz << "(type " << type << " - id " << mem_key << ")"<< std::endl;
#endif #endif
@ -595,11 +595,11 @@ int slsDetector::initializeDetectorSize(detectorType type) {
/** calculates the memory offsets for flat field coefficients and errors, module structures, dacs, adcs, chips and channels */ /** calculates the memory offsets for flat field coefficients and errors, module structures, dacs, adcs, chips and channels */
thisDetector->ffoff=sizeof(sharedSlsDetector); thisDetector->ffoff=sizeof(sharedSlsDetector);
thisDetector->fferroff=thisDetector->ffoff+sizeof(float)*thisDetector->nChans*thisDetector->nChips*thisDetector->nModsMax; thisDetector->fferroff=thisDetector->ffoff+sizeof(double)*thisDetector->nChans*thisDetector->nChips*thisDetector->nModsMax;
thisDetector->modoff= thisDetector->fferroff+sizeof(float)*thisDetector->nChans*thisDetector->nChips*thisDetector->nModsMax; thisDetector->modoff= thisDetector->fferroff+sizeof(double)*thisDetector->nChans*thisDetector->nChips*thisDetector->nModsMax;
thisDetector->dacoff=thisDetector->modoff+sizeof(sls_detector_module)*thisDetector->nModsMax; thisDetector->dacoff=thisDetector->modoff+sizeof(sls_detector_module)*thisDetector->nModsMax;
thisDetector->adcoff=thisDetector->dacoff+sizeof(float)*thisDetector->nDacs*thisDetector->nModsMax; thisDetector->adcoff=thisDetector->dacoff+sizeof(double)*thisDetector->nDacs*thisDetector->nModsMax;
thisDetector->chipoff=thisDetector->adcoff+sizeof(float)*thisDetector->nAdcs*thisDetector->nModsMax; thisDetector->chipoff=thisDetector->adcoff+sizeof(double)*thisDetector->nAdcs*thisDetector->nModsMax;
thisDetector->chanoff=thisDetector->chipoff+sizeof(int)*thisDetector->nChips*thisDetector->nModsMax; thisDetector->chanoff=thisDetector->chipoff+sizeof(int)*thisDetector->nChips*thisDetector->nModsMax;
@ -607,15 +607,15 @@ int slsDetector::initializeDetectorSize(detectorType type) {
/** also in case thisDetector alread existed initialize the pointer for flat field coefficients and errors, module structures, dacs, adcs, chips and channels */ /** also in case thisDetector alread existed initialize the pointer for flat field coefficients and errors, module structures, dacs, adcs, chips and channels */
ffcoefficients=(float*)(goff+thisDetector->ffoff); ffcoefficients=(double*)(goff+thisDetector->ffoff);
fferrors=(float*)(goff+thisDetector->fferroff); fferrors=(double*)(goff+thisDetector->fferroff);
detectorModules=(sls_detector_module*)(goff+ thisDetector->modoff); detectorModules=(sls_detector_module*)(goff+ thisDetector->modoff);
#ifdef VERBOSE #ifdef VERBOSE
// for (int imod=0; imod< thisDetector->nModsMax; imod++) // for (int imod=0; imod< thisDetector->nModsMax; imod++)
// std::cout<< hex << detectorModules+imod << dec <<std::endl; // std::cout<< hex << detectorModules+imod << dec <<std::endl;
#endif #endif
dacs=(float*)(goff+thisDetector->dacoff); dacs=(double*)(goff+thisDetector->dacoff);
adcs=(float*)(goff+thisDetector->adcoff); adcs=(double*)(goff+thisDetector->adcoff);
chipregs=(int*)(goff+thisDetector->chipoff); chipregs=(int*)(goff+thisDetector->chipoff);
chanregs=(int*)(goff+thisDetector->chanoff); chanregs=(int*)(goff+thisDetector->chanoff);
if (thisDetector->alreadyExisting==0) { if (thisDetector->alreadyExisting==0) {
@ -774,8 +774,8 @@ slsDetectorDefs::sls_detector_module* slsDetector::createModule(detectorType t)
na=0; na=0;
} }
float *dacs=new float[nd]; double *dacs=new double[nd];
float *adcs=new float[na]; double *adcs=new double[na];
int *chipregs=new int[nc]; int *chipregs=new int[nc];
int *chanregs=new int[nch*nc]; int *chanregs=new int[nch*nc];
myMod->ndac=nd; myMod->ndac=nd;
@ -824,8 +824,8 @@ int slsDetector::sendChip(sls_detector_chip *myChip) {
int slsDetector::sendModule(sls_detector_module *myMod) { int slsDetector::sendModule(sls_detector_module *myMod) {
int ts=0; int ts=0;
ts+=controlSocket->SendDataOnly(myMod,sizeof(sls_detector_module)); ts+=controlSocket->SendDataOnly(myMod,sizeof(sls_detector_module));
ts+=controlSocket->SendDataOnly(myMod->dacs,sizeof(float)*(myMod->ndac)); ts+=controlSocket->SendDataOnly(myMod->dacs,sizeof(double)*(myMod->ndac));
ts+=controlSocket->SendDataOnly(myMod->adcs,sizeof(float)*(myMod->nadc)); ts+=controlSocket->SendDataOnly(myMod->adcs,sizeof(double)*(myMod->nadc));
ts+=controlSocket->SendDataOnly(myMod->chipregs,sizeof(int)*(myMod->nchip)); ts+=controlSocket->SendDataOnly(myMod->chipregs,sizeof(int)*(myMod->nchip));
ts+=controlSocket->SendDataOnly(myMod->chanregs,sizeof(int)*(myMod->nchan)); ts+=controlSocket->SendDataOnly(myMod->chanregs,sizeof(int)*(myMod->nchan));
return ts; return ts;
@ -855,8 +855,8 @@ int slsDetector::receiveChip(sls_detector_chip* myChip) {
int slsDetector::receiveModule(sls_detector_module* myMod) { int slsDetector::receiveModule(sls_detector_module* myMod) {
float *dacptr=myMod->dacs; double *dacptr=myMod->dacs;
float *adcptr=myMod->adcs; double *adcptr=myMod->adcs;
int *chipptr=myMod->chipregs; int *chipptr=myMod->chipregs;
int *chanptr=myMod->chanregs; int *chanptr=myMod->chanregs;
int ts=0; int ts=0;
@ -869,11 +869,11 @@ int slsDetector::receiveModule(sls_detector_module* myMod) {
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< "received module " << myMod->module << " of size "<< ts << " register " << myMod->reg << std::endl; std::cout<< "received module " << myMod->module << " of size "<< ts << " register " << myMod->reg << std::endl;
#endif #endif
ts+=controlSocket->ReceiveDataOnly(myMod->dacs,sizeof(float)*(myMod->ndac)); ts+=controlSocket->ReceiveDataOnly(myMod->dacs,sizeof(double)*(myMod->ndac));
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< "received dacs " << myMod->module << " of size "<< ts << std::endl; std::cout<< "received dacs " << myMod->module << " of size "<< ts << std::endl;
#endif #endif
ts+=controlSocket->ReceiveDataOnly(myMod->adcs,sizeof(float)*(myMod->nadc)); ts+=controlSocket->ReceiveDataOnly(myMod->adcs,sizeof(double)*(myMod->nadc));
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< "received adcs " << myMod->module << " of size "<< ts << std::endl; std::cout<< "received adcs " << myMod->module << " of size "<< ts << std::endl;
#endif #endif
@ -1689,7 +1689,7 @@ int slsDetector::enableAnalogOutput(int imod, int ichip, int ichan){
give a train of calibration pulses give a train of calibration pulses
*/ */
/* /*
int slsDetector::giveCalibrationPulse(float vcal, int npulses){ int slsDetector::giveCalibrationPulse(double vcal, int npulses){
std::cout<< "function not yet implemented " << std::endl; std::cout<< "function not yet implemented " << std::endl;
}; };
*/ */
@ -1810,10 +1810,10 @@ int slsDetector::readRegister(int addr){
*/ */
float slsDetector::setDAC(float val, dacIndex index, int imod){ double slsDetector::setDAC(double val, dacIndex index, int imod){
float retval; double retval;
int fnum=F_SET_DAC; int fnum=F_SET_DAC;
int ret=FAIL; int ret=FAIL;
char mess[100]; char mess[100];
@ -1867,9 +1867,9 @@ float slsDetector::setDAC(float val, dacIndex index, int imod){
}; };
float slsDetector::getADC(dacIndex index, int imod){ double slsDetector::getADC(dacIndex index, int imod){
float retval; double retval;
int fnum=F_GET_ADC; int fnum=F_GET_ADC;
int ret=FAIL; int ret=FAIL;
char mess[100]; char mess[100];
@ -2271,7 +2271,7 @@ int slsDetector::setModule(int reg, int imod){
#endif #endif
int charegs[thisDetector->nChans*thisDetector->nChips]; int charegs[thisDetector->nChans*thisDetector->nChips];
int chiregs[thisDetector->nChips]; int chiregs[thisDetector->nChips];
float das[thisDetector->nDacs], ads[thisDetector->nAdcs]; double das[thisDetector->nDacs], ads[thisDetector->nAdcs];
int mmin=imod, mmax=imod+1; int mmin=imod, mmax=imod+1;
int ret=FAIL; int ret=FAIL;
@ -2439,7 +2439,7 @@ slsDetectorDefs::sls_detector_module *slsDetector::getModule(int imod){
// int chanreg[thisDetector->nChans*thisDetector->nChips]; // int chanreg[thisDetector->nChans*thisDetector->nChips];
//int chipreg[thisDetector->nChips]; //int chipreg[thisDetector->nChips];
//float dac[thisDetector->nDacs], adc[thisDetector->nAdcs]; //double dac[thisDetector->nDacs], adc[thisDetector->nAdcs];
int ret=FAIL; int ret=FAIL;
char mess[100]; char mess[100];
@ -2537,7 +2537,7 @@ slsDetectorDefs::sls_detector_module *slsDetector::getModule(int imod){
/* /*
really needed? really needed?
int slsDetector::setCalibration(int imod, detectorSettings isettings, float gain, float offset){ int slsDetector::setCalibration(int imod, detectorSettings isettings, double gain, double offset){
std::cout<< "function not yet implemented " << std::endl; std::cout<< "function not yet implemented " << std::endl;
@ -2545,7 +2545,7 @@ int slsDetector::setCalibration(int imod, detectorSettings isettings, float gai
return OK; return OK;
} }
int slsDetector::getCalibration(int imod, detectorSettings isettings, float &gain, float &offset){ int slsDetector::getCalibration(int imod, detectorSettings isettings, double &gain, double &offset){
std::cout<< "function not yet implemented " << std::endl; std::cout<< "function not yet implemented " << std::endl;
@ -2791,7 +2791,7 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
switch(thisDetector->myDetectorType==MYTHEN){ switch(thisDetector->myDetectorType==MYTHEN){
if (thisDetector->correctionMask&(1<<RATE_CORRECTION)) { if (thisDetector->correctionMask&(1<<RATE_CORRECTION)) {
int isett=getSettings(imod); int isett=getSettings(imod);
float t[]=defaultTDead; double t[]=defaultTDead;
if (isett>-1 && isett<3) { if (isett>-1 && isett<3) {
thisDetector->tDead=t[isett]; thisDetector->tDead=t[isett];
} }
@ -3586,9 +3586,9 @@ int slsDetector::setTotalProgress() {
} }
float slsDetector::getCurrentProgress() { double slsDetector::getCurrentProgress() {
return 100.*((float)thisDetector->progressIndex)/((float)thisDetector->totalProgress); return 100.*((double)thisDetector->progressIndex)/((double)thisDetector->totalProgress);
} }
@ -3886,13 +3886,13 @@ int slsDetector::executeTrimming(trimMode mode, int par1, int par2, int imod){
}; };
float* slsDetector::decodeData(int *datain, float *fdata) { double* slsDetector::decodeData(int *datain, double *fdata) {
float *dataout; double *dataout;
if (fdata) if (fdata)
dataout=fdata; dataout=fdata;
else else
dataout=new float[thisDetector->nChans*thisDetector->nChips*thisDetector->nMods]; dataout=new double[thisDetector->nChans*thisDetector->nChips*thisDetector->nMods];
const int bytesize=8; const int bytesize=8;
@ -3980,9 +3980,9 @@ float* slsDetector::decodeData(int *datain, float *fdata) {
int slsDetector::setFlatFieldCorrection(string fname) int slsDetector::setFlatFieldCorrection(string fname)
{ {
float data[thisDetector->nModMax[X]*thisDetector->nModMax[Y]*thisDetector->nChans*thisDetector->nChips]; double data[thisDetector->nModMax[X]*thisDetector->nModMax[Y]*thisDetector->nChans*thisDetector->nChips];
//float err[thisDetector->nModMax[X]*thisDetector->nModMax[Y]*thisDetector->nChans*thisDetector->nChips]; //double err[thisDetector->nModMax[X]*thisDetector->nModMax[Y]*thisDetector->nChans*thisDetector->nChips];
float xmed[thisDetector->nModMax[X]*thisDetector->nModMax[Y]*thisDetector->nChans*thisDetector->nChips]; double xmed[thisDetector->nModMax[X]*thisDetector->nModMax[Y]*thisDetector->nChans*thisDetector->nChips];
int nmed=0; int nmed=0;
int im=0; int im=0;
int nch; int nch;
@ -4069,7 +4069,7 @@ int slsDetector::setFlatFieldCorrection(string fname)
int slsDetector::setFlatFieldCorrection(float *corr, float *ecorr) { int slsDetector::setFlatFieldCorrection(double *corr, double *ecorr) {
if (corr!=NULL) { if (corr!=NULL) {
for (int ichan=0; ichan<thisDetector->nMod[X]*thisDetector->nChans*thisDetector->nChips; ichan++) { for (int ichan=0; ichan<thisDetector->nMod[X]*thisDetector->nChans*thisDetector->nChips; ichan++) {
// #ifdef VERBOSE // #ifdef VERBOSE
@ -4097,7 +4097,7 @@ int slsDetector::setFlatFieldCorrection(float *corr, float *ecorr) {
int slsDetector::getFlatFieldCorrection(float *corr, float *ecorr) { int slsDetector::getFlatFieldCorrection(double *corr, double *ecorr) {
if (thisDetector->correctionMask&(1<<FLAT_FIELD_CORRECTION)) { if (thisDetector->correctionMask&(1<<FLAT_FIELD_CORRECTION)) {
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< "Flat field correction is enabled" << std::endl; std::cout<< "Flat field correction is enabled" << std::endl;
@ -4127,11 +4127,11 @@ int slsDetector::getFlatFieldCorrection(float *corr, float *ecorr) {
} }
int slsDetector::flatFieldCorrect(float* datain, float *errin, float* dataout, float *errout){ int slsDetector::flatFieldCorrect(double* datain, double *errin, double* dataout, double *errout){
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< "Flat field correcting data" << std::endl; std::cout<< "Flat field correcting data" << std::endl;
#endif #endif
float e, eo; double e, eo;
if (thisDetector->correctionMask & (1<<FLAT_FIELD_CORRECTION)) { if (thisDetector->correctionMask & (1<<FLAT_FIELD_CORRECTION)) {
for (int ichan=0; ichan<thisDetector->nMod[X]*thisDetector->nChans*thisDetector->nChips; ichan++) { for (int ichan=0; ichan<thisDetector->nMod[X]*thisDetector->nChans*thisDetector->nChips; ichan++) {
if (errin==NULL) { if (errin==NULL) {
@ -4151,8 +4151,8 @@ int slsDetector::flatFieldCorrect(float* datain, float *errin, float* dataout, f
}; };
int slsDetector::setRateCorrection(float t){ int slsDetector::setRateCorrection(double t){
float tdead[]=defaultTDead; double tdead[]=defaultTDead;
if (t==0) { if (t==0) {
#ifdef VERBOSE #ifdef VERBOSE
@ -4177,7 +4177,7 @@ int slsDetector::setRateCorrection(float t){
} }
int slsDetector::getRateCorrection(float &t){ int slsDetector::getRateCorrection(double &t){
if (thisDetector->correctionMask&(1<<RATE_CORRECTION)) { if (thisDetector->correctionMask&(1<<RATE_CORRECTION)) {
#ifdef VERBOSE #ifdef VERBOSE
@ -4193,7 +4193,7 @@ int slsDetector::getRateCorrection(float &t){
return 0; return 0;
}; };
float slsDetector::getRateCorrectionTau(){ double slsDetector::getRateCorrectionTau(){
if (thisDetector->correctionMask&(1<<RATE_CORRECTION)) { if (thisDetector->correctionMask&(1<<RATE_CORRECTION)) {
#ifdef VERBOSE #ifdef VERBOSE
@ -4225,11 +4225,11 @@ int slsDetector::getRateCorrection(){
int slsDetector::rateCorrect(float* datain, float *errin, float* dataout, float *errout){ int slsDetector::rateCorrect(double* datain, double *errin, double* dataout, double *errout){
float tau=thisDetector->tDead; double tau=thisDetector->tDead;
float t=thisDetector->timerValue[ACQUISITION_TIME]; double t=thisDetector->timerValue[ACQUISITION_TIME];
// float data; // double data;
float e; double e;
if (thisDetector->correctionMask&(1<<RATE_CORRECTION)) { if (thisDetector->correctionMask&(1<<RATE_CORRECTION)) {
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< "Rate correcting data with dead time "<< tau << " and acquisition time "<< t << std::endl; std::cout<< "Rate correcting data with dead time "<< tau << " and acquisition time "<< t << std::endl;
@ -4599,9 +4599,9 @@ int slsDetector::getAngularConversion(int &direction, angleConversionConstant *
// float* slsDetector::convertAngles(float pos) { // double* slsDetector::convertAngles(double pos) {
// int imod; // int imod;
// float *ang=new float[thisDetector->nChans*thisDetector->nChips*thisDetector->nMods]; // double *ang=new double[thisDetector->nChans*thisDetector->nChips*thisDetector->nMods];
// for (int ip=0; ip<thisDetector->nChans*thisDetector->nChips*thisDetector->nMods; ip++) { // for (int ip=0; ip<thisDetector->nChans*thisDetector->nChips*thisDetector->nMods; ip++) {
// imod=ip/(thisDetector->nChans*thisDetector->nChips); // imod=ip/(thisDetector->nChans*thisDetector->nChips);
// ang[ip]=angle(ip%(thisDetector->nChans*thisDetector->nChips),\ // ang[ip]=angle(ip%(thisDetector->nChans*thisDetector->nChips),\

View File

@ -134,7 +134,7 @@ typedef struct sharedSlsDetector {
/** threaded processing flag (i.e. if data are processed and written to file in a separate thread) */ /** threaded processing flag (i.e. if data are processed and written to file in a separate thread) */
int threadedProcessing; int threadedProcessing;
/** dead time (in ns) for rate corrections */ /** dead time (in ns) for rate corrections */
float tDead; double tDead;
/** directory where the flat field files are stored */ /** directory where the flat field files are stored */
char flatFieldDir[MAX_STR_LENGTH]; char flatFieldDir[MAX_STR_LENGTH];
/** file used for flat field corrections */ /** file used for flat field corrections */
@ -157,15 +157,15 @@ typedef struct sharedSlsDetector {
/** angular direction (1 if it corresponds to the encoder direction i.e. channel 0 is 0, maxchan is positive high angle, 0 otherwise */ /** angular direction (1 if it corresponds to the encoder direction i.e. channel 0 is 0, maxchan is positive high angle, 0 otherwise */
int angDirection; int angDirection;
/** beamline fine offset (of the order of mdeg, might be adjusted for each measurements) */ /** beamline fine offset (of the order of mdeg, might be adjusted for each measurements) */
float fineOffset; double fineOffset;
/** beamline offset (might be a few degrees beacuse of encoder offset - normally it is kept fixed for a long period of time) */ /** beamline offset (might be a few degrees beacuse of encoder offset - normally it is kept fixed for a long period of time) */
float globalOffset; double globalOffset;
/** number of positions at which the detector should acquire */ /** number of positions at which the detector should acquire */
int numberOfPositions; int numberOfPositions;
/** list of encoder positions at which the detector should acquire */ /** list of encoder positions at which the detector should acquire */
float detPositions[MAXPOS]; double detPositions[MAXPOS];
/** bin size for data merging */ /** bin size for data merging */
float binSize; double binSize;
/** add encoder value flag (i.e. wether the detector is moving - 1 - or stationary - 0) */ /** add encoder value flag (i.e. wether the detector is moving - 1 - or stationary - 0) */
int moveFlag; int moveFlag;
@ -698,7 +698,7 @@ typedef struct sharedSlsDetector {
not yet implemented not yet implemented
*/ */
int giveCalibrationPulse(float vcal, int npulses); int giveCalibrationPulse(double vcal, int npulses);
// Expert Initialization functions // Expert Initialization functions
@ -727,7 +727,7 @@ typedef struct sharedSlsDetector {
\param imod module number (if -1 alla modules) \param imod module number (if -1 alla modules)
\returns current DAC value \returns current DAC value
*/ */
float setDAC(float val, dacIndex index, int imod=-1); double setDAC(double val, dacIndex index, int imod=-1);
/** /**
set dacs value set dacs value
@ -735,7 +735,7 @@ typedef struct sharedSlsDetector {
\param imod module number \param imod module number
\returns current ADC value \returns current ADC value
*/ */
float getADC(dacIndex index, int imod=0); double getADC(dacIndex index, int imod=0);
/** /**
configure channel configure channel
@ -822,8 +822,8 @@ typedef struct sharedSlsDetector {
//virtual sls_detector_module *getModule(int imod); //virtual sls_detector_module *getModule(int imod);
// calibration functions // calibration functions
// int setCalibration(int imod, detectorSettings isettings, float gain, float offset); // int setCalibration(int imod, detectorSettings isettings, double gain, double offset);
//int getCalibration(int imod, detectorSettings isettings, float &gain, float &offset); //int getCalibration(int imod, detectorSettings isettings, double &gain, double &offset);
/* /*
@ -1044,7 +1044,7 @@ typedef struct sharedSlsDetector {
\param ecorr if !=NULL the flat field correction errors will be filled with ecorr (1 otherwise) \param ecorr if !=NULL the flat field correction errors will be filled with ecorr (1 otherwise)
\returns 0 if ff correction disabled, >0 otherwise \returns 0 if ff correction disabled, >0 otherwise
*/ */
int setFlatFieldCorrection(float *corr, float *ecorr=NULL); int setFlatFieldCorrection(double *corr, double *ecorr=NULL);
/** /**
@ -1053,7 +1053,7 @@ typedef struct sharedSlsDetector {
\param ecorr if !=NULL will be filled with the correction coefficients errors \param ecorr if !=NULL will be filled with the correction coefficients errors
\returns 0 if ff correction disabled, >0 otherwise \returns 0 if ff correction disabled, >0 otherwise
*/ */
int getFlatFieldCorrection(float *corr=NULL, float *ecorr=NULL); int getFlatFieldCorrection(double *corr=NULL, double *ecorr=NULL);
/** /**
@ -1061,7 +1061,7 @@ typedef struct sharedSlsDetector {
\param t dead time in ns - if 0 disable correction, if >0 set dead time to t, if <0 set deadtime to default dead time for current settings \param t dead time in ns - if 0 disable correction, if >0 set dead time to t, if <0 set deadtime to default dead time for current settings
\returns 0 if rate correction disabled, >0 otherwise \returns 0 if rate correction disabled, >0 otherwise
*/ */
int setRateCorrection(float t=0); int setRateCorrection(double t=0);
/** /**
@ -1069,14 +1069,14 @@ typedef struct sharedSlsDetector {
\param t reference for dead time \param t reference for dead time
\returns 0 if rate correction disabled, >0 otherwise \returns 0 if rate correction disabled, >0 otherwise
*/ */
int getRateCorrection(float &t); int getRateCorrection(double &t);
/** /**
get rate correction tau get rate correction tau
\returns 0 if rate correction disabled, otherwise the tau used for the correction \returns 0 if rate correction disabled, otherwise the tau used for the correction
*/ */
float getRateCorrectionTau(); double getRateCorrectionTau();
/** /**
get rate correction get rate correction
\returns 0 if rate correction disabled, >0 otherwise \returns 0 if rate correction disabled, >0 otherwise
@ -1122,11 +1122,11 @@ typedef struct sharedSlsDetector {
/** /**
decode data from the detector converting them to an array of floats, one for each channle decode data from the detector converting them to an array of doubles, one for each channle
\param datain data from the detector \param datain data from the detector
\returns pointer to a float array with a data per channel \returns pointer to a double array with a data per channel
*/ */
float* decodeData(int *datain, float *fdata=NULL); double* decodeData(int *datain, double *fdata=NULL);
@ -1140,7 +1140,7 @@ typedef struct sharedSlsDetector {
\param errout error on corrected data (if not NULL) \param errout error on corrected data (if not NULL)
\returns 0 \returns 0
*/ */
int flatFieldCorrect(float* datain, float *errin, float* dataout, float *errout); int flatFieldCorrect(double* datain, double *errin, double* dataout, double *errout);
@ -1153,7 +1153,7 @@ typedef struct sharedSlsDetector {
\param errout error on corrected data (if not NULL) \param errout error on corrected data (if not NULL)
\returns 0 \returns 0
*/ */
int rateCorrect(float* datain, float *errin, float* dataout, float *errout); int rateCorrect(double* datain, double *errin, double* dataout, double *errout);
/* /\** */ /* /\** */
@ -1167,7 +1167,7 @@ typedef struct sharedSlsDetector {
/* \sa mythenDetector::resetMerging */ /* \sa mythenDetector::resetMerging */
/* *\/ */ /* *\/ */
/* int resetMerging(float *mp, float *mv,float *me, int *mm); */ /* int resetMerging(double *mp, double *mv,double *me, int *mm); */
/* /\** */ /* /\** */
/* pure virtual function */ /* pure virtual function */
@ -1181,7 +1181,7 @@ typedef struct sharedSlsDetector {
/* \param mm multiplicity of merged arrays */ /* \param mm multiplicity of merged arrays */
/* \sa mythenDetector::addToMerging */ /* \sa mythenDetector::addToMerging */
/* *\/ */ /* *\/ */
/* int addToMerging(float *p1, float *v1, float *e1, float *mp, float *mv,float *me, int *mm); */ /* int addToMerging(double *p1, double *v1, double *e1, double *mp, double *mv,double *me, int *mm); */
/* /\** pure virtual function */ /* /\** pure virtual function */
/* calculates the "final" positions, data value and errors for the emrged data */ /* calculates the "final" positions, data value and errors for the emrged data */
@ -1192,7 +1192,7 @@ typedef struct sharedSlsDetector {
/* \returns FAIL or the number of non empty bins (i.e. points belonging to the pattern) */ /* \returns FAIL or the number of non empty bins (i.e. points belonging to the pattern) */
/* \sa mythenDetector::finalizeMerging */ /* \sa mythenDetector::finalizeMerging */
/* *\/ */ /* *\/ */
/* int finalizeMerging(float *mp, float *mv,float *me, int *mm); */ /* int finalizeMerging(double *mp, double *mv,double *me, int *mm); */
/** /**
turns off server turns off server
@ -1227,10 +1227,10 @@ typedef struct sharedSlsDetector {
int setTotalProgress(); int setTotalProgress();
/** returns the current progress in % */ /** returns the current progress in % */
float getCurrentProgress(); double getCurrentProgress();
// float* convertAngles(float pos); // double* convertAngles(double pos);
@ -1366,17 +1366,17 @@ typedef struct sharedSlsDetector {
/** pointer to flat field coefficients */ /** pointer to flat field coefficients */
float *ffcoefficients; double *ffcoefficients;
/** pointer to flat field coefficient errors */ /** pointer to flat field coefficient errors */
float *fferrors; double *fferrors;
/** pointer to detector module structures */ /** pointer to detector module structures */
sls_detector_module *detectorModules; sls_detector_module *detectorModules;
/** pointer to dac valuse */ /** pointer to dac valuse */
float *dacs; double *dacs;
/** pointer to adc valuse */ /** pointer to adc valuse */
float *adcs; double *adcs;
/** pointer to chip registers */ /** pointer to chip registers */
int *chipregs; int *chipregs;
/** pointer to channal registers */ /** pointer to channal registers */

View File

@ -142,7 +142,7 @@ int slsDetectorActions::getActionMode(int iaction){
\param fname for script ("" disable) \param fname for script ("" disable)
\returns 0 if scan disabled, >0 otherwise \returns 0 if scan disabled, >0 otherwise
*/ */
int slsDetectorActions::setScan(int iscan, string script, int nvalues, float *values, string par, int precision) { int slsDetectorActions::setScan(int iscan, string script, int nvalues, double *values, string par, int precision) {
if (iscan>=0 && iscan<MAX_SCAN_LEVELS) { if (iscan>=0 && iscan<MAX_SCAN_LEVELS) {
if (script=="") { if (script=="") {
@ -274,7 +274,7 @@ int slsDetectorActions::setScanPrecision(int iscan, int precision) {
} }
int slsDetectorActions::setScanSteps(int iscan, int nvalues, float *values) { int slsDetectorActions::setScanSteps(int iscan, int nvalues, double *values) {
if (iscan>=0 && iscan<MAX_SCAN_LEVELS) { if (iscan>=0 && iscan<MAX_SCAN_LEVELS) {
@ -372,7 +372,7 @@ int slsDetectorActions::getScanMode(int iscan){
\param v is the pointer to the scan steps \param v is the pointer to the scan steps
\returns scan steps \returns scan steps
*/ */
int slsDetectorActions::getScanSteps(int iscan, float *v) { int slsDetectorActions::getScanSteps(int iscan, double *v) {
if (iscan>=0 && iscan<MAX_SCAN_LEVELS) { if (iscan>=0 && iscan<MAX_SCAN_LEVELS) {
if (v) { if (v) {
@ -463,7 +463,7 @@ int slsDetectorActions::executeAction(int level) {
// getActionScript(level).c_str(), \ // getActionScript(level).c_str(), \
// getFileIndexFromFileName(currentFileName), \ // getFileIndexFromFileName(currentFileName), \
// currentFileName.c_str(), \ // currentFileName.c_str(), \
// ((float)timerValue[ACQUISITION_TIME])*1E-9, \ // ((double)timerValue[ACQUISITION_TIME])*1E-9, \
// *currentSettings, \ // *currentSettings, \
// *currentThresholdEV, \ // *currentThresholdEV, \
// getBadChannelCorrectionFile().c_str(), \ // getBadChannelCorrectionFile().c_str(), \

View File

@ -89,7 +89,7 @@ class slsDetectorActions : public virtual slsDetectorBase
\param precision to write the scan varaible in the scan name (-1 unchanged) \param precision to write the scan varaible in the scan name (-1 unchanged)
\returns 0 is scan disabled, >0 otherwise \returns 0 is scan disabled, >0 otherwise
*/ */
int setScan(int index, string script="", int nvalues=-1, float *values=NULL, string par="", int precision=-1); int setScan(int index, string script="", int nvalues=-1, double *values=NULL, string par="", int precision=-1);
/** set scan script /** set scan script
\param index of the scan (0,1) \param index of the scan (0,1)
@ -117,14 +117,14 @@ class slsDetectorActions : public virtual slsDetectorBase
\param values pointer to array of values \param values pointer to array of values
\returns 0 is scan disabled, >0 otherwise \returns 0 is scan disabled, >0 otherwise
*/ */
int setScanSteps(int index, int nvalues=-1, float *values=NULL); int setScanSteps(int index, int nvalues=-1, double *values=NULL);
/** get scan step /** get scan step
\param index of the scan (0,1) \param index of the scan (0,1)
\param istep step number \param istep step number
\returns value of the scan variable \returns value of the scan variable
*/ */
float getScanStep(int index, int istep){if (index<MAX_SCAN_LEVELS && index>=0 && istep>=0 && istep<MAX_SCAN_STEPS) return scanSteps[index][istep]; else return -1;}; double getScanStep(int index, int istep){if (index<MAX_SCAN_LEVELS && index>=0 && istep>=0 && istep<MAX_SCAN_STEPS) return scanSteps[index][istep]; else return -1;};
/** /**
returns scan script returns scan script
\param iscan can be (0,1) \param iscan can be (0,1)
@ -152,7 +152,7 @@ class slsDetectorActions : public virtual slsDetectorBase
\param v is the pointer to the scan steps \param v is the pointer to the scan steps
\returns number of scan steps \returns number of scan steps
*/ */
int getScanSteps(int iscan, float *v=NULL); int getScanSteps(int iscan, double *v=NULL);
/** /**
@ -178,7 +178,7 @@ class slsDetectorActions : public virtual slsDetectorBase
\param index scan level index \param index scan level index
\returns value of the current scan variable \returns value of the current scan variable
*/ */
float getCurrentScanVariable(int index) {return currentScanVariable[index];}; double getCurrentScanVariable(int index) {return currentScanVariable[index];};
// int getScanPrecision(int index) {return scanPrecision[index];}; // int getScanPrecision(int index) {return scanPrecision[index];};
@ -191,7 +191,7 @@ class slsDetectorActions : public virtual slsDetectorBase
\param imod module number (if -1 alla modules) \param imod module number (if -1 alla modules)
\returns current DAC value \returns current DAC value
*/ */
virtual float setDAC(float val, dacIndex index , int imod=-1)=0; virtual double setDAC(double val, dacIndex index , int imod=-1)=0;
virtual int setThresholdEnergy(int, int im=-1, detectorSettings isettings=GET_SETTINGS)=0; virtual int setThresholdEnergy(int, int im=-1, detectorSettings isettings=GET_SETTINGS)=0;
@ -241,7 +241,7 @@ class slsDetectorActions : public virtual slsDetectorBase
/** /**
current scan variable of the detector current scan variable of the detector
*/ */
float currentScanVariable[MAX_SCAN_LEVELS]; double currentScanVariable[MAX_SCAN_LEVELS];
/** /**
current scan variable index of the detector current scan variable index of the detector

View File

@ -154,7 +154,7 @@ class slsDetectorBase : public virtual slsDetectorUsers , public virtual slsDet
\param values array of steps \param values array of steps
\returns 0 if scan disabled, >0 otherwise*/ \returns 0 if scan disabled, >0 otherwise*/
virtual int setScanSteps(int index, int nvalues=-1, float *values=NULL)=0; virtual int setScanSteps(int index, int nvalues=-1, double *values=NULL)=0;
/** /**
get scan script get scan script
@ -183,7 +183,7 @@ class slsDetectorBase : public virtual slsDetectorUsers , public virtual slsDet
\param values pointer to array of values (must be allocated in advance) \param values pointer to array of values (must be allocated in advance)
\returns number of steps \returns number of steps
*/ */
virtual int getScanSteps(int index, float *values=NULL)=0; virtual int getScanSteps(int index, double *values=NULL)=0;
/** /**
@ -215,7 +215,7 @@ class slsDetectorBase : public virtual slsDetectorUsers , public virtual slsDet
\param index scan level index \param index scan level index
\returns current scan variable \returns current scan variable
*/ */
virtual float getCurrentScanVariable(int index)=0;// {return 0;}; virtual double getCurrentScanVariable(int index)=0;// {return 0;};
/** /**
\returns current position index \returns current position index
@ -237,12 +237,12 @@ class slsDetectorBase : public virtual slsDetectorUsers , public virtual slsDet
virtual void incrementProgress()=0; virtual void incrementProgress()=0;
virtual float getCurrentProgress()=0; virtual double getCurrentProgress()=0;
virtual void incrementFileIndex()=0; virtual void incrementFileIndex()=0;
virtual int setTotalProgress()=0; virtual int setTotalProgress()=0;
virtual float* decodeData(int *datain, float *fdata=NULL)=0; virtual double* decodeData(int *datain, double *fdata=NULL)=0;
virtual string getCurrentFileName()=0; virtual string getCurrentFileName()=0;
@ -251,20 +251,20 @@ class slsDetectorBase : public virtual slsDetectorUsers , public virtual slsDet
virtual int getFileIndexFromFileName(string fname)=0; virtual int getFileIndexFromFileName(string fname)=0;
virtual float *convertAngles()=0; virtual double *convertAngles()=0;
/** /**
set rate correction set rate correction
\param t dead time in ns - if 0 disable correction, if >0 set dead time to t, if <0 set deadtime to default dead time for current settings \param t dead time in ns - if 0 disable correction, if >0 set dead time to t, if <0 set deadtime to default dead time for current settings
\returns 0 if rate correction disabled, >0 otherwise \returns 0 if rate correction disabled, >0 otherwise
*/ */
virtual int setRateCorrection(float t=0)=0; virtual int setRateCorrection(double t=0)=0;
/** /**
get rate correction get rate correction
\param t reference for dead time \param t reference for dead time
\returns 0 if rate correction disabled, >0 otherwise \returns 0 if rate correction disabled, >0 otherwise
*/ */
virtual int getRateCorrection(float &t)=0; virtual int getRateCorrection(double &t)=0;
/** /**
get rate correction get rate correction
@ -578,9 +578,11 @@ int64_t setNumberOfCycles(int64_t t=-1){return setTimer(CYCLES_NUMBER,t);};
switch(f) { \ switch(f) { \
case AUTO_TIMING: return string( "auto"); \ case AUTO_TIMING: return string( "auto"); \
case TRIGGER_EXPOSURE: return string("trigger"); \ case TRIGGER_EXPOSURE: return string("trigger"); \
case TRIGGER_FRAME: return string("trigger_frame"); \
case TRIGGER_READOUT: return string("ro_trigger"); \ case TRIGGER_READOUT: return string("ro_trigger"); \
case GATE_FIX_NUMBER: return string("gating"); \ case GATE_FIX_NUMBER: return string("gating"); \
case GATE_WITH_START_TRIGGER: return string("triggered_gating"); \ case GATE_WITH_START_TRIGGER: return string("triggered_gating"); \
case TRIGGER_WINDOW: return string("trigger_window"); \
default: return string( "unknown"); \ default: return string( "unknown"); \
} }; } };
@ -595,9 +597,11 @@ int64_t setNumberOfCycles(int64_t t=-1){return setTimer(CYCLES_NUMBER,t);};
static externalCommunicationMode externalCommunicationType(string sval){\ static externalCommunicationMode externalCommunicationType(string sval){\
if (sval=="auto") return AUTO_TIMING;\ if (sval=="auto") return AUTO_TIMING;\
if (sval=="trigger") return TRIGGER_EXPOSURE; \ if (sval=="trigger") return TRIGGER_EXPOSURE; \
if (sval=="trigger_frame") return TRIGGER_FRAME; \
if (sval=="ro_trigger") return TRIGGER_READOUT;\ if (sval=="ro_trigger") return TRIGGER_READOUT;\
if (sval=="gating") return GATE_FIX_NUMBER;\ if (sval=="gating") return GATE_FIX_NUMBER;\
if (sval=="triggered_gating") return GATE_WITH_START_TRIGGER;\ if (sval=="triggered_gating") return GATE_WITH_START_TRIGGER;\
if (sval=="trigger_window") return TRIGGER_WINDOW; \
return GET_EXTERNAL_COMMUNICATION_MODE; \ return GET_EXTERNAL_COMMUNICATION_MODE; \
}; };

View File

@ -1385,7 +1385,7 @@ string slsDetectorCommand::cmdFlatField(int narg, char *args[], int action){
sval=string(args[1]); sval=string(args[1]);
else else
sval="none"; sval="none";
float corr[24*1280], ecorr[24*1280]; double corr[24*1280], ecorr[24*1280];
if (myDet->getFlatFieldCorrection(corr,ecorr)) { if (myDet->getFlatFieldCorrection(corr,ecorr)) {
if (sval!="none") { if (sval!="none") {
myDet->writeDataFile(sval,corr,ecorr,NULL,'i'); myDet->writeDataFile(sval,corr,ecorr,NULL,'i');
@ -1438,14 +1438,14 @@ string slsDetectorCommand::cmdRateCorr(int narg, char *args[], int action){
if (action==HELP_ACTION) { if (action==HELP_ACTION) {
return helpRateCorr(narg, args, action); return helpRateCorr(narg, args, action);
} }
float fval; double fval;
char answer[1000]; char answer[1000];
if (action==PUT_ACTION) { if (action==PUT_ACTION) {
sscanf(args[1],"%f",&fval); sscanf(args[1],"%f",&fval);
myDet->setRateCorrection(fval); myDet->setRateCorrection(fval);
} }
float t; double t;
if (myDet->getRateCorrection(t)) { if (myDet->getRateCorrection(t)) {
sprintf(answer,"%f",t); sprintf(answer,"%f",t);
} else { } else {
@ -1525,7 +1525,7 @@ string slsDetectorCommand::cmdAngConv(int narg, char *args[], int action){
} }
string sval; string sval;
char answer[1000]; char answer[1000];
float fval; double fval;
angleConversionParameter c; angleConversionParameter c;
if (string(args[0])==string("angconv")) { if (string(args[0])==string("angconv")) {
@ -1767,7 +1767,7 @@ string slsDetectorCommand::cmdPositions(int narg, char *args[], int action){
if (action==PUT_ACTION) { if (action==PUT_ACTION) {
if (sscanf(args[1],"%d",&ival)) { if (sscanf(args[1],"%d",&ival)) {
float pos[ival]; double pos[ival];
for (ip=0; ip<ival;ip++) { for (ip=0; ip<ival;ip++) {
if ((2+ip)<narg) { if ((2+ip)<narg) {
if (sscanf(args[2+ip],"%f",pos+ip)) { if (sscanf(args[2+ip],"%f",pos+ip)) {
@ -1783,7 +1783,7 @@ string slsDetectorCommand::cmdPositions(int narg, char *args[], int action){
} }
int npos=myDet->getPositions(); int npos=myDet->getPositions();
sprintf(answer,"%d",npos); sprintf(answer,"%d",npos);
float opos[npos]; double opos[npos];
myDet->getPositions(opos); myDet->getPositions(opos);
for (int ip=0; ip<npos;ip++) { for (int ip=0; ip<npos;ip++) {
sprintf(answer,"%s %f",answer,opos[ip]); sprintf(answer,"%s %f",answer,opos[ip]);
@ -1855,7 +1855,7 @@ string slsDetectorCommand::cmdScans(int narg, char *args[], int action) {
int is=-1, ival, ns=0; int is=-1, ival, ns=0;
char answer[MAX_SCAN_STEPS*10]; char answer[MAX_SCAN_STEPS*10];
float *values; double *values;
if (action==HELP_ACTION) if (action==HELP_ACTION)
return helpScans(narg,args,action); return helpScans(narg,args,action);
@ -1894,7 +1894,7 @@ string slsDetectorCommand::cmdScans(int narg, char *args[], int action) {
if (ival>MAX_SCAN_STEPS) if (ival>MAX_SCAN_STEPS)
return string("too many steps required!"); return string("too many steps required!");
values=new float[ival]; values=new double[ival];
for (int i=0; i<ival; i++) { for (int i=0; i<ival; i++) {
if (narg>=(i+2)) { if (narg>=(i+2)) {
if (sscanf(args[i+2],"%f",values+i)) if (sscanf(args[i+2],"%f",values+i))
@ -1911,7 +1911,7 @@ string slsDetectorCommand::cmdScans(int narg, char *args[], int action) {
} }
} }
ns=myDet->getScanSteps(is); ns=myDet->getScanSteps(is);
values=new float[ns]; values=new double[ns];
ns=myDet->getScanSteps(is, values); ns=myDet->getScanSteps(is, values);
int p=myDet->getScanPrecision(is); int p=myDet->getScanPrecision(is);
char format[1000]; char format[1000];
@ -1927,7 +1927,7 @@ string slsDetectorCommand::cmdScans(int narg, char *args[], int action) {
if (action==PUT_ACTION) { if (action==PUT_ACTION) {
float fmin, fmax, fstep; double fmin, fmax, fstep;
if (narg<4) if (narg<4)
return string("wrong number of arguments ")+helpScans(narg,args,action); return string("wrong number of arguments ")+helpScans(narg,args,action);
@ -1969,7 +1969,7 @@ string slsDetectorCommand::cmdScans(int narg, char *args[], int action) {
fstep=-1*fstep; fstep=-1*fstep;
values=new float[ns]; values=new double[ns];
for (int i=0; i<ns; i++) { for (int i=0; i<ns; i++) {
values[i]=fmin+i*fstep; values[i]=fmin+i*fstep;
} }
@ -1978,7 +1978,7 @@ string slsDetectorCommand::cmdScans(int narg, char *args[], int action) {
} }
ns=myDet->getScanSteps(is); ns=myDet->getScanSteps(is);
values=new float[ns]; values=new double[ns];
ns=myDet->getScanSteps(is, values); ns=myDet->getScanSteps(is, values);
int p=myDet->getScanPrecision(is); int p=myDet->getScanPrecision(is);
char format[1000]; char format[1000];
@ -2638,7 +2638,7 @@ string slsDetectorCommand::cmdDAC(int narg, char *args[], int action) {
return helpDAC(narg, args, action); return helpDAC(narg, args, action);
dacIndex dac; dacIndex dac;
float val=-1; double val=-1;
char answer[1000]; char answer[1000];
if (cmd=="vthreshold") if (cmd=="vthreshold")
@ -2788,7 +2788,7 @@ string slsDetectorCommand::helpDAC(int narg, char *args[], int action) {
string slsDetectorCommand::cmdADC(int narg, char *args[], int action) { string slsDetectorCommand::cmdADC(int narg, char *args[], int action) {
dacIndex adc; dacIndex adc;
// float val=-1; // double val=-1;
char answer[1000]; char answer[1000];
if (action==HELP_ACTION) if (action==HELP_ACTION)
@ -2855,7 +2855,7 @@ string slsDetectorCommand::helpTiming(int narg, char *args[], int action){
string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) { string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) {
timerIndex index; timerIndex index;
int64_t t=-1, ret; int64_t t=-1, ret;
float val, rval; double val, rval;
char answer[1000]; char answer[1000];
@ -2896,7 +2896,7 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) {
ret=myDet->setTimer(index,t); ret=myDet->setTimer(index,t);
if (index==ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER) if (index==ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER)
rval=(float)ret*1E-9; rval=(double)ret*1E-9;
else rval=ret; else rval=ret;
@ -2949,7 +2949,7 @@ string slsDetectorCommand::helpTimer(int narg, char *args[], int action) {
string slsDetectorCommand::cmdTimeLeft(int narg, char *args[], int action) { string slsDetectorCommand::cmdTimeLeft(int narg, char *args[], int action) {
timerIndex index; timerIndex index;
int64_t ret; int64_t ret;
float rval; double rval;
char answer[1000]; char answer[1000];
@ -2991,7 +2991,7 @@ string slsDetectorCommand::cmdTimeLeft(int narg, char *args[], int action) {
ret=myDet->getTimeLeft(index); ret=myDet->getTimeLeft(index);
if (index==ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER || index==ACTUAL_TIME || index==MEASUREMENT_TIME) if (index==ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER || index==ACTUAL_TIME || index==MEASUREMENT_TIME)
rval=(float)ret*1E-9; rval=(double)ret*1E-9;
else rval=ret; else rval=ret;

View File

@ -182,14 +182,14 @@ class slsDetectorUsers
\param pos array with the encoder positions \param pos array with the encoder positions
\returns number of positions \returns number of positions
*/ */
virtual int setPositions(int nPos, float *pos)=0; virtual int setPositions(int nPos, double *pos)=0;
/** /**
@short get positions for the acquisition @short get positions for the acquisition
\param pos array which will contain the encoder positions \param pos array which will contain the encoder positions
\returns number of positions \returns number of positions
*/ */
virtual int getPositions(float *pos=NULL)=0; virtual int getPositions(double *pos=NULL)=0;
/** /**
@short sets the detector size @short sets the detector size
@ -358,7 +358,7 @@ class slsDetectorUsers
\param func function for reading the detector position \param func function for reading the detector position
*/ */
virtual void registerGetPositionCallback( float (*func)(void*),void *arg)=0; virtual void registerGetPositionCallback( double (*func)(void*),void *arg)=0;
/** /**
@short register callback for connecting to the epics channels @short register callback for connecting to the epics channels
\param func function for connecting to the epics channels \param func function for connecting to the epics channels
@ -373,17 +373,17 @@ class slsDetectorUsers
@short register callback for moving the detector @short register callback for moving the detector
\param func function for moving the detector \param func function for moving the detector
*/ */
virtual void registerGoToPositionCallback( int (*func)(float,void*),void *arg)=0; virtual void registerGoToPositionCallback( int (*func)(double,void*),void *arg)=0;
/** /**
@short register callback for moving the detector without waiting @short register callback for moving the detector without waiting
\param func function for moving the detector \param func function for moving the detector
*/ */
virtual void registerGoToPositionNoWaitCallback( int (*func)(float,void*),void *arg)=0; virtual void registerGoToPositionNoWaitCallback( int (*func)(double,void*),void *arg)=0;
/** /**
@short register calbback reading to I0 @short register calbback reading to I0
\param func function for reading the I0 (called with parameter 0 before the acquisition, 1 after and the return value used as I0) \param func function for reading the I0 (called with parameter 0 before the acquisition, 1 after and the return value used as I0)
*/ */
virtual void registerGetI0Callback( float (*func)(int,void*),void *arg)=0; virtual void registerGetI0Callback( double (*func)(int,void*),void *arg)=0;
/************************************************************************ /************************************************************************

View File

@ -398,11 +398,11 @@ int slsDetectorUtils::setBadChannelCorrection(string fname, int &nbadtot, int *b
float slsDetectorUtils::getCurrentProgress() { double slsDetectorUtils::getCurrentProgress() {
#ifdef VERBOSE #ifdef VERBOSE
cout << progressIndex << " / " << totalProgress << endl; cout << progressIndex << " / " << totalProgress << endl;
#endif #endif
return 100.*((float)progressIndex)/((float)totalProgress); return 100.*((double)progressIndex)/((double)totalProgress);
} }
@ -710,7 +710,7 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
outfile << names[iv] << " " << cmd->executeLine(nargs,args,GET_ACTION) << std::endl; outfile << names[iv] << " " << cmd->executeLine(nargs,args,GET_ACTION) << std::endl;
iv++; iv++;
if (level==2) { if (level==2) {
strcpy(myargs[0],names[iv].c_str()); strcpy(myargs[0],names[iv].c_str());
@ -754,8 +754,8 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
// float data[tch], xmed[tch]; // double data[tch], xmed[tch];
// float ffcoefficients[tch], fferrors[tch]; // double ffcoefficients[tch], fferrors[tch];
// int nmed=0; // int nmed=0;
// int idet=0, ichdet=-1; // int idet=0, ichdet=-1;
// char ffffname[MAX_STR_LENGTH*2]; // char ffffname[MAX_STR_LENGTH*2];

View File

@ -64,9 +64,9 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
//int setPositions(int nPos, float *pos){return angularConversion::setPositions(nPos, pos);}; //int setPositions(int nPos, double *pos){return angularConversion::setPositions(nPos, pos);};
// int getPositions(float *pos=NULL){return angularConversion::getPositions(pos);}; // int getPositions(double *pos=NULL){return angularConversion::getPositions(pos);};
using slsDetectorBase::setFlatFieldCorrection; using slsDetectorBase::setFlatFieldCorrection;
using postProcessing::setBadChannelCorrection; using postProcessing::setBadChannelCorrection;
@ -87,7 +87,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
// int getScanPrecision(int i){return slsDetectorActions::getScanPrecision(i);}; // int getScanPrecision(int i){return slsDetectorActions::getScanPrecision(i);};
// int getActionMask() {return slsDetectorActions::getActionMask();}; // int getActionMask() {return slsDetectorActions::getActionMask();};
// float getCurrentScanVariable(int i) {return slsDetectorActions::getCurrentScanVariable(i);}; // double getCurrentScanVariable(int i) {return slsDetectorActions::getCurrentScanVariable(i);};
// int getCurrentPositionIndex(){return angularConversion::getCurrentPositionIndex();}; // int getCurrentPositionIndex(){return angularConversion::getCurrentPositionIndex();};
// int getNumberOfPositions(){return angularConversion::getNumberOfPositions();}; // int getNumberOfPositions(){return angularConversion::getNumberOfPositions();};
@ -403,13 +403,13 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
void acquire(int delflag=1); void acquire(int delflag=1);
// float* convertAngles(){return convertAngles(currentPosition);}; // double* convertAngles(){return convertAngles(currentPosition);};
// virtual float* convertAngles(float pos)=0; // virtual double* convertAngles(double pos)=0;
virtual int setThresholdEnergy(int, int im=-1, detectorSettings isettings=GET_SETTINGS)=0; virtual int setThresholdEnergy(int, int im=-1, detectorSettings isettings=GET_SETTINGS)=0;
virtual int setChannel(int64_t, int ich=-1, int ichip=-1, int imod=-1)=0; virtual int setChannel(int64_t, int ich=-1, int ichip=-1, int imod=-1)=0;
virtual float getRateCorrectionTau()=0; virtual double getRateCorrectionTau()=0;
virtual int* startAndReadAll()=0; virtual int* startAndReadAll()=0;
virtual int getTotalNumberOfChannels()=0; virtual int getTotalNumberOfChannels()=0;
@ -423,7 +423,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
int setTotalProgress(); int setTotalProgress();
float getCurrentProgress(); double getCurrentProgress();
void incrementProgress(); void incrementProgress();
@ -491,7 +491,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
\param imod module number (if -1 alla modules) \param imod module number (if -1 alla modules)
\returns current DAC value \returns current DAC value
*/ */
virtual float setDAC(float val, dacIndex index , int imod=-1)=0; virtual double setDAC(double val, dacIndex index , int imod=-1)=0;
/** /**
@ -500,7 +500,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
\param imod module number \param imod module number
\returns current ADC value \returns current ADC value
*/ */
virtual float getADC(dacIndex index, int imod=0)=0; virtual double getADC(dacIndex index, int imod=0)=0;
/** /**
get the maximum size of the detector get the maximum size of the detector
@ -520,13 +520,13 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
void registerGetPositionCallback( float (*func)(void*),void *arg){get_position=func; POarg=arg;}; void registerGetPositionCallback( double (*func)(void*),void *arg){get_position=func; POarg=arg;};
void registerConnectChannelsCallback( int (*func)(void*),void *arg){connect_channels=func; CCarg=arg;}; void registerConnectChannelsCallback( int (*func)(void*),void *arg){connect_channels=func; CCarg=arg;};
void registerDisconnectChannelsCallback(int (*func)(void*),void*arg){disconnect_channels=func;DCarg=arg;}; void registerDisconnectChannelsCallback(int (*func)(void*),void*arg){disconnect_channels=func;DCarg=arg;};
void registerGoToPositionCallback( int (*func)(float, void*),void *arg){go_to_position=func;GTarg=arg;}; void registerGoToPositionCallback( int (*func)(double, void*),void *arg){go_to_position=func;GTarg=arg;};
void registerGoToPositionNoWaitCallback(int (*func)(float, void*),void*arg){go_to_position_no_wait=func;GTNarg=arg;}; void registerGoToPositionNoWaitCallback(int (*func)(double, void*),void*arg){go_to_position_no_wait=func;GTNarg=arg;};
void registerGetI0Callback( float (*func)(int, void*),void *arg){get_i0=func;IOarg=arg;}; void registerGetI0Callback( double (*func)(int, void*),void *arg){get_i0=func;IOarg=arg;};
/** /**
Saves the detector setup to file Saves the detector setup to file
@ -565,12 +565,12 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
int progressIndex; int progressIndex;
float (*get_position)(void*); double (*get_position)(void*);
int (*go_to_position)(float, void*); int (*go_to_position)(double, void*);
int (*go_to_position_no_wait)(float, void*); int (*go_to_position_no_wait)(double, void*);
int (*connect_channels)(void*); int (*connect_channels)(void*);
int (*disconnect_channels)(void*); int (*disconnect_channels)(void*);
float (*get_i0)(int, void*); double (*get_i0)(int, void*);
void *POarg,*CCarg,*DCarg,*GTarg,*GTNarg,*IOarg; void *POarg,*CCarg,*DCarg,*GTarg,*GTNarg,*IOarg;

View File

@ -8,7 +8,7 @@
using namespace std; using namespace std;
angularConversion::angularConversion( int *np, float *pos, float *bs, float *fo, float *go): currentPosition(0), angularConversion::angularConversion( int *np, double *pos, double *bs, double *fo, double *go): currentPosition(0),
currentPositionIndex(0), currentPositionIndex(0),
numberOfPositions(np), numberOfPositions(np),
detPositions(pos), detPositions(pos),
@ -42,10 +42,10 @@ angularConversion::~angularConversion(){
float* angularConversion::convertAngles(float pos) { double* angularConversion::convertAngles(double pos) {
int imod=0; int imod=0;
float *ang=new float[totalNumberOfChannels]; double *ang=new double[totalNumberOfChannels];
float enc=pos; double enc=pos;
angleConversionConstant *p=NULL; angleConversionConstant *p=NULL;
int ch0=0; int ch0=0;
@ -115,9 +115,9 @@ int angularConversion::readAngularConversion(string fname, int nmod, angleConver
int angularConversion::readAngularConversion( ifstream& infile, int nmod, angleConversionConstant *angOff) { int angularConversion::readAngularConversion( ifstream& infile, int nmod, angleConversionConstant *angOff) {
string str; string str;
int mod; int mod;
float center, ecenter; double center, ecenter;
float r_conv, er_conv; double r_conv, er_conv;
float off, eoff; double off, eoff;
string ss; string ss;
int interrupt=0; int interrupt=0;
int nm=0; int nm=0;
@ -187,7 +187,7 @@ int angularConversion:: writeAngularConversion(ofstream& outfile, int nmod, angl
//static //static
int angularConversion::resetMerging(float *mp, float *mv, float *me, int *mm, int nb) { int angularConversion::resetMerging(double *mp, double *mv, double *me, int *mm, int nb) {
#ifdef VERBOSE #ifdef VERBOSE
@ -206,7 +206,7 @@ int angularConversion::resetMerging(float *mp, float *mv, float *me, int *mm, in
//static //static
int angularConversion::finalizeMerging(float *mp, float *mv, float *me, int *mm,int nb) { int angularConversion::finalizeMerging(double *mp, double *mv, double *me, int *mm,int nb) {
int np=0; int np=0;
for (int ibin=0; ibin<nb; ibin++) { for (int ibin=0; ibin<nb; ibin++) {
if (mm[ibin]>0) { if (mm[ibin]>0) {
@ -226,10 +226,10 @@ int angularConversion::finalizeMerging(float *mp, float *mv, float *me, int *mm,
} }
//static //static
int angularConversion::addToMerging(float *p1, float *v1, float *e1, float *mp, float *mv,float *me, int *mm, int nchans, float binsize,int nbins, int *badChanMask ) { int angularConversion::addToMerging(double *p1, double *v1, double *e1, double *mp, double *mv,double *me, int *mm, int nchans, double binsize,int nbins, int *badChanMask ) {
float binmi=-180.; double binmi=-180.;
int ibin=0; int ibin=0;
if (p1==NULL) if (p1==NULL)
@ -305,13 +305,13 @@ int angularConversion::deleteMerging() {
int angularConversion::resetMerging() { int angularConversion::resetMerging() {
getAngularConversionParameter(BIN_SIZE); getAngularConversionParameter(BIN_SIZE);
mergingBins=new float[nBins]; mergingBins=new double[nBins];
mergingCounts=new float[nBins]; mergingCounts=new double[nBins];
mergingErrors=new float[nBins]; mergingErrors=new double[nBins];
mergingMultiplicity=new int[nBins]; mergingMultiplicity=new int[nBins];
@ -320,7 +320,7 @@ int angularConversion::resetMerging() {
} }
int angularConversion::resetMerging(float *mp, float *mv, float *me, int *mm) { int angularConversion::resetMerging(double *mp, double *mv, double *me, int *mm) {
getAngularConversionParameter(BIN_SIZE); getAngularConversionParameter(BIN_SIZE);
if (nBins) if (nBins)
return resetMerging(mp, mv, me, mm,nBins); return resetMerging(mp, mv, me, mm,nBins);
@ -344,14 +344,14 @@ int angularConversion::finalizeMerging() {
int angularConversion::finalizeMerging(float *mp, float *mv, float *me, int *mm) { int angularConversion::finalizeMerging(double *mp, double *mv, double *me, int *mm) {
if (nBins) if (nBins)
return finalizeMerging(mp, mv, me, mm, nBins); return finalizeMerging(mp, mv, me, mm, nBins);
else else
return FAIL; return FAIL;
} }
int angularConversion::addToMerging(float *p1, float *v1, float *e1, int *badChanMask ) { int angularConversion::addToMerging(double *p1, double *v1, double *e1, int *badChanMask ) {
return addToMerging(p1,v1,e1,mergingBins,mergingCounts, mergingErrors, mergingMultiplicity, badChanMask); return addToMerging(p1,v1,e1,mergingBins,mergingCounts, mergingErrors, mergingMultiplicity, badChanMask);
@ -359,7 +359,7 @@ int angularConversion::addToMerging(float *p1, float *v1, float *e1, int *badCh
} }
int angularConversion::addToMerging(float *p1, float *v1, float *e1, float *mp, float *mv,float *me, int *mm, int *badChanMask ) { int angularConversion::addToMerging(double *p1, double *v1, double *e1, double *mp, double *mv,double *me, int *mm, int *badChanMask ) {
int del=0; int del=0;
@ -398,7 +398,7 @@ int angularConversion::addToMerging(float *p1, float *v1, float *e1, float *mp,
\returns the actual value \returns the actual value
*/ */
float angularConversion::setAngularConversionParameter(angleConversionParameter c, float v){ double angularConversion::setAngularConversionParameter(angleConversionParameter c, double v){
switch (c) { switch (c) {
@ -441,7 +441,7 @@ float angularConversion::setAngularConversionParameter(angleConversionParameter
*/ */
float angularConversion::getAngularConversionParameter(angleConversionParameter c) { double angularConversion::getAngularConversionParameter(angleConversionParameter c) {
switch (c) { switch (c) {
case ANGULAR_DIRECTION: case ANGULAR_DIRECTION:
@ -501,7 +501,7 @@ int angularConversion::setAngularConversionFile(string fname) {
\param pos array with the encoder positions \param pos array with the encoder positions
\returns number of positions \returns number of positions
*/ */
int angularConversion::setPositions(int nPos, float *pos){ int angularConversion::setPositions(int nPos, double *pos){
if (nPos>=0) if (nPos>=0)
*numberOfPositions=nPos; *numberOfPositions=nPos;
for (int ip=0; ip<nPos; ip++) for (int ip=0; ip<nPos; ip++)
@ -514,7 +514,7 @@ int angularConversion::setPositions(int nPos, float *pos){
\param pos array which will contain the encoder positions \param pos array which will contain the encoder positions
\returns number of positions \returns number of positions
*/ */
int angularConversion::getPositions(float *pos){ int angularConversion::getPositions(double *pos){
if (pos) { if (pos) {
for (int ip=0; ip<(*numberOfPositions); ip++) for (int ip=0; ip<(*numberOfPositions); ip++)
pos[ip]=detPositions[ip]; pos[ip]=detPositions[ip];

View File

@ -10,7 +10,7 @@
//float angle(int ichan, float encoder, float totalOffset, float conv_r, float center, float offset, float tilt, int direction) //double angle(int ichan, double encoder, double totalOffset, double conv_r, double center, double offset, double tilt, int direction)
using namespace std; using namespace std;
@ -19,14 +19,14 @@ using namespace std;
@short Angular conversion constants needed for a detector module @short Angular conversion constants needed for a detector module
*/ */
typedef struct { typedef struct {
float center; /**< center of the module (channel at which the radius is perpendicular to the module surface) */ double center; /**< center of the module (channel at which the radius is perpendicular to the module surface) */
float ecenter; /**< error in the center determination */ double ecenter; /**< error in the center determination */
float r_conversion; /**< detector pixel size (or strip pitch) divided by the diffractometer radius */ double r_conversion; /**< detector pixel size (or strip pitch) divided by the diffractometer radius */
float er_conversion; /**< error in the r_conversion determination */ double er_conversion; /**< error in the r_conversion determination */
float offset; /**< the module offset i.e. the position of channel 0 with respect to the diffractometer 0 */ double offset; /**< the module offset i.e. the position of channel 0 with respect to the diffractometer 0 */
float eoffset; /**< error in the offset determination */ double eoffset; /**< error in the offset determination */
float tilt; /**< ossible tilt in the orthogonal direction (unused)*/ double tilt; /**< ossible tilt in the orthogonal direction (unused)*/
float etilt; /**< error in the tilt determination */ double etilt; /**< error in the tilt determination */
} angleConversionConstant; } angleConversionConstant;
@ -43,7 +43,7 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl
public: public:
/** default constructor */ /** default constructor */
angularConversion(int*, float*, float*, float*, float*); angularConversion(int*, double*, double*, double*, double*);
/** virtual destructor */ /** virtual destructor */
virtual ~angularConversion(); virtual ~angularConversion();
@ -100,7 +100,7 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl
\param nbins number of bins \param nbins number of bins
\returns OK or FAIL \returns OK or FAIL
*/ */
static int resetMerging(float *mp, float *mv,float *me, int *mm, int nbins); static int resetMerging(double *mp, double *mv,double *me, int *mm, int nbins);
/** /**
sets the arrays of the merged data to 0. NB The array should be created with size >= 360./getBinSize(); sets the arrays of the merged data to 0. NB The array should be created with size >= 360./getBinSize();
\param mp already merged postions \param mp already merged postions
@ -109,7 +109,7 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl
\param mm multiplicity of merged arrays \param mm multiplicity of merged arrays
\returns OK or FAIL \returns OK or FAIL
*/ */
int resetMerging(float *mp, float *mv,float *me, int *mm); int resetMerging(double *mp, double *mv,double *me, int *mm);
/** /**
creates the arrays for merging the data and sets them to 0. creates the arrays for merging the data and sets them to 0.
@ -132,7 +132,7 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl
\returns OK or FAIL \returns OK or FAIL
*/ */
static int addToMerging(float *p1, float *v1, float *e1, float *mp, float *mv,float *me, int *mm, int nchans, float binsize,int nb, int *badChanMask ); static int addToMerging(double *p1, double *v1, double *e1, double *mp, double *mv,double *me, int *mm, int nchans, double binsize,int nb, int *badChanMask );
/** /**
merge dataset merge dataset
@ -147,7 +147,7 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl
\returns OK or FAIL \returns OK or FAIL
*/ */
int addToMerging(float *p1, float *v1, float *e1, float *mp, float *mv,float *me, int *mm, int *badChanMask); int addToMerging(double *p1, double *v1, double *e1, double *mp, double *mv,double *me, int *mm, int *badChanMask);
/** /**
merge dataset merge dataset
\param p1 angular positions of dataset \param p1 angular positions of dataset
@ -157,7 +157,7 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl
\returns OK or FAIL \returns OK or FAIL
*/ */
int addToMerging(float *p1, float *v1, float *e1,int *badChanMask); int addToMerging(double *p1, double *v1, double *e1,int *badChanMask);
/** /**
calculates the "final" positions, data value and errors for the merged data calculates the "final" positions, data value and errors for the merged data
@ -169,7 +169,7 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl
\returns FAIL or the number of non empty bins (i.e. points belonging to the pattern) \returns FAIL or the number of non empty bins (i.e. points belonging to the pattern)
*/ */
static int finalizeMerging(float *mp, float *mv,float *me, int *mm, int nb); static int finalizeMerging(double *mp, double *mv,double *me, int *mm, int nb);
/** /**
calculates the "final" positions, data value and errors for the merged data calculates the "final" positions, data value and errors for the merged data
\param mp already merged postions \param mp already merged postions
@ -179,7 +179,7 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl
\returns FAIL or the number of non empty bins (i.e. points belonging to the pattern) \returns FAIL or the number of non empty bins (i.e. points belonging to the pattern)
*/ */
int finalizeMerging(float *mp, float *mv,float *me, int *mm); int finalizeMerging(double *mp, double *mv,double *me, int *mm);
/** /**
calculates the "final" positions, data value and errors for the merged data calculates the "final" positions, data value and errors for the merged data
@ -194,7 +194,7 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl
\param f global offset to be set \param f global offset to be set
\returns actual global offset \returns actual global offset
*/ */
float setGlobalOffset(float f){return setAngularConversionParameter(GLOBAL_OFFSET,f);}; double setGlobalOffset(double f){return setAngularConversionParameter(GLOBAL_OFFSET,f);};
/** /**
@ -202,19 +202,19 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl
\param f global fine to be set \param f global fine to be set
\returns actual fine offset \returns actual fine offset
*/ */
float setFineOffset(float f){return setAngularConversionParameter(FINE_OFFSET,f);}; double setFineOffset(double f){return setAngularConversionParameter(FINE_OFFSET,f);};
/** /**
get detector fine offset get detector fine offset
\returns actual fine offset \returns actual fine offset
*/ */
float getFineOffset(){return getAngularConversionParameter(FINE_OFFSET);}; double getFineOffset(){return getAngularConversionParameter(FINE_OFFSET);};
/** /**
get detector global offset get detector global offset
\returns actual global offset \returns actual global offset
*/ */
float getGlobalOffset(){return getAngularConversionParameter(GLOBAL_OFFSET);}; double getGlobalOffset(){return getAngularConversionParameter(GLOBAL_OFFSET);};
/** /**
@ -222,13 +222,13 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl
\param bs bin size to be set \param bs bin size to be set
\returns actual bin size \returns actual bin size
*/ */
float setBinSize(float bs){if (bs>0) nBins=360/bs; return setAngularConversionParameter(BIN_SIZE,bs);}; double setBinSize(double bs){if (bs>0) nBins=360/bs; return setAngularConversionParameter(BIN_SIZE,bs);};
/** /**
get detector bin size get detector bin size
\returns detector bin size used for merging (approx angular resolution) \returns detector bin size used for merging (approx angular resolution)
*/ */
float getBinSize() {return getAngularConversionParameter(BIN_SIZE);}; double getBinSize() {return getAngularConversionParameter(BIN_SIZE);};
@ -246,7 +246,7 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl
\param d angular direction to be set (1 is channel number increasing with angle, -1 decreasing) \param d angular direction to be set (1 is channel number increasing with angle, -1 decreasing)
\returns actual angular direction (1 is channel number increasing with angle, -1 decreasing) \returns actual angular direction (1 is channel number increasing with angle, -1 decreasing)
*/ */
int setAngularDirection(int d){return (int)setAngularConversionParameter(ANGULAR_DIRECTION, (float)d);}; int setAngularDirection(int d){return (int)setAngularConversionParameter(ANGULAR_DIRECTION, (double)d);};
/** /**
\returns number of angular bins in the merging (360./binsize) \returns number of angular bins in the merging (360./binsize)
@ -261,13 +261,13 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl
\param v value to be set \param v value to be set
\returns actual value \returns actual value
*/ */
float setAngularConversionParameter(angleConversionParameter c, float v); double setAngularConversionParameter(angleConversionParameter c, double v);
/** /**
get angular conversion parameter get angular conversion parameter
\param c parameter type (globaloffset, fineoffset, binsize, angular direction, move flag) \param c parameter type (globaloffset, fineoffset, binsize, angular direction, move flag)
\returns actual value \returns actual value
*/ */
float getAngularConversionParameter(angleConversionParameter c); double getAngularConversionParameter(angleConversionParameter c);
@ -278,13 +278,13 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl
\param pos array with the encoder positions \param pos array with the encoder positions
\returns number of positions \returns number of positions
*/ */
virtual int setPositions(int nPos, float *pos); virtual int setPositions(int nPos, double *pos);
/** /**
get positions for the acquisition get positions for the acquisition
\param pos array which will contain the encoder positions \param pos array which will contain the encoder positions
\returns number of positions \returns number of positions
*/ */
virtual int getPositions(float *pos=NULL); virtual int getPositions(double *pos=NULL);
/** /**
deletes the array of merged data deletes the array of merged data
@ -295,15 +295,15 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl
/** /**
\returns pointer to the array o merged positions \returns pointer to the array o merged positions
*/ */
float *getMergedPositions(){return mergingBins;}; double *getMergedPositions(){return mergingBins;};
/** /**
\returns pointer to the array of merged counts \returns pointer to the array of merged counts
*/ */
float *getMergedCounts(){return mergingCounts;}; double *getMergedCounts(){return mergingCounts;};
/** /**
\returns pointer to the array of merged errors \returns pointer to the array of merged errors
*/ */
float *getMergedErrors(){return mergingErrors;}; double *getMergedErrors(){return mergingErrors;};
@ -368,12 +368,12 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl
\param pos encoder position \param pos encoder position
\returns array of angles corresponding to the channels \returns array of angles corresponding to the channels
*/ */
float* convertAngles(float pos); double* convertAngles(double pos);
/** /**
converts channel number to angle for the current encoder position converts channel number to angle for the current encoder position
\returns array of angles corresponding to the channels \returns array of angles corresponding to the channels
*/ */
float *convertAngles(){return convertAngles(currentPosition);}; double *convertAngles(){return convertAngles(currentPosition);};
/** /**
@ -391,18 +391,18 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl
private: private:
/** merging bins */ /** merging bins */
float *mergingBins; double *mergingBins;
/** merging counts */ /** merging counts */
float *mergingCounts; double *mergingCounts;
/** merging errors */ /** merging errors */
float *mergingErrors; double *mergingErrors;
/** merging multiplicity */ /** merging multiplicity */
int *mergingMultiplicity; int *mergingMultiplicity;
float (*angle)(float, float, float, float, float, float, float, int); double (*angle)(double, double, double, double, double, double, double, int);
int totalNumberOfChannels; int totalNumberOfChannels;
@ -413,11 +413,11 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl
int *numberOfPositions; int *numberOfPositions;
/** pointer to the detector positions for the acquisition*/ /** pointer to the detector positions for the acquisition*/
float *detPositions; double *detPositions;
/** pointer to angular bin size*/ /** pointer to angular bin size*/
float *binSize; double *binSize;
int *correctionMask; int *correctionMask;
int chansPerMod; int chansPerMod;
@ -427,9 +427,9 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl
/** pointer to beamlien fine offset*/ /** pointer to beamlien fine offset*/
float *fineOffset; double *fineOffset;
/** pointer to beamlien global offset*/ /** pointer to beamlien global offset*/
float *globalOffset; double *globalOffset;
/** pointer to beamlien angular direction*/ /** pointer to beamlien angular direction*/
int *angDirection; int *angDirection;
@ -444,7 +444,7 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl
/** /**
current position of the detector current position of the detector
*/ */
float currentPosition; double currentPosition;
/** /**
current position index of the detector current position index of the detector
*/ */
@ -459,7 +459,7 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl
void registerAngleFunctionCallback(float( *fun)(float, float, float, float, float, float, float, int)) {angle = fun;}; void registerAngleFunctionCallback(double( *fun)(double, double, double, double, double, double, double, int)) {angle = fun;};
}; };

View File

@ -359,7 +359,7 @@ static int G__TSlsDetectorDict_87_0_2(G__value* result7, G__CONST char* funcname
static int G__TSlsDetectorDict_87_0_3(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) static int G__TSlsDetectorDict_87_0_3(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{ {
G__letdouble(result7, 102, (double) ((angularCalibration*) G__getstructoffset())->setEncoder((float) G__double(libp->para[0]))); G__letdouble(result7, 102, (double) ((angularCalibration*) G__getstructoffset())->setEncoder((double) G__double(libp->para[0])));
return(1 || funcname || hash || result7 || libp) ; return(1 || funcname || hash || result7 || libp) ;
} }
@ -371,7 +371,7 @@ static int G__TSlsDetectorDict_87_0_4(G__value* result7, G__CONST char* funcname
static int G__TSlsDetectorDict_87_0_5(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) static int G__TSlsDetectorDict_87_0_5(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{ {
G__letdouble(result7, 102, (double) ((angularCalibration*) G__getstructoffset())->setTotalOffset((float) G__double(libp->para[0]))); G__letdouble(result7, 102, (double) ((angularCalibration*) G__getstructoffset())->setTotalOffset((double) G__double(libp->para[0])));
return(1 || funcname || hash || result7 || libp) ; return(1 || funcname || hash || result7 || libp) ;
} }
@ -383,14 +383,14 @@ static int G__TSlsDetectorDict_87_0_6(G__value* result7, G__CONST char* funcname
static int G__TSlsDetectorDict_87_0_7(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) static int G__TSlsDetectorDict_87_0_7(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{ {
((angularCalibration*) G__getstructoffset())->setAngularRange((float) G__double(libp->para[0]), (float) G__double(libp->para[1])); ((angularCalibration*) G__getstructoffset())->setAngularRange((double) G__double(libp->para[0]), (double) G__double(libp->para[1]));
G__setnull(result7); G__setnull(result7);
return(1 || funcname || hash || result7 || libp) ; return(1 || funcname || hash || result7 || libp) ;
} }
static int G__TSlsDetectorDict_87_0_8(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash) static int G__TSlsDetectorDict_87_0_8(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{ {
((angularCalibration*) G__getstructoffset())->getAngularRange(*(float*) G__Floatref(&libp->para[0]), *(float*) G__Floatref(&libp->para[1])); ((angularCalibration*) G__getstructoffset())->getAngularRange(*(double*) G__doubleref(&libp->para[0]), *(double*) G__doubleref(&libp->para[1]));
G__setnull(result7); G__setnull(result7);
return(1 || funcname || hash || result7 || libp) ; return(1 || funcname || hash || result7 || libp) ;
} }

View File

@ -109,7 +109,7 @@ TF1 *fitPeak(TH1 *h) {
TF1 *fitfun=NULL; TF1 *fitfun=NULL;
int chmod, imod; int chmod, imod;
float ang; double ang;
// reads in a run and fits a gaussian to the peak as function // reads in a run and fits a gaussian to the peak as function
// of channel number also reads optical encoder // of channel number also reads optical encoder
@ -134,8 +134,8 @@ TF1 *fitPeak(TH1 *h) {
// for (i=0;i<nchannel;i++) { // for (i=0;i<nchannel;i++) {
// if ( (angle(i)>minang) && (angle(i)<maxang) ) { // if ( (angle(i)>minang) && (angle(i)<maxang) ) {
// x[npoints]=(float) i; // x[npoints]=(double) i;
// y[npoints]=(float) data[i]; // y[npoints]=(double) data[i];
// ex[npoints]=0.001; // ex[npoints]=0.001;
// ey[npoints]=dataerror[i]; // ey[npoints]=dataerror[i];
// anglefit[npoints]=angle(i); // anglefit[npoints]=angle(i);
@ -255,11 +255,11 @@ TF1 *fitPeak(TH1 *h) {
// // also set peak height,width and background in defines at beginning // // also set peak height,width and background in defines at beginning
// // // //
// void fitangle(char fname[80],char extension[10], int start, int stop, float startangle, float stopangle) { // void fitangle(char fname[80],char extension[10], int start, int stop, double startangle, double stopangle) {
// int i,nfit,mod,npoints,nnpoints; // int i,nfit,mod,npoints,nnpoints;
// float x[MAXINMODULE],y[MAXINMODULE],ex[MAXINMODULE],ey[MAXINMODULE],min,max; // double x[MAXINMODULE],y[MAXINMODULE],ex[MAXINMODULE],ey[MAXINMODULE],min,max;
// float xx[MAXINMODULE],yy[MAXINMODULE],exx[MAXINMODULE],eyy[MAXINMODULE]; // double xx[MAXINMODULE],yy[MAXINMODULE],exx[MAXINMODULE],eyy[MAXINMODULE];
// double channelfit[MAXRUN], channelerror[MAXRUN], encoderfit[MAXRUN]; // double channelfit[MAXRUN], channelerror[MAXRUN], encoderfit[MAXRUN];
// int runnrfit[MAXRUN], modulenr[MAXRUN]; // int runnrfit[MAXRUN], modulenr[MAXRUN];

View File

@ -12,7 +12,7 @@
class TH1; class TH1;
#endif #endif
//float angle(int ichan, float encoder, float totalOffset, float conv_r, float center, float offset, float tilt, int direction) //double angle(int ichan, double encoder, double totalOffset, double conv_r, double center, double offset, double tilt, int direction)
@ -20,14 +20,14 @@ class TH1;
angular conversion constant for a module angular conversion constant for a module
*/ */
typedef struct { typedef struct {
float center; /**< center of the module (channel at which the radius is perpendicular to the module surface) */ double center; /**< center of the module (channel at which the radius is perpendicular to the module surface) */
float ecenter; /**< error in the center determination */ double ecenter; /**< error in the center determination */
float r_conversion; /**< detector pixel size (or strip pitch) divided by the diffractometer radius */ double r_conversion; /**< detector pixel size (or strip pitch) divided by the diffractometer radius */
float er_conversion; /**< error in the r_conversion determination */ double er_conversion; /**< error in the r_conversion determination */
float offset; /**< the module offset i.e. the position of channel 0 with respect to the diffractometer 0 */ double offset; /**< the module offset i.e. the position of channel 0 with respect to the diffractometer 0 */
float eoffset; /**< error in the offset determination */ double eoffset; /**< error in the offset determination */
float tilt; /**< ossible tilt in the orthogonal direction (unused)*/ double tilt; /**< ossible tilt in the orthogonal direction (unused)*/
float etilt; /**< error in the tilt determination */ double etilt; /**< error in the tilt determination */
} angleConversionConstant; } angleConversionConstant;
@ -50,26 +50,26 @@ class angularCalibration {
\param f encoder position to be set \param f encoder position to be set
\returns current encoder position \returns current encoder position
*/ */
float setEncoder(float f) {encoder=f; return encoder;}; double setEncoder(double f) {encoder=f; return encoder;};
/** /**
gets the encoder position gets the encoder position
\returns encoder position \returns encoder position
*/ */
float getEncoder() {return encoder;}; double getEncoder() {return encoder;};
/** /**
sets the totalOffset of the detector sets the totalOffset of the detector
\param f total offset to be set \param f total offset to be set
\returns current total offset \returns current total offset
*/ */
float setTotalOffset(float f) {totalOffset=f; return totalOffset;}; double setTotalOffset(double f) {totalOffset=f; return totalOffset;};
/** /**
gets the encoder position gets the encoder position
\returns encoder position \returns encoder position
*/ */
float getTotalOffset() {return totalOffset;}; double getTotalOffset() {return totalOffset;};
@ -79,7 +79,7 @@ class angularCalibration {
\param mi minimum of the angular range \param mi minimum of the angular range
\param ma maximum of the angular range \param ma maximum of the angular range
*/ */
void setAngularRange(float mi, float ma){ang_min=mi; ang_max=ma;}; void setAngularRange(double mi, double ma){ang_min=mi; ang_max=ma;};
/** /**
@ -87,7 +87,7 @@ class angularCalibration {
\param mi reference to the minimum of the angular range \param mi reference to the minimum of the angular range
\param ma reference to the maximum of the angular range \param ma reference to the maximum of the angular range
*/ */
void getAngularRange(float &mi, float &ma){mi=ang_min; ma=ang_max;}; void getAngularRange(double &mi, double &ma){mi=ang_min; ma=ang_max;};
/** sets and returns the number of modules /** sets and returns the number of modules
@ -147,10 +147,10 @@ class angularCalibration {
TF1 *fangle; /**< Root function based on function angleFunction */ TF1 *fangle; /**< Root function based on function angleFunction */
#endif #endif
float encoder; /**< position of the detector encoder */ double encoder; /**< position of the detector encoder */
float totalOffset; /**< total offset of the detector */ double totalOffset; /**< total offset of the detector */
float ang_min; /**< minimum of the angular range for peak fitting*/ double ang_min; /**< minimum of the angular range for peak fitting*/
float ang_max; /**< maximum of the angular range for peak fitting */ double ang_max; /**< maximum of the angular range for peak fitting */
int nmod; int nmod;
int nchmod; int nchmod;
@ -161,8 +161,8 @@ class angularCalibration {
/* void fitangle(char fname[80],char extension[10], int start, int stop, float startangle, float stopangle); //fits all datasets and extracts the constants */ /* void fitangle(char fname[80],char extension[10], int start, int stop, double startangle, double stopangle); //fits all datasets and extracts the constants */
/* int fitpeak(char fname[80],char extension[10], int nr, float minang, float maxang); // fits a peak from a pattern using nominal calibration constant */ /* int fitpeak(char fname[80],char extension[10], int nr, double minang, double maxang); // fits a peak from a pattern using nominal calibration constant */
}; };

View File

@ -36,10 +36,10 @@ angularConversion::~angularConversion(){
float* angularConversion::convertAngles(float pos) { double* angularConversion::convertAngles(double pos) {
int imod=0; int imod=0;
float *ang=new float[getTotalNumberOfChannels()]; double *ang=new double[getTotalNumberOfChannels()];
float enc=pos; double enc=pos;
angleConversionConstant *p=NULL; angleConversionConstant *p=NULL;
int ch0=0; int ch0=0;
@ -109,9 +109,9 @@ int angularConversion::readAngularConversion(string fname, int nmod, angleConver
int angularConversion::readAngularConversion( ifstream& infile, int nmod, angleConversionConstant *angOff) { int angularConversion::readAngularConversion( ifstream& infile, int nmod, angleConversionConstant *angOff) {
string str; string str;
int mod; int mod;
float center, ecenter; double center, ecenter;
float r_conv, er_conv; double r_conv, er_conv;
float off, eoff; double off, eoff;
string ss; string ss;
int interrupt=0; int interrupt=0;
int nm=0; int nm=0;
@ -181,7 +181,7 @@ int angularConversion:: writeAngularConversion(ofstream& outfile, int nmod, angl
//static //static
int angularConversion::resetMerging(float *mp, float *mv, float *me, int *mm, int nb) { int angularConversion::resetMerging(double *mp, double *mv, double *me, int *mm, int nb) {
#ifdef VERBOSE #ifdef VERBOSE
@ -200,7 +200,7 @@ int angularConversion::resetMerging(float *mp, float *mv, float *me, int *mm, in
//static //static
int angularConversion::finalizeMerging(float *mp, float *mv, float *me, int *mm,int nb) { int angularConversion::finalizeMerging(double *mp, double *mv, double *me, int *mm,int nb) {
int np=0; int np=0;
for (int ibin=0; ibin<nb; ibin++) { for (int ibin=0; ibin<nb; ibin++) {
if (mm[ibin]>0) { if (mm[ibin]>0) {
@ -220,10 +220,10 @@ int angularConversion::finalizeMerging(float *mp, float *mv, float *me, int *mm,
} }
//static //static
int angularConversion::addToMerging(float *p1, float *v1, float *e1, float *mp, float *mv,float *me, int *mm, int nchans, float binsize,int nbins, int *badChanMask ) { int angularConversion::addToMerging(double *p1, double *v1, double *e1, double *mp, double *mv,double *me, int *mm, int nchans, double binsize,int nbins, int *badChanMask ) {
float binmi=-180.; double binmi=-180.;
int ibin=0; int ibin=0;
if (p1==NULL) if (p1==NULL)
@ -299,13 +299,13 @@ int angularConversion::deleteMerging() {
int angularConversion::resetMerging() { int angularConversion::resetMerging() {
getAngularConversionParameter(BIN_SIZE); getAngularConversionParameter(BIN_SIZE);
mergingBins=new float[nBins]; mergingBins=new double[nBins];
mergingCounts=new float[nBins]; mergingCounts=new double[nBins];
mergingErrors=new float[nBins]; mergingErrors=new double[nBins];
mergingMultiplicity=new int[nBins]; mergingMultiplicity=new int[nBins];
@ -314,7 +314,7 @@ int angularConversion::resetMerging() {
} }
int angularConversion::resetMerging(float *mp, float *mv, float *me, int *mm) { int angularConversion::resetMerging(double *mp, double *mv, double *me, int *mm) {
getAngularConversionParameter(BIN_SIZE); getAngularConversionParameter(BIN_SIZE);
if (nBins) if (nBins)
return resetMerging(mp, mv, me, mm,nBins); return resetMerging(mp, mv, me, mm,nBins);
@ -338,14 +338,14 @@ int angularConversion::finalizeMerging() {
int angularConversion::finalizeMerging(float *mp, float *mv, float *me, int *mm) { int angularConversion::finalizeMerging(double *mp, double *mv, double *me, int *mm) {
if (nBins) if (nBins)
return finalizeMerging(mp, mv, me, mm, nBins); return finalizeMerging(mp, mv, me, mm, nBins);
else else
return FAIL; return FAIL;
} }
int angularConversion::addToMerging(float *p1, float *v1, float *e1, int *badChanMask ) { int angularConversion::addToMerging(double *p1, double *v1, double *e1, int *badChanMask ) {
return addToMerging(p1,v1,e1,mergingBins,mergingCounts, mergingErrors, mergingMultiplicity, badChanMask); return addToMerging(p1,v1,e1,mergingBins,mergingCounts, mergingErrors, mergingMultiplicity, badChanMask);
@ -353,7 +353,7 @@ int angularConversion::addToMerging(float *p1, float *v1, float *e1, int *badCh
} }
int angularConversion::addToMerging(float *p1, float *v1, float *e1, float *mp, float *mv,float *me, int *mm, int *badChanMask ) { int angularConversion::addToMerging(double *p1, double *v1, double *e1, double *mp, double *mv,double *me, int *mm, int *badChanMask ) {
int del=0; int del=0;
@ -392,7 +392,7 @@ int angularConversion::addToMerging(float *p1, float *v1, float *e1, float *mp,
\returns the actual value \returns the actual value
*/ */
float angularConversion::setAngularConversionParameter(angleConversionParameter c, float v){ double angularConversion::setAngularConversionParameter(angleConversionParameter c, double v){
switch (c) { switch (c) {
@ -435,7 +435,7 @@ float angularConversion::setAngularConversionParameter(angleConversionParameter
*/ */
float angularConversion::getAngularConversionParameter(angleConversionParameter c) { double angularConversion::getAngularConversionParameter(angleConversionParameter c) {
switch (c) { switch (c) {
case ANGULAR_DIRECTION: case ANGULAR_DIRECTION:
@ -495,7 +495,7 @@ int angularConversion::setAngularConversionFile(string fname) {
\param pos array with the encoder positions \param pos array with the encoder positions
\returns number of positions \returns number of positions
*/ */
int angularConversion::setPositions(int nPos, float *pos){ int angularConversion::setPositions(int nPos, double *pos){
if (nPos>=0) if (nPos>=0)
*numberOfPositions=nPos; *numberOfPositions=nPos;
for (int ip=0; ip<nPos; ip++) for (int ip=0; ip<nPos; ip++)
@ -508,7 +508,7 @@ int angularConversion::setPositions(int nPos, float *pos){
\param pos array which will contain the encoder positions \param pos array which will contain the encoder positions
\returns number of positions \returns number of positions
*/ */
int angularConversion::getPositions(float *pos){ int angularConversion::getPositions(double *pos){
if (pos) { if (pos) {
for (int ip=0; ip<(*numberOfPositions); ip++) for (int ip=0; ip<(*numberOfPositions); ip++)
pos[ip]=detPositions[ip]; pos[ip]=detPositions[ip];

View File

@ -9,7 +9,7 @@
//float angle(int ichan, float encoder, float totalOffset, float conv_r, float center, float offset, float tilt, int direction) //double angle(int ichan, double encoder, double totalOffset, double conv_r, double center, double offset, double tilt, int direction)
using namespace std; using namespace std;
@ -18,14 +18,14 @@ using namespace std;
@short Angular conversion constants needed for a detector module @short Angular conversion constants needed for a detector module
*/ */
typedef struct { typedef struct {
float center; /**< center of the module (channel at which the radius is perpendicular to the module surface) */ double center; /**< center of the module (channel at which the radius is perpendicular to the module surface) */
float ecenter; /**< error in the center determination */ double ecenter; /**< error in the center determination */
float r_conversion; /**< detector pixel size (or strip pitch) divided by the diffractometer radius */ double r_conversion; /**< detector pixel size (or strip pitch) divided by the diffractometer radius */
float er_conversion; /**< error in the r_conversion determination */ double er_conversion; /**< error in the r_conversion determination */
float offset; /**< the module offset i.e. the position of channel 0 with respect to the diffractometer 0 */ double offset; /**< the module offset i.e. the position of channel 0 with respect to the diffractometer 0 */
float eoffset; /**< error in the offset determination */ double eoffset; /**< error in the offset determination */
float tilt; /**< ossible tilt in the orthogonal direction (unused)*/ double tilt; /**< ossible tilt in the orthogonal direction (unused)*/
float etilt; /**< error in the tilt determination */ double etilt; /**< error in the tilt determination */
} angleConversionConstant; } angleConversionConstant;
@ -105,7 +105,7 @@ class angularConversion : public virtual slsDetectorBase {
\param nbins number of bins \param nbins number of bins
\returns OK or FAIL \returns OK or FAIL
*/ */
static int resetMerging(float *mp, float *mv,float *me, int *mm, int nbins); static int resetMerging(double *mp, double *mv,double *me, int *mm, int nbins);
/** /**
sets the arrays of the merged data to 0. NB The array should be created with size >= 360./getBinSize(); sets the arrays of the merged data to 0. NB The array should be created with size >= 360./getBinSize();
\param mp already merged postions \param mp already merged postions
@ -114,7 +114,7 @@ class angularConversion : public virtual slsDetectorBase {
\param mm multiplicity of merged arrays \param mm multiplicity of merged arrays
\returns OK or FAIL \returns OK or FAIL
*/ */
int resetMerging(float *mp, float *mv,float *me, int *mm); int resetMerging(double *mp, double *mv,double *me, int *mm);
/** /**
creates the arrays for merging the data and sets them to 0. creates the arrays for merging the data and sets them to 0.
@ -137,7 +137,7 @@ class angularConversion : public virtual slsDetectorBase {
\returns OK or FAIL \returns OK or FAIL
*/ */
static int addToMerging(float *p1, float *v1, float *e1, float *mp, float *mv,float *me, int *mm, int nchans, float binsize,int nb, int *badChanMask ); static int addToMerging(double *p1, double *v1, double *e1, double *mp, double *mv,double *me, int *mm, int nchans, double binsize,int nb, int *badChanMask );
/** /**
merge dataset merge dataset
@ -152,7 +152,7 @@ class angularConversion : public virtual slsDetectorBase {
\returns OK or FAIL \returns OK or FAIL
*/ */
int addToMerging(float *p1, float *v1, float *e1, float *mp, float *mv,float *me, int *mm, int *badChanMask); int addToMerging(double *p1, double *v1, double *e1, double *mp, double *mv,double *me, int *mm, int *badChanMask);
/** /**
merge dataset merge dataset
\param p1 angular positions of dataset \param p1 angular positions of dataset
@ -162,7 +162,7 @@ class angularConversion : public virtual slsDetectorBase {
\returns OK or FAIL \returns OK or FAIL
*/ */
int addToMerging(float *p1, float *v1, float *e1,int *badChanMask); int addToMerging(double *p1, double *v1, double *e1,int *badChanMask);
/** /**
calculates the "final" positions, data value and errors for the merged data calculates the "final" positions, data value and errors for the merged data
@ -174,7 +174,7 @@ class angularConversion : public virtual slsDetectorBase {
\returns FAIL or the number of non empty bins (i.e. points belonging to the pattern) \returns FAIL or the number of non empty bins (i.e. points belonging to the pattern)
*/ */
static int finalizeMerging(float *mp, float *mv,float *me, int *mm, int nb); static int finalizeMerging(double *mp, double *mv,double *me, int *mm, int nb);
/** /**
calculates the "final" positions, data value and errors for the merged data calculates the "final" positions, data value and errors for the merged data
\param mp already merged postions \param mp already merged postions
@ -184,7 +184,7 @@ class angularConversion : public virtual slsDetectorBase {
\returns FAIL or the number of non empty bins (i.e. points belonging to the pattern) \returns FAIL or the number of non empty bins (i.e. points belonging to the pattern)
*/ */
int finalizeMerging(float *mp, float *mv,float *me, int *mm); int finalizeMerging(double *mp, double *mv,double *me, int *mm);
/** /**
calculates the "final" positions, data value and errors for the merged data calculates the "final" positions, data value and errors for the merged data
@ -199,7 +199,7 @@ class angularConversion : public virtual slsDetectorBase {
\param f global offset to be set \param f global offset to be set
\returns actual global offset \returns actual global offset
*/ */
float setGlobalOffset(float f){return setAngularConversionParameter(GLOBAL_OFFSET,f);}; double setGlobalOffset(double f){return setAngularConversionParameter(GLOBAL_OFFSET,f);};
/** /**
@ -207,19 +207,19 @@ class angularConversion : public virtual slsDetectorBase {
\param f global fine to be set \param f global fine to be set
\returns actual fine offset \returns actual fine offset
*/ */
float setFineOffset(float f){return setAngularConversionParameter(FINE_OFFSET,f);}; double setFineOffset(double f){return setAngularConversionParameter(FINE_OFFSET,f);};
/** /**
get detector fine offset get detector fine offset
\returns actual fine offset \returns actual fine offset
*/ */
float getFineOffset(){return getAngularConversionParameter(FINE_OFFSET);}; double getFineOffset(){return getAngularConversionParameter(FINE_OFFSET);};
/** /**
get detector global offset get detector global offset
\returns actual global offset \returns actual global offset
*/ */
float getGlobalOffset(){return getAngularConversionParameter(GLOBAL_OFFSET);}; double getGlobalOffset(){return getAngularConversionParameter(GLOBAL_OFFSET);};
/** /**
@ -227,13 +227,13 @@ class angularConversion : public virtual slsDetectorBase {
\param bs bin size to be set \param bs bin size to be set
\returns actual bin size \returns actual bin size
*/ */
float setBinSize(float bs){if (bs>0) nBins=360/bs; return setAngularConversionParameter(BIN_SIZE,bs);}; double setBinSize(double bs){if (bs>0) nBins=360/bs; return setAngularConversionParameter(BIN_SIZE,bs);};
/** /**
get detector bin size get detector bin size
\returns detector bin size used for merging (approx angular resolution) \returns detector bin size used for merging (approx angular resolution)
*/ */
float getBinSize() {return getAngularConversionParameter(BIN_SIZE);}; double getBinSize() {return getAngularConversionParameter(BIN_SIZE);};
@ -251,7 +251,7 @@ class angularConversion : public virtual slsDetectorBase {
\param d angular direction to be set (1 is channel number increasing with angle, -1 decreasing) \param d angular direction to be set (1 is channel number increasing with angle, -1 decreasing)
\returns actual angular direction (1 is channel number increasing with angle, -1 decreasing) \returns actual angular direction (1 is channel number increasing with angle, -1 decreasing)
*/ */
int setAngularDirection(int d){return (int)setAngularConversionParameter(ANGULAR_DIRECTION, (float)d);}; int setAngularDirection(int d){return (int)setAngularConversionParameter(ANGULAR_DIRECTION, (double)d);};
/** /**
\returns number of angular bins in the merging (360./binsize) \returns number of angular bins in the merging (360./binsize)
@ -273,13 +273,13 @@ class angularConversion : public virtual slsDetectorBase {
\param v value to be set \param v value to be set
\returns actual value \returns actual value
*/ */
float setAngularConversionParameter(angleConversionParameter c, float v); double setAngularConversionParameter(angleConversionParameter c, double v);
/** /**
get angular conversion parameter get angular conversion parameter
\param c parameter type (globaloffset, fineoffset, binsize, angular direction, move flag) \param c parameter type (globaloffset, fineoffset, binsize, angular direction, move flag)
\returns actual value \returns actual value
*/ */
float getAngularConversionParameter(angleConversionParameter c); double getAngularConversionParameter(angleConversionParameter c);
@ -290,13 +290,13 @@ class angularConversion : public virtual slsDetectorBase {
\param pos array with the encoder positions \param pos array with the encoder positions
\returns number of positions \returns number of positions
*/ */
virtual int setPositions(int nPos, float *pos); virtual int setPositions(int nPos, double *pos);
/** /**
get positions for the acquisition get positions for the acquisition
\param pos array which will contain the encoder positions \param pos array which will contain the encoder positions
\returns number of positions \returns number of positions
*/ */
virtual int getPositions(float *pos=NULL); virtual int getPositions(double *pos=NULL);
/** /**
deletes the array of merged data deletes the array of merged data
@ -307,15 +307,15 @@ class angularConversion : public virtual slsDetectorBase {
/** /**
\returns pointer to the array o merged positions \returns pointer to the array o merged positions
*/ */
float *getMergedPositions(){return mergingBins;}; double *getMergedPositions(){return mergingBins;};
/** /**
\returns pointer to the array of merged counts \returns pointer to the array of merged counts
*/ */
float *getMergedCounts(){return mergingCounts;}; double *getMergedCounts(){return mergingCounts;};
/** /**
\returns pointer to the array of merged errors \returns pointer to the array of merged errors
*/ */
float *getMergedErrors(){return mergingErrors;}; double *getMergedErrors(){return mergingErrors;};
@ -367,12 +367,12 @@ class angularConversion : public virtual slsDetectorBase {
\param pos encoder position \param pos encoder position
\returns array of angles corresponding to the channels \returns array of angles corresponding to the channels
*/ */
float* convertAngles(float pos); double* convertAngles(double pos);
/** /**
converts channel number to angle for the current encoder position converts channel number to angle for the current encoder position
\returns array of angles corresponding to the channels \returns array of angles corresponding to the channels
*/ */
float *convertAngles(){return convertAngles(currentPosition);}; double *convertAngles(){return convertAngles(currentPosition);};
/** /**
\param imod module number \param imod module number
@ -391,18 +391,18 @@ class angularConversion : public virtual slsDetectorBase {
int *numberOfPositions; int *numberOfPositions;
/** pointer to the detector positions for the acquisition*/ /** pointer to the detector positions for the acquisition*/
float *detPositions; double *detPositions;
/** pointer to angular conversion file name*/ /** pointer to angular conversion file name*/
char *angConvFile; char *angConvFile;
/** pointer to angular bin size*/ /** pointer to angular bin size*/
float *binSize; double *binSize;
/** pointer to beamlien fine offset*/ /** pointer to beamlien fine offset*/
float *fineOffset; double *fineOffset;
/** pointer to beamlien global offset*/ /** pointer to beamlien global offset*/
float *globalOffset; double *globalOffset;
/** pointer to beamlien angular direction*/ /** pointer to beamlien angular direction*/
int *angDirection; int *angDirection;
/** pointer to detector move flag (1 moves with encoder, 0 not)*/ /** pointer to detector move flag (1 moves with encoder, 0 not)*/
@ -416,7 +416,7 @@ class angularConversion : public virtual slsDetectorBase {
/** /**
current position of the detector current position of the detector
*/ */
float currentPosition; double currentPosition;
/** /**
current position index of the detector current position index of the detector
*/ */
@ -439,24 +439,24 @@ class angularConversion : public virtual slsDetectorBase {
void registerAngleFunctionCallback(float( *fun)(float, float, float, float, float, float, float, int)) {angle = fun;}; void registerAngleFunctionCallback(double( *fun)(double, double, double, double, double, double, double, int)) {angle = fun;};
private: private:
/** merging bins */ /** merging bins */
float *mergingBins; double *mergingBins;
/** merging counts */ /** merging counts */
float *mergingCounts; double *mergingCounts;
/** merging errors */ /** merging errors */
float *mergingErrors; double *mergingErrors;
/** merging multiplicity */ /** merging multiplicity */
int *mergingMultiplicity; int *mergingMultiplicity;
float (*angle)(float, float, float, float, float, float, float, int); double (*angle)(double, double, double, double, double, double, double, int);
}; };

View File

@ -19,17 +19,17 @@ class detectorData {
\param np number of points in x coordinate defaults to the number of detector channels (1D detector) \param np number of points in x coordinate defaults to the number of detector channels (1D detector)
\param ny dimension in y (1D detector) \param ny dimension in y (1D detector)
*/ */
detectorData(float *val=NULL, float *err=NULL, float *ang=NULL, float p_ind=-1, const char *fname="", int np=-1, int ny=1) : values(val), errors(err), angles(ang), progressIndex(p_ind), npoints(np), npy(ny){strcpy(fileName,fname);}; detectorData(double *val=NULL, double *err=NULL, double *ang=NULL, double p_ind=-1, const char *fname="", int np=-1, int ny=1) : values(val), errors(err), angles(ang), progressIndex(p_ind), npoints(np), npy(ny){strcpy(fileName,fname);};
/** /**
the destructor the destructor
deletes also the arrays pointing to data/errors/angles if not NULL deletes also the arrays pointing to data/errors/angles if not NULL
*/ */
~detectorData() {if (values) delete [] values; if (errors) delete [] errors; if (angles) delete [] angles;}; ~detectorData() {if (values) delete [] values; if (errors) delete [] errors; if (angles) delete [] angles;};
//private: //private:
float *values; /**< pointer to the data */ double *values; /**< pointer to the data */
float *errors; /**< pointer to the errors */ double *errors; /**< pointer to the errors */
float *angles;/**< pointer to the angles */ double *angles;/**< pointer to the angles */
float progressIndex;/**< file index */ double progressIndex;/**< file index */
char fileName[1000];/**< file name */ char fileName[1000];/**< file name */
int npoints;/**< number of points */ int npoints;/**< number of points */
int npy;/**< dimensions in y coordinate*/ int npy;/**< dimensions in y coordinate*/

View File

@ -26,7 +26,7 @@ Double_t energyCalibrationFunctions::gaussChargeSharing(Double_t *x, Double_t *p
// basic erf function // basic erf function
Double_t energyCalibrationFunctions::erfFunction(Double_t *x, Double_t *par) { Double_t energyCalibrationFunctions::erfFunction(Double_t *x, Double_t *par) {
float arg=0; double arg=0;
if (par[1]!=0) arg=(par[0]-x[0])/par[1]; if (par[1]!=0) arg=(par[0]-x[0])/par[1];
return ((par[2]/2.*(1+TMath::Erf(sign*arg/(TMath::Sqrt(2)))))); return ((par[2]/2.*(1+TMath::Erf(sign*arg/(TMath::Sqrt(2))))));
}; };
@ -47,10 +47,10 @@ Double_t energyCalibrationFunctions::erfFuncFluo(Double_t *x, Double_t *par) {
}; };
#endif #endif
float energyCalibrationFunctions::median(float *x, int n){ double energyCalibrationFunctions::median(double *x, int n){
// sorts x into xmed array and returns median // sorts x into xmed array and returns median
// n is number of values already in the xmed array // n is number of values already in the xmed array
float xmed[n]; double xmed[n];
int k,i,j; int k,i,j;
for (i=0; i<n; i++) { for (i=0; i<n; i++) {
@ -121,7 +121,7 @@ int energyCalibrationFunctions::quick_select(int arr[], int n){
int energyCalibrationFunctions::kth_smallest(int *a, int n, int k){ int energyCalibrationFunctions::kth_smallest(int *a, int n, int k){
register int i,j,l,m ; register int i,j,l,m ;
register float x ; register double x ;
l=0 ; m=n-1 ; l=0 ; m=n-1 ;
while (l<m) { while (l<m) {

View File

@ -16,8 +16,8 @@ using namespace std;
const float conven=1000./3.6; /**< electrons/keV */ const double conven=1000./3.6; /**< electrons/keV */
const float el=1.67E-4; /**< electron charge in fC */ const double el=1.67E-4; /**< electron charge in fC */
@ -148,7 +148,7 @@ Double_t erfFuncFluo(Double_t *x, Double_t *par);
#endif #endif
/** Calculates the median of an array of n elements */ /** Calculates the median of an array of n elements */
static float median(float *x, int n); static double median(double *x, int n);
/** Calculates the median of an array of n elements (swaps the arrays!)*/ /** Calculates the median of an array of n elements (swaps the arrays!)*/
static int quick_select(int arr[], int n); static int quick_select(int arr[], int n);
/** Calculates the median of an array of n elements (swaps the arrays!)*/ /** Calculates the median of an array of n elements (swaps the arrays!)*/

View File

@ -11,7 +11,7 @@ using namespace std;
int energyConversion::readCalibrationFile(string fname, float &gain, float &offset){ int energyConversion::readCalibrationFile(string fname, double &gain, double &offset){
string str; string str;
ifstream infile; ifstream infile;
@ -36,7 +36,7 @@ int energyConversion::readCalibrationFile(string fname, float &gain, float &offs
return 0; return 0;
}; };
int energyConversion::writeCalibrationFile(string fname, float gain, float offset){ int energyConversion::writeCalibrationFile(string fname, double gain, double offset){
//std::cout<< "Function not yet implemented " << std::endl; //std::cout<< "Function not yet implemented " << std::endl;
ofstream outfile; ofstream outfile;

View File

@ -26,7 +26,7 @@ class energyConversion: private virtual slsDetectorDefs {
\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
*/ */
static int readCalibrationFile(string fname, float &gain, float &offset); static int readCalibrationFile(string fname, double &gain, double &offset);
/** /**
@ -35,7 +35,7 @@ class energyConversion: private virtual slsDetectorDefs {
\param gain \param gain
\param offset \param offset
*/ */
static int writeCalibrationFile(string fname, float gain, float offset); static int writeCalibrationFile(string fname, double gain, double offset);
/** /**

View File

@ -3,7 +3,7 @@
string fileIO::createFileName(char *filepath, char *filename, int aMask, float sv0, int prec0, float sv1, int prec1, int pindex, int npos, int findex) { string fileIO::createFileName(char *filepath, char *filename, int aMask, double sv0, int prec0, double sv1, int prec1, int pindex, int npos, int findex) {
ostringstream osfn; ostringstream osfn;
// string fn; // string fn;
/*directory name +root file name */ /*directory name +root file name */
@ -87,10 +87,10 @@ int fileIO::getFileIndexFromFileName(string fname) {
return 0; return 0;
} }
int fileIO::getVariablesFromFileName(string fname, int &index, int &p_index, float &sv0, float &sv1) { int fileIO::getVariablesFromFileName(string fname, int &index, int &p_index, double &sv0, double &sv1) {
int i; int i;
float f; double f;
string s; string s;
@ -194,7 +194,7 @@ int fileIO::getVariablesFromFileName(string fname, int &index, int &p_index, flo
int fileIO::writeDataFile(string fname, int nch, float *data, float *err, float *ang, char dataformat){ int fileIO::writeDataFile(string fname, int nch, double *data, double *err, double *ang, char dataformat){
ofstream outfile; ofstream outfile;
@ -217,7 +217,7 @@ int fileIO::writeDataFile(string fname, int nch, float *data, float *err, float
}; };
int fileIO::writeDataFile(ofstream &outfile, int nch, float *data, float *err, float *ang, char dataformat, int offset){ int fileIO::writeDataFile(ofstream &outfile, int nch, double *data, double *err, double *ang, char dataformat, int offset){
int idata; int idata;
@ -341,13 +341,13 @@ int fileIO::writeDataFile(ofstream &outfile, int nch, short int *data, int offse
int fileIO::readDataFile(int nch, string fname, float *data, float *err, float *ang, char dataformat){ int fileIO::readDataFile(int nch, string fname, double *data, double *err, double *ang, char dataformat){
ifstream infile; ifstream infile;
int iline=0;//ichan, int iline=0;//ichan,
//int interrupt=0; //int interrupt=0;
//float fdata, ferr, fang; //double fdata, ferr, fang;
int maxchans; int maxchans;
//int ich; //int ich;
string str; string str;
@ -370,12 +370,12 @@ int fileIO::readDataFile(int nch, string fname, float *data, float *err, float *
}; };
int fileIO::readDataFile(int nch, ifstream &infile, float *data, float *err, float *ang, char dataformat, int offset){ int fileIO::readDataFile(int nch, ifstream &infile, double *data, double *err, double *ang, char dataformat, int offset){
int ichan,iline=0; int ichan,iline=0;
int interrupt=0; int interrupt=0;
float fdata, ferr, fang; double fdata, ferr, fang;
int maxchans; int maxchans;
int ich; int ich;
string str; string str;
@ -562,14 +562,14 @@ int fileIO::readDataFile(ifstream &infile, short int *data, int nch, int offset)
/*writes raw data file */ /*writes raw data file */
int fileIO::writeDataFile(string fname, float *data, float *err, float *ang, char dataformat, int nch){ int fileIO::writeDataFile(string fname, double *data, double *err, double *ang, char dataformat, int nch){
if (nch==-1) if (nch==-1)
nch=getTotalNumberOfChannels(); nch=getTotalNumberOfChannels();
return writeDataFile(fname, nch, data, err, ang, dataformat); return writeDataFile(fname, nch, data, err, ang, dataformat);
} }
int fileIO::writeDataFile(ofstream &outfile, float *data, float *err, float *ang, char dataformat, int nch, int offset){ int fileIO::writeDataFile(ofstream &outfile, double *data, double *err, double *ang, char dataformat, int nch, int offset){
if (nch==-1) if (nch==-1)
nch=getTotalNumberOfChannels(); nch=getTotalNumberOfChannels();
@ -607,12 +607,12 @@ int fileIO::writeDataFile(ofstream &outfile, short int *data, int offset){
int fileIO::readDataFile(string fname, float *data, float *err, float *ang, char dataformat) { int fileIO::readDataFile(string fname, double *data, double *err, double *ang, char dataformat) {
return readDataFile(getTotalNumberOfChannels(), fname, data, err, ang, dataformat); return readDataFile(getTotalNumberOfChannels(), fname, data, err, ang, dataformat);
} }
int fileIO::readDataFile(ifstream &infile, float *data, float *err, float *ang, char dataformat, int offset) { int fileIO::readDataFile(ifstream &infile, double *data, double *err, double *ang, char dataformat, int offset) {
return readDataFile(getTotalNumberOfChannels(), infile, data, err, ang, dataformat, offset); return readDataFile(getTotalNumberOfChannels(), infile, data, err, ang, dataformat, offset);
} }

View File

@ -91,7 +91,7 @@ class fileIO : public virtual slsDetectorBase {
\param findex file index \param findex file index
\returns file name without extension \returns file name without extension
*/ */
static string createFileName(char *filepath, char *filename, int aMask, float sv0, int prec0, float sv1, int prec1, int pindex, int npos, int findex); static string createFileName(char *filepath, char *filename, int aMask, double sv0, int prec0, double sv1, int prec1, int pindex, int npos, int findex);
string createFileName(); string createFileName();
@ -111,7 +111,7 @@ class fileIO : public virtual slsDetectorBase {
\param sv1 reference to scan variable 1 \param sv1 reference to scan variable 1
\returns file index \returns file index
*/ */
static int getVariablesFromFileName(string fname, int &index, int &p_index, float &sv0, float &sv1); static int getVariablesFromFileName(string fname, int &index, int &p_index, double &sv0, double &sv1);
@ -124,12 +124,12 @@ class fileIO : public virtual slsDetectorBase {
\param err array of arrors on the data. If NULL no errors will be written \param err array of arrors on the data. If NULL no errors will be written
\param ang array of angular values. If NULL data will be in the form chan-val(-err) otherwise ang-val(-err) \param ang array of angular values. If NULL data will be in the form chan-val(-err) otherwise ang-val(-err)
\param dataformat format of the data: can be 'i' integer or 'f' float (default) \param dataformat format of the data: can be 'i' integer or 'f' double (default)
\param nch number of channels to be written to file. if -1 defaults to the number of installed channels of the detector \param nch number of channels to be written to file. if -1 defaults to the number of installed channels of the detector
\returns OK or FAIL if it could not write the file or data=NULL \returns OK or FAIL if it could not write the file or data=NULL
*/ */
virtual int writeDataFile(string fname, float *data, float *err=NULL, float *ang=NULL, char dataformat='f', int nch=-1); virtual int writeDataFile(string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int nch=-1);
/** /**
@ -140,13 +140,13 @@ class fileIO : public virtual slsDetectorBase {
\param err array of arrors on the data. If NULL no errors will be written \param err array of arrors on the data. If NULL no errors will be written
\param ang array of angular values. If NULL data will be in the form chan-val(-err) otherwise ang-val(-err) \param ang array of angular values. If NULL data will be in the form chan-val(-err) otherwise ang-val(-err)
\param dataformat format of the data: can be 'i' integer or 'f' float (default) \param dataformat format of the data: can be 'i' integer or 'f' double (default)
\param nch number of channels to be written to file. if -1 defaults to the number of installed channels of the detector \param nch number of channels to be written to file. if -1 defaults to the number of installed channels of the detector
\param offset start channel number \param offset start channel number
\returns OK or FAIL if it could not write the file or data=NULL \returns OK or FAIL if it could not write the file or data=NULL
*/ */
int writeDataFile(ofstream &outfile, float *data, float *err=NULL, float *ang=NULL, char dataformat='f', int nch=-1, int offset=0); int writeDataFile(ofstream &outfile, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int nch=-1, int offset=0);
/** /**
@ -193,10 +193,10 @@ class fileIO : public virtual slsDetectorBase {
\param err array of arrors on the data. If NULL no errors are expected on the file \param err array of arrors on the data. If NULL no errors are expected on the file
\param ang array of angular values. If NULL data are expected in the form chan-val(-err) otherwise ang-val(-err) \param ang array of angular values. If NULL data are expected in the form chan-val(-err) otherwise ang-val(-err)
\param dataformat format of the data: can be 'i' integer or 'f' float (default) \param dataformat format of the data: can be 'i' integer or 'f' double (default)
\returns OK or FAIL if it could not read the file or data=NULL \returns OK or FAIL if it could not read the file or data=NULL
*/ */
virtual int readDataFile(string fname, float *data, float *err=NULL, float *ang=NULL, char dataformat='f'); virtual int readDataFile(string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f');
/** /**
reads a data file reads a data file
@ -208,7 +208,7 @@ class fileIO : public virtual slsDetectorBase {
\param offset start channel number to be expected \param offset start channel number to be expected
\returns OK or FAIL if it could not read the file or data=NULL \returns OK or FAIL if it could not read the file or data=NULL
*/ */
int readDataFile(ifstream& infile, float *data, float *err=NULL, float *ang=NULL, char dataformat='f', int offset=0); int readDataFile(ifstream& infile, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int offset=0);
/** /**
reads a raw data file reads a raw data file
@ -250,12 +250,12 @@ class fileIO : public virtual slsDetectorBase {
\param data array of data values \param data array of data values
\param err array of arrors on the data. If NULL no errors will be written \param err array of arrors on the data. If NULL no errors will be written
\param ang array of angular values. If NULL data will be in the form chan-val(-err) otherwise ang-val(-err) \param ang array of angular values. If NULL data will be in the form chan-val(-err) otherwise ang-val(-err)
\param dataformat format of the data: can be 'i' integer or 'f' float (default) \param dataformat format of the data: can be 'i' integer or 'f' double (default)
\returns OK or FAIL if it could not write the file or data=NULL \returns OK or FAIL if it could not write the file or data=NULL
*/ */
static int writeDataFile(string fname, int nch, float *data, float *err=NULL, float *ang=NULL, char dataformat='f'); static int writeDataFile(string fname, int nch, double *data, double *err=NULL, double *ang=NULL, char dataformat='f');
/** /**
writes a data file writes a data file
\param outfile output file stream \param outfile output file stream
@ -263,11 +263,11 @@ class fileIO : public virtual slsDetectorBase {
\param data array of data values \param data array of data values
\param err array of arrors on the data. If NULL no errors will be written \param err array of arrors on the data. If NULL no errors will be written
\param ang array of angular values. If NULL data will be in the form chan-val(-err) otherwise ang-val(-err) \param ang array of angular values. If NULL data will be in the form chan-val(-err) otherwise ang-val(-err)
\param dataformat format of the data: can be 'i' integer or 'f' float (default) \param dataformat format of the data: can be 'i' integer or 'f' double (default)
\param offset start channel number \param offset start channel number
\returns OK or FAIL if it could not write the file or data=NULL \returns OK or FAIL if it could not write the file or data=NULL
*/ */
static int writeDataFile(ofstream &outfile, int nch, float *data, float *err=NULL, float *ang=NULL, char dataformat='f', int offset=0); static int writeDataFile(ofstream &outfile, int nch, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int offset=0);
/** /**
writes a raw data file writes a raw data file
@ -317,11 +317,11 @@ class fileIO : public virtual slsDetectorBase {
\param data array of data values to be filled \param data array of data values to be filled
\param err array of arrors on the data. If NULL no errors are expected on the file \param err array of arrors on the data. If NULL no errors are expected on the file
\param ang array of angular values. If NULL data are expected in the form chan-val(-err) otherwise ang-val(-err) \param ang array of angular values. If NULL data are expected in the form chan-val(-err) otherwise ang-val(-err)
\param dataformat format of the data: can be 'i' integer or 'f' float (default) \param dataformat format of the data: can be 'i' integer or 'f' double (default)
\returns number of channels read or -1 if it could not read the file or data=NULL \returns number of channels read or -1 if it could not read the file or data=NULL
*/ */
static int readDataFile(int nch, string fname, float *data, float *err=NULL, float *ang=NULL, char dataformat='f'); static int readDataFile(int nch, string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f');
/** /**
reads a data file reads a data file
\param nch number of channels \param nch number of channels
@ -329,12 +329,12 @@ class fileIO : public virtual slsDetectorBase {
\param data array of data values to be filled \param data array of data values to be filled
\param err array of arrors on the data. If NULL no errors are expected on the file \param err array of arrors on the data. If NULL no errors are expected on the file
\param ang array of angular values. If NULL data are expected in the form chan-val(-err) otherwise ang-val(-err) \param ang array of angular values. If NULL data are expected in the form chan-val(-err) otherwise ang-val(-err)
\param dataformat format of the data: can be 'i' integer or 'f' float (default) \param dataformat format of the data: can be 'i' integer or 'f' double (default)
\param offset start channel number \param offset start channel number
\returns number of channels read or -1 if it could not read the file or data=NULL \returns number of channels read or -1 if it could not read the file or data=NULL
*/ */
static int readDataFile(int nch, ifstream &infile, float *data, float *err=NULL, float *ang=NULL, char dataformat='f', int offset=0); static int readDataFile(int nch, ifstream &infile, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int offset=0);
/** /**
reads a raw data file reads a raw data file

View File

@ -21,8 +21,8 @@ postProcessing::postProcessing(){
int postProcessing::flatFieldCorrect(float datain, float errin, float &dataout, float &errout, float ffcoefficient, float fferr){ int postProcessing::flatFieldCorrect(double datain, double errin, double &dataout, double &errout, double ffcoefficient, double fferr){
float e; double e;
dataout=datain*ffcoefficient; dataout=datain*ffcoefficient;
@ -40,10 +40,10 @@ int postProcessing::flatFieldCorrect(float datain, float errin, float &dataout,
}; };
int postProcessing::rateCorrect(float datain, float errin, float &dataout, float &errout, float tau, float t){ int postProcessing::rateCorrect(double datain, double errin, double &dataout, double &errout, double tau, double t){
// float data; // double data;
float e; double e;
dataout=(datain*exp(tau*datain/t)); dataout=(datain*exp(tau*datain/t));
@ -139,7 +139,7 @@ int postProcessing::setBadChannelCorrection(ifstream &infile, int &nbad, int *ba
void postProcessing::processFrame(int *myData, int delflag) { void postProcessing::processFrame(int *myData, int delflag) {
string fname; string fname;
// float *fdata=NULL; // double *fdata=NULL;
incrementProgress(); incrementProgress();
@ -182,7 +182,7 @@ if(*correctionMask&(1<<WRITE_FILE))
void postProcessing::doProcessing(float *lfdata, int delflag, string fname) { void postProcessing::doProcessing(double *lfdata, int delflag, string fname) {
// /** write raw data file */ // /** write raw data file */
@ -193,9 +193,9 @@ void postProcessing::doProcessing(float *lfdata, int delflag, string fname) {
float *rcdata=NULL, *rcerr=NULL; double *rcdata=NULL, *rcerr=NULL;
float *ffcdata=NULL, *ffcerr=NULL; double *ffcdata=NULL, *ffcerr=NULL;
float *ang=NULL; double *ang=NULL;
// int imod; // int imod;
int np; int np;
//string fname; //string fname;
@ -207,8 +207,8 @@ void postProcessing::doProcessing(float *lfdata, int delflag, string fname) {
/** rate correction */ /** rate correction */
if (*correctionMask&(1<<RATE_CORRECTION)) { if (*correctionMask&(1<<RATE_CORRECTION)) {
rcdata=new float[getTotalNumberOfChannels()]; rcdata=new double[getTotalNumberOfChannels()];
rcerr=new float[getTotalNumberOfChannels()]; rcerr=new double[getTotalNumberOfChannels()];
rateCorrect(lfdata,NULL,rcdata,rcerr); rateCorrect(lfdata,NULL,rcdata,rcerr);
delete [] lfdata; delete [] lfdata;
} else { } else {
@ -222,8 +222,8 @@ void postProcessing::doProcessing(float *lfdata, int delflag, string fname) {
/** flat field correction */ /** flat field correction */
if (*correctionMask&(1<<FLAT_FIELD_CORRECTION)) { if (*correctionMask&(1<<FLAT_FIELD_CORRECTION)) {
ffcdata=new float[getTotalNumberOfChannels()]; ffcdata=new double[getTotalNumberOfChannels()];
ffcerr=new float[getTotalNumberOfChannels()]; ffcerr=new double[getTotalNumberOfChannels()];
flatFieldCorrect(rcdata,rcerr,ffcdata,ffcerr); flatFieldCorrect(rcdata,rcerr,ffcdata,ffcerr);
delete [] rcdata; delete [] rcdata;
rcdata=NULL; rcdata=NULL;
@ -425,8 +425,8 @@ int postProcessing::fillBadChannelMask() {
#ifdef VERBOSE #ifdef VERBOSE
cout << "deleting bad channel mask beacuse no bad channel correction is selected" << endl; cout << "deleting bad channel mask beacuse no bad channel correction is selected" << endl;
#endif #endif
if (badChannelMask) delete [] badChannelMask; //delete [] badChannelMask;
badChannelMask=NULL; //badChannelMask=NULL;
} }
} }

View File

@ -58,7 +58,7 @@ class postProcessing : public virtual angularConversion, public virtual fileIO
\param ecorr if !=NULL will be filled with the correction coefficients errors \param ecorr if !=NULL will be filled with the correction coefficients errors
\returns 0 if ff correction disabled, >0 otherwise \returns 0 if ff correction disabled, >0 otherwise
*/ */
virtual int getFlatFieldCorrection(float *corr=NULL, float *ecorr=NULL)=0; virtual int getFlatFieldCorrection(double *corr=NULL, double *ecorr=NULL)=0;
/** /**
set flat field corrections set flat field corrections
@ -66,7 +66,7 @@ class postProcessing : public virtual angularConversion, public virtual fileIO
\param ecorr if !=NULL the flat field correction errors will be filled with ecorr (1 otherwise) \param ecorr if !=NULL the flat field correction errors will be filled with ecorr (1 otherwise)
\returns 0 if ff correction disabled, >0 otherwise \returns 0 if ff correction disabled, >0 otherwise
*/ */
virtual int setFlatFieldCorrection(float *corr, float *ecorr=NULL)=0; virtual int setFlatFieldCorrection(double *corr, double *ecorr=NULL)=0;
/** /**
set bad channels correction set bad channels correction
@ -105,7 +105,7 @@ class postProcessing : public virtual angularConversion, public virtual fileIO
\param fferr erro on ffcoefficient \param fferr erro on ffcoefficient
\returns 0 \returns 0
*/ */
static int flatFieldCorrect(float datain, float errin, float &dataout, float &errout, float ffcoefficient, float fferr); static int flatFieldCorrect(double datain, double errin, double &dataout, double &errout, double ffcoefficient, double fferr);
/** /**
rate correct data rate correct data
@ -117,7 +117,7 @@ class postProcessing : public virtual angularConversion, public virtual fileIO
\param t acquisition time (in ns) \param t acquisition time (in ns)
\returns 0 \returns 0
*/ */
static int rateCorrect(float datain, float errin, float &dataout, float &errout, float tau, float t); static int rateCorrect(double datain, double errin, double &dataout, double &errout, double tau, double t);
int enableWriteToFile(int i=-1) {if (i>0) ((*correctionMask)|=(1<<WRITE_FILE)); if(i==0) ((*correctionMask)&=~(1<< WRITE_FILE)); return ((*correctionMask)&(1<< WRITE_FILE));}; int enableWriteToFile(int i=-1) {if (i>0) ((*correctionMask)|=(1<<WRITE_FILE)); if(i==0) ((*correctionMask)&=~(1<< WRITE_FILE)); return ((*correctionMask)&(1<< WRITE_FILE));};
@ -190,7 +190,7 @@ s
\returns nothing \returns nothing
*/ */
void doProcessing(float* myData, int delflag, string fname); void doProcessing(double* myData, int delflag, string fname);
/** /**
@ -229,8 +229,8 @@ s
virtual int rateCorrect(float*, float*, float*, float*)=0; virtual int rateCorrect(double*, double*, double*, double*)=0;
virtual int flatFieldCorrect(float*, float*, float*, float*)=0; virtual int flatFieldCorrect(double*, double*, double*, double*)=0;
@ -343,20 +343,20 @@ s
/** /**
I0 measured I0 measured
*/ */
float currentI0; double currentI0;
float *fdata; double *fdata;
// private: // private:
/* virtual void incrementProgress()=0; */ /* virtual void incrementProgress()=0; */
/* virtual float getCurrentProgress()=0; */ /* virtual double getCurrentProgress()=0; */
/* virtual void incrementFileIndex()=0; */ /* virtual void incrementFileIndex()=0; */
/* virtual int setTotalProgress()=0; */ /* virtual int setTotalProgress()=0; */
/* virtual float* decodeData(int *datain, float *fdata=NULL)=0; */ /* virtual double* decodeData(int *datain, double *fdata=NULL)=0; */
/* virtual int getTotalNumberOfChannels()=0; */ /* virtual int getTotalNumberOfChannels()=0; */

View File

@ -22,8 +22,8 @@ postProcessing::postProcessing(){
int postProcessing::flatFieldCorrect(float datain, float errin, float &dataout, float &errout, float ffcoefficient, float fferr){ int postProcessing::flatFieldCorrect(double datain, double errin, double &dataout, double &errout, double ffcoefficient, double fferr){
float e; double e;
dataout=datain*ffcoefficient; dataout=datain*ffcoefficient;
@ -41,10 +41,10 @@ int postProcessing::flatFieldCorrect(float datain, float errin, float &dataout,
}; };
int postProcessing::rateCorrect(float datain, float errin, float &dataout, float &errout, float tau, float t){ int postProcessing::rateCorrect(double datain, double errin, double &dataout, double &errout, double tau, double t){
// float data; // double data;
float e; double e;
dataout=(datain*exp(tau*datain/t)); dataout=(datain*exp(tau*datain/t));
@ -140,7 +140,7 @@ int postProcessing::setBadChannelCorrection(ifstream &infile, int &nbad, int *ba
void postProcessing::processFrame(int *myData, int delflag) { void postProcessing::processFrame(int *myData, int delflag) {
string fname; string fname;
// float *fdata=NULL; // double *fdata=NULL;
incrementProgress(); incrementProgress();
@ -183,7 +183,7 @@ fname=createFileName();
void postProcessing::doProcessing(float *lfdata, int delflag, string fname) { void postProcessing::doProcessing(double *lfdata, int delflag, string fname) {
// /** write raw data file */ // /** write raw data file */
@ -194,9 +194,9 @@ void postProcessing::doProcessing(float *lfdata, int delflag, string fname) {
float *rcdata=NULL, *rcerr=NULL; double *rcdata=NULL, *rcerr=NULL;
float *ffcdata=NULL, *ffcerr=NULL; double *ffcdata=NULL, *ffcerr=NULL;
float *ang=NULL; double *ang=NULL;
// int imod; // int imod;
int np; int np;
//string fname; //string fname;
@ -208,8 +208,8 @@ void postProcessing::doProcessing(float *lfdata, int delflag, string fname) {
/** rate correction */ /** rate correction */
if (*correctionMask&(1<<RATE_CORRECTION)) { if (*correctionMask&(1<<RATE_CORRECTION)) {
rcdata=new float[getTotalNumberOfChannels()]; rcdata=new double[getTotalNumberOfChannels()];
rcerr=new float[getTotalNumberOfChannels()]; rcerr=new double[getTotalNumberOfChannels()];
rateCorrect(lfdata,NULL,rcdata,rcerr); rateCorrect(lfdata,NULL,rcdata,rcerr);
delete [] lfdata; delete [] lfdata;
} else { } else {
@ -223,8 +223,8 @@ void postProcessing::doProcessing(float *lfdata, int delflag, string fname) {
/** flat field correction */ /** flat field correction */
if (*correctionMask&(1<<FLAT_FIELD_CORRECTION)) { if (*correctionMask&(1<<FLAT_FIELD_CORRECTION)) {
ffcdata=new float[getTotalNumberOfChannels()]; ffcdata=new double[getTotalNumberOfChannels()];
ffcerr=new float[getTotalNumberOfChannels()]; ffcerr=new double[getTotalNumberOfChannels()];
flatFieldCorrect(rcdata,rcerr,ffcdata,ffcerr); flatFieldCorrect(rcdata,rcerr,ffcdata,ffcerr);
delete [] rcdata; delete [] rcdata;
rcdata=NULL; rcdata=NULL;

View File

@ -58,7 +58,7 @@ class postProcessing : public virtual fileIO {
\param ecorr if !=NULL will be filled with the correction coefficients errors \param ecorr if !=NULL will be filled with the correction coefficients errors
\returns 0 if ff correction disabled, >0 otherwise \returns 0 if ff correction disabled, >0 otherwise
*/ */
virtual int getFlatFieldCorrection(float *corr=NULL, float *ecorr=NULL)=0; virtual int getFlatFieldCorrection(double *corr=NULL, double *ecorr=NULL)=0;
/** /**
set flat field corrections set flat field corrections
@ -66,7 +66,7 @@ class postProcessing : public virtual fileIO {
\param ecorr if !=NULL the flat field correction errors will be filled with ecorr (1 otherwise) \param ecorr if !=NULL the flat field correction errors will be filled with ecorr (1 otherwise)
\returns 0 if ff correction disabled, >0 otherwise \returns 0 if ff correction disabled, >0 otherwise
*/ */
virtual int setFlatFieldCorrection(float *corr, float *ecorr=NULL)=0; virtual int setFlatFieldCorrection(double *corr, double *ecorr=NULL)=0;
/** /**
set bad channels correction set bad channels correction
@ -105,7 +105,7 @@ class postProcessing : public virtual fileIO {
\param fferr erro on ffcoefficient \param fferr erro on ffcoefficient
\returns 0 \returns 0
*/ */
static int flatFieldCorrect(float datain, float errin, float &dataout, float &errout, float ffcoefficient, float fferr); static int flatFieldCorrect(double datain, double errin, double &dataout, double &errout, double ffcoefficient, double fferr);
/** /**
rate correct data rate correct data
@ -117,7 +117,7 @@ class postProcessing : public virtual fileIO {
\param t acquisition time (in ns) \param t acquisition time (in ns)
\returns 0 \returns 0
*/ */
static int rateCorrect(float datain, float errin, float &dataout, float &errout, float tau, float t); static int rateCorrect(double datain, double errin, double &dataout, double &errout, double tau, double t);
int enableWriteToFile(int i=-1) {if (i>0) ((*correctionMask)|=(1<<WRITE_FILE)); if(i==0) ((*correctionMask)&=~(1<< WRITE_FILE)); return ((*correctionMask)&(1<< WRITE_FILE));}; int enableWriteToFile(int i=-1) {if (i>0) ((*correctionMask)|=(1<<WRITE_FILE)); if(i==0) ((*correctionMask)&=~(1<< WRITE_FILE)); return ((*correctionMask)&(1<< WRITE_FILE));};
@ -190,7 +190,7 @@ s
\returns nothing \returns nothing
*/ */
void doProcessing(float* myData, int delflag, string fname); void doProcessing(double* myData, int delflag, string fname);
/** /**
@ -229,8 +229,8 @@ s
virtual int rateCorrect(float*, float*, float*, float*)=0; virtual int rateCorrect(double*, double*, double*, double*)=0;
virtual int flatFieldCorrect(float*, float*, float*, float*)=0; virtual int flatFieldCorrect(double*, double*, double*, double*)=0;
@ -326,9 +326,9 @@ s
/** /**
I0 measured I0 measured
*/ */
float currentI0; double currentI0;
float *fdata; double *fdata;

View File

@ -58,8 +58,8 @@ int bus_w(int addr,int val);
//read register //read register
int bus_r(int addr); int bus_r(int addr);
float setDAC(enum dacIndex ind, float val, int imod); double setDAC(enum dacIndex ind, double val, int imod);
float getADC(enum dacIndex ind, int imod); double getADC(enum dacIndex ind, int imod);
int setChannel(sls_detector_channel myChan); int setChannel(sls_detector_channel myChan);
int getChannel(sls_detector_channel *myChan); int getChannel(sls_detector_channel *myChan);

View File

@ -776,13 +776,13 @@ int read_register(int file_des) {
int set_dac(int file_des) { int set_dac(int file_des) {
float retval; double retval;
int ret=OK; int ret=OK;
int arg[2]; int arg[2];
enum dacIndex ind; enum dacIndex ind;
int imod; int imod;
int n; int n;
float val; double val;
sprintf(mess,"Can't set DAC\n"); sprintf(mess,"Can't set DAC\n");
@ -880,7 +880,7 @@ int set_dac(int file_des) {
int get_adc(int file_des) { int get_adc(int file_des) {
float retval; double retval;
int ret=OK; int ret=OK;
int arg[2]; int arg[2];
enum dacIndex ind; enum dacIndex ind;
@ -1239,8 +1239,8 @@ int set_module(int file_des) {
sls_detector_module myModule; sls_detector_module myModule;
int *myChip=malloc(getNumberOfChipsPerModule()*sizeof(int)); int *myChip=malloc(getNumberOfChipsPerModule()*sizeof(int));
int *myChan=malloc(getNumberOfChannelsPerModule()*sizeof(int)); int *myChan=malloc(getNumberOfChannelsPerModule()*sizeof(int));
float *myDac=malloc(getNumberOfDACsPerModule()*sizeof(int)); double *myDac=malloc(getNumberOfDACsPerModule()*sizeof(int));
float *myAdc=malloc(getNumberOfADCsPerModule()*sizeof(int)); double *myAdc=malloc(getNumberOfADCsPerModule()*sizeof(int));
int retval, n; int retval, n;
int ret=OK; int ret=OK;
int dr;//, ow; int dr;//, ow;
@ -1343,8 +1343,8 @@ int get_module(int file_des) {
sls_detector_module myModule; sls_detector_module myModule;
int *myChip=malloc(getNumberOfChipsPerModule()*sizeof(int)); int *myChip=malloc(getNumberOfChipsPerModule()*sizeof(int));
int *myChan=malloc(getNumberOfChannelsPerModule()*sizeof(int)); int *myChan=malloc(getNumberOfChannelsPerModule()*sizeof(int));
float *myDac=malloc(getNumberOfDACsPerModule()*sizeof(int)); double *myDac=malloc(getNumberOfDACsPerModule()*sizeof(int));
float *myAdc=malloc(getNumberOfADCsPerModule()*sizeof(int)); double *myAdc=malloc(getNumberOfADCsPerModule()*sizeof(int));
if (myDac) if (myDac)

View File

@ -3,8 +3,8 @@
#include <stdio.h> #include <stdio.h>
float pos; double pos;
float i0=0; double i0=0;
#ifdef EPICS #ifdef EPICS
#include <cadef.h> #include <cadef.h>
@ -119,15 +119,15 @@ int caput(chid ch_id, double value) {
*/ */
float angle(int ichan, float encoder, float totalOffset, float conv_r, float center, float offset, float tilt, int direction) { double angle(int ichan, double encoder, double totalOffset, double conv_r, double center, double offset, double tilt, int direction) {
(void) tilt; /* to avoid warning: unused parameter */ (void) tilt; /* to avoid warning: unused parameter */
float ang; double ang;
ang=180./PI*(center*conv_r+atan((float)(ichan-center)*conv_r))+encoder+totalOffset+offset; ang=180./PI*(center*conv_r+atan((double)(ichan-center)*conv_r))+encoder+totalOffset+offset;
cout <<"***" << offset << " " << ang << endl; cout <<"***" << offset << " " << ang << endl;
@ -139,7 +139,7 @@ float angle(int ichan, float encoder, float totalOffset, float conv_r, float cen
/* reads the encoder and returns the position */ /* reads the encoder and returns the position */
float get_position(void *ch_poarg) { double get_position(void *ch_poarg) {
#ifdef VERBOSE #ifdef VERBOSE
printf("Getting motor position \n"); printf("Getting motor position \n");
#endif #endif
@ -169,7 +169,7 @@ float get_position(void *ch_poarg) {
/* moves the encoder to position p */ /* moves the encoder to position p */
int go_to_position(float p,void *ch_parg) { int go_to_position(double p,void *ch_parg) {
#ifdef VERBOSE #ifdef VERBOSE
printf("Setting motor position \n"); printf("Setting motor position \n");
#endif #endif
@ -196,7 +196,7 @@ int go_to_position(float p,void *ch_parg) {
/* moves the encoder to position p without waiting */ /* moves the encoder to position p without waiting */
int go_to_position_no_wait(float p) { int go_to_position_no_wait(double p) {
#ifdef VERBOSE #ifdef VERBOSE
printf("Setting motor position no wait \n"); printf("Setting motor position no wait \n");
#endif #endif
@ -231,7 +231,7 @@ int go_to_position_no_wait(float p) {
/* reads I0 and returns the intensity */ /* reads I0 and returns the intensity */
float get_i0(void *ch_ioarg) { double get_i0(void *ch_ioarg) {
#ifdef VERBOSE #ifdef VERBOSE
printf("Getting I0 readout \n"); printf("Getting I0 readout \n");
#endif #endif

View File

@ -3,8 +3,8 @@
#include <stdio.h> #include <stdio.h>
float pos; double pos;
float i0=0; double i0=0;
#ifdef EPICS #ifdef EPICS
#include <cadef.h> #include <cadef.h>
@ -118,13 +118,13 @@ int caput(chid ch_id, double value) {
*/ */
float defaultAngleFunction(float ichan, float encoder, float totalOffset, float conv_r, float center, float offset, float tilt, int direction) { double defaultAngleFunction(double ichan, double encoder, double totalOffset, double conv_r, double center, double offset, double tilt, int direction) {
(void) tilt; /* to avoid warning: unused parameter */ (void) tilt; /* to avoid warning: unused parameter */
float ang; double ang;
ang=180./PI*(center*conv_r+direction*atan((float)(ichan-center)*conv_r))+encoder+totalOffset+offset; ang=180./PI*(center*conv_r+direction*atan((double)(ichan-center)*conv_r))+encoder+totalOffset+offset;
@ -134,7 +134,7 @@ float defaultAngleFunction(float ichan, float encoder, float totalOffset, float
/* reads the encoder and returns the position */ /* reads the encoder and returns the position */
float defaultGetPosition(void *d) { double defaultGetPosition(void *d) {
#ifdef VERBOSE #ifdef VERBOSE
printf("Getting motor position \n"); printf("Getting motor position \n");
#endif #endif
@ -165,7 +165,7 @@ float defaultGetPosition(void *d) {
/* moves the encoder to position p */ /* moves the encoder to position p */
int defaultGoToPosition(float p,void *d) { int defaultGoToPosition(double p,void *d) {
#ifdef VERBOSE #ifdef VERBOSE
printf("Setting motor position \n"); printf("Setting motor position \n");
#endif #endif
@ -193,7 +193,7 @@ int defaultGoToPosition(float p,void *d) {
/* moves the encoder to position p without waiting */ /* moves the encoder to position p without waiting */
int defaultGoToPositionNoWait(float p,void *d) { int defaultGoToPositionNoWait(double p,void *d) {
#ifdef VERBOSE #ifdef VERBOSE
printf("Setting motor position no wait \n"); printf("Setting motor position no wait \n");
#endif #endif
@ -224,7 +224,7 @@ int defaultGoToPositionNoWait(float p,void *d) {
/* reads I0 and returns the intensity */ /* reads I0 and returns the intensity */
float defaultGetI0(int t,void *d) { double defaultGetI0(int t,void *d) {
#ifdef VERBOSE #ifdef VERBOSE
printf("Getting I0 readout \n"); printf("Getting I0 readout \n");
#endif #endif

View File

@ -29,13 +29,13 @@ extern "C" {
#endif #endif
float defaultAngleFunction(float ichan, float encoder, float totalOffset, float conv_r, float center, float offset, float tilt, int direction); double defaultAngleFunction(double ichan, double encoder, double totalOffset, double conv_r, double center, double offset, double tilt, int direction);
float defaultGetPosition(void *d); double defaultGetPosition(void *d);
int defaultGoToPosition(float p,void *d); int defaultGoToPosition(double p,void *d);
int defaultGoToPositionNoWait(float p,void *d); int defaultGoToPositionNoWait(double p,void *d);
int defaultConnectChannels(void *d); int defaultConnectChannels(void *d);
int defaultDisconnectChannels(void *d); int defaultDisconnectChannels(void *d);
float defaultGetI0(int t,void *d); double defaultGetI0(int t,void *d);
int defaultDataReadyFunc(detectorData* d, void* p); int defaultDataReadyFunc(detectorData* d, void* p);