mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 06:50:02 +02:00
fixed bug of pointing to wrong missing packet header fo 10g and 1g32 bit
This commit is contained in:
parent
cb3f8b05a6
commit
2e894f33ce
@ -22,6 +22,9 @@ public:
|
|||||||
eigerHalfModuleData(int dr, int np, int bsize, int dsize, bool top, double c=0): slsReceiverData<uint32_t>(xpixels, ypixels, np, bsize),
|
eigerHalfModuleData(int dr, int np, int bsize, int dsize, bool top, double c=0): slsReceiverData<uint32_t>(xpixels, ypixels, np, bsize),
|
||||||
xtalk(c), bufferSize(bsize), actualDataSize(dsize), dynamicRange(dr), numberOfPackets(np), top(top),header_t(0), footer_t(0){
|
xtalk(c), bufferSize(bsize), actualDataSize(dsize), dynamicRange(dr), numberOfPackets(np), top(top),header_t(0), footer_t(0){
|
||||||
|
|
||||||
|
tenGiga = false;
|
||||||
|
if(actualDataSize == TEN_GIGA_PACKET_SIZE)
|
||||||
|
tenGiga = true;
|
||||||
|
|
||||||
int **dMap;
|
int **dMap;
|
||||||
uint32_t **dMask;
|
uint32_t **dMask;
|
||||||
@ -203,7 +206,6 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Returns the frame number for the given dataset.
|
/** Returns the frame number for the given dataset.
|
||||||
\param buff pointer to the dataset
|
\param buff pointer to the dataset
|
||||||
\returns frame number
|
\returns frame number
|
||||||
@ -217,8 +219,6 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** gets the packets number
|
/** gets the packets number
|
||||||
\param buff pointer to the memory
|
\param buff pointer to the memory
|
||||||
\returns packet number
|
\returns packet number
|
||||||
@ -241,9 +241,9 @@ public:
|
|||||||
double getValue(char *data, int ix, int iy=0) {
|
double getValue(char *data, int ix, int iy=0) {
|
||||||
// cout << "##" << (void*)data << " " << ix << " " <<iy << endl;
|
// cout << "##" << (void*)data << " " << ix << " " <<iy << endl;
|
||||||
if (xtalk==0)
|
if (xtalk==0)
|
||||||
return getChannel(data, ix, iy, dynamicRange);
|
return getChannelwithMissingPackets(data, ix, iy);
|
||||||
else
|
else
|
||||||
return getChannel(data, ix, iy,dynamicRange)-xtalk * getChannel(data, ix-1, iy,dynamicRange);
|
return getChannelwithMissingPackets(data, ix, iy)-xtalk * getChannelwithMissingPackets(data, ix-1, iy);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -253,12 +253,11 @@ public:
|
|||||||
\param data pointer to the dataset (including headers etc)
|
\param data pointer to the dataset (including headers etc)
|
||||||
\param ix pixel number in the x direction
|
\param ix pixel number in the x direction
|
||||||
\param iy pixel number in the y direction
|
\param iy pixel number in the y direction
|
||||||
\param dr dynamic range
|
|
||||||
\returns data for the selected channel, with inversion if required
|
\returns data for the selected channel, with inversion if required
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
virtual int getChannel(char *data, int ix, int iy, int dr) {
|
virtual int getChannelwithMissingPackets(char *data, int ix, int iy) {
|
||||||
uint32_t m=0, n = 0;
|
uint32_t m=0, n = 0;
|
||||||
int linesperpacket,newix, newiy,origX;
|
int linesperpacket,newix, newiy,origX;
|
||||||
|
|
||||||
@ -270,23 +269,30 @@ public:
|
|||||||
|
|
||||||
//pixelpos1d = (nx * iy + ix);
|
//pixelpos1d = (nx * iy + ix);
|
||||||
|
|
||||||
switch(dr){
|
switch(dynamicRange){
|
||||||
case 4: linesperpacket=4;break;
|
case 4: if(tenGiga) linesperpacket=16; else linesperpacket=4;break;
|
||||||
case 8: linesperpacket=2;break;
|
case 8: if(tenGiga) linesperpacket=8; else linesperpacket=2;break;
|
||||||
case 16: linesperpacket=1;break;
|
case 16: if(tenGiga) linesperpacket=4; else linesperpacket=1;break;
|
||||||
case 32: linesperpacket=2;break;
|
case 32: if(tenGiga) linesperpacket=2; else linesperpacket=1;break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//each byte is shared by 2 pixels for 4 bit mode
|
//each byte is shared by 2 pixels for 4 bit mode
|
||||||
origX = ix;
|
origX = ix;
|
||||||
if((dr == 4) && (ix%2))
|
if((dynamicRange == 4) && (ix%2))
|
||||||
ix--;
|
ix--;
|
||||||
|
|
||||||
|
|
||||||
//check if missing packet, get to pixel at start of packet
|
|
||||||
|
|
||||||
//to get the starting of a packet, ix is divided by 512pixels because of 2 ports
|
// ------check if missing packet, get to pixel at start of packet-----------------
|
||||||
|
|
||||||
|
//to get the starting of a packet, ix is divided by 512pixels because of 2 ports (except 1g 32 bit)
|
||||||
newix = ix - (ix%512);
|
newix = ix - (ix%512);
|
||||||
|
// 0.5 Lines per packet for 1g 32 bit
|
||||||
|
if(dynamicRange ==32 && !tenGiga)
|
||||||
|
newix = ix - (ix%256);
|
||||||
|
|
||||||
//iy divided by linesperpacket depending on bitmode
|
//iy divided by linesperpacket depending on bitmode
|
||||||
if(!(iy%linesperpacket))
|
if(!(iy%linesperpacket))
|
||||||
newiy = iy;
|
newiy = iy;
|
||||||
@ -298,7 +304,7 @@ public:
|
|||||||
// cprintf(RED,"missing packet\n");
|
// cprintf(RED,"missing packet\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
// -----END OF CHECK -------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
@ -310,13 +316,13 @@ public:
|
|||||||
n = ((uint32_t)(*((uint32_t*)(((char*)data)+(dataMap[iy][ix])))));
|
n = ((uint32_t)(*((uint32_t*)(((char*)data)+(dataMap[iy][ix])))));
|
||||||
|
|
||||||
//each byte is shared by 2 pixels for 4 bit mode
|
//each byte is shared by 2 pixels for 4 bit mode
|
||||||
if(dr == 4){
|
if(dynamicRange == 4){
|
||||||
if(ix != origX)
|
if(ix != origX)
|
||||||
return ((n & 0xf0)>>4)^m;
|
return ((n & 0xf0)>>4)^m;
|
||||||
return (n & 0xf)^m;
|
return (n & 0xf)^m;
|
||||||
}
|
}
|
||||||
else if(dr == 8) return (n & 0xff)^m;
|
else if(dynamicRange == 8) return (n & 0xff)^m;
|
||||||
else if(dr == 16) return (n & 0xffff)^m;
|
else if(dynamicRange == 16) return (n & 0xffff)^m;
|
||||||
else return (n & 0xffffffff)^m;
|
else return (n & 0xffffffff)^m;
|
||||||
|
|
||||||
|
|
||||||
@ -353,6 +359,8 @@ private:
|
|||||||
const int dynamicRange;
|
const int dynamicRange;
|
||||||
const int numberOfPackets;
|
const int numberOfPackets;
|
||||||
bool top;
|
bool top;
|
||||||
|
bool tenGiga;
|
||||||
|
static const int TEN_GIGA_PACKET_SIZE = 4096;
|
||||||
|
|
||||||
|
|
||||||
/** structure of an eiger packet*/
|
/** structure of an eiger packet*/
|
||||||
|
@ -88,10 +88,7 @@ class slsDetectorData {
|
|||||||
/**
|
/**
|
||||||
defines the data map (as offset) - no error checking if datasize and offsets are compatible!
|
defines the data map (as offset) - no error checking if datasize and offsets are compatible!
|
||||||
\param dMap array of size nx*ny storing the pointers to the data in the dataset (as offset). If NULL (default),the data are arranged as if read out row by row (dataMap[iy][ix]=(iy*nx+ix)*sizeof(dataType);)
|
\param dMap array of size nx*ny storing the pointers to the data in the dataset (as offset). If NULL (default),the data are arranged as if read out row by row (dataMap[iy][ix]=(iy*nx+ix)*sizeof(dataType);)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
void setDataMap(int **dMap=NULL) {
|
void setDataMap(int **dMap=NULL) {
|
||||||
|
|
||||||
/* int ip;*/
|
/* int ip;*/
|
||||||
@ -123,8 +120,6 @@ class slsDetectorData {
|
|||||||
\param dMask Array of size nx*ny storing the polarity of the data in the dataset (should be 0 if no inversion is required, 0xffffffff is inversion is required)
|
\param dMask Array of size nx*ny storing the polarity of the data in the dataset (should be 0 if no inversion is required, 0xffffffff is inversion is required)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
void setDataMask(dataType **dMask=NULL){
|
void setDataMask(dataType **dMask=NULL){
|
||||||
|
|
||||||
if (dMask!=NULL) {
|
if (dMask!=NULL) {
|
||||||
@ -143,7 +138,6 @@ class slsDetectorData {
|
|||||||
\param dROI Array of size nx*ny. The lements are 1s if the channel is good or in the ROI, 0 is bad or out of the ROI. NULL (default) means all 1s.
|
\param dROI Array of size nx*ny. The lements are 1s if the channel is good or in the ROI, 0 is bad or out of the ROI. NULL (default) means all 1s.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void setDataROIMask(int **dROI=NULL){
|
void setDataROIMask(int **dROI=NULL){
|
||||||
|
|
||||||
if (dROI!=NULL) {
|
if (dROI!=NULL) {
|
||||||
@ -188,12 +182,12 @@ class slsDetectorData {
|
|||||||
|
|
||||||
/** Returns the size of the data frame */
|
/** Returns the size of the data frame */
|
||||||
int getDataSize() {return dataSize;};
|
int getDataSize() {return dataSize;};
|
||||||
|
|
||||||
/** changes the size of the data frame */
|
/** changes the size of the data frame */
|
||||||
int setDataSize(int d) {dataSize=d; return dataSize;};
|
int setDataSize(int d) {dataSize=d; return dataSize;};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Returns the value of the selected channel for the given dataset. Virtual function, can be overloaded.
|
Returns the value of the selected channel for the given dataset. Virtual function, can be overloaded.
|
||||||
\param data pointer to the dataset (including headers etc)
|
\param data pointer to the dataset (including headers etc)
|
||||||
\param ix pixel number in the x direction
|
\param ix pixel number in the x direction
|
||||||
@ -201,8 +195,6 @@ class slsDetectorData {
|
|||||||
\returns data for the selected channel, with inversion if required
|
\returns data for the selected channel, with inversion if required
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
virtual dataType getChannel(char *data, int ix, int iy=0) {
|
virtual dataType getChannel(char *data, int ix, int iy=0) {
|
||||||
dataType m=0, d=0;
|
dataType m=0, d=0;
|
||||||
if (ix>=0 && ix<nx && iy>=0 && iy<ny && dataMap[iy][ix]>=0 && dataMap[iy][ix]<dataSize) {
|
if (ix>=0 && ix<nx && iy>=0 && iy<ny && dataMap[iy][ix]>=0 && dataMap[iy][ix]<dataSize) {
|
||||||
@ -212,24 +204,22 @@ class slsDetectorData {
|
|||||||
return d^m;
|
return d^m;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Returns the value of the selected channel for the given dataset. Virtual function, can be overloaded.
|
Returns the value of the selected channel for the given dataset. Virtual function, can be overloaded.
|
||||||
\param data pointer to the dataset (including headers etc)
|
\param data pointer to the dataset (including headers etc)
|
||||||
\param ix pixel number in the x direction
|
\param ix pixel number in the x direction
|
||||||
\param iy pixel number in the y direction
|
\param iy pixel number in the y direction
|
||||||
\param dr dynamic range
|
\returns data for the selected channel, with inversion if required or -1 if its a missing packet
|
||||||
\returns data for the selected channel, with inversion if required
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
virtual int getChannel(char *data, int ix, int iy, int dr) {
|
virtual int getChannelwithMissingPackets(char *data, int ix, int iy) {
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the value of the selected channel for the given dataset as double.
|
Returns the value of the selected channel for the given dataset as double.
|
||||||
\param data pointer to the dataset (including headers etc)
|
\param data pointer to the dataset (including headers etc)
|
||||||
@ -240,29 +230,13 @@ class slsDetectorData {
|
|||||||
*/
|
*/
|
||||||
virtual double getValue(char *data, int ix, int iy=0) {return (double)getChannel(data, ix, iy);};
|
virtual double getValue(char *data, int ix, int iy=0) {return (double)getChannel(data, ix, iy);};
|
||||||
|
|
||||||
/**
|
|
||||||
|
|
||||||
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
|
|
||||||
\param dr dynamic range
|
|
||||||
\returns data for the selected channel, with inversion if required as double
|
|
||||||
|
|
||||||
*/
|
|
||||||
virtual double getValue(char *data, int ix, int iy, int dr) {
|
|
||||||
return ((double)getChannel(data, ix, iy, dr));
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Returns the frame number for the given dataset. Purely virtual func.
|
Returns the frame number for the given dataset. Purely virtual func.
|
||||||
\param buff pointer to the dataset
|
\param buff pointer to the dataset
|
||||||
\returns frame number
|
\returns frame number
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
virtual int getFrameNumber(char *buff)=0;
|
virtual int getFrameNumber(char *buff)=0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user