mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-12-16 01:21:20 +01:00
refactorign
This commit is contained in:
@@ -210,7 +210,7 @@ std::string DataProcessor::CreateVirtualFile(
|
||||
|
||||
int ny = generalData->nPixelsY;
|
||||
if (generalData->dynamicRange == 4)
|
||||
ny = generalData->nPixelsY / 2;
|
||||
ny /= 2;
|
||||
bool gotthard25um = ((generalData->detType == GOTTHARD ||
|
||||
generalData->detType == GOTTHARD2) &&
|
||||
(numModX * numModY) == 2);
|
||||
|
||||
@@ -156,11 +156,7 @@ void Implementation::setDetectorType(const detectorType d) {
|
||||
}
|
||||
|
||||
if (d == EIGER) {
|
||||
// resets ROIs and sets size to 2
|
||||
std::vector<ROI> rois(2);
|
||||
std::vector<ROI> multiRoi(1);
|
||||
setPortROIs(rois);
|
||||
setMultiROIMetadata(multiRoi);
|
||||
ResetRois();
|
||||
}
|
||||
|
||||
SetLocalNetworkParameters();
|
||||
@@ -409,6 +405,15 @@ std::vector<slsDetectorDefs::ROI> Implementation::getPortROIs() const {
|
||||
return portRois;
|
||||
}
|
||||
|
||||
void Implementation::ResetRois() {
|
||||
int numports = generalData->numUDPInterfaces;
|
||||
std::vector<ROI> rois(numports);
|
||||
std::vector<ROI> multiRoi(1);
|
||||
setPortROIs(rois);
|
||||
setMultiROIMetadata(multiRoi);
|
||||
}
|
||||
|
||||
|
||||
void Implementation::setPortROIs(const std::vector<defs::ROI> &args) {
|
||||
int nx = static_cast<int>(generalData->nPixelsX);
|
||||
int ny = static_cast<int>(generalData->nPixelsY);
|
||||
@@ -432,8 +437,6 @@ void Implementation::setPortROIs(const std::vector<defs::ROI> &args) {
|
||||
for (size_t i = 0; i != dataProcessor.size(); ++i) {
|
||||
dataProcessor[i]->SetPortROI(portRois[i]);
|
||||
}
|
||||
if (dataProcessor.size() > 0)
|
||||
dataProcessor[0]->setMultiROIMetadata(multiRoiMetadata);
|
||||
for (size_t i = 0; i != dataStreamer.size(); ++i) {
|
||||
dataStreamer[i]->SetPortROI(portRois[i]);
|
||||
}
|
||||
@@ -1040,8 +1043,6 @@ int Implementation::getNumberofUDPInterfaces() const {
|
||||
|
||||
// not Eiger
|
||||
void Implementation::setNumberofUDPInterfaces(const int n) {
|
||||
LOG(logDEBUG) << "Setting Number of UDP Interfaces: " << n;
|
||||
|
||||
if (generalData->detType == EIGER) {
|
||||
throw RuntimeError("Cannot set number of UDP interfaces for Eiger");
|
||||
}
|
||||
@@ -1060,11 +1061,7 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
||||
// fifo
|
||||
SetupFifoStructure();
|
||||
|
||||
// roi cleared - complete detector and sets roi vector size
|
||||
std::vector<ROI> rois(n);
|
||||
std::vector<ROI> multiRoi(1);
|
||||
setPortROIs(rois);
|
||||
setMultiROIMetadata(multiRoi);
|
||||
ResetRois();
|
||||
|
||||
// create threads
|
||||
for (int i = 0; i < generalData->numUDPInterfaces; ++i) {
|
||||
|
||||
@@ -284,6 +284,7 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
void SetupFifoStructure();
|
||||
|
||||
const xy GetPortGeometry() const;
|
||||
void ResetRois();
|
||||
void ResetParametersforNewAcquisition();
|
||||
void CreateUDPSockets();
|
||||
void SetupWriter();
|
||||
|
||||
@@ -154,6 +154,17 @@ void MasterAttributes::GetFinalBinaryAttributes(
|
||||
w->EndObject();
|
||||
}
|
||||
|
||||
void MasterAttributes::GetBinaryRois(
|
||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w) {
|
||||
w->Key("Receiver Rois");
|
||||
w->StartArray();
|
||||
for (const slsDetectorDefs::ROI &roi : rois) {
|
||||
std::string roi_str = ToString(roi);
|
||||
w->String(roi_str.c_str());
|
||||
}
|
||||
w->EndArray();
|
||||
}
|
||||
|
||||
#ifdef HDF5C
|
||||
void MasterAttributes::WriteCommonHDF5Attributes(H5::H5File *fd,
|
||||
H5::Group *group) {
|
||||
@@ -555,13 +566,7 @@ void MasterAttributes::WriteHDF5TransceiverSamples(H5::Group *group) {
|
||||
|
||||
void MasterAttributes::GetJungfrauBinaryAttributes(
|
||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w) {
|
||||
w->Key("Receiver Rois");
|
||||
w->StartArray();
|
||||
for (const slsDetectorDefs::ROI &roi : rois) {
|
||||
std::string roi_str = ToString(roi);
|
||||
w->String(roi_str.c_str());
|
||||
}
|
||||
w->EndArray();
|
||||
GetBinaryRois(w);
|
||||
w->Key("Exptime");
|
||||
w->String(ToString(exptime).c_str());
|
||||
w->Key("Period");
|
||||
@@ -584,13 +589,7 @@ void MasterAttributes::WriteJungfrauHDF5Attributes(H5::Group *group) {
|
||||
|
||||
void MasterAttributes::GetMoenchBinaryAttributes(
|
||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w) {
|
||||
w->Key("Receiver Rois");
|
||||
w->StartArray();
|
||||
for (const slsDetectorDefs::ROI &roi : rois) {
|
||||
std::string roi_str = ToString(roi);
|
||||
w->String(roi_str.c_str());
|
||||
}
|
||||
w->EndArray();
|
||||
GetBinaryRois(w);
|
||||
w->Key("Exptime");
|
||||
w->String(ToString(exptime).c_str());
|
||||
w->Key("Period");
|
||||
@@ -613,13 +612,7 @@ void MasterAttributes::WriteMoenchHDF5Attributes(H5::Group *group) {
|
||||
|
||||
void MasterAttributes::GetEigerBinaryAttributes(
|
||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w) {
|
||||
w->Key("Receiver Rois");
|
||||
w->StartArray();
|
||||
for (const slsDetectorDefs::ROI &roi : rois) {
|
||||
std::string roi_str = ToString(roi);
|
||||
w->String(roi_str.c_str());
|
||||
}
|
||||
w->EndArray();
|
||||
GetBinaryRois(w);
|
||||
w->Key("Dynamic Range");
|
||||
w->Uint(dynamicRange);
|
||||
w->Key("Ten Giga");
|
||||
@@ -660,13 +653,7 @@ void MasterAttributes::WriteEigerHDF5Attributes(H5::Group *group) {
|
||||
|
||||
void MasterAttributes::GetMythen3BinaryAttributes(
|
||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w) {
|
||||
w->Key("Receiver Rois");
|
||||
w->StartArray();
|
||||
for (const slsDetectorDefs::ROI &roi : rois) {
|
||||
std::string roi_str = ToString(roi);
|
||||
w->String(roi_str.c_str());
|
||||
}
|
||||
w->EndArray();
|
||||
GetBinaryRois(w);
|
||||
w->Key("Dynamic Range");
|
||||
w->Uint(dynamicRange);
|
||||
w->Key("Ten Giga");
|
||||
@@ -705,13 +692,7 @@ void MasterAttributes::WriteMythen3HDF5Attributes(H5::Group *group) {
|
||||
|
||||
void MasterAttributes::GetGotthard2BinaryAttributes(
|
||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w) {
|
||||
w->Key("Receiver Rois");
|
||||
w->StartArray();
|
||||
for (const slsDetectorDefs::ROI &roi : rois) {
|
||||
std::string roi_str = ToString(roi);
|
||||
w->String(roi_str.c_str());
|
||||
}
|
||||
w->EndArray();
|
||||
GetBinaryRois(w);
|
||||
w->Key("Exptime");
|
||||
w->String(ToString(exptime).c_str());
|
||||
w->Key("Period");
|
||||
|
||||
@@ -78,6 +78,8 @@ class MasterAttributes {
|
||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
||||
void GetFinalBinaryAttributes(
|
||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
||||
void GetBinaryRois(
|
||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
||||
#ifdef HDF5C
|
||||
void WriteCommonHDF5Attributes(H5::H5File *fd, H5::Group *group);
|
||||
void WriteFinalHDF5Attributes(H5::Group *group);
|
||||
|
||||
Reference in New Issue
Block a user