mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-07 10:30:41 +02:00
added gotthard specific instructions
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorCalibration@42 113b152e-814d-439b-b186-022a431db7b5
This commit is contained in:
parent
0a86011998
commit
26003dc867
165
slsDetectorCalibration/gotthardModuleData.h
Normal file
165
slsDetectorCalibration/gotthardModuleData.h
Normal file
@ -0,0 +1,165 @@
|
||||
#ifndef GOTTHARDMODULEDATA_H
|
||||
#define GOTTHARDMODULEDATA_H
|
||||
#include "slsReceiverData.h"
|
||||
|
||||
|
||||
|
||||
#define X_PIXELS 1280
|
||||
#define Y_PIXELS 1
|
||||
#define NPACKETS 2
|
||||
#define BUFFERSIZE 1286
|
||||
#define NUMPACKETS 2
|
||||
#define NUMSHORTPACKETS 1
|
||||
#define FRAMEMASK 0xFFFFFFFE
|
||||
#define PACKETMASK 1
|
||||
#define FRAMEOFFSET 0x1
|
||||
#define SHORT_FRAMEMASK 0xFFFFFFFF
|
||||
#define SHORT_PACKETMASK 0
|
||||
#define SHORT_FRAMEOFFSET 0
|
||||
|
||||
|
||||
class gotthardModuleData : public slsReceiverData<uint16_t> {
|
||||
public:
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Implements the slsReceiverData structure for the gotthard read out by a module i.e. using the slsReceiver
|
||||
(1x1280 pixels, 2 packets 1286 large etc.)
|
||||
\param c crosstalk parameter for the output buffer
|
||||
|
||||
*/
|
||||
|
||||
|
||||
gotthardModuleData(double c=0, bool s=-1): slsReceiverData<uint16_t>(X_PIXELS, Y_PIXELS, NPACKETS, BUFFERSIZE), xtalk(c),shortFrame(s) {
|
||||
|
||||
|
||||
if(shortFrame == -1)
|
||||
shortFrame = 0;
|
||||
else
|
||||
shortFrame = 1;
|
||||
|
||||
uint16_t **dMask;
|
||||
int **dMap;
|
||||
int ix, iy;
|
||||
int initial_offset = 2;
|
||||
int offset = initial_offset;
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
if(!shortFrame){
|
||||
for(ix=0; ix<Y_PIXELS; ++ix){
|
||||
if(ix == (Y_PIXELS/2)){
|
||||
offset += initial_offset;//2
|
||||
offset++;
|
||||
}
|
||||
for(iy=0; iy<X_PIXELS; ++iy){
|
||||
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);
|
||||
setDataMask(dMask);
|
||||
if(shortFrame){
|
||||
setFrameIndexMask(FRAMEMASK);
|
||||
setPacketIndexMask(PACKETMASK);
|
||||
setFrameIndexOffset(FRAMEOFFSET);
|
||||
}else{
|
||||
setFrameIndexMask(SHORT_FRAMEMASK);
|
||||
setPacketIndexMask(SHORT_PACKETMASK);
|
||||
setFrameIndexOffset(SHORT_FRAMEOFFSET);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
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){
|
||||
if(shortFrame)
|
||||
return 1;
|
||||
|
||||
int np=(*(int*)buff)&0x1;
|
||||
++np;
|
||||
return np;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
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 */
|
||||
int shortFrame; /**<short frame */
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -65,8 +65,9 @@ class moench02ModuleData : public slsReceiverData<uint16_t> {
|
||||
|
||||
setDataMap(dMap);
|
||||
setDataMask(dMask);
|
||||
|
||||
|
||||
setFrameIndexMask(0xffffff00);
|
||||
setPacketIndexMask(0xff);
|
||||
setFrameIndexOffset(8);
|
||||
|
||||
|
||||
};
|
||||
|
@ -191,6 +191,32 @@ class slsDetectorData {
|
||||
*/
|
||||
virtual double getValue(char *data, int ix, int iy=0) {return (double)getChannel(data, ix, iy);};
|
||||
|
||||
/**
|
||||
|
||||
Sets frame index mask for the given dataset. Virtual func: works for slsDetectorReceiver packets, but can be overloaded.
|
||||
\param m frame index mask
|
||||
|
||||
*/
|
||||
|
||||
virtual void setFrameIndexMask(uint32_t m)=0;
|
||||
|
||||
/**
|
||||
|
||||
Sets the packet index mask for the given dataset. Virtual func: works for slsDetectorReceiver packets, but can be overloaded.
|
||||
\param m packet index mask
|
||||
|
||||
*/
|
||||
|
||||
virtual void setPacketIndexMask(uint32_t m)=0;
|
||||
|
||||
/**
|
||||
|
||||
Sets the frame index offset for the given dataset. Virtual func: works for slsDetectorReceiver packets, but can be overloaded.
|
||||
\param o frame index offset
|
||||
*/
|
||||
|
||||
virtual void setFrameIndexOffset(int o)=0;
|
||||
|
||||
/**
|
||||
|
||||
Returns the frame number for the given dataset. Purely virtual func.
|
||||
|
@ -23,9 +23,34 @@ class slsReceiverData : public slsDetectorData<dataType> {
|
||||
\param dROI Array of size nx*ny. The elements are 1s if the channel is good or in the ROI, 0 is bad or out of the ROI. NULL (default) means all 1s.
|
||||
|
||||
*/
|
||||
slsReceiverData(int npx, int npy, int np, int psize, int **dMap=NULL, dataType **dMask=NULL, int **dROI=NULL): slsDetectorData<dataType>(npx, npy, np*psize, dMap, dMask, dROI), nPackets(np), packetSize(psize) {};
|
||||
slsReceiverData(int npx, int npy, int np, int psize, int **dMap=NULL, dataType **dMask=NULL, int **dROI=NULL): slsDetectorData<dataType>(npx, npy, np*psize, dMap, dMask, dROI), nPackets(np), packetSize(psize),frameIndexMask(0),packetIndexMask(0),frameIndexOffset(0) {};
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Sets frame index mask for the given dataset. Virtual func: works for slsDetectorReceiver packets, but can be overloaded.
|
||||
\param m frame index mask
|
||||
|
||||
*/
|
||||
|
||||
virtual void setFrameIndexMask(uint32_t m) {frameIndexMask = m;};
|
||||
|
||||
/**
|
||||
|
||||
Sets the packet index mask for the given dataset. Virtual func: works for slsDetectorReceiver packets, but can be overloaded.
|
||||
\param m packet index mask
|
||||
|
||||
*/
|
||||
|
||||
virtual void setPacketIndexMask(uint32_t m) {packetIndexMask = m;};
|
||||
|
||||
/**
|
||||
|
||||
Sets the frame index offset for the given dataset. Virtual func: works for slsDetectorReceiver packets, but can be overloaded.
|
||||
\param o frame index offset
|
||||
*/
|
||||
|
||||
virtual void setFrameIndexOffset(int o) {frameIndexOffset = o;};
|
||||
|
||||
/**
|
||||
|
||||
@ -35,7 +60,7 @@ class slsReceiverData : public slsDetectorData<dataType> {
|
||||
|
||||
*/
|
||||
|
||||
virtual int getFrameNumber(char *buff){return ((*(int*)buff)&(0xffffff00))>>8;};
|
||||
virtual int getFrameNumber(char *buff){return ((*(int*)buff)&(frameIndexMask))>>frameIndexOffset;};/*{return ((*(int*)buff)&(0xffffff00))>>8;};*/
|
||||
|
||||
/**
|
||||
|
||||
@ -45,7 +70,7 @@ class slsReceiverData : public slsDetectorData<dataType> {
|
||||
|
||||
*/
|
||||
|
||||
virtual int getPacketNumber(char *buff) {return (*(int*)buff)&0xff;};
|
||||
virtual int getPacketNumber(char *buff) {return (*(int*)buff)&packetIndexMask;};/*{return (*(int*)buff)&0xff;};*/
|
||||
|
||||
|
||||
|
||||
@ -165,6 +190,9 @@ class slsReceiverData : public slsDetectorData<dataType> {
|
||||
private:
|
||||
const int nPackets; /**<number of UDP packets constituting one frame */
|
||||
const int packetSize; /**< size of a udp packet */
|
||||
uint32_t frameIndexMask;
|
||||
uint32_t packetIndexMask;
|
||||
int frameIndexOffset;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user