diff --git a/examples/moench03_T1.config b/examples/moench03_T1.config index 233ccd9ed..39a6bc0d1 100644 --- a/examples/moench03_T1.config +++ b/examples/moench03_T1.config @@ -3,33 +3,34 @@ ### edit with hostname or IP address of your detector ############################################ #hostname bchip181+ -hostname bchip135 +hostname bchip296 ############################################# ### edit with hostname or 1Gbs IP address of your server ############################################ -rx_hostname mpc2011 +rx_hostname mpc2011:7777 ############################################# ### edit with 10 Gbs IP of your server ############################################ -udp_dstip 10.1.1.102 +udp_dstip 10.1.2.102 ############################################# ### edit with any number in the subnet of your server (first 3 numbers as above) ############################################ -udp_srcip 10.1.1.19 -udp_dstport 32411 +udp_srcip 10.1.2.19 +udp_dstport 32777 + ############################################# ### edit with 10 Gbs IP of your server ############################################ -rx_zmqip 10.1.1.102 -rx_zmqport 50003 +rx_zmqip 10.1.2.102 +rx_zmqport 8003 ############################################# ### edit with 1 Gbs IP of PC where you will run the GUI ############################################ zmqip 129.129.202.57 -zmqport 50001 +zmqport 8001 @@ -38,7 +39,7 @@ rx_zmqstream 1 -frames 100000 +frames 1 period 0.0006 exptime 0.00035 @@ -49,8 +50,8 @@ fpath /mnt/moench_data/scratch1/ fwrite 0 -rx_jsonpara frameMode frame -rx_jsonpara detectorMode counting +rx_jsonpara frameMode pedestal +rx_jsonpara detectorMode analog rx_discardpolicy discardpartial diff --git a/slsDetectorCalibration/interpolations/slsInterpolation.h b/slsDetectorCalibration/interpolations/slsInterpolation.h index 11152adcf..df9f4a61c 100644 --- a/slsDetectorCalibration/interpolations/slsInterpolation.h +++ b/slsDetectorCalibration/interpolations/slsInterpolation.h @@ -357,6 +357,16 @@ class slsInterpolation { } } + /* cout << "(((" << totquad << "\t" << corner << endl; */ + /* for (int iy=0; iy<3; iy++) { */ + /* for (int ix=0; ix<3; ix++) */ + /* cout << cl[ix+iy*3] <<"\t"; */ + /* cout << endl; */ + + /* } */ + + /* cout << ")))" << endl; */ + return corner; } @@ -370,6 +380,10 @@ class slsInterpolation { etax = r / totquad; etay = t / totquad; } + /* cout << "************" << endl; */ + /* cout << sDum[0][0]<< "\t"<iarg) + cmin=atof(argv[iarg++]); + if (argc>iarg) + cmax= atof(argv[iarg++]); cout << "Energy min: " << cmin << endl; cout << "Energy max: " << cmax << endl; + int xmin=0, xmax=NC, ymin=0, ymax=NR; + + if (argc>iarg) + xmin=atof(argv[iarg++]); + if (argc>iarg) + xmax= atof(argv[iarg++]); + + if (argc>iarg) + ymin=atof(argv[iarg++]); + if (argc>iarg) + ymax= atof(argv[iarg++]); + // int etabins=500; int etabins = 1000; // nsubpix*2*100; - double etamin = -1, etamax = 2; + double etamin = -0.25, etamax = 1.25; // double etamin=-0.1, etamax=1.1; // double eta3min = -2, eta3max = 2; double sum, totquad; @@ -80,7 +97,7 @@ int main(int argc, char *argv[]) { // double eta3x, eta3y, int3_x, int3_y, noint_x, noint_y; int ix, iy, isx, isy; - int nframes = 0, lastframe = -1; + int nframes = 0, lastframe = -1, iframe, nphFrame; //double d_x, d_y, res = 5, xx, yy; int nph = 0, totph = 0; //badph = 0, @@ -98,7 +115,7 @@ int main(int argc, char *argv[]) { // int nSubPixels = nsubpix; #ifndef NOINTERPOLATION eta2InterpolationPosXY *interp = - new eta2InterpolationPosXY(NC, NR, nsubpix, etabins, etamin, etamax); + new eta2InterpolationPosXY(NC, NR, nsubpix, nsubpix, etabins, etabins, etamin, etamax); // eta2InterpolationCleverAdaptiveBins *interp=new // eta2InterpolationCleverAdaptiveBins(NC, NR, nsubpix, etabins, etamin, // etamax); @@ -107,8 +124,8 @@ int main(int argc, char *argv[]) { noInterpolation *interp = new noInterpolation(NC, NR, nsubpix); #endif -#ifndef FF int quad; +#ifndef FF #ifndef NOINTERPOLATION char fname[10000]; int ok; @@ -142,19 +159,26 @@ int main(int argc, char *argv[]) { #endif int irun; - for (irun = runmin; irun < runmax; irun++) { + for (irun = runmin; irun <= runmax; irun++) { sprintf(infname, argv[1], irun); #ifndef FF sprintf(outfname, argv[3], irun); #endif + f = fopen(infname, "r"); if (f) { cout << infname << endl; nframes = 0; //f0 = -1; - while (cl.read(f)) { + //iff=0; + while (fread((void*)&iframe, 1, sizeof(int), f)) { + //n=0; + if (fread((void*)&nphFrame, 1, sizeof(int), f)) { + for (int iph=0; iphcalcQuad(cl.get_cluster(), sum, totquad, sDum); -#ifndef FF +// #ifndef FF +// quad = interp->calcEta(cl.get_cluster(), etax, etay, sum, +// totquad, sDum); +// #endif +// #ifdef FF + quad = interp->calcEta(cl.get_cluster(), etax, etay, sum, totquad, sDum); -#endif -#ifdef FF - interp->calcEta(cl.get_cluster(), etax, etay, sum, - totquad, sDum); -#endif + + + /* cl.print(); + cout << "(" << etax <<","<< etay <<")"<< quad<< endl; + */ + //#endif - if (sum > cmin && totquad / sum > 0.8 && totquad / sum < 1.2 && - sum < cmax) { - nph++; + if (totquad > cmin && cl.x >= xmin && cl.x <= xmax && + cl.y >= ymin && cl.y <= ymax && + totquad < cmax) { + + // if (sum > cmin && totquad / sum > 0.8 && totquad / sum < 1.2 && + // sum < cmax) { + nph++; // if (sum>200 && sum<580) { // interp->getInterpolatedPosition(cl.x,cl.y, // totquad,quad,cl.get_cluster(),int_x, int_y); @@ -227,9 +261,12 @@ int main(int argc, char *argv[]) { #ifdef FF interp->writeFlatField(outfname); #endif + } } } - } + } + } + } fclose(f); #ifdef FF diff --git a/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp b/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp index 55220f781..c1fad6f2f 100644 --- a/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp +++ b/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp @@ -720,6 +720,22 @@ int main(int argc, char *argv[]) { ymin >> ymax; } + if (addJsonHeader.find("xMin") != addJsonHeader.end()) { + istringstream(addJsonHeader.at("xMin")) >> xmin; + } + + if (addJsonHeader.find("yMin") != addJsonHeader.end()) { + istringstream(addJsonHeader.at("yMin")) >> ymin; + } + + if (addJsonHeader.find("xMax") != addJsonHeader.end()) { + istringstream(addJsonHeader.at("xMax")) >> xmax; + } + + if (addJsonHeader.find("yMax") != addJsonHeader.end()) { + istringstream(addJsonHeader.at("yMax")) >> ymax; + } + cprintf(MAGENTA, "%d %d %d %d\n", xmin, xmax, ymin, ymax); mt->setROI(xmin, xmax, ymin, ymax); if (addJsonHeader.find("dynamicRange") != addJsonHeader.end()) { diff --git a/slsDetectorCalibration/singlePhotonDetector.h b/slsDetectorCalibration/singlePhotonDetector.h index d647cde16..8fc522422 100644 --- a/slsDetectorCalibration/singlePhotonDetector.h +++ b/slsDetectorCalibration/singlePhotonDetector.h @@ -533,7 +533,7 @@ class singlePhotonDetector : public analogDetector { (clusters + nph)->print(); cout << max << " " << val[iy * nx + ix] << endl; } - good = 1; + //good = 1; if (eMin > 0 && tot < eMin) good = 0; if (eMax > 0 && tot > eMax) @@ -542,7 +542,7 @@ class singlePhotonDetector : public analogDetector { nph++; image[iy * nx + ix]++; } - + good=1; } else if (ee == PEDESTAL) { addToPedestal(data, ix, iy, cm); } /*else {