From cadb4cff93783771716baf11e7379539c3c799e2 Mon Sep 17 00:00:00 2001 From: Anna Bergamaschi Date: Wed, 21 Aug 2019 16:27:14 +0200 Subject: [PATCH 1/5] moench02 common mode moved to new structure --- slsDetectorCalibration/moenchCommonMode.h | 56 +++++++++---------- .../moenchExecutables/moenchZmqProcess.cpp | 2 +- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/slsDetectorCalibration/moenchCommonMode.h b/slsDetectorCalibration/moenchCommonMode.h index dba0df2b7..b34428113 100644 --- a/slsDetectorCalibration/moenchCommonMode.h +++ b/slsDetectorCalibration/moenchCommonMode.h @@ -1,7 +1,7 @@ #ifndef MOENCHCOMMONMODE_H #define MOENCHCOMMONMODE_H -#include "commonModeSubtraction.h" +#include "commonModeSubtractionNew.h" class moenchCommonMode : public commonModeSubtraction { /** @short class to calculate the common mode noise for moench02 i.e. on 4 supercolumns separately */ @@ -9,35 +9,35 @@ class moenchCommonMode : public commonModeSubtraction { /** constructor - initalizes a commonModeSubtraction with 4 different regions of interest \param nn number of samples for the moving average */ - moenchCommonMode(int nn=1000) : commonModeSubtraction(nn,4){} ; + moenchCommonMode(int nn=1000) : commonModeSubtraction(0){} ; - /** add value to common mode as a function of the pixel value, subdividing the region of interest in the 4 supercolumns of 40 columns each; - \param val value to add to the common mode - \param ix pixel coordinate in the x direction - \param iy pixel coordinate in the y direction - */ - virtual void addToCommonMode(double val, int ix=0, int iy=0) { - (void) iy; - int isc=ix/40; - if (isc>=0 && isc=0 && isc0) return cmPed[isc]/nCm[isc]-cmStat[isc].Mean(); - } - return 0; - }; + /* /\** add value to common mode as a function of the pixel value, subdividing the region of interest in the 4 supercolumns of 40 columns each; */ + /* \param val value to add to the common mode */ + /* \param ix pixel coordinate in the x direction */ + /* \param iy pixel coordinate in the y direction */ + /* *\/ */ + /* virtual void addToCommonMode(double val, int ix=0, int iy=0) { */ + /* (void) iy; */ + /* int isc=ix/40; */ + /* if (isc>=0 && isc=0 && isc0) return cmPed[isc]/nCm[isc]-cmStat[isc].Mean(); */ + /* } */ + /* return 0; */ + /* }; */ }; diff --git a/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp b/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp index e256dd5d2..c1517b970 100644 --- a/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp +++ b/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp @@ -114,7 +114,7 @@ int main(int argc, char *argv[]) { char dummybuff[size]; int ncol_cm=20; - double xt_ghost=0.00045; + double xt_ghost=0.0004; moench03CommonMode *cm=new moench03CommonMode(ncol_cm); moench03GhostSummation *gs=new moench03GhostSummation(det, xt_ghost); double *gainmap=NULL; From 1b5e9397487dca43b4e9c3ee5c87a725d89c02ce Mon Sep 17 00:00:00 2001 From: Anna Bergamaschi Date: Wed, 21 Aug 2019 16:57:54 +0200 Subject: [PATCH 2/5] Added 10Gb data structures for moench04 (to be tested) --- ctbGui/ctbAcquisition.cpp | 6 +- .../moench04CtbReceiver10GbData.h | 294 ++++++++++++++++++ .../dataStructures/moench04CtbZmq10GbData.h | 279 +++++++++++++++++ 3 files changed, 578 insertions(+), 1 deletion(-) create mode 100644 slsDetectorCalibration/dataStructures/moench04CtbReceiver10GbData.h create mode 100644 slsDetectorCalibration/dataStructures/moench04CtbZmq10GbData.h diff --git a/ctbGui/ctbAcquisition.cpp b/ctbGui/ctbAcquisition.cpp index 8246d6af8..5dff7f769 100755 --- a/ctbGui/ctbAcquisition.cpp +++ b/ctbGui/ctbAcquisition.cpp @@ -39,6 +39,7 @@ #include "Mythen3_02_jctbData.h" #include "adcSar2_jctbData.h" #include "moench04CtbZmqData.h" +#include "moench04CtbZmq10GbData.h" #include "deserializer.h" #include "detectorData.h" @@ -1197,7 +1198,10 @@ void ctbAcquisition::changeDetector(){ // commonMode=new moench03CommonMode(); break; case MOENCH04: - dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples); + if (myDet->enableTenGigabitEthernet(-1)) + dataStructure=new moench04CtbZmq10GbData(nAnalogSamples, nDigitalSamples); + else + dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples); cout << "MOENCH 0.4!" << endl; commonMode=new moench03CommonMode(); break; diff --git a/slsDetectorCalibration/dataStructures/moench04CtbReceiver10GbData.h b/slsDetectorCalibration/dataStructures/moench04CtbReceiver10GbData.h new file mode 100644 index 000000000..916f95c65 --- /dev/null +++ b/slsDetectorCalibration/dataStructures/moench04CtbReceiver10GbData.h @@ -0,0 +1,294 @@ +#ifndef MOENCH04REC10GBDATA_H +#define MOENCH04REC10GBDATA_H +#include "slsDetectorData.h" + +//#define VERSION_V2 + /** + @short structure for a Detector Packet or Image Header + @li frameNumber is the frame number + @li expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others) + @li packetNumber is the packet number + @li bunchId is the bunch id from beamline + @li timestamp is the time stamp with 10 MHz clock + @li modId is the unique module id (unique even for left, right, top, bottom) + @li xCoord is the x coordinate in the complete detector system + @li yCoord is the y coordinate in the complete detector system + @li zCoord is the z coordinate in the complete detector system + @li debug is for debugging purposes + @li roundRNumber is the round robin set number + @li detType is the detector type see :: detectorType + @li version is the version number of this structure format + */ + typedef struct { + uint64_t frameNumber; /**< is the frame number */ + uint32_t expLength; /**< is the subframe number (32 bit eiger) or real time exposure time in 100ns (others) */ + uint32_t packetNumber; /**< is the packet number */ + uint64_t bunchId; /**< is the bunch id from beamline */ + uint64_t timestamp; /**< is the time stamp with 10 MHz clock */ + uint16_t modId; /**< is the unique module id (unique even for left, right, top, bottom) */ + uint16_t xCoord; /**< is the x coordinate in the complete detector system */ + uint16_t yCoord; /**< is the y coordinate in the complete detector system */ + uint16_t zCoord; /**< is the z coordinate in the complete detector system */ + uint32_t debug; /**< is for debugging purposes */ + uint16_t roundRNumber; /**< is the round robin set number */ + uint8_t detType; /**< is the detector type see :: detectorType */ + uint8_t version; /**< is the version number of this structure format */ + uint64_t packetCaught[8]; /**< is the version number of this structure format */ + + } sls_detector_header; + + + + +class moench04CtbReceiver10GbData : public slsDetectorData { + + private: + + int iframe; + int nadc; + int sc_width; + int sc_height; + const int aSamples; + const int dSamples; + + + 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 + + */ + moench04CtbReceiver10GbData(int nas=5000, int nds=0): slsDetectorData(400, 400, nas*2*32+sizeof(sls_detector_header)+nds*8), aSamples(nas), dSamples(nds) { + + int nadc=32; + int sc_width=25; + int sc_height=200; + + int adc_nr[32]={9, 8,11,10,13,12,15,14,1,0,3,2,5,4,7,6,23,22,21,20,19,18,17,16,31,30,29,28,27,26,25,24 }; + + int row, col; + + int isample; + int iadc; + int ix, iy; + + int npackets=40; + int i; + int adc4(0); + + for (int ip=0; ip0) { + row=199-i/sc_width; + } else { + row=200+i/sc_width; + } + if (nds>0) + dataMap[row][col]=sizeof(sls_detector_header)+((nadc+4)*i+iadc)*2;//+16*(ip+1); + else + dataMap[row][col]=sizeof(sls_detector_header)+(nadc*i+iadc)*2;//+16*(ip+1); + if (dataMap[row][col]<0 || dataMap[row][col]>=aSamples*2*32) + cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl; + } + } + } + } + + int ipacket; + int ibyte; + int ii=0; + for (ibyte=0; ibyteframeNumber;};//*((int*)(buff+5))&0xffffff;}; + + /** + + Returns the packet number for the given dataset. purely virtual func + \param buff pointer to the dataset + \returns packet number number + + + + */ + int getPacketNumber(char *buff){return ((sls_detector_header*)buff)->packetNumber;}//((*(((int*)(buff+4))))&0xff)+1;}; + +/* /\** */ + +/* Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func */ +/* \param data pointer to the memory to be analyzed */ +/* \param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot */ +/* \param dsize size of the memory slot to be analyzed */ +/* \returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found */ + +/* *\/ */ +/* virtual char *findNextFrame(char *data, int &ndata, int dsize){ndata=dsize; setDataSize(dsize); return data;}; */ + + +/* /\** */ + +/* Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors! */ +/* \param filebin input file stream (binary) */ +/* \returns pointer to the begin of the last good frame, NULL if no frame is found or last frame is incomplete */ + +/* *\/ */ +/* virtual char *readNextFrame(ifstream &filebin){ */ +/* // int afifo_length=0; */ +/* uint16_t *afifo_cont; */ +/* int ib=0; */ +/* if (filebin.is_open()) { */ +/* afifo_cont=new uint16_t[dataSize/2]; */ +/* while (filebin.read(((char*)afifo_cont)+ib,2)) { */ +/* ib+=2; */ +/* if (ib==dataSize) break; */ +/* } */ +/* if (ib>0) { */ +/* iframe++; */ +/* // cout << ib << "-" << endl; */ +/* return (char*)afifo_cont; */ +/* } else { */ +/* delete [] afifo_cont; */ +/* return NULL; */ +/* } */ +/* } */ +/* return NULL; */ +/* }; */ + + + virtual char *readNextFrame(ifstream &filebin) { + int ff=-1, np=-1; + return readNextFrame(filebin, ff, np); + }; + + virtual char *readNextFrame(ifstream &filebin, int &ff) { + int np=-1; + return readNextFrame(filebin, ff, np); + }; + + virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) { + char *data=new char[dataSize]; + char *d=readNextFrame(filebin, ff, np, data); + if (d==NULL) {delete [] data; data=NULL;} + return data; + } + + + + + virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) { + char *retval=0; + int nd; + int fnum = -1; + np=0; + int pn; + + // cout << dataSize << endl; + if (ff>=0) + fnum=ff; + + if (filebin.is_open()) { + if (filebin.read(data, dataSize) ){ + ff=getFrameNumber(data); + np=getPacketNumber(data); + return data; + } + } + return NULL; + + + + }; + + + + /** + + Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func + \param data pointer to the memory to be analyzed + \param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot + \param dsize size of the memory slot to be analyzed + \returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found + + */ + virtual char *findNextFrame(char *data, int &ndata, int dsize){ + if (dsize { + + private: + + int iframe; + int nadc; + int sc_width; + int sc_height; + const int aSamples; + const int dSamples; + + + 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 + + */ + moench04CtbZmq10GbData(int nas=5000, int nds=0): slsDetectorData(400, 400, nas*2*32+nds*8), aSamples(nas), dSamples(nds), nadc(32), sc_width(25), sc_height(200) { + + + int adc_nr[32]={9, 8,11,10,13,12,15,14,1,0,3,2,5,4,7,6,23,22,21,20,19,18,17,16,31,30,29,28,27,26,25,24 }; + + int row, col; + + int isample; + int iadc; + int ix, iy; + + int npackets=40; + int i; + int adc4(0); + + for (int is=0; is0) + dataMap[row][col]=((nadc+4)*i+iadc)*2;//+16*(ip+1); + else + dataMap[row][col]=(nadc*i+iadc)*2;//+16*(ip+1); + if (dataMap[row][col]<0 || dataMap[row][col]>=aSamples*2*32) + cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl; + } + } + } + + + /* for (ibyte=0; ibyte=32) return 0; + if (ibit[isc]<0 || ibit[isc]>=64) return 0; + if (dSamples>isample) { + ptr=data+32*(isample+1)+8*isample; + sample=*((uint64_t*)ptr); + cout << isc << " " << ibit[isc] << " " << isample << hex << sample << dec << endl; + if (sample & (1<frameNumber;};//*((int*)(buff+5))&0xffffff;}; + + /** + + Returns the packet number for the given dataset. purely virtual func + \param buff pointer to the dataset + \returns packet number number + + + + */ + //int getPacketNumber(char *buff){return ((sls_detector_header*)buff)->packetNumber;}//((*(((int*)(buff+4))))&0xff)+1;}; + +/* /\** */ + +/* Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func */ +/* \param data pointer to the memory to be analyzed */ +/* \param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot */ +/* \param dsize size of the memory slot to be analyzed */ +/* \returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found */ + +/* *\/ */ +/* virtual char *findNextFrame(char *data, int &ndata, int dsize){ndata=dsize; setDataSize(dsize); return data;}; */ + + +/* /\** */ + +/* Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors! */ +/* \param filebin input file stream (binary) */ +/* \returns pointer to the begin of the last good frame, NULL if no frame is found or last frame is incomplete */ + +/* *\/ */ +/* virtual char *readNextFrame(ifstream &filebin){ */ +/* // int afifo_length=0; */ +/* uint16_t *afifo_cont; */ +/* int ib=0; */ +/* if (filebin.is_open()) { */ +/* afifo_cont=new uint16_t[dataSize/2]; */ +/* while (filebin.read(((char*)afifo_cont)+ib,2)) { */ +/* ib+=2; */ +/* if (ib==dataSize) break; */ +/* } */ +/* if (ib>0) { */ +/* iframe++; */ +/* // cout << ib << "-" << endl; */ +/* return (char*)afifo_cont; */ +/* } else { */ +/* delete [] afifo_cont; */ +/* return NULL; */ +/* } */ +/* } */ +/* return NULL; */ +/* }; */ + + + virtual char *readNextFrame(ifstream &filebin) { + int ff=-1, np=-1; + return readNextFrame(filebin, ff, np); + }; + + virtual char *readNextFrame(ifstream &filebin, int &ff) { + int np=-1; + return readNextFrame(filebin, ff, np); + }; + + virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) { + char *data=new char[dataSize]; + char *d=readNextFrame(filebin, ff, np, data); + if (d==NULL) {delete [] data; data=NULL;} + return data; + } + + + + + virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) { + char *retval=0; + int nd; + int fnum = -1; + np=0; + int pn; + + // cout << dataSize << endl; + if (ff>=0) + fnum=ff; + + if (filebin.is_open()) { + if (filebin.read(data, dataSize) ){ + ff=getFrameNumber(data); + // np=getPacketNumber(data); + return data; + } + } + return NULL; + + + + }; + + + + /** + + Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func + \param data pointer to the memory to be analyzed + \param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot + \param dsize size of the memory slot to be analyzed + \returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found + + */ + virtual char *findNextFrame(char *data, int &ndata, int dsize){ + if (dsize Date: Wed, 21 Aug 2019 17:19:54 +0200 Subject: [PATCH 3/5] Modified waveform plots for 10Gb (to be tested) --- ctbGui/ctbAcquisition.cpp | 55 +++++++++++++++---- ctbGui/ctbAcquisition.h | 1 + .../dataStructures/moench04CtbZmq10GbData.h | 15 ++++- 3 files changed, 59 insertions(+), 12 deletions(-) diff --git a/ctbGui/ctbAcquisition.cpp b/ctbGui/ctbAcquisition.cpp index 5dff7f769..d621dc7aa 100755 --- a/ctbGui/ctbAcquisition.cpp +++ b/ctbGui/ctbAcquisition.cpp @@ -48,7 +48,7 @@ using namespace std; -ctbAcquisition::ctbAcquisition(TGVerticalFrame *page, multiSlsDetector *det) : TGGroupFrame(page,"Acquisition",kVerticalFrame), myDet(det), myCanvas(NULL), globalPlot(0), nAnalogSamples(1), nDigitalSamples(1), dataStructure(NULL), photonFinder(NULL), cmSub(0), dBitMask(0xffffffffffffffff), deserializer(0) { +ctbAcquisition::ctbAcquisition(TGVerticalFrame *page, multiSlsDetector *det) : TGGroupFrame(page,"Acquisition",kVerticalFrame), myDet(det), myCanvas(NULL), globalPlot(0), nAnalogSamples(1), nDigitalSamples(1), dataStructure(NULL), photonFinder(NULL), cmSub(0), tenG(0), dBitMask(0xffffffffffffffff), deserializer(0) { adcFit=NULL; bitPlot=NULL; @@ -894,8 +894,18 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") { } } else ndbit=dbitlist.size(); - - dsize=nadc*2*nAnalogSamples+ndbit*(nDigitalSamples-dBitOffset/8)/8; + if (tenG){ + + if (nDigitalSamples && nAnalogSamples){ + if (nDigitalSamples>nAnalogSamples) + dsize=nDigitalSamples*(32*2+8); + else + dsize=nAnalogSamples*(32*2+8); + } else + dsize=32*2*nAnalogSamples+8*nDigitalSamples; + + } else + dsize=nadc*2*nAnalogSamples+ndbit*(nDigitalSamples-dBitOffset/8)/8; cout << "dataBytes is " << data->databytes << " expected " << dsize << endl; @@ -906,7 +916,11 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") { i=0; - char *d_data= data->data+2*nadc*nAnalogSamples; + char *d_data; + if (tenG) + d_data= data->data; + else + d_data = data->data+2*nadc*nAnalogSamples; char dval; @@ -968,7 +982,11 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") { ig=ii; else ig=adclist.at(ii); - aval=data->getChannel(i);//*((uint16_t*)(data->cvalues+i*2));// + + // if (tenG) + // aval=data->getChannel(i); + // else + aval=data->getChannel(i);//*((uint16_t*)(data->cvalues+i*2));// if (plotFlag[ig]) { @@ -980,10 +998,11 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") { // cout << data->getChannel(i) << endl; h->SetBinContent(ip+1,aval); h1->Fill(aval); - } + } i++; - } + } + if (tenG) i+=4; } @@ -993,8 +1012,10 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") { if (dbitlist.empty()) { for (ip=0; ipgetReceiverDbitOffset(); + try{ + dBitOffset=myDet->getReceiverDbitOffset(); + } catch (...) { + cout << "Do nothing for this error" << endl; + } + try{ + tenG=myDet->enableTenGigabitEthernet(-1); + } catch (...) { + cout << "Do nothing for this error" << endl; + } // char aargs[10][100]; // char *args[10]; // for (int i=0; i<10; i++) @@ -1666,6 +1696,11 @@ void ctbAcquisition::acquisitionFinished() { void ctbAcquisition::startAcquisition(){ cout << "Detector started " <GetNumber()<< endl; stop=0; + try { + tenG=myDet->enableTenGigabitEthernet(-1); + } catch (...) { + cout << "Do nothing for this error" << endl; + } for (int im=0; imGetNumber(); im++) { try { myDet->acquire(); diff --git a/ctbGui/ctbAcquisition.h b/ctbGui/ctbAcquisition.h index 12abd313e..5daee0e34 100755 --- a/ctbGui/ctbAcquisition.h +++ b/ctbGui/ctbAcquisition.h @@ -151,6 +151,7 @@ class ctbAcquisition : public TGGroupFrame { int globalPlot; int adcPlot; int dbitPlot; + int tenG; int nAnalogSamples, nDigitalSamples; // int iScanStep; diff --git a/slsDetectorCalibration/dataStructures/moench04CtbZmq10GbData.h b/slsDetectorCalibration/dataStructures/moench04CtbZmq10GbData.h index 3c4386f5b..c62d483b5 100644 --- a/slsDetectorCalibration/dataStructures/moench04CtbZmq10GbData.h +++ b/slsDetectorCalibration/dataStructures/moench04CtbZmq10GbData.h @@ -28,8 +28,19 @@ class moench04CtbZmq10GbData : public slsDetectorData { \param c crosstalk parameter for the output buffer */ - moench04CtbZmq10GbData(int nas=5000, int nds=0): slsDetectorData(400, 400, nas*2*32+nds*8), aSamples(nas), dSamples(nds), nadc(32), sc_width(25), sc_height(200) { - + //moench04CtbZmq10GbData(int nas=5000, int nds=0): slsDetectorData(400, 400, nas*2*32+nds*8), aSamples(nas), dSamples(nds), nadc(32), sc_width(25), sc_height(200) { + moench04CtbZmq10GbData(int nas=5000, int nds=0): aSamples(nas), dSamples(nds), nadc(32), sc_width(25), sc_height(200) { + + int ds; + if (nas && nds) + if (nds>nas) + ds=nds*(32*2+8); + else + ds=nas*(32*2+8); + else + ds=nas*32*2+nds*8; + + slsDetectorData(400, 400, ds); int adc_nr[32]={9, 8,11,10,13,12,15,14,1,0,3,2,5,4,7,6,23,22,21,20,19,18,17,16,31,30,29,28,27,26,25,24 }; From d4a2af1693c78e4d5064764e2af1a058d4e2b79e Mon Sep 17 00:00:00 2001 From: Anna Bergamaschi Date: Wed, 21 Aug 2019 17:31:25 +0200 Subject: [PATCH 4/5] CTB fixed 10Gb data structures for the GUI (to be tested) --- .../dataStructures/moench04CtbZmq10GbData.h | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/slsDetectorCalibration/dataStructures/moench04CtbZmq10GbData.h b/slsDetectorCalibration/dataStructures/moench04CtbZmq10GbData.h index c62d483b5..28a579123 100644 --- a/slsDetectorCalibration/dataStructures/moench04CtbZmq10GbData.h +++ b/slsDetectorCalibration/dataStructures/moench04CtbZmq10GbData.h @@ -29,18 +29,18 @@ class moench04CtbZmq10GbData : public slsDetectorData { */ //moench04CtbZmq10GbData(int nas=5000, int nds=0): slsDetectorData(400, 400, nas*2*32+nds*8), aSamples(nas), dSamples(nds), nadc(32), sc_width(25), sc_height(200) { - moench04CtbZmq10GbData(int nas=5000, int nds=0): aSamples(nas), dSamples(nds), nadc(32), sc_width(25), sc_height(200) { + moench04CtbZmq10GbData(int nas=5000, int nds=0): slsDetectorData(400, 400, (nas > 0) && (nds>0) ? max(nas,nds)*(32*2+8) : nas*32*2+nds*8), aSamples(nas), dSamples(nds), nadc(32), sc_width(25), sc_height(200) { - int ds; - if (nas && nds) - if (nds>nas) - ds=nds*(32*2+8); - else - ds=nas*(32*2+8); - else - ds=nas*32*2+nds*8; + /* int ds; */ + /* if (nas && nds) */ + /* if (nds>nas) */ + /* ds=nds*(32*2+8); */ + /* else */ + /* ds=nas*(32*2+8); */ + /* else */ + /* ds=nas*32*2+nds*8; */ - slsDetectorData(400, 400, ds); + /* new slsDetectorData(400, 400, ds); */ int adc_nr[32]={9, 8,11,10,13,12,15,14,1,0,3,2,5,4,7,6,23,22,21,20,19,18,17,16,31,30,29,28,27,26,25,24 }; From 199ecbce80b1b9a4a24d7bebd11dc808cec839ba Mon Sep 17 00:00:00 2001 From: Gemma Tinti Date: Wed, 21 Aug 2019 20:24:59 +0200 Subject: [PATCH 5/5] transmission delays --- manual/manual-client/Eiger_short.tex | 78 +++++++++++++++++----------- 1 file changed, 48 insertions(+), 30 deletions(-) diff --git a/manual/manual-client/Eiger_short.tex b/manual/manual-client/Eiger_short.tex index ddd858af2..d0dab648c 100755 --- a/manual/manual-client/Eiger_short.tex +++ b/manual/manual-client/Eiger_short.tex @@ -353,19 +353,19 @@ In the case of REAL CONTINUOUS readout, i.e. continuous acquire and readout from \begin{table} \begin{tabular}{|c|c|c|c|c|} \hline -\tiny{GbE} & \tiny{dynamic range} & \tiny{continuos maximum frame rate(Hz)} & \tiny{minimum period ($\mu$s)}& \tiny{time to send out data ($\mu$s)}\\ +\tiny{GbE} & \tiny{dynamic range} & \tiny{continuos maximum frame rate(Hz)} & \tiny{minimum period ($\mu$s)}& \tiny{calculated/measered time to send out data ($\mu$s)}\\ \hline 1 & 16 & \textbf{256} & 3901 & \\ \hline 1 & 32 & \textbf{128} & 7820 & \\ \hline -10 & 4 & \textbf{10240} & 98 & 100\\ +10 & 4 & \textbf{10240} & 98 & 105/128\\ \hline -10 & 8 & \textbf{5120} & 196 & 200\\ +10 & 8 & \textbf{5120} & 196 & 210/250\\ \hline -10 & 16 & \textbf{2560} & 391 & 400\\ +10 & 16 & \textbf{2560} & 391 & 420/490\\ \hline -10 & 32 & \textbf{1280} & 782 & 800\\ +10 & 32 & \textbf{1280} & 782 & 840/977\\ \hline \end{tabular} \caption{Frame rate limits for the CONTINUOS streaming out of images, i.e. the data rate out is just below 1Gb/s or 10Gb/s. 1280~Hz for 32-bit, 10GbE is obtained from the 10GbE limitation. The maximum achievable frame rate is 977~Hz.} @@ -794,9 +794,23 @@ Transmission delays should be chosen only to accomodate the writing speed of the Table~\ref{tcont} gives the times that are needed to transfer 1 images out of the 10~Gb Ethernet connection. This reflects the CONTINUOS frame rate achieavable. The disk speed can be monitored with {\tt{dstat}}. One you have worked out this, you can calculated the {\tt{txndelay\_frame}} delay as: \begin{equation} - {\tt{txndelay\_frame}}=-tsending+dr \cdot \frac{4*256*256*N\_half\_modules}{1024 \cdot 1000 \cdot disk\_speed [MB/s]} + {\tt{txndelay\_frame}}=-t_sending+dr \cdot \frac{4*256*256*N\_half\_modules}{1024 \cdot 1000 \cdot disk\_speed [MB/s] \cdot 8} \end{equation} -In 4-bit mode, for a disk seed of 320MB/s, the {\tt{txndelay\_frame}} is 300~$\mu$s (30000 to be set up to the detector). The sending time is 100~$\mu$s, such that an total ackievable writing sped of 1/400~$\mu$s (2.5~kHz) in achieved. +In 4-bit mode, for a disk seed of 320MB/s, the {\tt{txndelay\_frame}} is 300~$\mu$s (30000 to be set up to the detector). The sending time is 100~$\mu$s, such that an total ackievable writing speed of 1/400~$\mu$s (2.5~kHz) in achieved. + +Note that: +\begin{enumerate} +\item The continuos frame rate goes down when transmission delays are introduced: +\begin{equation} +continuos\_frame\_rate= \frac{1}{\tt{txndelay\_frame}+t\_sending} +\end{equation} +\item If your transmission delays reduce the continuos frame rate, you will saturate the memory on board at some point and you will corrupt images. Conservatively, we say that the number of maximum images in buffered mode is the one listed in table~\ref{timgs}, call N\_images. However, one can approximately say that (and here we need to test more, so do not believe to these numbers yet), +\begin{equation} +N\_tot\_images= N\_images+\frac{ N\_images}{frame\_rate \cdot (t\_delay\_frame + t\_sending) } +\end{equation} + +\end{enumerate} + \section{Setting up the PC settings for 10Gb}\label{10g} @@ -818,12 +832,8 @@ ethtool -G xth1 rx 4096 #or wheterver is the max number for your pc ethtool -C xth1 rx-usecs 100 ethtool -A xth1 rx on \end{verbatim} -where {\tt{xth1}} can be replaced with the correct 10Gb device. To minimise loosing packets, priorities are set better as root user, so have the receiver as root. -To try to bypass being root, we trued something like this: -\begin{verbatim} -/etc/security/limits.conf username – rtprio 99 -\end{verbatim} -but somehow it did not fully worked so we kept the trick of being root. +where {\tt{xth1}} can be replaced with the correct 10Gb device. +NOTE THAT THIS SETTINGS WILL BE LOST IF YOU REBOOT THE COMPUTER. Very important is to activate the flow control in 10Gb (in 1Gb it is on by default and not configurable) \begin{verbatim} @@ -857,10 +867,18 @@ to make the settings permanent, edit /etc/sysctl.conf: \begin{verbatim} # 100MiB net.core.rmem_max = 104857600 +net.core.rmem_default= 104857600 net.core.netdev_max_backlog = 250000 \end{verbatim} and run \textbf{sysctl -p}. +To minimise loosing packets, priorities are set better as root user, so have the receiver as root. +To try to bypass being root, we trued something like this: +\begin{verbatim} +/etc/security/limits.conf username – rtprio 99 +\end{verbatim} +but somehow it did not fully worked so we kept the trick of being root. + Last, you can disable power saving in the CPU frequency (chose the appropriate command for your system): \begin{verbatim} cpupower frequency-info @@ -895,9 +913,6 @@ mount -t tmpfs none /mnt/ramdisk -o size=10G \end{verbatim} check how many GB memory you can allocate, to avoid swapping otherwise - - - \section{Offline processing and monitoring} \subsection{Data out of the detector: UDP packets}\label{UDP} @@ -935,19 +950,22 @@ If you use the option of writing raw files, you will have a raw file for each UD The master file is named: {\tt{filename\_master\_0.raw}} and for version ``4.0.0'' of the slsDetectorSoftware looks like: \begin{verbatim} -Version : 2.0 +Version : 4.0 +Detector Type : 3 Dynamic Range : 32 Ten Giga : 1 Image Size : 524288 bytes -x : 512 pixels -y : 256 pixels -Max. Frames Per File : 10000 -Total Frames : 1 -Exptime (ns) : 1000000000 +nPixelsX : 512 pixels +nPixelsY : 256 pixels +Max Frames Per File : 10000 +Total Frames : 3 +Exptime (ns) : 10000000 SubExptime (ns) : 2621440 SubPeriod(ns) : 2621440 -Period (ns) : 1000000000 -Timestamp : Mon Sep 3 09:07:05 2018 +Period (ns) : 0 +Gap Pixels Enable : 0 +Quad Enable : 0 +Timestamp : Wed Aug 21 16:30:20 2019 #Frame Header @@ -957,9 +975,9 @@ Packet Number : 4 bytes Bunch ID : 8 bytes Timestamp : 8 bytes Module Id : 2 bytes -X Coordinate : 2 bytes -Y Coordinate : 2 bytes -Z Coordinate : 2 bytes +Row : 2 bytes +Column : 2 bytes +Reserved : 2 bytes Debug : 4 bytes Round Robin Number : 2 bytes Detector Type : 1 byte @@ -972,15 +990,15 @@ Note that if one wants to reconstruct the real time the detector was acquiring \subsection{Offline image reconstruction} The offline image reconstruction{\tt{slsImageReconstruction}} is not part of the package anymore. The code is still available doing \\ {\tt{git clone git@git.psi.ch:sls\_detectors\_software/sls\_image\_reconstruction.git slsImageReconstruction}}. -Checkout the {\tt{developer}} branch if in a 3.1.X release or the {\tt{v4.0.0}} branch if in 4.0.X release of the {\tt{slsDetector}} code. +Checkout the {\tt{developer}} branch if in a 3.1.X release, the {\tt{v4.0.0}} branch if in 4.0.X release, or the {\tt{v4.1}} branch if in 4.1.X release of the {\tt{slsDetector}} code. Three possible conversions are possible: into \textbf{cbf}, \textbf{hdf5} and \textbf{root} format. The detector writes 4 raw files per receiver. An offline image reconstruction executable has been written to collate the possible files together and produce output files. By default an interpolation between the values of the large pixels is performed. Gap pixels between modules are also inserted. -Note that the number of images per file is hardcoded and needs to match whatever you are using in {\tt{slsDetectorsPackage/slsReceiverSoftware/include/sls\_receiver\_defs.h}}: +Note that the number of images per file in the 3.1.X release is hardcoded and needs to match whatever you are using in {\tt{slsDetectorsPackage/slsReceiverSoftware/include/sls\_receiver\_defs.h}}: \begin{verbatim} #define EIGER_MAX_FRAMES_PER_FILE 2000 \end{verbatim} -The default is 2000. +The default is 2000 in the 3.1.X release. The default has been changed to 10000 frm realease 4.0.X and now this is picked up automatically without doing anything. \subsubsection{cbf} The cbf executable executable uses the CBFlib-0.9.5 library (downloaded from the web as it downloads architecture dependent packages at installation).Edit the Makefile to correclty point at it.\\