mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-05 17:40:40 +02:00
Added deserializer and moench04 map to ctbGui
This commit is contained in:
parent
c90a7b0e8a
commit
4a112d7889
@ -38,6 +38,8 @@
|
||||
#include "Mythen3_01_jctbData.h"
|
||||
#include "Mythen3_02_jctbData.h"
|
||||
#include "adcSar2_jctbData.h"
|
||||
#include "moench04CtbReceiverData.h"
|
||||
#include "deserializer.h"
|
||||
#include "detectorData.h"
|
||||
|
||||
using namespace std;
|
||||
@ -45,7 +47,7 @@ using namespace std;
|
||||
|
||||
|
||||
|
||||
ctbAcquisition::ctbAcquisition(TGVerticalFrame *page, multiSlsDetector *det) : TGGroupFrame(page,"Acquisition",kVerticalFrame), myDet(det), myCanvas(NULL), globalPlot(0), nAnalogSamples(1), nDigitalSamples(1), dataStructure(NULL), photonFinder(NULL), cmSub(0), dBitMask(0xffffffffffffffff) {
|
||||
ctbAcquisition::ctbAcquisition(TGVerticalFrame *page, multiSlsDetector *det) : TGGroupFrame(page,"Acquisition",kVerticalFrame), myDet(det), myCanvas(NULL), globalPlot(0), nAnalogSamples(1), nDigitalSamples(1), dataStructure(NULL), photonFinder(NULL), cmSub(0), dBitMask(0xffffffffffffffff), deserializer(0) {
|
||||
|
||||
adcFit=NULL;
|
||||
bitPlot=NULL;
|
||||
@ -216,15 +218,16 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
// rbScan=new TGRadioButton(hframe, "Scan");
|
||||
|
||||
cbDetType=new TGComboBox(hframe);
|
||||
// enum {MOENCH03, MOENCH02, ADCSAR2, MYTHEN301, MYTHEN302, MAXDET};
|
||||
cbDetType->AddEntry("MOENCH03", MOENCH03);
|
||||
// enum {DESERIALIZER, MOENCH04, MOENCH02, ADCSAR2, MYTHEN301, MYTHEN302, MAXDET};
|
||||
cbDetType->AddEntry("Deserializer", DESERIALIZER);
|
||||
cbDetType->AddEntry("MOENCH02", MOENCH02);
|
||||
cbDetType->AddEntry("MOENCH04", MOENCH04);
|
||||
// cbDetType->AddEntry("JUNGFRAU1.0", 2);
|
||||
//cbDetType->AddEntry("MOENCH03 T", iiii++);
|
||||
//cbDetType->AddEntry("MOENCH03", iiii++);
|
||||
cbDetType->AddEntry("MYTHEN3 0.1", MYTHEN301);
|
||||
cbDetType->AddEntry("ADCSAR2", ADCSAR2);
|
||||
cbDetType->AddEntry("MYTHEN3 0.2", MYTHEN302);
|
||||
// cbDetType->AddEntry("MYTHEN3 0.1", MYTHEN301);
|
||||
// cbDetType->AddEntry("ADCSAR2", ADCSAR2);
|
||||
// cbDetType->AddEntry("MYTHEN3 0.2", MYTHEN302);
|
||||
|
||||
cbDetType->SetHeight(20);
|
||||
cbDetType->Select(0);
|
||||
@ -849,13 +852,19 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
double ped=0;
|
||||
int vv1,vv2;
|
||||
int dsize=-1;
|
||||
short unsigned int **val=NULL;
|
||||
int *val=NULL;
|
||||
int nx=1, ny=1, jj;
|
||||
short unsigned int *va;
|
||||
if (dataStructure) {
|
||||
dataStructure->getDetectorSize(nx,ny);
|
||||
cout << "Data structure: " << dataStructure << " size " << nx << " " << ny << endl;
|
||||
}
|
||||
int dr=24, soff=2;
|
||||
if (deserializer) {
|
||||
nx=eNumCount->GetIntNumber();
|
||||
dr=eDynRange->GetIntNumber();
|
||||
soff=eSerOff->GetIntNumber();
|
||||
}
|
||||
|
||||
i=0;
|
||||
int nadc;
|
||||
@ -871,9 +880,15 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
else
|
||||
nadc=adclist.size();
|
||||
|
||||
std::vector <int> plotlist;
|
||||
if (dbitlist.empty()) {
|
||||
ndbit=64;
|
||||
dBitOffset=0;
|
||||
for (ib=0; ib<64; ib++){
|
||||
if (bitPlotFlag[ib]) {
|
||||
plotlist.push_back(ib);
|
||||
}
|
||||
}
|
||||
} else
|
||||
ndbit=dbitlist.size();
|
||||
|
||||
@ -965,21 +980,24 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
|
||||
|
||||
|
||||
if (dataStructure) {
|
||||
|
||||
val=dataStructure->getData(d_data);
|
||||
if (deserializer) {
|
||||
if (dbitlist.empty())
|
||||
val=deserializer::deserializeAll(d_data,plotlist,dr,nx,soff);//dataStructure->getData(d_data);
|
||||
else
|
||||
val=deserializer::deserializeList(d_data,dbitlist,dr,nx,soff);//dataStructure->getData(d_data);
|
||||
|
||||
|
||||
if (val) {
|
||||
if (h2DMap) {
|
||||
for (x=0; x<nx; x++) {
|
||||
for (y=0; y<ny; y++) {
|
||||
h2DMap->SetBinContent(x+1,y+1,val[y][x]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (h2DMap) {
|
||||
// for (x=0; x<nx; x++) {
|
||||
// for (y=0; y<ny; y++) {
|
||||
// h2DMap->SetBinContent(x+1,y+1,val[y][x]);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if (h1DMap){
|
||||
for (x=0; x<nx; x++) {
|
||||
h1DMap->SetBinContent(x+1,val[0][x]);
|
||||
h1DMap->SetBinContent(x+1,val[x]);
|
||||
// cout << dec << x << " " << val[0][x] << endl;
|
||||
}
|
||||
}
|
||||
@ -993,9 +1011,7 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
// } else
|
||||
// cout << "No scan (digital)" << endl;
|
||||
|
||||
for (y=0; y<ny; y++) {
|
||||
delete [] val[y];
|
||||
}
|
||||
|
||||
delete [] val;
|
||||
} else
|
||||
cout << "get val did not succeed"<<endl;
|
||||
@ -1166,13 +1182,21 @@ void ctbAcquisition::changeDetector(){
|
||||
eNumCount->SetState(kFALSE);
|
||||
eDynRange->SetState(kFALSE);
|
||||
eSerOff->SetState(kFALSE);
|
||||
deserializer=0;
|
||||
if (rb2D->IsOn() ) {//|| rbScan->IsOn()
|
||||
switch (cbDetType->GetSelected()) {
|
||||
case MOENCH03:
|
||||
cout << "MOENCH 0.3 T1!" << endl;
|
||||
dataStructure=new moench03T1CtbData();
|
||||
commonMode=new moench03CommonMode();
|
||||
case DESERIALIZER:
|
||||
deserializer=1;
|
||||
// cout << "DESERIALIZER!" << endl;
|
||||
// dataStructure=new moench03T1CtbData();
|
||||
// commonMode=new moench03CommonMode();
|
||||
break;
|
||||
case MOENCH04:
|
||||
dataStructure=new moench04CtbReceiverData();
|
||||
cout << "MOENCH 0.4!" << endl;
|
||||
commonMode=new moench03CommonMode();
|
||||
break;
|
||||
|
||||
// case 1:
|
||||
// cout << "************** T!!!!!!!!!!" << endl;
|
||||
// dataStructure=new moench03TCtbData();
|
||||
@ -1192,34 +1216,37 @@ void ctbAcquisition::changeDetector(){
|
||||
// dataStructure=new moench03CtbData();
|
||||
// commonMode=new moench03CommonMode();
|
||||
// break;
|
||||
case MYTHEN301:
|
||||
cout << "MYTHEN 3 0.1" << endl;
|
||||
dataStructure=new mythen3_01_jctbData(eNumCount->GetIntNumber(),eDynRange->GetIntNumber(),eSerOff->GetIntNumber());
|
||||
//( int nch=64*3,int dr=24, int off=5)
|
||||
eNumCount->SetState(kTRUE);
|
||||
eDynRange->SetState(kTRUE);
|
||||
eSerOff->SetState(kTRUE);
|
||||
commonMode=NULL;
|
||||
dim=1;
|
||||
break;
|
||||
case ADCSAR2:
|
||||
//adcsar2
|
||||
dataStructure=new adcSar2_jctbData();
|
||||
//need to use configurable number of counters, offset or dynamic range?
|
||||
commonMode=NULL;
|
||||
dim=1;
|
||||
break;
|
||||
// case MYTHEN301:
|
||||
// deserializer=1;
|
||||
// cout << "MYTHEN 3 0.1" << endl;
|
||||
// dataStructure=new mythen3_01_jctbData(eNumCount->GetIntNumber(),eDynRange->GetIntNumber(),eSerOff->GetIntNumber());
|
||||
// //( int nch=64*3,int dr=24, int off=5)
|
||||
// eNumCount->SetState(kTRUE);
|
||||
// eDynRange->SetState(kTRUE);
|
||||
// eSerOff->SetState(kTRUE);
|
||||
// commonMode=NULL;
|
||||
// dim=1;
|
||||
// break;
|
||||
// case ADCSAR2:
|
||||
// deserializer=1;
|
||||
// //adcsar2
|
||||
// dataStructure=new adcSar2_jctbData();
|
||||
// //need to use configurable number of counters, offset or dynamic range?
|
||||
// commonMode=NULL;
|
||||
// dim=1;
|
||||
// break;
|
||||
|
||||
case MYTHEN302:
|
||||
cout << "MYTHEN 3 0.2" << endl;
|
||||
dataStructure=new mythen3_02_jctbData(eNumCount->GetIntNumber(),eDynRange->GetIntNumber(),eSerOff->GetIntNumber());
|
||||
//( int nch=64*3,int dr=24, int off=5)
|
||||
eNumCount->SetState(kTRUE);
|
||||
eDynRange->SetState(kTRUE);
|
||||
eSerOff->SetState(kTRUE);
|
||||
commonMode=NULL;
|
||||
dim=1;
|
||||
break;
|
||||
// case MYTHEN302:
|
||||
// deserializer=1;
|
||||
// cout << "MYTHEN 3 0.2" << endl;
|
||||
// dataStructure=new mythen3_02_jctbData(eNumCount->GetIntNumber(),eDynRange->GetIntNumber(),eSerOff->GetIntNumber());
|
||||
// //( int nch=64*3,int dr=24, int off=5)
|
||||
// eNumCount->SetState(kTRUE);
|
||||
// eDynRange->SetState(kTRUE);
|
||||
// eSerOff->SetState(kTRUE);
|
||||
// commonMode=NULL;
|
||||
// dim=1;
|
||||
// break;
|
||||
default:
|
||||
dataStructure=NULL;
|
||||
commonMode=NULL;
|
||||
@ -1227,10 +1254,16 @@ void ctbAcquisition::changeDetector(){
|
||||
if (cbCommonMode->IsOn()) cm=commonMode;
|
||||
}
|
||||
|
||||
if (dataStructure) {
|
||||
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 (dataStructure || deserializer) {
|
||||
if (dataStructure) {
|
||||
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;
|
||||
nx=eNumCount->GetIntNumber();
|
||||
}
|
||||
// cout << "h size is " << nx << " " << ny << endl;
|
||||
int ymax=ny, xmax=nx;
|
||||
// if (ny>500) {ny=ny/2;}
|
||||
|
@ -27,6 +27,7 @@ class multiSlsDetector;
|
||||
class detectorData;
|
||||
|
||||
template <class dataType> class slsDetectorData;
|
||||
|
||||
class singlePhotonDetector;
|
||||
//class singlePhotonDetector;
|
||||
class commonModeSubtraction;
|
||||
@ -38,7 +39,7 @@ using namespace std;
|
||||
class ctbAcquisition : public TGGroupFrame {
|
||||
|
||||
|
||||
enum {MOENCH03, MOENCH02, ADCSAR2, MYTHEN301, MYTHEN302};
|
||||
enum {DESERIALIZER, MOENCH04, MOENCH02, ADCSAR2, MYTHEN301, MYTHEN302};
|
||||
|
||||
|
||||
private:
|
||||
@ -161,7 +162,7 @@ class ctbAcquisition : public TGGroupFrame {
|
||||
|
||||
uint64_t dBitMask;
|
||||
|
||||
|
||||
int deserializer;
|
||||
|
||||
public:
|
||||
ctbAcquisition(TGVerticalFrame*, multiSlsDetector*);
|
||||
|
171
slsDetectorCalibration/dataStructures/deserializer.h
Normal file
171
slsDetectorCalibration/dataStructures/deserializer.h
Normal file
@ -0,0 +1,171 @@
|
||||
#ifndef DESERIALIZER_H
|
||||
#define DESERIALIZER_H
|
||||
#include <vector>
|
||||
|
||||
class deserializer : public slsDetectorData<int> {
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
deserializer( std::vector <int> dbl, int nch=64*3,int dr=24, int off=2): slsDetectorData<int>(nch,1,nch*dr*8+off*8,NULL,NULL,NULL), dbitlist(dbl), dynamicRange(dr), serialOffset(off), frameNumber(0), numberOfCounters(nch) {};
|
||||
|
||||
deserializer( std::vector <int> dbl, int nch,int dr, int off, int ds): slsDetectorData<int>(nch,1,ds,NULL,NULL,NULL), dbitlist(dbl), dynamicRange(dr), serialOffset(off), frameNumber(0), numberOfCounters(nch) {};
|
||||
|
||||
virtual void getPixel(int ip, int &x, int &y) {x=-1; y=-1;};
|
||||
|
||||
virtual int getChannel(char *data, int ix, int iy=0) {
|
||||
int ret=-1;
|
||||
if (ix>=0 && ix<numberOfCounters) {
|
||||
int *val=deserializeAll(data,dbitlist,dynamicRange,numberOfCounters,serialOffset);
|
||||
ret=val[ix];
|
||||
delete [] val;
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
virtual int getFrameNumber(char *buff) {return frameNumber;};
|
||||
|
||||
virtual char *findNextFrame(char *data, int &ndata, int dsize) {
|
||||
ndata=dsize;
|
||||
return data;
|
||||
}
|
||||
|
||||
virtual char *readNextFrame(ifstream &filebin) {
|
||||
char *data=NULL;
|
||||
if (filebin.is_open()) {
|
||||
data=new char[dataSize];
|
||||
filebin.read(data,dataSize);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
virtual int **getData(char *ptr, int dsize=-1) {
|
||||
int **val;
|
||||
val=new int*[1];
|
||||
val[0]=deserializeAll(ptr,dbitlist,dynamicRange,nx,serialOffset);
|
||||
return val;
|
||||
|
||||
}
|
||||
|
||||
|
||||
static int* deserializeAll(char *ptr, std::vector <int> dbl, int dr=24, int nch=64*3, int off=5) {
|
||||
// off=0;
|
||||
int iarg;
|
||||
int64_t word, *wp;
|
||||
int* val=new int[nch];
|
||||
int ioff=0;
|
||||
int idr=0;
|
||||
int ib=0;
|
||||
int iw=0;
|
||||
int ii=0;
|
||||
int ich;
|
||||
int nb=dbl.size();
|
||||
idr=0;
|
||||
for (ib=0; ib<nch; ib++) {
|
||||
val[ib]=0;
|
||||
}
|
||||
wp=(int64_t*)ptr;
|
||||
|
||||
for (iw=0; iw<nch*dr/nb; iw) {
|
||||
word=*wp;;
|
||||
if (ioff<off) {
|
||||
ioff++;
|
||||
cout <<"*";
|
||||
} else {
|
||||
//if (idr<16) {
|
||||
ib=0;
|
||||
for (const auto &bit : dbl) {
|
||||
ich=iw+nch/nb*(ib);
|
||||
if (word&(1<<bit) && ich<nch) {
|
||||
//cout << "+" ;
|
||||
val[ich]|=(1<<idr);
|
||||
} //else {
|
||||
//cout << "-" ;
|
||||
//}
|
||||
ib++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
idr++;
|
||||
if (idr==dr) {
|
||||
idr=0;
|
||||
// cout << dec << " " << iw << " " << val[iw] << " " << val[iw+nch/2] << endl;
|
||||
cout <<dec << iw<<endl;
|
||||
iw++;
|
||||
}//end if()
|
||||
|
||||
//end else()
|
||||
wp+=1;
|
||||
ii++;
|
||||
}//end for
|
||||
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
static int* deserializeList(char *ptr, std::vector <int> dbl, int dr=24, int nch=64*3, int off=5) {
|
||||
// off=0;
|
||||
int iarg;
|
||||
int64_t word;
|
||||
int* val=new int[nch];
|
||||
int ioff=0;
|
||||
int idr=0;
|
||||
int ib=0;
|
||||
int iw=0;
|
||||
int ii=0;
|
||||
int ich;
|
||||
int nb=dbl.size();
|
||||
|
||||
char *dval;
|
||||
|
||||
idr=0;
|
||||
for (ib=0; ib<nch; ib++) {
|
||||
val[ib]=0;
|
||||
}
|
||||
dval=ptr;
|
||||
|
||||
ib=0;
|
||||
ich=0;
|
||||
for (const auto &bit : dbl) {
|
||||
ioff=off;
|
||||
idr=0;
|
||||
for (iw=0; iw<(nch*dr/nb)/8; iw++) {
|
||||
val[ich]|=(*dval)<<idr;
|
||||
idr+=8;
|
||||
dval++;
|
||||
if (idr>=dr) {
|
||||
idr=0;
|
||||
ich++;
|
||||
}
|
||||
}
|
||||
ii++;
|
||||
ib++;
|
||||
}//end for
|
||||
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
virtual int setFrameNumber(int f=0) {if (f>=0) frameNumber=f; return frameNumber; };
|
||||
virtual int setDynamicRange(int d=-1) {if (d>0 && d<=24) dynamicRange=d; return dynamicRange;};
|
||||
virtual int setSerialOffset(int d=-1) {if (d>=0) serialOffset=d; return serialOffset;};
|
||||
virtual int setNumberOfCounters(int d=-1) {if (d>=0) numberOfCounters=d; return numberOfCounters;};
|
||||
virtual std::vector <int> setDBitList(std::vector <int> dbl) {dbitlist=dbl; return dbitlist;};
|
||||
virtual std::vector <int> getDBitList() {return dbitlist;};
|
||||
|
||||
|
||||
private:
|
||||
|
||||
int dynamicRange;
|
||||
int serialOffset;
|
||||
int frameNumber;
|
||||
int numberOfCounters;
|
||||
std::vector <int> dbitlist;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -40,7 +40,7 @@
|
||||
|
||||
|
||||
|
||||
class moench04ReceiverData : public slsDetectorData<uint16_t> {
|
||||
class moench04CtbReceiverData : public slsDetectorData<uint16_t> {
|
||||
|
||||
private:
|
||||
|
||||
@ -63,7 +63,7 @@ class moench04ReceiverData : public slsDetectorData<uint16_t> {
|
||||
\param c crosstalk parameter for the output buffer
|
||||
|
||||
*/
|
||||
moench04ReceiverData(int nas=5000, int nds=0): slsDetectorData<uint16_t>(400, 400, nas*2*32+sizeof(sls_detector_header)+nds*8), aSamples(nas), dSamples(nds) {
|
||||
moench04CtbReceiverData(int nas=5000, int nds=0): slsDetectorData<uint16_t>(400, 400, nas*2*32+sizeof(sls_detector_header)+nds*8), aSamples(nas), dSamples(nds) {
|
||||
|
||||
int nadc=32;
|
||||
int sc_width=25;
|
||||
@ -97,7 +97,7 @@ class moench04ReceiverData : public slsDetectorData<uint16_t> {
|
||||
row=200+i/sc_width;
|
||||
}
|
||||
dataMap[row][col]=sizeof(sls_detector_header)+(nadc*i+iadc)*2;//+16*(ip+1);
|
||||
if (dataMap[row][col]<0 || dataMap[row][col]>=nSamples*2*32)
|
||||
if (dataMap[row][col]<0 || dataMap[row][col]>=aSamples*2*32)
|
||||
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ if [ "x${BASH_ARGV[0]}" = "x" ]; then
|
||||
#if [ "x$f" = "x" ]; then
|
||||
if [ ! -f this_build_bin_path.sh ]; then
|
||||
f=$0
|
||||
echo "aaaa"
|
||||
#thispath=$(dirname ${BASH_ARGV[0]})
|
||||
thispath=$(dirname $f)
|
||||
p=$(cd ${thispath};pwd);
|
||||
@ -16,15 +17,19 @@ if [ "x${BASH_ARGV[0]}" = "x" ]; then
|
||||
# echo "ERROR: must cd where/this/package/is before calling this_path.sh"
|
||||
# echo "Try sourcing it"
|
||||
else
|
||||
echo "bbb"
|
||||
THIS_PATH="$PWD/build/bin/";
|
||||
fi
|
||||
else
|
||||
#thispath=$(dirname ${BASH_ARGV[0]})
|
||||
thispath=${BASH_ARGV[0]}
|
||||
#thispath=$(dirname $f)
|
||||
THIS_PATH=$(cd ${thispath};pwd);
|
||||
else
|
||||
thispath=$(dirname ${BASH_ARGV[0]})
|
||||
p=$(cd ${thispath};pwd);
|
||||
THIS_PATH="$p/build/bin/"
|
||||
echo "ccc"
|
||||
fi
|
||||
|
||||
echo $THIS_PATH
|
||||
echo "this_path="$THIS_PATH
|
||||
export PATH=$THIS_PATH:$PATH
|
||||
export LD_LIBRARY_PATH=$THIS_PATH:$LD_LIBRARY_PATH
|
||||
|
||||
echo "path="$PATH
|
||||
echo "ld_library_path="$LD_LIBRARY_PATH
|
||||
|
Loading…
x
Reference in New Issue
Block a user