mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 05:17:13 +02:00
merge from developer
This commit is contained in:
@ -208,6 +208,9 @@ if (NOT TARGET libzmq)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
get_target_property(VAR libzmq INTERFACE_INCLUDE_DIRECTORIES)
|
||||
message(STATUS "zmq: ${VAR}")
|
||||
|
||||
if (SLS_USE_TESTS)
|
||||
enable_testing()
|
||||
add_subdirectory(tests)
|
||||
|
@ -69,14 +69,14 @@ void setoutput(int bit) {
|
||||
mask=mask<<bit;
|
||||
iopat |= mask;
|
||||
}
|
||||
|
||||
/*
|
||||
void setclk(int bit) {
|
||||
uint64_t mask=1;
|
||||
mask=mask<<bit;
|
||||
iopat |= mask;
|
||||
clkpat |= mask;
|
||||
}
|
||||
|
||||
*/
|
||||
void clearbit(int bit){
|
||||
uint64_t mask=1;
|
||||
mask=mask<<bit;
|
||||
@ -157,7 +157,7 @@ main(void) {
|
||||
#include INFILE
|
||||
|
||||
fprintf(fd,"patioctrl 0x%016llx\n",iopat);
|
||||
fprintf(fd,"patclkctrl 0x%016llx\n",clkpat);
|
||||
//fprintf(fd,"patclkctrl 0x%016llx\n",clkpat);
|
||||
fprintf(fd,"patlimits 0x%04x 0x%04x\n",start, stop);
|
||||
|
||||
for (iloop=0; iloop<MAXLOOPS; iloop++) {
|
||||
|
@ -34,6 +34,12 @@ Python bindings
|
||||
* pybind11 (packaged in libs/)
|
||||
|
||||
|
||||
-----------------------
|
||||
Moench executables
|
||||
-----------------------
|
||||
|
||||
* libtiff
|
||||
|
||||
-----------------------
|
||||
Documentation
|
||||
-----------------------
|
||||
|
@ -99,7 +99,7 @@ class moench04CtbReceiverData : public slsDetectorData<uint16_t> {
|
||||
row=200+i/sc_width;
|
||||
}
|
||||
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)
|
||||
if (dataMap[row][col]<0 || dataMap[row][col]>=aSamples*2*32+sizeof(sls_detector_header))
|
||||
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,46 @@
|
||||
#define MOENCH04ZMQ10GBDATA_H
|
||||
#include "slsDetectorData.h"
|
||||
|
||||
#ifndef SLS_DETECTOR_HEADER
|
||||
#define SLS_DETECTOR_HEADER
|
||||
|
||||
//#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;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -17,7 +57,7 @@ class moench04CtbZmq10GbData : public slsDetectorData<uint16_t> {
|
||||
int sc_height;
|
||||
const int aSamples;
|
||||
const int dSamples;
|
||||
|
||||
int off;
|
||||
|
||||
public:
|
||||
|
||||
@ -31,8 +71,16 @@ class moench04CtbZmq10GbData : public slsDetectorData<uint16_t> {
|
||||
|
||||
*/
|
||||
//moench04CtbZmq10GbData(int nas=5000, int nds=0): slsDetectorData<uint16_t>(400, 400, nas*2*32+nds*8), aSamples(nas), dSamples(nds), nadc(32), sc_width(25), sc_height(200) {
|
||||
#ifndef RAWDATA
|
||||
moench04CtbZmq10GbData(int nas=5000, int nds=0): slsDetectorData<uint16_t>(400, 400, (nas > 0) && (nds>0) ? max(nas,nds)*(32*2+8) : nas*32*2+nds*8), nadc(32), sc_width(25), sc_height(200), aSamples(nas), dSamples(nds) {
|
||||
|
||||
int off=0;
|
||||
#endif
|
||||
#ifdef RAWDATA
|
||||
moench04CtbZmq10GbData(int nas=5000, int nds=0): slsDetectorData<uint16_t>(400, 400, sizeof(sls_detector_header)+((nas > 0) && (nds>0) ? max(nas,nds)*(32*2+8) : nas*32*2+nds*8)), nadc(32), sc_width(25), sc_height(200), aSamples(nas), dSamples(nds) {
|
||||
int off=sizeof(sls_detector_header);
|
||||
cout << "hh" << dataSize << endl;
|
||||
cout << sizeof(sls_detector_header)+ ((nas > 0) && (nds>0) ? max(nas,nds)*(32*2+8) : nas*32*2+nds*8) << endl;
|
||||
#endif
|
||||
/* int ds; */
|
||||
/* if (nas && nds) */
|
||||
/* if (nds>nas) */
|
||||
@ -93,10 +141,10 @@ class moench04CtbZmq10GbData : public slsDetectorData<uint16_t> {
|
||||
row=200+i/sc_width;
|
||||
}
|
||||
if (nds>0)
|
||||
dataMap[row][col]=((nadc+4)*i+iadc)*2;//+16*(ip+1);
|
||||
dataMap[row][col]=((nadc+4)*i+iadc)*2+off;//+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)
|
||||
dataMap[row][col]=(nadc*i+iadc)*2+off;//+16*(ip+1);
|
||||
if (dataMap[row][col]<0 || dataMap[row][col]>=aSamples*2*32+off)
|
||||
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
|
||||
}
|
||||
}
|
||||
@ -184,9 +232,24 @@ class moench04CtbZmq10GbData : public slsDetectorData<uint16_t> {
|
||||
/* }; */
|
||||
|
||||
|
||||
#ifdef RAWDATA
|
||||
int getFrameNumber(char *buff){return ((sls_detector_header*)buff)->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;};
|
||||
#endif
|
||||
#ifndef RAWDATA
|
||||
|
||||
int getFrameNumber(char *buff){return iframe;};//((sls_detector_header*)buff)->frameNumber;};//*((int*)(buff+5))&0xffffff;};
|
||||
|
||||
#endif
|
||||
/**
|
||||
|
||||
Returns the packet number for the given dataset. purely virtual func
|
||||
@ -239,7 +302,6 @@ class moench04CtbZmq10GbData : public slsDetectorData<uint16_t> {
|
||||
/* return NULL; */
|
||||
/* }; */
|
||||
|
||||
|
||||
virtual char *readNextFrame(ifstream &filebin) {
|
||||
int ff=-1, np=-1;
|
||||
return readNextFrame(filebin, ff, np);
|
||||
@ -257,6 +319,8 @@ class moench04CtbZmq10GbData : public slsDetectorData<uint16_t> {
|
||||
return data;
|
||||
}
|
||||
|
||||
#ifndef RAWDATA
|
||||
|
||||
|
||||
|
||||
|
||||
@ -285,6 +349,42 @@ class moench04CtbZmq10GbData : public slsDetectorData<uint16_t> {
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef RAWDATA
|
||||
|
||||
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -301,9 +401,6 @@ class moench04CtbZmq10GbData : public slsDetectorData<uint16_t> {
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
|
||||
|
||||
};
|
||||
|
@ -480,9 +480,9 @@ double Implementation::getProgress() const {
|
||||
((double)(currentFrameIndex + 1) / (double)numberOfTotalFrames));
|
||||
}
|
||||
|
||||
std::vector<uint64_t> Implementation::getNumMissingPackets() const {
|
||||
std::vector<uint64_t> mp(numUDPInterfaces);
|
||||
for (int i = 0; i < numUDPInterfaces; i++) {
|
||||
std::vector<int64_t> Implementation::getNumMissingPackets() const {
|
||||
std::vector<int64_t> mp(numUDPInterfaces);
|
||||
for (int i = 0; i < numUDPInterfaces; ++i) {
|
||||
int np = generalData->packetsPerFrame;
|
||||
uint64_t totnp = np;
|
||||
// ReadNRows
|
||||
@ -603,12 +603,7 @@ void Implementation::stopReceiver() {
|
||||
LOG(logINFO) << "Status: " << sls::ToString(status);
|
||||
|
||||
{ // statistics
|
||||
auto tmp = getNumMissingPackets();
|
||||
// convert to signed missing packets (to get excess)
|
||||
std::vector<int64_t> mp;
|
||||
for (auto val : tmp) {
|
||||
mp.push_back(static_cast<int64_t>(val));
|
||||
}
|
||||
auto mp = getNumMissingPackets();
|
||||
// print summary
|
||||
uint64_t tot = 0;
|
||||
for (int i = 0; i < numUDPInterfaces; i++) {
|
||||
@ -617,7 +612,7 @@ void Implementation::stopReceiver() {
|
||||
std::string mpMessage = std::to_string(mp[i]);
|
||||
if (mp[i] < 0) {
|
||||
mpMessage =
|
||||
std::to_string(abs(mp[i])) + std::string(" (Extra)");
|
||||
std::to_string(std::abs(mp[i])) + std::string(" (Extra)");
|
||||
}
|
||||
|
||||
TLogLevel lev = ((mp[i]) > 0) ? logINFORED : logINFOGREEN;
|
||||
|
@ -85,7 +85,7 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
uint64_t getFramesCaught() const;
|
||||
uint64_t getAcquisitionIndex() const;
|
||||
double getProgress() const;
|
||||
std::vector<uint64_t> getNumMissingPackets() const;
|
||||
std::vector<int64_t> getNumMissingPackets() const;
|
||||
void setScan(slsDetectorDefs::scanParameters s);
|
||||
void startReceiver();
|
||||
void setStoppedFlag(bool stopped);
|
||||
|
@ -40,8 +40,8 @@ uint64_t Listener::GetLastFrameIndexCaught() const {
|
||||
return lastCaughtFrameIndex;
|
||||
}
|
||||
|
||||
uint64_t Listener::GetNumMissingPacket(bool stoppedFlag,
|
||||
uint64_t numPackets) const {
|
||||
int64_t Listener::GetNumMissingPacket(bool stoppedFlag,
|
||||
uint64_t numPackets) const {
|
||||
if (!stoppedFlag) {
|
||||
return (numPackets - numPacketsCaught);
|
||||
}
|
||||
|
@ -63,8 +63,8 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
|
||||
*/
|
||||
uint64_t GetLastFrameIndexCaught() const;
|
||||
|
||||
/** Get number of missing packets */
|
||||
uint64_t GetNumMissingPacket(bool stoppedFlag, uint64_t numPackets) const;
|
||||
/** Get number of missing packets, returns negative values in case to extra packet */
|
||||
int64_t GetNumMissingPacket(bool stoppedFlag, uint64_t numPackets) const;
|
||||
|
||||
/**
|
||||
* Set Fifo pointer to the one given
|
||||
|
Reference in New Issue
Block a user