mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 05:17:13 +02:00
fixed some interpolation issues (#796)
This commit is contained in:
@ -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
|
||||
|
||||
|
||||
|
@ -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"<<sDum[0][1] << endl << sDum[1][0]<< "\t"<<sDum[1][1] << endl; */
|
||||
/* cout << "***************" <<endl; */
|
||||
/* cout << etax << " " << etay << endl; */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ int main(int argc, char *argv[]) {
|
||||
#ifndef FF
|
||||
if (argc < 9) {
|
||||
cout << "Wrong usage! Should be: " << argv[0]
|
||||
<< " infile etafile outfile runmin runmax ns cmin cmax" << endl;
|
||||
<< " infile etafile outfile runmin runmax ns [cmin cmax xmin xmax ymin ymax]" << endl;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
@ -41,7 +41,7 @@ int main(int argc, char *argv[]) {
|
||||
#ifdef FF
|
||||
if (argc < 7) {
|
||||
cout << "Wrong usage! Should be: " << argv[0]
|
||||
<< " infile etafile runmin runmax cmin cmax" << endl;
|
||||
<< " infile etafile runmin runmax [cmin cmax xmin xmax ymin ymax]" << endl;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
@ -65,13 +65,30 @@ int main(int argc, char *argv[]) {
|
||||
nsubpix = atoi(argv[iarg++]);
|
||||
cout << "Subpix: " << nsubpix << endl;
|
||||
#endif
|
||||
float cmin = atof(argv[iarg++]);
|
||||
float cmax = atof(argv[iarg++]);
|
||||
|
||||
float cmin = 0;
|
||||
float cmax=1000000;
|
||||
if (argc>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; iph<nphFrame; iph++) {
|
||||
//while (cl.read(f)) {
|
||||
if (cl.read(f)) {
|
||||
totph++;
|
||||
if (lastframe != cl.iframe) {
|
||||
lastframe = cl.iframe;
|
||||
@ -165,17 +189,27 @@ int main(int argc, char *argv[]) {
|
||||
nframes++;
|
||||
}
|
||||
// quad=interp->calcQuad(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
|
||||
|
||||
if (sum > cmin && totquad / sum > 0.8 && totquad / sum < 1.2 &&
|
||||
sum < cmax) {
|
||||
|
||||
/* cl.print();
|
||||
cout << "(" << etax <<","<< etay <<")"<< quad<< endl;
|
||||
*/
|
||||
//#endif
|
||||
|
||||
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,
|
||||
@ -230,6 +264,9 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
#ifdef FF
|
||||
|
@ -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()) {
|
||||
|
@ -533,7 +533,7 @@ class singlePhotonDetector : public analogDetector<uint16_t> {
|
||||
(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<uint16_t> {
|
||||
nph++;
|
||||
image[iy * nx + ix]++;
|
||||
}
|
||||
|
||||
good=1;
|
||||
} else if (ee == PEDESTAL) {
|
||||
addToPedestal(data, ix, iy, cm);
|
||||
} /*else {
|
||||
|
Reference in New Issue
Block a user