From 985b4d71b409c021a60eab8fdf987e7f72a5f069 Mon Sep 17 00:00:00 2001 From: Anna Bergamaschi Date: Thu, 5 Mar 2015 13:04:31 +0100 Subject: [PATCH 01/13] Added jungfrau1.0 data structure (bad) and added xmap, ymap and getPixel method to the slsDetectorData base class --- slsDetectorCalibration/jungfrau10ModuleData.h | 154 ++++++++++++++++++ slsDetectorCalibration/moench02CtbData.h | 4 +- slsDetectorCalibration/moench03CtbData.h | 7 +- slsDetectorCalibration/moench03ReadData.C | 57 +++---- slsDetectorCalibration/readMoench03Data.C | 36 ++-- slsDetectorCalibration/slsDetectorData.h | 30 +++- 6 files changed, 230 insertions(+), 58 deletions(-) create mode 100644 slsDetectorCalibration/jungfrau10ModuleData.h diff --git a/slsDetectorCalibration/jungfrau10ModuleData.h b/slsDetectorCalibration/jungfrau10ModuleData.h new file mode 100644 index 000000000..a107f5058 --- /dev/null +++ b/slsDetectorCalibration/jungfrau10ModuleData.h @@ -0,0 +1,154 @@ +#ifndef JUNGFRAU10MODULEDATA_H +#define JUNGFRAU10MODULEBDATA_H +#include "slsDetectorData.h" + + + +class jungfrau10ModuleData : public slsDetectorData { + + 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 + + */ + + + jungfrau10ModuleData(int ns=16384): slsDetectorData(256*4, 256*2, ns*2*32, NULL, NULL) , nadc(32), sc_width(64), sc_height(256) { + + + + int row, col; + + int isample; + int iadc; + int ix, iy; + + + + cout << nx << " " << ny << " " << dataSize << endl; + + for (iadc=0; iadc=dataSize) + cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl; + + } + + } + for (int i=0; i0) { + iframe++; + // cout << ib << "-" << endl; + return (char*)afifo_cont; + } else { + delete [] afifo_cont; + return NULL; + } + } + return NULL; + }; + + + + +}; + + + +#endif diff --git a/slsDetectorCalibration/moench02CtbData.h b/slsDetectorCalibration/moench02CtbData.h index 03ffd4ac5..37bf8304d 100644 --- a/slsDetectorCalibration/moench02CtbData.h +++ b/slsDetectorCalibration/moench02CtbData.h @@ -47,9 +47,11 @@ class moench02CtbData : public slsDetectorData { col=adc_nr[iadc]+(i%sc_width); row=i/sc_width; dataMap[row][col]=(32*i+iadc)*2; - if (dataMap[row][col]<0 || dataMap[row][col]>=2*160*160) + if (dataMap[row][col]<0 || dataMap[row][col]>=dataSize) { cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl; + } + } } for (int i=0; i { private: int iframe; - int *xmap, *ymap; int nadc; int sc_width; int sc_height; @@ -39,8 +38,6 @@ class moench03CtbData : public slsDetectorData { int iadc; int ix, iy; - xmap=new int[nx*ny]; - ymap=new int[nx*ny]; @@ -83,8 +80,6 @@ class moench03CtbData : public slsDetectorData { // cout << "data struct created" << endl; }; - void getPixel(int ip, int &x, int &y) {if (ip>=0 && ip { } if (ib>0) { iframe++; - cout << ib << "-" << endl; + // cout << ib << "-" << endl; return (char*)afifo_cont; } else { delete [] afifo_cont; diff --git a/slsDetectorCalibration/moench03ReadData.C b/slsDetectorCalibration/moench03ReadData.C index a2f268aff..c54a7655e 100644 --- a/slsDetectorCalibration/moench03ReadData.C +++ b/slsDetectorCalibration/moench03ReadData.C @@ -27,7 +27,7 @@ using namespace std; #define NR 400 -#define MY_DEBUG 1 +//#define MY_DEBUG 1 #ifdef MY_DEBUG #include @@ -47,7 +47,7 @@ TH2F *readImage(ifstream &filebin, TH2F *h2=NULL, TH2F *hped=NULL) { h2=new TH2F("h2","",400,0,400,400,0,400); h2->SetStats(kFALSE); } - cout << "." << endl; + // cout << "." << endl; for (int ix=0; ix<400; ix++) { for (int iy=0; iy<400; iy++) { // cout << decoder->getDataSize() << " " << decoder->getValue(buff,ix,iy)<< endl; @@ -77,7 +77,7 @@ TH2F *readImage(char *fname, int iframe=0, TH2F *hped=NULL) { if (hh==NULL) break; hh=readImage(filebin, h2, hped ); if (hh) - cout << "="<< endl; + ;// cout << "="<< endl; else { delete h2; return NULL; @@ -114,7 +114,7 @@ TH2F *calcPedestal(char *fformat, int runmin, int runmax){ } } delete [] buff; - cout << "="<< endl; + //cout << "="<< endl; ii++; } if (filebin.is_open()) @@ -146,8 +146,6 @@ Loops over data file to find single photons, fills the tree (and writes it to fi \param nbins number of bins for spectrum hists \param hmin histo minimum for spectrum hists \param hmax histo maximum for spectrum hists - \param sign sign of the spectrum to find hits - \param hc readout correlation coefficient with previous pixel \param xmin minimum x coordinate \param xmax maximum x coordinate \param ymin minimum y coordinate @@ -156,8 +154,10 @@ Loops over data file to find single photons, fills the tree (and writes it to fi \returns pointer to histo stack with cluster spectra */ -THStack *moench03ReadData(char *fformat, char *tit, int runmin, int runmax, int nbins=1500, int hmin=-500, int hmax=1000, int sign=1, double hc=0, int xmin=1, int xmax=NC-1, int ymin=1, int ymax=NR-1, int cmsub=0, int hitfinder=1) { - +THStack *moench03ReadData(char *fformat, char *tit, int runmin, int runmax, int nbins=1500, int hmin=-500, int hmax=1000, int xmin=1, int xmax=NC-1, int ymin=1, int ymax=NR-1, int cmsub=0, int hitfinder=1) { + double hc=0; + int sign=1; + moench03CtbData *decoder=new moench03CtbData(); cout << "decoder allocated " << endl; @@ -173,7 +173,7 @@ THStack *moench03ReadData(char *fformat, char *tit, int runmin, int runmax, int int iev=0; int nph=0; - singlePhotonDetector *filter=new singlePhotonDetector(decoder, 3, 5, sign, cmSub, 10, 100); + singlePhotonDetector *filter=new singlePhotonDetector(decoder, 3, 5, sign, cmSub, 100, 10); cout << "filter allocated " << endl; char *buff; @@ -270,11 +270,8 @@ THStack *moench03ReadData(char *fformat, char *tit, int runmin, int runmax, int nph=0; while ((buff=decoder->readNextFrame(filebin))) { + filter->newFrame(); - if (hitfinder) { - filter->newFrame(); - - //calculate pedestals and common modes if (cmsub) { // cout << "cm" << endl; for (ix=xmin-1; ixgetEventType(buff, ix, iy,0); } } - } + // if (hitfinder) { + + // //calculate pedestals and common modes + // } // cout << "new frame " << endl; for (ix=xmin-1; ixgetEventType(buff, ix, iy, cmsub); - -#ifdef MY_DEBUG - if (hitfinder) { - // if (iev%10==0) - he->SetBinContent(ix+1-xmin, iy+1-ymin, (int)thisEvent); - } -#endif - + thisEvent=filter->getEventType(buff, ix, iy, cmsub); // if (nf>10) { h1->Fill(filter->getClusterTotal(1), iy+NR*ix); - if (hitfinder) { + +#ifdef MY_DEBUG + // if (iev%10==0) + he->SetBinContent(ix+1-xmin, iy+1-ymin, (int)thisEvent); +#endif + + if (hitfinder) { if (thisEvent==PHOTON_MAX ) { nph++; @@ -315,7 +313,10 @@ THStack *moench03ReadData(char *fformat, char *tit, int runmin, int runmax, int } - } + } // else { + // filter->addToPedestal(decoder->getValue(buff,ix,iy, cmsub)); + + // } // } @@ -323,7 +324,7 @@ THStack *moench03ReadData(char *fformat, char *tit, int runmin, int runmax, int ////////////////////////////////////////////////////////// #ifdef MY_DEBUG - cout << iev << " " << h1->GetEntries() << " " << h2->GetEntries() << endl; + // cout << iev << " " << h1->GetEntries() << " " << h2->GetEntries() << endl; // if (iev%10==0) { // myC->Modified(); // myC->Update(); @@ -338,10 +339,10 @@ THStack *moench03ReadData(char *fformat, char *tit, int runmin, int runmax, int #endif nf++; - cout << "=" ; + // cout << "=" ; delete [] buff; } - cout << nph << endl; + // cout << nph << endl; if (filebin.is_open()) filebin.close(); else diff --git a/slsDetectorCalibration/readMoench03Data.C b/slsDetectorCalibration/readMoench03Data.C index 2bf22e111..8bbee83b3 100644 --- a/slsDetectorCalibration/readMoench03Data.C +++ b/slsDetectorCalibration/readMoench03Data.C @@ -12,31 +12,31 @@ void readMoench03Data(char *tit, int sign=1){ TFile *fout; THStack *hs; - sprintf(fname,"/scratch/roberto/photons.root"); + sprintf(fname,"/mnt/moenchnas/big_moench_xbox_20150223/Mo.root"); fout=new TFile(fname,"RECREATE"); - sprintf(fname,"/scratch/roberto/run_%%d.raw"); + sprintf(fname,"/mnt/moenchnas/big_moench_xbox_20150223/Mo_f0_%%d.raw"); - hs=moench03ReadData(fname,"photons",136,1135,1500,-500,2500,1,0.,1,399,1,399, 0,1); -// cout << "returned" << endl; -// hs->SetName(tit); -// hs->SetTitle(tit); -// cout << "name/title set" << endl; + hs=moench03ReadData(fname,"Mo",25133,25187,1500,-500,2500,1,399,1,399, 0,1); + cout << "returned" << endl; + hs->SetName(tit); + hs->SetTitle(tit); + cout << "name/title set" << endl; -// if (hs->GetHists()) { -// for (int i=0; i<3; i++) { -// if (hs->GetHists()->At(i)) { -// cout << i << " " ; -// (TH2F*)(hs->GetHists()->At(i))->Write(); -// } -// } -// cout << " histos written " << endl; -// } else -// cout << "no hists in stack " << endl; + if (hs->GetHists()) { + for (int i=0; i<3; i++) { + if (hs->GetHists()->At(i)) { + cout << i << " " ; + (TH2F*)(hs->GetHists()->At(i))->Write(); + } + } + cout << " histos written " << endl; + } else + cout << "no hists in stack " << endl; -// fout->Close(); + fout->Close(); diff --git a/slsDetectorCalibration/slsDetectorData.h b/slsDetectorCalibration/slsDetectorData.h index 8240a7484..b433960f3 100644 --- a/slsDetectorCalibration/slsDetectorData.h +++ b/slsDetectorCalibration/slsDetectorData.h @@ -19,6 +19,8 @@ class slsDetectorData { dataType **dataMask; /**< 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) */ int **dataROIMask; /**< Array of size nx*ny 1 if channel is good (or in the ROI), 0 if bad channel (or out of ROI) */ + int *xmap; + int *ymap; public: @@ -56,6 +58,16 @@ class slsDetectorData { dataROIMask[i][j]=1; } + + + xmap=new int[dataSize/sizeof(dataType)]; + ymap=new int[dataSize/sizeof(dataType)]; + + for (int i=0 ; i=0 && ip Date: Tue, 24 Mar 2015 10:42:22 +0100 Subject: [PATCH 02/13] 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 03/13] 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 04/13] 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)); + }; /** From 5e59c86d7249b599e5b208c85e3ebde1d7284f1a Mon Sep 17 00:00:00 2001 From: Anna Bergamaschi Date: Tue, 31 Mar 2015 14:41:06 +0200 Subject: [PATCH 05/13] Jungfrau10ModuleData modified --- slsDetectorCalibration/jungfrau10ModuleData.h | 61 ++++++++++--------- slsDetectorCalibration/moench02CtbData.h | 22 ------- slsDetectorCalibration/slsDetectorData.h | 28 ++++++--- 3 files changed, 50 insertions(+), 61 deletions(-) diff --git a/slsDetectorCalibration/jungfrau10ModuleData.h b/slsDetectorCalibration/jungfrau10ModuleData.h index a107f5058..39db07216 100644 --- a/slsDetectorCalibration/jungfrau10ModuleData.h +++ b/slsDetectorCalibration/jungfrau10ModuleData.h @@ -25,7 +25,7 @@ class jungfrau10ModuleData : public slsDetectorData { */ - jungfrau10ModuleData(int ns=16384): slsDetectorData(256*4, 256*2, ns*2*32, NULL, NULL) , nadc(32), sc_width(64), sc_height(256) { + jungfrau10ModuleData(int ns=16384): slsDetectorData(256*4, 256*2, 256*256*8*2, NULL, NULL, NULL) , iframe(0), nadc(32), sc_width(64), sc_height(256) { @@ -35,48 +35,49 @@ class jungfrau10ModuleData : public slsDetectorData { int iadc; int ix, iy; - + int ichip; - cout << nx << " " << ny << " " << dataSize << endl; + // cout << sizeof(uint16_t) << endl; for (iadc=0; iadc=dataSize) - cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl; + + +/* if (iadc=ny || col<0 || col>=nx) { + cout << "Wrong row, column " << row << " " << col << " " << iadc << " " << i << endl; + } else + dataMap[row][col]=(nadc*i+iadc)*2; + if (dataMap[row][col]<0 || dataMap[row][col]>=dataSize) + cout << "Error: pointer " << dataMap[row][col] << " out of range " << row << " " << col <<" " << iadc << " " << i << endl; + else { + xmap[nadc*i+iadc]=col; + ymap[nadc*i+iadc]=row; + + } } } - for (int i=0; i { int iadc; int ix, iy; - xmap=new int[nx*ny]; - ymap=new int[nx*ny]; - @@ -54,25 +51,6 @@ class moench02CtbData : public slsDetectorData { } } - for (int i=0; i Date: Tue, 31 Mar 2015 14:45:45 +0200 Subject: [PATCH 06/13] messing up while updating and merging --- slsDetectorCalibration/slsDetectorData.h | 84 ++++++++++++++++++++++++ slsDetectorCalibration/slsReceiverData.h | 4 +- 2 files changed, 87 insertions(+), 1 deletion(-) diff --git a/slsDetectorCalibration/slsDetectorData.h b/slsDetectorCalibration/slsDetectorData.h index 0030091d7..4f696ae29 100644 --- a/slsDetectorCalibration/slsDetectorData.h +++ b/slsDetectorCalibration/slsDetectorData.h @@ -112,6 +112,7 @@ class slsDetectorData { void setDataMap(int **dMap=NULL) { +<<<<<<< HEAD if (dMap==NULL) { for (int iy=0; iy>>>>>> 7ef3348d521f1a704f974b05dd763cd65253dd98 }; @@ -227,6 +245,58 @@ class slsDetectorData { return d^m; }; + + /** + + 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 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 + + */ + virtual dataType getChannel(char *data, int ix, int iy, int dr) { + dataType m=0, d=0; + uint64_t t; + int numBytes,divFactor,newix,pixelval; + + + if (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; + } + }; + /** Returns the value of the selected channel for the given dataset as double. @@ -238,6 +308,20 @@ class slsDetectorData { */ 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. diff --git a/slsDetectorCalibration/slsReceiverData.h b/slsDetectorCalibration/slsReceiverData.h index e07a757fd..4781cb36e 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 { @@ -89,7 +90,7 @@ public: dd+=packetSize; np++; // cout << pnum << " " << fn << " " << np << " " << dd << " " << dsize << endl; - if (np==nPackets) + if (np==nPackets){ if (pnum==nPackets) { // cout << "Frame found!" << endl; break; @@ -97,6 +98,7 @@ public: cout << "Too many packets for this frame! "<< fnum << " " << pnum << endl; retval=NULL; } + } } if (np0) From 48d672b918cd04af35535fc87c582c4ccec11d47 Mon Sep 17 00:00:00 2001 From: Anna Bergamaschi Date: Tue, 31 Mar 2015 15:07:53 +0200 Subject: [PATCH 07/13] Moved eiger related stuff from slsDetectorData to eigerHalfModule data, added xmap and ymap to slsDetectorData calss --- slsDetectorCalibration/eigerHalfModuleData.h | 57 ++++++++++++++++++ slsDetectorCalibration/slsDetectorData.h | 62 +++----------------- 2 files changed, 65 insertions(+), 54 deletions(-) diff --git a/slsDetectorCalibration/eigerHalfModuleData.h b/slsDetectorCalibration/eigerHalfModuleData.h index 1c878af8c..f81426bde 100644 --- a/slsDetectorCalibration/eigerHalfModuleData.h +++ b/slsDetectorCalibration/eigerHalfModuleData.h @@ -81,6 +81,57 @@ public: }; + /** + + 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 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 + + */ + virtual dataType getChannel(char *data, int ix, int iy=0, int dr=0) { + dataType m=0, d=0; + uint64_t t; + int numBytes,divFactor,newix,pixelval; + + + if (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; + } + }; + /** Returns the frame number for the given dataset. \param buff pointer to the dataset @@ -91,6 +142,12 @@ public: }; + + + + + + /** gets the packets number (last packet is labelled with 0 and is replaced with 40) \param buff pointer to the memory \returns packet number diff --git a/slsDetectorCalibration/slsDetectorData.h b/slsDetectorCalibration/slsDetectorData.h index 04ddc43d5..f5e42022c 100644 --- a/slsDetectorCalibration/slsDetectorData.h +++ b/slsDetectorCalibration/slsDetectorData.h @@ -18,7 +18,8 @@ class slsDetectorData { int **dataMap; /**< Array of size nx*ny storing the pointers to the data in the dataset (as offset)*/ dataType **dataMask; /**< 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) */ int **dataROIMask; /**< Array of size nx*ny 1 if channel is good (or in the ROI), 0 if bad channel (or out of ROI) */ - + int *xmap; + int *ymap; public: @@ -55,7 +56,9 @@ class slsDetectorData { for (int j=0; j=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; - } - }; - /** Returns the value of the selected channel for the given dataset as double. From 904462b582324458c751db0e5628d9261d957414 Mon Sep 17 00:00:00 2001 From: Anna Bergamaschi Date: Wed, 1 Apr 2015 13:04:27 +0200 Subject: [PATCH 08/13] xmap, ymap added again to slsDetectorData --- slsDetectorCalibration/slsDetectorData.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/slsDetectorCalibration/slsDetectorData.h b/slsDetectorCalibration/slsDetectorData.h index f5e42022c..643adad9a 100644 --- a/slsDetectorCalibration/slsDetectorData.h +++ b/slsDetectorCalibration/slsDetectorData.h @@ -40,6 +40,8 @@ class slsDetectorData { slsDetectorData(int npx, int npy, int dsize, int **dMap=NULL, dataType **dMask=NULL, int **dROI=NULL): nx(npx), ny(npy), dataSize(dsize) { + xmap=new int[nx*ny]; + ymap=new int[nx*ny]; dataMask=new dataType*[ny]; for(int i = 0; i < ny; i++) { @@ -56,8 +58,8 @@ class slsDetectorData { for (int j=0; j Date: Tue, 14 Apr 2015 17:13:09 +0200 Subject: [PATCH 09/13] eiger mapping for 32 bit done --- slsDetectorCalibration/eigerHalfModuleData.h | 112 ++++++++++++++----- slsDetectorCalibration/slsDetectorData.h | 10 +- slsDetectorCalibration/slsReceiverData.h | 2 +- 3 files changed, 87 insertions(+), 37 deletions(-) diff --git a/slsDetectorCalibration/eigerHalfModuleData.h b/slsDetectorCalibration/eigerHalfModuleData.h index 1c878af8c..553e9dbd3 100644 --- a/slsDetectorCalibration/eigerHalfModuleData.h +++ b/slsDetectorCalibration/eigerHalfModuleData.h @@ -19,8 +19,8 @@ public: */ - 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){ + eigerHalfModuleData(int dr, int np, int bsize, int dsize, bool top, double c=0): slsReceiverData(xpixels, ypixels, np, bsize), + xtalk(c), bufferSize(bsize), dataSize(dsize), dynamicRange(dr), numberOfPackets(np){ int **dMap; @@ -42,29 +42,60 @@ public: 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; + + if(top){ + 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; + } } } } } +/* + else{ + iPacket1 = (totalNumberOfBytes/2) - 1040 - 8; + iPacket2 = totalNumberOfBytes - 1040 - 8; + 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; + } + } + } + } + } +*/ @@ -87,7 +118,7 @@ public: \returns frame number */ int getFrameNumber(char *buff){ - return htonl(*(unsigned int*)((eiger_image_header *)((char*)(buff)))->fnum); + return(*(unsigned int*)(((eiger_packet_header *)((char*)buff))->num1)); }; @@ -96,7 +127,31 @@ public: \returns packet number */ int getPacketNumber(char *buff){ - return htonl(*(unsigned int*)((eiger_packet_header *)((char*)(buff)))->num2); + /*other way roud if its a bottom*/ + +#ifdef VERY_DEBUG + cprintf(RED, "\n0x%x - %d - %d", + (*(uint8_t*)(((eiger_packet_header *)((char*)(buff)))->num3)), + (*(uint8_t*)(((eiger_packet_header *)((char*)(buff)))->num4)), + (*(uint16_t*)(((eiger_packet_header *)((char*)(buff)))->num2))); +#endif + //32 bit packet number written in num2 + if(dynamicRange == 32){ + //both ports have same packet numbers, so reconstruct + if((*(uint8_t*)(((eiger_packet_header *)((char*)buff))->num3))){ + return ((*(uint16_t*)(((eiger_packet_header *)((char*)buff))->num2))+(numberOfPackets/2) +1); + }else{ + return ((*(uint16_t*)(((eiger_packet_header *)((char*)buff))->num2))+1); + } + } + else{ + //both ports have same packet numbers, so reconstruct + if((*(uint8_t*)(((eiger_packet_header *)((char*)buff))->num3))){ + return ((*(uint8_t*)(((eiger_packet_header *)((char*)buff))->num4))+(numberOfPackets/2) +1); + }else{ + return ((*(uint8_t*)(((eiger_packet_header *)((char*)buff))->num4))+1); + } + } }; @@ -146,21 +201,16 @@ private: const int bufferSize; const int dataSize; const int dynamicRange; + const int numberOfPackets; - /** structure of an eiger image header*/ - typedef struct - { - unsigned char header_before[20]; - unsigned char fnum[4]; - unsigned char header_after[24]; - } eiger_image_header; - /** structure of an eiger image header*/ typedef struct { unsigned char num1[4]; - unsigned char num2[4]; + unsigned char num2[2]; + unsigned char num3[1]; + unsigned char num4[1]; } eiger_packet_header; }; diff --git a/slsDetectorCalibration/slsDetectorData.h b/slsDetectorCalibration/slsDetectorData.h index 04ddc43d5..cb364bc04 100644 --- a/slsDetectorCalibration/slsDetectorData.h +++ b/slsDetectorCalibration/slsDetectorData.h @@ -211,14 +211,14 @@ class slsDetectorData { */ virtual dataType getChannel(char *data, int ix, int iy, int dr) { - dataType m=0, d=0; + dataType m=0; uint64_t t; int numBytes,divFactor,newix,pixelval; if (ix>=0 && ix=0 && iy=0 && dataMap[iy][ix]nPackets) { cout << "Bad packet number " << pnum << " frame "<< fn << endl; From 5731ead4cba1d4ce9a11e9b03bfb9d23c823eff2 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Wed, 15 Apr 2015 14:38:32 +0200 Subject: [PATCH 10/13] eiger top mapping done. bottom doesnt work --- slsDetectorCalibration/eigerHalfModuleData.h | 63 +++++++++++++++----- 1 file changed, 48 insertions(+), 15 deletions(-) diff --git a/slsDetectorCalibration/eigerHalfModuleData.h b/slsDetectorCalibration/eigerHalfModuleData.h index 553e9dbd3..34ee0f7de 100644 --- a/slsDetectorCalibration/eigerHalfModuleData.h +++ b/slsDetectorCalibration/eigerHalfModuleData.h @@ -20,7 +20,7 @@ public: eigerHalfModuleData(int dr, int np, int bsize, int dsize, bool top, double c=0): slsReceiverData(xpixels, ypixels, np, bsize), - xtalk(c), bufferSize(bsize), dataSize(dsize), dynamicRange(dr), numberOfPackets(np){ + xtalk(c), bufferSize(bsize), dataSize(dsize), dynamicRange(dr), numberOfPackets(np), top(top){ int **dMap; @@ -40,6 +40,7 @@ public: int iPacket1 = 8; int iPacket2 = (totalNumberOfBytes/2) + 8; int iData1 = 0, iData2 = 0; + /*int iData=0*/ int iPort; @@ -51,6 +52,7 @@ public: dMap[ir][ic] = iPacket1; iPacket1 += (dynamicRange / 8); iData1 +=(dynamicRange / 8); + //increment header if(iData1 >= dataSize){ iPacket1 += 16; iData1 = 0; @@ -59,28 +61,38 @@ public: dMap[ir][ic] = iPacket2; iPacket2 += (dynamicRange / 8); iData2 +=(dynamicRange / 8); + //increment header if(iData2 >= dataSize){ iPacket2 += 16; iData2 = 0; } } + /*iData +=(dynamicRange / 8); + //increment header + if(iData1 >= dataSize){ + iPacket1 += 16; + iData1 = 0; + }*/ } } } -/* + else{ - iPacket1 = (totalNumberOfBytes/2) - 1040 - 8; - iPacket2 = totalNumberOfBytes - 1040 - 8; + /*int iData=0;*/ + iData1 = 0; iData2 = 0; + iPacket1 = (totalNumberOfBytes/2) - bufferSize - 8; + iPacket2 = totalNumberOfBytes - bufferSize - 8; for (int ir=0; ir= dataSize){ - iPacket1 += 16; + iPacket1 -= (dataSize*2); + iPacket1 -= 16; iData1 = 0; } }else{ @@ -88,14 +100,24 @@ public: iPacket2 += (dynamicRange / 8); iData2 +=(dynamicRange / 8); if(iData2 >= dataSize){ - iPacket2 += 16; + iPacket2 -= (dataSize*2); + iPacket2 -= 16; iData2 = 0; } } + /*iData +=(dynamicRange / 8); + //increment header + if(iData >= dataSize){ + iPacket1 -= (bufferSize*2); + iPacket2 -= (bufferSize*2); + iPacket1 += 16; + iPacket2 += 16; + iData = 0; + }*/ } } } -*/ + @@ -127,8 +149,6 @@ public: \returns packet number */ int getPacketNumber(char *buff){ - /*other way roud if its a bottom*/ - #ifdef VERY_DEBUG cprintf(RED, "\n0x%x - %d - %d", (*(uint8_t*)(((eiger_packet_header *)((char*)(buff)))->num3)), @@ -137,19 +157,31 @@ public: #endif //32 bit packet number written in num2 if(dynamicRange == 32){ - //both ports have same packet numbers, so reconstruct + //both ports have same packet numbers, so reconstruct, ports interchanged for bottom if((*(uint8_t*)(((eiger_packet_header *)((char*)buff))->num3))){ - return ((*(uint16_t*)(((eiger_packet_header *)((char*)buff))->num2))+(numberOfPackets/2) +1); + if (top) + return ((*(uint16_t*)(((eiger_packet_header *)((char*)buff))->num2))+(numberOfPackets/2) +1); + else + return ((*(uint16_t*)(((eiger_packet_header *)((char*)buff))->num2))+1); }else{ - return ((*(uint16_t*)(((eiger_packet_header *)((char*)buff))->num2))+1); + if (top) + return ((*(uint16_t*)(((eiger_packet_header *)((char*)buff))->num2))+1); + else + return ((*(uint16_t*)(((eiger_packet_header *)((char*)buff))->num2))+(numberOfPackets/2) +1); } } else{ //both ports have same packet numbers, so reconstruct if((*(uint8_t*)(((eiger_packet_header *)((char*)buff))->num3))){ - return ((*(uint8_t*)(((eiger_packet_header *)((char*)buff))->num4))+(numberOfPackets/2) +1); + if (top) + return ((*(uint8_t*)(((eiger_packet_header *)((char*)buff))->num4))+(numberOfPackets/2) +1); + else + return ((*(uint8_t*)(((eiger_packet_header *)((char*)buff))->num4))+1); }else{ - return ((*(uint8_t*)(((eiger_packet_header *)((char*)buff))->num4))+1); + if (top) + return ((*(uint8_t*)(((eiger_packet_header *)((char*)buff))->num4))+1); + else + return ((*(uint8_t*)(((eiger_packet_header *)((char*)buff))->num4))+(numberOfPackets/2) +1); } } }; @@ -202,6 +234,7 @@ private: const int dataSize; const int dynamicRange; const int numberOfPackets; + bool top; /** structure of an eiger image header*/ From 83a766914f62124f52f7c1c8540e11f0824677b2 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Wed, 15 Apr 2015 14:48:27 +0200 Subject: [PATCH 11/13] not necessary merge --- slsDetectorCalibration/slsDetectorData.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/slsDetectorCalibration/slsDetectorData.h b/slsDetectorCalibration/slsDetectorData.h index 0316b8ec6..d5f567595 100644 --- a/slsDetectorCalibration/slsDetectorData.h +++ b/slsDetectorCalibration/slsDetectorData.h @@ -211,8 +211,6 @@ class slsDetectorData { /** - -<<<<<<< HEAD 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 ix pixel number in the x direction @@ -263,9 +261,6 @@ class slsDetectorData { }; /** - -======= ->>>>>>> b3dac953736499019603c2201df6e7eb45cc890c 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 From 0c2bd83e968ea7b161629b8f3d524c399a12287e Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Wed, 15 Apr 2015 15:49:52 +0200 Subject: [PATCH 12/13] moved getchannel back to slsdetectordata as it doesnt work for eiger --- slsDetectorCalibration/eigerHalfModuleData.h | 47 -------------------- slsDetectorCalibration/slsDetectorData.h | 18 +++++--- 2 files changed, 11 insertions(+), 54 deletions(-) diff --git a/slsDetectorCalibration/eigerHalfModuleData.h b/slsDetectorCalibration/eigerHalfModuleData.h index 74e81d7b9..f6b301d82 100644 --- a/slsDetectorCalibration/eigerHalfModuleData.h +++ b/slsDetectorCalibration/eigerHalfModuleData.h @@ -134,56 +134,9 @@ public: }; - /** - - 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 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 - - */ - virtual dataType getChannel(char *data, int ix, int iy=0, int dr=0) { - dataType m=0, d=0; - uint64_t t; - int numBytes,divFactor,newix,pixelval; - if (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; - } - }; /** Returns the frame number for the given dataset. diff --git a/slsDetectorCalibration/slsDetectorData.h b/slsDetectorCalibration/slsDetectorData.h index d5f567595..c9637aa5a 100644 --- a/slsDetectorCalibration/slsDetectorData.h +++ b/slsDetectorCalibration/slsDetectorData.h @@ -105,9 +105,9 @@ class slsDetectorData { for (int ix=0; ix=0 && ix=0 && iy=0 && dataMap[iy][ix]=0 && ix=0 && iy=0 && dataMap[iy][ix] Date: Tue, 19 May 2015 10:12:57 +0200 Subject: [PATCH 13/13] mapping of bottom and top for all bit modes work --- slsDetectorCalibration/eigerHalfModuleData.h | 108 ++++++++++++------- slsDetectorCalibration/slsDetectorData.h | 2 +- 2 files changed, 69 insertions(+), 41 deletions(-) diff --git a/slsDetectorCalibration/eigerHalfModuleData.h b/slsDetectorCalibration/eigerHalfModuleData.h index f6b301d82..381456a54 100644 --- a/slsDetectorCalibration/eigerHalfModuleData.h +++ b/slsDetectorCalibration/eigerHalfModuleData.h @@ -40,18 +40,23 @@ public: int iPacket1 = 8; int iPacket2 = (totalNumberOfBytes/2) + 8; int iData1 = 0, iData2 = 0; - /*int iData=0*/ + int increment = (dynamicRange/8); + int ic_increment = 1; + if (dynamicRange == 4) { + increment = 1; + ic_increment = 2; + } int iPort; if(top){ for (int ir=0; ir= dataSize){ iPacket1 += 16; @@ -59,61 +64,84 @@ public: } }else{ dMap[ir][ic] = iPacket2; - iPacket2 += (dynamicRange / 8); - iData2 +=(dynamicRange / 8); + iPacket2 += increment; + iData2 += increment; //increment header if(iData2 >= dataSize){ iPacket2 += 16; iData2 = 0; } } - /*iData +=(dynamicRange / 8); - //increment header - if(iData1 >= dataSize){ - iPacket1 += 16; - iData1 = 0; - }*/ } } } + //bottom else{ - /*int iData=0;*/ iData1 = 0; iData2 = 0; - iPacket1 = (totalNumberOfBytes/2) - bufferSize - 8; - iPacket2 = totalNumberOfBytes - bufferSize - 8; + int numbytesperlineperport = 1024; + if (dynamicRange == 8) + numbytesperlineperport = 512; + else if (dynamicRange == 4) + numbytesperlineperport = 256; + else if (dynamicRange == 32) + numbytesperlineperport = 2048; + + + + iPacket1 = (totalNumberOfBytes/2) - numbytesperlineperport - 8; + iPacket2 = totalNumberOfBytes - numbytesperlineperport - 8; + if (dynamicRange == 32){ + iPacket1 -= 16; + iPacket2 -= 16; + } + for (int ir=0; ir= dataSize){ - iPacket1 -= (dataSize*2); - iPacket1 -= 16; - iData1 = 0; - } - }else{ - dMap[ir][ic] = iPacket2; - iPacket2 += (dynamicRange / 8); - iData2 +=(dynamicRange / 8); - if(iData2 >= dataSize){ - iPacket2 -= (dataSize*2); - iPacket2 -= 16; - iData2 = 0; + iPacket1 += increment; + iData1 += increment; + if(dynamicRange == 32){ + if(iData1 == numbytesperlineperport){ + iPacket1 -= (numbytesperlineperport*2 + 16*3); + iData1 = 0; + } + if(iData1 == dataSize){ + iPacket1 += 16; + } + }else if((iData1 % numbytesperlineperport) == 0){ + iPacket1 -= (numbytesperlineperport*2); + if(iData1 == dataSize){ + iPacket1 -= 16; + iData1 = 0; + } + + } + } + //other port + else{ + dMap[ir][ic] = iPacket2; + iPacket2 += increment; + iData2 += increment; + if(dynamicRange == 32){ + if(iData2 == numbytesperlineperport){ + iPacket2 -= (numbytesperlineperport*2 + 16*3); + iData2 = 0; + } + if(iData2 == dataSize){ + iPacket2 += 16; + } + }else if((iData2 % numbytesperlineperport) == 0){ + iPacket2 -= (numbytesperlineperport*2); + if(iData2 == dataSize){ + iPacket2 -= 16; + iData2 = 0; + } } } - /*iData +=(dynamicRange / 8); - //increment header - if(iData >= dataSize){ - iPacket1 -= (bufferSize*2); - iPacket2 -= (bufferSize*2); - iPacket1 += 16; - iPacket2 += 16; - iData = 0; - }*/ } } } diff --git a/slsDetectorCalibration/slsDetectorData.h b/slsDetectorCalibration/slsDetectorData.h index c9637aa5a..b130b7aa2 100644 --- a/slsDetectorCalibration/slsDetectorData.h +++ b/slsDetectorCalibration/slsDetectorData.h @@ -228,7 +228,7 @@ class slsDetectorData { uint64_t t; int numBytes,divFactor,newix,pixelval; - +//cout <<"ix:"<=0 && ix=0 && iy=0 && dataMap[iy][ix]