Fixed ctbGui to work also with moench03

This commit is contained in:
bergamaschi 2020-02-06 14:28:20 +01:00
parent 2314fdabd1
commit 4cce0aee62
6 changed files with 192 additions and 40 deletions

View File

@ -29,9 +29,10 @@
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
#include "ctbMain.h" #include "ctbMain.h"
#include "moench03CtbData.h" #include "moench03CtbData.h"
#include "moench03TCtbData.h" //#include "moench03TCtbData.h"
#include "moench03T1CtbData.h" //#include "moench03T1CtbData.h"
#include "moench03CommonMode.h" #include "moench03CommonMode.h"
#include "moench03T1ZmqDataNew.h"
#include "moench02CtbData.h" #include "moench02CtbData.h"
//#include "jungfrau10ModuleData.h" //#include "jungfrau10ModuleData.h"
#include "moenchCommonMode.h" #include "moenchCommonMode.h"
@ -43,6 +44,8 @@
#include "moench04CtbZmq10GbData.h" #include "moench04CtbZmq10GbData.h"
#include "deserializer.h" #include "deserializer.h"
#include "detectorData.h" #include "detectorData.h"
#include "imageZmq16bit.h"
using namespace std; using namespace std;
@ -232,7 +235,9 @@ hframe=new TGHorizontalFrame(this, 800,50);
cbDetType->AddEntry("MOENCH02", MOENCH02); cbDetType->AddEntry("MOENCH02", MOENCH02);
cbDetType->AddEntry("MOENCH04", MOENCH04); cbDetType->AddEntry("MOENCH04", MOENCH04);
// cbDetType->AddEntry("JUNGFRAU1.0", 2); // cbDetType->AddEntry("JUNGFRAU1.0", 2);
//cbDetType->AddEntry("MOENCH03 T", iiii++); cbDetType->AddEntry("MOENCH03",MOENCH03);
cbDetType->AddEntry("IMAGE16BIT",IMAGE16B);
//cbDetType->AddEntry("MOENCH03", iiii++); //cbDetType->AddEntry("MOENCH03", iiii++);
// cbDetType->AddEntry("MYTHEN3 0.1", MYTHEN301); // cbDetType->AddEntry("MYTHEN3 0.1", MYTHEN301);
// cbDetType->AddEntry("ADCSAR2", ADCSAR2); // 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); hframe=new TGHorizontalFrame(this, 800,50);
@ -290,8 +295,8 @@ hframe=new TGHorizontalFrame(this, 800,50);
TGNumberFormat::kNEANonNegative, TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELLimitMinMax,0,16535); TGNumberFormat::kNELLimitMinMax,0,16535);
hframe->AddFrame(eSerOff,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1)); hframe->AddFrame(eSerOff,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
eSerOff->MapWindow();; eSerOff->MapWindow();
eSerOff->SetNumber(5); eSerOff->SetNumber(0);
e= eSerOff->TGNumberEntry::GetNumberEntry(); e= eSerOff->TGNumberEntry::GetNumberEntry();
eSerOff->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeSerialOffset(Long_t)"); eSerOff->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeSerialOffset(Long_t)");
e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeSerialOffset()"); 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); hframe=new TGHorizontalFrame(this, 800,50);
@ -859,6 +911,11 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
nx=eNumCount->GetIntNumber(); nx=eNumCount->GetIntNumber();
dr=eDynRange->GetIntNumber(); dr=eDynRange->GetIntNumber();
soff=eSerOff->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; i=0;
@ -1200,6 +1257,9 @@ void ctbAcquisition::changeDetector(){
eNumCount->SetState(kFALSE); eNumCount->SetState(kFALSE);
eDynRange->SetState(kFALSE); eDynRange->SetState(kFALSE);
eSerOff->SetState(kFALSE); eSerOff->SetState(kFALSE);
ePixX->SetState(kFALSE);
ePixY->SetState(kFALSE);
deserializer=0; deserializer=0;
if (rb2D->IsOn() ) {//|| rbScan->IsOn() if (rb2D->IsOn() ) {//|| rbScan->IsOn()
switch (cbDetType->GetSelected()) { switch (cbDetType->GetSelected()) {
@ -1210,7 +1270,6 @@ void ctbAcquisition::changeDetector(){
// commonMode=new moench03CommonMode(); // commonMode=new moench03CommonMode();
break; break;
case MOENCH04: case MOENCH04:
try { try {
auto retval = myDet->getTenGiga().tsquash("Different values"); auto retval = myDet->getTenGiga().tsquash("Different values");
if (retval) { if (retval) {
@ -1223,6 +1282,36 @@ void ctbAcquisition::changeDetector(){
cout << "MOENCH 0.4!" << endl; cout << "MOENCH 0.4!" << endl;
commonMode=new moench03CommonMode(); commonMode=new moench03CommonMode();
break; 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: // case 1:
// cout << "************** T!!!!!!!!!!" << endl; // cout << "************** T!!!!!!!!!!" << endl;
@ -1511,13 +1600,13 @@ void ctbAcquisition::update() {
if (dataStructure) { if (dataStructure) {
cout << cbDetType->GetSelected()<< endl; cout << cbDetType->GetSelected()<< endl;
if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){ // if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
cout << "settings deserialiation parameters for MYTHEN" << endl; // cout << "settings deserialiation parameters for MYTHEN" << endl;
mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure; // mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
eSerOff->SetNumber( ms->setSerialOffset(-1)); // eSerOff->SetNumber( ms->setSerialOffset(-1));
eDynRange->SetNumber( ms->setDynamicRange(-1)); // eDynRange->SetNumber( ms->setDynamicRange(-1));
eNumCount->SetNumber( ms->setNumberOfCounters(-1)); // eNumCount->SetNumber( ms->setNumberOfCounters(-1));
} // }
} }
@ -1977,20 +2066,22 @@ void ctbAcquisition::ChangeNumberOfChannels(Long_t a){
void ctbAcquisition::ChangeSerialOffset(){ void ctbAcquisition::ChangeSerialOffset(){
changeDetector();
// if (dataStructure) { // if (dataStructure) {
// // cout << cbDetType->GetSelected()<< endl; // cout << cbDetType->GetSelected()<< endl;
// // if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302 ){ // if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302 ){
// // cout << "settings offsets for MYTHEN" << endl; // cout << "settings offsets for MYTHEN" << endl;
// // mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure; // mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
// // ms->setSerialOffset(eSerOff->GetIntNumber()); // ms->setSerialOffset(eSerOff->GetIntNumber());
// // } // }
// } // }
}; };
void ctbAcquisition::ChangeDynamicRange(){ void ctbAcquisition::ChangeDynamicRange(){
changeDetector();
// if (dataStructure) { // if (dataStructure) {
// cout << cbDetType->GetSelected()<< endl; // cout << cbDetType->GetSelected()<< endl;
@ -2004,6 +2095,7 @@ void ctbAcquisition::ChangeDynamicRange(){
}; };
void ctbAcquisition::ChangeNumberOfChannels(){ void ctbAcquisition::ChangeNumberOfChannels(){
changeDetector();
// if (dataStructure) { // if (dataStructure) {
// cout << cbDetType->GetSelected()<< endl; // cout << cbDetType->GetSelected()<< endl;
// if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){ // if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
@ -2017,6 +2109,24 @@ void ctbAcquisition::ChangeNumberOfChannels(){
changePlot(); 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){ void ctbAcquisition::ChangeHistoLimitsPedSub(Long_t a){

View File

@ -42,7 +42,7 @@ using namespace std;
class ctbAcquisition : public TGGroupFrame { class ctbAcquisition : public TGGroupFrame {
enum {DESERIALIZER, MOENCH04, MOENCH02, ADCSAR2, MYTHEN301, MYTHEN302}; enum {DESERIALIZER, MOENCH04, MOENCH02, MOENCH03, IMAGE16B, ADCSAR2, MYTHEN301, MYTHEN302};
private: private:
@ -57,6 +57,9 @@ class ctbAcquisition : public TGGroupFrame {
TGNumberEntry *eNumCount; TGNumberEntry *eNumCount;
TGNumberEntry *ePixX;
TGNumberEntry *ePixY;
TGNumberEntry *eFitADC; TGNumberEntry *eFitADC;
TGNumberEntry *eBitPlot; TGNumberEntry *eBitPlot;
TGNumberEntry *eMinRaw; TGNumberEntry *eMinRaw;
@ -231,7 +234,8 @@ class ctbAcquisition : public TGGroupFrame {
void ChangeNumberOfChannels(Long_t); void ChangeNumberOfChannels(Long_t);
void ChangeDynamicRange(); void ChangeDynamicRange();
void ChangeDynamicRange(Long_t); void ChangeDynamicRange(Long_t);
void ChangeImagePixels();
void ChangeImagePixels(Long_t);
void canvasClicked(); void canvasClicked();
void FitADC(); void FitADC();

View File

@ -1,6 +1,7 @@
#ifndef DESERIALIZER_H #ifndef DESERIALIZER_H
#define DESERIALIZER_H #define DESERIALIZER_H
#include <vector> #include <vector>
#include "slsDetectorData.h"
class deserializer : public slsDetectorData<int> { class deserializer : public slsDetectorData<int> {
@ -52,7 +53,13 @@ class deserializer : public slsDetectorData<int> {
static int* deserializeAll(char *ptr, std::vector <int> dbl, int dr=24, int nch=64*3, int off=5) { static int* deserializeAll(char *ptr, std::vector <int> dbl, int dr=24, int nch=64*3, int off=5) {
// off=0; // off=0;
//int iarg; //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* val=new int[nch];
int ioff=0; int ioff=0;
int idr=0; int idr=0;
@ -67,38 +74,61 @@ class deserializer : public slsDetectorData<int> {
} }
wp=(int64_t*)ptr; wp=(int64_t*)ptr;
for (iw=0; iw<nch/nb; iw) { int nw=nch/nb;
cout << "** Number of bits:\t" << nb << endl;
cout << "** Samples:\t" << nw << endl;
for (ib=0; ib<nb; ib++) {
cout << dbl[ib] << " " ;
}
cout << endl;
for (ib=0; ib<nch; ib++) {
val[ib]=0;
}
for (iw=0; iw<nw; iw) {
word=*wp;; word=*wp;;
if (ioff<off) { if (ioff<off) {
ioff++; ioff++;
// cout <<"*"; // cout <<"*";
} else { } else {
//if (idr<16) { //if (idr<16) {
ib=0; //ib=0;
for (const auto &bit : dbl) { // cout << hex << "*************" << word << endl;
ich=iw+nch/nb*(ib); for (ib=0; ib<nb; ib++) {
if (word&(1<<bit) && ich<nch) { // for (const auto &bit : dbl) {
ich=iw+nch*ib/nb;
/* if (ich>1060) */
/* cout << iw << " " << idr << " " << ib << " " << bit << " " << ich << " " << val[ich] << " ** " ; */
bit=dbl[ib];
ww=one<<bit;
if (word&(ww) && ich<nch) {
//cout << "+" ; //cout << "+" ;
val[ich]|=(1<<idr); val[ich]|=(1<<idr);
} //else { }
/* if (ich>1060) */
/* cout << val[ich] << " " << hex << word << " " << ww << " " << (word&(ww)) << dec <<endl; */
/* //else { */
//cout << "-" ; //cout << "-" ;
//} //}
ib++; //ib++;
} }
idr++;
} }
idr++;
if (idr==dr) { if (idr==dr) {
idr=0; idr=0;
// cout << dec << " " << iw << " " << val[iw] << " " << val[iw+nch/2] << endl; // cout << dec << " " << iw << " " << val[iw] << " " << val[iw+nch/2] << endl;
cout <<dec << iw<<endl; // cout <<dec << iw<<endl;
iw++; iw++;
}//end if() }//end if()
//end else() //end else()
wp+=1; wp+=1;
ii++; // ii++;
}//end for }//end for
@ -117,7 +147,7 @@ class deserializer : public slsDetectorData<int> {
int ii=0; int ii=0;
int ich; int ich;
int nb=dbl.size(); int nb=dbl.size();
int bit;
char *dval; char *dval;
idr=0; idr=0;
@ -128,7 +158,12 @@ class deserializer : public slsDetectorData<int> {
ib=0; ib=0;
ich=0; ich=0;
for (const auto &bit : dbl) { for (ib=0; ib<nb; ib++) {
// for (const auto &bit : dbl) {
/* if (ich>1060) */
/* cout << iw << " " << idr << " " << ib << " " << bit << " " << ich << " " << val[ich] << " ** " ; */
bit=dbl[ib];
//ioff=off; //ioff=off;
idr=0; idr=0;
for (iw=0; iw<(nch*dr/nb)/8; iw++) { for (iw=0; iw<(nch*dr/nb)/8; iw++) {
@ -141,7 +176,7 @@ class deserializer : public slsDetectorData<int> {
} }
} }
ii++; ii++;
ib++; // ib++;
}//end for }//end for

View File

@ -28,7 +28,8 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
\param c crosstalk parameter for the output buffer \param c crosstalk parameter for the output buffer
*/ */
moench03T1ZmqDataNew(int ns=5000): slsDetectorData<uint16_t>(400, 400, ns*32*2+sizeof(int)), nSamples(ns), offset(sizeof(int)), xtalk(0.00021) { // moench03T1ZmqDataNew(int ns=5000): slsDetectorData<uint16_t>(400, 400, ns*32*2+sizeof(int)), nSamples(ns), offset(sizeof(int)), xtalk(0.00021) {
moench03T1ZmqDataNew(int ns=5000): slsDetectorData<uint16_t>(400, 400, ns*32*2+sizeof(int)), nSamples(ns), offset(0), xtalk(0.00021) {
int nadc=32; int nadc=32;
int sc_width=25; int sc_width=25;
@ -137,6 +138,7 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
/* vout+=0.0008*val-6224; */ /* vout+=0.0008*val-6224; */
/* return vout; //(double)getChannel(data, ix, iy); /* return vout; //(double)getChannel(data, ix, iy);
*/ */
// cout << ix << " "<< iy << " " << dataMap[iy][ix] << endl;
return ((double)getChannel(data, ix, iy))+xtalk*getGhost(iy,iy); return ((double)getChannel(data, ix, iy))+xtalk*getGhost(iy,iy);
}; };

View File

@ -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 LDFLAG= -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -O3 -g -std=c++11 -Wall
#-L../../bin -lhdf5 -L. #-L../../bin -lhdf5 -L.

View File

@ -293,7 +293,8 @@ int main(int argc, char *argv[]) {
uint8_t detType = 0; uint8_t detType = 0;
uint8_t version = 0; uint8_t version = 0;
// int* flippedData = 0; // int* flippedData = 0;
char* additionalJsonHeader = 0; string* additionalJsonHeader = 0;
//char* additionalJsonHeader = 0;
int32_t threshold=0; int32_t threshold=0;