Changed everywhere from float to double, even mythenDetectorServer and the standalone files

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@206 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d
2012-08-02 12:58:08 +00:00
parent 3795dcedfe
commit 5aebcd4888
47 changed files with 615 additions and 611 deletions

View File

@ -59,7 +59,7 @@ int slsDetector::initSharedMemory(detectorType type, int id) {
*/
sz=sizeof(sharedSlsDetector)+nm*(2*nch*nc*sizeof(float)+sizeof(sls_detector_module)+sizeof(int)*nc+sizeof(float)*nd+sizeof(int)*nch*nc);
sz=sizeof(sharedSlsDetector)+nm*(2*nch*nc*sizeof(double)+sizeof(sls_detector_module)+sizeof(int)*nc+sizeof(double)*nd+sizeof(int)*nch*nc);
#ifdef VERBOSE
std::cout<<"Size of shared memory is "<< sz << "(type " << type << " - id " << mem_key << ")"<< std::endl;
#endif
@ -595,11 +595,11 @@ int slsDetector::initializeDetectorSize(detectorType type) {
/** calculates the memory offsets for flat field coefficients and errors, module structures, dacs, adcs, chips and channels */
thisDetector->ffoff=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 <<std::endl;
#endif
dacs=(float*)(goff+thisDetector->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<<RATE_CORRECTION)) {
int isett=getSettings(imod);
float t[]=defaultTDead;
double t[]=defaultTDead;
if (isett>-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; ichan<thisDetector->nMod[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<<FLAT_FIELD_CORRECTION)) {
#ifdef VERBOSE
std::cout<< "Flat field correction is enabled" << std::endl;
@ -4127,11 +4127,11 @@ int slsDetector::getFlatFieldCorrection(float *corr, float *ecorr) {
}
int slsDetector::flatFieldCorrect(float* datain, float *errin, float* dataout, float *errout){
int slsDetector::flatFieldCorrect(double* datain, double *errin, double* dataout, double *errout){
#ifdef VERBOSE
std::cout<< "Flat field correcting data" << std::endl;
#endif
float e, eo;
double e, eo;
if (thisDetector->correctionMask & (1<<FLAT_FIELD_CORRECTION)) {
for (int ichan=0; ichan<thisDetector->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<<RATE_CORRECTION)) {
#ifdef VERBOSE
@ -4193,7 +4193,7 @@ int slsDetector::getRateCorrection(float &t){
return 0;
};
float slsDetector::getRateCorrectionTau(){
double slsDetector::getRateCorrectionTau(){
if (thisDetector->correctionMask&(1<<RATE_CORRECTION)) {
#ifdef VERBOSE
@ -4225,11 +4225,11 @@ int slsDetector::getRateCorrection(){
int slsDetector::rateCorrect(float* datain, float *errin, float* dataout, float *errout){
float tau=thisDetector->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<<RATE_CORRECTION)) {
#ifdef VERBOSE
std::cout<< "Rate correcting data with dead time "<< tau << " and acquisition time "<< t << std::endl;
@ -4599,9 +4599,9 @@ int slsDetector::getAngularConversion(int &direction, angleConversionConstant *
// float* slsDetector::convertAngles(float pos) {
// double* slsDetector::convertAngles(double pos) {
// int imod;
// float *ang=new float[thisDetector->nChans*thisDetector->nChips*thisDetector->nMods];
// double *ang=new double[thisDetector->nChans*thisDetector->nChips*thisDetector->nMods];
// for (int ip=0; ip<thisDetector->nChans*thisDetector->nChips*thisDetector->nMods; ip++) {
// imod=ip/(thisDetector->nChans*thisDetector->nChips);
// ang[ip]=angle(ip%(thisDetector->nChans*thisDetector->nChips),\

View File

@ -134,7 +134,7 @@ typedef struct sharedSlsDetector {
/** threaded processing flag (i.e. if data are processed and written to file in a separate thread) */
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 */

View File

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

View File

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

View File

@ -154,7 +154,7 @@ class slsDetectorBase : public virtual slsDetectorUsers , public virtual slsDet
\param values array of steps
\returns 0 if scan disabled, >0 otherwise*/
virtual int setScanSteps(int index, int nvalues=-1, float *values=NULL)=0;
virtual int setScanSteps(int index, int nvalues=-1, double *values=NULL)=0;
/**
get scan script
@ -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; \
};

View File

@ -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; ip<ival;ip++) {
if ((2+ip)<narg) {
if (sscanf(args[2+ip],"%f",pos+ip)) {
@ -1783,7 +1783,7 @@ string slsDetectorCommand::cmdPositions(int narg, char *args[], int action){
}
int npos=myDet->getPositions();
sprintf(answer,"%d",npos);
float opos[npos];
double opos[npos];
myDet->getPositions(opos);
for (int ip=0; ip<npos;ip++) {
sprintf(answer,"%s %f",answer,opos[ip]);
@ -1855,7 +1855,7 @@ string slsDetectorCommand::cmdScans(int narg, char *args[], int action) {
int is=-1, ival, ns=0;
char answer[MAX_SCAN_STEPS*10];
float *values;
double *values;
if (action==HELP_ACTION)
return helpScans(narg,args,action);
@ -1894,7 +1894,7 @@ string slsDetectorCommand::cmdScans(int narg, char *args[], int action) {
if (ival>MAX_SCAN_STEPS)
return string("too many steps required!");
values=new float[ival];
values=new double[ival];
for (int i=0; i<ival; i++) {
if (narg>=(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; i<ns; i++) {
values[i]=fmin+i*fstep;
}
@ -1978,7 +1978,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];
@ -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;

View File

@ -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;
/************************************************************************

View File

@ -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];

View File

@ -64,9 +64,9 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
//int setPositions(int nPos, float *pos){return angularConversion::setPositions(nPos, pos);};
//int setPositions(int nPos, double *pos){return angularConversion::setPositions(nPos, pos);};
// int getPositions(float *pos=NULL){return angularConversion::getPositions(pos);};
// int getPositions(double *pos=NULL){return angularConversion::getPositions(pos);};
using slsDetectorBase::setFlatFieldCorrection;
using 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;