diff --git a/slsDetectorCalibration/interpolatingDetector.h b/slsDetectorCalibration/interpolatingDetector.h index fde2740f5..6bad86bb6 100644 --- a/slsDetectorCalibration/interpolatingDetector.h +++ b/slsDetectorCalibration/interpolatingDetector.h @@ -127,7 +127,6 @@ class interpolatingDetector : public singlePhotonDetector { return interp->getInterpolatedImage(); else return analogDetector::getImage(); - //cout << "null " << endl; } #ifdef MYROOT1 @@ -179,7 +178,8 @@ int addFrame(char *data, int *ph=NULL, int ff=0) { double int_x, int_y; double eta_x, eta_y; if (interp) { - pthread_mutex_lock(fi); + cout << "int" << endl; + pthread_mutex_lock(fi); for (nph=0; nphaddToFlatField((clusters+nph)->quadTot,(clusters+nph)->quad,(clusters+nph)->get_cluster(),eta_x, eta_y); @@ -214,7 +214,7 @@ int addFrame(char *data, int *ph=NULL, int ff=0) { if (interp) addFrame(data,val,1); else - singlePhotonDetector::processData(data,val); + singlePhotonDetector::processData(data,val); break; default: if (interp) diff --git a/slsDetectorCalibration/moenchExecutables/Makefile.moench_zmq_rh7 b/slsDetectorCalibration/moenchExecutables/Makefile.moench_zmq_rh7 new file mode 100644 index 000000000..51187595f --- /dev/null +++ b/slsDetectorCalibration/moenchExecutables/Makefile.moench_zmq_rh7 @@ -0,0 +1,17 @@ + +ZMQLIB=../../slsReceiverSoftware/include +INCDIR= -I$(ZMQLIB) -I. -I../dataStructures ../tiffIO.cpp -I../ -I../interpolations/ +LDFLAG= -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -L$(ZMQLIB) -O3 +#-L../../bin -lhdf5 -L. + +#DESTDIR?=../bin + +all: moenchZmqProcess + +moenchZmqProcess: moenchZmqProcess.cpp clean + g++ -o moenchZmqProcess moenchZmqProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWZMQ -DINTERP + +clean: + rm -f moenchZmqProcess + + diff --git a/slsDetectorCalibration/moenchExecutables/moench03Interpolation.cpp b/slsDetectorCalibration/moenchExecutables/moench03Interpolation.cpp index 865c35d05..a3d354798 100644 --- a/slsDetectorCalibration/moenchExecutables/moench03Interpolation.cpp +++ b/slsDetectorCalibration/moenchExecutables/moench03Interpolation.cpp @@ -143,10 +143,13 @@ int main(int argc, char *argv[]) { nframes++; } quad=interp->calcQuad(cl.get_cluster(), sum, totquad, sDum); - if (sum>cmin && totquad/sum>0.8 && totquad/sum<1.2 && totquadcmin && totquad/sum>0.8 && totquad/sum<1.2 && sum200 && sum<580) { // interp->getInterpolatedPosition(cl.x,cl.y, totquad,quad,cl.get_cluster(),int_x, int_y); +#ifdef SOLEIL + if (cl.x>210 && cl.x<240 && cl.y>210 && cl.y<240) { +#endif #ifndef FF interp->getInterpolatedPosition(cl.x,cl.y, cl.get_cluster(),int_x, int_y); interp->addToImage(int_x, int_y); @@ -154,7 +157,9 @@ int main(int argc, char *argv[]) { #ifdef FF interp->addToFlatField(cl.get_cluster(), etax, etay); #endif - +#ifdef SOLEIL + } +#endif if (nph%1000000==0) cout << nph << endl; if (nph%100000000==0) { diff --git a/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp b/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp index 37313477e..5ae6f937b 100644 --- a/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp +++ b/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp @@ -109,18 +109,25 @@ int main(int argc, char *argv[]) { //analogDetector *filter=new analogDetector(det,1,NULL,1000); - // singlePhotonDetector *filter=new singlePhotonDetector(det,3, 5, 1, 0, 1000, 10); +#ifndef INTERP + singlePhotonDetector *filter=new singlePhotonDetector(det,3, 5, 1, 0, 1000, 10); + + multiThreadedCountingDetector *mt=new multiThreadedCountingDetector(filter,nthreads,fifosize); + + // multiThreadedAnalogDetector *mt=new multiThreadedAnalogDetector(filter,nthreads,fifosize); +#endif +#ifdef INTERP eta2InterpolationPosXY *interp=new eta2InterpolationPosXY(npx, npy, nSubPixels, etabins, etamin, etamax); if (etafname) interp->readFlatField(etafname); interpolatingDetector *filter=new interpolatingDetector(det,interp, 5, 1, 0, 1000, 10); - cout << " filter" <setFrameMode(eFrame); mt->StartThreads(); mt->popFree(buff); @@ -302,12 +309,15 @@ int main(int argc, char *argv[]) { sprintf(ofname,"%s_%d_ped.tiff",fname,fileindex); mt->writePedestal(ofname); cout << "Writing pedestal to " << ofname << endl; - } else if (fMode==eFlat) { - mt->prepareInterpolation(ok); - sprintf(ofname,"%s_%d_eta.tiff",fname,fileindex); - mt->writeFlatField(ofname); + } +#ifdef INTERP + else if (fMode==eFlat) { + mt->prepareInterpolation(ok); + sprintf(ofname,"%s_%d_eta.tiff",fname,fileindex); + mt->writeFlatField(ofname); cout << "Writing eta to " << ofname << endl; - } + } +#endif else { sprintf(ofname,"%s_%d.tiff",fname,fileindex); mt->writeImage(ofname); @@ -334,7 +344,9 @@ int main(int argc, char *argv[]) { // cout << ix << " " << ped[ix] << endl; } - } else if (fMode==eFlat) { + } +#ifdef INTERP + else if (fMode==eFlat) { int nb; double emi, ema; int *ff=mt->getFlatField(nb, emi, ema); @@ -345,6 +357,7 @@ int main(int argc, char *argv[]) { dout[ix]=ff[ix]; } } +#endif else { detimage=mt->getImage(nnx,nny,nns); cprintf(MAGENTA,"Get image!\n"); @@ -483,7 +496,9 @@ int main(int argc, char *argv[]) { // cprintf(MAGENTA, "Resetting pedestal\n"); fMode=ePedestal; isPedestal=1; - } else if (frameMode_s == "flatfield") { + } +#ifdef INTERP + else if (frameMode_s == "flatfield") { fMode=eFlat; isFlat=1; } else if (frameMode_s == "newFlatfield") { @@ -492,6 +507,7 @@ int main(int argc, char *argv[]) { cprintf(MAGENTA, "Resetting flatfield\n"); fMode=eFlat; } +#endif else { fMode=eFrame; isPedestal=0; @@ -553,15 +569,22 @@ int main(int argc, char *argv[]) { if (doc.HasMember("detectorMode")) { if (doc["detectorMode"].IsString()) { detectorMode_s=doc["detectorMode"].GetString(); +#ifdef INTERP if (detectorMode_s == "interpolating"){ dMode=eInterpolating; mt->setInterpolation(interp); - } else if (detectorMode_s == "counting"){ + } else +#endif + if (detectorMode_s == "counting"){ dMode=ePhotonCounting; +#ifdef INTERP mt->setInterpolation(NULL); +#endif } else { dMode=eAnalog; +#ifdef INTERP mt->setInterpolation(NULL); +#endif } } diff --git a/slsDetectorCalibration/multiThreadedInterpolatingDetector.h b/slsDetectorCalibration/multiThreadedInterpolatingDetector.h index 91a5c44d7..bda801afa 100644 --- a/slsDetectorCalibration/multiThreadedInterpolatingDetector.h +++ b/slsDetectorCalibration/multiThreadedInterpolatingDetector.h @@ -10,74 +10,6 @@ using namespace std; -/* class threadedInterpolatingDetector : public threadedCountingDetector */ -/* { */ -/* public: */ -/* threadedInterpolatingDetector(interpolatingDetector *d, int fs=10000) : threadedCountingDetector(d,fs) {}; */ - -/* virtual void prepareInterpolation(int &ok){ */ -/* slsInterpolation *interp=((interpolatingDetector*)det)->getInterpolation(); */ -/* if (interp) */ -/* interp->prepareInterpolation(ok); */ -/* } */ - -/* virtual int *getFlatField(){ */ -/* slsInterpolation *interp=((interpolatingDetector*)det)->getInterpolation(); */ -/* if (interp) */ -/* return interp->getFlatField(); */ -/* else */ -/* return NULL; */ -/* } */ - -/* virtual int *setFlatField(int *ff, int nb, double emin, double emax){ */ -/* slsInterpolation *interp=((interpolatingDetector*)det)->getInterpolation(); */ -/* if (interp) */ -/* return interp->setFlatField(ff, nb, emin, emax); */ -/* else */ -/* return NULL; */ -/* } */ - -/* void *writeFlatField(const char * imgname) { */ - -/* slsInterpolation *interp=((interpolatingDetector*)det)->getInterpolation(); */ -/* if (interp) */ -/* interp->writeFlatField(imgname); */ - -/* } */ -/* void *readFlatField(const char * imgname, int nb=-1, double emin=1, double emax=0){ */ -/* slsInterpolation *interp=((interpolatingDetector*)det)->getInterpolation(); */ -/* if (interp) */ -/* interp->readFlatField(imgname, nb, emin, emax); */ -/* } */ - -/* virtual int *getFlatField(int &nb, double emi, double ema){ */ -/* slsInterpolation *interp=((interpolatingDetector*)det)->getInterpolation(); */ -/* int *ff=NULL; */ -/* if (interp) { */ -/* ff=interp->getFlatField(nb,emi,ema); */ -/* } */ -/* return ff; */ -/* } */ - -/* virtual slsInterpolation *getInterpolation() { */ -/* return ((interpolatingDetector*)det)->getInterpolation(); */ -/* } */ - -/* virtual void resetFlatField() { ((interpolatingDetector*)det)->resetFlatField();}; */ - - -/* virtual int setNSubPixels(int ns) { return ((interpolatingDetector*)det)->setNSubPixels(ns);}; */ - - -/* virtual slsInterpolation *setInterpolation(slsInterpolation *f){ */ -/* cout << "thr" << endl; */ -/* return ((interpolatingDetector*)det)->setInterpolation(f); */ -/* }; */ -/* protected: */ -/* interpolatingDetector *det; */ -/* }; */ - - class multiThreadedInterpolatingDetector : public multiThreadedCountingDetector { @@ -125,13 +57,9 @@ public: */ virtual slsInterpolation *setInterpolation(slsInterpolation *f){ int ok; - // for (int i=0; isetInterpolation(f); - //dets[i]->setMutex(&fmutex); - // } - //dets[0]->prepareInterpolation(ok); - //return (slsInterpolation*)((interpolatingDetector*)dets[0])->getInterpolation(); + for (int i=0; isetInterpolation(f); + return (dets[0])->getInterpolation(); }; virtual slsInterpolation *getInterpolation(){ @@ -141,6 +69,25 @@ public: + virtual int *getImage(int &nnx, int &nny, int &ns) { + if (getInterpolation()==NULL) return multiThreadedAnalogDetector::getImage(nnx,nny,ns); + //if one interpolates, the whole image is stored in detector 0; + int *img; + // int nnx, nny, ns; + // int nnx, nny, ns; + int nn=dets[0]->getImageSize(nnx, nny,ns); + if (image) { + delete image; + image=NULL; + } + image=new int[nn]; + img=dets[0]->getImage(); + for (int i=0; i