gotthard works for short frame

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorCalibration@44 113b152e-814d-439b-b186-022a431db7b5
This commit is contained in:
l_maliakal_d 2014-02-20 13:24:52 +00:00
parent 44fb8230cf
commit eee5f7f743
3 changed files with 138 additions and 39 deletions

View File

@ -8,8 +8,7 @@
#define Y_PIXELS 1 #define Y_PIXELS 1
#define NPACKETS 2 #define NPACKETS 2
#define BUFFERSIZE 1286 #define BUFFERSIZE 1286
#define NUMPACKETS 2
#define NUMSHORTPACKETS 1
#define FRAMEMASK 0xFFFFFFFE #define FRAMEMASK 0xFFFFFFFE
#define PACKETMASK 1 #define PACKETMASK 1
#define FRAMEOFFSET 0x1 #define FRAMEOFFSET 0x1
@ -29,12 +28,7 @@ public:
*/ */
gotthardModuleData(double c=0, int s=-1): slsReceiverData<uint16_t>(X_PIXELS, Y_PIXELS, NPACKETS, BUFFERSIZE), xtalk(c),shortFrame(s) { gotthardModuleData(double c=0): slsReceiverData<uint16_t>(X_PIXELS, Y_PIXELS, NPACKETS, BUFFERSIZE), xtalk(c) {
if(shortFrame == -1)
shortFrame = 0;
else
shortFrame = 1;
uint16_t **dMask; uint16_t **dMask;
int **dMap; int **dMap;
@ -42,7 +36,6 @@ public:
int initial_offset = 2; int initial_offset = 2;
int offset = initial_offset; int offset = initial_offset;
dMask=new uint16_t*[Y_PIXELS]; dMask=new uint16_t*[Y_PIXELS];
dMap=new int*[Y_PIXELS]; dMap=new int*[Y_PIXELS];
for (int i = 0; i < Y_PIXELS; i++) { for (int i = 0; i < Y_PIXELS; i++) {
@ -50,34 +43,21 @@ public:
dMask[i] = new uint16_t[X_PIXELS]; dMask[i] = new uint16_t[X_PIXELS];
} }
for(ix=0; ix<Y_PIXELS; ++ix) for(ix=0; ix<Y_PIXELS; ++ix)
for(iy=0; iy<X_PIXELS; ++iy) for(iy=0; iy<X_PIXELS; ++iy)
dMask[ix][iy] = 0x0; dMask[ix][iy] = 0x0;
for(ix=0; ix<Y_PIXELS; ++ix){
if(!shortFrame){ if(ix == (Y_PIXELS/2)){
for(ix=0; ix<Y_PIXELS; ++ix){ offset += initial_offset;//2
if(ix == (Y_PIXELS/2)){ offset++;
offset += initial_offset;//2 }
offset++; for(iy=0; iy<X_PIXELS; ++iy){
} dMap[ix][iy] = offset;
for(iy=0; iy<X_PIXELS; ++iy){ offset++;
dMap[ix][iy] = offset;
offset++;
}
} }
}else{
for(ix=0; ix<Y_PIXELS; ++ix)
for(iy=0; iy<X_PIXELS; ++iy){
dMap[ix][iy] = offset;
offset++;
}
} }
setDataMap(dMap); setDataMap(dMap);
setDataMask(dMask); setDataMask(dMask);
@ -94,10 +74,6 @@ public:
int getFrameNumber(char *buff){ int getFrameNumber(char *buff){
int np=(*(int*)buff); int np=(*(int*)buff);
if(shortFrame)
return np;
//gotthards frame header must be incremented //gotthards frame header must be incremented
++np; ++np;
//packet index should be 1 or 2 //packet index should be 1 or 2
@ -114,9 +90,6 @@ public:
*/ */
int getPacketNumber(char *buff){ int getPacketNumber(char *buff){
if(shortFrame)
return 1;
int np=(*(int*)buff); int np=(*(int*)buff);
//gotthards frame header must be incremented //gotthards frame header must be incremented
++np; ++np;
@ -165,7 +138,6 @@ public:
private: private:
double xtalk; /**<output buffer crosstalk correction parameter */ double xtalk; /**<output buffer crosstalk correction parameter */
int shortFrame; /**<short frame */
}; };

View File

@ -0,0 +1,128 @@
#ifndef GOTTHARDSHORTMODULEDATA_H
#define GOTTHARDSHORTMODULEDATA_H
#include "slsReceiverData.h"
#define X_PIXELS 256
#define Y_PIXELS 1
#define NPACKETS 1
#define BUFFERSIZE 518
class gotthardShortModuleData : public slsReceiverData<uint16_t> {
public:
/**
Implements the slsReceiverData structure for the gotthard short read out by a module i.e. using the slsReceiver
(1x256 pixels, 1 packet 256 large etc.)
\param c crosstalk parameter for the output buffer
*/
gotthardShortModuleData(double c=0): slsReceiverData<uint16_t>(X_PIXELS, Y_PIXELS, NPACKETS, BUFFERSIZE), xtalk(c){
uint16_t **dMask;
int **dMap;
int ix, iy;
int offset = 2;
dMask=new uint16_t*[Y_PIXELS];
dMap=new int*[Y_PIXELS];
for (int i = 0; i < Y_PIXELS; i++) {
dMap[i] = new int[X_PIXELS];
dMask[i] = new uint16_t[X_PIXELS];
}
for(ix=0; ix<Y_PIXELS; ++ix)
for(iy=0; iy<X_PIXELS; ++iy)
dMask[ix][iy] = 0x0;
for(ix=0; ix<Y_PIXELS; ++ix)
for(iy=0; iy<X_PIXELS; ++iy){
dMap[ix][iy] = offset;
offset++;
}
setDataMap(dMap);
setDataMask(dMask);
};
/**
Returns the frame number for the given dataset.
\param buff pointer to the dataset
\returns frame number
*/
int getFrameNumber(char *buff){
return (*(int*)buff);
};
/**
gets the packets number (last packet is labelled with 0 and is replaced with 40)
\param buff pointer to the memory
\returns packet number
*/
int getPacketNumber(char *buff){
return 1;
};
/**
returns the pixel value as double correcting for the output buffer crosstalk
\param data pointer to the memory
\param ix coordinate in the x direction
\param iy coordinate in the y direction
\returns channel value as double
*/
double getValue(char *data, int ix, int iy=0) {
//check how it is for gotthard
if (xtalk==0)
return slsDetectorData<uint16_t>::getValue(data, ix, iy);
else
return slsDetectorData<uint16_t>::getValue(data, ix, iy)-xtalk*slsDetectorData<uint16_t>::getValue(data, ix-1, iy);
};
/** sets the output buffer crosstalk correction parameter
\param c output buffer crosstalk correction parameter to be set
\returns current value for the output buffer crosstalk correction parameter
*/
double setXTalk(double c) {xtalk=c; return xtalk;}
/** gets the output buffer crosstalk parameter
\returns current value for the output buffer crosstalk correction parameter
*/
double getXTalk() {return xtalk;}
private:
double xtalk; /**<output buffer crosstalk correction parameter */
};
#endif

View File

@ -212,7 +212,6 @@ class slsDetectorData {
*/ */
virtual int getPacketNumber(char *buff)=0; virtual int getPacketNumber(char *buff)=0;
/*
/** /**