mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 03:40:04 +02:00
commit
04d6644753
@ -8,6 +8,7 @@
|
|||||||
#include "versionAPI.h"
|
#include "versionAPI.h"
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <chrono>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -19,6 +20,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
using ns = std::chrono::nanoseconds;
|
||||||
using sls::RuntimeError;
|
using sls::RuntimeError;
|
||||||
using sls::SocketError;
|
using sls::SocketError;
|
||||||
using Interface = sls::ServerInterface;
|
using Interface = sls::ServerInterface;
|
||||||
@ -381,12 +383,13 @@ int ClientInterface::setup_receiver(Interface &socket) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (myDetectorType != MYTHEN3) {
|
if (myDetectorType != MYTHEN3) {
|
||||||
impl()->setAcquisitionTime(arg.expTimeNs);
|
impl()->setAcquisitionTime(std::chrono::nanoseconds(arg.expTimeNs));
|
||||||
}
|
}
|
||||||
impl()->setAcquisitionPeriod(arg.periodNs);
|
impl()->setAcquisitionPeriod(std::chrono::nanoseconds(arg.periodNs));
|
||||||
if (myDetectorType == EIGER) {
|
if (myDetectorType == EIGER) {
|
||||||
impl()->setSubExpTime(arg.subExpTimeNs);
|
impl()->setSubExpTime(std::chrono::nanoseconds(arg.subExpTimeNs));
|
||||||
impl()->setSubPeriod(arg.subExpTimeNs + arg.subDeadTimeNs);
|
impl()->setSubPeriod(std::chrono::nanoseconds(arg.subExpTimeNs) +
|
||||||
|
std::chrono::nanoseconds(arg.subDeadTimeNs));
|
||||||
impl()->setActivate(static_cast<bool>(arg.activate));
|
impl()->setActivate(static_cast<bool>(arg.activate));
|
||||||
try {
|
try {
|
||||||
impl()->setQuad(arg.quad == 0 ? false : true);
|
impl()->setQuad(arg.quad == 0 ? false : true);
|
||||||
@ -445,12 +448,12 @@ int ClientInterface::setup_receiver(Interface &socket) {
|
|||||||
}
|
}
|
||||||
if (myDetectorType == MYTHEN3) {
|
if (myDetectorType == MYTHEN3) {
|
||||||
impl()->setCounterMask(arg.countermask);
|
impl()->setCounterMask(arg.countermask);
|
||||||
impl()->setAcquisitionTime1(arg.expTime1Ns);
|
impl()->setAcquisitionTime1(std::chrono::nanoseconds(arg.expTime1Ns));
|
||||||
impl()->setAcquisitionTime2(arg.expTime2Ns);
|
impl()->setAcquisitionTime2(std::chrono::nanoseconds(arg.expTime2Ns));
|
||||||
impl()->setAcquisitionTime3(arg.expTime3Ns);
|
impl()->setAcquisitionTime3(std::chrono::nanoseconds(arg.expTime3Ns));
|
||||||
impl()->setGateDelay1(arg.gateDelay1Ns);
|
impl()->setGateDelay1(std::chrono::nanoseconds(arg.gateDelay1Ns));
|
||||||
impl()->setGateDelay2(arg.gateDelay2Ns);
|
impl()->setGateDelay2(std::chrono::nanoseconds(arg.gateDelay2Ns));
|
||||||
impl()->setGateDelay3(arg.gateDelay3Ns);
|
impl()->setGateDelay3(std::chrono::nanoseconds(arg.gateDelay3Ns));
|
||||||
impl()->setNumberOfGates(arg.gates);
|
impl()->setNumberOfGates(arg.gates);
|
||||||
}
|
}
|
||||||
if (myDetectorType == GOTTHARD2) {
|
if (myDetectorType == GOTTHARD2) {
|
||||||
@ -618,9 +621,9 @@ int ClientInterface::set_exptime(Interface &socket) {
|
|||||||
int64_t args[2]{-1, -1};
|
int64_t args[2]{-1, -1};
|
||||||
socket.Receive(args);
|
socket.Receive(args);
|
||||||
int gateIndex = static_cast<int>(args[0]);
|
int gateIndex = static_cast<int>(args[0]);
|
||||||
int64_t value = args[1];
|
ns value = std::chrono::nanoseconds(args[1]);
|
||||||
LOG(logDEBUG1) << "Setting exptime to " << value
|
LOG(logDEBUG1) << "Setting exptime to " << sls::ToString(value)
|
||||||
<< "ns (gateIndex: " << gateIndex << ")";
|
<< " (gateIndex: " << gateIndex << ")";
|
||||||
switch (gateIndex) {
|
switch (gateIndex) {
|
||||||
case -1:
|
case -1:
|
||||||
if (myDetectorType == MYTHEN3) {
|
if (myDetectorType == MYTHEN3) {
|
||||||
@ -657,27 +660,27 @@ int ClientInterface::set_exptime(Interface &socket) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ClientInterface::set_period(Interface &socket) {
|
int ClientInterface::set_period(Interface &socket) {
|
||||||
auto value = socket.Receive<int64_t>();
|
auto value = std::chrono::nanoseconds(socket.Receive<int64_t>());
|
||||||
LOG(logDEBUG1) << "Setting period to " << value << "ns";
|
LOG(logDEBUG1) << "Setting period to " << sls::ToString(value);
|
||||||
impl()->setAcquisitionPeriod(value);
|
impl()->setAcquisitionPeriod(value);
|
||||||
return socket.Send(OK);
|
return socket.Send(OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ClientInterface::set_subexptime(Interface &socket) {
|
int ClientInterface::set_subexptime(Interface &socket) {
|
||||||
auto value = socket.Receive<int64_t>();
|
auto value = std::chrono::nanoseconds(socket.Receive<int64_t>());
|
||||||
LOG(logDEBUG1) << "Setting period to " << value << "ns";
|
LOG(logDEBUG1) << "Setting period to " << sls::ToString(value);
|
||||||
uint64_t subdeadtime = impl()->getSubPeriod() - impl()->getSubExpTime();
|
ns subdeadtime = impl()->getSubPeriod() - impl()->getSubExpTime();
|
||||||
impl()->setSubExpTime(value);
|
impl()->setSubExpTime(value);
|
||||||
impl()->setSubPeriod(impl()->getSubExpTime() + subdeadtime);
|
impl()->setSubPeriod(impl()->getSubExpTime() + subdeadtime);
|
||||||
return socket.Send(OK);
|
return socket.Send(OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ClientInterface::set_subdeadtime(Interface &socket) {
|
int ClientInterface::set_subdeadtime(Interface &socket) {
|
||||||
auto value = socket.Receive<int64_t>();
|
auto value = std::chrono::nanoseconds(socket.Receive<int64_t>());
|
||||||
LOG(logDEBUG1) << "Setting sub deadtime to " << value << "ns";
|
LOG(logDEBUG1) << "Setting sub deadtime to " << sls::ToString(value);
|
||||||
impl()->setSubPeriod(value + impl()->getSubExpTime());
|
impl()->setSubPeriod(value + impl()->getSubExpTime());
|
||||||
LOG(logDEBUG1) << "Setting sub period to " << impl()->getSubPeriod()
|
LOG(logDEBUG1) << "Setting sub period to "
|
||||||
<< "ns";
|
<< sls::ToString(impl()->getSubPeriod());
|
||||||
return socket.Send(OK);
|
return socket.Send(OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1554,9 +1557,9 @@ int ClientInterface::set_gate_delay(Interface &socket) {
|
|||||||
int64_t args[2]{-1, -1};
|
int64_t args[2]{-1, -1};
|
||||||
socket.Receive(args);
|
socket.Receive(args);
|
||||||
int gateIndex = static_cast<int>(args[0]);
|
int gateIndex = static_cast<int>(args[0]);
|
||||||
int64_t value = args[1];
|
auto value = std::chrono::nanoseconds(args[1]);
|
||||||
LOG(logDEBUG1) << "Setting gate delay to " << value
|
LOG(logDEBUG1) << "Setting gate delay to " << sls::ToString(value)
|
||||||
<< "ns (gateIndex: " << gateIndex << ")";
|
<< " (gateIndex: " << gateIndex << ")";
|
||||||
if (myDetectorType != MYTHEN3) {
|
if (myDetectorType != MYTHEN3) {
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
}
|
}
|
||||||
|
@ -23,121 +23,12 @@
|
|||||||
/** cosntructor & destructor */
|
/** cosntructor & destructor */
|
||||||
|
|
||||||
Implementation::Implementation(const detectorType d) {
|
Implementation::Implementation(const detectorType d) {
|
||||||
InitializeMembers();
|
|
||||||
setDetectorType(d);
|
setDetectorType(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
Implementation::~Implementation() { DeleteMembers(); }
|
Implementation::~Implementation() {
|
||||||
|
|
||||||
void Implementation::DeleteMembers() {
|
|
||||||
delete generalData;
|
delete generalData;
|
||||||
generalData = nullptr;
|
generalData = nullptr;
|
||||||
additionalJsonHeader.clear();
|
|
||||||
listener.clear();
|
|
||||||
dataProcessor.clear();
|
|
||||||
dataStreamer.clear();
|
|
||||||
fifo.clear();
|
|
||||||
eth.clear();
|
|
||||||
udpPortNum.clear();
|
|
||||||
rateCorrections.clear();
|
|
||||||
ctbDbitList.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Implementation::InitializeMembers() {
|
|
||||||
// config parameters
|
|
||||||
numThreads = 1;
|
|
||||||
myDetectorType = GENERIC;
|
|
||||||
for (int i = 0; i < MAX_DIMENSIONS; ++i)
|
|
||||||
numDet[i] = 0;
|
|
||||||
modulePos = 0;
|
|
||||||
detHostname = "";
|
|
||||||
silentMode = false;
|
|
||||||
fifoDepth = 0;
|
|
||||||
frameDiscardMode = NO_DISCARD;
|
|
||||||
framePadding = true;
|
|
||||||
|
|
||||||
// file parameters
|
|
||||||
fileFormatType = BINARY;
|
|
||||||
filePath = "/";
|
|
||||||
fileName = "run";
|
|
||||||
fileIndex = 0;
|
|
||||||
fileWriteEnable = true;
|
|
||||||
masterFileWriteEnable = true;
|
|
||||||
overwriteEnable = true;
|
|
||||||
framesPerFile = 0;
|
|
||||||
|
|
||||||
// acquisition
|
|
||||||
status = IDLE;
|
|
||||||
stoppedFlag = false;
|
|
||||||
|
|
||||||
// network configuration (UDP)
|
|
||||||
numUDPInterfaces = 1;
|
|
||||||
eth.resize(MAX_NUMBER_OF_LISTENING_THREADS);
|
|
||||||
udpPortNum.resize(MAX_NUMBER_OF_LISTENING_THREADS);
|
|
||||||
for (int i = 0; i < MAX_NUMBER_OF_LISTENING_THREADS; ++i) {
|
|
||||||
eth[i] = "";
|
|
||||||
udpPortNum[i] = DEFAULT_UDP_PORTNO + i;
|
|
||||||
}
|
|
||||||
udpSocketBufferSize = 0;
|
|
||||||
actualUDPSocketBufferSize = 0;
|
|
||||||
|
|
||||||
// zmq parameters
|
|
||||||
dataStreamEnable = false;
|
|
||||||
streamingFrequency = 1;
|
|
||||||
streamingTimerInMs = DEFAULT_STREAMING_TIMER_IN_MS;
|
|
||||||
streamingStartFnum = 0;
|
|
||||||
streamingPort = 0;
|
|
||||||
streamingSrcIP = sls::IpAddr{};
|
|
||||||
|
|
||||||
// detector parameters
|
|
||||||
numberOfTotalFrames = 0;
|
|
||||||
numberOfFrames = 1;
|
|
||||||
numberOfTriggers = 1;
|
|
||||||
numberOfBursts = 1;
|
|
||||||
numberOfAdditionalStorageCells = 0;
|
|
||||||
numberOfGates = 0;
|
|
||||||
timingMode = AUTO_TIMING;
|
|
||||||
burstMode = BURST_INTERNAL;
|
|
||||||
acquisitionPeriod = SAMPLE_TIME_IN_NS;
|
|
||||||
acquisitionTime = 0;
|
|
||||||
acquisitionTime1 = 0;
|
|
||||||
acquisitionTime2 = 0;
|
|
||||||
acquisitionTime3 = 0;
|
|
||||||
gateDelay1 = 0;
|
|
||||||
gateDelay2 = 0;
|
|
||||||
gateDelay3 = 0;
|
|
||||||
subExpTime = 0;
|
|
||||||
subPeriod = 0;
|
|
||||||
numberOfAnalogSamples = 0;
|
|
||||||
numberOfDigitalSamples = 0;
|
|
||||||
counterMask = 0;
|
|
||||||
dynamicRange = 16;
|
|
||||||
roi.xmin = -1;
|
|
||||||
roi.xmax = -1;
|
|
||||||
tengigaEnable = false;
|
|
||||||
flippedDataX = 0;
|
|
||||||
quadEnable = false;
|
|
||||||
activated = true;
|
|
||||||
deactivatedPaddingEnable = true;
|
|
||||||
numLinesReadout = MAX_EIGER_ROWS_PER_READOUT;
|
|
||||||
readoutType = ANALOG_ONLY;
|
|
||||||
adcEnableMaskOneGiga = BIT32_MASK;
|
|
||||||
adcEnableMaskTenGiga = BIT32_MASK;
|
|
||||||
|
|
||||||
ctbDbitOffset = 0;
|
|
||||||
ctbAnalogDataBytes = 0;
|
|
||||||
|
|
||||||
// callbacks
|
|
||||||
startAcquisitionCallBack = nullptr;
|
|
||||||
pStartAcquisition = nullptr;
|
|
||||||
acquisitionFinishedCallBack = nullptr;
|
|
||||||
pAcquisitionFinished = nullptr;
|
|
||||||
rawDataReadyCallBack = nullptr;
|
|
||||||
rawDataModifyReadyCallBack = nullptr;
|
|
||||||
pRawDataReady = nullptr;
|
|
||||||
|
|
||||||
// class objects
|
|
||||||
generalData = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Implementation::SetLocalNetworkParameters() {
|
void Implementation::SetLocalNetworkParameters() {
|
||||||
@ -835,12 +726,12 @@ void Implementation::SetupWriter() {
|
|||||||
xy(generalData->nPixelsX, generalData->nPixelsY);
|
xy(generalData->nPixelsX, generalData->nPixelsY);
|
||||||
masterAttributes->maxFramesPerFile = framesPerFile;
|
masterAttributes->maxFramesPerFile = framesPerFile;
|
||||||
masterAttributes->totalFrames = numberOfTotalFrames;
|
masterAttributes->totalFrames = numberOfTotalFrames;
|
||||||
masterAttributes->exptime = std::chrono::nanoseconds(acquisitionTime);
|
masterAttributes->exptime = acquisitionTime;
|
||||||
masterAttributes->period = std::chrono::nanoseconds(acquisitionPeriod);
|
masterAttributes->period = acquisitionPeriod;
|
||||||
masterAttributes->dynamicRange = dynamicRange;
|
masterAttributes->dynamicRange = dynamicRange;
|
||||||
masterAttributes->tenGiga = tengigaEnable;
|
masterAttributes->tenGiga = tengigaEnable;
|
||||||
masterAttributes->subExptime = std::chrono::nanoseconds(subExpTime);
|
masterAttributes->subExptime = subExpTime;
|
||||||
masterAttributes->subPeriod = std::chrono::nanoseconds(subPeriod);
|
masterAttributes->subPeriod = subPeriod;
|
||||||
masterAttributes->quad = quadEnable;
|
masterAttributes->quad = quadEnable;
|
||||||
masterAttributes->ratecorr = rateCorrections;
|
masterAttributes->ratecorr = rateCorrections;
|
||||||
masterAttributes->adcmask =
|
masterAttributes->adcmask =
|
||||||
@ -858,12 +749,12 @@ void Implementation::SetupWriter() {
|
|||||||
}
|
}
|
||||||
masterAttributes->roi = roi;
|
masterAttributes->roi = roi;
|
||||||
masterAttributes->counterMask = counterMask;
|
masterAttributes->counterMask = counterMask;
|
||||||
masterAttributes->exptime1 = std::chrono::nanoseconds(acquisitionTime1);
|
masterAttributes->exptime1 = acquisitionTime1;
|
||||||
masterAttributes->exptime2 = std::chrono::nanoseconds(acquisitionTime2);
|
masterAttributes->exptime2 = acquisitionTime2;
|
||||||
masterAttributes->exptime3 = std::chrono::nanoseconds(acquisitionTime3);
|
masterAttributes->exptime3 = acquisitionTime3;
|
||||||
masterAttributes->gateDelay1 = std::chrono::nanoseconds(gateDelay1);
|
masterAttributes->gateDelay1 = gateDelay1;
|
||||||
masterAttributes->gateDelay2 = std::chrono::nanoseconds(gateDelay2);
|
masterAttributes->gateDelay2 = gateDelay2;
|
||||||
masterAttributes->gateDelay3 = std::chrono::nanoseconds(gateDelay3);
|
masterAttributes->gateDelay3 = gateDelay3;
|
||||||
masterAttributes->gates = numberOfGates;
|
masterAttributes->gates = numberOfGates;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -1298,81 +1189,74 @@ void Implementation::setBurstMode(const slsDetectorDefs::burstMode i) {
|
|||||||
updateTotalNumberOfFrames();
|
updateTotalNumberOfFrames();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t Implementation::getAcquisitionPeriod() const {
|
ns Implementation::getAcquisitionPeriod() const { return acquisitionPeriod; }
|
||||||
return acquisitionPeriod;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Implementation::setAcquisitionPeriod(const uint64_t i) {
|
void Implementation::setAcquisitionPeriod(const ns i) {
|
||||||
acquisitionPeriod = i;
|
acquisitionPeriod = i;
|
||||||
LOG(logINFO) << "Acquisition Period: " << (double)acquisitionPeriod / (1E9)
|
LOG(logINFO) << "Acquisition Period: " << sls::ToString(acquisitionPeriod);
|
||||||
<< "s";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t Implementation::getAcquisitionTime() const { return acquisitionTime; }
|
ns Implementation::getAcquisitionTime() const { return acquisitionTime; }
|
||||||
|
|
||||||
void Implementation::updateAcquisitionTime() {
|
void Implementation::updateAcquisitionTime() {
|
||||||
if (acquisitionTime1 == acquisitionTime2 &&
|
if (acquisitionTime1 == acquisitionTime2 &&
|
||||||
acquisitionTime2 == acquisitionTime3) {
|
acquisitionTime2 == acquisitionTime3) {
|
||||||
acquisitionTime = acquisitionTime1;
|
acquisitionTime = acquisitionTime1;
|
||||||
} else {
|
} else {
|
||||||
acquisitionTime = -1;
|
acquisitionTime = std::chrono::nanoseconds(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Implementation::setAcquisitionTime(const uint64_t i) {
|
void Implementation::setAcquisitionTime(const ns i) {
|
||||||
acquisitionTime = i;
|
acquisitionTime = i;
|
||||||
LOG(logINFO) << "Acquisition Time: " << (double)acquisitionTime / (1E9)
|
LOG(logINFO) << "Acquisition Time: " << sls::ToString(acquisitionTime);
|
||||||
<< "s";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Implementation::setAcquisitionTime1(const uint64_t i) {
|
void Implementation::setAcquisitionTime1(const ns i) {
|
||||||
acquisitionTime1 = i;
|
acquisitionTime1 = i;
|
||||||
LOG(logINFO) << "Acquisition Time1: " << (double)acquisitionTime1 / (1E9)
|
LOG(logINFO) << "Acquisition Time1: " << sls::ToString(acquisitionTime1);
|
||||||
<< "s";
|
|
||||||
updateAcquisitionTime();
|
updateAcquisitionTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Implementation::setAcquisitionTime2(const uint64_t i) {
|
void Implementation::setAcquisitionTime2(const ns i) {
|
||||||
acquisitionTime2 = i;
|
acquisitionTime2 = i;
|
||||||
LOG(logINFO) << "Acquisition Time2: " << (double)acquisitionTime2 / (1E9)
|
LOG(logINFO) << "Acquisition Time2: " << sls::ToString(acquisitionTime2);
|
||||||
<< "s";
|
|
||||||
updateAcquisitionTime();
|
updateAcquisitionTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Implementation::setAcquisitionTime3(const uint64_t i) {
|
void Implementation::setAcquisitionTime3(const ns i) {
|
||||||
acquisitionTime3 = i;
|
acquisitionTime3 = i;
|
||||||
LOG(logINFO) << "Acquisition Time3: " << (double)acquisitionTime3 / (1E9)
|
LOG(logINFO) << "Acquisition Time3: " << sls::ToString(acquisitionTime3);
|
||||||
<< "s";
|
|
||||||
updateAcquisitionTime();
|
updateAcquisitionTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Implementation::setGateDelay1(const uint64_t i) {
|
void Implementation::setGateDelay1(const ns i) {
|
||||||
gateDelay1 = i;
|
gateDelay1 = i;
|
||||||
LOG(logINFO) << "Gate Delay1: " << (double)gateDelay1 / (1E9) << "s";
|
LOG(logINFO) << "Gate Delay1: " << sls::ToString(gateDelay1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Implementation::setGateDelay2(const uint64_t i) {
|
void Implementation::setGateDelay2(const ns i) {
|
||||||
gateDelay2 = i;
|
gateDelay2 = i;
|
||||||
LOG(logINFO) << "Gate Delay2: " << (double)gateDelay2 / (1E9) << "s";
|
LOG(logINFO) << "Gate Delay2: " << sls::ToString(gateDelay2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Implementation::setGateDelay3(const uint64_t i) {
|
void Implementation::setGateDelay3(const ns i) {
|
||||||
gateDelay3 = i;
|
gateDelay3 = i;
|
||||||
LOG(logINFO) << "Gate Delay3: " << (double)gateDelay3 / (1E9) << "s";
|
LOG(logINFO) << "Gate Delay3: " << sls::ToString(gateDelay3);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t Implementation::getSubExpTime() const { return subExpTime; }
|
ns Implementation::getSubExpTime() const { return subExpTime; }
|
||||||
|
|
||||||
void Implementation::setSubExpTime(const uint64_t i) {
|
void Implementation::setSubExpTime(const ns i) {
|
||||||
subExpTime = i;
|
subExpTime = i;
|
||||||
LOG(logINFO) << "Sub Exposure Time: " << (double)subExpTime / (1E9) << "s";
|
LOG(logINFO) << "Sub Exposure Time: " << sls::ToString(subExpTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t Implementation::getSubPeriod() const { return subPeriod; }
|
ns Implementation::getSubPeriod() const { return subPeriod; }
|
||||||
|
|
||||||
void Implementation::setSubPeriod(const uint64_t i) {
|
void Implementation::setSubPeriod(const ns i) {
|
||||||
subPeriod = i;
|
subPeriod = i;
|
||||||
LOG(logINFO) << "Sub Period: " << (double)subPeriod / (1E9) << "s";
|
LOG(logINFO) << "Sub Period: " << sls::ToString(subPeriod);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Implementation::getNumberofAnalogSamples() const {
|
uint32_t Implementation::getNumberofAnalogSamples() const {
|
||||||
|
@ -11,10 +11,12 @@ class Fifo;
|
|||||||
class slsDetectorDefs;
|
class slsDetectorDefs;
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
#include <chrono>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
using ns = std::chrono::nanoseconds;
|
||||||
|
|
||||||
class Implementation : private virtual slsDetectorDefs {
|
class Implementation : private virtual slsDetectorDefs {
|
||||||
public:
|
public:
|
||||||
@ -156,30 +158,30 @@ class Implementation : private virtual slsDetectorDefs {
|
|||||||
burstMode getBurstMode() const;
|
burstMode getBurstMode() const;
|
||||||
/** [Gottthard2] */
|
/** [Gottthard2] */
|
||||||
void setBurstMode(const burstMode i);
|
void setBurstMode(const burstMode i);
|
||||||
uint64_t getAcquisitionTime() const;
|
ns getAcquisitionTime() const;
|
||||||
void setAcquisitionTime(const uint64_t i);
|
void setAcquisitionTime(const ns i);
|
||||||
/** [Mythen3] */
|
/** [Mythen3] */
|
||||||
void updateAcquisitionTime();
|
void updateAcquisitionTime();
|
||||||
/** [Mythen3] */
|
/** [Mythen3] */
|
||||||
void setAcquisitionTime1(const uint64_t i);
|
void setAcquisitionTime1(const ns i);
|
||||||
/** [Mythen3] */
|
/** [Mythen3] */
|
||||||
void setAcquisitionTime2(const uint64_t i);
|
void setAcquisitionTime2(const ns i);
|
||||||
/** [Mythen3] */
|
/** [Mythen3] */
|
||||||
void setAcquisitionTime3(const uint64_t i);
|
void setAcquisitionTime3(const ns i);
|
||||||
/** [Mythen3] */
|
/** [Mythen3] */
|
||||||
void setGateDelay1(const uint64_t i);
|
void setGateDelay1(const ns i);
|
||||||
/** [Mythen3] */
|
/** [Mythen3] */
|
||||||
void setGateDelay2(const uint64_t i);
|
void setGateDelay2(const ns i);
|
||||||
/** [Mythen3] */
|
/** [Mythen3] */
|
||||||
void setGateDelay3(const uint64_t i);
|
void setGateDelay3(const ns i);
|
||||||
uint64_t getAcquisitionPeriod() const;
|
ns getAcquisitionPeriod() const;
|
||||||
void setAcquisitionPeriod(const uint64_t i);
|
void setAcquisitionPeriod(const ns i);
|
||||||
uint64_t getSubExpTime() const;
|
ns getSubExpTime() const;
|
||||||
/* [Eiger] */
|
/* [Eiger] */
|
||||||
void setSubExpTime(const uint64_t i);
|
void setSubExpTime(const ns i);
|
||||||
uint64_t getSubPeriod() const;
|
ns getSubPeriod() const;
|
||||||
/* [Eiger] */
|
/* [Eiger] */
|
||||||
void setSubPeriod(const uint64_t i);
|
void setSubPeriod(const ns i);
|
||||||
uint32_t getNumberofAnalogSamples() const;
|
uint32_t getNumberofAnalogSamples() const;
|
||||||
/**[Ctb][Moench] */
|
/**[Ctb][Moench] */
|
||||||
void setNumberofAnalogSamples(const uint32_t i);
|
void setNumberofAnalogSamples(const uint32_t i);
|
||||||
@ -225,7 +227,7 @@ class Implementation : private virtual slsDetectorDefs {
|
|||||||
void setTenGigaADCEnableMask(const uint32_t mask);
|
void setTenGigaADCEnableMask(const uint32_t mask);
|
||||||
std::vector<int> getDbitList() const;
|
std::vector<int> getDbitList() const;
|
||||||
/* [Ctb] */
|
/* [Ctb] */
|
||||||
void setDbitList(const std::vector<int>& v);
|
void setDbitList(const std::vector<int> &v);
|
||||||
int getDbitOffset() const;
|
int getDbitOffset() const;
|
||||||
/* [Ctb] */
|
/* [Ctb] */
|
||||||
void setDbitOffset(const int s);
|
void setDbitOffset(const int s);
|
||||||
@ -249,8 +251,6 @@ class Implementation : private virtual slsDetectorDefs {
|
|||||||
void *arg);
|
void *arg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DeleteMembers();
|
|
||||||
void InitializeMembers();
|
|
||||||
void SetLocalNetworkParameters();
|
void SetLocalNetworkParameters();
|
||||||
void SetThreadPriorities();
|
void SetThreadPriorities();
|
||||||
void SetupFifoStructure();
|
void SetupFifoStructure();
|
||||||
@ -267,89 +267,89 @@ class Implementation : private virtual slsDetectorDefs {
|
|||||||
* ************************************************/
|
* ************************************************/
|
||||||
|
|
||||||
// config parameters
|
// config parameters
|
||||||
int numThreads;
|
int numThreads{1};
|
||||||
detectorType myDetectorType;
|
detectorType myDetectorType{GENERIC};
|
||||||
int numDet[MAX_DIMENSIONS];
|
int numDet[MAX_DIMENSIONS] = {0, 0};
|
||||||
int modulePos;
|
int modulePos{0};
|
||||||
std::string detHostname;
|
std::string detHostname;
|
||||||
bool silentMode;
|
bool silentMode{false};
|
||||||
uint32_t fifoDepth;
|
uint32_t fifoDepth{0};
|
||||||
frameDiscardPolicy frameDiscardMode;
|
frameDiscardPolicy frameDiscardMode{NO_DISCARD};
|
||||||
bool framePadding;
|
bool framePadding{true};
|
||||||
pid_t parentThreadId;
|
pid_t parentThreadId;
|
||||||
pid_t tcpThreadId;
|
pid_t tcpThreadId;
|
||||||
|
|
||||||
// file parameters
|
// file parameters
|
||||||
fileFormat fileFormatType;
|
fileFormat fileFormatType{BINARY};
|
||||||
std::string filePath;
|
std::string filePath{"/"};
|
||||||
std::string fileName;
|
std::string fileName{"run"};
|
||||||
uint64_t fileIndex;
|
uint64_t fileIndex{0};
|
||||||
bool fileWriteEnable;
|
bool fileWriteEnable{true};
|
||||||
bool masterFileWriteEnable;
|
bool masterFileWriteEnable{true};
|
||||||
bool overwriteEnable;
|
bool overwriteEnable{true};
|
||||||
uint32_t framesPerFile;
|
uint32_t framesPerFile{0};
|
||||||
|
|
||||||
// acquisition
|
// acquisition
|
||||||
std::atomic<runStatus> status;
|
std::atomic<runStatus> status{IDLE};
|
||||||
bool stoppedFlag;
|
bool stoppedFlag{false};
|
||||||
|
|
||||||
// network configuration (UDP)
|
// network configuration (UDP)
|
||||||
int numUDPInterfaces;
|
int numUDPInterfaces{1};
|
||||||
std::vector<std::string> eth;
|
std::array<std::string,MAX_NUMBER_OF_LISTENING_THREADS>eth;
|
||||||
std::vector<uint32_t> udpPortNum;
|
std::array<uint32_t,MAX_NUMBER_OF_LISTENING_THREADS> udpPortNum{DEFAULT_UDP_PORTNO, DEFAULT_UDP_PORTNO+1};
|
||||||
int64_t udpSocketBufferSize;
|
int64_t udpSocketBufferSize{0};
|
||||||
int64_t actualUDPSocketBufferSize;
|
int64_t actualUDPSocketBufferSize{0};
|
||||||
|
|
||||||
// zmq parameters
|
// zmq parameters
|
||||||
bool dataStreamEnable;
|
bool dataStreamEnable{false};
|
||||||
uint32_t streamingFrequency;
|
uint32_t streamingFrequency{1};
|
||||||
uint32_t streamingTimerInMs;
|
uint32_t streamingTimerInMs{DEFAULT_STREAMING_TIMER_IN_MS};
|
||||||
uint32_t streamingStartFnum;
|
uint32_t streamingStartFnum{0};
|
||||||
uint32_t streamingPort;
|
uint32_t streamingPort{0};
|
||||||
sls::IpAddr streamingSrcIP;
|
sls::IpAddr streamingSrcIP = sls::IpAddr{};
|
||||||
std::map<std::string, std::string> additionalJsonHeader;
|
std::map<std::string, std::string> additionalJsonHeader;
|
||||||
|
|
||||||
// detector parameters
|
// detector parameters
|
||||||
uint64_t numberOfTotalFrames;
|
uint64_t numberOfTotalFrames{0};
|
||||||
uint64_t numberOfFrames;
|
uint64_t numberOfFrames{1};
|
||||||
uint64_t numberOfTriggers;
|
uint64_t numberOfTriggers{1};
|
||||||
uint64_t numberOfBursts;
|
uint64_t numberOfBursts{1};
|
||||||
int numberOfAdditionalStorageCells;
|
int numberOfAdditionalStorageCells{0};
|
||||||
int numberOfGates;
|
int numberOfGates{0};
|
||||||
timingMode timingMode;
|
timingMode timingMode{AUTO_TIMING};
|
||||||
burstMode burstMode;
|
burstMode burstMode{BURST_INTERNAL};
|
||||||
uint64_t acquisitionPeriod;
|
ns acquisitionPeriod = std::chrono::nanoseconds(SAMPLE_TIME_IN_NS);
|
||||||
uint64_t acquisitionTime;
|
ns acquisitionTime = std::chrono::nanoseconds(0);
|
||||||
uint64_t acquisitionTime1;
|
ns acquisitionTime1 = std::chrono::nanoseconds(0);
|
||||||
uint64_t acquisitionTime2;
|
ns acquisitionTime2 = std::chrono::nanoseconds(0);
|
||||||
uint64_t acquisitionTime3;
|
ns acquisitionTime3 = std::chrono::nanoseconds(0);
|
||||||
uint64_t gateDelay1;
|
ns gateDelay1 = std::chrono::nanoseconds(0);
|
||||||
uint64_t gateDelay2;
|
ns gateDelay2 = std::chrono::nanoseconds(0);
|
||||||
uint64_t gateDelay3;
|
ns gateDelay3 = std::chrono::nanoseconds(0);
|
||||||
uint64_t subExpTime;
|
ns subExpTime = std::chrono::nanoseconds(0);
|
||||||
uint64_t subPeriod;
|
ns subPeriod = std::chrono::nanoseconds(0);
|
||||||
uint64_t numberOfAnalogSamples;
|
uint32_t numberOfAnalogSamples{0};
|
||||||
uint64_t numberOfDigitalSamples;
|
uint32_t numberOfDigitalSamples{0};
|
||||||
uint32_t counterMask;
|
uint32_t counterMask{0};
|
||||||
uint32_t dynamicRange;
|
uint32_t dynamicRange{16};
|
||||||
ROI roi;
|
ROI roi{};
|
||||||
bool tengigaEnable;
|
bool tengigaEnable{false};
|
||||||
int flippedDataX;
|
int flippedDataX{0};
|
||||||
bool quadEnable;
|
bool quadEnable{false};
|
||||||
bool activated;
|
bool activated{true};
|
||||||
bool deactivatedPaddingEnable;
|
bool deactivatedPaddingEnable{true};
|
||||||
int numLinesReadout;
|
int numLinesReadout{MAX_EIGER_ROWS_PER_READOUT};
|
||||||
std::vector<int64_t> rateCorrections;
|
std::vector<int64_t> rateCorrections;
|
||||||
readoutMode readoutType;
|
readoutMode readoutType{ANALOG_ONLY};
|
||||||
uint32_t adcEnableMaskOneGiga;
|
uint32_t adcEnableMaskOneGiga{BIT32_MASK};
|
||||||
uint32_t adcEnableMaskTenGiga;
|
uint32_t adcEnableMaskTenGiga{BIT32_MASK};
|
||||||
std::vector<int> ctbDbitList;
|
std::vector<int> ctbDbitList;
|
||||||
int ctbDbitOffset;
|
int ctbDbitOffset{0};
|
||||||
int ctbAnalogDataBytes;
|
int ctbAnalogDataBytes{0};
|
||||||
|
|
||||||
// callbacks
|
// callbacks
|
||||||
int (*startAcquisitionCallBack)(std::string, std::string, uint64_t,
|
int (*startAcquisitionCallBack)(std::string, std::string, uint64_t,
|
||||||
uint32_t, void *);
|
uint32_t, void *){nullptr};
|
||||||
void *pStartAcquisition;
|
void *pStartAcquisition;
|
||||||
void (*acquisitionFinishedCallBack)(uint64_t, void *);
|
void (*acquisitionFinishedCallBack)(uint64_t, void *);
|
||||||
void *pAcquisitionFinished;
|
void *pAcquisitionFinished;
|
||||||
|
@ -42,10 +42,14 @@ std::string ToString(const slsDetectorDefs::rxParameters &r) {
|
|||||||
<< "bursts:" << r.bursts << std::endl
|
<< "bursts:" << r.bursts << std::endl
|
||||||
<< "analogSamples:" << r.analogSamples << std::endl
|
<< "analogSamples:" << r.analogSamples << std::endl
|
||||||
<< "digitalSamples:" << r.digitalSamples << std::endl
|
<< "digitalSamples:" << r.digitalSamples << std::endl
|
||||||
<< "expTimeNs:" << r.expTimeNs << std::endl
|
<< "expTime:" << ToString(std::chrono::nanoseconds(r.expTimeNs))
|
||||||
<< "periodNs:" << r.periodNs << std::endl
|
<< std::endl
|
||||||
<< "subExpTimeNs:" << r.subExpTimeNs << std::endl
|
<< "period:" << ToString(std::chrono::nanoseconds(r.periodNs))
|
||||||
<< "subDeadTimeNs:" << r.subDeadTimeNs << std::endl
|
<< std::endl
|
||||||
|
<< "subExpTime:" << ToString(std::chrono::nanoseconds(r.subExpTimeNs))
|
||||||
|
<< std::endl
|
||||||
|
<< "subDeadTime:" << ToString(std::chrono::nanoseconds(r.subDeadTimeNs))
|
||||||
|
<< std::endl
|
||||||
<< "activate:" << r.activate << std::endl
|
<< "activate:" << r.activate << std::endl
|
||||||
<< "quad:" << r.quad << std::endl
|
<< "quad:" << r.quad << std::endl
|
||||||
<< "dynamicRange:" << r.dynamicRange << std::endl
|
<< "dynamicRange:" << r.dynamicRange << std::endl
|
||||||
@ -58,12 +62,18 @@ std::string ToString(const slsDetectorDefs::rxParameters &r) {
|
|||||||
<< "roi.xmax:" << r.roi.xmax << std::endl
|
<< "roi.xmax:" << r.roi.xmax << std::endl
|
||||||
<< "countermask:" << r.countermask << std::endl
|
<< "countermask:" << r.countermask << std::endl
|
||||||
<< "burstType:" << r.burstType << std::endl
|
<< "burstType:" << r.burstType << std::endl
|
||||||
<< "exptime1:" << r.expTime1Ns << std::endl
|
<< "exptime1:" << ToString(std::chrono::nanoseconds(r.expTime1Ns))
|
||||||
<< "exptime2:" << r.expTime2Ns << std::endl
|
<< std::endl
|
||||||
<< "exptime3:" << r.expTime3Ns << std::endl
|
<< "exptime2:" << ToString(std::chrono::nanoseconds(r.expTime2Ns))
|
||||||
<< "gateDelay1:" << r.gateDelay1Ns << std::endl
|
<< std::endl
|
||||||
<< "gateDelay2:" << r.gateDelay2Ns << std::endl
|
<< "exptime3:" << ToString(std::chrono::nanoseconds(r.expTime3Ns))
|
||||||
<< "gateDelay3:" << r.gateDelay3Ns << std::endl
|
<< std::endl
|
||||||
|
<< "gateDelay1:" << ToString(std::chrono::nanoseconds(r.gateDelay1Ns))
|
||||||
|
<< std::endl
|
||||||
|
<< "gateDelay2:" << ToString(std::chrono::nanoseconds(r.gateDelay2Ns))
|
||||||
|
<< std::endl
|
||||||
|
<< "gateDelay3:" << ToString(std::chrono::nanoseconds(r.gateDelay3Ns))
|
||||||
|
<< std::endl
|
||||||
<< "gates:" << r.gates << std::endl
|
<< "gates:" << r.gates << std::endl
|
||||||
<< ']';
|
<< ']';
|
||||||
return oss.str();
|
return oss.str();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user