From c9269d0f21dcd082be2489ca07bc2d186cc34f69 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Mon, 16 Mar 2015 17:53:54 +0100 Subject: [PATCH 1/4] included a cstring include for compilation in slsReceiverData.h --- slsDetectorCalibration/slsReceiverData.h | 1 + 1 file changed, 1 insertion(+) diff --git a/slsDetectorCalibration/slsReceiverData.h b/slsDetectorCalibration/slsReceiverData.h index e07a757fd..51e371434 100644 --- a/slsDetectorCalibration/slsReceiverData.h +++ b/slsDetectorCalibration/slsReceiverData.h @@ -2,6 +2,7 @@ #define SLSRECEIVERDATA_H #include "slsDetectorData.h" +#include template class slsReceiverData : public slsDetectorData { From 9b11df1c31e58a7a884326a9788929e16b8dab3b Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Tue, 24 Mar 2015 10:42:22 +0100 Subject: [PATCH 2/4] a trial version of eiger mapping data --- slsDetectorCalibration/eigerHalfModuleData.h | 172 +++++++++++++++++++ slsDetectorCalibration/slsDetectorData.h | 38 ++++ 2 files changed, 210 insertions(+) create mode 100644 slsDetectorCalibration/eigerHalfModuleData.h diff --git a/slsDetectorCalibration/eigerHalfModuleData.h b/slsDetectorCalibration/eigerHalfModuleData.h new file mode 100644 index 000000000..9257c173b --- /dev/null +++ b/slsDetectorCalibration/eigerHalfModuleData.h @@ -0,0 +1,172 @@ +#ifndef EIGERMODULEDATA_H +#define EIGERMODULEDATA_H +#include "slsReceiverData.h" + + + +class eigerHalfModuleData : public slsReceiverData { +public: + + + + + /** + Implements the slsReceiverData structure for the eiger prototype read out by a half module i.e. using the slsReceiver + (256*256 pixels, 512 packets for 16 bit mode, 256 for 8, 128 for 4, 1024 for 32, 1040 etc.) + \param d dynamic range + \param c crosstalk parameter for the output buffer + + */ + + + eigerHalfModuleData(int np, int dr, int t, int bsize, int dsize, double c=0): slsReceiverData(xpixels, ypixels, nPackets, bsize), + xtalk(c), nPackets(np), dynamicRange(dr), bufferSize(bsize), dataSize(dsize){ + + + int **dMap; + uint32_t **dMask; + int ix, iy; + + dMap=new int*[ypixels]; + dMask=new uint32_t*[ypixels]; + + + for (int i = 0; i < ypixels; i++) { + dMap[i] = new int[xpixels]; + dMask[i] = new uint32_t[xpixels]; + } + + //Map + int totalNumberOfBytes = 1040 * dynamicRange * 16 *2; //for both 1g and 10g + int iPacket1 = 8; + int iPacket2 = (totalNumberOfBytes/2) + 8; + int iData1 = 0, iData2 = 0; + int iPort; + + for (int ir=0; ir= dataSize){ + iPacket1 += 16; + iData1 = 0; + } + }else{ + dMap[ir][ic] = iPacket2; + iPacket2 += (dynamicRange / 8); + iData2 +=(dynamicRange / 8); + if(iData2 >= dataSize){ + iPacket2 += 16; + iData2 = 0; + } + } + } + } + + + + + //Mask + for(ix=0; ixfnum); + }; + + + /** 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 htonl(*(unsigned int*)((eiger_packet_header *)((char*)(buff)))->num2); + }; + + + /** + 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) { + // cout << "##" << (void*)data << " " << ix << " " <::getValue(data, ix, iy); + else + return slsDetectorData::getValue(data, ix, iy)-xtalk*slsDetectorData::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; /**=0 && ix=0 && iy=0 && dataMap[iy][ix] Date: Wed, 25 Mar 2015 15:14:03 +0100 Subject: [PATCH 3/4] some more changes for eiger mapping --- slsDetectorCalibration/eigerHalfModuleData.h | 5 +- slsDetectorCalibration/slsDetectorData.h | 50 +++++++++++++------- slsDetectorCalibration/slsReceiverData.h | 3 +- 3 files changed, 38 insertions(+), 20 deletions(-) diff --git a/slsDetectorCalibration/eigerHalfModuleData.h b/slsDetectorCalibration/eigerHalfModuleData.h index 9257c173b..555edee54 100644 --- a/slsDetectorCalibration/eigerHalfModuleData.h +++ b/slsDetectorCalibration/eigerHalfModuleData.h @@ -19,8 +19,8 @@ public: */ - eigerHalfModuleData(int np, int dr, int t, int bsize, int dsize, double c=0): slsReceiverData(xpixels, ypixels, nPackets, bsize), - xtalk(c), nPackets(np), dynamicRange(dr), bufferSize(bsize), dataSize(dsize){ + eigerHalfModuleData(int dr, int np, int bsize, int dsize, double c=0): slsReceiverData(xpixels, ypixels, np, bsize), + xtalk(c), dynamicRange(dr), bufferSize(bsize), dataSize(dsize){ int **dMap; @@ -146,7 +146,6 @@ private: const static int ypixels = 256; const int bufferSize; const int dataSize; - const int nPackets; const int dynamicRange; diff --git a/slsDetectorCalibration/slsDetectorData.h b/slsDetectorCalibration/slsDetectorData.h index 26efa53af..d76310d21 100644 --- a/slsDetectorCalibration/slsDetectorData.h +++ b/slsDetectorCalibration/slsDetectorData.h @@ -87,19 +87,21 @@ class slsDetectorData { void setDataMap(int **dMap=NULL) { - if (dMap==NULL) { - for (int iy=0; iy=0 && ix=0 && iy=0 && dataMap[iy][ix]0) From 70c98a663de9c01088a55fea85f908aaaab92085 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Fri, 27 Mar 2015 17:42:23 +0100 Subject: [PATCH 4/4] eiger mapping done --- slsDetectorCalibration/eigerHalfModuleData.h | 7 +- slsDetectorCalibration/slsDetectorData.h | 72 ++++++++++++-------- 2 files changed, 45 insertions(+), 34 deletions(-) diff --git a/slsDetectorCalibration/eigerHalfModuleData.h b/slsDetectorCalibration/eigerHalfModuleData.h index 555edee54..1c878af8c 100644 --- a/slsDetectorCalibration/eigerHalfModuleData.h +++ b/slsDetectorCalibration/eigerHalfModuleData.h @@ -25,7 +25,6 @@ public: int **dMap; uint32_t **dMask; - int ix, iy; dMap=new int*[ypixels]; dMask=new uint32_t*[ypixels]; @@ -70,9 +69,9 @@ public: //Mask - for(ix=0; ix=0 && ix=0 && iy=0 && dataMap[iy][ix]=0 && ix=0 && iy=0 && dataMap[iy][ix]> (pixelval*4); cout <<"value:"<< value << endl; + return ((t >> (pixelval*4)) & 0xf)^m; + else if(dr == 8) + //uint8_t value = t >> (pixelval*8); cout <<"value:"<< value << endl; + return ((t >> (pixelval*8)) & 0xff)^m; + else if(dr == 16){ + //uint16_t value = t >> (pixelval*16); cout <<"value:"<< value << endl; + return ((t >> (pixelval*16)) & 0xffff)^m; + }else{ + //uint32_t value = t >> (pixelval*32); cout <<"value:"<< value << endl; + return ((t >> (pixelval*32)) & 0xffffffff)^m; + } }; /** @@ -262,7 +272,9 @@ class slsDetectorData { \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);}; + virtual double getValue(char *data, int ix, int iy, int dr) { + return ((double)getChannel(data, ix, iy, dr)); + }; /**