fixed warnings to avoid crashing

This commit is contained in:
Erik Frojdh
2020-03-19 11:13:56 +01:00
parent d43d74a92d
commit d551bac3f7
7 changed files with 45 additions and 38 deletions

View File

@ -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

View File

@ -441,8 +441,9 @@ template <class dataType> 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<ny; iy++) {
for (int ix=0; ix<nx; ix++) {
ped[iy*nx+ix]=stat[iy][ix].getPedestal();
@ -459,10 +460,11 @@ template <class dataType> 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<ny; iy++) {
for (int ix=0; ix<nx; ix++) {
}
for (int iy=0; iy<ny; iy++) {
for (int ix=0; ix<nx; ix++) {
ped[iy*nx+ix]=stat[iy][ix].getPedestalRMS();
}
}

View File

@ -46,7 +46,7 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
int row, col;
int isample;
// int isample;
int iadc;
int ix, iy;

View File

@ -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; ip<dsize/sizeof(dataType); ip++){
for (int ip=0; ip<el; ip++){
xmap[ip]=-1;
ymap[ip]=-1;
}
@ -205,7 +206,7 @@ class slsDetectorData {
virtual void getPixel(int ip, int &x, int &y) {x=xmap[ip]; y=ymap[ip];};
virtual dataType **getData(char *ptr, int dsize=-1) {
int el=dsize/sizeof(dataType);
dataType **data;
int ix,iy;
data=new dataType*[ny];
@ -213,7 +214,7 @@ class slsDetectorData {
data[i]=new dataType[nx];
}
if (dsize<=0 || dsize>dataSize) 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<nx && iy>=0 && iy<ny) {
data[iy][ix]=getChannel(ptr,ix,iy);
@ -231,8 +232,9 @@ class slsDetectorData {
for(int i = 0; i < ny; i++) {
data[i]=new double[nx];
}
int el=dsize/sizeof(dataType);
if (dsize<=0 || dsize>dataSize) 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<nx && iy>=0 && iy<ny) {
data[iy][ix]=getValue(ptr,ix,iy);

View File

@ -13,7 +13,7 @@ template <class dataType> class ghostSummation {
/** constructor
\param xt crosstalk
*/
ghostSummation(slsDetectorData<dataType> *d, double xt) : xtalk(xt),det(d) {
ghostSummation(slsDetectorData<dataType> *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 dataType> class ghostSummation {
ghostSummation(ghostSummation *orig) {
xtalk=orig->xtalk;
det=orig->det;
nx=1;
ny=1;
det->getDetectorSize(nx,ny);
ghost=new double[nx*ny];
}

View File

@ -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

View File

@ -366,12 +366,12 @@ int *getClusters(char *data, int *ph=NULL) {
if (cm)
if (cm) {
addToCommonMode(data);
}
for (int iy=ymin; iy<ymax; iy++) {
for (int ix=xmin; ix<xmax; ix++) {
for (int iy=ymin; iy<ymax; iy++) {
for (int ix=xmin; ix<xmax; ix++) {
if (det->isGood(ix,iy)) {
max=0;
tl=0;