Added defines to invert the data for HIGHZ in the moench data structures

This commit is contained in:
2019-09-26 12:22:23 +02:00
parent d0c5c2a6e5
commit db2742495a
3 changed files with 23 additions and 160 deletions

View File

@ -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;};
};