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

@ -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; ibin<nb; ibin++) {
if (mm[ibin]>0) {
@ -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<nPos; ip++)
@ -514,7 +514,7 @@ int angularConversion::setPositions(int nPos, float *pos){
\param pos array which will contain the encoder positions
\returns number of positions
*/
int angularConversion::getPositions(float *pos){
int angularConversion::getPositions(double *pos){
if (pos) {
for (int ip=0; ip<(*numberOfPositions); ip++)
pos[ip]=detPositions[ip];

View File

@ -10,7 +10,7 @@
//float angle(int ichan, float encoder, float totalOffset, float conv_r, float center, float offset, float tilt, int direction)
//double angle(int ichan, double encoder, double totalOffset, double conv_r, double center, double offset, double tilt, int direction)
using namespace std;
@ -19,14 +19,14 @@ using namespace std;
@short Angular conversion constants needed for a detector 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;
@ -43,7 +43,7 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl
public:
/** default constructor */
angularConversion(int*, float*, float*, float*, float*);
angularConversion(int*, double*, double*, double*, double*);
/** virtual destructor */
virtual ~angularConversion();
@ -100,7 +100,7 @@ class angularConversion : public virtual slsDetectorDefs { //: public virtual sl
\param nbins number of bins
\returns OK or FAIL
*/
static int resetMerging(float *mp, float *mv,float *me, int *mm, int nbins);
static int resetMerging(double *mp, double *mv,double *me, int *mm, int nbins);
/**
sets the arrays of the merged data to 0. NB The array should be created with size >= 360./getBinSize();
\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;};
};

View File

@ -359,7 +359,7 @@ static int G__TSlsDetectorDict_87_0_2(G__value* result7, G__CONST char* funcname
static int G__TSlsDetectorDict_87_0_3(G__value* result7, G__CONST char* funcname, struct G__param* libp, int hash)
{
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) ;
}

View File

@ -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;i<nchannel;i++) {
// if ( (angle(i)>minang) && (angle(i)<maxang) ) {
// x[npoints]=(float) i;
// y[npoints]=(float) data[i];
// x[npoints]=(double) i;
// y[npoints]=(double) data[i];
// ex[npoints]=0.001;
// ey[npoints]=dataerror[i];
// anglefit[npoints]=angle(i);
@ -255,11 +255,11 @@ TF1 *fitPeak(TH1 *h) {
// // also set peak height,width and background in defines at beginning
// //
// void fitangle(char fname[80],char extension[10], int start, int stop, float startangle, float stopangle) {
// void fitangle(char fname[80],char extension[10], int start, int stop, double startangle, double stopangle) {
// int i,nfit,mod,npoints,nnpoints;
// float x[MAXINMODULE],y[MAXINMODULE],ex[MAXINMODULE],ey[MAXINMODULE],min,max;
// float xx[MAXINMODULE],yy[MAXINMODULE],exx[MAXINMODULE],eyy[MAXINMODULE];
// double x[MAXINMODULE],y[MAXINMODULE],ex[MAXINMODULE],ey[MAXINMODULE],min,max;
// double xx[MAXINMODULE],yy[MAXINMODULE],exx[MAXINMODULE],eyy[MAXINMODULE];
// double channelfit[MAXRUN], channelerror[MAXRUN], encoderfit[MAXRUN];
// int runnrfit[MAXRUN], modulenr[MAXRUN];

View File

@ -12,7 +12,7 @@
class TH1;
#endif
//float angle(int ichan, float encoder, float totalOffset, float conv_r, float center, float offset, float tilt, int direction)
//double angle(int ichan, double encoder, double totalOffset, double conv_r, double center, double offset, double tilt, int direction)
@ -20,14 +20,14 @@ class TH1;
angular conversion constant for a module
*/
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;
@ -50,26 +50,26 @@ class angularCalibration {
\param f encoder position to be set
\returns current encoder position
*/
float setEncoder(float f) {encoder=f; return encoder;};
double setEncoder(double f) {encoder=f; return encoder;};
/**
gets the encoder position
\returns encoder position
*/
float getEncoder() {return encoder;};
double getEncoder() {return encoder;};
/**
sets the totalOffset of the detector
\param f total offset to be set
\returns current total offset
*/
float setTotalOffset(float f) {totalOffset=f; return totalOffset;};
double setTotalOffset(double f) {totalOffset=f; return totalOffset;};
/**
gets the encoder position
\returns encoder position
*/
float getTotalOffset() {return totalOffset;};
double getTotalOffset() {return totalOffset;};
@ -79,7 +79,7 @@ class angularCalibration {
\param mi minimum of the angular range
\param ma maximum of the angular range
*/
void setAngularRange(float mi, float ma){ang_min=mi; ang_max=ma;};
void setAngularRange(double mi, double ma){ang_min=mi; ang_max=ma;};
/**
@ -87,7 +87,7 @@ class angularCalibration {
\param mi reference to the minimum of the angular range
\param ma reference to the maximum of the angular range
*/
void getAngularRange(float &mi, float &ma){mi=ang_min; ma=ang_max;};
void getAngularRange(double &mi, double &ma){mi=ang_min; ma=ang_max;};
/** sets and returns the number of modules
@ -147,10 +147,10 @@ class angularCalibration {
TF1 *fangle; /**< Root function based on function angleFunction */
#endif
float encoder; /**< position of the detector encoder */
float totalOffset; /**< total offset of the detector */
float ang_min; /**< minimum of the angular range for peak fitting*/
float ang_max; /**< maximum of the angular range for peak fitting */
double encoder; /**< position of the detector encoder */
double totalOffset; /**< total offset of the detector */
double ang_min; /**< minimum of the angular range for peak fitting*/
double ang_max; /**< maximum of the angular range for peak fitting */
int nmod;
int nchmod;
@ -161,8 +161,8 @@ class angularCalibration {
/* void fitangle(char fname[80],char extension[10], int start, int stop, float startangle, float stopangle); //fits all datasets and extracts the constants */
/* int fitpeak(char fname[80],char extension[10], int nr, float minang, float maxang); // fits a peak from a pattern using nominal calibration constant */
/* void fitangle(char fname[80],char extension[10], int start, int stop, double startangle, double stopangle); //fits all datasets and extracts the constants */
/* int fitpeak(char fname[80],char extension[10], int nr, double minang, double maxang); // fits a peak from a pattern using nominal calibration constant */
};

View File

@ -36,10 +36,10 @@ angularConversion::~angularConversion(){
float* angularConversion::convertAngles(float pos) {
double* angularConversion::convertAngles(double pos) {
int imod=0;
float *ang=new float[getTotalNumberOfChannels()];
float enc=pos;
double *ang=new double[getTotalNumberOfChannels()];
double enc=pos;
angleConversionConstant *p=NULL;
int ch0=0;
@ -109,9 +109,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;
@ -181,7 +181,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
@ -200,7 +200,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; ibin<nb; ibin++) {
if (mm[ibin]>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<nPos; ip++)
@ -508,7 +508,7 @@ int angularConversion::setPositions(int nPos, float *pos){
\param pos array which will contain the encoder positions
\returns number of positions
*/
int angularConversion::getPositions(float *pos){
int angularConversion::getPositions(double *pos){
if (pos) {
for (int ip=0; ip<(*numberOfPositions); ip++)
pos[ip]=detPositions[ip];

View File

@ -9,7 +9,7 @@
//float angle(int ichan, float encoder, float totalOffset, float conv_r, float center, float offset, float tilt, int direction)
//double angle(int ichan, double encoder, double totalOffset, double conv_r, double center, double offset, double tilt, int direction)
using namespace std;
@ -18,14 +18,14 @@ using namespace std;
@short Angular conversion constants needed for a detector 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;
@ -105,7 +105,7 @@ class angularConversion : public virtual slsDetectorBase {
\param nbins number of bins
\returns OK or FAIL
*/
static int resetMerging(float *mp, float *mv,float *me, int *mm, int nbins);
static int resetMerging(double *mp, double *mv,double *me, int *mm, int nbins);
/**
sets the arrays of the merged data to 0. NB The array should be created with size >= 360./getBinSize();
\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);
};

View File

@ -19,17 +19,17 @@ class detectorData {
\param np number of points in x coordinate defaults to the number of detector channels (1D detector)
\param 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*/

View File

@ -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; i<n; i++) {
@ -121,7 +121,7 @@ int energyCalibrationFunctions::quick_select(int arr[], int n){
int energyCalibrationFunctions::kth_smallest(int *a, int n, int k){
register int i,j,l,m ;
register float x ;
register double x ;
l=0 ; m=n-1 ;
while (l<m) {

View File

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

View File

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

View File

@ -26,7 +26,7 @@ class energyConversion: private virtual slsDetectorDefs {
\param gain reference to the gain variable
\offset reference to the offset variable
*/
static int readCalibrationFile(string fname, float &gain, float &offset);
static int readCalibrationFile(string fname, double &gain, double &offset);
/**
@ -35,7 +35,7 @@ class energyConversion: private virtual slsDetectorDefs {
\param gain
\param offset
*/
static int writeCalibrationFile(string fname, float gain, float offset);
static int writeCalibrationFile(string fname, double gain, double offset);
/**

View File

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

View File

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

View File

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

View File

@ -58,7 +58,7 @@ class postProcessing : public virtual angularConversion, public virtual fileIO
\param ecorr if !=NULL will be filled with the correction coefficients errors
\returns 0 if ff correction disabled, >0 otherwise
*/
virtual int getFlatFieldCorrection(float *corr=NULL, float *ecorr=NULL)=0;
virtual int getFlatFieldCorrection(double *corr=NULL, double *ecorr=NULL)=0;
/**
set flat field corrections
@ -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<<WRITE_FILE)); if(i==0) ((*correctionMask)&=~(1<< WRITE_FILE)); return ((*correctionMask)&(1<< WRITE_FILE));};
@ -190,7 +190,7 @@ s
\returns nothing
*/
void doProcessing(float* myData, int delflag, string fname);
void doProcessing(double* myData, int delflag, string fname);
/**
@ -229,8 +229,8 @@ s
virtual int rateCorrect(float*, float*, float*, float*)=0;
virtual int flatFieldCorrect(float*, float*, float*, float*)=0;
virtual int rateCorrect(double*, double*, double*, double*)=0;
virtual int flatFieldCorrect(double*, double*, double*, double*)=0;
@ -343,20 +343,20 @@ s
/**
I0 measured
*/
float currentI0;
double currentI0;
float *fdata;
double *fdata;
// private:
/* 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 int getTotalNumberOfChannels()=0; */

View File

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

View File

@ -58,7 +58,7 @@ class postProcessing : public virtual fileIO {
\param ecorr if !=NULL will be filled with the correction coefficients errors
\returns 0 if ff correction disabled, >0 otherwise
*/
virtual int getFlatFieldCorrection(float *corr=NULL, float *ecorr=NULL)=0;
virtual int getFlatFieldCorrection(double *corr=NULL, double *ecorr=NULL)=0;
/**
set flat field corrections
@ -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<<WRITE_FILE)); if(i==0) ((*correctionMask)&=~(1<< WRITE_FILE)); return ((*correctionMask)&(1<< WRITE_FILE));};
@ -190,7 +190,7 @@ s
\returns nothing
*/
void doProcessing(float* myData, int delflag, string fname);
void doProcessing(double* myData, int delflag, string fname);
/**
@ -229,8 +229,8 @@ s
virtual int rateCorrect(float*, float*, float*, float*)=0;
virtual int flatFieldCorrect(float*, float*, float*, float*)=0;
virtual int rateCorrect(double*, double*, double*, double*)=0;
virtual int flatFieldCorrect(double*, double*, double*, double*)=0;
@ -326,9 +326,9 @@ s
/**
I0 measured
*/
float currentI0;
double currentI0;
float *fdata;
double *fdata;