WIP det dependant master file attribtes

This commit is contained in:
maliakal_d 2020-07-30 18:05:47 +02:00
parent c2b586a333
commit 85c958facf
5 changed files with 132 additions and 4 deletions

View File

@ -7,6 +7,7 @@
#include "ToString.h"
#include "ZmqSocket.h" //just for the zmq port define
#include "file_utils.h"
#include "masterFileAttributes.h"
#include <cerrno> //eperm
#include <chrono>

View File

@ -0,0 +1,116 @@
#pragma once
#include "sls_detector_defs.h"
#include "logger.h"
#include "ToString.h"
// versions
#define HDF5_WRITER_VERSION (6.1) // 1 decimal places
#define BINARY_WRITER_VERSION (6.1) // 1 decimal places
class masterFileAttributes {
public:
double version{0.0};
slsDetectorDefs::detectorType detType{slsDetectorDefs::GENERIC};
uint32_t imageSize{0};
slsDetectorDefs::xy nPixels{};
uint32_t maxFramesPerFile{0};
uint64_t totalFrames{0};
uint64_t exptimeNs{0};
uint64_t periodNs{0};
uint32_t dynamicRange{0};
uint32_t tenGiga{0};
uint64_t subExptimeNs{0};
uint64_t subPeriodNs{0};
uint32_t quadEnable{0};
uint32_t adcmask{0};
uint32_t analogFlag{0};
uint32_t digitalFlag{0};
uint32_t dbitoffset{0};
uint64_t dbitlist{0};
slsDetectorDefs::ROI roi{};
uint64_t exptime1Ns{0};
uint64_t exptime2Ns{0};
uint64_t exptime3Ns{0};
uint64_t gateDelay1Ns{0};
uint64_t gateDelay2Ns{0};
uint64_t gateDelay3Ns{0};
uint32_t gates;
/*
double version{0.0};
slsDetectorDefs::detectorType myDetectorType{slsDetectorDefs::GENERIC};
uint32_t imageSize{0};
uint32_t nPixelsX{0};
uint32_t nPixelsY{0};
uint32_t maxFramesPerFile{0};
uint64_t totalFrames{0};
uint64_t exptimeNs{0};
uint64_t periodNs{0};
*/
/* eiger
uint32_t dynamicRange{0};
uint32_t tenGiga{0};
uint64_t subExptimeNs{0};
uint64_t subPeriodNs{0};
uint32_t quadEnable{0};
*/
/** moench
uint32_t tenGiga{0};
uint32_t adcmask{0};
*/
/* ctb
uint32_t tenGiga{0};
uint32_t adcmask{0};
uint32_t analogFlag{0};
uint32_t digitalFlag{0};
uint32_t dbitoffset{0};
uint64_t dbitlist{0};
*/
/* gotthard
uint32_t roiXmin{0};
uint32_t roiXmax{0};
*/
/* mythen3
uint32_t dynamicRange{0};
uint32_t tenGiga{0};
uint64_t exptime1Ns{0};
uint64_t exptime2Ns{0};
uint64_t exptime3Ns{0};
uint64_t gateDelay1Ns{0};
uint64_t gateDelay2Ns{0};
uint64_t gateDelay3Ns{0};
uint32_t gates;
*/
masterFileAttributes(){};
virtual ~masterFileAttributes(){};
std::string GetBinaryMasterFileAttributes() {
std::ostringstream oss;
oss << "Version : " << std::setprecision(2) << version << '\n'
<< "Detector Type : " << sls::ToString(detType) << '\n'
<< "Image Size : " << imageSize << " bytes" << '\n'
<< "nPixels : " << sls::ToString(nPixels) << " pixels" << '\n'
<< "Max Frames Per File : " << maxFramesPerFile << '\n'
<< "Total Frames : " << totalFrames << '\n'
<< "Exptime (ns) : " << exptimeNs << '\n'
<< "Period (ns) : " << periodNs << '\n';
return oss.str();
};
// hdf5
};
class GotthardMasterFileAttributes : public masterFileAttributes {
public:
GotthardMasterFileAttributes() {};
std::string GetBinaryMasterFileAttributes() {
std::ostringstream oss;
oss << masterFileAttributes::GetBinaryMasterFileAttributes()
<< "Roi (xmin, xmax) : " << sls::ToString(roi) << '\n';
return oss.str();
};
};

View File

@ -39,10 +39,6 @@
// hdf5
#define MAX_CHUNKED_IMAGES (1)
// versions
#define HDF5_WRITER_VERSION (6.0) // 1 decimal places
#define BINARY_WRITER_VERSION (6.0) // 1 decimal places
// parameters to calculate fifo depth
#define SAMPLE_TIME_IN_NS (100000000) // 100ms
#define MAX_EIGER_ROWS_PER_READOUT (256)
@ -57,6 +53,9 @@
#define STREAMER_PRIORITY (10)
#define TCP_PRIORITY (10)
#define HDF5_WRITER_VERSION (6.1) // 1 decimal places
#define BINARY_WRITER_VERSION (6.1) // 1 decimal places
struct masterAttributes {
double version;
uint32_t detectorType;

View File

@ -39,6 +39,8 @@ std::string ToString(const std::vector<defs::dacIndex> &vec);
std::string ToString(const defs::burstMode s);
std::string ToString(const defs::timingSourceType s);
std::string ToString(const slsDetectorDefs::xy &coord);
std::ostream &operator<<(std::ostream &os, const slsDetectorDefs::xy &coord);
std::string ToString(const slsDetectorDefs::ROI &roi);
std::ostream &operator<<(std::ostream &os, const slsDetectorDefs::ROI &roi);
std::string ToString(const slsDetectorDefs::rxParameters &r);

View File

@ -3,6 +3,16 @@
namespace sls {
std::string ToString(const slsDetectorDefs::xy &coord) {
std::ostringstream oss;
oss << '[' << coord.x << ", " << coord.y << ']';
return oss.str();
}
std::ostream &operator<<(std::ostream &os, const slsDetectorDefs::xy &coord) {
return os << ToString(coord);
}
std::string ToString(const slsDetectorDefs::ROI &roi) {
std::ostringstream oss;
oss << '[' << roi.xmin << ", " << roi.xmax << ']';