From d551bac3f76b3e059485268fe9245990ef63a9dd Mon Sep 17 00:00:00 2001 From: Erik Frojdh Date: Thu, 19 Mar 2020 11:13:56 +0100 Subject: [PATCH] fixed warnings to avoid crashing --- examples/moench03_T1_lab.config | 14 +++++----- slsDetectorCalibration/analogDetector.h | 10 ++++--- .../dataStructures/moench03T1ZmqDataNewRect.h | 2 +- .../dataStructures/slsDetectorData.h | 16 ++++++----- slsDetectorCalibration/ghostSummation.h | 5 +++- .../moenchExecutables/moenchZmqProcess.cpp | 28 +++++++++---------- slsDetectorCalibration/singlePhotonDetector.h | 8 +++--- 7 files changed, 45 insertions(+), 38 deletions(-) diff --git a/examples/moench03_T1_lab.config b/examples/moench03_T1_lab.config index 41bcfd872..3d54a1acc 100644 --- a/examples/moench03_T1_lab.config +++ b/examples/moench03_T1_lab.config @@ -1,4 +1,4 @@ -hostname bchip064+ +hostname bchip071+ patword 0000 0000000000000000 patword 0001 0000000000000000 @@ -417,17 +417,17 @@ patwaittime2 0 ####mcp2011 0:rx_tcpport 1954 -0:rx_udpip 10.1.1.102 -0:detectorip 10.1.1.19 +0:rx_udpip 10.1.2.117 +0:detectorip 10.1.2.19 0:rx_udpport 32411 ####gui listening to -zmqip 129.129.202.106 +zmqip 129.129.202.86 zmqport 50001 ####data streaming out of -rx_zmqip 10.1.2.103 +rx_zmqip 10.1.2.117 rx_zmqport 50003 -0:rx_hostname mpc2011 +0:rx_hostname mpc2608 ####pcmoench01 #0:rx_tcpport 1977 @@ -487,6 +487,6 @@ period 0.005 frames 100 period 0.1 -outdir /scratch/ +outdir /mnt/raid0/moench/scratch/ enablefwrite 0 diff --git a/slsDetectorCalibration/analogDetector.h b/slsDetectorCalibration/analogDetector.h index b05761181..984271305 100644 --- a/slsDetectorCalibration/analogDetector.h +++ b/slsDetectorCalibration/analogDetector.h @@ -441,8 +441,9 @@ template class analogDetector { \returns pedestal value */ virtual double* getPedestal(double *ped){ - if (ped==NULL) + if (ped==NULL) { ped=new double[nx*ny]; + } for (int iy=0; iy class analogDetector { \returns pedestal rms */ virtual double* getPedestalRMS(double *ped=NULL){ - if (ped==NULL) + if (ped==NULL) { ped=new double[nx*ny]; - for (int iy=0; iy { int row, col; - int isample; + // int isample; int iadc; int ix, iy; diff --git a/slsDetectorCalibration/dataStructures/slsDetectorData.h b/slsDetectorCalibration/dataStructures/slsDetectorData.h index 55cae4240..b0a3a4ef0 100644 --- a/slsDetectorCalibration/dataStructures/slsDetectorData.h +++ b/slsDetectorCalibration/dataStructures/slsDetectorData.h @@ -39,9 +39,9 @@ class slsDetectorData { */ slsDetectorData(int npx, int npy, int dsize, int **dMap=NULL, dataType **dMask=NULL, int **dROI=NULL): nx(npx), ny(npy), dataSize(dsize) { - - xmap=new int[dsize/sizeof(dataType)]; - ymap=new int[dsize/sizeof(dataType)]; + int el=dsize/sizeof(dataType); + xmap=new int[el]; + ymap=new int[el]; // if (dataMask==NULL) { @@ -65,7 +65,8 @@ class slsDetectorData { dataROIMask[i][j]=1; } // } - for (int ip=0; ipdataSize) dsize=dataSize; - for (int ip=0; ip<(dsize/sizeof(dataType)); ip++) { + for (int ip=0; ip<(el); ip++) { getPixel(ip,ix,iy); if (ix>=0 && ix=0 && iydataSize) dsize=dataSize; - for (int ip=0; ip<(dsize/sizeof(dataType)); ip++) { + for (int ip=0; ip=0 && ix=0 && iy class ghostSummation { /** constructor \param xt crosstalk */ - ghostSummation(slsDetectorData *d, double xt) : xtalk(xt),det(d) { + ghostSummation(slsDetectorData *d, double xt) : xtalk(xt),det(d), nx(1), ny(1) { if (det) det->getDetectorSize(nx,ny); ghost=new double[nx*ny]; @@ -22,6 +22,9 @@ template class ghostSummation { ghostSummation(ghostSummation *orig) { xtalk=orig->xtalk; det=orig->det; + nx=1; + ny=1; + det->getDetectorSize(nx,ny); ghost=new double[nx*ny]; } diff --git a/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp b/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp index 8b685cb34..bc9812acb 100644 --- a/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp +++ b/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp @@ -290,7 +290,7 @@ int main(int argc, char *argv[]) { int iframe=0; char ofname[10000]; - char fname[10000]; + string fname; // int length; int *detimage=NULL; int nnx, nny,nnsx, nnsy; @@ -374,7 +374,7 @@ int main(int argc, char *argv[]) { } else { send_something=0; if (fMode==ePedestal) { - sprintf(ofname,"%s_%ld_ped.tiff",fname,fileindex); + sprintf(ofname,"%s_%ld_ped.tiff",fname.c_str(),fileindex); mt->writePedestal(ofname); cout << "Writing pedestal to " << ofname << endl; send_something=1; @@ -382,7 +382,7 @@ int main(int argc, char *argv[]) { #ifdef INTERP else if (fMode==eFlat) { mt->prepareInterpolation(ok); - sprintf(ofname,"%s_%ld_eta.tiff",fname,fileindex); + sprintf(ofname,"%s_%ld_eta.tiff",fname.c_str(),fileindex); mt->writeFlatField(ofname); cout << "Writing eta to " << ofname << endl; send_something=1; @@ -391,7 +391,7 @@ int main(int argc, char *argv[]) { else { if (subframes>0 ) { if (insubframe>0) { - sprintf(ofname,"%s_sf%ld_%ld.tiff",fname,nnsubframe,fileindex); + sprintf(ofname,"%s_sf%ld_%ld.tiff",fname.c_str(),nnsubframe,fileindex); // mt->writeImage(ofname); doutf= new float[nnx*nny]; if (subframes>0 && insubframe!=subframes && insubframe>0) @@ -416,7 +416,7 @@ int main(int argc, char *argv[]) { send_something=1; } } else { - sprintf(ofname,"%s_%ld.tiff",fname,fileindex); + sprintf(ofname,"%s_%ld.tiff",fname.c_str(),fileindex); mt->writeImage(ofname); send_something=1; } @@ -496,16 +496,16 @@ int main(int argc, char *argv[]) { if(send_something) { #ifndef DEVELOPER #ifndef MOENCH_BRANCH - zmqsocket2->SendHeaderData (0, false, SLS_DETECTOR_JSON_HEADER_VERSION, dr, fileindex, 0,0, nnx, nny, nnx*nny*dr/8,acqIndex, frameIndex, fname, acqIndex,0 , packetNumber,bunchId, timestamp, modId, xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, additionalJsonHeader); + zmqsocket2->SendHeaderData (0, false, SLS_DETECTOR_JSON_HEADER_VERSION, dr, fileindex, 0,0, nnx, nny, nnx*nny*dr/8,acqIndex, frameIndex, fname.c_str(), acqIndex,0 , packetNumber,bunchId, timestamp, modId, xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, additionalJsonHeader); #endif #endif #ifdef DEVELOPER - zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 0,0,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, 0,additionalJsonHeader); + zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 0,0,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname.c_str(),acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, 0,additionalJsonHeader); #endif #ifdef MOENCH_BRANCH - zmqsocket2->SendHeaderData (0, false, SLS_DETECTOR_JSON_HEADER_VERSION, dr, fileindex, nnx, nny, nnx*nny*dr/8,acqIndex, frameIndex, fname, acqIndex, subFrameIndex, packetNumber,bunchId, timestamp, modId, xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, flippedData, additionalJsonHeader); + zmqsocket2->SendHeaderData (0, false, SLS_DETECTOR_JSON_HEADER_VERSION, dr, fileindex, nnx, nny, nnx*nny*dr/8,acqIndex, frameIndex, fname.c_str(), acqIndex, subFrameIndex, packetNumber,bunchId, timestamp, modId, xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, flippedData, additionalJsonHeader); #endif @@ -567,8 +567,8 @@ int main(int argc, char *argv[]) { //dataSize=size; - strcpy(fname,filename.c_str()); - + //strcpy(fname,filename.c_str()); + fname=filename; // cprintf(BLUE, "Header Info:\n" // "size: %u\n" // "multisize: %u\n" @@ -841,7 +841,7 @@ int main(int argc, char *argv[]) { if (dout[ix]<0) dout[ix]=0; doutf[ix]=dout[ix]; } - sprintf(ofname,"%s_sf%ld_%ld.tiff",fname,nnsubframe,fileindex); + sprintf(ofname,"%s_sf%ld_%ld.tiff",fname.c_str(),nnsubframe,fileindex); cout << "Writing image to " << ofname << endl; @@ -853,16 +853,16 @@ int main(int argc, char *argv[]) { #ifndef DEVELOPER #ifndef MOENCH_BRANCH - zmqsocket2->SendHeaderData (0, false, SLS_DETECTOR_JSON_HEADER_VERSION, dr, fileindex, 0,0, nnx, nny, nnx*nny*dr/8,acqIndex, frameIndex, fname, acqIndex,0 , packetNumber,bunchId, timestamp, modId, xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, additionalJsonHeader); + zmqsocket2->SendHeaderData (0, false, SLS_DETECTOR_JSON_HEADER_VERSION, dr, fileindex, 0,0, nnx, nny, nnx*nny*dr/8,acqIndex, frameIndex, fname.c_str(), acqIndex,0 , packetNumber,bunchId, timestamp, modId, xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, additionalJsonHeader); #endif #endif #ifdef DEVELOPER - zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 0,0,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, 0,additionalJsonHeader); + zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 0,0,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname.c_str(),acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, 0,additionalJsonHeader); #endif #ifdef MOENCH_BRANCH - zmqsocket2->SendHeaderData (0, false, SLS_DETECTOR_JSON_HEADER_VERSION, dr, fileindex, nnx, nny, nnx*nny*dr/8,acqIndex, frameIndex, fname, acqIndex, subFrameIndex, packetNumber,bunchId, timestamp, modId, xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, flippedData, additionalJsonHeader); + zmqsocket2->SendHeaderData (0, false, SLS_DETECTOR_JSON_HEADER_VERSION, dr, fileindex, nnx, nny, nnx*nny*dr/8,acqIndex, frameIndex, fname.c_str(), acqIndex, subFrameIndex, packetNumber,bunchId, timestamp, modId, xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, flippedData, additionalJsonHeader); #endif diff --git a/slsDetectorCalibration/singlePhotonDetector.h b/slsDetectorCalibration/singlePhotonDetector.h index 99554ab54..f863bc28a 100644 --- a/slsDetectorCalibration/singlePhotonDetector.h +++ b/slsDetectorCalibration/singlePhotonDetector.h @@ -366,12 +366,12 @@ int *getClusters(char *data, int *ph=NULL) { - if (cm) + if (cm) { addToCommonMode(data); + } - - for (int iy=ymin; iyisGood(ix,iy)) { max=0; tl=0;