diff --git a/slsDetectorCalibration/analogDetector.h b/slsDetectorCalibration/analogDetector.h index a47b7c5aa..1b72e8e7f 100644 --- a/slsDetectorCalibration/analogDetector.h +++ b/slsDetectorCalibration/analogDetector.h @@ -709,6 +709,7 @@ template class analogDetector { + /** Sets region of interest in which data should be processed \param xmi minimum x. if -1 or out of range remains unchanged diff --git a/slsDetectorCalibration/dataStructures/moench02CtbData.h b/slsDetectorCalibration/dataStructures/moench02CtbData.h index c66f5df12..4e1f78404 100644 --- a/slsDetectorCalibration/dataStructures/moench02CtbData.h +++ b/slsDetectorCalibration/dataStructures/moench02CtbData.h @@ -31,23 +31,28 @@ class moench02CtbData : public slsDetectorData { */ - moench02CtbData(int ns=6400): slsDetectorData(160, 160, ns*2*32, NULL, NULL) , nadc(4), sc_width(40), sc_height(160) { + moench02CtbData(int ns=6400): slsDetectorData(160, 160, ns*2*32, NULL, NULL) , nadc(32), sc_width(40), sc_height(160) { - int adc_nr[4]={120,0,80,40}; + int adc_off[4]={0,40,80,120}; + int adc_nr[4]={8,10,20,23}; int row, col; int isample; - int iadc; + int iadc, iiadc; int ix, iy; maplength=this->getDataSize()/2; - + //cout << maplength << endl; - for (iadc=0; iadc=dataSize) { cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl; } @@ -56,12 +61,17 @@ class moench02CtbData : public slsDetectorData { } for (int i=0; i1 && iadc<6){ - xmap[i]=adc_nr[iadc-2]+ix; + if(iadc>=0){ + xmap[i]=adc_off[iadc]+ix; ymap[i]=iy; }else{ xmap[i]=-1; @@ -71,7 +81,7 @@ class moench02CtbData : public slsDetectorData { iframe=0; cout << "data struct created" << endl; }; - + void getPixel(int ip, int &x, int &y) { if(ip>=0 && ip { } if (ib>0) { iframe++; - //cout << ib << "-" << endl; + //cout << ib/2 << "-" << endl; + //for (int i=0; i using namespace std; -#define XMIN 350/2 -#define XMAX 600/2 -#define YMIN 0 -#define YMAX 400 + class interpolatingDetector : public singlePhotonDetector { @@ -50,7 +47,7 @@ class interpolatingDetector : public singlePhotonDetector { commonModeSubtraction *cm=NULL, int nped=1000, int nd=100, int nnx=-1, int nny=-1) : - singlePhotonDetector(d, 3,nsigma,sign, cm, nped, nd, nnx, nny) , interp(inte), id(0), xmin(XMIN), xmax(XMAX), ymin(YMIN), ymax(YMAX) { + singlePhotonDetector(d, 3,nsigma,sign, cm, nped, nd, nnx, nny) , interp(inte), id(0) { cout << "**"<< xmin << " " << xmax << " " << ymin << " " << ymax << endl; }; @@ -60,10 +57,10 @@ class interpolatingDetector : public singlePhotonDetector { interpolatingDetector(interpolatingDetector *orig) : singlePhotonDetector(orig) { interp=(orig->interp)->Clone(); id=orig->id; - xmin=orig->xmin; - xmax=orig->xmax; - ymin=orig->ymin; - ymax=orig->ymax; + /* xmin=orig->xmin; */ + /* xmax=orig->xmax; */ + /* ymin=orig->ymin; */ + /* ymax=orig->ymax; */ } @@ -157,10 +154,10 @@ int addFrame(char *data, int *ph=NULL, int ff=0) { int cy=(clusterSizeY+1)/2; int cs=(clusterSize+1)/2; int ir, ic; - + double rms; double int_x,int_y, eta_x, eta_y; double max=0, tl=0, tr=0, bl=0,br=0, *v, vv; - + // cout << "********** Add frame "<< iframe << endl; if (ph==NULL) ph=image; @@ -169,6 +166,7 @@ int addFrame(char *data, int *ph=NULL, int ff=0) { return 0; } newFrame(); + // cout << "********** Data "<< endl; for (int ix=xmin; ixrms=getPedestalRMS(ix,iy); + rms=getPedestalRMS(ix,iy); + (clusters+nph)->rms=rms; @@ -213,7 +211,7 @@ int addFrame(char *data, int *ph=NULL, int ff=0) { if (ir==0 && ic==0) { - if (*v<-nSigma*cluster->rms) + if (*v<-nSigma*rms) eventMask[iy][ix]=NEGATIVE_PEDESTAL; } @@ -234,7 +232,7 @@ int addFrame(char *data, int *ph=NULL, int ff=0) { (clusters+nph)->quadTot=tr; } - if (max>nSigma*cluster->rms || tot>sqrt(clusterSizeY*clusterSize)*nSigma*cluster->rms || ((clusters+nph)->quadTot)>sqrt(cy*cs)*nSigma*cluster->rms) { + if (max>nSigma*rms || tot>sqrt(clusterSizeY*clusterSize)*nSigma*rms || ((clusters+nph)->quadTot)>sqrt(cy*cs)*nSigma*rms) { if (val[iy][ix]>=max) { eventMask[iy][ix]=PHOTON_MAX; (clusters+nph)->tot=tot; @@ -646,8 +644,6 @@ int addFrame(char *data, int *ph=NULL, int ff=0) { slsInterpolation *interp; int id; - //should put it to analogDetector - int xmin, xmax, ymin, ymax; }; diff --git a/slsDetectorCalibration/interpolations/etaInterpolationBase.h b/slsDetectorCalibration/interpolations/etaInterpolationBase.h index da40f9e4f..1218320f9 100644 --- a/slsDetectorCalibration/interpolations/etaInterpolationBase.h +++ b/slsDetectorCalibration/interpolations/etaInterpolationBase.h @@ -97,7 +97,9 @@ class etaInterpolationBase : public slsInterpolation { #ifndef MYROOT1 int *setEta(int *h, int nb=-1, double emin=1, double emax=0) { - if (h) {heta=h; + if (h) { + if (heta) delete [] heta; + heta=h; nbeta=nb; if (nb<=0) nbeta=nSubPixels*10; etamin=emin; diff --git a/slsDetectorCalibration/interpolations/etaInterpolationPosXY.h b/slsDetectorCalibration/interpolations/etaInterpolationPosXY.h index e730d2df6..7730771cd 100644 --- a/slsDetectorCalibration/interpolations/etaInterpolationPosXY.h +++ b/slsDetectorCalibration/interpolations/etaInterpolationPosXY.h @@ -15,11 +15,11 @@ class etaInterpolationPosXY : public virtual etaInterpolationBase{ etaInterpolationPosXY(etaInterpolationPosXY *orig): etaInterpolationBase(orig) {}; - virtual etaInterpolationPosXY* Clone()=0;/** { + virtual etaInterpolationPosXY* Clone()=0; /* { */ - return new etaInterpolationPosXY(this); + /* return new etaInterpolationPosXY(this); */ - };*/ + /* }; */ virtual void prepareInterpolation(int &ok) { diff --git a/slsDetectorCalibration/interpolations/linearInterpolation.h b/slsDetectorCalibration/interpolations/linearInterpolation.h index 061a1a6e7..605de4c93 100644 --- a/slsDetectorCalibration/interpolations/linearInterpolation.h +++ b/slsDetectorCalibration/interpolations/linearInterpolation.h @@ -40,7 +40,21 @@ class linearInterpolation : public slsInterpolation{ return; }; + virtual void getInterpolatedPosition(int x, int y, int *data, double &int_x, double &int_y) + { + double sDum[2][2]; + double tot, totquad; + double etax,etay; + + int corner; + corner=calcQuad(data, tot, totquad, sDum); + if (nSubPixels>2) + calcEta(totquad, sDum, etax, etay); + getInterpolatedPosition(x,y,etax,etay,corner,int_x,int_y); + return; + }; + virtual void getInterpolatedPosition(int x, int y, double totquad,int quad,double *cl,double &int_x, double &int_y) { double eta_x, eta_y; @@ -78,6 +92,7 @@ class linearInterpolation : public slsInterpolation{ cc[1][1]=cluster[yoff+1][xoff+1]; calcEta(totquad,cc,eta_x,eta_y); } + // cout << x << " " << y << " " << eta_x << " " << eta_y << " " << int_x << " " << int_y << endl; return getInterpolatedPosition(x,y,eta_x, eta_y,quad,int_x,int_y); @@ -86,6 +101,49 @@ class linearInterpolation : public slsInterpolation{ + } + + + virtual void getInterpolatedPosition(int x, int y, double totquad,int quad,int *cl,double &int_x, double &int_y) { + + double cc[2][2]; + int *cluster[3]; + int xoff, yoff; + cluster[0]=cl; + cluster[1]=cl+3; + cluster[2]=cl+6; + + switch (quad) { + case BOTTOM_LEFT: + xoff=0; + yoff=0; + break; + case BOTTOM_RIGHT: + xoff=1; + yoff=0; + break; + case TOP_LEFT: + xoff=0; + yoff=1; + break; + case TOP_RIGHT: + xoff=1; + yoff=1; + break; + default: + ; + } + double etax, etay; + if (nSubPixels>2) { + cc[0][0]=cluster[yoff][xoff]; + cc[1][0]=cluster[yoff+1][xoff]; + cc[0][1]=cluster[yoff][xoff+1]; + cc[1][1]=cluster[yoff+1][xoff+1]; + calcEta(totquad,cc,etax,etay); + } + // cout << x << " " << y << " " << etax << " " << etay << " " << int_x << " " << int_y << endl; + return getInterpolatedPosition(x,y,etax, etay,quad,int_x,int_y); + } @@ -125,11 +183,11 @@ class linearInterpolation : public slsInterpolation{ ypos_eta=(etay)+dY; } else { xpos_eta=0.5*dX+0.25; - xpos_eta=0.5*dY+0.25; + ypos_eta=0.5*dY+0.25; } int_x=((double)x) + xpos_eta; int_y=((double)y) + ypos_eta; - + // cout <<"**"<< x << " " << y << " " << xpos_eta << " " << ypos_eta << " " << corner << endl; return; }; @@ -162,8 +220,10 @@ class linearInterpolation : public slsInterpolation{ //////////////////////////////////////////////////////////////////////////////////////////////////////// virtual int addToFlatField(double *cluster, double &etax, double &etay){}; + virtual int addToFlatField(int *cluster, double &etax, double &etay){}; virtual int addToFlatField(double etax, double etay){}; virtual int addToFlatField(double totquad,int quad,double *cl,double &etax, double &etay) {}; + virtual int addToFlatField(double totquad,int quad,int *cl,double &etax, double &etay) {}; protected: ; diff --git a/slsDetectorCalibration/interpolations/slsInterpolation.h b/slsDetectorCalibration/interpolations/slsInterpolation.h index ea79eb639..8059ddcc9 100644 --- a/slsDetectorCalibration/interpolations/slsInterpolation.h +++ b/slsDetectorCalibration/interpolations/slsInterpolation.h @@ -24,7 +24,10 @@ #endif #include +#include +#include using namespace std; + //#ifdef MYROOT1 //: public TObject //#endif @@ -84,7 +87,13 @@ hint=new TH2F("hint","hint",ns*nx, 0, nx, ns*ny, 0, ny); #endif #ifndef MYROOT1 - virtual int *getInterpolatedImage(){return hint;}; + virtual int *getInterpolatedImage(){ + // cout << "return interpolated image " << endl; + /* for (int i=0; i=0 && ix<(nPixelsX*nSubPixels) && iy<(nSubPixels*nPixelsY) && iy>=0 )(*(hint+ix+iy*nPixelsX*nSubPixels))+=1; + if (ix>=0 && ix<(nPixelsX*nSubPixels) && iy<(nSubPixels*nPixelsY) && iy>=0 ){ + // cout << int_x << " " << int_y << " " << " " << ix << " " << iy << " " << ix+iy*nPixelsX*nSubPixels << " " << hint[ix+iy*nPixelsX*nSubPixels]; + (*(hint+ix+iy*nPixelsX*nSubPixels))+=1; + // cout << " " << hint[ix+iy*nPixelsX*nSubPixels] << endl; + }// else + // cout << "bad! "<< int_x << " " << int_y << " " << " " << ix << " " << iy << " " << ix+iy*nPixelsX*nSubPixels << endl; + return hint; }; #endif diff --git a/slsDetectorCalibration/moenchExecutables/Makefile.reoder_image b/slsDetectorCalibration/moenchExecutables/Makefile.reoder_image new file mode 100644 index 000000000..2ad256370 --- /dev/null +++ b/slsDetectorCalibration/moenchExecutables/Makefile.reoder_image @@ -0,0 +1,22 @@ + +CBFLIBDIR= /afs/psi.ch/project/sls_det_software/CBFlib-0.9.5/ +#ZMQLIB=../slsReceiverSoftware/include +INCDIR=-I. -I../ -I../interpolations -I../interpolations/etaVEL -I../dataStructures -I../../slsReceiverSoftware/include -I$(CBFLIBDIR)/include/ +LDFLAG= ../tiffIO.cpp -L/usr/lib64/ -lpthread -lm -lstdc++ -L. -pthread -lrt -L$(CBFLIBDIR)/lib/ -ltiff +MAIN=moench03ReorderImage.cpp + +all: moenchReorderImage moenchClusterFinder + + + +moenchReorderImage: $(MAIN) $(INCS) clean + g++ -o moenchReorderImage $(MAIN) $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DNEWRECEIVER + +moenchClusterFinder: moench03ClusterFinder.cpp + g++ -o moenchClusterFinder $(MAIN) $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DNEWRECEIVER + + +clean: + rm -f moenchReorderImage moenchClusterFinder + + diff --git a/slsDetectorCalibration/moenchExecutables/Makefile.tiff_to_th2f b/slsDetectorCalibration/moenchExecutables/Makefile.tiff_to_th2f index cf03cebb5..db51710b7 100644 --- a/slsDetectorCalibration/moenchExecutables/Makefile.tiff_to_th2f +++ b/slsDetectorCalibration/moenchExecutables/Makefile.tiff_to_th2f @@ -2,12 +2,14 @@ #INCS= $(INCSROOT) moench03_receiver.h #LINKDEF=receiverGuiLinkDef.h -CBFLIBDIR= /afs/psi.ch/project/sls_det_software/CBFlib-0.9.5/ -ZMQLIB=../slsReceiverSoftware/include -LIBRARYCBF=$(CBFLIBDIR)/lib/*.o -INCDIR=-I. -I../ -I../interpolations -I../interpolations/etaVEL -I../dataStructures -I../../slsReceiverSoftware/include -I$(CBFLIBDIR)/include/ -I$(ROOTSYS)/include +#CBFLIBDIR= /afs/psi.ch/project/sls_det_software/CBFlib-0.9.5/ +#ZMQLIB=../slsReceiverSoftware/include +#LIBRARYCBF=$(CBFLIBDIR)/lib/*.o +INCDIR=-I. -I../ -I../interpolations -I../interpolations/etaVEL -I../dataStructures -I../../slsReceiverSoftware/include -I$(ROOTSYS)/include +#-I$(CBFLIBDIR)/include/ #LIBHDF5= -LDFLAG= -L/usr/lib64/ -lpthread -lm -lstdc++ -L. -pthread -lrt -L$(CBFLIBDIR)/lib/ -lhdf5 -ltiff +LDFLAG= -L/usr/lib64/ -lpthread -lm -lstdc++ -L. -pthread -lrt -ltiff +#-L$(CBFLIBDIR)/lib/ -lhdf5 MAIN=tiff_to_th2f.cpp @@ -18,8 +20,8 @@ all: tiff_to_th2f tiff_to_th2f: $(MAIN) $(INCS) - g++ -o tiff_to_th2f $(MAIN) `root-config --cflags --glibs` -lMinuit -lm -ltiff -lstdc++ $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) ../tiffIO.cpp - + g++ -o tiff_to_th2f $(MAIN) `root-config --cflags --glibs` -lMinuit -lm -ltiff -lstdc++ $(LDFLAG) $(INCDIR) ../tiffIO.cpp +#$(LIBRARYCBF) $(LIBHDF5) clean: rm -f tiff_to_th2f diff --git a/slsDetectorCalibration/moenchExecutables/moench03ClusterFinder.cpp b/slsDetectorCalibration/moenchExecutables/moench03ClusterFinder.cpp index 8a58566db..0246c0c1a 100644 --- a/slsDetectorCalibration/moenchExecutables/moench03ClusterFinder.cpp +++ b/slsDetectorCalibration/moenchExecutables/moench03ClusterFinder.cpp @@ -40,7 +40,7 @@ int main(int argc, char *argv[]) { } int p=10000; int fifosize=1000; - int nthreads=8; + int nthreads=1; int nsubpix=25; int etabins=nsubpix*10; double etamin=-1, etamax=2; diff --git a/slsDetectorCalibration/moenchExecutables/moench03ClusterFinderPhoenix.cpp b/slsDetectorCalibration/moenchExecutables/moench03ClusterFinderPhoenix.cpp index 67153ac03..7ae1f4559 100644 --- a/slsDetectorCalibration/moenchExecutables/moench03ClusterFinderPhoenix.cpp +++ b/slsDetectorCalibration/moenchExecutables/moench03ClusterFinderPhoenix.cpp @@ -30,9 +30,10 @@ int main(int argc, char *argv[]) { cout << "Usage is " << argv[0] << "indir outdir fname runmin runmax " << endl; return 0; } + int ii=0; int p=10000; int fifosize=1000; - int nthreads=1; + int nthreads=5; int nsubpix=25; int etabins=nsubpix*10; double etamin=-1, etamax=2; @@ -165,6 +166,14 @@ int main(int argc, char *argv[]) { mt->popFree(buff); ff=-1; + ii++; + if (ii%10000==0) { + + cout << ii << endl; + + while (mt->isBusy()) {;}//wait until all data are processed from the queues + mt->writeImage("/scratch/tmp.tiff"); + } } // cout << "--" << endl; filebin.close(); diff --git a/slsDetectorCalibration/moenchExecutables/moench03ReorderImage.cpp b/slsDetectorCalibration/moenchExecutables/moench03ReorderImage.cpp new file mode 100644 index 000000000..69b9b20c8 --- /dev/null +++ b/slsDetectorCalibration/moenchExecutables/moench03ReorderImage.cpp @@ -0,0 +1,163 @@ +//#include "ansi.h" +#include + + + +//#include "moench03T1ZmqData.h" + +#include "moench03T1ReceiverDataNew.h" + +// #include "interpolatingDetector.h" +//#include "etaInterpolationPosXY.h" +// #include "linearInterpolation.h" +// #include "noInterpolation.h" +//#include "interpolatingDetector.h" + +#include +#include +#include +#include + +#include + +#include +using namespace std; + +#define NX 400 //number of x pixels +#define NY 400 //number of y pixels + +int main(int argc, char *argv[]) { + + + if (argc<6) { + cout << "Usage is " << argv[0] << "indir outdir fname runmin runmax " << endl; + return 1; + } + int p=10000; + int fifosize=1000; + int nthreads=8; + int nsubpix=25; + int etabins=nsubpix*10; + double etamin=-1, etamax=2; + int csize=3; + int nx=400, ny=400; + int save=1; + int nsigma=5; + int nped=1000; + int ndark=100; + int ok; + int iprog=0; + + + + + moench03T1ReceiverDataNew *decoder=new moench03T1ReceiverDataNew(); + + + uint16_t data[NY*NX]; + + + int size = 327680;////atoi(argv[3]); + + int* image; + + int ff, np; + int dsize=decoder->getDataSize(); + + + //char data[dsize]; + + ifstream filebin; + char *indir=argv[1]; + char *outdir=argv[2]; + char *fformat=argv[3]; + int runmin=atoi(argv[4]); + int runmax=atoi(argv[5]); + + char fname[10000]; + char outfname[10000]; + char imgfname[10000]; + char pedfname[10000]; + // strcpy(pedfname,argv[6]); + char fn[10000]; + + std::time_t end_time; + + FILE *of=NULL; + cout << "input directory is " << indir << endl; + cout << "output directory is " << outdir << endl; + cout << "fileformat is " << fformat << endl; + + + std::time(&end_time); + cout << std::ctime(&end_time) << endl; + + + + + + + + char* buff; + + + + + int ifr=0; + + + for (int irun=runmin; irunreadNextFrame(filebin, ff, np,buff)) { + for (int ix=0; ix<400; ix++) + for (int iy=0; iy<400; iy++) + data[iy*NX+ix]=decoder->getChannel(buff,ix,iy); + + ifr++; + + fwrite(&ff, 8, 1,of);//write detector frame number + fwrite(&ifr, 8, 1,of);//write datset frame number + fwrite(data,2,NX*NY,of);//write reordered data + + if (ifr%10000==0) cout << ifr << " " << ff << endl; + ff=-1; + + } + cout << "--" << endl; + filebin.close(); + // //close file + // //join threads + + if (of) + fclose(of); + + std::time(&end_time); + cout << std::ctime(&end_time) << endl; + + } else + cout << "Could not open "<< fname << " for reading " << endl; + + + } + + + return 0; +} + diff --git a/slsDetectorCalibration/moenchExecutables/moenchZmqInterpolating.cpp b/slsDetectorCalibration/moenchExecutables/moenchZmqInterpolating.cpp index 2b3809b8a..0871f36f0 100644 --- a/slsDetectorCalibration/moenchExecutables/moenchZmqInterpolating.cpp +++ b/slsDetectorCalibration/moenchExecutables/moenchZmqInterpolating.cpp @@ -22,15 +22,19 @@ using namespace std; #define SLS_DETECTOR_JSON_HEADER_VERSION 0x2 + + int main(int argc, char *argv[]) { /** * trial.o [socket ip] [starting port number] [send_socket ip] [send port number] * */ + FILE *of=NULL; int fifosize=1000; int nthreads=20; - int nsubpixels=2; + int int_ready=0; + int ok; // help if (argc < 3 ) { cprintf(RED, "Help: ./trial [receive socket ip] [receive starting port number] [send_socket ip] [send starting port number]\n"); @@ -58,6 +62,10 @@ int main(int argc, char *argv[]) { "\nsd port num : " << portnum2; } cout << endl; + int nsubpixels=2; + if (argc > 5) { + nsubpixels=atoi(argv[5]); + } //slsDetectorData *det=new moench03T1ZmqDataNew(); int npx, npy; moench03T1ZmqDataNew *det=new moench03T1ZmqDataNew(); @@ -70,7 +78,8 @@ int main(int argc, char *argv[]) { char* buff; multiThreadedAnalogDetector *mt=new multiThreadedAnalogDetector(filter,nthreads,fifosize); - mt->setFrameMode(eFrame); + int frameMode=eFrame; + mt->setFrameMode(frameMode); mt->StartThreads(); mt->popFree(buff); @@ -113,6 +122,9 @@ int main(int argc, char *argv[]) { uint32_t subframeIndex = -1; uint64_t fileindex = -1; string filename = ""; + char ffname[10000]; + int ffindex; + char* image = new char[size]; //int* image = new int[(size/sizeof(int))](); @@ -139,35 +151,42 @@ int main(int argc, char *argv[]) { // cprintf(RED, "Got Dummy\n"); while (mt->isBusy()) {;}//wait until all data are processed from the queues - + if (frameMode==eFrame) { detimage=mt->getImage(nix,niy,nis); - + if (detimage) { - for (ix=0; ixSendHeaderData(0, false, SLS_DETECTOR_JSON_HEADER_VERSION,16,fileindex,400,400,400*400, acqIndex,frameIndex,fname, acqIndex, 0,0,0,0,0,0,0,0,0,0,0,1); - zmqsocket2->SendHeaderData(0, false, SLS_DETECTOR_JSON_HEADER_VERSION,0,0,0,0,0, 0,0,fname, 0, 0,0,0,0,0,0,0,0,0,0,0,1); - zmqsocket2->SendData((char*)dout,length); - cprintf(GREEN, "Sent Data\n"); } - - sprintf(ofname,"%s_%d.tiff",filename.c_str(),fileindex); - mt->writeImage(ofname); - } + } + if (send) { + strcpy(fname,filename.c_str()); + // zmqsocket2->SendHeaderData(0, false, SLS_DETECTOR_JSON_HEADER_VERSION,16,fileindex,400,400,400*400, acqIndex,frameIndex,fname, acqIndex, 0,0,0,0,0,0,0,0,0,0,0,1); + zmqsocket2->SendHeaderData(0, false, SLS_DETECTOR_JSON_HEADER_VERSION,0,0,0,0,0, 0,0,fname, 0, 0,0,0,0,0,0,0,0,0,0,0,1); + + zmqsocket2->SendData((char*)dout,length); + cprintf(GREEN, "Sent Data\n"); + } + + sprintf(ofname,"%s_%d.tiff",ffname,ffindex); + if (frameMode==eFlat) + mt->writeFlatField(ofname); + else if (frameMode==ePedestal) + mt->writePedestal(ofname); + else + mt->writeImage(ofname); + + // stream dummy to socket2 to signal end of acquisition if (send) { zmqsocket2->SendHeaderData(0, true, SLS_DETECTOR_JSON_HEADER_VERSION); @@ -184,7 +203,8 @@ int main(int argc, char *argv[]) { } - if (of==NULL) { + if (of==NULL) { + while (mt->isBusy()) {;} sprintf(ofname,"%s_%d.clust",filename.c_str(),fileindex); of=fopen(ofname,"w"); if (of) { @@ -193,6 +213,32 @@ int main(int argc, char *argv[]) { cout << "Could not open "<< ofname << " for writing " << endl; mt->setFilePointer(NULL); } + ffindex=fileindex; + strcpy(ffname,filename.c_str()); + if (filename.find("flat")!=std::string::npos) { + cout << "add to ff" << endl; + frameMode=eFlat;//ePedestal; + int_ready=0; + + } else if (filename.find("newped")!=std::string::npos) { + frameMode=ePedestal; + cout << "new pedestal" << endl; + + mt->newDataSet(); + } else if (filename.find("ped")!=std::string::npos){ + frameMode=ePedestal; + cout << "pedestal" << endl; + } else { + frameMode=eFrame; + cout << "data" << endl; + if (int_ready==0) { + mt->prepareInterpolation(ok); + cout << "prepare interpolation " << endl; + int_ready=1; + } + } + + mt->setFrameMode(frameMode); } // get data diff --git a/slsDetectorCalibration/multiThreadedAnalogDetector.h b/slsDetectorCalibration/multiThreadedAnalogDetector.h index 02969a609..44d20df5d 100644 --- a/slsDetectorCalibration/multiThreadedAnalogDetector.h +++ b/slsDetectorCalibration/multiThreadedAnalogDetector.h @@ -50,7 +50,7 @@ public: virtual int setFrameMode(int fm) {fMode=fm; if (fMode>=0) det->setFrameMode((frameMode)fMode);}; - + virtual void newDataSet(){det->newDataSet();}; //fMode=fm; return fMode;} /* void prepareInterpolation(int &ok) { */ @@ -235,6 +235,7 @@ public: int setFrameMode(int fm) { int ret; for (int i=0; isetFrameMode(fm); return ret;}; + void newDataSet(){for (int i=0; inewDataSet();}; int *getImage(int &nnx, int &nny, int &ns) { int *img; // int nnx, nny, ns; @@ -242,13 +243,14 @@ public: //for (i=0; igetImageSize(nnx, nny, ns) << " " << nnx << " " << nny << " " << ns << endl; + //cout << ii << " " << nn << " " << nnx << " " << nny << " " << ns << endl; img=dets[ii]->getImage(); for (int i=0; i0) cout << ix << " " << image[ix]<< endl; gm[ix]=image[ix]; + // if (image[ix]>0 && ix/nnx<350) cout << ix/nnx << " " << ix%nnx << " " << image[ix]<< " " << gm[ix] << endl; } //cout << "image " << nnx << " " << nny << endl; WriteToTiff(gm,imgname ,nnx, nny); @@ -403,7 +405,7 @@ public: } else cout << "Could not allocate float image " << endl; } } else - cout << "Not interpolating detector! " << endl; + cout << "Detector without flat field! " << endl; return NULL; diff --git a/slsDetectorCalibration/singlePhotonDetector.h b/slsDetectorCalibration/singlePhotonDetector.h index 93dc12bb5..f8b0f7577 100644 --- a/slsDetectorCalibration/singlePhotonDetector.h +++ b/slsDetectorCalibration/singlePhotonDetector.h @@ -187,10 +187,10 @@ public analogDetector { double g=1.; - double tthr=thr; + double tthr=thr, tthr1, tthr2; int nn=0; double max=0, tl=0, tr=0, bl=0,br=0, v; - + double rms=0; int cm=0; if (cmSub) cm=1; @@ -240,56 +240,62 @@ public analogDetector { tot=0; quadTot=0; - for (int ir=-(clusterSizeY/2); ir<(clusterSizeY/2)+1; ir++) { - for (int ic=-(clusterSize/2); ic<(clusterSize/2)+1; ic++) { - if ((iy+ir)>=0 && (iy+ir)=0 && (ix+ic)set_data(rest[iy+ir][ix+ic], ic, ir); - + if (rest[iy][ix]>0.25*tthr) { + eventMask[iy][ix]=NEIGHBOUR; + for (int ir=-(clusterSizeY/2); ir<(clusterSizeY/2)+1; ir++) { + for (int ic=-(clusterSize/2); ic<(clusterSize/2)+1; ic++) { + if ((iy+ir)>=0 && (iy+ir)=0 && (ix+ic)set_data(rest[iy+ir][ix+ic], ic, ir); + - v=rest[iy+ir][ix+ic];//clusters->get_data(ic,ir); - tot+=v; - - if (ir<=0 && ic<=0) - bl+=v; - if (ir<=0 && ic>=0) - br+=v; - if (ir>=0 && ic<=0) - tl+=v; - if (ir>=0 && ic>=0) - tr+=v; - - if (v>max) { - max=v; - } - // if (ir==0 && ic==0) { - if (v>tthr) { - eventMask[iy][ix]=NEIGHBOUR; + v=rest[iy+ir][ix+ic];//clusters->get_data(ic,ir); + tot+=v; + + if (ir<=0 && ic<=0) + bl+=v; + if (ir<=0 && ic>=0) + br+=v; + if (ir>=0 && ic<=0) + tl+=v; + if (ir>=0 && ic>=0) + tr+=v; + + if (v>max) { + max=v; } + // if (ir==0 && ic==0) { //} + } } } - } - if (rest[iy][ix]>=max) { - if (bl>=br && bl>=tl && bl>=tr) { - quad=BOTTOM_LEFT; - quadTot=bl; - } else if (br>=bl && br>=tl && br>=tr) { - quad=BOTTOM_RIGHT; - quadTot=br; + + if (rest[iy][ix]>=max) { + if (bl>=br && bl>=tl && bl>=tr) { + quad=BOTTOM_LEFT; + quadTot=bl; + } else if (br>=bl && br>=tl && br>=tr) { + quad=BOTTOM_RIGHT; + quadTot=br; } else if (tl>=br && tl>=bl && tl>=tr) { - quad=TOP_LEFT; - quadTot=tl; + quad=TOP_LEFT; + quadTot=tl; } else if (tr>=bl && tr>=tl && tr>=br) { - quad=TOP_RIGHT; - quadTot=tr; + quad=TOP_RIGHT; + quadTot=tr; + } + rms=getPedestalRMS(ix,iy); + tthr1=tthr-sqrt(ccy*ccs)*rms; + tthr2=tthr-sqrt(cy*cs)*rms; + if (tthr>sqrt(ccy*ccs)*rms) tthr1=tthr-sqrt(ccy*ccs)*rms; else tthr1=sqrt(ccy*ccs)*rms; + if (tthr>sqrt(cy*cs)*rms) tthr2=tthr-sqrt(cy*cs)*rms; else tthr2=sqrt(cy*cs)*rms; + if (tot>tthr1 || quadTot>tthr2) { + eventMask[iy][ix]=PHOTON; + nph[ix+nx*iy]++; + nphFrame++; + nphTot++; + + } } - if (max>tthr || tot>sqrt(ccy*ccs)*tthr || quadTot>sqrt(cy*cs)*tthr) { - eventMask[iy][ix]=PHOTON; - nph[ix+nx*iy]++; - nphFrame++; - nphTot++; - - } } } } diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index 4a4dcea3d..f9219431e 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -104,7 +104,7 @@ void qTabSettings::SetupDetectorSettings(){ int sett = (int)myDet->getSettings();cout<<"sett:"< slsDetectorDefs::UNDEFINED) sett = Uninitialized; + if(detType == slsDetectorDefs::JUNGFRAUCTB) sett = Uninitialized; else if(sett == slsDetectorDefs::UNDEFINED) sett = Undefined; else if(sett == slsDetectorDefs::UNINITIALIZED) sett = Uninitialized; // To be able to index items on a combo box @@ -186,7 +186,7 @@ void qTabSettings::SetupDetectorSettings(){ default: cout << "Unknown detector type. Exiting GUI." << endl; qDefs::Message(qDefs::CRITICAL,"Unknown detector type. Exiting GUI.","qTabSettings::SetupDetectorSettings"); - exit(-1); + exit(-1); break; } // detector settings selected NOT ENABLED. @@ -197,7 +197,8 @@ void qTabSettings::SetupDetectorSettings(){ #ifdef VERBOSE cout << "ERROR: Unknown Detector Settings retrieved from detector." << endl; #endif - exit(-1); + sett= Undefined; + // exit(-1); } // Setting the detector settings else comboSettings->setCurrentIndex(sett); diff --git a/slsDetectorSoftware/jctbDetectorServer/AD9257.h b/slsDetectorSoftware/jctbDetectorServer/AD9257.h new file mode 100755 index 000000000..a716af64c --- /dev/null +++ b/slsDetectorSoftware/jctbDetectorServer/AD9257.h @@ -0,0 +1,141 @@ +#ifndef AD9257_H +#define AD9257_H + +#include "ansi.h" + +#include "commonServerFunctions.h" +#include + +/* AD9257 ADC DEFINES */ +#define AD9257_ADC_NUMBITS (24) + +#define AD9257_DEV_IND_2_REG (0x04) +#define AD9257_CHAN_H_OFST (0) +#define AD9257_CHAN_H_MSK (0x00000001 << AD9257_CHAN_H_OFST) +#define AD9257_CHAN_G_OFST (1) +#define AD9257_CHAN_G_MSK (0x00000001 << AD9257_CHAN_G_OFST) +#define AD9257_CHAN_F_OFST (2) +#define AD9257_CHAN_F_MSK (0x00000001 << AD9257_CHAN_F_OFST) +#define AD9257_CHAN_E_OFST (3) +#define AD9257_CHAN_E_MSK (0x00000001 << AD9257_CHAN_E_OFST) + +#define AD9257_DEV_IND_1_REG (0x05) +#define AD9257_CHAN_D_OFST (0) +#define AD9257_CHAN_D_MSK (0x00000001 << AD9257_CHAN_D_OFST) +#define AD9257_CHAN_C_OFST (1) +#define AD9257_CHAN_C_MSK (0x00000001 << AD9257_CHAN_C_OFST) +#define AD9257_CHAN_B_OFST (2) +#define AD9257_CHAN_B_MSK (0x00000001 << AD9257_CHAN_B_OFST) +#define AD9257_CHAN_A_OFST (3) +#define AD9257_CHAN_A_MSK (0x00000001 << AD9257_CHAN_A_OFST) +#define AD9257_CLK_CH_DCO_OFST (4) +#define AD9257_CLK_CH_DCO_MSK (0x00000001 << AD9257_CLK_CH_DCO_OFST) +#define AD9257_CLK_CH_IFCO_OFST (5) +#define AD9257_CLK_CH_IFCO_MSK (0x00000001 << AD9257_CLK_CH_IFCO_OFST) + +#define AD9257_POWER_MODE_REG (0x08) +#define AD9257_POWER_INTERNAL_OFST (0) +#define AD9257_POWER_INTERNAL_MSK (0x00000003 << AD9257_POWER_INTERNAL_OFST) +#define AD9257_INT_RESET_VAL (0x3) +#define AD9257_INT_CHIP_RUN_VAL (0x0) +#define AD9257_POWER_EXTERNAL_OFST (5) +#define AD9257_POWER_EXTERNAL_MSK (0x00000001 << AD9257_POWER_EXTERNAL_OFST) +#define AD9257_EXT_FULL_POWER_VAL (0x0) +#define AD9257_EXT_STANDBY_VAL (0x1) + +#define AD9257_OUT_MODE_REG (0x14) +#define AD9257_OUT_FORMAT_OFST (0) +#define AD9257_OUT_FORMAT_MSK (0x00000001 << AD9257_OUT_FORMAT_OFST) +#define AD9257_OUT_BINARY_OFST_VAL (0) +#define AD9257_OUT_TWOS_COMPL_VAL (1) +#define AD9257_OUT_LVDS_OPT_OFST (6) +#define AD9257_OUT_LVDS_OPT_MSK (0x00000001 << AD9257_OUT_LVDS_OPT_OFST) +#define AD9257_OUT_LVDS_ANSI_VAL (0) +#define AD9257_OUT_LVDS_IEEE_VAL (1) + +#define AD9257_OUT_PHASE_REG (0x16) +#define AD9257_OUT_CLK_OFST (0) +#define AD9257_OUT_CLK_MSK (0x0000000F << AD9257_OUT_CLK_OFST) +#define AD9257_OUT_CLK_60_VAL (0x1) +#define AD9257_IN_CLK_OFST (4) +#define AD9257_IN_CLK_MSK (0x00000007 << AD9257_IN_CLK_OFST) +#define AD9257_IN_CLK_0_VAL (0x0) + +#define AD9257_VREF_REG (0x18) +#define AD9257_VREF_OFST (0) +#define AD9257_VREF_MSK (0x00000003 << AD9257_VREF_OFST) +#define AD9257_VREF_1_33_VAL (0x2) + +#define AD9257_TEST_MODE_REG (0x0D) +#define AD9257_OUT_TEST_OFST (0) +#define AD9257_OUT_TEST_MSK (0x0000000F << AD9257_OUT_TEST_OFST) +#define AD9257_NONE_VAL (0x0) +#define AD9257_MIXED_BIT_FREQ_VAL (0xC) +#define AD9257_TEST_RESET_SHORT_GEN (4) +#define AD9257_TEST_RESET_LONG_GEN (5) +#define AD9257_USER_IN_MODE_OFST (6) +#define AD9257_USER_IN_MODE_MSK (0x00000003 << AD9257_USER_IN_MODE_OFST) + + +void setAdc(int addr, int val) { + + u_int32_t codata; + codata = val + (addr << 8); + printf(" Setting ADC SPI Register. Wrote 0x%04x at 0x%04x\n", val, addr); + serializeToSPI(ADC_SPI_REG, codata, ADC_SERIAL_CS_OUT_MSK, AD9257_ADC_NUMBITS, + ADC_SERIAL_CLK_OUT_MSK, ADC_SERIAL_DATA_OUT_MSK, ADC_SERIAL_DATA_OUT_OFST); +} + +void prepareADC(){ + printf("\n\nPreparing ADC ... \n"); + + //power mode reset + printf("power mode reset:\n"); + setAdc(AD9257_POWER_MODE_REG, + (AD9257_INT_RESET_VAL << AD9257_POWER_INTERNAL_OFST) & AD9257_POWER_INTERNAL_MSK); + + //power mode chip run + printf("power mode chip run:\n"); + setAdc(AD9257_POWER_MODE_REG, + (AD9257_INT_CHIP_RUN_VAL << AD9257_POWER_INTERNAL_OFST) & AD9257_POWER_INTERNAL_MSK); + + //output clock phase + printf("output clock phase:\n"); + setAdc(AD9257_OUT_PHASE_REG, + (AD9257_OUT_CLK_60_VAL << AD9257_OUT_CLK_OFST) & AD9257_OUT_CLK_MSK); + + // lvds-iee reduced , binary offset + printf("lvds-iee reduced, binary offset:\n"); + setAdc(AD9257_OUT_MODE_REG, + (AD9257_OUT_LVDS_IEEE_VAL << AD9257_OUT_LVDS_OPT_OFST) & AD9257_OUT_LVDS_OPT_MSK); + + // all devices on chip to receive next command + printf("all devices on chip to receive next command:\n"); + setAdc(AD9257_DEV_IND_2_REG, + AD9257_CHAN_H_MSK | AD9257_CHAN_G_MSK | AD9257_CHAN_F_MSK | AD9257_CHAN_E_MSK); + setAdc(AD9257_DEV_IND_1_REG, + AD9257_CHAN_D_MSK | AD9257_CHAN_C_MSK | AD9257_CHAN_B_MSK | AD9257_CHAN_A_MSK | + AD9257_CLK_CH_DCO_MSK | AD9257_CLK_CH_IFCO_MSK); + + // vref 1.33 + printf("vref 1.33:\n"); + setAdc(AD9257_VREF_REG, + (AD9257_VREF_1_33_VAL << AD9257_VREF_OFST) & AD9257_VREF_MSK); + + // no test mode + printf("no test mode:\n"); + setAdc(AD9257_TEST_MODE_REG, + (AD9257_NONE_VAL << AD9257_OUT_TEST_OFST) & AD9257_OUT_TEST_MSK); + +#ifdef TESTADC + printf("***************************************** *******\n"); + printf("******* PUTTING ADC IN TEST MODE!!!!!!!!! *******\n"); + printf("***************************************** *******\n"); + // mixed bit frequency test mode + printf("mixed bit frequency test mode:\n"); + setAdc(AD9257_TEST_MODE_REG, + (AD9257_MIXED_BIT_FREQ_VAL << AD9257_OUT_TEST_OFST) & AD9257_OUT_TEST_MSK); +#endif +} + +#endif //AD9257_H diff --git a/slsDetectorSoftware/jctbDetectorServer/Makefile b/slsDetectorSoftware/jctbDetectorServer/Makefile index 9a125a2df..3259ff756 100644 --- a/slsDetectorSoftware/jctbDetectorServer/Makefile +++ b/slsDetectorSoftware/jctbDetectorServer/Makefile @@ -6,10 +6,10 @@ CROSS = bfin-uclinux- CC = $(CROSS)gcc -CFLAGS += -Wall -DMOENCHD -DMCB_FUNCS -DDACS_INT -DDEBUG -DV1 -DCTB #-DVERBOSE #-DVERYVERBOSE #-DVIRTUAL #-DDACS_INT_CSERVER +CFLAGS += -Wall -DMOENCHD -DMCB_FUNCS -DDACS_INT -DDEBUG -DV1 -DCTB -DOLDVERSION #-DVERBOSE #-DVERYVERBOSE #-DVIRTUAL #-DDACS_INT_CSERVER -PROGS= jctbDetectorServer +PROGS= jctbDetectorServer INSTDIR= /tftpboot INSTMODE= 0777 @@ -31,10 +31,14 @@ boot: $(OBJS) versioning: @echo `tput setaf 6; ./updateGitVersion.sh; tput sgr0;` -jctbDetectorServer: $(OBJS) +jctbDetectorServerNew: $(OBJS) echo $(OBJS) $(CC) $(CFLAGS) -o $@ $^ $(LDLIBS_$@) $(LDFLAGS_$@) +jctbDetectorServer: $(OBJS) + echo $(OBJS) + $(CC) $(CFLAGS) -o $@ $^ $(LDLIBS_$@) $(LDFLAGS_$@) -DOLDVERSION + jungfrauADCTEst: $(OBJS) echo $(OBJS) $(CC) $(CFLAGS) -o $@ $^ $(LDLIBS_$@) $(LDFLAGS_$@) -DTESTADC diff --git a/slsDetectorSoftware/jctbDetectorServer/blackfin.h b/slsDetectorSoftware/jctbDetectorServer/blackfin.h index 975244242..c7ef2cda2 100644 --- a/slsDetectorSoftware/jctbDetectorServer/blackfin.h +++ b/slsDetectorSoftware/jctbDetectorServer/blackfin.h @@ -2,9 +2,13 @@ #define BLACKFIN_H #define CSP0 0x20200000 -#define MEM_SIZE 0x100000 +#define MEM_SIZE 0x100000 +#ifndef OLDVERSION #define MEM_MAP_SHIFT 1 - +#endif +#ifdef OLDVERSION +#define MEM_MAP_SHIFT 11 +#endif #include int mapCSP0(void); diff --git a/slsDetectorSoftware/jctbDetectorServer/commonServerFunctions.h b/slsDetectorSoftware/jctbDetectorServer/commonServerFunctions.h new file mode 100755 index 000000000..55d30b8c4 --- /dev/null +++ b/slsDetectorSoftware/jctbDetectorServer/commonServerFunctions.h @@ -0,0 +1,73 @@ +#ifndef COMMON_SERVER_FUNCTIONS_H +#define COMMON_SERVER_FUNCTIONS_H + +#ifndef GOTTHARDD //gotthard already had bus_w etc defined in its firmware_funcs.c (not yet made with common files) +#include "blackfin.h" +#endif + +/* global variables */ + +void SPIChipSelect (u_int32_t* valw, u_int32_t addr, u_int32_t csmask) { + + // start point + (*valw) = 0xffffffff; // old board compatibility (not using specific bits) + bus_w (addr, (*valw)); + + // chip sel bar down + (*valw) &= ~csmask; /* todo with test: done a bit different, not with previous value */ + bus_w (addr, (*valw)); +} + + +void SPIChipDeselect (u_int32_t* valw, u_int32_t addr, u_int32_t csmask, u_int32_t clkmask) { + // chip sel bar up + (*valw) |= csmask; /* todo with test: not done for spi */ + bus_w (addr, (*valw)); + + //clk down + (*valw) &= ~clkmask; + bus_w (addr, (*valw)); + + // stop point = start point of course + (*valw) = 0xffffffff; // old board compatibility (not using specific bits) + bus_w (addr, (*valw)); +} + +void sendDataToSPI (u_int32_t* valw, u_int32_t addr, u_int32_t val, int numbitstosend, u_int32_t clkmask, u_int32_t digoutmask, int digofset) { + int i = 0; + for (i = 0; i < numbitstosend; ++i) { + + // clk down + (*valw) &= ~clkmask; + bus_w (addr, (*valw)); + + // write data (i) + (*valw) = (((*valw) & ~digoutmask) + // unset bit + (((val >> (numbitstosend - 1 - i)) & 0x1) << digofset)); // each bit from val starting from msb + bus_w (addr, (*valw)); + + // clk up + (*valw) |= clkmask ; + bus_w (addr, (*valw)); + } +} + + +void serializeToSPI(u_int32_t addr, u_int32_t val, u_int32_t csmask, int numbitstosend, u_int32_t clkmask, u_int32_t digoutmask, int digofset) { +#ifdef VERBOSE + if (numbitstosend == 16) + printf("Writing to SPI Register: 0x%04x\n",val); + else + printf("Writing to SPI Register: 0x%08x\n", val); +#endif + + u_int32_t valw; + + SPIChipSelect (&valw, addr, csmask); + + sendDataToSPI(&valw, addr, val, numbitstosend, clkmask, digoutmask, digofset); + + SPIChipDeselect(&valw, addr, csmask, clkmask); +} + +#endif //COMMON_SERVER_FUNCTIONS_H diff --git a/slsDetectorSoftware/jctbDetectorServer/firmware_funcs.c b/slsDetectorSoftware/jctbDetectorServer/firmware_funcs.c index 26c15915b..d7f703c0d 100755 --- a/slsDetectorSoftware/jctbDetectorServer/firmware_funcs.c +++ b/slsDetectorSoftware/jctbDetectorServer/firmware_funcs.c @@ -8,6 +8,16 @@ #include "mcb_funcs.h" #include "slow_adc.h" #include "registers_m.h" +#define ADC_SPI_REG ADC_WRITE_REG + +#define ADC_SERIAL_CLK_OUT_OFST (0) +#define ADC_SERIAL_CLK_OUT_MSK (0x00000001 << ADC_SERIAL_CLK_OUT_OFST) +#define ADC_SERIAL_DATA_OUT_OFST (1) +#define ADC_SERIAL_DATA_OUT_MSK (0x00000001 << ADC_SERIAL_DATA_OUT_OFST) +#define ADC_SERIAL_CS_OUT_OFST (2) +#define ADC_SERIAL_CS_OUT_MSK (0x0000000F << ADC_SERIAL_CS_OUT_OFST) + +#include "AD9257.h" //#define VERBOSE //#define VERYVERBOSE @@ -1718,60 +1728,60 @@ int initConfGain(int isettings,int val,int imod){ -int setADC(int adc){ -/* int reg,nchips,mask,nchans; */ +/* int setADC(int adc){ */ +/* /\* int reg,nchips,mask,nchans; *\/ */ -/* if(adc==-1) ROI_flag=0; */ -/* else ROI_flag=1; */ +/* /\* if(adc==-1) ROI_flag=0; *\/ */ +/* /\* else ROI_flag=1; *\/ */ -/* // setDAQRegister();//token timing */ -/* cleanFifo();//adc sync */ +/* /\* // setDAQRegister();//token timing *\/ */ +/* /\* cleanFifo();//adc sync *\/ */ -/* //with gotthard module */ -/* if(withGotthard){ */ -/* //set packet size */ -/* ipPacketSize= DEFAULT_IP_PACKETSIZE; */ -/* udpPacketSize=DEFAULT_UDP_PACKETSIZE; */ -/* //set channel mask */ -/* nchips = GOTTHARDNCHIP; */ -/* nchans = GOTTHARDNCHAN; */ -/* mask = ACTIVE_ADC_MASK; */ -/* } */ +/* /\* //with gotthard module *\/ */ +/* /\* if(withGotthard){ *\/ */ +/* /\* //set packet size *\/ */ +/* /\* ipPacketSize= DEFAULT_IP_PACKETSIZE; *\/ */ +/* /\* udpPacketSize=DEFAULT_UDP_PACKETSIZE; *\/ */ +/* /\* //set channel mask *\/ */ +/* /\* nchips = GOTTHARDNCHIP; *\/ */ +/* /\* nchans = GOTTHARDNCHAN; *\/ */ +/* /\* mask = ACTIVE_ADC_MASK; *\/ */ +/* /\* } *\/ */ -/* //with moench module all adc */ -/* else{/\* if(adc==-1){*\/ */ -/* //set packet size */ -/* ipPacketSize= DEFAULT_IP_PACKETSIZE; */ -/* udpPacketSize=DEFAULT_UDP_PACKETSIZE; */ -/* //set channel mask */ -/* nchips = N_CHIP; */ -/* nchans = N_CHANS; */ -/* mask = ACTIVE_ADC_MASK; */ -/* }/\* */ -/* //with moench module 1 adc -- NOT IMPLEMENTED */ -/* else{ */ -/* ipPacketSize= ADC1_IP_PACKETSIZE; */ -/* udpPacketSize=ADC1_UDP_PACKETSIZE; */ -/* //set channel mask */ -/* nchips = NCHIPS_PER_ADC; */ -/* nchans = GOTTHARDNCHAN; */ -/* mask = 1<>(23-i))&0x1)<>(23-i))&0x1)<