mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-17 07:17:13 +02:00
Added defines to invert the data for HIGHZ in the moench data structures
This commit is contained in:
@ -52,7 +52,6 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
||||
int sc_height;
|
||||
const int nSamples;
|
||||
|
||||
double ghost[200][25];
|
||||
|
||||
public:
|
||||
|
||||
@ -65,7 +64,7 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
||||
\param c crosstalk parameter for the output buffer
|
||||
|
||||
*/
|
||||
moench03T1ReceiverDataNew(int ns=5000): slsDetectorData<uint16_t>(400, 400, ns*2*32+sizeof(sls_detector_header)), nSamples(ns) {
|
||||
moench03T1ReceiverDataNew(int ns=5000): slsDetectorData<uint16_t>(400, 400, ns*2*32+sizeof(sls_detector_header)), nSamples(ns) {
|
||||
|
||||
int nadc=32;
|
||||
int sc_width=25;
|
||||
@ -100,9 +99,9 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
||||
} else {
|
||||
row=200+i/sc_width;
|
||||
}
|
||||
dataMap[row][col]=sizeof(sls_detector_header)+(nadc*i+iadc)*2;//+16*(ip+1);
|
||||
dataMap[row][col]=sizeof(sls_detector_header)+(nadc*i+iadc)*2;//+16*(ip+1);
|
||||
#ifdef HIGHZ
|
||||
dataMask[row][col]=0x3fff; //invert data
|
||||
dataMask[row][col]=0x3fff;
|
||||
#endif
|
||||
if (dataMap[row][col]<0 || dataMap[row][col]>=nSamples*2*32)
|
||||
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
|
||||
@ -110,11 +109,6 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
||||
}
|
||||
}
|
||||
}
|
||||
// double ghost[200][25];
|
||||
|
||||
for (int ix=0; ix<25; ix++)
|
||||
for (int iy=0; iy<200; iy++)
|
||||
ghost[iy][ix]=0.;
|
||||
|
||||
int ipacket;
|
||||
int ibyte;
|
||||
@ -151,73 +145,6 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Returns the value of the selected channel for the given dataset as double.
|
||||
\param data pointer to the dataset (including headers etc)
|
||||
\param ix pixel number in the x direction
|
||||
\param iy pixel number in the y direction
|
||||
\returns data for the selected channel, with inversion if required as double
|
||||
|
||||
*/
|
||||
virtual double getValue(char *data, int ix, int iy=0) {
|
||||
/* cout << " x "<< ix << " y"<< iy << " val " << getChannel(data, ix, iy)<< endl;*/
|
||||
/* double val=0, vout=getChannel(data, ix, iy); */
|
||||
/* int x1=ix%25; */
|
||||
/* for (int ix=0; ix<16; ix++) { */
|
||||
/* for (int ii=0; ii<2; ii++) { */
|
||||
/* val+=getChannel(data,x1+25*ix,iy); */
|
||||
/* val+=getChannel(data,x1+25*ix,399-iy); */
|
||||
/* } */
|
||||
/* } */
|
||||
/* vout+=0.0008*val-6224; */
|
||||
/* return vout; //(double)getChannel(data, ix, iy);
|
||||
*/
|
||||
uint16_t val=getChannel(data, ix, iy)&0x3fff;
|
||||
return val;
|
||||
};
|
||||
|
||||
|
||||
|
||||
virtual void calcGhost(char *data, int ix, int iy) {
|
||||
double val=0;
|
||||
/* for (int ix=0; ix<25; ix++){ */
|
||||
/* for (int iy=0; iy<200; iy++) { */
|
||||
val=0;
|
||||
// cout << "** ";
|
||||
for (int isc=0; isc<16; isc++) {
|
||||
// for (int ii=0; ii<2; ii++) {
|
||||
val+=getChannel(data,ix+25*isc,iy);
|
||||
// cout << "(" << isc << "," << val << " " ;
|
||||
val+=getChannel(data,ix+25*isc,399-iy);
|
||||
// cout << val << " " ;
|
||||
// }
|
||||
}
|
||||
ghost[iy][ix]=val;//-6224;
|
||||
// cout << " --"<< endl;
|
||||
/* } */
|
||||
/* } */
|
||||
// cout << "*" << endl;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
virtual void calcGhost(char *data) {
|
||||
for (int ix=0; ix<25; ix++){
|
||||
for (int iy=0; iy<200; iy++) {
|
||||
calcGhost(data, ix,iy);
|
||||
}
|
||||
}
|
||||
// cout << "*" << endl;
|
||||
}
|
||||
|
||||
|
||||
double getGhost(int ix, int iy) {
|
||||
if (iy<200) return ghost[iy][ix%25];
|
||||
if (iy<400) return ghost[399-iy][ix%25];
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -354,6 +281,8 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
||||
|
||||
};
|
||||
|
@ -14,9 +14,6 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
|
||||
const int nSamples;
|
||||
const int offset;
|
||||
|
||||
double ghost[200][25];
|
||||
double xtalk;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@ -28,7 +25,7 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
|
||||
\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)) {
|
||||
|
||||
int nadc=32;
|
||||
int sc_width=25;
|
||||
@ -64,6 +61,9 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
|
||||
row=200+i/sc_width;
|
||||
}
|
||||
dataMap[row][col]=(nadc*i+iadc)*2+offset;//+16*(ip+1);
|
||||
#ifdef HIGHZ
|
||||
dataMask[row][col]=0x3fff;
|
||||
#endif
|
||||
if (dataMap[row][col]<0 || dataMap[row][col]>=dataSize)
|
||||
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
|
||||
}
|
||||
@ -103,84 +103,12 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
|
||||
|
||||
|
||||
|
||||
for (int ix=0; ix<25; ix++)
|
||||
for (int iy=0; iy<200; iy++)
|
||||
ghost[iy][ix]=0.;
|
||||
|
||||
|
||||
// iframe=0;
|
||||
// cout << "data struct created" << endl;
|
||||
};
|
||||
|
||||
|
||||
double getXTalk(){return xtalk;};
|
||||
void setXTalk(double g) {xtalk=g;};
|
||||
|
||||
/**
|
||||
Returns the value of the selected channel for the given dataset as double.
|
||||
\param data pointer to the dataset (including headers etc)
|
||||
\param ix pixel number in the x direction
|
||||
\param iy pixel number in the y direction
|
||||
\returns data for the selected channel, with inversion if required as double
|
||||
|
||||
*/
|
||||
virtual double getValue(char *data, int ix, int iy=0) {
|
||||
/* cout << " x "<< ix << " y"<< iy << " val " << getChannel(data, ix, iy)<< endl;*/
|
||||
/* double val=0, vout=getChannel(data, ix, iy); */
|
||||
/* int x1=ix%25; */
|
||||
/* for (int ix=0; ix<16; ix++) { */
|
||||
/* for (int ii=0; ii<2; ii++) { */
|
||||
/* val+=getChannel(data,x1+25*ix,iy); */
|
||||
/* val+=getChannel(data,x1+25*ix,399-iy); */
|
||||
/* } */
|
||||
/* } */
|
||||
/* vout+=0.0008*val-6224; */
|
||||
/* return vout; //(double)getChannel(data, ix, iy);
|
||||
*/
|
||||
return ((double)getChannel(data, ix, iy))+xtalk*getGhost(iy,iy);
|
||||
};
|
||||
|
||||
|
||||
|
||||
virtual void calcGhost(char *data, int ix, int iy) {
|
||||
double val=0;
|
||||
/* for (int ix=0; ix<25; ix++){ */
|
||||
/* for (int iy=0; iy<200; iy++) { */
|
||||
val=0;
|
||||
for (int isc=0; isc<16; isc++) {
|
||||
for (int ii=0; ii<2; ii++) {
|
||||
val+=getChannel(data,ix+25*isc,iy);
|
||||
// cout << val << " " ;
|
||||
val+=getChannel(data,ix+25*isc,399-iy);
|
||||
// cout << val << " " ;
|
||||
}
|
||||
}
|
||||
ghost[iy][ix]=val;//-6224;
|
||||
// cout << endl;
|
||||
/* } */
|
||||
/* } */
|
||||
// cout << "*" << endl;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
virtual void calcGhost(char *data) {
|
||||
for (int ix=0; ix<25; ix++){
|
||||
for (int iy=0; iy<200; iy++) {
|
||||
calcGhost(data, ix,iy);
|
||||
}
|
||||
}
|
||||
// cout << "*" << endl;
|
||||
}
|
||||
|
||||
|
||||
double getGhost(int ix, int iy) {
|
||||
if (iy<200) return ghost[iy][ix%25];
|
||||
if (iy<400) return ghost[399-iy][ix%25];
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -276,15 +204,15 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
|
||||
|
||||
|
||||
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
|
||||
//char *retval=0;
|
||||
// int nd;
|
||||
//int fnum = -1;
|
||||
char *retval=0;
|
||||
int nd;
|
||||
int fnum = -1;
|
||||
np=0;
|
||||
// int pn;
|
||||
int pn;
|
||||
|
||||
|
||||
// if (ff>=0)
|
||||
// fnum=ff;
|
||||
if (ff>=0)
|
||||
fnum=ff;
|
||||
|
||||
if (filebin.is_open()) {
|
||||
if (filebin.read(data, 32*2*nSamples) ){
|
||||
|
@ -5,12 +5,18 @@ LDFLAG= -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -O3
|
||||
|
||||
#DESTDIR?=../bin
|
||||
|
||||
all: moenchZmqProcess
|
||||
all: moenchZmqProcess moenchZmqProcessHighZ
|
||||
|
||||
moenchZmqProcess: moenchZmqProcess.cpp clean
|
||||
g++ -o moenchZmqProcess moenchZmqProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWZMQ -DINTERP
|
||||
|
||||
moenchZmqProcessHighZ: moenchZmqProcess.cpp clean
|
||||
g++ -o moenchZmqProcessHighZ moenchZmqProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWZMQ -DINTERP -DHIGHZ
|
||||
|
||||
|
||||
|
||||
clean:
|
||||
rm -f moenchZmqProcess
|
||||
rm -f moenchZmqProcess moenchZmqProcessHighZ
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user