diff --git a/slsDetectorCalibration/MovingStat.h b/slsDetectorCalibration/MovingStat.h index 9d3720b1b..968a3eab1 100755 --- a/slsDetectorCalibration/MovingStat.h +++ b/slsDetectorCalibration/MovingStat.h @@ -25,6 +25,16 @@ class MovingStat m_newM=0; m_newM2=0; } + + /** + clears the moving average number of samples parameter, mean and standard deviation + */ + void Set(double val) + { + m_n = n; + m_newM=val*n; + m_newM2=val*val*n; + } /** sets number of samples parameter diff --git a/slsDetectorCalibration/moench03Ctb10GbData.h b/slsDetectorCalibration/moench03Ctb10GbData.h index 68ab2e167..52b7575e4 100644 --- a/slsDetectorCalibration/moench03Ctb10GbData.h +++ b/slsDetectorCalibration/moench03Ctb10GbData.h @@ -211,6 +211,7 @@ class moench03Ctb10GbData : public slsReceiverData { }; +int getPacketNumber(int x, int y) {return dataMap[y][x]/8208;}; virtual char *readNextFrame(ifstream &filebin) { int fnum; diff --git a/slsDetectorCalibration/moench03Ctb10GbT1Data.h b/slsDetectorCalibration/moench03Ctb10GbT1Data.h new file mode 100644 index 000000000..da91c65c4 --- /dev/null +++ b/slsDetectorCalibration/moench03Ctb10GbT1Data.h @@ -0,0 +1,236 @@ +#ifndef MOENCH03CTB10GBT1DATA_H +#define MOENCH03CTB10GBT1DATA_H +#include "slsReceiverData.h" + + + +class moench03Ctb10GbData : public slsReceiverData { + + private: + + int iframe; + int nadc; + int sc_width; + int sc_height; + public: + + + + + /** + Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver + (160x160 pixels, 40 packets 1286 large etc.) + \param c crosstalk parameter for the output buffer + + */ + + + // moench03Ctb10GbData(int ns=5000): slsDetectorData(400, 400, 8208*40, NULL, NULL) , nadc(32), sc_width(25), sc_height(200) { + moench03Ctb10GbT1Data(int ns=5000): slsReceiverData(400, 400, 40, 8208), nadc(32), sc_width(25), sc_height(200) { + + int adc_nr[32]={200,225,250,275,300,325,350,375,\ + 0,25,50,75,100,125,150,175,\ + 175,150,125,100,75,50,25,0,\ + 375,350,325,300,275,250,225,200}; + int row, col; + + int isample; + int iadc; + int ix, iy; + + int npackets=40; + int i; + + + for (int ip=0; ip=8208*40) + cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl; + } + } + } + } + + int ipacket; + int ibyte; + int ii=0; + for (int ipacket=0; ipacket0) { */ +/* iframe++; */ +/* // cout << ib << "-" << endl; */ +/* return (char*)afifo_cont; */ +/* } else { */ +/* delete [] afifo_cont; */ +/* return NULL; */ +/* } */ +/* } */ +/* return NULL; */ +/* }; */ + + + virtual char *readNextFrame(ifstream &filebin, int& fnum) { + char *data=new char[packetSize*nPackets]; + char *retval=0; + int np=0, nd; + fnum = -1; + int pn; + char aa[8224]; + char *packet=(char *)aa; + + if (filebin.is_open()) { + + + + + while(filebin.read((char*)packet, 8208) && np=0) { + if (getFrameNumber(packet) !=fnum) { + + if (np==0){ + delete [] data; + return NULL; + } else + return data; + } + + memcpy(data+(pn-1)*packetSize, packet, packetSize); + np++; + + } + } + + } + + if (np==0){ + delete [] data; + return NULL; + } + + }; + +int getPacketNumber(int x, int y) {return dataMap[y][x]/8208;}; + + virtual char *readNextFrame(ifstream &filebin) { + int fnum; + return readNextFrame(filebin, fnum); + }; + +}; + + + + +#endif diff --git a/slsDetectorCalibration/moench03CtbData.h b/slsDetectorCalibration/moench03CtbData.h index 7ad309942..99a7fe92e 100644 --- a/slsDetectorCalibration/moench03CtbData.h +++ b/slsDetectorCalibration/moench03CtbData.h @@ -4,7 +4,7 @@ -class moench03CtbData : public slsDetectorData { +class moench03TCtbData : public slsDetectorData { private: @@ -25,7 +25,7 @@ class moench03CtbData : public slsDetectorData { */ - moench03CtbData(int ns=5000): slsDetectorData(400, 400, ns*2*32, NULL, NULL) , nadc(32), sc_width(25), sc_height(200) { + moench03TCtbData(int ns=5000): slsDetectorData(400, 400, ns*2*32, NULL, NULL) , nadc(32), sc_width(25), sc_height(200) { int adc_nr[32]={200,225,250,275,300,325,350,375,\ diff --git a/slsDetectorCalibration/moench03TCtb10GbData.h b/slsDetectorCalibration/moench03TCtb10GbData.h index 7c885601f..2eaeb0019 100644 --- a/slsDetectorCalibration/moench03TCtb10GbData.h +++ b/slsDetectorCalibration/moench03TCtb10GbData.h @@ -232,7 +232,7 @@ class moench03TCtb10GbData : public slsReceiverData { }; - +int getPacketNumber(int x, int y) {return dataMap[y][x]/8208;}; virtual char *readNextFrame(ifstream &filebin) { int fnum=-1, np; diff --git a/slsDetectorCalibration/pedestalSubtraction.h b/slsDetectorCalibration/pedestalSubtraction.h index ee3aff8aa..6ec9343bd 100644 --- a/slsDetectorCalibration/pedestalSubtraction.h +++ b/slsDetectorCalibration/pedestalSubtraction.h @@ -39,8 +39,11 @@ class pedestalSubtraction { */ virtual int SetNPedestals(int i=-1) {if (i>0) stat.SetN(i); return stat.GetN();}; + /** sets the moving average */ + virtual void setPedestal(double val) {stat.Set(val);} + private: MovingStat stat; /**< approximated moving average struct */ diff --git a/slsDetectorCalibration/singlePhotonDetector.h b/slsDetectorCalibration/singlePhotonDetector.h index 007851e28..1e112d917 100644 --- a/slsDetectorCalibration/singlePhotonDetector.h +++ b/slsDetectorCalibration/singlePhotonDetector.h @@ -150,6 +150,18 @@ class singlePhotonDetector { \param iy pixel y coordinate */ double getPedestalRMS(int ix, int iy){if (ix>=0 && ix=0 && iy=0 && ix=0 && iy