From 5aebcd4888e722615bdfa2efa2b5f0d4228e1248 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 2 Aug 2012 12:58:08 +0000 Subject: [PATCH] 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 --- .../commonFiles/communication_funcs.c | 24 ++--- .../commonFiles/sls_detector_defs.h | 28 ++--- .../communication_funcs.c | 24 ++--- .../gotthardDetectorServer/firmware_funcs.c | 6 +- .../gotthardDetectorServer/firmware_funcs.h | 2 +- .../gotthardDetectorServer/mcb_funcs.c | 48 ++++----- .../gotthardDetectorServer/mcb_funcs.h | 8 +- .../gotthardDetectorServer/server_funcs.c | 14 +-- .../gotthardDetectorServer/trimming_funcs.c | 12 +-- .../multiSlsDetector/multiSlsDetector.cpp | 62 +++++------ .../multiSlsDetector/multiSlsDetector.h | 54 +++++----- .../mythenDetectorServer/mcb_funcs.c | 44 ++++---- .../mythenDetectorServer/mcb_funcs.h | 6 +- .../mythenDetectorServer/server_funcs.c | 14 +-- .../mythenDetectorServer/trimming_funcs.c | 14 +-- .../slsDetector/slsDetector.cpp | 100 +++++++++--------- slsDetectorSoftware/slsDetector/slsDetector.h | 58 +++++----- .../slsDetector/slsDetectorActions.cpp | 8 +- .../slsDetector/slsDetectorActions.h | 14 +-- .../slsDetector/slsDetectorBase.h | 20 ++-- .../slsDetector/slsDetectorCommand.cpp | 36 +++---- .../slsDetector/slsDetectorUsers.h | 12 +-- .../slsDetector/slsDetectorUtils.cpp | 10 +- .../slsDetector/slsDetectorUtils.h | 34 +++--- .../AngularConversion_Standalone.cpp | 44 ++++---- .../AngularConversion_Standalone.h | 86 +++++++-------- .../slsDetectorAnalysis/TSlsDetectorDict.cpp | 8 +- .../angularCalibration.cpp | 12 +-- .../slsDetectorAnalysis/angularCalibration.h | 42 ++++---- .../slsDetectorAnalysis/angularConversion.cpp | 42 ++++---- .../slsDetectorAnalysis/angularConversion.h | 84 +++++++-------- .../slsDetectorAnalysis/detectorData.h | 10 +- .../slsDetectorAnalysis/energyCalibration.cpp | 8 +- .../slsDetectorAnalysis/energyCalibration.h | 6 +- .../slsDetectorAnalysis/energyConversion.cpp | 4 +- .../slsDetectorAnalysis/energyConversion.h | 4 +- .../slsDetectorAnalysis/fileIO.cpp | 26 ++--- .../slsDetectorAnalysis/fileIO.h | 34 +++--- .../slsDetectorAnalysis/postProcessing.cpp | 32 +++--- .../slsDetectorAnalysis/postProcessing.h | 22 ++-- .../postProcessing_Standalone.cpp | 28 ++--- .../postProcessing_Standalone.h | 18 ++-- .../slsDetectorFunctionList.h | 4 +- .../slsDetectorServer_funcs.c | 14 +-- .../usersFunctions/usersFunctions.c | 18 ++-- .../usersFunctions/usersFunctions.cpp | 18 ++-- .../usersFunctions/usersFunctions.h | 10 +- 47 files changed, 615 insertions(+), 611 deletions(-) diff --git a/slsDetectorSoftware/commonFiles/communication_funcs.c b/slsDetectorSoftware/commonFiles/communication_funcs.c index f8b0ec5fe..63b8e1f00 100755 --- a/slsDetectorSoftware/commonFiles/communication_funcs.c +++ b/slsDetectorSoftware/commonFiles/communication_funcs.c @@ -362,13 +362,13 @@ int sendModule(int file_des, sls_detector_module *myMod) { #ifdef VERBOSE printf("module %d of size %d sent\n",myMod->module, ts); #endif - ts+= sendDataOnly(file_des,myMod->dacs,sizeof(float)*nDacs); + ts+= sendDataOnly(file_des,myMod->dacs,sizeof(double)*nDacs); #ifdef VERBOSE printf("dacs %d of size %d sent\n",myMod->module, ts); for (idac=0; idac< nDacs; idac++) printf("dac %d is %d\n",idac,myMod->dacs[idac]); #endif - ts+= sendDataOnly(file_des,myMod->adcs,sizeof(float)*nAdcs); + ts+= sendDataOnly(file_des,myMod->adcs,sizeof(double)*nAdcs); #ifdef VERBOSE printf("adcs %d of size %d sent\n",myMod->module, ts); #endif @@ -432,8 +432,8 @@ int receiveChip(int file_des, sls_detector_chip* myChip) { int receiveModule(int file_des, sls_detector_module* myMod) { - float *dacptr=myMod->dacs; - float *adcptr=myMod->adcs; + double *dacptr=myMod->dacs; + double *adcptr=myMod->adcs; int *chipptr=myMod->chipregs, *chanptr=myMod->chanregs; int ts=0; 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); #endif if (ndacdiff<=0) { - ts+=receiveDataOnly(file_des,myMod->dacs, sizeof(float)*nDacs); + ts+=receiveDataOnly(file_des,myMod->dacs, sizeof(double)*nDacs); #ifdef VERBOSE printf("dacs received\n"); #endif } else { - dacptr=malloc(ndacdiff*sizeof(float)); + dacptr=malloc(ndacdiff*sizeof(double)); myMod->ndac=ndold; - ts+=receiveDataOnly(file_des,myMod->dacs, sizeof(float)*ndold); - ts+=receiveDataOnly(file_des,dacptr, sizeof(float)*ndacdiff); + ts+=receiveDataOnly(file_des,myMod->dacs, sizeof(double)*ndold); + ts+=receiveDataOnly(file_des,dacptr, sizeof(double)*ndacdiff); free(dacptr); return FAIL; } if (nadcdiff<=0) { - ts+=receiveDataOnly(file_des,myMod->adcs, sizeof(float)*nAdcs); + ts+=receiveDataOnly(file_des,myMod->adcs, sizeof(double)*nAdcs); #ifdef VERBOSE printf("adcs received\n"); #endif } else { - adcptr=malloc(nadcdiff*sizeof(float)); + adcptr=malloc(nadcdiff*sizeof(double)); myMod->nadc=naold; - ts+=receiveDataOnly(file_des,myMod->adcs, sizeof(float)*naold); - ts+=receiveDataOnly(file_des,adcptr, sizeof(float)*nadcdiff); + ts+=receiveDataOnly(file_des,myMod->adcs, sizeof(double)*naold); + ts+=receiveDataOnly(file_des,adcptr, sizeof(double)*nadcdiff); free(adcptr); return FAIL; } diff --git a/slsDetectorSoftware/commonFiles/sls_detector_defs.h b/slsDetectorSoftware/commonFiles/sls_detector_defs.h index f7ab2698a..ac8babb21 100755 --- a/slsDetectorSoftware/commonFiles/sls_detector_defs.h +++ b/slsDetectorSoftware/commonFiles/sls_detector_defs.h @@ -12,10 +12,10 @@ /** maxmimum number of detectors ina multidetector structure*/ #define MAXDET 100 -typedef float float32_t; +typedef double double32_t; typedef int int32_t; typedef char mystring[MAX_STR_LENGTH]; -typedef float mysteps[MAX_SCAN_STEPS]; +typedef double mysteps[MAX_SCAN_STEPS]; /** \file sls_detector_defs.h @@ -102,14 +102,14 @@ typedef struct { int nadc; /**< is the number of adcs on the module */ int reg; /**< is the module register (e.g. dynamic range?) \see moduleRegisterBit */ - float *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 *dacs; /**< is the pointer to the array of the dac values (in V) */ + 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 \see ::chipRegisterBit */ int *chanregs; /**< is the pointer to the array of the channel registers \see ::channelRegisterBit */ - float gain; /**< is the module gain (V/keV) */ - float offset; /**< is the module offset (V) */ + double gain; /**< is the module gain (V/keV) */ + double offset; /**< is the module offset (V) */ } sls_detector_module; /** @@ -464,14 +464,14 @@ enum imageType { /* angular conversion constant for a module */ /* *\/ */ /* typedef struct { */ -/* float center; /\**< center of the module (channel at which the radius is perpendicular to the module surface) *\/ */ -/* float ecenter; /\**< error in the center determination *\/ */ -/* float r_conversion; /\**< detector pixel size (or strip pitch) divided by the diffractometer radius *\/ */ -/* float 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 *\/ */ -/* float eoffset; /\**< error in the offset determination *\/ */ -/* float tilt; /\**< ossible tilt in the orthogonal direction (unused)*\/ */ -/* float etilt; /\**< error in the tilt determination *\/ */ +/* double center; /\**< center of the module (channel at which the radius is perpendicular to the module surface) *\/ */ +/* double ecenter; /\**< error in the center determination *\/ */ +/* double r_conversion; /\**< detector pixel size (or strip pitch) divided by the diffractometer radius *\/ */ +/* double er_conversion; /\**< error in the r_conversion determination *\/ */ +/* double offset; /\**< the module offset i.e. the position of channel 0 with respect to the diffractometer 0 *\/ */ +/* double eoffset; /\**< error in the offset determination *\/ */ +/* double tilt; /\**< ossible tilt in the orthogonal direction (unused)*\/ */ +/* double etilt; /\**< error in the tilt determination *\/ */ /* } angleConversionConstant; */ diff --git a/slsDetectorSoftware/gotthardDetectorServer/communication_funcs.c b/slsDetectorSoftware/gotthardDetectorServer/communication_funcs.c index 3b6054776..de00290c6 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/communication_funcs.c +++ b/slsDetectorSoftware/gotthardDetectorServer/communication_funcs.c @@ -291,13 +291,13 @@ int sendModule(int file_des, sls_detector_module *myMod) { #ifdef VERBOSE printf("module %d of size %d sent\n",myMod->module, ts); #endif - ts+= sendDataOnly(file_des,myMod->dacs,sizeof(float)*nDacs); + ts+= sendDataOnly(file_des,myMod->dacs,sizeof(double)*nDacs); #ifdef VERBOSE printf("dacs %d of size %d sent\n",myMod->module, ts); for (idac=0; idac< nDacs; idac++) printf("dac %d is %d\n",idac,myMod->dacs[idac]); #endif - ts+= sendDataOnly(file_des,myMod->adcs,sizeof(float)*nAdcs); + ts+= sendDataOnly(file_des,myMod->adcs,sizeof(double)*nAdcs); #ifdef VERBOSE printf("adcs %d of size %d sent\n",myMod->module, ts); #endif @@ -361,8 +361,8 @@ int receiveChip(int file_des, sls_detector_chip* myChip) { int receiveModule(int file_des, sls_detector_module* myMod) { - float *dacptr=myMod->dacs; - float *adcptr=myMod->adcs; + double *dacptr=myMod->dacs; + double *adcptr=myMod->adcs; int *chipptr=myMod->chipregs, *chanptr=myMod->chanregs; int ts=0; 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); #endif if (ndacdiff<=0) { - ts+=receiveDataOnly(file_des,myMod->dacs, sizeof(float)*nDacs); + ts+=receiveDataOnly(file_des,myMod->dacs, sizeof(double)*nDacs); #ifdef VERBOSE printf("dacs received\n"); #endif } else { - dacptr=malloc(ndacdiff*sizeof(float)); + dacptr=malloc(ndacdiff*sizeof(double)); myMod->ndac=ndold; - ts+=receiveDataOnly(file_des,myMod->dacs, sizeof(float)*ndold); - ts+=receiveDataOnly(file_des,dacptr, sizeof(float)*ndacdiff); + ts+=receiveDataOnly(file_des,myMod->dacs, sizeof(double)*ndold); + ts+=receiveDataOnly(file_des,dacptr, sizeof(double)*ndacdiff); free(dacptr); return FAIL; } if (nadcdiff<=0) { - ts+=receiveDataOnly(file_des,myMod->adcs, sizeof(float)*nAdcs); + ts+=receiveDataOnly(file_des,myMod->adcs, sizeof(double)*nAdcs); #ifdef VERBOSE printf("adcs received\n"); #endif } else { - adcptr=malloc(nadcdiff*sizeof(float)); + adcptr=malloc(nadcdiff*sizeof(double)); myMod->nadc=naold; - ts+=receiveDataOnly(file_des,myMod->adcs, sizeof(float)*naold); - ts+=receiveDataOnly(file_des,adcptr, sizeof(float)*nadcdiff); + ts+=receiveDataOnly(file_des,myMod->adcs, sizeof(double)*naold); + ts+=receiveDataOnly(file_des,adcptr, sizeof(double)*nadcdiff); free(adcptr); return FAIL; } diff --git a/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.c b/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.c index 04d47cf32..89500f882 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.c +++ b/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.c @@ -1208,8 +1208,8 @@ int setDACRegister(int idac, int val, int imod) { } -float getTemperature(int tempSensor, int imod){ - float val; +double getTemperature(int tempSensor, int imod){ + double val; char cTempSensor[2][100]={"ADCs/ASICs","VRs/FPGAs"}; imod=0;//ignoring more than 1 mod for now 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 - val=((float)tempVal)/4.0; + val=((double)tempVal)/4.0; #ifdef VERBOSE printf("Temperature of module:%d for the %s is %.2fC\n",imod,cTempSensor[tempSensor],val); diff --git a/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.h b/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.h index 33d16e7d8..180783b33 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.h +++ b/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.h @@ -56,7 +56,7 @@ int setContinousReadOut(int d); 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 initConfGain(int isettings,int val,int imod); diff --git a/slsDetectorSoftware/gotthardDetectorServer/mcb_funcs.c b/slsDetectorSoftware/gotthardDetectorServer/mcb_funcs.c index fde7a0a78..f6e13b7b6 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/mcb_funcs.c +++ b/slsDetectorSoftware/gotthardDetectorServer/mcb_funcs.c @@ -37,8 +37,8 @@ const int noneSelected=-1; sls_detector_module *detectorModules=NULL; int *detectorChips=NULL; int *detectorChans=NULL; -float *detectorDacs=NULL; -float *detectorAdcs=NULL; +double *detectorDacs=NULL; +double *detectorAdcs=NULL; //int numberOfProbes; @@ -56,8 +56,8 @@ int initDetector() { detectorModules=malloc(n*sizeof(sls_detector_module)); detectorChips=malloc(n*NCHIP*sizeof(int)); detectorChans=malloc(n*NCHIP*NCHAN*sizeof(int)); - detectorDacs=malloc(n*NDAC*sizeof(float)); - detectorAdcs=malloc(n*NADC*sizeof(float)); + detectorDacs=malloc(n*NDAC*sizeof(double)); + detectorAdcs=malloc(n*NADC*sizeof(double)); #ifdef VERBOSE printf("modules from 0x%x to 0x%x\n",(unsigned int)(detectorModules), (unsigned int)(detectorModules+n)); 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; } -float initDACbyIndex(int ind,float val, int imod) { +double initDACbyIndex(int ind,double val, int imod) { int v; - const float partref[NDAC]=PARTREF; - const float partr1[NDAC]=PARTR1; - const float partr2[NDAC]=PARTR2; + const double partref[NDAC]=PARTREF; + const double partr1[NDAC]=PARTR1; + const double partr2[NDAC]=PARTR2; - float ref=partref[ind]; - float r1=partr1[ind]; - float r2=partr2[ind]; + double ref=partref[ind]; + double r1=partr1[ind]; + double r2=partr2[ind]; v=(val+(val-ref)*r1/r2)*DAC_DR/DAC_MAX; @@ -557,10 +557,10 @@ float initDACbyIndex(int ind,float val, int imod) { return (v*DAC_MAX/DAC_DR+ref*r1/r2)/(1+r1/r2); } -float initDACbyIndexDACU(int ind, int val, int imod) { +double initDACbyIndexDACU(int ind, int val, int imod) { - // const float daccs[NDAC]=DACCS; - // const float dacaddr[NDAC]=DACADDR; + // const double daccs[NDAC]=DACCS; + // const double dacaddr[NDAC]=DACADDR; // int cs=daccs[ind]; // int addr=dacaddr[ind]; @@ -601,9 +601,9 @@ float initDACbyIndexDACU(int ind, int val, int imod) { } int getThresholdEnergy() { - float g[3]=DEFAULTGAIN; - float o[3]=DEFAULTOFFSET; - float myg=-1, myo=-1; + double g[3]=DEFAULTGAIN; + double o[3]=DEFAULTOFFSET; + double myg=-1, myo=-1; // int dacu; int imod; int ethr=-1; @@ -643,7 +643,7 @@ int getThresholdEnergy() { } #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,(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); #endif @@ -659,9 +659,9 @@ int getThresholdEnergy() { } int setThresholdEnergy(int ethr) { - float g[3]=DEFAULTGAIN; - float o[3]=DEFAULTOFFSET; - float myg=-1, myo=-1; + double g[3]=DEFAULTGAIN; + double o[3]=DEFAULTOFFSET; + double myg=-1, myo=-1; int dacu; int imod; int ret=ethr; @@ -698,7 +698,7 @@ int setThresholdEnergy(int ethr) { myg=-1; } if (myg>0 && myo>0) { - dacu=myo-myg*((float)ethr)/1000.; + dacu=myo-myg*((double)ethr)/1000.; #ifdef VERBOSE printf("module %d (%x): gain %f, off %f, energy %d eV, dac %d\n",imod,(unsigned int)((detectorModules+imod)),(detectorModules+imod)->gain,(detectorModules+imod)->offset, ethr,dacu); #endif @@ -715,7 +715,7 @@ int setThresholdEnergy(int ethr) { -float getDACbyIndexDACU(int ind, int imod) { +double getDACbyIndexDACU(int ind, int imod) { /* if (detectorDacs) { if (imodnumberOfChannels]; + dataout=new double[thisMultiDetector->numberOfChannels]; // int ich=0; - float *detp=dataout; + double *detp=dataout; int *datap=datain; @@ -1605,8 +1605,8 @@ float* multiSlsDetector::decodeData(int *datain, float *fdata) { int multiSlsDetector::setFlatFieldCorrection(string fname){ - float data[thisMultiDetector->numberOfChannels], xmed[thisMultiDetector->numberOfChannels]; - float ffcoefficients[thisMultiDetector->numberOfChannels], fferrors[thisMultiDetector->numberOfChannels]; + double data[thisMultiDetector->numberOfChannels], xmed[thisMultiDetector->numberOfChannels]; + double ffcoefficients[thisMultiDetector->numberOfChannels], fferrors[thisMultiDetector->numberOfChannels]; int nmed=0; int idet=0, ichdet=-1; 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; - float *p, *ep; + double *p, *ep; for (int idet=0; idetnumberOfDetectors; idet++) { if (detectors[idet]) { 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; - float *p, *ep; + double *p, *ep; for (int idet=0; idetnumberOfDetectors; idet++) { if (detectors[idet]) { 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; - float *perr=errin;//*pdata, + double *perr=errin;//*pdata, for (int idet=0; idetnumberOfDetectors; idet++) { if (detectors[idet]) { #ifdef VERBOSE @@ -1887,8 +1887,8 @@ int multiSlsDetector::flatFieldCorrect(float* datain, float *errin, float* datao -int multiSlsDetector::setRateCorrection(float t){ - // float tdead[]=defaultTDead; +int multiSlsDetector::setRateCorrection(double t){ + // double tdead[]=defaultTDead; if (t==0) { thisMultiDetector->correctionMask&=~(1<correctionMask&(1<correctionMask&(1<numberOfDetectors; idet++) { if (detectors[idet]) { if (errin) @@ -2157,8 +2157,8 @@ int multiSlsDetector::getAngularConversion(int &direction, angleConversionCons -float multiSlsDetector::setDAC(float val, dacIndex idac, int imod) { - float ret, ret1=-100; +double multiSlsDetector::setDAC(double val, dacIndex idac, int imod) { + double ret, ret1=-100; int id=-1, im=-1; int dmi=0, dma=thisMultiDetector->numberOfDetectors; @@ -2180,8 +2180,8 @@ float multiSlsDetector::setDAC(float val, dacIndex idac, int imod) { return ret1; } -float multiSlsDetector::getADC(dacIndex idac, int imod) { - float ret, ret1=-100; +double multiSlsDetector::getADC(dacIndex idac, int imod) { + double ret, ret1=-100; int id=-1, im=-1; 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 */ -float multiSlsDetector::setAngularConversionParameter(angleConversionParameter c, float v) { - float ret=slsDetectorUtils::setAngularConversionParameter(c,v); +double multiSlsDetector::setAngularConversionParameter(angleConversionParameter c, double v) { + double ret=slsDetectorUtils::setAngularConversionParameter(c,v); for (int idet=0; idetnumberOfDetectors; idet++) { if (detectors[idet]) { @@ -2248,10 +2248,10 @@ float multiSlsDetector::setAngularConversionParameter(angleConversionParameter c -// float* multiSlsDetector::convertAngles(float pos) { -// float *ang=new float[thisMultiDetector->numberOfChannels]; +// double* multiSlsDetector::convertAngles(double pos) { +// double *ang=new double[thisMultiDetector->numberOfChannels]; -// float *p=ang; +// double *p=ang; // int choff=0; // for (int idet=0; idetnumberOfDetectors; 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 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; int choff=0, off=0; //idata, - float *pe=err, *pa=ang; + double *pe=err, *pa=ang; int nch_left=nch, n, nd; 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 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; string str; int choff=0, off=0; - float *pe=err, *pa=ang; + double *pe=err, *pa=ang; #ifdef VERBOSE std::cout<< "Opening file "<< fname << std::endl; diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h index a3c7830dc..7c6034d54 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h @@ -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) */ int threadedProcessing; /** 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 */ int angDirection; /** 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) */ - float globalOffset; + double globalOffset; /** bin size for data merging */ - float binSize; + double binSize; /** number of positions at which the detector should acquire */ int numberOfPositions; /** 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;}; - 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) \param pos position of the detector \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) \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 @@ -630,7 +630,7 @@ class multiSlsDetector : public slsDetectorUtils { \param ecorr if !=NULL will be filled with the correction coefficients errors \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 \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 \returns 0 if rate correction disabled, >0 otherwise */ - int getRateCorrection(float &t); + int getRateCorrection(double &t); /** get rate correction tau \returns 0 if rate correction disabled, otherwise the tau used for the correction */ - float getRateCorrectionTau(); + double getRateCorrectionTau(); /** get rate correction \returns 0 if rate correction disabled, >0 otherwise @@ -703,17 +703,17 @@ class multiSlsDetector : public slsDetectorUtils { 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 - \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 \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 @@ -738,7 +738,7 @@ class multiSlsDetector : public slsDetectorUtils { \param errout error on corrected data (if not NULL) \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) \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 @@ -762,7 +762,7 @@ class multiSlsDetector : public slsDetectorUtils { \param errout error on corrected data (if not NULL) \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 @@ -785,7 +785,7 @@ class multiSlsDetector : public slsDetectorUtils { /////////////////////////////////////// int setTotalProgress(); ////////////// from slsDetectorUtils! /** 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) \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 \param val value (in V) @@ -803,7 +803,7 @@ class multiSlsDetector : public slsDetectorUtils { \param imod module number (if -1 alla modules) \returns current DAC value */ - float getADC(dacIndex index, int imod=0); + double getADC(dacIndex index, int imod=0); /** configure channel \param reg channel register @@ -903,7 +903,7 @@ class multiSlsDetector : public slsDetectorUtils { \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 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 \returns OK or FAIL if it could not write the file or data=NULL \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 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 \returns OK or FAIL if it could not read the file or data=NULL \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'); /** diff --git a/slsDetectorSoftware/mythenDetectorServer/mcb_funcs.c b/slsDetectorSoftware/mythenDetectorServer/mcb_funcs.c index e3f3d0eba..f91ce4b3e 100755 --- a/slsDetectorSoftware/mythenDetectorServer/mcb_funcs.c +++ b/slsDetectorSoftware/mythenDetectorServer/mcb_funcs.c @@ -38,8 +38,8 @@ const int noneSelected=-1; sls_detector_module *detectorModules=NULL; int *detectorChips=NULL; int *detectorChans=NULL; -float *detectorDacs=NULL; -float *detectorAdcs=NULL; +double *detectorDacs=NULL; +double *detectorAdcs=NULL; //int numberOfProbes; @@ -61,8 +61,8 @@ int initDetector() { detectorChips=malloc(n*NCHIP*sizeof(int)); detectorChans=malloc(n*NCHIP*NCHAN*sizeof(int)); - detectorDacs=malloc(n*NDAC*sizeof(float)); - detectorAdcs=malloc(n*NADC*sizeof(float)); + detectorDacs=malloc(n*NDAC*sizeof(double)); + detectorAdcs=malloc(n*NADC*sizeof(double)); #ifdef VERBOSE printf("modules from 0x%x to 0x%x\n",detectorModules, detectorModules+n); printf("chips from 0x%x to 0x%x\n",detectorChips, detectorChips+n*NCHIP); @@ -640,15 +640,15 @@ int set_one_dac(int imod) { return OK; } -float initDACbyIndex(int ind,float val, int imod) { +double initDACbyIndex(int ind,double val, int imod) { int v; - const float partref[NDAC]=PARTREF; - const float partr1[NDAC]=PARTR1; - const float partr2[NDAC]=PARTR2; + const double partref[NDAC]=PARTREF; + const double partr1[NDAC]=PARTR1; + const double partr2[NDAC]=PARTR2; - float ref=partref[ind]; - float r1=partr1[ind]; - float r2=partr2[ind]; + double ref=partref[ind]; + double r1=partr1[ind]; + double r2=partr2[ind]; v=(val+(val-ref)*r1/r2)*DAC_DR/DAC_MAX; @@ -657,10 +657,10 @@ float initDACbyIndex(int ind,float val, int imod) { return (v*DAC_MAX/DAC_DR+ref*r1/r2)/(1+r1/r2); } -float initDACbyIndexDACU(int ind, int val, int imod) { +double initDACbyIndexDACU(int ind, int val, int imod) { - const float daccs[NDAC]=DACCS; - const float dacaddr[NDAC]=DACADDR; + const double daccs[NDAC]=DACCS; + const double dacaddr[NDAC]=DACADDR; int cs=daccs[ind]; int addr=dacaddr[ind]; @@ -706,9 +706,9 @@ float initDACbyIndexDACU(int ind, int val, int imod) { } int getThresholdEnergy() { - float g[3]=DEFAULTGAIN; - float o[3]=DEFAULTOFFSET; - float myg=-1, myo=-1; + double g[3]=DEFAULTGAIN; + double o[3]=DEFAULTOFFSET; + double myg=-1, myo=-1; // int dacu; int imod; int ethr=-1; @@ -764,9 +764,9 @@ int getThresholdEnergy() { } int setThresholdEnergy(int ethr) { - float g[3]=DEFAULTGAIN; - float o[3]=DEFAULTOFFSET; - float myg=-1, myo=-1; + double g[3]=DEFAULTGAIN; + double o[3]=DEFAULTOFFSET; + double myg=-1, myo=-1; int dacu; int imod; int ret=ethr; @@ -803,7 +803,7 @@ int setThresholdEnergy(int ethr) { myg=-1; } if (myg>0 && myo>0) { - dacu=myo-myg*((float)ethr)/1000.; + dacu=myo-myg*((double)ethr)/1000.; #ifdef VERBOSE printf("module %d (%x): gain %f, off %f, energy %d eV, dac %d\n",imod,(detectorModules+imod),(detectorModules+imod)->gain,(detectorModules+imod)->offset, ethr,dacu); #endif @@ -820,7 +820,7 @@ int setThresholdEnergy(int ethr) { -float getDACbyIndexDACU(int ind, int imod) { +double getDACbyIndexDACU(int ind, int imod) { /* if (detectorDacs) { if (imodffoff=sizeof(sharedSlsDetector); - thisDetector->fferroff=thisDetector->ffoff+sizeof(float)*thisDetector->nChans*thisDetector->nChips*thisDetector->nModsMax; - thisDetector->modoff= thisDetector->fferroff+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(double)*thisDetector->nChans*thisDetector->nChips*thisDetector->nModsMax; thisDetector->dacoff=thisDetector->modoff+sizeof(sls_detector_module)*thisDetector->nModsMax; - thisDetector->adcoff=thisDetector->dacoff+sizeof(float)*thisDetector->nDacs*thisDetector->nModsMax; - thisDetector->chipoff=thisDetector->adcoff+sizeof(float)*thisDetector->nAdcs*thisDetector->nModsMax; + thisDetector->adcoff=thisDetector->dacoff+sizeof(double)*thisDetector->nDacs*thisDetector->nModsMax; + thisDetector->chipoff=thisDetector->adcoff+sizeof(double)*thisDetector->nAdcs*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 */ - ffcoefficients=(float*)(goff+thisDetector->ffoff); - fferrors=(float*)(goff+thisDetector->fferroff); + ffcoefficients=(double*)(goff+thisDetector->ffoff); + fferrors=(double*)(goff+thisDetector->fferroff); detectorModules=(sls_detector_module*)(goff+ thisDetector->modoff); #ifdef VERBOSE // for (int imod=0; imod< thisDetector->nModsMax; imod++) // std::cout<< hex << detectorModules+imod << dec <dacoff); - adcs=(float*)(goff+thisDetector->adcoff); + dacs=(double*)(goff+thisDetector->dacoff); + adcs=(double*)(goff+thisDetector->adcoff); chipregs=(int*)(goff+thisDetector->chipoff); chanregs=(int*)(goff+thisDetector->chanoff); if (thisDetector->alreadyExisting==0) { @@ -774,8 +774,8 @@ slsDetectorDefs::sls_detector_module* slsDetector::createModule(detectorType t) na=0; } - float *dacs=new float[nd]; - float *adcs=new float[na]; + double *dacs=new double[nd]; + double *adcs=new double[na]; int *chipregs=new int[nc]; int *chanregs=new int[nch*nc]; myMod->ndac=nd; @@ -824,8 +824,8 @@ int slsDetector::sendChip(sls_detector_chip *myChip) { int slsDetector::sendModule(sls_detector_module *myMod) { int ts=0; ts+=controlSocket->SendDataOnly(myMod,sizeof(sls_detector_module)); - ts+=controlSocket->SendDataOnly(myMod->dacs,sizeof(float)*(myMod->ndac)); - ts+=controlSocket->SendDataOnly(myMod->adcs,sizeof(float)*(myMod->nadc)); + ts+=controlSocket->SendDataOnly(myMod->dacs,sizeof(double)*(myMod->ndac)); + ts+=controlSocket->SendDataOnly(myMod->adcs,sizeof(double)*(myMod->nadc)); ts+=controlSocket->SendDataOnly(myMod->chipregs,sizeof(int)*(myMod->nchip)); ts+=controlSocket->SendDataOnly(myMod->chanregs,sizeof(int)*(myMod->nchan)); return ts; @@ -855,8 +855,8 @@ int slsDetector::receiveChip(sls_detector_chip* myChip) { int slsDetector::receiveModule(sls_detector_module* myMod) { - float *dacptr=myMod->dacs; - float *adcptr=myMod->adcs; + double *dacptr=myMod->dacs; + double *adcptr=myMod->adcs; int *chipptr=myMod->chipregs; int *chanptr=myMod->chanregs; int ts=0; @@ -869,11 +869,11 @@ int slsDetector::receiveModule(sls_detector_module* myMod) { #ifdef VERBOSE std::cout<< "received module " << myMod->module << " of size "<< ts << " register " << myMod->reg << std::endl; #endif - ts+=controlSocket->ReceiveDataOnly(myMod->dacs,sizeof(float)*(myMod->ndac)); + ts+=controlSocket->ReceiveDataOnly(myMod->dacs,sizeof(double)*(myMod->ndac)); #ifdef VERBOSE std::cout<< "received dacs " << myMod->module << " of size "<< ts << std::endl; #endif - ts+=controlSocket->ReceiveDataOnly(myMod->adcs,sizeof(float)*(myMod->nadc)); + ts+=controlSocket->ReceiveDataOnly(myMod->adcs,sizeof(double)*(myMod->nadc)); #ifdef VERBOSE std::cout<< "received adcs " << myMod->module << " of size "<< ts << std::endl; #endif @@ -1689,7 +1689,7 @@ int slsDetector::enableAnalogOutput(int imod, int ichip, int ichan){ 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; }; */ @@ -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 ret=FAIL; 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 ret=FAIL; char mess[100]; @@ -2271,7 +2271,7 @@ int slsDetector::setModule(int reg, int imod){ #endif int charegs[thisDetector->nChans*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 ret=FAIL; @@ -2439,7 +2439,7 @@ slsDetectorDefs::sls_detector_module *slsDetector::getModule(int imod){ // int chanreg[thisDetector->nChans*thisDetector->nChips]; //int chipreg[thisDetector->nChips]; - //float dac[thisDetector->nDacs], adc[thisDetector->nAdcs]; + //double dac[thisDetector->nDacs], adc[thisDetector->nAdcs]; int ret=FAIL; char mess[100]; @@ -2537,7 +2537,7 @@ slsDetectorDefs::sls_detector_module *slsDetector::getModule(int imod){ /* 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; @@ -2545,7 +2545,7 @@ int slsDetector::setCalibration(int imod, detectorSettings isettings, float gai 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; @@ -2791,7 +2791,7 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise switch(thisDetector->myDetectorType==MYTHEN){ if (thisDetector->correctionMask&(1<-1 && isett<3) { 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) dataout=fdata; else - dataout=new float[thisDetector->nChans*thisDetector->nChips*thisDetector->nMods]; + dataout=new double[thisDetector->nChans*thisDetector->nChips*thisDetector->nMods]; const int bytesize=8; @@ -3980,9 +3980,9 @@ float* slsDetector::decodeData(int *datain, float *fdata) { int slsDetector::setFlatFieldCorrection(string fname) { - float data[thisDetector->nModMax[X]*thisDetector->nModMax[Y]*thisDetector->nChans*thisDetector->nChips]; - //float err[thisDetector->nModMax[X]*thisDetector->nModMax[Y]*thisDetector->nChans*thisDetector->nChips]; - float xmed[thisDetector->nModMax[X]*thisDetector->nModMax[Y]*thisDetector->nChans*thisDetector->nChips]; + double data[thisDetector->nModMax[X]*thisDetector->nModMax[Y]*thisDetector->nChans*thisDetector->nChips]; + //double err[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 im=0; 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) { for (int ichan=0; ichannMod[X]*thisDetector->nChans*thisDetector->nChips; ichan++) { // #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<correctionMask & (1<nMod[X]*thisDetector->nChans*thisDetector->nChips; ichan++) { if (errin==NULL) { @@ -4151,8 +4151,8 @@ int slsDetector::flatFieldCorrect(float* datain, float *errin, float* dataout, f }; -int slsDetector::setRateCorrection(float t){ - float tdead[]=defaultTDead; +int slsDetector::setRateCorrection(double t){ + double tdead[]=defaultTDead; if (t==0) { #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<correctionMask&(1<tDead; - float t=thisDetector->timerValue[ACQUISITION_TIME]; - // float data; - float e; +int slsDetector::rateCorrect(double* datain, double *errin, double* dataout, double *errout){ + double tau=thisDetector->tDead; + double t=thisDetector->timerValue[ACQUISITION_TIME]; + // double data; + double e; if (thisDetector->correctionMask&(1<nChans*thisDetector->nChips*thisDetector->nMods]; +// double *ang=new double[thisDetector->nChans*thisDetector->nChips*thisDetector->nMods]; // for (int ip=0; ipnChans*thisDetector->nChips*thisDetector->nMods; ip++) { // imod=ip/(thisDetector->nChans*thisDetector->nChips); // ang[ip]=angle(ip%(thisDetector->nChans*thisDetector->nChips),\ diff --git a/slsDetectorSoftware/slsDetector/slsDetector.h b/slsDetectorSoftware/slsDetector/slsDetector.h index daf948789..5a7350643 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.h +++ b/slsDetectorSoftware/slsDetector/slsDetector.h @@ -134,7 +134,7 @@ typedef struct sharedSlsDetector { /** threaded processing flag (i.e. if data are processed and written to file in a separate thread) */ int threadedProcessing; /** dead time (in ns) for rate corrections */ - float tDead; + double tDead; /** directory where the flat field files are stored */ char flatFieldDir[MAX_STR_LENGTH]; /** 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 */ int angDirection; /** 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) */ - float globalOffset; + double globalOffset; /** number of positions at which the detector should acquire */ int numberOfPositions; /** list of encoder positions at which the detector should acquire */ - float detPositions[MAXPOS]; + double detPositions[MAXPOS]; /** bin size for data merging */ - float binSize; + double binSize; /** add encoder value flag (i.e. wether the detector is moving - 1 - or stationary - 0) */ int moveFlag; @@ -698,7 +698,7 @@ typedef struct sharedSlsDetector { not yet implemented */ - int giveCalibrationPulse(float vcal, int npulses); + int giveCalibrationPulse(double vcal, int npulses); // Expert Initialization functions @@ -727,7 +727,7 @@ typedef struct sharedSlsDetector { \param imod module number (if -1 alla modules) \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 @@ -735,7 +735,7 @@ typedef struct sharedSlsDetector { \param imod module number \returns current ADC value */ - float getADC(dacIndex index, int imod=0); + double getADC(dacIndex index, int imod=0); /** configure channel @@ -822,8 +822,8 @@ typedef struct sharedSlsDetector { //virtual sls_detector_module *getModule(int imod); // calibration functions - // int setCalibration(int imod, detectorSettings isettings, float gain, float offset); - //int getCalibration(int imod, detectorSettings isettings, float &gain, float &offset); + // int setCalibration(int imod, detectorSettings isettings, double gain, double 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) \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 \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 \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 \returns 0 if rate correction disabled, >0 otherwise */ - int getRateCorrection(float &t); + int getRateCorrection(double &t); /** get rate correction tau \returns 0 if rate correction disabled, otherwise the tau used for the correction */ - float getRateCorrectionTau(); + double getRateCorrectionTau(); /** get rate correction \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 - \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) \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) \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 */ /* *\/ */ -/* int resetMerging(float *mp, float *mv,float *me, int *mm); */ +/* int resetMerging(double *mp, double *mv,double *me, int *mm); */ /* /\** */ /* pure virtual function */ @@ -1181,7 +1181,7 @@ typedef struct sharedSlsDetector { /* \param mm multiplicity of merged arrays */ /* \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 */ /* 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) */ /* \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 @@ -1227,10 +1227,10 @@ typedef struct sharedSlsDetector { int setTotalProgress(); /** 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 */ - float *ffcoefficients; + double *ffcoefficients; /** pointer to flat field coefficient errors */ - float *fferrors; + double *fferrors; /** pointer to detector module structures */ sls_detector_module *detectorModules; /** pointer to dac valuse */ - float *dacs; + double *dacs; /** pointer to adc valuse */ - float *adcs; + double *adcs; /** pointer to chip registers */ int *chipregs; /** pointer to channal registers */ diff --git a/slsDetectorSoftware/slsDetector/slsDetectorActions.cpp b/slsDetectorSoftware/slsDetector/slsDetectorActions.cpp index 6761124c2..d56870a46 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorActions.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorActions.cpp @@ -142,7 +142,7 @@ int slsDetectorActions::getActionMode(int iaction){ \param fname for script ("" disable) \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=0 && iscan=0 && iscan0 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 \param index of the scan (0,1) @@ -117,14 +117,14 @@ class slsDetectorActions : public virtual slsDetectorBase \param values pointer to array of values \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 \param index of the scan (0,1) \param istep step number \returns value of the scan variable */ - float getScanStep(int index, int istep){if (index=0 && istep>=0 && istep=0 && istep>=0 && istep0 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 @@ -183,7 +183,7 @@ class slsDetectorBase : public virtual slsDetectorUsers , public virtual slsDet \param values pointer to array of values (must be allocated in advance) \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 \returns current scan variable */ - virtual float getCurrentScanVariable(int index)=0;// {return 0;}; + virtual double getCurrentScanVariable(int index)=0;// {return 0;}; /** \returns current position index @@ -237,12 +237,12 @@ class slsDetectorBase : public virtual slsDetectorUsers , public virtual slsDet virtual void incrementProgress()=0; - virtual float getCurrentProgress()=0; + virtual double getCurrentProgress()=0; virtual void incrementFileIndex()=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; @@ -251,20 +251,20 @@ class slsDetectorBase : public virtual slsDetectorUsers , public virtual slsDet virtual int getFileIndexFromFileName(string fname)=0; - virtual float *convertAngles()=0; + virtual double *convertAngles()=0; /** 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 \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 \param t reference for dead time \returns 0 if rate correction disabled, >0 otherwise */ - virtual int getRateCorrection(float &t)=0; + virtual int getRateCorrection(double &t)=0; /** get rate correction @@ -578,9 +578,11 @@ int64_t setNumberOfCycles(int64_t t=-1){return setTimer(CYCLES_NUMBER,t);}; switch(f) { \ case AUTO_TIMING: return string( "auto"); \ case TRIGGER_EXPOSURE: return string("trigger"); \ + case TRIGGER_FRAME: return string("trigger_frame"); \ case TRIGGER_READOUT: return string("ro_trigger"); \ case GATE_FIX_NUMBER: return string("gating"); \ case GATE_WITH_START_TRIGGER: return string("triggered_gating"); \ + case TRIGGER_WINDOW: return string("trigger_window"); \ 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){\ if (sval=="auto") return AUTO_TIMING;\ if (sval=="trigger") return TRIGGER_EXPOSURE; \ + if (sval=="trigger_frame") return TRIGGER_FRAME; \ if (sval=="ro_trigger") return TRIGGER_READOUT;\ if (sval=="gating") return GATE_FIX_NUMBER;\ if (sval=="triggered_gating") return GATE_WITH_START_TRIGGER;\ + if (sval=="trigger_window") return TRIGGER_WINDOW; \ return GET_EXTERNAL_COMMUNICATION_MODE; \ }; diff --git a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp index 9875e46e6..26105a2ae 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp @@ -1385,7 +1385,7 @@ string slsDetectorCommand::cmdFlatField(int narg, char *args[], int action){ sval=string(args[1]); else sval="none"; - float corr[24*1280], ecorr[24*1280]; + double corr[24*1280], ecorr[24*1280]; if (myDet->getFlatFieldCorrection(corr,ecorr)) { if (sval!="none") { myDet->writeDataFile(sval,corr,ecorr,NULL,'i'); @@ -1438,14 +1438,14 @@ string slsDetectorCommand::cmdRateCorr(int narg, char *args[], int action){ if (action==HELP_ACTION) { return helpRateCorr(narg, args, action); } - float fval; + double fval; char answer[1000]; if (action==PUT_ACTION) { sscanf(args[1],"%f",&fval); myDet->setRateCorrection(fval); } - float t; + double t; if (myDet->getRateCorrection(t)) { sprintf(answer,"%f",t); } else { @@ -1525,7 +1525,7 @@ string slsDetectorCommand::cmdAngConv(int narg, char *args[], int action){ } string sval; char answer[1000]; - float fval; + double fval; angleConversionParameter c; if (string(args[0])==string("angconv")) { @@ -1767,7 +1767,7 @@ string slsDetectorCommand::cmdPositions(int narg, char *args[], int action){ if (action==PUT_ACTION) { if (sscanf(args[1],"%d",&ival)) { - float pos[ival]; + double pos[ival]; for (ip=0; ipgetPositions(); sprintf(answer,"%d",npos); - float opos[npos]; + double opos[npos]; myDet->getPositions(opos); for (int ip=0; ipMAX_SCAN_STEPS) return string("too many steps required!"); - values=new float[ival]; + values=new double[ival]; for (int i=0; i=(i+2)) { 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); - values=new float[ns]; + values=new double[ns]; ns=myDet->getScanSteps(is, values); int p=myDet->getScanPrecision(is); char format[1000]; @@ -1927,7 +1927,7 @@ string slsDetectorCommand::cmdScans(int narg, char *args[], int action) { if (action==PUT_ACTION) { - float fmin, fmax, fstep; + double fmin, fmax, fstep; if (narg<4) 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; - values=new float[ns]; + values=new double[ns]; for (int i=0; igetScanSteps(is); - values=new float[ns]; + values=new double[ns]; ns=myDet->getScanSteps(is, values); int p=myDet->getScanPrecision(is); char format[1000]; @@ -2638,7 +2638,7 @@ string slsDetectorCommand::cmdDAC(int narg, char *args[], int action) { return helpDAC(narg, args, action); dacIndex dac; - float val=-1; + double val=-1; char answer[1000]; 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) { dacIndex adc; - // float val=-1; + // double val=-1; char answer[1000]; 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) { timerIndex index; int64_t t=-1, ret; - float val, rval; + double val, rval; char answer[1000]; @@ -2896,7 +2896,7 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) { ret=myDet->setTimer(index,t); if (index==ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER) - rval=(float)ret*1E-9; + rval=(double)ret*1E-9; 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) { timerIndex index; int64_t ret; - float rval; + double rval; char answer[1000]; @@ -2991,7 +2991,7 @@ string slsDetectorCommand::cmdTimeLeft(int narg, char *args[], int action) { ret=myDet->getTimeLeft(index); 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; diff --git a/slsDetectorSoftware/slsDetector/slsDetectorUsers.h b/slsDetectorSoftware/slsDetector/slsDetectorUsers.h index 8bed282c0..7955bb216 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorUsers.h +++ b/slsDetectorSoftware/slsDetector/slsDetectorUsers.h @@ -182,14 +182,14 @@ class slsDetectorUsers \param pos array with the encoder 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 \param pos array which will contain the encoder positions \returns number of positions */ - virtual int getPositions(float *pos=NULL)=0; + virtual int getPositions(double *pos=NULL)=0; /** @short sets the detector size @@ -358,7 +358,7 @@ class slsDetectorUsers \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 \param func function for connecting to the epics channels @@ -373,17 +373,17 @@ class slsDetectorUsers @short register callback 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 \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 \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; /************************************************************************ diff --git a/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp b/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp index 56b945bf0..df37852a8 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp @@ -398,11 +398,11 @@ int slsDetectorUtils::setBadChannelCorrection(string fname, int &nbadtot, int *b -float slsDetectorUtils::getCurrentProgress() { +double slsDetectorUtils::getCurrentProgress() { #ifdef VERBOSE cout << progressIndex << " / " << totalProgress << endl; #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; iv++; - + if (level==2) { strcpy(myargs[0],names[iv].c_str()); @@ -754,8 +754,8 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){ -// float data[tch], xmed[tch]; -// float ffcoefficients[tch], fferrors[tch]; +// double data[tch], xmed[tch]; +// double ffcoefficients[tch], fferrors[tch]; // int nmed=0; // int idet=0, ichdet=-1; // char ffffname[MAX_STR_LENGTH*2]; diff --git a/slsDetectorSoftware/slsDetector/slsDetectorUtils.h b/slsDetectorSoftware/slsDetector/slsDetectorUtils.h index 25b6a9227..6662a03f5 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorUtils.h +++ b/slsDetectorSoftware/slsDetector/slsDetectorUtils.h @@ -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 postProcessing::setBadChannelCorrection; @@ -87,7 +87,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing { // int getScanPrecision(int i){return slsDetectorActions::getScanPrecision(i);}; // 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 getNumberOfPositions(){return angularConversion::getNumberOfPositions();}; @@ -403,13 +403,13 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing { void acquire(int delflag=1); - // float* convertAngles(){return convertAngles(currentPosition);}; - // virtual float* convertAngles(float pos)=0; + // double* convertAngles(){return convertAngles(currentPosition);}; + // virtual double* convertAngles(double pos)=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 float getRateCorrectionTau()=0; + virtual double getRateCorrectionTau()=0; virtual int* startAndReadAll()=0; virtual int getTotalNumberOfChannels()=0; @@ -423,7 +423,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing { int setTotalProgress(); - float getCurrentProgress(); + double getCurrentProgress(); void incrementProgress(); @@ -491,7 +491,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing { \param imod module number (if -1 alla modules) \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 \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 @@ -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 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 registerGoToPositionNoWaitCallback(int (*func)(float, 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 registerGoToPositionCallback( int (*func)(double, void*),void *arg){go_to_position=func;GTarg=arg;}; + void registerGoToPositionNoWaitCallback(int (*func)(double, void*),void*arg){go_to_position_no_wait=func;GTNarg=arg;}; + void registerGetI0Callback( double (*func)(int, void*),void *arg){get_i0=func;IOarg=arg;}; /** Saves the detector setup to file @@ -565,12 +565,12 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing { int progressIndex; - float (*get_position)(void*); - int (*go_to_position)(float, void*); - int (*go_to_position_no_wait)(float, void*); + double (*get_position)(void*); + int (*go_to_position)(double, void*); + int (*go_to_position_no_wait)(double, void*); int (*connect_channels)(void*); int (*disconnect_channels)(void*); - float (*get_i0)(int, void*); + double (*get_i0)(int, void*); void *POarg,*CCarg,*DCarg,*GTarg,*GTNarg,*IOarg; diff --git a/slsDetectorSoftware/slsDetectorAnalysis/AngularConversion_Standalone.cpp b/slsDetectorSoftware/slsDetectorAnalysis/AngularConversion_Standalone.cpp index e7e48f095..e84d38ed9 100644 --- a/slsDetectorSoftware/slsDetectorAnalysis/AngularConversion_Standalone.cpp +++ b/slsDetectorSoftware/slsDetectorAnalysis/AngularConversion_Standalone.cpp @@ -8,7 +8,7 @@ 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), numberOfPositions(np), detPositions(pos), @@ -42,10 +42,10 @@ angularConversion::~angularConversion(){ -float* angularConversion::convertAngles(float pos) { +double* angularConversion::convertAngles(double pos) { int imod=0; - float *ang=new float[totalNumberOfChannels]; - float enc=pos; + double *ang=new double[totalNumberOfChannels]; + double enc=pos; angleConversionConstant *p=NULL; int ch0=0; @@ -115,9 +115,9 @@ int angularConversion::readAngularConversion(string fname, int nmod, angleConver int angularConversion::readAngularConversion( ifstream& infile, int nmod, angleConversionConstant *angOff) { string str; int mod; - float center, ecenter; - float r_conv, er_conv; - float off, eoff; + double center, ecenter; + double r_conv, er_conv; + double off, eoff; string ss; int interrupt=0; int nm=0; @@ -187,7 +187,7 @@ int angularConversion:: writeAngularConversion(ofstream& outfile, int nmod, angl //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 @@ -206,7 +206,7 @@ int angularConversion::resetMerging(float *mp, float *mv, float *me, int *mm, in //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; for (int ibin=0; ibin0) { @@ -226,10 +226,10 @@ int angularConversion::finalizeMerging(float *mp, float *mv, float *me, int *mm, } //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; if (p1==NULL) @@ -305,13 +305,13 @@ int angularConversion::deleteMerging() { int angularConversion::resetMerging() { 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]; @@ -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); if (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) return finalizeMerging(mp, mv, me, mm, nBins); else 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); @@ -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; @@ -398,7 +398,7 @@ int angularConversion::addToMerging(float *p1, float *v1, float *e1, float *mp, \returns the actual value */ -float angularConversion::setAngularConversionParameter(angleConversionParameter c, float v){ +double angularConversion::setAngularConversionParameter(angleConversionParameter c, double v){ switch (c) { @@ -441,7 +441,7 @@ float angularConversion::setAngularConversionParameter(angleConversionParameter */ -float angularConversion::getAngularConversionParameter(angleConversionParameter c) { +double angularConversion::getAngularConversionParameter(angleConversionParameter c) { switch (c) { case ANGULAR_DIRECTION: @@ -501,7 +501,7 @@ int angularConversion::setAngularConversionFile(string fname) { \param pos array with the encoder positions \returns number of positions */ -int angularConversion::setPositions(int nPos, float *pos){ +int angularConversion::setPositions(int nPos, double *pos){ if (nPos>=0) *numberOfPositions=nPos; for (int ip=0; ip= 360./getBinSize(); \param mp already merged postions @@ -109,7 +109,7 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl \param mm multiplicity of merged arrays \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. @@ -132,7 +132,7 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl \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 @@ -147,7 +147,7 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl \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 \param p1 angular positions of dataset @@ -157,7 +157,7 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl \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 @@ -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) */ - 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 \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) */ - 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 @@ -194,7 +194,7 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl \param f global offset to be set \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 \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 \returns actual fine offset */ - float getFineOffset(){return getAngularConversionParameter(FINE_OFFSET);}; + double getFineOffset(){return getAngularConversionParameter(FINE_OFFSET);}; /** get detector 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 \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 \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) \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) @@ -261,13 +261,13 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl \param v value to be set \returns actual value */ - float setAngularConversionParameter(angleConversionParameter c, float v); + double setAngularConversionParameter(angleConversionParameter c, double v); /** get angular conversion parameter \param c parameter type (globaloffset, fineoffset, binsize, angular direction, move flag) \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 \returns number of positions */ - virtual int setPositions(int nPos, float *pos); + virtual int setPositions(int nPos, double *pos); /** get positions for the acquisition \param pos array which will contain the encoder positions \returns number of positions */ - virtual int getPositions(float *pos=NULL); + virtual int getPositions(double *pos=NULL); /** 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 */ - float *getMergedPositions(){return mergingBins;}; + double *getMergedPositions(){return mergingBins;}; /** \returns pointer to the array of merged counts */ - float *getMergedCounts(){return mergingCounts;}; + double *getMergedCounts(){return mergingCounts;}; /** \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 \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 \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: /** merging bins */ - float *mergingBins; + double *mergingBins; /** merging counts */ - float *mergingCounts; + double *mergingCounts; /** merging errors */ - float *mergingErrors; + double *mergingErrors; /** merging multiplicity */ int *mergingMultiplicity; - float (*angle)(float, float, float, float, float, float, float, int); + double (*angle)(double, double, double, double, double, double, double, int); int totalNumberOfChannels; @@ -413,11 +413,11 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl int *numberOfPositions; /** pointer to the detector positions for the acquisition*/ - float *detPositions; + double *detPositions; /** pointer to angular bin size*/ - float *binSize; + double *binSize; int *correctionMask; int chansPerMod; @@ -427,9 +427,9 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl /** pointer to beamlien fine offset*/ - float *fineOffset; + double *fineOffset; /** pointer to beamlien global offset*/ - float *globalOffset; + double *globalOffset; /** pointer to beamlien angular direction*/ int *angDirection; @@ -444,7 +444,7 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl /** current position of the detector */ - float currentPosition; + double currentPosition; /** 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;}; }; diff --git a/slsDetectorSoftware/slsDetectorAnalysis/TSlsDetectorDict.cpp b/slsDetectorSoftware/slsDetectorAnalysis/TSlsDetectorDict.cpp index 4cbd4858d..67c907790 100644 --- a/slsDetectorSoftware/slsDetectorAnalysis/TSlsDetectorDict.cpp +++ b/slsDetectorSoftware/slsDetectorAnalysis/TSlsDetectorDict.cpp @@ -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) { - 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) ; } @@ -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) { - 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) ; } @@ -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) { - ((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); 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) { - ((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); return(1 || funcname || hash || result7 || libp) ; } diff --git a/slsDetectorSoftware/slsDetectorAnalysis/angularCalibration.cpp b/slsDetectorSoftware/slsDetectorAnalysis/angularCalibration.cpp index 362e80555..08fa890a3 100644 --- a/slsDetectorSoftware/slsDetectorAnalysis/angularCalibration.cpp +++ b/slsDetectorSoftware/slsDetectorAnalysis/angularCalibration.cpp @@ -109,7 +109,7 @@ TF1 *fitPeak(TH1 *h) { TF1 *fitfun=NULL; int chmod, imod; - float ang; + double ang; // reads in a run and fits a gaussian to the peak as function // of channel number also reads optical encoder @@ -134,8 +134,8 @@ TF1 *fitPeak(TH1 *h) { // for (i=0;iminang) && (angle(i)0) { @@ -220,10 +220,10 @@ int angularConversion::finalizeMerging(float *mp, float *mv, float *me, int *mm, } //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; if (p1==NULL) @@ -299,13 +299,13 @@ int angularConversion::deleteMerging() { int angularConversion::resetMerging() { 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]; @@ -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); if (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) return finalizeMerging(mp, mv, me, mm, nBins); else 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); @@ -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; @@ -392,7 +392,7 @@ int angularConversion::addToMerging(float *p1, float *v1, float *e1, float *mp, \returns the actual value */ -float angularConversion::setAngularConversionParameter(angleConversionParameter c, float v){ +double angularConversion::setAngularConversionParameter(angleConversionParameter c, double v){ switch (c) { @@ -435,7 +435,7 @@ float angularConversion::setAngularConversionParameter(angleConversionParameter */ -float angularConversion::getAngularConversionParameter(angleConversionParameter c) { +double angularConversion::getAngularConversionParameter(angleConversionParameter c) { switch (c) { case ANGULAR_DIRECTION: @@ -495,7 +495,7 @@ int angularConversion::setAngularConversionFile(string fname) { \param pos array with the encoder positions \returns number of positions */ -int angularConversion::setPositions(int nPos, float *pos){ +int angularConversion::setPositions(int nPos, double *pos){ if (nPos>=0) *numberOfPositions=nPos; for (int ip=0; ip= 360./getBinSize(); \param mp already merged postions @@ -114,7 +114,7 @@ class angularConversion : public virtual slsDetectorBase { \param mm multiplicity of merged arrays \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. @@ -137,7 +137,7 @@ class angularConversion : public virtual slsDetectorBase { \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 @@ -152,7 +152,7 @@ class angularConversion : public virtual slsDetectorBase { \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 \param p1 angular positions of dataset @@ -162,7 +162,7 @@ class angularConversion : public virtual slsDetectorBase { \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 @@ -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) */ - 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 \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) */ - 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 @@ -199,7 +199,7 @@ class angularConversion : public virtual slsDetectorBase { \param f global offset to be set \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 \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 \returns actual fine offset */ - float getFineOffset(){return getAngularConversionParameter(FINE_OFFSET);}; + double getFineOffset(){return getAngularConversionParameter(FINE_OFFSET);}; /** get detector 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 \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 \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) \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) @@ -273,13 +273,13 @@ class angularConversion : public virtual slsDetectorBase { \param v value to be set \returns actual value */ - float setAngularConversionParameter(angleConversionParameter c, float v); + double setAngularConversionParameter(angleConversionParameter c, double v); /** get angular conversion parameter \param c parameter type (globaloffset, fineoffset, binsize, angular direction, move flag) \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 \returns number of positions */ - virtual int setPositions(int nPos, float *pos); + virtual int setPositions(int nPos, double *pos); /** get positions for the acquisition \param pos array which will contain the encoder positions \returns number of positions */ - virtual int getPositions(float *pos=NULL); + virtual int getPositions(double *pos=NULL); /** deletes the array of merged data @@ -307,15 +307,15 @@ class angularConversion : public virtual slsDetectorBase { /** \returns pointer to the array o merged positions */ - float *getMergedPositions(){return mergingBins;}; + double *getMergedPositions(){return mergingBins;}; /** \returns pointer to the array of merged counts */ - float *getMergedCounts(){return mergingCounts;}; + double *getMergedCounts(){return mergingCounts;}; /** \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 \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 \returns array of angles corresponding to the channels */ - float *convertAngles(){return convertAngles(currentPosition);}; + double *convertAngles(){return convertAngles(currentPosition);}; /** \param imod module number @@ -391,18 +391,18 @@ class angularConversion : public virtual slsDetectorBase { int *numberOfPositions; /** pointer to the detector positions for the acquisition*/ - float *detPositions; + double *detPositions; /** pointer to angular conversion file name*/ char *angConvFile; /** pointer to angular bin size*/ - float *binSize; + double *binSize; /** pointer to beamlien fine offset*/ - float *fineOffset; + double *fineOffset; /** pointer to beamlien global offset*/ - float *globalOffset; + double *globalOffset; /** pointer to beamlien angular direction*/ int *angDirection; /** 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 */ - float currentPosition; + double currentPosition; /** 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: /** merging bins */ - float *mergingBins; + double *mergingBins; /** merging counts */ - float *mergingCounts; + double *mergingCounts; /** merging errors */ - float *mergingErrors; + double *mergingErrors; /** merging multiplicity */ int *mergingMultiplicity; - float (*angle)(float, float, float, float, float, float, float, int); + double (*angle)(double, double, double, double, double, double, double, int); }; diff --git a/slsDetectorSoftware/slsDetectorAnalysis/detectorData.h b/slsDetectorSoftware/slsDetectorAnalysis/detectorData.h index 32217a907..0b5c31a60 100644 --- a/slsDetectorSoftware/slsDetectorAnalysis/detectorData.h +++ b/slsDetectorSoftware/slsDetectorAnalysis/detectorData.h @@ -19,17 +19,17 @@ class detectorData { \param np number of points in x coordinate defaults to the number of detector channels (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 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;}; //private: - float *values; /**< pointer to the data */ - float *errors; /**< pointer to the errors */ - float *angles;/**< pointer to the angles */ - float progressIndex;/**< file index */ + double *values; /**< pointer to the data */ + double *errors; /**< pointer to the errors */ + double *angles;/**< pointer to the angles */ + double progressIndex;/**< file index */ char fileName[1000];/**< file name */ int npoints;/**< number of points */ int npy;/**< dimensions in y coordinate*/ diff --git a/slsDetectorSoftware/slsDetectorAnalysis/energyCalibration.cpp b/slsDetectorSoftware/slsDetectorAnalysis/energyCalibration.cpp index a6bcda4cc..1bfb9478b 100644 --- a/slsDetectorSoftware/slsDetectorAnalysis/energyCalibration.cpp +++ b/slsDetectorSoftware/slsDetectorAnalysis/energyCalibration.cpp @@ -26,7 +26,7 @@ Double_t energyCalibrationFunctions::gaussChargeSharing(Double_t *x, Double_t *p // basic erf function 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]; 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 -float energyCalibrationFunctions::median(float *x, int n){ +double energyCalibrationFunctions::median(double *x, int n){ // sorts x into xmed array and returns median // n is number of values already in the xmed array - float xmed[n]; + double xmed[n]; int k,i,j; for (i=0; i0 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 @@ -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) \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 @@ -105,7 +105,7 @@ class postProcessing : public virtual angularConversion, public virtual fileIO \param fferr erro on ffcoefficient \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 @@ -117,7 +117,7 @@ class postProcessing : public virtual angularConversion, public virtual fileIO \param t acquisition time (in ns) \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<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 @@ -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) \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 @@ -105,7 +105,7 @@ class postProcessing : public virtual fileIO { \param fferr erro on ffcoefficient \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 @@ -117,7 +117,7 @@ class postProcessing : public virtual fileIO { \param t acquisition time (in ns) \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< -float pos; -float i0=0; +double pos; +double i0=0; #ifdef EPICS #include @@ -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 */ - 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; @@ -139,7 +139,7 @@ float angle(int ichan, float encoder, float totalOffset, float conv_r, float cen /* reads the encoder and returns the position */ -float get_position(void *ch_poarg) { +double get_position(void *ch_poarg) { #ifdef VERBOSE printf("Getting motor position \n"); #endif @@ -169,7 +169,7 @@ float get_position(void *ch_poarg) { /* 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 printf("Setting motor position \n"); #endif @@ -196,7 +196,7 @@ int go_to_position(float p,void *ch_parg) { /* 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 printf("Setting motor position no wait \n"); #endif @@ -231,7 +231,7 @@ int go_to_position_no_wait(float p) { /* reads I0 and returns the intensity */ -float get_i0(void *ch_ioarg) { +double get_i0(void *ch_ioarg) { #ifdef VERBOSE printf("Getting I0 readout \n"); #endif diff --git a/slsDetectorSoftware/usersFunctions/usersFunctions.cpp b/slsDetectorSoftware/usersFunctions/usersFunctions.cpp index 87542d5af..def987709 100644 --- a/slsDetectorSoftware/usersFunctions/usersFunctions.cpp +++ b/slsDetectorSoftware/usersFunctions/usersFunctions.cpp @@ -3,8 +3,8 @@ #include -float pos; -float i0=0; +double pos; +double i0=0; #ifdef EPICS #include @@ -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 */ - 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 */ -float defaultGetPosition(void *d) { +double defaultGetPosition(void *d) { #ifdef VERBOSE printf("Getting motor position \n"); #endif @@ -165,7 +165,7 @@ float defaultGetPosition(void *d) { /* moves the encoder to position p */ -int defaultGoToPosition(float p,void *d) { +int defaultGoToPosition(double p,void *d) { #ifdef VERBOSE printf("Setting motor position \n"); #endif @@ -193,7 +193,7 @@ int defaultGoToPosition(float p,void *d) { /* moves the encoder to position p without waiting */ -int defaultGoToPositionNoWait(float p,void *d) { +int defaultGoToPositionNoWait(double p,void *d) { #ifdef VERBOSE printf("Setting motor position no wait \n"); #endif @@ -224,7 +224,7 @@ int defaultGoToPositionNoWait(float p,void *d) { /* reads I0 and returns the intensity */ -float defaultGetI0(int t,void *d) { +double defaultGetI0(int t,void *d) { #ifdef VERBOSE printf("Getting I0 readout \n"); #endif diff --git a/slsDetectorSoftware/usersFunctions/usersFunctions.h b/slsDetectorSoftware/usersFunctions/usersFunctions.h index 13ac7ef97..85eae5bfc 100644 --- a/slsDetectorSoftware/usersFunctions/usersFunctions.h +++ b/slsDetectorSoftware/usersFunctions/usersFunctions.h @@ -29,13 +29,13 @@ extern "C" { #endif - float defaultAngleFunction(float ichan, float encoder, float totalOffset, float conv_r, float center, float offset, float tilt, int direction); - float defaultGetPosition(void *d); - int defaultGoToPosition(float p,void *d); - int defaultGoToPositionNoWait(float p,void *d); + double defaultAngleFunction(double ichan, double encoder, double totalOffset, double conv_r, double center, double offset, double tilt, int direction); + double defaultGetPosition(void *d); + int defaultGoToPosition(double p,void *d); + int defaultGoToPositionNoWait(double p,void *d); int defaultConnectChannels(void *d); int defaultDisconnectChannels(void *d); - float defaultGetI0(int t,void *d); + double defaultGetI0(int t,void *d); int defaultDataReadyFunc(detectorData* d, void* p);