From 924f583be962f73b79594ea112c1996c139e9137 Mon Sep 17 00:00:00 2001 From: bergamaschi Date: Tue, 2 Oct 2012 08:52:01 +0000 Subject: [PATCH] Added f90Interface used at SLS X04SA git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@269 951219d9-93cf-4727-9268-0efd64621fa3 --- slsDetectorSoftware/Makefile.x04sa | 27 +- slsDetectorSoftware/doxy.config | 2 +- .../f90Interface/externPostProcessing.cpp | 48 +++ .../f90Interface/externPostProcessing.h | 65 ++++ .../f90Interface/sls_detector_analysis_f.f90 | 171 ++++++++++ .../slsDetectorAnalysis/angularConversion.h | 2 +- .../angularConversionStatic.cpp | 24 +- .../angularConversionStatic.cpp~ | 304 ++---------------- .../angularConversionStatic.h | 7 +- .../angularConversionStatic.h~ | 9 +- 10 files changed, 350 insertions(+), 309 deletions(-) create mode 100644 slsDetectorSoftware/f90Interface/externPostProcessing.cpp create mode 100644 slsDetectorSoftware/f90Interface/externPostProcessing.h create mode 100644 slsDetectorSoftware/f90Interface/sls_detector_analysis_f.f90 diff --git a/slsDetectorSoftware/Makefile.x04sa b/slsDetectorSoftware/Makefile.x04sa index 5a5eaf9d4..d5767b421 100644 --- a/slsDetectorSoftware/Makefile.x04sa +++ b/slsDetectorSoftware/Makefile.x04sa @@ -1,21 +1,29 @@ -INCLUDES= -IcommonFiles -IslsDetector -IMySocketTCP -IusersFunctions -ImultiSlsDetector -IslsDetectorUtils -IslsDetectorCommand -IslsDetectorAnalysis +INCLUDES= -IcommonFiles -IslsDetector -IMySocketTCP -IusersFunctions -ImultiSlsDetector -IslsDetectorUtils -IslsDetectorCommand -IslsDetectorAnalysis -If90Interface EPICSFLAGS=-D EPICS -I/usr/local/epics/base/include/ -I /usr/local/epics/base/include/os/Linux/ -L /usr/local/epics/base/lib/SL5-x86/ -Wl,-R/usr/local/epics/base/lib/SL5-x86 -lca -lCom CFLAGS= -DC_ONLY FLAGS= $(EPICSFLAGS) - -CC=g++ +CC=gcc +CXX=g++ -SRC_CLNT= slsDetectorAnalysis/fileIO.cpp MySocketTCP/MySocketTCP.cpp usersFunctions/usersFunctions.cpp slsDetector/slsDetectorUtils.cpp slsDetector/slsDetectorCommand.cpp slsDetectorAnalysis/angularConversion.cpp slsDetectorAnalysis/energyConversion.cpp slsDetector/slsDetectorActions.cpp slsDetectorAnalysis/postProcessing.cpp slsDetector/slsDetector.cpp multiSlsDetector/multiSlsDetector.cpp +SRC_CLNT= slsDetectorAnalysis/fileIO.cpp MySocketTCP/MySocketTCP.cpp usersFunctions/usersFunctions.cpp slsDetector/slsDetectorUtils.cpp slsDetector/slsDetectorCommand.cpp slsDetectorAnalysis/angularConversion.cpp slsDetectorAnalysis/energyConversion.cpp slsDetector/slsDetectorActions.cpp slsDetectorAnalysis/postProcessing.cpp slsDetector/slsDetector.cpp multiSlsDetector/multiSlsDetector.cpp f90Interface/externPostProcessing.cpp OBJS = $(SRC_CLNT:.cpp=.o) HEADERS = $(SRC_CLNT:.cpp=.h) commonFiles/sls_detector_defs.h slsDetectorAnalysis/detectorData.h slsDetector/slsDetectorBase.h slsDetector/slsDetectorUsers.h multiSlsDetector/multiSlsDetectorCommand.h +LGF=/usr/lib/gcc/i386-redhat-linux/4.1.2 +GCC=/usr/bin//gcc +FF=/opt/intel/intel-10.1/fc-10.1/bin/ifort + +SRC_F = f90Interface/sls_detector_analysis_f.f90 + +OBJS_F = f90Interface/sls_detector_analysis_f.o + SRC_MYTHEN_SVC = mythenDetectorServer/server.c mythenDetectorServer/server_funcs.c mythenDetectorServer/communication_funcs.c mythenDetectorServer/firmware_funcs.c mythenDetectorServer/mcb_funcs.c mythenDetectorServer/trimming_funcs.c @@ -43,12 +51,15 @@ picassoServer: $(SRC_MYTHEN_SVC) $(CXX) -Wall -o $@ -c $< $(INCLUDES) $(FLAGS) $(EPICSFLAGS) -package: $(OBJS) - $(CXX) -shared -Wl,-soname,libSlsDetector.so -o libSlsDetector.so $(OBJS) -lc $(INCLUDES) $(FLAGS) $(EPICSFLAGS) - ar rcs libSlsDetector.a $(OBJS) +$(OBJS_F) : $(SRC_F) + $(FF) -c $(SRC_F) + +package: $(OBJS) $(OBJS_F) + $(CXX) -shared -Wl,-soname,libSlsDetector.so -o libSlsDetector.so $(OBJS) $(OBJS_F) -lc $(INCLUDES) $(FLAGS) $(EPICSFLAGS) + ar rcs libSlsDetector.a $(OBJS) $(OBJS_F) clean: - rm -rf libSlsDetector.a libSlsDetector.so core docs/* $(OBJS) + rm -rf libSlsDetector.a libSlsDetector.so core docs/* $(OBJS) $(OBJS_F) #------------------------------------------------------------------------------- diff --git a/slsDetectorSoftware/doxy.config b/slsDetectorSoftware/doxy.config index f8f94c499..44787dc88 100644 --- a/slsDetectorSoftware/doxy.config +++ b/slsDetectorSoftware/doxy.config @@ -80,7 +80,7 @@ LATEX_HIDE_INDICES = YES PREDEFINED = __cplusplus -INPUT = slsDetector/slsDetectorUsers.h slsDetector/slsDetectorBase.h commonFiles/sls_detector_defs.h slsDetector/slsDetector.h MySocketTCP/MySocketTCP.h usersFunctions/usersFunctions.h multiSlsDetector/multiSlsDetector.h commonFiles/sls_detector_defs.h slsDetector/slsDetectorUtils.h slsDetector/slsDetectorBase.h slsDetector/slsDetectorCommand.h slsDetector/slsDetectorActions.h multiSlsDetector/multiSlsDetector.h slsDetectorAnalysis/detectorData.h slsDetectorAnalysis/energyConversion.h slsDetectorAnalysis/postProcessing.h slsDetectorAnalysis/angularConversion.h slsDetectorAnalysis/fileIO.h multiSlsDetector/multiSlsDetectorClient.h multiSlsDetector/multiSlsDetectorCommand.h +INPUT = slsDetector/slsDetectorUsers.h slsDetector/slsDetectorBase.h commonFiles/sls_detector_defs.h slsDetector/slsDetector.h MySocketTCP/MySocketTCP.h usersFunctions/usersFunctions.h multiSlsDetector/multiSlsDetector.h commonFiles/sls_detector_defs.h slsDetector/slsDetectorUtils.h slsDetector/slsDetectorBase.h slsDetector/slsDetectorCommand.h slsDetector/slsDetectorActions.h multiSlsDetector/multiSlsDetector.h slsDetectorAnalysis/detectorData.h slsDetectorAnalysis/energyConversion.h slsDetectorAnalysis/postProcessing.h slsDetectorAnalysis/angularConversion.h slsDetectorAnalysis/fileIO.h multiSlsDetector/multiSlsDetectorClient.h multiSlsDetector/multiSlsDetectorCommand.h slsDetectorAnalysis/angularConversionStatic.h slsDetectorAnalysis/angleConversionConstant.h slsDetectorAnalysis/enCalLogClass.h slsDetectorAnalysis/angCalLogClass.h slsDetectorAnalysis/badChannelCorrections.h slsDetectorAnalysis/fileIOStatic.h OUTPUT_DIRECTORY = docs diff --git a/slsDetectorSoftware/f90Interface/externPostProcessing.cpp b/slsDetectorSoftware/f90Interface/externPostProcessing.cpp new file mode 100644 index 000000000..0ce755e59 --- /dev/null +++ b/slsDetectorSoftware/f90Interface/externPostProcessing.cpp @@ -0,0 +1,48 @@ +#include "externPostProcessing.h" + + + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + + +using namespace std; + + + + +int externPostProcessing::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) + { + + init_dataset(nModules,chPerMod,moduleMask,badChans,ffcoeff,fferr,tDead,angRadius,angOffset,angCentre,totalOffset,binSize,sampleX,sampleY); + + return 0; + + } + +int externPostProcessing::finalizeDataset(double ang[], double val[], double err[]) +{ +cout<<"Finalize Dataset"< + +#include +#include +#include +#include +#include +#include +#include +#include + + +using namespace std; + + + +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 finalize_dataset(double *outang, double *outval, double *outerr, int *np); +void add_frame(double *data, double *pos, double *i0, char *fn, double *var); +void calculate_flat_field(int *nMod, int *chPerMod, int *modMask,int *badChanMask, double *data, double *ffc, double *fferr); +} + + + +class externPostProcessing : public virtual slsDetectorBase1 + +{ + + + + + public: + 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); + + + + int finalizeDataset(double ang[], double val[], double err[]); + + int addFrame(double data[], double *pos, double *IO, double expTime, const char *filename, int *var=0); + + int calculateFlatField(int* nModules, int badChannelMask[], double ffData[], double ffCoeff[], double ffErr[]); + + + + + }; + + +#endif diff --git a/slsDetectorSoftware/f90Interface/sls_detector_analysis_f.f90 b/slsDetectorSoftware/f90Interface/sls_detector_analysis_f.f90 new file mode 100644 index 000000000..0016d7ec1 --- /dev/null +++ b/slsDetectorSoftware/f90Interface/sls_detector_analysis_f.f90 @@ -0,0 +1,171 @@ +module ax +USE,INTRINSIC :: ISO_C_BINDING +IMPLICIT NONE +integer(C_LONG) :: numberofmodules,totalnumberofchannels +real(C_DOUBLE) :: numberofbins +real(C_DOUBLE) :: bincenter(360000), binvalue(360000), binerror(360000) + +contains + + +subroutine initdataset(nmodules, chpmod, modulemask,badchanmask,ffcoeff,fferr,tdead,angradius,angoffset,angcenter, totaloffset, binsize, samplex, sampley) bind(c, name='init_dataset') +IMPLICIT NONE +integer(C_LONG), intent(IN) :: nmodules, chpmod +integer(C_LONG), intent(IN) :: modulemask(nmodules), badchanmask(nmodules*chpmod) +real(C_DOUBLE), intent(IN) :: ffcoeff(nmodules*chpmod), fferr(nmodules*chpmod) +real(C_DOUBLE), intent(IN) :: tdead, totaloffset,binsize, samplex, sampley +real(C_DOUBLE), intent(IN) :: angradius(nmodules), angoffset(nmodules), angcenter(nmodules) +integer(C_LONG) :: i + +print*,'init dataset' + +numberofmodules=nmodules + +print*,'Number of modules:' +print*,numberofmodules +print*,'Channels per module:' +print*,chpmod + +totalnumberofchannels=nmodules*chpmod + +print*,'Total number of channels:' +print*,totalnumberofchannels + + +print*,'Modulemask:' +do i=1,nmodules + print*,i,modulemask(i) +enddo + +print*,'Badchannelmask:' +do i=1,nmodules*chpmod + print*,i,badchanmask(i) +enddo + +print*,'Flat field coefficients:' +do i=1,nmodules*chpmod + print*,i,ffcoeff(i),'+-',fferr(i) +enddo + +print*,'Tdead:' +print*,tdead + + +print*,'Angular conversion coefficients:' +do i=1,nmodules + print*,i,angradius(i),angoffset(i),angcenter(i) +enddo + + +print*,'Total offset:' +print*,totaloffset + +print*,'Bin size:' +print*,binsize + +numberofbins=360./binsize + + +print*,'Sample displacement:' +print*,samplex, sampley + +end subroutine initdataset + + + +subroutine resetdataset() bind(c, name='resetDataset') +IMPLICIT NONE + +print*,'reset dataset' + + +end subroutine resetdataset + + +subroutine finalizedataset(outang, outval, outerr, outnpoints) bind(c, name='finalize_dataset') +IMPLICIT NONE +integer(C_LONG), intent(OUT) :: outnpoints +real(C_DOUBLE), intent(OUT) :: outang(*), outval(*), outerr(*) +integer(C_LONG) :: i + +print*,'finalize dataset' + +outnpoints=numberofbins + +print*,'returning points:' +do i=1,numberofbins + + outang(i)=i; + outval(i)=i*100; + outerr(i)=i*0.1 + + print*,i,outang(i),outval(i),outerr(i) +enddo + +end subroutine finalizedataset + + + +subroutine addframe(data, pos, i0, fname, var) bind(c, name='add_frame') +IMPLICIT NONE +real(C_DOUBLE), intent(IN) :: data(totalnumberofchannels) +real(C_DOUBLE), intent(IN) :: pos, i0, var +character(kind=c_char), dimension(*), intent(IN) :: fname +integer :: l +integer :: i + +l=0 +do + if (fname(l+1) == C_NULL_CHAR) exit + l = l + 1 +end do + + +print*,'add frame' + +print*,'Filename: ' +print*,fname(1:l) + +print*,'Position: ' +print*,pos + +print*,'I0: ' +print*,i0 + +print*,'Var: ' +print*,var + +print*,'Data: ' +print*,data + + +end subroutine addframe + + + +subroutine calculateflatfield(nmodules, chpmod, modulemask, badchanmask,data, ffcoeff,fferr) bind(c, name='calculate_flat_field') + +IMPLICIT NONE +integer(C_LONG), intent(IN) :: nmodules, chpmod +integer(C_LONG), intent(IN) :: modulemask(nmodules), badchanmask(nmodules*chpmod) +real(C_DOUBLE), intent(IN) :: data(nmodules*chpmod) +real(C_DOUBLE), intent(OUT) :: ffcoeff(*),fferr(*) +integer(C_LONG) :: i + +real(C_DOUBLE) :: ave; + +print*,'calculate flat field' + +do i=1,nmodules*chpmod + ffcoeff(i)=data(i)*10. + fferr(i)=i + print*,i,data(i), ffcoeff(i),fferr(i) +enddo + + + + +end subroutine calculateflatfield + + +end module ax diff --git a/slsDetectorSoftware/slsDetectorAnalysis/angularConversion.h b/slsDetectorSoftware/slsDetectorAnalysis/angularConversion.h index 89346f72f..ee76388e1 100644 --- a/slsDetectorSoftware/slsDetectorAnalysis/angularConversion.h +++ b/slsDetectorSoftware/slsDetectorAnalysis/angularConversion.h @@ -35,7 +35,7 @@ class containing the methods to set/unset the angular conversion and merge the d The angular conversion itself is defined by the angle() function defined in usersFunctions.cpp */ -class angularConversion : public virtual slsDetectorBase, public virtual angularConversionStatic +class angularConversion : public virtual slsDetectorBase, public angularConversionStatic { diff --git a/slsDetectorSoftware/slsDetectorAnalysis/angularConversionStatic.cpp b/slsDetectorSoftware/slsDetectorAnalysis/angularConversionStatic.cpp index e6a1bf832..28b7e93d5 100644 --- a/slsDetectorSoftware/slsDetectorAnalysis/angularConversionStatic.cpp +++ b/slsDetectorSoftware/slsDetectorAnalysis/angularConversionStatic.cpp @@ -4,7 +4,9 @@ #include #include #include +#include "angleConversionConstant.h" +#include "sls_detector_defs.h" #include "angleFunction.h" using namespace std; @@ -180,7 +182,7 @@ int angularConversionStatic::resetMerging(double *mp, double *mv, double *me, in me[ibin]=0; mm[ibin]=0; } - return OK; + return slsDetectorDefs::OK; } @@ -214,25 +216,25 @@ int angularConversionStatic::addToMerging(double *p1, double *v1, double *e1, d if (p1==NULL) return 0; if (v1==NULL) - return FAIL; + return slsDetectorDefs::FAIL; if (mp==NULL) //can be changed if we want to use a fixed bin algorithm! - return FAIL; + return slsDetectorDefs::FAIL; if (mv==NULL) - return FAIL; + return slsDetectorDefs::FAIL; if (me==NULL) - return FAIL; + return slsDetectorDefs::FAIL; if (mm==NULL) - return FAIL; + return slsDetectorDefs::FAIL; if (nchans==0) - return FAIL; + return slsDetectorDefs::FAIL; if (binsize<=0) - return FAIL; + return slsDetectorDefs::FAIL; if (nbins<=0) - return FAIL; + return slsDetectorDefs::FAIL; for (int ip=0; ip #include #include #include -#ifndef MYROOT -#include "usersFunctions.h" -#endif #include "angleFunction.h" using namespace std; -angularConversion::angularConversion(): currentPosition(0), - currentPositionIndex(0) +angularConversionStatic::angularConversionStatic() { //angleFunctionPointer=0; registerAngleFunctionCallback(&defaultAngleFunction); } -angularConversion::~angularConversion(){ +angularConversionStatic::~angularConversionStatic(){ } -// int angularConversion::setAngularConversionPointer(angleConversionConstant *p, int *nm, int nch, int idet) { -// if (p) { -// angOff[idet]=p; -// nMods[idet]=nm; -// nCh[idet]=nch; -// } else { -// angOff[idet]=NULL; -// nMods[idet]=NULL; -// } - -// return OK; -// } - - -double* angularConversion::convertAngles(double pos, int nch) { +double* angularConversionStatic::convertAngles(double pos, int nch, int *chansPerMod, angleConversionConstant **angOff, int *mF, double fo, double go, int angdir) { int imod=0; double *ang=new double[nch]; double enc=pos; angleConversionConstant *p=NULL; - + int ch0=0; - int chlast=getChansPerMod(0); - int nchmod=getChansPerMod(0); - p=getAngularConversionPointer(imod); - if (getMoveFlag(imod)==0) + int chlast=chansPerMod[0]; + int nchmod=chansPerMod[0]; + p=angOff[imod]; + if (mF[imod]==0) enc=0; else enc=pos; - + for (int ip=0; ip=chlast) { imod++; - p=getAngularConversionPointer(imod); - if (getMoveFlag(imod)==0) + p=angOff[imod]; + if (mF[imod]==0) enc=0; else enc=pos; ch0=chlast; - nchmod=getChansPerMod(imod); + nchmod=chansPerMod[imod]; if (nchmod>0) chlast+=nchmod; } if (p) - ang[ip]=angle(ip-ch0, \ + ang[ip]=angle(ip-ch0, \ enc, \ - (*fineOffset)+(*globalOffset), \ + fo+go, \ p->r_conversion, \ p->center, \ p->offset, \ p->tilt, \ - *angDirection ); + angdir ); } return ang; } @@ -88,7 +70,7 @@ double* angularConversion::convertAngles(double pos, int nch) { //static! -int angularConversion::readAngularConversion(string fname, int nmod, angleConversionConstant *angOff) { +int angularConversionStatic::readAngularConversion(string fname, int nmod, angleConversionConstant *angOff) { ifstream infile; string ss; @@ -109,7 +91,7 @@ int angularConversion::readAngularConversion(string fname, int nmod, angleConver //static -int angularConversion::readAngularConversion( ifstream& infile, int nmod, angleConversionConstant *angOff) { +int angularConversionStatic::readAngularConversion( ifstream& infile, int nmod, angleConversionConstant *angOff) { string str; int mod; double center, ecenter; @@ -155,7 +137,7 @@ int angularConversion::readAngularConversion( ifstream& infile, int nmod, angleC } //static -int angularConversion:: writeAngularConversion(string fname, int nmod, angleConversionConstant *angOff) { +int angularConversionStatic:: writeAngularConversion(string fname, int nmod, angleConversionConstant *angOff) { ofstream outfile; outfile.open (fname.c_str(),ios_base::out); @@ -174,7 +156,7 @@ int angularConversion:: writeAngularConversion(string fname, int nmod, angleConv //static -int angularConversion:: writeAngularConversion(ofstream& outfile, int nmod, angleConversionConstant *angOff) { +int angularConversionStatic:: writeAngularConversion(ofstream& outfile, int nmod, angleConversionConstant *angOff) { for (int imod=0; imod0) { @@ -223,7 +205,7 @@ int angularConversion::finalizeMerging(double *mp, double *mv, double *me, int * } //static -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 ) { +int angularConversionStatic::addToMerging(double *p1, double *v1, double *e1, double *mp, double *mv,double *me, int *mm, int nchans, double binsize,int nbins, int *badChanMask ) { double binmi=-180.; @@ -284,243 +266,3 @@ int angularConversion::addToMerging(double *p1, double *v1, double *e1, double return OK; } - -int angularConversion::deleteMerging() { - - if (mergingBins) - delete [] mergingBins; - - if (mergingCounts) - delete [] mergingCounts; - - if (mergingErrors) - delete [] mergingErrors; - -} - - -int angularConversion::resetMerging() { - getAngularConversionParameter(BIN_SIZE); - - mergingBins=new double[nBins]; - - - mergingCounts=new double[nBins]; - - - mergingErrors=new double[nBins]; - - - mergingMultiplicity=new int[nBins]; - - return resetMerging(mergingBins, mergingCounts, mergingErrors, mergingMultiplicity); - -} - -int angularConversion::resetMerging(double *mp, double *mv, double *me, int *mm) { - getAngularConversionParameter(BIN_SIZE); - if (nBins) - return resetMerging(mp, mv, me, mm,nBins); - else - return FAIL; -} - - - - -int angularConversion::finalizeMerging() { - int np=finalizeMerging(mergingBins, mergingCounts, mergingErrors, mergingMultiplicity); - - if (mergingMultiplicity) - delete [] mergingMultiplicity; - - return np; - -} - - - - -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(double *p1, double *v1, double *e1, int *badChanMask ) { - - return addToMerging(p1,v1,e1,mergingBins,mergingCounts, mergingErrors, mergingMultiplicity, badChanMask); - - -} - - -int angularConversion::addToMerging(double *p1, double *v1, double *e1, double *mp, double *mv,double *me, int *mm, int *badChanMask ) { - - int del=0; - - if (getAngularConversionParameter(BIN_SIZE)==0){ - cout << "no bin size " << endl; - return FAIL; - } - - if (nBins==0) { - cout << "no bins " << endl; - return FAIL; - } - - if (p1==NULL) { - del=1; - p1=convertAngles(); - } - - - int ret=addToMerging(p1, v1, e1, mp, mv,me, mm,getTotalNumberOfChannels(), *binSize,nBins, badChanMask ); - - - if (del) { - delete [] p1; - p1=NULL; - } - return ret; -} - - - - /** - sets the value of s angular conversion parameter - \param c can be ANGULAR_DIRECTION, GLOBAL_OFFSET, FINE_OFFSET, BIN_SIZE - \param v the value to be set - \returns the actual value - */ - -double angularConversion::setAngularConversionParameter(angleConversionParameter c, double v){ - - - switch (c) { - case ANGULAR_DIRECTION: - if (v<0) - *angDirection=-1; - else - *angDirection=1; - return *angDirection; - case GLOBAL_OFFSET: - *globalOffset=v; - return *globalOffset; - case FINE_OFFSET: - *fineOffset=v; - return *fineOffset; - case BIN_SIZE: - if (v>0) { - *binSize=v; - nBins=360./(*binSize); - } - return *binSize; - case MOVE_FLAG: - if (moveFlag) { - if (v>0) - *moveFlag=1; - else if (v==0) - *moveFlag=0; - return *moveFlag; - } - return -1; - default: - return 0; - } -} - - /** - returns the value of an angular conversion parameter - \param c can be ANGULAR_DIRECTION, GLOBAL_OFFSET, FINE_OFFSET, BIN_SIZE - \returns the actual value - - */ - -double angularConversion::getAngularConversionParameter(angleConversionParameter c) { - - switch (c) { - case ANGULAR_DIRECTION: - return *angDirection; - case GLOBAL_OFFSET: - return *globalOffset; - case FINE_OFFSET: - return *fineOffset; - case BIN_SIZE: - if (*binSize>0) - nBins=360./(*binSize); - else - nBins=0; - return *binSize; - case MOVE_FLAG: - if (moveFlag) - return *moveFlag; - else - return -1; - default: - return 0; - } -} - - - - -int angularConversion::setAngularConversionFile(string fname) { - if (fname=="") { - setAngularCorrectionMask(0); -#ifdef VERBOSE - std::cout << "Unsetting angular conversion" << std::endl; -#endif - } else { - if (fname=="default") { - fname=string(angConvFile); - } - -#ifdef VERBOSE - std::cout << "Setting angular conversion to " << fname << std:: endl; -#endif - if (readAngularConversionFile(fname)>=0) { - setAngularCorrectionMask(1); - strcpy(angConvFile,fname.c_str()); - } - } - return setAngularCorrectionMask(); -} - - - - - - /* - set positions for the acquisition - \param nPos number of positions - \param pos array with the encoder positions - \returns number of positions - */ -int angularConversion::setPositions(int nPos, double *pos){ - if (nPos>=0) - *numberOfPositions=nPos; - for (int ip=0; ip #include -#include "angleConversionConstant.h" +//#include "angleConversionConstant.h" //double angle(int ichan, double encoder, double totalOffset, double conv_r, double center, double offset, double tilt, int direction) +class angleConversionConstant; using namespace std; @@ -35,7 +35,8 @@ class containing the methods to set/unset the angular conversion and merge the d The angular conversion itself is defined by the angle() function defined in usersFunctions.cpp */ -class angularConversionStatic : public virtual slsDetectorDefs +class angularConversionStatic +// : public virtual slsDetectorDefs { public: diff --git a/slsDetectorSoftware/slsDetectorAnalysis/angularConversionStatic.h~ b/slsDetectorSoftware/slsDetectorAnalysis/angularConversionStatic.h~ index 201c09a49..45ce07c95 100644 --- a/slsDetectorSoftware/slsDetectorAnalysis/angularConversionStatic.h~ +++ b/slsDetectorSoftware/slsDetectorAnalysis/angularConversionStatic.h~ @@ -15,6 +15,7 @@ #include "angleConversionConstant.h" + //double angle(int ichan, double encoder, double totalOffset, double conv_r, double center, double offset, double tilt, int direction) @@ -147,12 +148,12 @@ class angularConversionStatic : public virtual slsDetectorDefs int registerAngleFunctionCallback(double (*fun)(double, double, double, double, double, double, double, int)) {angle = fun; return 0;}; - - private: - - double (*angle)(double, double, double, double, double, double, double, int); + + // private: + + }; #endif