New Zmq header staructur implemented and works, still different number of pixels in the GUI should be fixed (but it does not crash)

This commit is contained in:
2018-09-25 09:36:47 +02:00
parent 19e7ced332
commit ae8678cdc2
16 changed files with 1505 additions and 182 deletions

View File

@ -0,0 +1,242 @@
//#include "ansi.h"
#include <iostream>
//#include "moench03T1ZmqData.h"
#ifdef NEWRECEIVER
#include "moench03T1ReceiverDataNew.h"
#endif
#ifdef CSAXS_FP
#include "moench03T1ReceiverData.h"
#endif
#ifdef OLDDATA
#include "moench03Ctb10GbT1Data.h"
#endif
// #include "interpolatingDetector.h"
//#include "etaInterpolationPosXY.h"
// #include "linearInterpolation.h"
// #include "noInterpolation.h"
#include "multiThreadedAnalogDetector.h"
#include "singlePhotonDetector.h"
//#include "interpolatingDetector.h"
#include <stdio.h>
#include <map>
#include <fstream>
#include <sys/stat.h>
#include <ctime>
using namespace std;
int main(int argc, char *argv[]) {
if (argc<4) {
cout << "Usage is " << argv[0] << "indir outdir fname [pedfile] [threshold]" << endl;
return 1;
}
int p=10000;
int fifosize=1000;
int nthreads=8;
int nsubpix=25;
int etabins=nsubpix*10;
double etamin=-1, etamax=2;
int csize=3;
int nx=400, ny=400;
int save=1;
int nsigma=5;
int nped=1000;
int ndark=100;
int ok;
int iprog=0;
#ifdef NEWRECEIVER
moench03T1ReceiverDataNew *decoder=new moench03T1ReceiverDataNew();
cout << "RECEIVER DATA WITH ONE HEADER!"<<endl;
#endif
#ifdef CSAXS_FP
moench03T1ReceiverData *decoder=new moench03T1ReceiverData();
cout << "RECEIVER DATA WITH ALL HEADERS!"<<endl;
#endif
#ifdef OLDDATA
moench03Ctb10GbT1Data *decoder=new moench03Ctb10GbT1Data();
cout << "OLD RECEIVER DATA!"<<endl;
#endif
#ifndef ANALOG
//moench03T1ZmqData *decoder=new moench03T1ZmqData();
singlePhotonDetector *filter=new singlePhotonDetector(decoder,csize, nsigma, 1, 0, nped, 200);
// char tit[10000];
cout << "filter " << endl;
#endif
#ifdef ANALOG
//moench03T1ZmqData *decoder=new moench03T1ZmqData();
analogDetector<uint16_t> *filter=new analogDetector<uint16_t>(decoder, 1, 0, nped);
// char tit[10000];
cout << "filter " << endl;
#endif
// filter->readPedestals("/scratch/ped_100.tiff");
// interp->readFlatField("/scratch/eta_100.tiff",etamin,etamax);
// cout << "filter "<< endl;
int size = 327680;////atoi(argv[3]);
int* image;
//int* image =new int[327680/sizeof(int)];
filter->newDataSet();
int ff, np;
int dsize=decoder->getDataSize();
cout << " data size is " << dsize;
char data[dsize];
ifstream filebin;
char *indir=argv[1];
char *outdir=argv[2];
char *fformat=argv[3];
char *pedfile=NULL;
if (argc>=5) {
pedfile=argv[4];
}
double thr=0;
if (argc>=6) {
thr=atoi(argv[5]);
}
char fname[10000];
char imgfname[10000];
// strcpy(pedfname,argv[6]);
char fn[10000];
std::time_t end_time;
FILE *of=NULL;
cout << "input directory is " << indir << endl;
cout << "output directory is " << outdir << endl;
cout << "input file is " << fformat << endl;
if (pedfile)
cout << "pedestal file is " << pedfile << endl;
if (thr>0) {
cout << "threshold is " << thr << endl;
filter->setThreshold(thr);
}
filter->setROI(0,150,0,150);
std::time(&end_time);
cout << std::ctime(&end_time) << endl;
char* buff;
multiThreadedAnalogDetector *mt=new multiThreadedAnalogDetector(filter,nthreads,fifosize);
mt->StartThreads();
mt->popFree(buff);
cout << "mt " << endl;
int ifr=0;
for (int irun=0; irun<2; irun++) {
if (irun>0) {
mt->setFrameMode(eFrame);
// sprintf(fn,fformat,irun);
sprintf(fname,"%s/%s.raw",indir,fformat);
// sprintf(outfname,"%s/%s.clust",outdir,fn);
sprintf(imgfname,"%s/%s.tiff",outdir,fformat);
} else {
mt->setFrameMode(ePedestal);
// sprintf(fn,fformat,irun);
sprintf(fname,"%s/%s.raw",indir,pedfile);
// sprintf(outfname,"%s/%s.clust",outdir,fn);
// sprintf(imgfname,"%s/%s.tiff",outdir,fn);
}
cout << fname << endl;
std::time(&end_time);
cout << std::ctime(&end_time) << endl;
// cout << fname << " " << outfname << " " << imgfname << endl;
filebin.open((const char *)(fname), ios::in | ios::binary);
// //open file
if (filebin.is_open()){
// of=fopen(outfname,"w");
// if (of) {
// mt->setFilePointer(of);
// // cout << "file pointer set " << endl;
// } else {
// cout << "Could not open "<< outfname << " for writing " << endl;
// mt->setFilePointer(NULL);
// return 1;
// }
// //while read frame
ff=-1;
while (decoder->readNextFrame(filebin, ff, np,buff)) {
// cout << "*"<<ifr++<<"*"<<ff<< endl;
// cout << ff << " " << np << endl;
// //push
mt->pushData(buff);
// // //pop
mt->nextThread();
// // // cout << " " << (void*)buff;
mt->popFree(buff);
ifr++;
if (ifr%10000==0) cout << ifr << " " << ff << endl;
ff=-1;
}
cout << "--" << endl;
filebin.close();
// //close file
// //join threads
while (mt->isBusy()) {;}//wait until all data are processed from the queues
// if (of)
// fclose(of);
if (irun>0) {
cout << "Writing tiff to " << imgfname << endl;
mt->writeImage(imgfname);
// mt->clearImage();
}
std::time(&end_time);
cout << std::ctime(&end_time) << endl;
} else
cout << "Could not open "<< fname << " for reading " << endl;
}
return 0;
}

View File

@ -0,0 +1,326 @@
//#include "ansi.h"
#include <iostream>
//#include "moench03T1ZmqData.h"
#ifdef NEWRECEIVER
#include "moench03T1ReceiverDataNew.h"
#endif
#ifdef CSAXS_FP
#include "moench03T1ReceiverData.h"
#endif
#ifdef OLDDATA
#include "moench03Ctb10GbT1Data.h"
#endif
// #include "interpolatingDetector.h"
//#include "etaInterpolationPosXY.h"
// #include "linearInterpolation.h"
// #include "noInterpolation.h"
#include "multiThreadedAnalogDetector.h"
#include "singlePhotonDetector.h"
//#include "interpolatingDetector.h"
#include <stdio.h>
#include <map>
#include <fstream>
#include <sys/stat.h>
#include <ctime>
using namespace std;
int main(int argc, char *argv[]) {
if (argc<4) {
cout << "Usage is " << argv[0] << "indir outdir fname [runmin] [runmax] [pedfile] [threshold] [nframes] [xmin xmax ymin ymax]" << endl;
cout << "threshold <0 means analog; threshold=0 means cluster finder; threshold>0 means photon counting" << endl;
cout << "nframes <0 means sum everything; nframes=0 means one file per run; nframes>0 means one file every nframes" << endl;
return 1;
}
int p=10000;
int fifosize=1000;
int nthreads=8;
int nsubpix=25;
int etabins=nsubpix*10;
double etamin=-1, etamax=2;
int csize=3;
int nx=400, ny=400;
int save=1;
int nsigma=5;
int nped=1000;
int ndark=100;
int ok;
int iprog=0;
#ifdef NEWRECEIVER
moench03T1ReceiverDataNew *decoder=new moench03T1ReceiverDataNew();
cout << "RECEIVER DATA WITH ONE HEADER!"<<endl;
#endif
#ifdef CSAXS_FP
moench03T1ReceiverData *decoder=new moench03T1ReceiverData();
cout << "RECEIVER DATA WITH ALL HEADERS!"<<endl;
#endif
#ifdef OLDDATA
moench03Ctb10GbT1Data *decoder=new moench03Ctb10GbT1Data();
cout << "OLD RECEIVER DATA!"<<endl;
#endif
singlePhotonDetector *filter=new singlePhotonDetector(decoder,csize, nsigma, 1, 0, nped, 200);
int size = 327680;////atoi(argv[3]);
int* image;
//int* image =new int[327680/sizeof(int)];
filter->newDataSet();
int ff, np;
int dsize=decoder->getDataSize();
//cout << " data size is " << dsize;
char data[dsize];
ifstream filebin;
char *indir=argv[1];
char *outdir=argv[2];
char *fformat=argv[3];
int runmin=0;
// cout << "argc is " << argc << endl;
if (argc>=5) {
runmin=atoi(argv[4]);
}
int runmax=runmin;
if (argc>=6) {
runmax=atoi(argv[5]);
}
char *pedfile=NULL;
if (argc>=7) {
pedfile=argv[6];
}
double thr=0;
double thr1=0;
if (argc>=8) {
thr=atoi(argv[7]);
}
int nframes=0;
if (argc>=9) {
nframes=atoi(argv[8]);
}
int xmin=0, xmax=400, ymin=0, ymax=400;
if (argc>=13) {
xmin=atoi(argv[9]);
xmax=atoi(argv[10]);
ymin=atoi(argv[11]);
ymax=atoi(argv[12]);
}
char ffname[10000];
char fname[10000];
char imgfname[10000];
char cfname[10000];
char fn[10000];
std::time_t end_time;
FILE *of=NULL;
cout << "input directory is " << indir << endl;
cout << "output directory is " << outdir << endl;
cout << "input file is " << fformat << endl;
cout << "runmin is " << runmin << endl;
cout << "runmax is " << runmax << endl;
if (pedfile)
cout << "pedestal file is " << pedfile << endl;
#ifndef ANALOG
if (thr>0) {
cout << "threshold is " << thr << endl;
filter->setThreshold(thr);
}
#endif
filter->setROI(xmin,xmax,ymin,ymax);
#ifdef SOLEIL
filter->setROI(150,210,170,230);
nframes=-1;
#endif
std::time(&end_time);
cout << std::ctime(&end_time) << endl;
char* buff;
multiThreadedAnalogDetector *mt=new multiThreadedAnalogDetector(filter,nthreads,fifosize);
#ifndef ANALOG
if (thr>=0) {
mt->setDetectorMode(ePhotonCounting);
cout << "Counting!" << endl;
} else
#endif
{
mt->setDetectorMode(eAnalog);
cout << "Analog!" << endl;
#ifdef ANALOG
thr1=thr;
#endif
}
mt->StartThreads();
mt->popFree(buff);
cout << "mt " << endl;
int ifr=0;
if (pedfile) {
cout << "PEDESTAL " ;
sprintf(fname,"%s.raw",pedfile);
cout << fname << endl ;
sprintf(imgfname,"%s/pedestals.tiff",outdir,fformat);
std::time(&end_time);
cout << "aaa" << std::ctime(&end_time) << endl;
mt->setFrameMode(ePedestal);
// sprintf(fn,fformat,irun);
filebin.open((const char *)(fname), ios::in | ios::binary);
// //open file
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)
cout << ifr << " " << ff << " " << np << endl;
ff=-1;
}
filebin.close();
while (mt->isBusy()) {;}
mt->writePedestal(imgfname);
std::time(&end_time);
cout << std::ctime(&end_time) << endl;
} else
cout << "Could not open "<< fname << " for reading " << endl;
}
ifr=0;
int ifile=0;
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);
sprintf(ffname,"%s/%s.tiff",outdir,fformat);
sprintf(imgfname,ffname,irun);
sprintf(ffname,"%s/%s.clust",outdir,fformat);
sprintf(cfname,ffname,irun);
cout << fname << " " ;
cout << imgfname << endl;
std::time(&end_time);
cout << std::ctime(&end_time) << endl;
// cout << fname << " " << outfname << " " << imgfname << endl;
filebin.open((const char *)(fname), ios::in | ios::binary);
// //open file
ifile=0;
if (filebin.is_open()){
if (thr<=0) {
if (of==NULL) {
of=fopen(cfname,"w");
if (of) {
mt->setFilePointer(of);
cout << "file pointer set " << endl;
} else {
cout << "Could not open "<< cfname << " for writing " << endl;
mt->setFilePointer(NULL);
return 1;
}
}
}
// //while read frame
ff=-1;
ifr=0;
while (decoder->readNextFrame(filebin, ff, np,buff)) {
// 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++;
}
}
ff=-1;
}
cout << "--" << endl;
filebin.close();
// //close file
// //join threads
while (mt->isBusy()) {;}
if (nframes>=0) {
if (nframes>0) {
sprintf(ffname,"%s/%s_f%05d.tiff",outdir,fformat,ifile);
sprintf(imgfname,ffname,irun);
}
sprintf(ffname,"%s/%s.tiff",outdir,fformat);
sprintf(imgfname,ffname,irun);
cout << "Writing tiff to " << imgfname << " " << thr1 <<endl;
mt->writeImage(imgfname, thr1);
mt->clearImage();
if (of) {
fclose(of);
of=NULL;
mt->setFilePointer(NULL);
}
}
std::time(&end_time);
cout << std::ctime(&end_time) << endl;
} else
cout << "Could not open "<< fname << " for reading " << endl;
}
return 0;
}

View File

@ -109,7 +109,7 @@ int main(int argc, char *argv[]) {
//analogDetector<uint16_t> *filter=new analogDetector<uint16_t>(det,1,NULL,1000);
//singlePhotonDetector *filter=new singlePhotonDetector(det,3, 5, 1, 0, 1000, 10);
// singlePhotonDetector *filter=new singlePhotonDetector(det,3, 5, 1, 0, 1000, 10);
eta2InterpolationPosXY *interp=new eta2InterpolationPosXY(npx, npy, nSubPixels, etabins, etamin, etamax);
if (etafname) interp->readFlatField(etafname);
@ -120,7 +120,7 @@ int main(int argc, char *argv[]) {
char* buff;
// multiThreadedCountingDetector *mt=new multiThreadedCountingDetector(filter,nthreads,fifosize);
// multiThreadedAnalogDetector *mt=new multiThreadedAnalogDetector(filter,nthreads,fifosize);
multiThreadedInterpolatingDetector *mt=new multiThreadedInterpolatingDetector(filter,nthreads,fifosize);
multiThreadedInterpolatingDetector *mt=new multiThreadedInterpolatingDetector(filter,nthreads,fifosize);
mt->setFrameMode(eFrame);
mt->StartThreads();
mt->popFree(buff);
@ -229,10 +229,10 @@ int main(int argc, char *argv[]) {
uint16_t yCoord = 0;
uint16_t zCoord = 0;
uint32_t debug = 0;
uint32_t dr = 16;
int16_t *dout;//=new int16_t [nnx*nny];
//uint32_t dr = 32;
//int32_t *dout=new int32_t [nnx*nny];
//uint32_t dr = 16;
//int16_t *dout;//=new int16_t [nnx*nny];
uint32_t dr = 32;
int32_t *dout=NULL;//=new int32_t [nnx*nny];
uint32_t nSigma=5;
uint16_t roundRNumber = 0;
uint8_t detType = 0;
@ -291,53 +291,71 @@ int main(int argc, char *argv[]) {
fclose(of);
of=NULL;
}
if (fMode==ePedestal) {
sprintf(ofname,"ped_%s_%d.tiff",fname,fileindex);
mt->writePedestal(ofname);
} else if (fMode==eFlat) {
mt->prepareInterpolation(ok);
sprintf(ofname,"eta_%s_%d.tiff",fname,fileindex);
mt->writeFlatField(ofname);
if (newFrame>0) {
cprintf(RED,"DIDn't receive any data!\n");
if (send) {
zmqsocket2->SendHeaderData(0, true, SLS_DETECTOR_JSON_HEADER_VERSION);
cprintf(RED, "Sent Dummy\n");
}
} else {
if (fMode==ePedestal) {
sprintf(ofname,"%s_%d_ped.tiff",fname,fileindex);
mt->writePedestal(ofname);
cout << "Writing pedestal to " << ofname << endl;
} else if (fMode==eFlat) {
mt->prepareInterpolation(ok);
sprintf(ofname,"%s_%d_eta.tiff",fname,fileindex);
mt->writeFlatField(ofname);
cout << "Writing eta to " << ofname << endl;
}
else {
sprintf(ofname,"%s_%d.tiff",fname,fileindex);
mt->writeImage(ofname);
cout << "Writing image to " << ofname << endl;
}
// cout << nns*nnx*nny*nns*dr/8 << " " << length << endl;
if (send) {
if (fMode==ePedestal) {
if (fMode==ePedestal) {
cprintf(MAGENTA,"Get pedestal!\n");
nns=1;
nnx=npx;
nny=npy;
dout= new int16_t[nnx*nny*nns*nns];
//dout= new int16_t[nnx*nny*nns*nns];
dout= new int32_t[nnx*nny*nns*nns];
// cout << "get pedestal " << endl;
ped=mt->getPedestal();
// cout << "got pedestal " << endl;
for (int ix=0; ix<nnx*nny; ix++) {
dout[ix]=ped[ix];
// if (ix<100*400)
// cout << ix << " " << ped[ix] << endl;
}
} else if (fMode==eFlat) {
int nb;
int nb;
double emi, ema;
int *ff=mt->getFlatField(nb, emi, ema);
nnx=nb;
nny=nb;
dout= new int16_t[nb*nb];
for (int ix=0; ix<nb*nb; ix++) {
dout[ix]=ff[ix];
}
} else {
int *ff=mt->getFlatField(nb, emi, ema);
nnx=nb;
nny=nb;
dout= new int32_t[nb*nb];
for (int ix=0; ix<nb*nb; ix++) {
dout[ix]=ff[ix];
}
}
else {
detimage=mt->getImage(nnx,nny,nns);
cprintf(MAGENTA,"Get image!\n");
cout << nnx << " " << nny << " " << nns << endl;
// nns=1;
// nnx=npx;
// nny=npy;
nnx=nnx*nns;
nny=nny*nns;
dout= new int16_t[nnx*nny];
for (int ix=0; ix<nnx*nns; ix++) {
// nnx=nnx*nns;
//nny=nny*nns;
dout= new int32_t[nnx*nny];
for (int ix=0; ix<nnx*nny; ix++) {
// for (int iy=0; iy<nny*nns; iy++) {
// for (int isx=0; isx<nns; isx++) {
// for (int isy=0; isy<nns; isy++) {
@ -350,6 +368,7 @@ int main(int argc, char *argv[]) {
// }
dout[ix]=detimage[ix];
if (dout[ix]<0) dout[ix]=0;
// cout << ix << " " << dout[ix] << endl;
// }
}
}
@ -357,7 +376,7 @@ int main(int argc, char *argv[]) {
#ifdef NEWZMQ
cout << "Sending image size " << nnx << " " << nny << endl;
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);
#endif
@ -365,16 +384,18 @@ int main(int argc, char *argv[]) {
#ifndef NEWZMQ
zmqsocket2->SendHeaderData(0, false, SLS_DETECTOR_JSON_HEADER_VERSION,0,0,0,0,0, 0,0,fname, 0, 0,0,0,0,0,0,0,0,0,0,0,1);
#endif
zmqsocket2->SendData((char*)dout,length);//nns*dr/8);
zmqsocket2->SendData((char*)dout,nnx*nny*dr/8);
cprintf(GREEN, "Sent Data\n");
zmqsocket2->SendHeaderData(0, true, SLS_DETECTOR_JSON_HEADER_VERSION);
cprintf(RED, "Sent Dummy\n");
delete [] dout;
if (dout)
delete [] dout;
dout=NULL;
}
}
mt->clearImage();
@ -382,7 +403,7 @@ int main(int argc, char *argv[]) {
continue; //continue to not get out
}
}
#ifdef NEWZMQ
if (newFrame) {
@ -463,15 +484,21 @@ int main(int argc, char *argv[]) {
fMode=ePedestal;
isPedestal=1;
} else if (frameMode_s == "flatfield") {
fMode=eFlat;
isFlat=1;
} else if (frameMode_s == "newFlatfield") {
mt->resetFlatField();
isFlat=1;
//cprintf(MAGENTA, "Resetting flatfield\n");
fMode=eFlat;
} else
fMode=eFlat;
isFlat=1;
} else if (frameMode_s == "newFlatfield") {
mt->resetFlatField();
isFlat=1;
cprintf(MAGENTA, "Resetting flatfield\n");
fMode=eFlat;
}
else {
fMode=eFrame;
isPedestal=0;
isFlat=0;
fMode=eFrame;
frameMode_s="frame";
}
}
}
cprintf(MAGENTA, "%s\n" , frameMode_s.c_str());
@ -512,12 +539,12 @@ int main(int argc, char *argv[]) {
}
}
cprintf(MAGENTA, "ROI: %d %d %d %d\n", xmin, xmax, ymin, ymax);
cprintf(MAGENTA, "%d %d %d %d\n", xmin, xmax, ymin, ymax);
mt->setROI(xmin, xmax, ymin, ymax);
if (doc.HasMember("dynamicRange")) {
dr=doc["dynamicRange"].GetUint();
dr=16;
dr=32;
}
dMode=eAnalog;
@ -528,58 +555,61 @@ int main(int argc, char *argv[]) {
detectorMode_s=doc["detectorMode"].GetString();
if (detectorMode_s == "interpolating"){
dMode=eInterpolating;
mt->setInterpolation(interp);
} else if (detectorMode_s == "counting"){
dMode=ePhotonCounting;
mt->setInterpolation(NULL);
} else {
dMode=eAnalog;
mt->setInterpolation(NULL);
}
}
}
cprintf(MAGENTA, "%s\n" , detectorMode_s.c_str());
mt->setDetectorMode(dMode);
cprintf(MAGENTA, "%s\n" , detectorMode_s.c_str());
// cout << "done " << endl;
/* Single Photon Detector commands */
nSigma=5;
if (doc.HasMember("nSigma")) {
if (doc["nSigma"].IsInt())
nSigma=doc["nSigma"].GetInt();
mt->setNSigma(nSigma);
}
// /* Single Photon Detector commands */
// nSigma=5;
// if (doc.HasMember("nSigma")) {
// if (doc["nSigma"].IsInt())
// nSigma=doc["nSigma"].GetInt();
// mt->setNSigma(nSigma);
// }
emin=-1;
emax=-1;
if (doc.HasMember("energyRange")) {
if (doc["energyRange"].IsArray()) {
if (doc["energyRange"].Size() > 0 )
if (doc["energyRange"][0].IsInt())
emin=doc["energyRange"][0].GetInt();
// emin=-1;
// emax=-1;
// if (doc.HasMember("energyRange")) {
// if (doc["energyRange"].IsArray()) {
// if (doc["energyRange"].Size() > 0 )
// if (doc["energyRange"][0].IsInt())
// emin=doc["energyRange"][0].GetInt();
if (doc["energyRange"].Size() > 1 )
if (doc["energyRange"][1].IsInt())
emax=doc["energyRange"][1].GetUint();
}
}
if (doc.HasMember("eMin")) {
if (doc["eMin"][1].IsInt())
emin=doc["eMin"].GetInt();
}
if (doc.HasMember("eMax")) {
if (doc["eMax"][1].IsInt())
emin=doc["eMax"].GetInt();
}
mt->setEnergyRange(emin,emax);
// if (doc["energyRange"].Size() > 1 )
// if (doc["energyRange"][1].IsInt())
// emax=doc["energyRange"][1].GetUint();
// }
// }
// if (doc.HasMember("eMin")) {
// if (doc["eMin"][1].IsInt())
// emin=doc["eMin"].GetInt();
// }
// if (doc.HasMember("eMax")) {
// if (doc["eMax"][1].IsInt())
// emin=doc["eMax"].GetInt();
// }
// mt->setEnergyRange(emin,emax);
/* interpolating detector commands */
// /* interpolating detector commands */
if (doc.HasMember("nSubPixels")) {
if (doc["nSubPixels"].IsUint())
nSubPixels=doc["nSubPixels"].GetUint();
mt->setNSubPixels(nSubPixels);
}
// if (doc.HasMember("nSubPixels")) {
// if (doc["nSubPixels"].IsUint())
// nSubPixels=doc["nSubPixels"].GetUint();
// mt->setNSubPixels(nSubPixels);
// }
newFrame=0;
@ -587,6 +617,8 @@ int main(int argc, char *argv[]) {
}
#endif
// cout << "file" << endl;
// cout << "data " << endl;
if (of==NULL) {
sprintf(ofname,"%s_%d.clust",filename.c_str(),fileindex);
of=fopen(ofname,"w");
@ -599,7 +631,7 @@ int main(int argc, char *argv[]) {
}
// cout << "data" << endl;
// get data
length = zmqsocket->ReceiveData(0, buff, size);
mt->pushData(buff);