Compare commits

...

1 Commits

Author SHA1 Message Date
52f74142b1 Moench working version 2019-03-28 13:29:12 +01:00
7 changed files with 107 additions and 66 deletions

View File

@ -1,4 +1,4 @@
hostname bchip085+
hostname bchip011+
patword 0000 0000000000000000
patword 0001 0000000000000000
@ -416,27 +416,30 @@ patwaittime2 0
####mcp2011
#0:rx_tcpport 1955
#0:rx_udpip 10.1.1.102
#0:detectorip 10.1.1.19
#0:rx_udpport 32410
#0:rx_udpport 32411
####gui listening to
#zmqip 129.129.202.131
#zmqport 30001
#zmqip 129.129.202.106
#zmqport 50001
####data streaming out of
#rx_zmqip 10.1.2.103
#rx_zmqport 30003
#rx_zmqport 50003
#0:rx_hostname mpc2011
####mx-test-1
####pcmoench01
0:rx_tcpport 1977
0:rx_udpip 10.1.1.100
0:detectorip 10.1.1.19
0:rx_udpport 32410
####gui listening to (on receiver pc)
zmqip 129.129.202.92
zmqport 30001
zmqport 50001
####data streaming out of
rx_zmqip 10.1.1.100
rx_zmqport 30003
rx_zmqport 50003
0:rx_hostname pcmoench01

View File

@ -854,9 +854,11 @@ template <class dataType> class analogDetector {
if (g==0) g=-1.;
}
if (det)
if (det) {
/* if (det->getChannel(data, ix, iy)>=0x3fff) */
/* cout << ix << " " << iy << " " << det->getChannel(data, ix, iy) <<endl; */
val= (dataSign*det->getValue(data, ix, iy)-getPedestal(ix,iy,cm))/g;
else
} else
val= (((double*)data)[iy*nx+ix]-getPedestal(ix,iy))/g;
#ifdef ROOTSPECTRUM

View File

@ -2,7 +2,7 @@
#define MOENCH03T1RECDATANEW_H
#include "slsDetectorData.h"
#define VERSION_V2
//#define VERSION_V2
/**
@short structure for a Detector Packet or Image Header
@li frameNumber is the frame number
@ -33,7 +33,7 @@
uint16_t roundRNumber; /**< is the round robin set number */
uint8_t detType; /**< is the detector type see :: detectorType */
uint8_t version; /**< is the version number of this structure format */
#ifdef VERSION_V2
#ifndef VERSION_V1
uint64_t packetCaught[8]; /**< is the version number of this structure format */
#endif

View File

@ -22,6 +22,10 @@
#include "moench03Ctb10GbT1Data.h"
#endif
#ifdef REORDERED
#include "moench03T1ReorderedData.h"
#endif
// #include "interpolatingDetector.h"
//#include "etaInterpolationPosXY.h"
// #include "linearInterpolation.h"
@ -48,7 +52,7 @@ int main(int argc, char *argv[]) {
}
int p=10000;
int fifosize=1000;
int nthreads=24;
int nthreads=1;
int nsubpix=25;
int etabins=nsubpix*10;
double etamin=-1, etamax=2;
@ -83,6 +87,14 @@ int main(int argc, char *argv[]) {
cout << "OLD RECEIVER DATA!"<<endl;
#endif
#ifdef REORDERED
moench03T1ReorderedData *decoder=new moench03T1ReorderedData();
cout << "REORDERED DATA!"<<endl;
#endif
decoder->getDetectorSize(nx,ny);
cout << "nx " << nx << " ny " << ny << endl;
//moench03T1ZmqData *decoder=new moench03T1ZmqData();
singlePhotonDetector *filter=new singlePhotonDetector(decoder,csize, nsigma, 1, 0, nped, 200);
@ -183,11 +195,18 @@ int main(int argc, char *argv[]) {
// cout << "*"<<ifr++<<"*"<<ff<< endl;
// cout << ff << " " << np << endl;
// //push
mt->pushData(buff);
// for (int ix=0; ix<400; ix++)
// for (int iy=0; iy<400; iy++) {
// if (decoder->getChannel(buff, ix, iy)<3000 || decoder->getChannel(buff, ix, iy)>8000) {
// cout << ifr << " " << ff << " " << ix << " " << iy << " " << decoder->getChannel(buff, ix, iy) << endl ;
// }
// }
mt->pushData(buff);
// // //pop
mt->nextThread();
mt->nextThread();
// // // cout << " " << (void*)buff;
mt->popFree(buff);
mt->popFree(buff);
ifr++;
if (ifr%10000==0) cout << ifr << " " << ff << endl;
ff=-1;

View File

@ -57,8 +57,6 @@ int main(int argc, char *argv[]) {
uint16_t data[NY*NX];
int size = 327680;////atoi(argv[3]);
int* image;
int ff, np;
@ -76,8 +74,6 @@ int main(int argc, char *argv[]) {
char fname[10000];
char outfname[10000];
char imgfname[10000];
char pedfname[10000];
// strcpy(pedfname,argv[6]);
char fn[10000];
@ -98,7 +94,7 @@ int main(int argc, char *argv[]) {
char* buff;
char buff[dsize];
@ -112,7 +108,7 @@ int main(int argc, char *argv[]) {
sprintf(outfname,"%s/%s_image.raw",outdir,fn);
std::time(&end_time);
cout << std::ctime(&end_time) << endl;
cout << fname << " " << outfname << " " << imgfname << endl;
// cout << fname << " " << outfname << " " << imgfname << endl;
filebin.open((const char *)(fname), ios::in | ios::binary);
// //open file
if (filebin.is_open()){
@ -126,10 +122,14 @@ int main(int argc, char *argv[]) {
// //while read frame
ff=-1;
while (decoder->readNextFrame(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);
for (int ix=0; ix<400; ix++) {
for (int iy=0; iy<400; iy++) {
data[iy*400+ix]=decoder->getChannel(buff,ix,iy);
if (data[iy*NX+ix]<3000 || data[iy*NX+ix]>8000) {
cout << ifr << " " << ff << " " << ix << " " << iy << " " << data[iy*NX+ix] << " " << decoder->getChannel(buff,ix,iy) << endl;
}
}
}
ifr++;
fwrite(&ff, 8, 1,of);//write detector frame number
@ -138,7 +138,7 @@ int main(int argc, char *argv[]) {
if (ifr%10000==0) cout << ifr << " " << ff << endl;
ff=-1;
// break;
}
cout << "--" << endl;
filebin.close();

View File

@ -2,6 +2,7 @@
#include <iostream>
#define VERSION_V1
//#include "moench03T1ZmqData.h"
#ifdef NEWRECEIVER
@ -52,14 +53,14 @@ 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;
int csize=3;
int save=1;
int nsigma=5;
int nped=1000;
int nped=10000;
int ndark=100;
int ok;
int iprog=0;
@ -169,7 +170,11 @@ int main(int argc, char *argv[]) {
//#ifndef ANALOG
if (thr>0) {
cout << "threshold is " << thr << endl;
//#ifndef ANALOG
filter->setThreshold(thr);
//#endif
} else
cf=1;
//#endif
@ -184,7 +189,9 @@ int main(int argc, char *argv[]) {
cout << std::ctime(&end_time) << endl;
char* buff;
multiThreadedAnalogDetector *mt=new multiThreadedAnalogDetector(filter,nthreads,fifosize);
#ifndef ANALOG
mt->setDetectorMode(ePhotonCounting);
cout << "Counting!" << endl;
@ -197,8 +204,7 @@ int main(int argc, char *argv[]) {
mt->setDetectorMode(eAnalog);
cout << "Analog!" << endl;
cf=0;
// #ifdef ANALOG
// thr1=thr;
// thr1=thr;
#endif
// }
@ -229,11 +235,14 @@ int main(int argc, char *argv[]) {
if (filebin.is_open()){
ff=-1;
while (decoder->readNextFrame(filebin, ff, np,buff)) {
mt->pushData(buff);
mt->nextThread();
mt->popFree(buff);
ifr++;
if (ifr%10000==0)
if (np==40) {
mt->pushData(buff);
mt->nextThread();
mt->popFree(buff);
ifr++;
if (ifr%10000==0)
cout << ifr << " " << ff << " " << np << endl;
} else
cout << ifr << " " << ff << " " << np << endl;
ff=-1;
}
@ -244,16 +253,18 @@ int main(int argc, char *argv[]) {
cout << std::ctime(&end_time) << endl;
} else
cout << "Could not open "<< fname << " for reading " << endl;
cout << "Could not open pedestal file "<< fname << " for reading " << endl;
}
ifr=0;
int ifile=0;
mt->setFrameMode(eFrame);
for (int irun=runmin; irun<=runmax; irun++) {
cout << "DATA " ;
mt->setFrameMode(eFrame);
// sprintf(fn,fformat,irun);
sprintf(ffname,"%s/%s.raw",indir,fformat);
sprintf(fname,ffname,irun);
@ -270,8 +281,7 @@ int main(int argc, char *argv[]) {
// //open file
ifile=0;
if (filebin.is_open()){
if (thr<=0) {
if (cf) {
if (thr<=0 && cf!=0) { //cluster finder
if (of==NULL) {
of=fopen(cfname,"w");
if (of) {
@ -283,35 +293,36 @@ int main(int argc, char *argv[]) {
return 1;
}
}
}
}
// //while read frame
ff=-1;
ifr=0;
while (decoder->readNextFrame(filebin, ff, np,buff)) {
if (np==40) {
// cout << "*"<<ifr++<<"*"<<ff<< endl;
// cout << ff << " " << np << endl;
// //push
mt->pushData(buff);
// // //pop
mt->nextThread();
// // // cout << " " << (void*)buff;
mt->popFree(buff);
ifr++;
if (ifr%1000==0) cout << ifr << " " << ff << endl;
if (nframes>0) {
if (ifr%nframes==0) {
//The name has an additional "_fXXXXX" at the end, where "XXXXX" is the initial frame number of the image (0,1000,2000...)
sprintf(ffname,"%s/%s_f%05d.tiff",outdir,fformat,ifile);
sprintf(imgfname,ffname,irun);
//cout << "Writing tiff to " << imgfname << " " << thr1 << endl;
mt->writeImage(imgfname, thr1);
mt->clearImage();
ifile++;
mt->pushData(buff);
// // //pop
mt->nextThread();
// // // cout << " " << (void*)buff;
mt->popFree(buff);
ifr++;
if (ifr%1000==0) cout << ifr << " " << ff << endl;
if (nframes>0) {
if (ifr%nframes==0) {
//The name has an additional "_fXXXXX" at the end, where "XXXXX" is the initial frame number of the image (0,1000,2000...)
sprintf(ffname,"%s/%s_f%05d.tiff",outdir,fformat,ifile);
sprintf(imgfname,ffname,irun);
//cout << "Writing tiff to " << imgfname << " " << thr1 << endl;
mt->writeImage(imgfname, thr1);
mt->clearImage();
ifile++;
}
}
}
} else
cout << ifr << " " << ff << " " << np << endl;
ff=-1;
}
cout << "--" << endl;

View File

@ -324,8 +324,11 @@ public:
img=dets[ii]->getImage();
for (int i=0; i<nn; i++) {
if (ii==0)
image[i]=img[i];
else
// if (img[i]>0)
image[i]=img[i];
// else
// image[i]=0;
else //if (img[i]>0)
image[i]+=img[i];
//if (img[i]) cout << "det " << ii << " pix " << i << " val " << img[i] << " " << image[i] << endl;
}
@ -359,11 +362,14 @@ public:
float *gm=new float[nn];
if (gm) {
for (int ix=0; ix<nn; ix++) {
if (t)
gm[ix]=(image[ix])/t;
else
if (t) {
if (image[ix]<0)
gm[ix]=0;
else
gm[ix]=(image[ix])/t;
} else
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;