From 4cce0aee62ca8dc3d8ee58ce7ecc2ff55fb5ec2a Mon Sep 17 00:00:00 2001 From: Anna Bergamaschi Date: Thu, 6 Feb 2020 14:28:20 +0100 Subject: [PATCH] Fixed ctbGui to work also with moench03 --- ctbGui/ctbAcquisition.cpp | 150 +++++++++++++++--- ctbGui/ctbAcquisition.h | 8 +- .../dataStructures/deserializer.h | 65 ++++++-- .../dataStructures/moench03T1ZmqDataNew.h | 4 +- .../moenchExecutables/Makefile.zmq | 2 +- .../moenchExecutables/moenchZmqProcess.cpp | 3 +- 6 files changed, 192 insertions(+), 40 deletions(-) diff --git a/ctbGui/ctbAcquisition.cpp b/ctbGui/ctbAcquisition.cpp index c0e95d214..4000715da 100755 --- a/ctbGui/ctbAcquisition.cpp +++ b/ctbGui/ctbAcquisition.cpp @@ -29,9 +29,10 @@ #include "sls_detector_defs.h" #include "ctbMain.h" #include "moench03CtbData.h" -#include "moench03TCtbData.h" -#include "moench03T1CtbData.h" +//#include "moench03TCtbData.h" +//#include "moench03T1CtbData.h" #include "moench03CommonMode.h" +#include "moench03T1ZmqDataNew.h" #include "moench02CtbData.h" //#include "jungfrau10ModuleData.h" #include "moenchCommonMode.h" @@ -43,6 +44,8 @@ #include "moench04CtbZmq10GbData.h" #include "deserializer.h" #include "detectorData.h" +#include "imageZmq16bit.h" + using namespace std; @@ -232,7 +235,9 @@ hframe=new TGHorizontalFrame(this, 800,50); cbDetType->AddEntry("MOENCH02", MOENCH02); cbDetType->AddEntry("MOENCH04", MOENCH04); // cbDetType->AddEntry("JUNGFRAU1.0", 2); - //cbDetType->AddEntry("MOENCH03 T", iiii++); + cbDetType->AddEntry("MOENCH03",MOENCH03); + cbDetType->AddEntry("IMAGE16BIT",IMAGE16B); + //cbDetType->AddEntry("MOENCH03", iiii++); // cbDetType->AddEntry("MYTHEN3 0.1", MYTHEN301); // cbDetType->AddEntry("ADCSAR2", ADCSAR2); @@ -271,7 +276,7 @@ hframe=new TGHorizontalFrame(this, 800,50); - cout << "off "<< endl; + // cout << "off "<< endl; hframe=new TGHorizontalFrame(this, 800,50); @@ -290,8 +295,8 @@ hframe=new TGHorizontalFrame(this, 800,50); TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax,0,16535); hframe->AddFrame(eSerOff,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1)); - eSerOff->MapWindow();; - eSerOff->SetNumber(5); + eSerOff->MapWindow(); + eSerOff->SetNumber(0); e= eSerOff->TGNumberEntry::GetNumberEntry(); eSerOff->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeSerialOffset(Long_t)"); e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeSerialOffset()"); @@ -337,6 +342,53 @@ hframe=new TGHorizontalFrame(this, 800,50); + hframe=new TGHorizontalFrame(this, 800,50); + AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 10,10,10,10)); + hframe->MapWindow(); + + + + label=new TGLabel(hframe,"Image Pixels"); + hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5)); + label->MapWindow(); + label->SetTextJustify(kTextLeft); + + + label=new TGLabel(hframe,"X: "); + hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5)); + label->MapWindow(); + label->SetTextJustify(kTextRight); + + + ePixX=new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger, + TGNumberFormat::kNEANonNegative, + TGNumberFormat::kNELLimitMinMax,0,16535); + hframe->AddFrame(ePixX,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1)); + ePixX->MapWindow(); + ePixX->SetNumber(0); + e= ePixX->TGNumberEntry::GetNumberEntry(); + ePixX->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeImagePixels(Long_t)"); + e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeImagePixels()"); + + + + label=new TGLabel(hframe,"Y: "); + hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5)); + label->MapWindow(); + label->SetTextJustify(kTextRight); + + + ePixY=new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger, + TGNumberFormat::kNEANonNegative, + TGNumberFormat::kNELLimitMinMax,0,16535); + hframe->AddFrame(ePixY,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1)); + ePixY->MapWindow(); + ePixY->SetNumber(0); + e= ePixY->TGNumberEntry::GetNumberEntry(); + ePixY->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeImagePixels(Long_t)"); + e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeImagePixels()"); + + hframe=new TGHorizontalFrame(this, 800,50); @@ -859,6 +911,11 @@ 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; + } i=0; @@ -1200,6 +1257,9 @@ void ctbAcquisition::changeDetector(){ eNumCount->SetState(kFALSE); eDynRange->SetState(kFALSE); eSerOff->SetState(kFALSE); + ePixX->SetState(kFALSE); + ePixY->SetState(kFALSE); + deserializer=0; if (rb2D->IsOn() ) {//|| rbScan->IsOn() switch (cbDetType->GetSelected()) { @@ -1210,7 +1270,6 @@ void ctbAcquisition::changeDetector(){ // commonMode=new moench03CommonMode(); break; case MOENCH04: - try { auto retval = myDet->getTenGiga().tsquash("Different values"); if (retval) { @@ -1223,6 +1282,36 @@ void ctbAcquisition::changeDetector(){ cout << "MOENCH 0.4!" << endl; commonMode=new moench03CommonMode(); break; + case MOENCH03: + //try { + // auto retval = myDet->getTenGiga().tsquash("Different values"); + // if (retval) { + dataStructure=new moench03T1ZmqDataNew(nAnalogSamples); + // } else { + // dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples); + // } + //} CATCH_DISPLAY ("Could not get ten giga enable.", "ctbAcquisition::changeDetector") + + cout << "MOENCH 0.3! USE JUNGFRAU MODULE!" << endl; + commonMode=new moench03CommonMode(); + break; + case IMAGE16B: + //try { + // auto retval = myDet->getTenGiga().tsquash("Different values"); + // if (retval) { + 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; + commonMode=NULL; + break; // case 1: // cout << "************** T!!!!!!!!!!" << endl; @@ -1511,13 +1600,13 @@ void ctbAcquisition::update() { if (dataStructure) { cout << cbDetType->GetSelected()<< endl; - if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){ - cout << "settings deserialiation parameters for MYTHEN" << endl; - mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure; - eSerOff->SetNumber( ms->setSerialOffset(-1)); - eDynRange->SetNumber( ms->setDynamicRange(-1)); - eNumCount->SetNumber( ms->setNumberOfCounters(-1)); - } + // if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){ + // cout << "settings deserialiation parameters for MYTHEN" << endl; + // mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure; + // eSerOff->SetNumber( ms->setSerialOffset(-1)); + // eDynRange->SetNumber( ms->setDynamicRange(-1)); + // eNumCount->SetNumber( ms->setNumberOfCounters(-1)); + // } } @@ -1977,20 +2066,22 @@ void ctbAcquisition::ChangeNumberOfChannels(Long_t a){ void ctbAcquisition::ChangeSerialOffset(){ + changeDetector(); // if (dataStructure) { - // // cout << cbDetType->GetSelected()<< endl; - // // if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302 ){ - // // cout << "settings offsets for MYTHEN" << endl; - // // mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure; - // // ms->setSerialOffset(eSerOff->GetIntNumber()); + // cout << cbDetType->GetSelected()<< endl; + // if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302 ){ + // cout << "settings offsets for MYTHEN" << endl; + // mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure; + // ms->setSerialOffset(eSerOff->GetIntNumber()); - // // } + // } // } }; void ctbAcquisition::ChangeDynamicRange(){ + changeDetector(); // if (dataStructure) { // cout << cbDetType->GetSelected()<< endl; @@ -2004,6 +2095,7 @@ void ctbAcquisition::ChangeDynamicRange(){ }; void ctbAcquisition::ChangeNumberOfChannels(){ + changeDetector(); // if (dataStructure) { // cout << cbDetType->GetSelected()<< endl; // if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){ @@ -2017,6 +2109,24 @@ void ctbAcquisition::ChangeNumberOfChannels(){ changePlot(); }; +void ctbAcquisition::ChangeImagePixels(Long_t a){ + ChangeImagePixels(); +}; + +void ctbAcquisition::ChangeImagePixels(){ + changeDetector(); + // if (dataStructure) { + // cout << cbDetType->GetSelected()<< endl; + // if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){ + // cout << "settings number of channels for MYTHEN" << endl; + // mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure; + // ms->setNumberOfCounters(eNumCount->GetIntNumber()); + + // } + // } + // if (deserializer) + // changePlot(); +}; void ctbAcquisition::ChangeHistoLimitsPedSub(Long_t a){ diff --git a/ctbGui/ctbAcquisition.h b/ctbGui/ctbAcquisition.h index ed1f69fe8..89bc3a104 100755 --- a/ctbGui/ctbAcquisition.h +++ b/ctbGui/ctbAcquisition.h @@ -42,7 +42,7 @@ using namespace std; class ctbAcquisition : public TGGroupFrame { - enum {DESERIALIZER, MOENCH04, MOENCH02, ADCSAR2, MYTHEN301, MYTHEN302}; + enum {DESERIALIZER, MOENCH04, MOENCH02, MOENCH03, IMAGE16B, ADCSAR2, MYTHEN301, MYTHEN302}; private: @@ -57,6 +57,9 @@ class ctbAcquisition : public TGGroupFrame { TGNumberEntry *eNumCount; + TGNumberEntry *ePixX; + TGNumberEntry *ePixY; + TGNumberEntry *eFitADC; TGNumberEntry *eBitPlot; TGNumberEntry *eMinRaw; @@ -231,7 +234,8 @@ class ctbAcquisition : public TGGroupFrame { void ChangeNumberOfChannels(Long_t); void ChangeDynamicRange(); void ChangeDynamicRange(Long_t); - + void ChangeImagePixels(); + void ChangeImagePixels(Long_t); void canvasClicked(); void FitADC(); diff --git a/slsDetectorCalibration/dataStructures/deserializer.h b/slsDetectorCalibration/dataStructures/deserializer.h index bf18b4335..a14da9e15 100644 --- a/slsDetectorCalibration/dataStructures/deserializer.h +++ b/slsDetectorCalibration/dataStructures/deserializer.h @@ -1,6 +1,7 @@ #ifndef DESERIALIZER_H #define DESERIALIZER_H #include +#include "slsDetectorData.h" class deserializer : public slsDetectorData { @@ -52,7 +53,13 @@ class deserializer : public slsDetectorData { static int* deserializeAll(char *ptr, std::vector dbl, int dr=24, int nch=64*3, int off=5) { // off=0; //int iarg; - int64_t word, *wp; + + + cout <<"** deserializer: " << endl; + cout << "** Number of chans:\t" << nch << endl; + cout << "** Serial Offset:\t" << off << endl; + cout << "** Dynamic range:\t" << dr << endl; + int64_t word, *wp, ww,one=1, bit ; int* val=new int[nch]; int ioff=0; int idr=0; @@ -66,39 +73,62 @@ class deserializer : public slsDetectorData { val[ib]=0; } wp=(int64_t*)ptr; + + int nw=nch/nb; + + cout << "** Number of bits:\t" << nb << endl; + cout << "** Samples:\t" << nw << endl; + + for (ib=0; ib1060) */ + /* cout << iw << " " << idr << " " << ib << " " << bit << " " << ich << " " << val[ich] << " ** " ; */ + bit=dbl[ib]; + ww=one<1060) */ + /* cout << val[ich] << " " << hex << word << " " << ww << " " << (word&(ww)) << dec < { int ii=0; int ich; int nb=dbl.size(); - + int bit; char *dval; idr=0; @@ -127,8 +157,13 @@ class deserializer : public slsDetectorData { dval=ptr; ib=0; - ich=0; - for (const auto &bit : dbl) { + ich=0; + for (ib=0; ib1060) */ + /* cout << iw << " " << idr << " " << ib << " " << bit << " " << ich << " " << val[ich] << " ** " ; */ + bit=dbl[ib]; //ioff=off; idr=0; for (iw=0; iw<(nch*dr/nb)/8; iw++) { @@ -141,7 +176,7 @@ class deserializer : public slsDetectorData { } } ii++; - ib++; + // ib++; }//end for diff --git a/slsDetectorCalibration/dataStructures/moench03T1ZmqDataNew.h b/slsDetectorCalibration/dataStructures/moench03T1ZmqDataNew.h index 5cdb74242..a8c604121 100644 --- a/slsDetectorCalibration/dataStructures/moench03T1ZmqDataNew.h +++ b/slsDetectorCalibration/dataStructures/moench03T1ZmqDataNew.h @@ -28,7 +28,8 @@ class moench03T1ZmqDataNew : public slsDetectorData { \param c crosstalk parameter for the output buffer */ - 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(sizeof(int)), xtalk(0.00021) { +moench03T1ZmqDataNew(int ns=5000): slsDetectorData(400, 400, ns*32*2+sizeof(int)), nSamples(ns), offset(0), xtalk(0.00021) { int nadc=32; int sc_width=25; @@ -137,6 +138,7 @@ class moench03T1ZmqDataNew : public slsDetectorData { /* vout+=0.0008*val-6224; */ /* return vout; //(double)getChannel(data, ix, iy); */ + // cout << ix << " "<< iy << " " << dataMap[iy][ix] << endl; return ((double)getChannel(data, ix, iy))+xtalk*getGhost(iy,iy); }; diff --git a/slsDetectorCalibration/moenchExecutables/Makefile.zmq b/slsDetectorCalibration/moenchExecutables/Makefile.zmq index 2db6dbdda..b0aecf786 100644 --- a/slsDetectorCalibration/moenchExecutables/Makefile.zmq +++ b/slsDetectorCalibration/moenchExecutables/Makefile.zmq @@ -1,5 +1,5 @@ -INCDIR= -I. -I../dataStructures ../tiffIO.cpp -I../ -I../interpolations/ -I../../slsSupportLib/include/ -I../../slsReceiverSoftware/include/ +INCDIR= -I. -I../dataStructures ../tiffIO.cpp -I../ -I../interpolations/ -I../../slsSupportLib/include/ -I../../slsReceiverSoftware/include/ -I../../libs/rapidjson/ LDFLAG= -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -O3 -g -std=c++11 -Wall #-L../../bin -lhdf5 -L. diff --git a/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp b/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp index 6653dc4a1..df577e037 100644 --- a/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp +++ b/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp @@ -293,7 +293,8 @@ int main(int argc, char *argv[]) { uint8_t detType = 0; uint8_t version = 0; // int* flippedData = 0; - char* additionalJsonHeader = 0; + string* additionalJsonHeader = 0; + //char* additionalJsonHeader = 0; int32_t threshold=0;