mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 03:10:02 +02:00
almost compiling on 64bit...
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@297 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
0c89b0986f
commit
6fb6f72bc3
@ -1,4 +1,4 @@
|
|||||||
CFLAGS= -DC_ONLY
|
CFLAGS= -DC_ONLY -fPIC
|
||||||
#FLAGS+= #-DVERBOSE -DVERYVERBOSE
|
#FLAGS+= #-DVERBOSE -DVERYVERBOSE
|
||||||
|
|
||||||
DFLAGS= -DDACS_INT
|
DFLAGS= -DDACS_INT
|
||||||
@ -40,11 +40,11 @@ picassoServer: $(SRC_MYTHEN_SVC)
|
|||||||
|
|
||||||
|
|
||||||
%.o : %.cpp %.h
|
%.o : %.cpp %.h
|
||||||
$(CXX) -Wall -o $@ -c $< $(INCLUDES) $(DFLAGS) $(FLAGS) $(EPICSFLAGS)
|
$(CXX) -Wall -o $@ -c $< $(INCLUDES) $(DFLAGS) $(FLAGS) -fPIC $(EPICSFLAGS)
|
||||||
|
|
||||||
|
|
||||||
package: $(OBJS)
|
package: $(OBJS)
|
||||||
$(CXX) -shared -Wl,-soname,libSlsDetector.so -o libSlsDetector.so $(OBJS) -lc $(INCLUDES) $(DFLAGS) $(FLAGS) $(EPICSFLAGS)
|
$(CXX) -shared -Wl,-soname,libSlsDetector.so -o libSlsDetector.so $(OBJS) -lc $(INCLUDES) $(DFLAGS) $(FLAGS) $(EPICSFLAGS)
|
||||||
ar rcs libSlsDetector.a $(OBJS)
|
ar rcs libSlsDetector.a $(OBJS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
@ -22,9 +22,9 @@ using namespace std;
|
|||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
void init_dataset(int *nMod, int *chPerMod, int* modMask, int *badChanMask, double *ffCoeff, double *ffErr, double *tDead, double *angRadius, double *angOffset, double *angCenter, double *totalOff, double *binSize, double * sampleX, double* sampleY);
|
void init_dataset(int *nMod, int *chPerMod, int* modMask, int *badChanMask, double *ffCoeff, double *ffErr, double *tDead, int *dir, double *angRadius, double *angOffset, double *angCenter, double *totalOff, double *binSize, double * sampleX, double* sampleY);
|
||||||
void finalize_dataset(double *outang, double *outval, double *outerr, int *np);
|
void finalize_dataset(double *outang, double *outval, double *outerr, int *np);
|
||||||
void add_frame(double *data, double *pos, double *i0, char *fn, double *var);
|
void add_frame(double *data, double *pos, double *i0, double *exptime, char *fn, double *var);
|
||||||
void calculate_flat_field(int *nMod, int *chPerMod, int *modMask,int *badChanMask, double *data, double *ffc, double *fferr);
|
void calculate_flat_field(int *nMod, int *chPerMod, int *modMask,int *badChanMask, double *data, double *ffc, double *fferr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,13 +39,13 @@ class externPostProcessing
|
|||||||
virtual ~externPostProcessing(){};
|
virtual ~externPostProcessing(){};
|
||||||
|
|
||||||
|
|
||||||
static int InitDataset(int *nModules,int *chPerMod,int moduleMask[],int badChans[], double ffcoeff[], double fferr[], double* tDead, double angRadius[], double angOffset[], double angCentre[], double* totalOffset, double* binSize, double *sampleX, double *sampleY);
|
static int InitDataset(int *nModules,int *chPerMod,int moduleMask[],int badChans[], double ffcoeff[], double fferr[], double* tDead, int *dir, double angRadius[], double angOffset[], double angCentre[], double* totalOffset, double* binSize, double *sampleX, double *sampleY);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int finalizeDataset(double ang[], double val[], double err[], int *np);
|
static int finalizeDataset(double ang[], double val[], double err[], int *np);
|
||||||
|
|
||||||
static int addFrame(double data[], double *pos, double *IO, double expTime, const char *filename, int *var=0);
|
static int addFrame(double data[], double *pos, double *IO, double *expTime, const char *filename, int *var=0);
|
||||||
|
|
||||||
static int calculateFlatField(int* nModules, int *chPerMod, int moduleMask[], int badChannelMask[], double ffData[], double ffCoeff[], double ffErr[]);
|
static int calculateFlatField(int* nModules, int *chPerMod, int moduleMask[], int badChannelMask[], double ffData[], double ffCoeff[], double ffErr[]);
|
||||||
|
|
||||||
|
@ -2194,7 +2194,7 @@ dacs_t multiSlsDetector::getADC(dacIndex idac, int imod) {
|
|||||||
return ret1;
|
return ret1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int multiSlsDetector::setChannel(long long reg, int ichan, int ichip, int imod) {
|
int multiSlsDetector::setChannel(int64_t reg, int ichan, int ichip, int imod) {
|
||||||
int ret, ret1=-100;
|
int ret, ret1=-100;
|
||||||
int id=-1, im=-1;
|
int id=-1, im=-1;
|
||||||
int dmi=0, dma=thisMultiDetector->numberOfDetectors;
|
int dmi=0, dma=thisMultiDetector->numberOfDetectors;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "slsDetectorActions.h"
|
#include "slsDetectorActions.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ class slsDetectorActions : public virtual slsDetectorBase
|
|||||||
|
|
||||||
|
|
||||||
virtual int setThresholdEnergy(int, int im=-1, detectorSettings isettings=GET_SETTINGS)=0;
|
virtual int setThresholdEnergy(int, int im=-1, detectorSettings isettings=GET_SETTINGS)=0;
|
||||||
virtual int setChannel(long long, int ich=-1, int ichip=-1, int imod=-1)=0;
|
virtual int setChannel(int64_t, int ich=-1, int ichip=-1, int imod=-1)=0;
|
||||||
|
|
||||||
|
|
||||||
int setStartIndex(int i=-1){if (i>=0) {startIndex=i; lastIndex=startIndex; nowIndex=startIndex;};return startIndex;};
|
int setStartIndex(int i=-1){if (i>=0) {startIndex=i; lastIndex=startIndex; nowIndex=startIndex;};return startIndex;};
|
||||||
|
@ -194,11 +194,37 @@ string slsDetectorUsers::getDetectorType(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void slsDetectorUsers::initDataset(int refresh){
|
||||||
|
myDetector->initDataset(refresh);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void slsDetectorUsers::addFrame(double *data, double pos, double i0, double t, string fname, double var){
|
||||||
|
myDetector->addFrame(data,pos,i0,t,fname,var);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsDetectorUsers::finalizeDataset(double *a, double *v, double *e, int &np){
|
||||||
|
myDetector->finalizeDataset(a, v, e, np);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void slsDetectorUsers::registerDataCallback(int( *userCallback)(detectorData*, void*), void *pArg){
|
void slsDetectorUsers::registerDataCallback(int( *userCallback)(detectorData*, void*), void *pArg){
|
||||||
myDetector->registerDataCallback(userCallback,pArg);
|
myDetector->registerDataCallback(userCallback,pArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void slsDetectorUsers::registerRawDataCallback(int( *userCallback)(double*, void*), void *pArg){
|
void slsDetectorUsers::registerRawDataCallback(int( *userCallback)(double*, int, void*), void *pArg){
|
||||||
myDetector->registerRawDataCallback(userCallback,pArg);
|
myDetector->registerRawDataCallback(userCallback,pArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,11 +358,45 @@ class slsDetectorUsers
|
|||||||
void registerDataCallback(int( *userCallback)(detectorData*, void*), void *pArg);
|
void registerDataCallback(int( *userCallback)(detectorData*, void*), void *pArg);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@short register calbback for accessing raw data
|
@short register callback for accessing raw data - if the rawDataCallback is registered, no filewriting/postprocessing will be carried on automatically by the software - the raw data are deleted by the software
|
||||||
\param userCallback function for postprocessing and saving the data
|
\param userCallback function for postprocessing and saving the data - p is the pointer to the data, n is the number of channels
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void registerRawDataCallback(int( *userCallback)(double*, void*), void *pArg);
|
void registerRawDataCallback(int( *userCallback)(double* p, int n, void*), void *pArg);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@short function to initalize a set of measurements (reset binning if angular conversion, reset summing otherwise) - can be overcome by the user's functions thanks to the virtual property
|
||||||
|
\param refresh if 1, all parameters like ffcoefficients, badchannels, ratecorrections etc. are reset (should be called at least onece with this option), if 0 simply reset merging/ summation
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual void initDataset(int refresh);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
@short adds frame to merging/summation - can be overcome by the user's functions thanks to the virtual property
|
||||||
|
\param data pointer to the raw data
|
||||||
|
\param pos encoder position
|
||||||
|
\param i0 beam monitor readout for intensity normalization (if 0 not performed)
|
||||||
|
\param t exposure time in seconds, required only if rate corrections
|
||||||
|
\param fname file name (unused since filewriting would be performed by the user)
|
||||||
|
\param var optional parameter - unused.
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual void addFrame(double *data, double pos, double i0, double t, string fname, double var);
|
||||||
|
|
||||||
|
/**
|
||||||
|
@short finalizes the data set returning the array of angles, values and errors to be used as final data - can be overcome by the user's functions thanks to the virtual property
|
||||||
|
\param a pointer to the array of angles - can be null if no angular coversion is required
|
||||||
|
\param v pointer to the array of values
|
||||||
|
\param e pointer to the array of errors
|
||||||
|
\param np reference returning the number of points
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual void finalizeDataset(double *a, double *v, double *e, int &np);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@short register calbback for accessing detector final data
|
@short register calbback for accessing detector final data
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -69,31 +69,18 @@ double* angularConversionStatic::convertAngles(double pos, int nch, int *chansPe
|
|||||||
return ang;
|
return ang;
|
||||||
}
|
}
|
||||||
|
|
||||||
double angularConversionStatic::convertAngle(double pos, int ich, int *chansPerMod, angleConversionConstant **angOff, int *mF, double fo, double go, int angdir) {
|
|
||||||
|
|
||||||
int imod=0;
|
|
||||||
double ang;
|
|
||||||
|
|
||||||
|
|
||||||
|
double angularConversionStatic::convertAngle(double pos, int ich, angleConversionConstant *p, int mF, double fo, double go, int angdir) {
|
||||||
|
|
||||||
|
|
||||||
double enc=0, trans=0;
|
double enc=0, trans=0;
|
||||||
angleConversionConstant *p=NULL;
|
double ang;
|
||||||
|
|
||||||
int ch0=0;
|
switch (mF) {
|
||||||
int chlast=chansPerMod[0]-1;
|
|
||||||
int nchmod=chansPerMod[0];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while (ich>chlast) {
|
|
||||||
imod++;
|
|
||||||
ch0=chlast+1;
|
|
||||||
nchmod=chansPerMod[imod];
|
|
||||||
chlast=ch0+nchmod-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
p=angOff[imod];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch (mF[imod]) {
|
|
||||||
case 0:
|
case 0:
|
||||||
enc=0;
|
enc=0;
|
||||||
trans=0;
|
trans=0;
|
||||||
@ -119,10 +106,8 @@ double angularConversionStatic::convertAngle(double pos, int ich, int *chansPerM
|
|||||||
trans=0;
|
trans=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (p)
|
if (p)
|
||||||
ang=angle(ich-ch0, \
|
ang=angle(ich, \
|
||||||
enc, \
|
enc, \
|
||||||
fo+go, \
|
fo+go, \
|
||||||
p->r_conversion, \
|
p->r_conversion, \
|
||||||
@ -133,6 +118,47 @@ double angularConversionStatic::convertAngle(double pos, int ich, int *chansPerM
|
|||||||
|
|
||||||
return ang;
|
return ang;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
double angularConversionStatic::convertAngle(double pos, int ich, int *chansPerMod, angleConversionConstant **angOff, int *mF, double fo, double go, int angdir) {
|
||||||
|
|
||||||
|
int imod=0;
|
||||||
|
double ang;
|
||||||
|
double enc=0, trans=0;
|
||||||
|
angleConversionConstant *p=NULL;
|
||||||
|
|
||||||
|
int ch0=0;
|
||||||
|
int chlast=chansPerMod[0]-1;
|
||||||
|
int nchmod=chansPerMod[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
while (ich>chlast) {
|
||||||
|
imod++;
|
||||||
|
ch0=chlast+1;
|
||||||
|
nchmod=chansPerMod[imod];
|
||||||
|
chlast=ch0+nchmod-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
p=angOff[imod];
|
||||||
|
|
||||||
|
|
||||||
|
ang=convertAngle(pos, ich-ch0, p, mF[imod], fo, go, angdir);
|
||||||
|
|
||||||
|
return ang;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -162,12 +188,13 @@ int angularConversionStatic::readAngularConversion(string fname, int nmod, angle
|
|||||||
int angularConversionStatic::readAngularConversion( ifstream& infile, int nmod, angleConversionConstant *angOff) {
|
int angularConversionStatic::readAngularConversion( ifstream& infile, int nmod, angleConversionConstant *angOff) {
|
||||||
string str;
|
string str;
|
||||||
int mod;
|
int mod;
|
||||||
double center, ecenter;
|
double center, ecenter, pitch, epitch;
|
||||||
double r_conv, er_conv;
|
double r_conv, er_conv;
|
||||||
double off, eoff;
|
double off, eoff;
|
||||||
string ss;
|
string ss;
|
||||||
int interrupt=0;
|
int interrupt=0;
|
||||||
int nm=0;
|
int nm=0;
|
||||||
|
int newangconv=0;
|
||||||
//" module %i center %E +- %E conversion %E +- %E offset %f +- %f \n"
|
//" module %i center %E +- %E conversion %E +- %E offset %f +- %f \n"
|
||||||
while (infile.good() and interrupt==0) {
|
while (infile.good() and interrupt==0) {
|
||||||
getline(infile,str);
|
getline(infile,str);
|
||||||
@ -178,18 +205,31 @@ int angularConversionStatic::readAngularConversion( ifstream& infile, int nmod,
|
|||||||
istringstream ssstr(str);
|
istringstream ssstr(str);
|
||||||
ssstr >> ss >> mod;
|
ssstr >> ss >> mod;
|
||||||
ssstr >> ss >> center;
|
ssstr >> ss >> center;
|
||||||
|
if (ss==string("center"))
|
||||||
|
newangconv=1;
|
||||||
ssstr >> ss >> ecenter;
|
ssstr >> ss >> ecenter;
|
||||||
|
if (newangconv) {
|
||||||
|
ssstr >> ss >> pitch;
|
||||||
|
ssstr >> ss >> epitch;
|
||||||
|
}
|
||||||
ssstr >> ss >> r_conv;
|
ssstr >> ss >> r_conv;
|
||||||
ssstr >> ss >> er_conv;
|
ssstr >> ss >> er_conv;
|
||||||
ssstr >> ss >> off;
|
ssstr >> ss >> off;
|
||||||
ssstr >> ss >> eoff;
|
ssstr >> ss >> eoff;
|
||||||
if (nm<nmod && nm>=0 ) {
|
if (nm<nmod && nm>=0 ) {
|
||||||
angOff[nm].center=center;
|
if (newangconv==0) {
|
||||||
angOff[nm].r_conversion=r_conv;
|
angOff[nm].center=center;
|
||||||
angOff[nm].offset=off;
|
angOff[nm].r_conversion=r_conv;
|
||||||
angOff[nm].ecenter=ecenter;
|
angOff[nm].offset=off;
|
||||||
angOff[nm].er_conversion=er_conv;
|
angOff[nm].ecenter=ecenter;
|
||||||
angOff[nm].eoffset=eoff;
|
angOff[nm].er_conversion=er_conv;
|
||||||
|
angOff[nm].eoffset=eoff;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
angOff[nm].tilt=pitch;
|
||||||
|
angOff[nm].etilt=epitch;
|
||||||
|
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
//cout << nm<<" " << angOff[nm].offset << endl;
|
//cout << nm<<" " << angOff[nm].offset << endl;
|
||||||
|
@ -258,9 +258,9 @@ int angularConversionStatic::finalizeMerging(double *mp, double *mv, double *me,
|
|||||||
for (int ibin=0; ibin<nb; ibin++) {
|
for (int ibin=0; ibin<nb; ibin++) {
|
||||||
if (mm[ibin]>0) {
|
if (mm[ibin]>0) {
|
||||||
|
|
||||||
#ifdef VERBOSE
|
// #ifdef VERBOSE
|
||||||
cout << "finalize " << ibin << " "<< mm[ibin] << " " << mp[ibin]<< mv[ibin] << me[ibin] << endl;
|
// cout << "finalize " << ibin << " "<< mm[ibin] << " " << mp[ibin]<< mv[ibin] << me[ibin] << endl;
|
||||||
#endif
|
// #endif
|
||||||
mp[np]=mp[ibin]/mm[ibin];
|
mp[np]=mp[ibin]/mm[ibin];
|
||||||
mv[np]=mv[ibin]/mm[ibin];
|
mv[np]=mv[ibin]/mm[ibin];
|
||||||
me[np]=me[ibin]/mm[ibin];
|
me[np]=me[ibin]/mm[ibin];
|
||||||
@ -323,9 +323,9 @@ int angularConversionStatic::addToMerging(double *p1, double *v1, double *e1, d
|
|||||||
me[ibin]+=v1[ip];
|
me[ibin]+=v1[ip];
|
||||||
mm[ibin]++;
|
mm[ibin]++;
|
||||||
|
|
||||||
#ifdef VERBOSE
|
// #ifdef VERBOSE
|
||||||
cout << "add " << ibin << " "<< mm[ibin] << " " << mp[ibin]<< mv[ibin] << me[ibin] << endl;
|
// cout << "add " << ibin << " "<< mm[ibin] << " " << mp[ibin]<< mv[ibin] << me[ibin] << endl;
|
||||||
#endif
|
// #endif
|
||||||
} else
|
} else
|
||||||
return slsDetectorDefs::FAIL;
|
return slsDetectorDefs::FAIL;
|
||||||
}
|
}
|
||||||
@ -371,9 +371,9 @@ int angularConversionStatic::addPointToMerging(double p1, double v1, double e1,
|
|||||||
me[ibin]+=v1;
|
me[ibin]+=v1;
|
||||||
mm[ibin]++;
|
mm[ibin]++;
|
||||||
|
|
||||||
#ifdef VERBOSE
|
// #ifdef VERBOSE
|
||||||
cout << "add " << ibin << " "<< mm[ibin] << " " << mp[ibin]<< mv[ibin] << me[ibin] << endl;
|
// cout << "add " << ibin << " "<< mm[ibin] << " " << mp[ibin]<< mv[ibin] << me[ibin] << endl;
|
||||||
#endif
|
// #endif
|
||||||
} else
|
} else
|
||||||
return slsDetectorDefs::FAIL;
|
return slsDetectorDefs::FAIL;
|
||||||
|
|
||||||
|
@ -161,6 +161,9 @@ class angularConversionStatic
|
|||||||
double convertAngle(double pos, int ich, int *chansPerMod, angleConversionConstant **angOff, int *mF, double fo, double go, int angdir);
|
double convertAngle(double pos, int ich, int *chansPerMod, angleConversionConstant **angOff, int *mF, double fo, double go, int angdir);
|
||||||
|
|
||||||
|
|
||||||
|
double convertAngle(double pos, int ich, angleConversionConstant *angOff, int mF, double fo, double go, int angdir);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -116,7 +116,26 @@ class angularConversionStatic
|
|||||||
\returns OK or FAIL
|
\returns OK or FAIL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
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 );
|
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=NULL);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
merge dataset
|
||||||
|
\param p1 angular positions of dataset
|
||||||
|
\param v1 data
|
||||||
|
\param e1 errors
|
||||||
|
\param mp already merged postions
|
||||||
|
\param mv already merged data
|
||||||
|
\param me already merged errors (squared sum)
|
||||||
|
\param mm multiplicity of merged arrays
|
||||||
|
\param nchans number of channels
|
||||||
|
\param binsize size of angular bin
|
||||||
|
\param nb number of angular bins
|
||||||
|
\param badChanMask badchannelmask (if NULL does not correct for bad channels)
|
||||||
|
\returns OK or FAIL
|
||||||
|
*/
|
||||||
|
|
||||||
|
static int addPointToMerging(double p1, double v1, double e1, double *mp, double *mv,double *me, int *mm, double binsize, int nb);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -139,6 +158,8 @@ class angularConversionStatic
|
|||||||
|
|
||||||
double* convertAngles(double pos, int nch, int *chansPerMod, angleConversionConstant **angOff, int *mF, double fo, double go, int angdir);
|
double* convertAngles(double pos, int nch, int *chansPerMod, angleConversionConstant **angOff, int *mF, double fo, double go, int angdir);
|
||||||
|
|
||||||
|
double convertAngle(double pos, int ich, int *chansPerMod, angleConversionConstant **angOff, int *mF, double fo, double go, int angdir);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -3,26 +3,30 @@
|
|||||||
#include "angleConversionConstant.h"
|
#include "angleConversionConstant.h"
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
#include "usersFunctions.h"
|
#include "usersFunctions.h"
|
||||||
|
#elif EXTPP
|
||||||
|
#include "usersFunctions.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
postProcessing::postProcessing(): expTime(NULL), ang(NULL), val(NULL), err(NULL){
|
postProcessing::postProcessing(): expTime(NULL), ang(NULL), val(NULL), err(NULL), numberOfChannels(0){
|
||||||
pthread_mutex_t mp1 = PTHREAD_MUTEX_INITIALIZER;
|
pthread_mutex_t mp1 = PTHREAD_MUTEX_INITIALIZER;
|
||||||
mp=mp1;
|
mp=mp1;
|
||||||
pthread_mutex_init(&mp, NULL);
|
pthread_mutex_init(&mp, NULL);
|
||||||
mg=mp1;
|
// mg=mp1;
|
||||||
pthread_mutex_init(&mg, NULL);
|
// pthread_mutex_init(&mg, NULL);
|
||||||
//cout << "reg callback "<< endl;
|
//cout << "reg callback "<< endl;
|
||||||
dataReady = 0;
|
dataReady = 0;
|
||||||
pCallbackArg = 0;
|
pCallbackArg = 0;
|
||||||
#ifdef VERBOSE
|
|
||||||
registerDataCallback(&defaultDataReadyFunc, NULL);
|
|
||||||
#endif
|
|
||||||
//cout << "done "<< endl;
|
//cout << "done "<< endl;
|
||||||
rawDataReady = 0;
|
rawDataReady = 0;
|
||||||
pRawDataArg = 0;
|
pRawDataArg = 0;
|
||||||
|
#ifdef VERBOSE
|
||||||
|
registerDataCallback(&defaultDataReadyFunc, NULL);
|
||||||
|
#endif
|
||||||
|
#ifdef EXTPP
|
||||||
|
registerRawDataCallback(&defaultRawDataReadyFunc, NULL);
|
||||||
|
#endif
|
||||||
ppFun=new postProcessingFuncs();
|
ppFun=new postProcessingFuncs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,7 +34,9 @@ postProcessing::postProcessing(): expTime(NULL), ang(NULL), val(NULL), err(NULL)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
postProcessing::~postProcessing(){delete ppFun;};
|
postProcessing::~postProcessing(){
|
||||||
|
delete ppFun;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -62,49 +68,59 @@ void postProcessing::processFrame(int *myData, int delflag) {
|
|||||||
cout << "decode"<< endl;
|
cout << "decode"<< endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (rawDataReady) {
|
||||||
|
//#ifdef VERBOSE
|
||||||
|
cout << "raw data ready..." << endl;
|
||||||
|
//#endif
|
||||||
|
rawDataReady(fdata,numberOfChannels, pRawDataArg);
|
||||||
|
//#ifdef VERBOSE
|
||||||
|
cout << "done" << endl;
|
||||||
|
cout << "NO FILE WRITING AND/OR DATA PROCESSING DONE BY SLS DETECTOR SOFTWARE!!!" << endl;
|
||||||
|
//#endif
|
||||||
|
|
||||||
pthread_mutex_lock(&mp);
|
} else {
|
||||||
fname=createFileName();
|
|
||||||
pthread_mutex_unlock(&mp);
|
|
||||||
|
pthread_mutex_lock(&mp);
|
||||||
|
fname=createFileName();
|
||||||
|
pthread_mutex_unlock(&mp);
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "fname is " << fname << endl;
|
cout << "fname is " << fname << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Checking for write flag
|
//Checking for write flag
|
||||||
if((*correctionMask)&(1<<WRITE_FILE)) {
|
if((*correctionMask)&(1<<WRITE_FILE)) {
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "writing raw data " << endl;
|
cout << "writing raw data " << endl;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
//uses static function?!?!?!?
|
//uses static function?!?!?!?
|
||||||
writeDataFile (fname+string(".raw"),fdata, NULL, NULL, 'i');
|
writeDataFile (fname+string(".raw"),fdata, NULL, NULL, 'i');
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "done " << endl;
|
cout << "done " << endl;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
if (rawDataReady) {
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << "raw data ready..." << endl;
|
|
||||||
#endif
|
|
||||||
rawDataReady(fdata,pRawDataArg);
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << "done" << endl;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((*correctionMask) & ~(1<<WRITE_FILE)) {
|
|
||||||
doProcessing(fdata,delflag, fname);
|
|
||||||
} else
|
|
||||||
if (dataReady) {
|
|
||||||
thisData=new detectorData(fdata,NULL,NULL,getCurrentProgress(),(fname+string(".raw")).c_str(),getTotalNumberOfChannels());
|
|
||||||
dataReady(thisData, pCallbackArg);
|
|
||||||
delete thisData;
|
|
||||||
fdata=NULL;
|
|
||||||
}
|
}
|
||||||
|
if ((*correctionMask) & ~(1<<WRITE_FILE)) {
|
||||||
|
doProcessing(fdata,delflag, fname);
|
||||||
|
} else
|
||||||
|
if (dataReady) {
|
||||||
|
thisData=new detectorData(fdata,NULL,NULL,getCurrentProgress(),(fname+string(".raw")).c_str(),getTotalNumberOfChannels());
|
||||||
|
dataReady(thisData, pCallbackArg);
|
||||||
|
delete thisData;
|
||||||
|
fdata=NULL;
|
||||||
|
}
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "findex incremented " << endl;
|
||||||
|
#endif
|
||||||
|
if(*correctionMask&(1<<WRITE_FILE))
|
||||||
|
IncrementFileIndex();
|
||||||
|
}
|
||||||
|
|
||||||
delete [] myData;
|
delete [] myData;
|
||||||
if (fdata)
|
if (fdata)
|
||||||
@ -116,20 +132,15 @@ void postProcessing::processFrame(int *myData, int delflag) {
|
|||||||
cout << "Pop data queue " << *fileIndex << endl;
|
cout << "Pop data queue " << *fileIndex << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(*correctionMask&(1<<WRITE_FILE))
|
|
||||||
IncrementFileIndex();
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << "findex incremented " << endl;
|
|
||||||
#endif
|
|
||||||
popDataQueue(); //remove the data from the queue
|
popDataQueue(); //remove the data from the queue
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Pop data queue " << *fileIndex << endl;
|
cout << "Data queue popped" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "processing returning " << *fileIndex << endl;
|
cout << "process frame returning " << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -144,13 +155,7 @@ void postProcessing::doProcessing(double *lfdata, int delflag, string fname) {
|
|||||||
cout << "do processing - data size is " << arraySize << endl;
|
cout << "do processing - data size is " << arraySize << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (*correctionMask&(1<< ANGULAR_CONVERSION))
|
|
||||||
ang=new double[arraySize];
|
|
||||||
else
|
|
||||||
ang=NULL;
|
|
||||||
|
|
||||||
val=new double[arraySize];
|
|
||||||
err=new double[arraySize];
|
|
||||||
int np;
|
int np;
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -178,22 +183,31 @@ void postProcessing::doProcessing(double *lfdata, int delflag, string fname) {
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "init dataset" << endl;
|
cout << "init dataset" << endl;
|
||||||
#endif
|
#endif
|
||||||
ppFun->initDataset();
|
|
||||||
}
|
|
||||||
|
if (*correctionMask&(1<< ANGULAR_CONVERSION))
|
||||||
|
ang=new double[arraySize];
|
||||||
|
else
|
||||||
|
ang=NULL;
|
||||||
|
|
||||||
|
val=new double[arraySize];
|
||||||
|
err=new double[arraySize];
|
||||||
|
initDataset(0);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "add frame" << endl;
|
cout << "add frame" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ppFun->addFrame(lfdata, ¤tPosition, ¤tI0, &t, (fname).c_str(), NULL);
|
addFrame(lfdata,currentPosition, currentI0, t, fname, 0);
|
||||||
|
|
||||||
if ((GetCurrentPositionIndex()>=npos && positionFinished() && dataQueueSize()) || npos==0) {
|
if ((GetCurrentPositionIndex()>=npos && positionFinished() && dataQueueSize()) || npos==0) {
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "finalize dataset" << endl;
|
cout << "finalize dataset" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ppFun->finalizeDataset(ang, val, err, &np);
|
finalizeDataset(ang, val, err, np);
|
||||||
IncrementPositionIndex();
|
IncrementPositionIndex();
|
||||||
|
|
||||||
pthread_mutex_lock(&mp);
|
pthread_mutex_lock(&mp);
|
||||||
@ -202,7 +216,6 @@ void postProcessing::doProcessing(double *lfdata, int delflag, string fname) {
|
|||||||
|
|
||||||
|
|
||||||
if((*correctionMask)&(1<<WRITE_FILE)) {
|
if((*correctionMask)&(1<<WRITE_FILE)) {
|
||||||
//cout << "write to file " << fname+ext << " " << np << " " << ang<< " " << val << " " << err << endl;
|
|
||||||
writeDataFile (fname+ext,np,val, err,ang,'f');
|
writeDataFile (fname+ext,np,val, err,ang,'f');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,6 +228,7 @@ void postProcessing::doProcessing(double *lfdata, int delflag, string fname) {
|
|||||||
val=NULL;
|
val=NULL;
|
||||||
err=NULL;
|
err=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ang)
|
if (ang)
|
||||||
delete [] ang;
|
delete [] ang;
|
||||||
if (val)
|
if (val)
|
||||||
@ -222,7 +236,11 @@ void postProcessing::doProcessing(double *lfdata, int delflag, string fname) {
|
|||||||
if (err)
|
if (err)
|
||||||
delete [] err;
|
delete [] err;
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -414,16 +432,16 @@ int* postProcessing::popDataQueue() {
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
detectorData* postProcessing::popFinalDataQueue() {
|
// detectorData* postProcessing::popFinalDataQueue() {
|
||||||
detectorData *retval=NULL;
|
// detectorData *retval=NULL;
|
||||||
pthread_mutex_unlock(&mg);
|
// pthread_mutex_unlock(&mg);
|
||||||
if( !finalDataQueue.empty() ) {
|
// if( !finalDataQueue.empty() ) {
|
||||||
retval=finalDataQueue.front();
|
// retval=finalDataQueue.front();
|
||||||
finalDataQueue.pop();
|
// finalDataQueue.pop();
|
||||||
}
|
// }
|
||||||
pthread_mutex_unlock(&mg);
|
// pthread_mutex_unlock(&mg);
|
||||||
return retval;
|
// return retval;
|
||||||
}
|
// }
|
||||||
|
|
||||||
void postProcessing::resetDataQueue() {
|
void postProcessing::resetDataQueue() {
|
||||||
int *retval=NULL;
|
int *retval=NULL;
|
||||||
@ -437,30 +455,24 @@ void postProcessing::resetDataQueue() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void postProcessing::resetFinalDataQueue() {
|
// void postProcessing::resetFinalDataQueue() {
|
||||||
detectorData *retval=NULL;
|
// detectorData *retval=NULL;
|
||||||
pthread_mutex_lock(&mg);
|
// pthread_mutex_lock(&mg);
|
||||||
while( !finalDataQueue.empty() ) {
|
// while( !finalDataQueue.empty() ) {
|
||||||
retval=finalDataQueue.front();
|
// retval=finalDataQueue.front();
|
||||||
finalDataQueue.pop();
|
// finalDataQueue.pop();
|
||||||
delete retval;
|
// delete retval;
|
||||||
}
|
// }
|
||||||
pthread_mutex_unlock(&mg);
|
// pthread_mutex_unlock(&mg);
|
||||||
}
|
// }
|
||||||
|
void postProcessing::initDataset(int r) {
|
||||||
|
|
||||||
|
if (r) {
|
||||||
|
|
||||||
void postProcessing::startThread(int delflag) {
|
int nmod=getNMods();
|
||||||
|
int *chPM=new int[nmod];
|
||||||
/////////////////////////////////// Initialize dataset
|
int *mM=new int[nmod];
|
||||||
|
int totch=0;
|
||||||
//resetDataQueue();
|
|
||||||
|
|
||||||
setTotalProgress();
|
|
||||||
|
|
||||||
int nmod=getNMods();
|
|
||||||
int *chPM=new int[nmod];
|
|
||||||
int *mM=new int[nmod];
|
|
||||||
int totch=0;
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "init dataset stuff" << endl;
|
cout << "init dataset stuff" << endl;
|
||||||
#endif
|
#endif
|
||||||
@ -487,7 +499,7 @@ void postProcessing::startThread(int delflag) {
|
|||||||
|
|
||||||
if (*correctionMask&(1<<FLAT_FIELD_CORRECTION)) {
|
if (*correctionMask&(1<<FLAT_FIELD_CORRECTION)) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "get ff " << endl;
|
cout << "get ff " << endl;
|
||||||
#endif
|
#endif
|
||||||
ffcoeff=new double[totch];
|
ffcoeff=new double[totch];
|
||||||
fferr=new double[totch];
|
fferr=new double[totch];
|
||||||
@ -554,16 +566,69 @@ void postProcessing::startThread(int delflag) {
|
|||||||
arraySize=totch;
|
arraySize=totch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
numberOfChannels=totch;
|
||||||
|
|
||||||
queuesize=dataQueueSize();
|
queuesize=dataQueueSize();
|
||||||
|
|
||||||
resetFinalDataQueue();
|
// resetFinalDataQueue();
|
||||||
resetDataQueue();
|
resetDataQueue();
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
ppFun->initDataset();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void postProcessing::addFrame(double *data, double pos, double i0, double t, string fname, double var) {
|
||||||
|
ppFun->addFrame(data, &pos, &i0, &t, fname.c_str(), &var);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void postProcessing::finalizeDataset(double *a, double *v, double *e, int &np) {
|
||||||
|
|
||||||
|
ppFun->finalizeDataset(a, v, e, &np);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void postProcessing::startThread(int delflag) {
|
||||||
|
|
||||||
|
/////////////////////////////////// Initialize dataset
|
||||||
|
|
||||||
|
//resetDataQueue();
|
||||||
|
|
||||||
|
setTotalProgress();
|
||||||
|
|
||||||
|
initDataset(1);
|
||||||
|
|
||||||
/////////////////////////////////// Start thread ////////////////////////////////////////////////////////
|
/////////////////////////////////// Start thread ////////////////////////////////////////////////////////
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "start thread stuff" << endl;
|
cout << "start thread stuff" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pthread_attr_t tattr;
|
pthread_attr_t tattr;
|
||||||
int ret;
|
int ret;
|
||||||
sched_param param, mparam;
|
sched_param param, mparam;
|
||||||
|
@ -184,12 +184,12 @@ s
|
|||||||
|
|
||||||
int dataQueueSize();
|
int dataQueueSize();
|
||||||
|
|
||||||
/**
|
/* /\** */
|
||||||
pops the data from thepostprocessed data queue
|
/* pops the data from thepostprocessed data queue */
|
||||||
\returns pointer to the popped data or NULL if the queue is empty.
|
/* \returns pointer to the popped data or NULL if the queue is empty. */
|
||||||
\sa finalDataQueue
|
/* \sa finalDataQueue */
|
||||||
*/
|
/* *\/ */
|
||||||
detectorData* popFinalDataQueue();
|
/* detectorData* popFinalDataQueue(); */
|
||||||
|
|
||||||
|
|
||||||
int checkJoinThread();
|
int checkJoinThread();
|
||||||
@ -202,11 +202,11 @@ s
|
|||||||
*/
|
*/
|
||||||
void resetDataQueue();
|
void resetDataQueue();
|
||||||
|
|
||||||
/**
|
/* /\** */
|
||||||
resets the postprocessed data queue
|
/* resets the postprocessed data queue */
|
||||||
\sa finalDataQueue
|
/* \sa finalDataQueue */
|
||||||
*/
|
/* *\/ */
|
||||||
void resetFinalDataQueue();
|
/* void resetFinalDataQueue(); */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ s
|
|||||||
void registerDataCallback(int( *userCallback)(detectorData*, void*), void *pArg) {dataReady = userCallback; pCallbackArg = pArg;};
|
void registerDataCallback(int( *userCallback)(detectorData*, void*), void *pArg) {dataReady = userCallback; pCallbackArg = pArg;};
|
||||||
|
|
||||||
|
|
||||||
void registerRawDataCallback(int( *userCallback)(double*, void*), void *pArg) {rawDataReady = userCallback; pRawDataArg = pArg;};
|
void registerRawDataCallback(int( *userCallback)(double*, int, void*), void *pArg) {rawDataReady = userCallback; pRawDataArg = pArg;};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -251,6 +251,15 @@ s
|
|||||||
int setCurrentPosition(double v) { pthread_mutex_lock(&mp); currentPosition=v; pthread_mutex_unlock(&mp); return currentPosition;};
|
int setCurrentPosition(double v) { pthread_mutex_lock(&mp); currentPosition=v; pthread_mutex_unlock(&mp); return currentPosition;};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void initDataset(int refresh);
|
||||||
|
void addFrame(double *data, double pos, double i0, double t, string fname, double var);
|
||||||
|
void finalizeDataset(double *a, double *v, double *e, int &np);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
int *threadedProcessing;
|
int *threadedProcessing;
|
||||||
@ -322,7 +331,7 @@ s
|
|||||||
int (*dataReady)(detectorData*,void*);
|
int (*dataReady)(detectorData*,void*);
|
||||||
void *pCallbackArg;
|
void *pCallbackArg;
|
||||||
|
|
||||||
int (*rawDataReady)(double*,void*);
|
int (*rawDataReady)(double*,int,void*);
|
||||||
void *pRawDataArg;
|
void *pRawDataArg;
|
||||||
|
|
||||||
|
|
||||||
@ -334,6 +343,7 @@ s
|
|||||||
double *val;
|
double *val;
|
||||||
double *err;
|
double *err;
|
||||||
|
|
||||||
|
int numberOfChannels;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,18 +70,30 @@ int postProcessingFuncs::finalizeDataset(double *ang, double *val, double *err,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int postProcessingFuncs::addFrame(double *data, double *pos, double *I0, double *expTime, const char *filename, int *var) {
|
int postProcessingFuncs::addFrame(double *data, double *pos, double *I0, double *expTime, const char *filename, double *var) {
|
||||||
|
|
||||||
|
|
||||||
double p1, vin, ein, vout, eout;
|
double p1, vin, ein, vout, eout;
|
||||||
double e=0.;
|
double e=0.;
|
||||||
double i0=*I0;
|
double i0=*I0;
|
||||||
|
int imod=0, ch0=0;
|
||||||
|
|
||||||
|
int chlast=chansPerMod[0]-1;
|
||||||
|
int nchmod=chansPerMod[0];
|
||||||
|
|
||||||
if (i0>0)
|
if (i0>0)
|
||||||
totalI0+=i0;
|
totalI0+=i0;
|
||||||
|
|
||||||
for (int ich=0; ich<totalChans; ich++) {
|
for (int ich=0; ich<totalChans; ich++) {
|
||||||
|
|
||||||
|
|
||||||
|
if (ich>chlast) {
|
||||||
|
imod++;
|
||||||
|
ch0=chlast+1;
|
||||||
|
nchmod=chansPerMod[imod];
|
||||||
|
chlast=ch0+nchmod-1;
|
||||||
|
}
|
||||||
|
|
||||||
vin=data[ich];
|
vin=data[ich];
|
||||||
ein=0;
|
ein=0;
|
||||||
vout=data[ich];
|
vout=data[ich];
|
||||||
@ -138,12 +150,14 @@ int postProcessingFuncs::addFrame(double *data, double *pos, double *I0, double
|
|||||||
//check module mask?!?!?!?
|
//check module mask?!?!?!?
|
||||||
|
|
||||||
|
|
||||||
p1=convertAngle(*pos,ich,chansPerMod,angConv,moduleMask,totalOffset,0,angDir);
|
p1=convertAngle(*pos,ich-ch0,angConv[imod],moduleMask[imod],totalOffset,0,angDir);
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "ppFuncs merge" << endl;
|
cout << "ppFuncs merge" << endl;
|
||||||
#endif
|
#endif
|
||||||
addPointToMerging(p1,vout,eout,mp,mv,me,mm, binSize, nBins);
|
addPointToMerging(p1,vout,eout,mp,mv,me,mm, binSize, nBins);
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "ppFuncs merge" << endl;
|
cout << "ppFuncs merge" << endl;
|
||||||
|
@ -38,7 +38,7 @@ class postProcessingFuncs : public virtual angularConversionStatic
|
|||||||
|
|
||||||
int finalizeDataset(double ang[], double val[], double err[], int *np);
|
int finalizeDataset(double ang[], double val[], double err[], int *np);
|
||||||
|
|
||||||
int addFrame(double data[], double *pos, double *IO, double *expTime, const char *filename, int *var=0);
|
int addFrame(double data[], double *pos, double *IO, double *expTime, const char *filename, double *var=0);
|
||||||
|
|
||||||
static int calculateFlatField(int* nModules, int *chPerMod, int moduleMask[], int badChannelMask[], double ffData[], double ffCoeff[], double ffErr[]);
|
static int calculateFlatField(int* nModules, int *chPerMod, int moduleMask[], int badChannelMask[], double ffData[], double ffCoeff[], double ffErr[]);
|
||||||
|
|
||||||
|
@ -321,5 +321,19 @@ int defaultDataReadyFunc(detectorData* d, void* p) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int defaultRawDataReadyFunc(double* d, int np, void* p) {
|
||||||
|
//#ifdef VERBOSE
|
||||||
|
printf("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU Raw Data received \n");
|
||||||
|
if (d==NULL)
|
||||||
|
printf("no data received\n");
|
||||||
|
else
|
||||||
|
printf("received %d channels\n",np);
|
||||||
|
|
||||||
|
printf("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU Finished \n");
|
||||||
|
//#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ extern "C" {
|
|||||||
double defaultGetI0(int t,void *d);
|
double defaultGetI0(int t,void *d);
|
||||||
|
|
||||||
int defaultDataReadyFunc(detectorData* d, void* p);
|
int defaultDataReadyFunc(detectorData* d, void* p);
|
||||||
|
int defaultRawDataReadyFunc(double* d, int np, void* p);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
Loading…
x
Reference in New Issue
Block a user