From 6b0bf02a85531939702bc42ad16636858161820c Mon Sep 17 00:00:00 2001 From: Anna Bergamaschi Date: Tue, 18 Feb 2020 10:45:53 +0100 Subject: [PATCH] Some fixes to use moench --- ctbGui/ctbAcquisition.cpp | 43 ++++-- ctbGui/ctbAcquisition.h | 2 +- slsDetectorCalibration/analogDetector.h | 2 +- .../dataStructures/moench03T1ZmqDataNew.h | 2 +- .../moenchExecutables/Makefile.zmq | 6 +- .../moenchExecutables/moenchZmqProcess.cpp | 131 +++++++++++------- .../multiThreadedAnalogDetector.h | 65 +++++++++ slsDetectorSoftware/src/multiSlsDetector.cpp | 38 +++-- 8 files changed, 210 insertions(+), 79 deletions(-) diff --git a/ctbGui/ctbAcquisition.cpp b/ctbGui/ctbAcquisition.cpp index 4000715da..812e5459b 100755 --- a/ctbGui/ctbAcquisition.cpp +++ b/ctbGui/ctbAcquisition.cpp @@ -45,6 +45,7 @@ #include "deserializer.h" #include "detectorData.h" #include "imageZmq16bit.h" +#include "imageZmq32bit.h" using namespace std; @@ -236,6 +237,7 @@ hframe=new TGHorizontalFrame(this, 800,50); cbDetType->AddEntry("MOENCH04", MOENCH04); // cbDetType->AddEntry("JUNGFRAU1.0", 2); cbDetType->AddEntry("MOENCH03",MOENCH03); + cbDetType->AddEntry("IMAGE32BIT",IMAGE32B); cbDetType->AddEntry("IMAGE16BIT",IMAGE16B); //cbDetType->AddEntry("MOENCH03", iiii++); @@ -365,7 +367,7 @@ hframe=new TGHorizontalFrame(this, 800,50); TGNumberFormat::kNELLimitMinMax,0,16535); hframe->AddFrame(ePixX,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1)); ePixX->MapWindow(); - ePixX->SetNumber(0); + ePixX->SetNumber(400); e= ePixX->TGNumberEntry::GetNumberEntry(); ePixX->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeImagePixels(Long_t)"); e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeImagePixels()"); @@ -383,7 +385,7 @@ hframe=new TGHorizontalFrame(this, 800,50); TGNumberFormat::kNELLimitMinMax,0,16535); hframe->AddFrame(ePixY,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1)); ePixY->MapWindow(); - ePixY->SetNumber(0); + ePixY->SetNumber(400); e= ePixY->TGNumberEntry::GetNumberEntry(); ePixY->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeImagePixels(Long_t)"); e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeImagePixels()"); @@ -911,10 +913,10 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") { nx=eNumCount->GetIntNumber(); dr=eDynRange->GetIntNumber(); soff=eSerOff->GetIntNumber(); - cout <<"deserializer: " << endl; - cout << "Number of chans:\t" << nx << endl; - cout << "Serial Offset:\t" << soff << endl; - cout << "Dynamic range:\t" << dr << endl; + // cout <<"deserializer: " << endl; + // cout << "Number of chans:\t" << nx << endl; + // cout << "Serial Offset:\t" << soff << endl; + // cout << "Dynamic range:\t" << dr << endl; } @@ -980,7 +982,7 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") { for (int y=0; ygetValue(data->data,x,y); - + // cout << x << " " <IsOn()) { if (photonFinder) { photonFinder->addToPedestal(aval,x,y); @@ -1295,23 +1297,41 @@ void ctbAcquisition::changeDetector(){ cout << "MOENCH 0.3! USE JUNGFRAU MODULE!" << endl; commonMode=new moench03CommonMode(); break; + case IMAGE32B: + //try { + // auto retval = myDet->getTenGiga().tsquash("Different values"); + // if (retval) { + // if (deserializer) { + ePixX->SetState(kTRUE); + ePixY->SetState(kTRUE); + // } + dataStructure=new imageZmq32bit(ePixX->GetIntNumber(),ePixY->GetIntNumber()); + // } else { + // dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples); + // } + //} CATCH_DISPLAY ("Could not get ten giga enable.", "ctbAcquisition::changeDetector") + + cout << "Image 32bit, no channel shuffling" << endl; + commonMode=NULL; + break; + case IMAGE16B: //try { // auto retval = myDet->getTenGiga().tsquash("Different values"); // if (retval) { - if (deserializer) { + // if (deserializer) { ePixX->SetState(kTRUE); ePixY->SetState(kTRUE); - } + // } dataStructure=new imageZmq16bit(ePixX->GetIntNumber(),ePixY->GetIntNumber()); // } else { // dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples); // } //} CATCH_DISPLAY ("Could not get ten giga enable.", "ctbAcquisition::changeDetector") - cout << "Image, no channel shuffling" << endl; + cout << "Image 16bit, no channel shuffling" << endl; commonMode=NULL; - break; + break; // case 1: // cout << "************** T!!!!!!!!!!" << endl; @@ -1375,6 +1395,7 @@ void ctbAcquisition::changeDetector(){ photonFinder=new singlePhotonDetector(dataStructure,csize,nsigma,1,cm); //sign is positive - should correct with ADC mask, no common mode //photonFinder=new singlePhotonDetector(dataStructure,csize,nsigma,1,cm); //sign is positive - should correct with ADC mask, no common mode dataStructure->getDetectorSize(nx,ny); + } if (deserializer) { ny=1; diff --git a/ctbGui/ctbAcquisition.h b/ctbGui/ctbAcquisition.h index 89bc3a104..212bc5e1a 100755 --- a/ctbGui/ctbAcquisition.h +++ b/ctbGui/ctbAcquisition.h @@ -42,7 +42,7 @@ using namespace std; class ctbAcquisition : public TGGroupFrame { - enum {DESERIALIZER, MOENCH04, MOENCH02, MOENCH03, IMAGE16B, ADCSAR2, MYTHEN301, MYTHEN302}; + enum {DESERIALIZER, MOENCH04, MOENCH02, MOENCH03, IMAGE32B, IMAGE16B, ADCSAR2, MYTHEN301, MYTHEN302}; private: diff --git a/slsDetectorCalibration/analogDetector.h b/slsDetectorCalibration/analogDetector.h index d8b0e141f..0078a0abe 100644 --- a/slsDetectorCalibration/analogDetector.h +++ b/slsDetectorCalibration/analogDetector.h @@ -423,7 +423,7 @@ template class analogDetector { if (g==0) g=-1.; } - return stat[iy][ix].getPedestalRMS()/g;//divide by gain? + return stat[iy][ix].getPedestalRMS();//divide by gain? } return -1; }; diff --git a/slsDetectorCalibration/dataStructures/moench03T1ZmqDataNew.h b/slsDetectorCalibration/dataStructures/moench03T1ZmqDataNew.h index a8c604121..22f6d126c 100644 --- a/slsDetectorCalibration/dataStructures/moench03T1ZmqDataNew.h +++ b/slsDetectorCalibration/dataStructures/moench03T1ZmqDataNew.h @@ -29,7 +29,7 @@ class moench03T1ZmqDataNew : public slsDetectorData { */ // moench03T1ZmqDataNew(int ns=5000): slsDetectorData(400, 400, ns*32*2+sizeof(int)), nSamples(ns), offset(sizeof(int)), xtalk(0.00021) { -moench03T1ZmqDataNew(int ns=5000): slsDetectorData(400, 400, ns*32*2+sizeof(int)), nSamples(ns), offset(0), xtalk(0.00021) { + moench03T1ZmqDataNew(int ns=5000, int oo=0): slsDetectorData(400, 400, ns*32*2+oo), nSamples(ns), offset(oo), xtalk(0.00021) { int nadc=32; int sc_width=25; diff --git a/slsDetectorCalibration/moenchExecutables/Makefile.zmq b/slsDetectorCalibration/moenchExecutables/Makefile.zmq index b0aecf786..21ff8ee0b 100644 --- a/slsDetectorCalibration/moenchExecutables/Makefile.zmq +++ b/slsDetectorCalibration/moenchExecutables/Makefile.zmq @@ -5,11 +5,15 @@ LDFLAG= -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -O3 #DESTDIR?=../bin -all: moenchZmqProcess +all: moenchZmqProcess moenchZmqProcessCtbGui + moenchZmqProcess: moenchZmqProcess.cpp clean g++ -o moenchZmqProcess moenchZmqProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWZMQ -DINTERP +moenchZmqProcessCtbGui: moenchZmqProcess.cpp clean + g++ -o moenchZmqProcessCtbGui moenchZmqProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWZMQ -DINTERP -DCTBGUI + clean: rm -f moenchZmqProcess diff --git a/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp b/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp index df577e037..e30f56361 100644 --- a/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp +++ b/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp @@ -74,6 +74,14 @@ int main(int argc, char *argv[]) { // high_resolution_clock::time_point t1; // high_resolution_clock::time_point t2 ; time_t begin,end,finished; + int rms=0; + + int nped=1000, nped0=100; + +#ifdef PTC + nped=10000; + nped0=10000; +#endif if (argc > 4) { @@ -111,7 +119,7 @@ int main(int argc, char *argv[]) { } //slsDetectorData *det=new moench03T1ZmqDataNew(); - moench03T1ZmqDataNew *det=new moench03T1ZmqDataNew(); + moench03T1ZmqDataNew *det=new moench03T1ZmqDataNew(5000,sizeof(int)); cout << endl << " det" <getDetectorSize(npx, npy); @@ -129,8 +137,15 @@ int main(int argc, char *argv[]) { int ncol_cm=CM_ROWS; double xt_ghost=C_GHOST; - moench03CommonMode *cm=new moench03CommonMode(ncol_cm); - moench03GhostSummation *gs=new moench03GhostSummation(det, xt_ghost); + + + moench03CommonMode *cm=NULL; + moench03GhostSummation *gs=NULL; +#ifdef CORR + cm=new moench03CommonMode(ncol_cm); + gs=new moench03GhostSummation(det, xt_ghost); +#endif + double *gainmap=NULL; float *gm; double *gmap=NULL; @@ -158,7 +173,7 @@ int main(int argc, char *argv[]) { //analogDetector *filter=new analogDetector(det,1,NULL,1000); #ifndef INTERP - singlePhotonDetector *filter=new singlePhotonDetector(det,3, nSigma, 1, cm, 1000, 10, -1, -1, gainmap, gs); + singlePhotonDetector *filter=new singlePhotonDetector(det,3, nSigma, 1, cm, nped, nped0, -1, -1, gainmap, gs); multiThreadedCountingDetector *mt=new multiThreadedCountingDetector(filter,nthreads,fifosize); @@ -169,7 +184,7 @@ int main(int argc, char *argv[]) { if (etafname) interp->readFlatField(etafname); - interpolatingDetector *filter=new interpolatingDetector(det,interp, nSigma, 1, cm, 1000, 10, -1, -1, gainmap, gs); + interpolatingDetector *filter=new interpolatingDetector(det,interp, nSigma, 1, cm, nped, nped0, -1, -1, gainmap, gs); multiThreadedInterpolatingDetector *mt=new multiThreadedInterpolatingDetector(filter,nthreads,fifosize); #endif @@ -357,6 +372,11 @@ int main(int argc, char *argv[]) { sprintf(ofname,"%s_%ld_ped.tiff",fname,fileindex); mt->writePedestal(ofname); cout << "Writing pedestal to " << ofname << endl; + if (rms) { + sprintf(ofname,"%s_%ld_var.tiff",fname,fileindex); + mt->writePedestalRMS(ofname); + cout << "Writing pedestal variance to " << ofname << endl; + } } #ifdef INTERP else if (fMode==eFlat) { @@ -389,7 +409,7 @@ int main(int argc, char *argv[]) { dout[ix]=ped[ix]; // if (ix<100*400) - // cout << ix << " " << ped[ix] << endl; + // cout << ix << " " << ped[ix] << " "<< dout[ix] << endl; } } @@ -427,9 +447,9 @@ int main(int argc, char *argv[]) { // } // } - dout[ix]=detimage[ix]; - if (dout[ix]<0) dout[ix]=0; - // cout << ix << " " << dout[ix] << endl; + dout[ix]=detimage[ix]; + if (dout[ix]<0) dout[ix]=0; + //cout << ix << " " << dout[ix] << endl; // } } } @@ -449,42 +469,48 @@ int main(int argc, char *argv[]) { // cout << "Sending image size " << nnx << " " << nny << endl; -#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); +// #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); +// #endif +// #endif + + +// #ifdef DEVELOPER +#ifdef CTBGUI + 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); #endif +#ifndef CTBGUI + zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 0,0,nnx,1,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, 0,additionalJsonHeader); #endif +// #endif +// #ifdef MOENCH_BRANCH +// /* +// int SendHeaderData ( int index, bool dummy, uint32_t jsonversion, uint32_t dynamicrange = 0, uint64_t fileIndex = 0, +// uint32_t npixelsx = 0, uint32_t npixelsy = 0, uint32_t imageSize = 0, +// uint64_t acqIndex = 0, uint64_t fIndex = 0, char* fname = NULL, +// uint64_t frameNumber = 0, uint32_t expLength = 0, uint32_t packetNumber = 0, +// uint64_t bunchId = 0, uint64_t timestamp = 0, +// uint16_t modId = 0, uint16_t row = 0, uint16_t column = 0, uint16_t reserved = 0, +// uint32_t debug = 0, uint16_t roundRNumber = 0, +// uint8_t detType = 0, uint8_t version = 0, int* flippedData = 0, +// char* additionalJsonHeader = 0) { +// int ZmqSocket::SendHeaderData(int 0, bool false, uint32_t SLS_DETECTOR_JSON_HEADER_VERSION , uint32_t dr, uint64_t fileindex, uint32_t 0, uint32_t 0, uint32_t, uint64_t, uint64_t, char*, uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t, int*, char*) -#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); -#endif -#ifdef MOENCH_BRANCH - /* - int SendHeaderData ( int index, bool dummy, uint32_t jsonversion, uint32_t dynamicrange = 0, uint64_t fileIndex = 0, - uint32_t npixelsx = 0, uint32_t npixelsy = 0, uint32_t imageSize = 0, - uint64_t acqIndex = 0, uint64_t fIndex = 0, char* fname = NULL, - uint64_t frameNumber = 0, uint32_t expLength = 0, uint32_t packetNumber = 0, - uint64_t bunchId = 0, uint64_t timestamp = 0, - uint16_t modId = 0, uint16_t row = 0, uint16_t column = 0, uint16_t reserved = 0, - uint32_t debug = 0, uint16_t roundRNumber = 0, - uint8_t detType = 0, uint8_t version = 0, int* flippedData = 0, - char* additionalJsonHeader = 0) { -int ZmqSocket::SendHeaderData(int 0, bool false, uint32_t SLS_DETECTOR_JSON_HEADER_VERSION , uint32_t dr, uint64_t fileindex, uint32_t 0, uint32_t 0, uint32_t, uint64_t, uint64_t, char*, uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t, int*, char*) +// */ +// //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,additionalJsonHeader); +// 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, 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,additionalJsonHeader); - 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); - - /* old - 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); - */ - /* +// /* old +// 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); +// */ +// /* - new - 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,additionalJsonHeader); - */ -#endif +// new +// 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,additionalJsonHeader); +// */ +// #endif @@ -578,6 +604,7 @@ int ZmqSocket::SendHeaderData(int 0, bool false, uint32_t SLS_DETECTOR_JSON_HEAD /* Analog detector commands */ //isPedestal=0; //isFlat=0; + rms=0; fMode=eFrame; frameMode_s="frame"; cprintf(MAGENTA, "Frame mode: "); @@ -587,11 +614,17 @@ int ZmqSocket::SendHeaderData(int 0, bool false, uint32_t SLS_DETECTOR_JSON_HEAD if (frameMode_s == "pedestal"){ fMode=ePedestal; //isPedestal=1; - } else if (frameMode_s == "newPedestal"){ + } else if (frameMode_s == "newpedestal"){ mt->newDataSet(); //resets pedestal // cprintf(MAGENTA, "Resetting pedestal\n"); fMode=ePedestal; //isPedestal=1; + } else if (frameMode_s == "variance"){ + mt->newDataSet(); //resets pedestal + // cprintf(MAGENTA, "Resetting pedestal\n"); + fMode=ePedestal; + rms=1; + //isPedestal=1; } #ifdef INTERP else if (frameMode_s == "flatfield") { @@ -612,11 +645,13 @@ int ZmqSocket::SendHeaderData(int 0, bool false, uint32_t SLS_DETECTOR_JSON_HEAD frameMode_s="frame"; } } - } - cprintf(MAGENTA, "%s\n" , frameMode_s.c_str()); + cprintf(MAGENTA, "%s\n" , frameMode_s.c_str()); + } else + cprintf(RED, "%s\n" , frameMode_s.c_str()); + mt->setFrameMode(fMode); - // threshold=0; + threshold=0; cprintf(MAGENTA, "Threshold: "); if (doc.HasMember("threshold")) { if (doc["threshold"].IsInt()) { @@ -684,10 +719,11 @@ int ZmqSocket::SendHeaderData(int 0, bool false, uint32_t SLS_DETECTOR_JSON_HEAD } } - } + cprintf(MAGENTA, "%s\n" , detectorMode_s.c_str()); + } else + cprintf(RED, "%s\n" , frameMode_s.c_str()); mt->setDetectorMode(dMode); - cprintf(MAGENTA, "%s\n" , detectorMode_s.c_str()); // cout << "done " << endl; @@ -738,7 +774,7 @@ int ZmqSocket::SendHeaderData(int 0, bool false, uint32_t SLS_DETECTOR_JSON_HEAD // cout << "file" << endl; // cout << "data " << endl; - if (of==NULL) { + if (of==NULL && dMode!=eAnalog && fMode!=ePedestal && threshold<=0) { #ifdef WRITE_QUAD sprintf(ofname,"%s_%ld.clust2",filename.c_str(),fileindex); #endif @@ -779,9 +815,6 @@ int ZmqSocket::SendHeaderData(int 0, bool false, uint32_t SLS_DETECTOR_JSON_HEAD zmqsocket->ReceiveData(0, dummybuff, size); } - - - iframe++; } // exiting infinite loop diff --git a/slsDetectorCalibration/multiThreadedAnalogDetector.h b/slsDetectorCalibration/multiThreadedAnalogDetector.h index 5aaa31e51..9a37a62ca 100644 --- a/slsDetectorCalibration/multiThreadedAnalogDetector.h +++ b/slsDetectorCalibration/multiThreadedAnalogDetector.h @@ -461,6 +461,50 @@ public: return ped; }; + + virtual double *getPedestalRMS(){ + int nx, ny; + dets[0]->getDetectorSize(nx,ny); + // if (ped) delete [] ped; + double *rms=new double[nx*ny]; + double *p0=new double[nx*ny]; + + for (int i=0; igetInterpolation(nb,emi,ema); + // cout << i << endl; + p0=dets[i]->getPedestalRMS(p0); + if (p0) { + if (i==0) { + + for (int ib=0; ib0) */ + /* rms[ib]=sqrt(ped[ib]); */ + /* else */ + /* rms[ib]=0; */ + /* } */ + + + return rms; + }; + + + + virtual double *setPedestal(double *h=NULL){ //int nb=0; @@ -498,6 +542,27 @@ public: }; + virtual void *writePedestalRMS(const char * imgname){ + + int nx, ny; + dets[0]->getDetectorSize(nx,ny); + + double *rms=getPedestalRMS(); + float *gm=new float[nx*ny]; + if (gm) { + for (int ix=0; ixReceiveData(isocket, image, size); - // creating multi image { uint32_t xoffset = coordX * nPixelsX * bytesPerPixel; uint32_t yoffset = coordY * nPixelsY; uint32_t singledetrowoffset = nPixelsX * bytesPerPixel; uint32_t rowoffset = nX * singledetrowoffset; - if (multi_shm()->multiDetectorType == CHIPTESTBOARD) { + if (multi_shm()->multiDetectorType == CHIPTESTBOARD) { singledetrowoffset = size; - } - FILE_LOG(logDEBUG1) - << "Multi Image Info:" + nPixelsY=1; + + } + + + FILE_LOG(logDEBUG1) + << "Multi Image Info:" "\n\txoffset: " << xoffset << "\n\tyoffset: " << yoffset << "\n\tsingledetrowoffset: " << singledetrowoffset @@ -654,6 +660,7 @@ void multiSlsDetector::readFrameFromReceiver() { } } else { for (uint32_t i = 0; i < nPixelsY; ++i) { + std::cout << i << " " << std::endl; memcpy(((char *)multiframe) + ((yoffset + i) * rowoffset) + xoffset, (char *)image + (i * singledetrowoffset), @@ -663,11 +670,11 @@ void multiSlsDetector::readFrameFromReceiver() { } } } - FILE_LOG(logDEBUG) << "Call Back Info:" + FILE_LOG(logDEBUG)<< "Call Back Info:" << "\n\t nDetPixelsX: " << nDetPixelsX << "\n\t nDetPixelsY: " << nDetPixelsY << "\n\t databytes: " << multisize - << "\n\t dynamicRange: " << dynamicRange; + << "\n\t dynamicRange: " << dynamicRange ; // send data to callback if (data) { @@ -683,7 +690,8 @@ void multiSlsDetector::readFrameFromReceiver() { } int n = processImageWithGapPixels(multiframe, multigappixels, quadEnable); - FILE_LOG(logDEBUG) << "Call Back Info Recalculated:" + FILE_LOG(logDEBUG) + << "Call Back Info Recalculated:" << "\n\t nDetPixelsX: " << nDetPixelsX << "\n\t nDetPixelsY: " << nDetPixelsY << "\n\t databytes: " << n; @@ -704,7 +712,7 @@ void multiSlsDetector::readFrameFromReceiver() { pCallbackArg); delete thisData; } - + // all done if (numRunning == 0) { // let main thread know that all dummy packets have been received