diff --git a/slsDetectorSoftware/Makefile b/slsDetectorSoftware/Makefile index 190e405ad..e5899effe 100644 --- a/slsDetectorSoftware/Makefile +++ b/slsDetectorSoftware/Makefile @@ -38,15 +38,13 @@ picassoServer: $(SRC_MYTHEN_SVC) package: $(OBJS) - echo $(OBJS) - $(CXX) -shared -Wl,-soname,libSlsDetector.so.1 -o libSlsDetector.so.1.0.1 objs/slsDetector.o objs/slsDetectorUtils.o objs/slsDetectorCommand.o objs/multiSlsDetector.o objs/usersFunctions.o objs/MySocketTCP.o -lc $(INCLUDES) $(FLAGS) $(EPICSFLAGS) - ln -sf libSlsDetector.so libSlsDetector.so.1 - ln -sf libSlsDetector.so libSlsDetector.so.1.0.1 + $(CXX) -shared -Wl,-soname,libSlsDetector.so -o libSlsDetector.so $(OBJS) -lc $(INCLUDES) $(FLAGS) $(EPICSFLAGS) ar rcs libSlsDetector.a $(OBJS) clean: - rm -rf libSlsDetector.so.1 libSlsDetector.so.1.0.1 libSlsDetector.so core docs/* $(OBJS) -#objs/* + rm -rf libSlsDetector.a libSlsDetector.so core docs/* $(OBJS) + + #------------------------------------------------------------------------------- lib: package diff --git a/slsDetectorSoftware/Makefile.x04sa b/slsDetectorSoftware/Makefile.x04sa index 0cbd50e6d..6ff533949 100644 --- a/slsDetectorSoftware/Makefile.x04sa +++ b/slsDetectorSoftware/Makefile.x04sa @@ -12,7 +12,8 @@ OBJS = $(SRC_CLNT:.cpp=.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 -all: package doc +all: package $(SRC_CLNT) + doc: $(SRC_H) $(SRC_CLNT) doxygen doxy.config @@ -34,17 +35,11 @@ picassoServer: $(SRC_MYTHEN_SVC) package: $(OBJS) $(CXX) -shared -Wl,-soname,libSlsDetector.so -o libSlsDetector.so $(OBJS) -lc $(INCLUDES) $(FLAGS) $(EPICSFLAGS) -# $(CXX) -shared -Wl,-soname,libSlsDetector.so.1 -o libSlsDetector.so.1.0.1 objs/slsDetector.o $(OBJS) -lc $(INCLUDES) $(FLAGS) $(EPICSFLAGS) -# ln -sf libSlsDetector.so libSlsDetector.so.1 -# ln -sf libSlsDetector.so libSlsDetector.so.1.0.1 ar rcs libSlsDetector.a $(OBJS) - - - - + clean: - rm -rf libSlsDetector.so.1 libSlsDetector.so.1.0.1 libSlsDetector.so core objs/* docs/* + rm -rf libSlsDetector.so libSlsDetector.a core $(OBJS) docs/* #------------------------------------------------------------------------------- lib: package diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp index a6f2529f3..9751b70ca 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp @@ -973,18 +973,18 @@ int* multiSlsDetector::getDataFromDetector() { for (int id=0; idnumberOfDetectors; id++) { if (detectors[id]) { - retdet=detectors[id]->getDataFromDetector(); + retdet=detectors[id]->getDataFromDetector(p); n=detectors[id]->getDataBytes(); if (retdet) { nodata=0; #ifdef VERBOSE cout << "Detector " << id << " returned " << n << " bytes " << endl; #endif - memcpy(p,retdet,n); -#ifdef VERBOSE - cout << "Copied to pointer "<< p << endl; -#endif - delete [] retdet; + // memcpy(p,retdet,n); + //#ifdef VERBOSE + //cout << "Copied to pointer "<< p << endl; + //#endif + // delete [] retdet; } else { nodatadet=id; #ifdef VERBOSE @@ -1003,8 +1003,7 @@ int* multiSlsDetector::getDataFromDetector() { cout << "Stopping detector "<< id << endl; #endif detectors[id]->stopAcquisition(); - while ((retdet=detectors[id]->getDataFromDetector())) { - + while ((retdet=detectors[id]->getDataFromDetector())) { #ifdef VERBOSE cout << "Detector "<< id << " still sent data " << endl; #endif @@ -2032,10 +2031,18 @@ float* multiSlsDetector::convertAngles(float pos) { for (int idet=0; idetnumberOfDetectors; idet++) { if (detectors[idet]) { - p=detectors[idet]->convertAngles(pos); +#ifdef EPICS + // cout << "convert angle det " << idet << endl; + if (idet<2) +#endif + p=detectors[idet]->convertAngles(pos); +#ifdef EPICS + else //////////// GOOD ONLY AT THE BEAMLINE!!!!!!!!!!!!! + p=detectors[idet]->convertAngles(0); +#endif for (int ich=0; ichgetTotalNumberOfChannels(); ich++) { ang[choff+ich]=p[ich]; - } + } choff+=detectors[idet]->getTotalNumberOfChannels(); delete [] p; } diff --git a/slsDetectorSoftware/slsDetector/slsDetector.cpp b/slsDetectorSoftware/slsDetector/slsDetector.cpp index 052b95060..e1d0364a2 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetector.cpp @@ -3009,10 +3009,17 @@ int* slsDetector::readFrame(){ -int* slsDetector::getDataFromDetector(){ +int* slsDetector::getDataFromDetector(int *retval){ int nel=thisDetector->dataBytes/sizeof(int); int n; - int* retval=new int[nel]; + + + + // int* retval=new int[nel]; + + if (retval==NULL) + retval=new int[nel]; + int ret=FAIL; char mess[100]="Nothing"; @@ -3035,8 +3042,10 @@ int* slsDetector::getDataFromDetector(){ std::cout<< "Detector successfully returned: " << mess << " " << n << std::endl; #endif } - delete [] retval; - retval=NULL; + if (retval==NULL) { + delete [] retval; + } + return NULL; } else { n=controlSocket->ReceiveDataOnly(retval,thisDetector->dataBytes); @@ -3047,8 +3056,10 @@ int* slsDetector::getDataFromDetector(){ std::cout<< "wrong data size received: received " << n << " but expected " << thisDetector->dataBytes << std::endl; thisDetector->stoppedFlag=1; ret=FAIL; - delete [] retval; - retval=NULL; + if (retval==NULL) { + delete [] retval; + } + return NULL; } } @@ -4565,7 +4576,16 @@ float* slsDetector::convertAngles(float pos) { float *ang=new float[thisDetector->nChans*thisDetector->nChips*thisDetector->nMods]; for (int ip=0; ipnChans*thisDetector->nChips*thisDetector->nMods; ip++) { imod=ip/(thisDetector->nChans*thisDetector->nChips); - ang[ip]=angle(ip%(thisDetector->nChans*thisDetector->nChips),pos,thisDetector->fineOffset+thisDetector->globalOffset,thisDetector->angOff[imod].r_conversion,thisDetector->angOff[imod].center, thisDetector->angOff[imod].offset,thisDetector->angOff[imod].tilt,thisDetector->angDirection); + ang[ip]=angle(ip%(thisDetector->nChans*thisDetector->nChips),\ + pos, \ + thisDetector->fineOffset+thisDetector->globalOffset, \ + thisDetector->angOff[imod].r_conversion, \ + thisDetector->angOff[imod].center, \ + thisDetector->angOff[imod].offset, \ + thisDetector->angOff[imod].tilt, \ + thisDetector->angDirection + ); + // cout << imod << " " << thisDetector->angOff[imod].offset << " " << ang[ip] << endl; } return ang; } diff --git a/slsDetectorSoftware/slsDetector/slsDetector.h b/slsDetectorSoftware/slsDetector/slsDetector.h index 99e4892f3..cc997df10 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.h +++ b/slsDetectorSoftware/slsDetector/slsDetector.h @@ -276,6 +276,7 @@ typedef struct sharedSlsDetector { using slsDetectorUtils::readAngularConversion; using slsDetectorUtils::writeAngularConversion; + // using slsDetectorBase::getDataFromDetector; @@ -1313,7 +1314,10 @@ typedef struct sharedSlsDetector { \returns pointer to the data (or NULL if failed) */ - int* getDataFromDetector(); + int* getDataFromDetector(int *retval=NULL); + + //int* + /** returns if the detector is Master, slave or nothing \param flag can be GET_MASTER, NO_MASTER, IS_MASTER, IS_SLAVE diff --git a/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp b/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp index 74c83b348..83583d084 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorUtils.cpp @@ -537,9 +537,14 @@ int slsDetectorUtils::readAngularConversion( ifstream& infile, int nmod, angleCo angOff[nm].eoffset=eoff; } else break; + //cout << nm<<" " << angOff[nm].offset << endl; nm++; if (nm>=nmod) break; + + + + } return nm; } @@ -620,7 +625,7 @@ int slsDetectorUtils::addToMerging(float *p1, float *v1, float *e1, float *mp, float binmi=-180., binma; int ibin=0; // int imod; - float ang=0; + float ang=0, angold; binmi=-180.; @@ -629,7 +634,7 @@ int slsDetectorUtils::addToMerging(float *p1, float *v1, float *e1, float *mp, cout << "pointer to badchan mask is " << badChanMask << endl; #endif - if (angDir>0) { + // if (angDir>0) { for (int ip=0; ip=0; ip--) { - if ((cm)&(1<< DISCARD_BAD_CHANNELS)) { - if (badChanMask[ip]) - continue; - - } - while (binmaang) { + ibin--; + binmi-=binsize; + binma-=binsize; + } } - if (ibin<(360./binsize)) { + if (ibin<(360./binsize) && ibin>=0) { + angold=ang; mp[ibin]+=ang; mv[ibin]+=v1[ip]; if (e1) @@ -682,7 +674,32 @@ int slsDetectorUtils::addToMerging(float *p1, float *v1, float *e1, float *mp, } else return FAIL; } - } + +// } else { +// for (int ip=nchans-1; ip>=0; ip--) { +// if ((cm)&(1<< DISCARD_BAD_CHANNELS)) { +// if (badChanMask[ip]) +// continue; + +// } + +// while (binma