merge fix with developer

This commit is contained in:
maliakal_d 2022-03-28 10:26:28 +02:00
commit 039e1fd829
29 changed files with 365 additions and 136 deletions

View File

@ -55,6 +55,8 @@ This document describes the differences between v7.0.0 and v6.x.x
- 10g eiger nextframenumber get fixed. - 10g eiger nextframenumber get fixed.
- stop, able to set nextframenumber to a consistent (max + 1) for all modules if different (eiger/ctb/jungfrau/moench) - stop, able to set nextframenumber to a consistent (max + 1) for all modules if different (eiger/ctb/jungfrau/moench)
- ctb: can set names for all the dacs - ctb: can set names for all the dacs
- fpga/kernel programming, checks if drive is a special file and not a normal file
- gotthard 25 um image reconstructed in gui and virtual hdf5 (firmware updated for slave to reverse channels)
2. Resolved Issues 2. Resolved Issues
================== ==================

View File

@ -1544,9 +1544,10 @@ void init_det(py::module &m) {
Detector::setAdditionalJsonParameter, Detector::setAdditionalJsonParameter,
py::arg(), py::arg(), py::arg() = Positions{}) py::arg(), py::arg(), py::arg() = Positions{})
.def("programFPGA", .def("programFPGA",
(void (Detector::*)(const std::string &, sls::Positions)) & (void (Detector::*)(const std::string &, const bool,
sls::Positions)) &
Detector::programFPGA, Detector::programFPGA,
py::arg(), py::arg() = Positions{}) py::arg(), py::arg(), py::arg() = Positions{})
.def("resetFPGA", .def("resetFPGA",
(void (Detector::*)(sls::Positions)) & Detector::resetFPGA, (void (Detector::*)(sls::Positions)) & Detector::resetFPGA,
py::arg() = Positions{}) py::arg() = Positions{})

View File

@ -429,10 +429,15 @@ class singlePhotonDetector : public analogDetector<uint16_t> {
for (ic = -(clusterSize / 2); ic < (clusterSize / 2) + 1; for (ic = -(clusterSize / 2); ic < (clusterSize / 2) + 1;
ic++) { ic++) {
if ((iy + ir) >= iy && (iy + ir) < ny && if ((iy + ir) >= 0 && (iy + ir) < ny &&
(ix + ic) >= ix && (ix + ic) < nx) { (ix + ic) >= 0 && (ix + ic) < nx) {
if ((iy + ir) >= iy && (ix + ic) >= ix ) {
val[(iy + ir) * nx + ix + ic] = val[(iy + ir) * nx + ix + ic] =
subtractPedestal(data, ix + ic, iy + ir, cm); subtractPedestal(data, ix + ic, iy + ir, cm);
}
v = &(val[(iy + ir) * nx + ix + ic]); v = &(val[(iy + ir) * nx + ix + ic]);
tot += *v; tot += *v;
if (ir <= 0 && ic <= 0) if (ir <= 0 && ic <= 0)
@ -443,9 +448,9 @@ class singlePhotonDetector : public analogDetector<uint16_t> {
tl += *v; tl += *v;
if (ir >= 0 && ic >= 0) if (ir >= 0 && ic >= 0)
tr += *v; tr += *v;
if (*v > max) { if (*v > max) //{
max = *v; max = *v;
} //}
} }
} }
} }
@ -513,12 +518,19 @@ class singlePhotonDetector : public analogDetector<uint16_t> {
for (ic = -(clusterSize / 2); for (ic = -(clusterSize / 2);
ic < (clusterSize / 2) + 1; ic++) { ic < (clusterSize / 2) + 1; ic++) {
if ((iy + ir) >= 0 && (iy + ir) < ny && if ((iy + ir) >= 0 && (iy + ir) < ny &&
(ix + ic) >= 0 && (ix + ic) < nx) (ix + ic) >= 0 && (ix + ic) < nx) {
(clusters + nph) (clusters + nph)
->set_data(val[(iy + ir) * nx + ix + ic], ->set_data(val[(iy + ir) * nx + ix + ic],
ic, ir); ic, ir);
if (val[(iy + ir) * nx + ix + ic]>max)
good=0;
} }
} }
}
if (good==0) {
(clusters + nph)->print();
cout << max << " " << val[iy * nx + ix] << endl;
}
good = 1; good = 1;
if (eMin > 0 && tot < eMin) if (eMin > 0 && tot < eMin)
good = 0; good = 0;

View File

@ -216,14 +216,18 @@ class single_photon_hit {
// int ix, iy; // int ix, iy;
printf("***************\n");
printf("** %d %d **\n",x,y);
for (int iy = 0; iy < dy; iy++) { for (int iy = 0; iy < dy; iy++) {
for (int ix = 0; ix < dx; ix++) { for (int ix = 0; ix < dx; ix++) {
printf("%d \t", data[ix + iy * dx]); printf("%d \t", data[ix + iy * dx]);
} }
printf("\n"); printf("\n");
} }
printf("***************\n");
} }
/** /**
assign the value to the element of the cluster matrix, with relative assign the value to the element of the cluster matrix, with relative
coordinates where the center of the cluster is (0,0) \param v value to be coordinates where the center of the cluster is (0,0) \param v value to be

View File

@ -91,8 +91,10 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
void Update2dPlot(); void Update2dPlot();
void Update1dXYRange(); void Update1dXYRange();
void Update2dXYRange(); void Update2dXYRange();
void rearrangeGotthard25data(double *data);
static const int NUM_PEDESTAL_FRAMES = 20; static const int NUM_PEDESTAL_FRAMES = 20;
static const int NUM_GOTTHARD25_CHANS = 1280;
sls::Detector *det; sls::Detector *det;
slsDetectorDefs::detectorType detType; slsDetectorDefs::detectorType detType;
@ -164,4 +166,5 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
uint32_t pixelMask{0}; uint32_t pixelMask{0};
uint32_t gainMask{0}; uint32_t gainMask{0};
int gainOffset{0}; int gainOffset{0};
bool gotthard25;
}; };

View File

@ -80,6 +80,10 @@ void qDrawPlot::SetupWidgetWindow() {
fileSaveName = "Image"; fileSaveName = "Image";
} }
gotthard25 = ((detType == slsDetectorDefs::GOTTHARD2 ||
detType == slsDetectorDefs::GOTTHARD) &&
det->size() == 2);
SetupPlots(); SetupPlots();
SetDataCallBack(true); SetDataCallBack(true);
det->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack), det->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack),
@ -807,6 +811,11 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex,
isGainDataExtracted = false; isGainDataExtracted = false;
} }
// gotthard25um rearranging
if (gotthard25) {
rearrangeGotthard25data(rawData);
}
// title and frame index titles // title and frame index titles
plotTitle = plotTitle =
plotTitlePrefix + QString(data->fileName.c_str()).section('/', -1); plotTitlePrefix + QString(data->fileName.c_str()).section('/', -1);
@ -1145,6 +1154,18 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size,
} }
} }
void qDrawPlot::rearrangeGotthard25data(double *data) {
const int nChans = NUM_GOTTHARD25_CHANS;
double temp[nChans * 2] = {0.0};
for (int i = 0; i != nChans; ++i) {
// master module
temp[i * 2] = data[i];
// slave module
temp[i * 2 + 1] = data[nChans + i];
}
memcpy(data, temp, nChans * 2 * sizeof(double));
}
void qDrawPlot::UpdatePlot() { void qDrawPlot::UpdatePlot() {
std::lock_guard<std::mutex> lock(mPlots); std::lock_guard<std::mutex> lock(mPlots);
LOG(logDEBUG) << "Update Plot"; LOG(logDEBUG) << "Update Plot";

View File

@ -26,10 +26,12 @@ int preparetoCopyProgram(char *mess, char *functionType, FILE **fd,
uint64_t fsize); uint64_t fsize);
int eraseAndWriteToFlash(char *mess, enum PROGRAM_INDEX index, int eraseAndWriteToFlash(char *mess, enum PROGRAM_INDEX index,
char *functionType, char *clientChecksum, char *functionType, char *clientChecksum,
ssize_t fsize); ssize_t fsize, int forceDeleteNormalFile);
int getDrive(char *mess, enum PROGRAM_INDEX index); int getDrive(char *mess, enum PROGRAM_INDEX index);
/** Notify fpga not to touch flash, open src and flash drive to write */ /** Notify fpga not to touch flash, open src and flash drive to write */
int openFileForFlash(char *mess, FILE **flashfd, FILE **srcfd); int openFileForFlash(char *mess, enum PROGRAM_INDEX index, FILE **flashfd, FILE **srcfd,
int forceDeleteNormalFile);
int checkNormalFile(char *mess, enum PROGRAM_INDEX index, int forceDeleteNormalFile);
int eraseFlash(char *mess); int eraseFlash(char *mess);
/* write from tmp file to flash */ /* write from tmp file to flash */
int writeToFlash(char *mess, ssize_t fsize, FILE *flashfd, FILE *srcfd); int writeToFlash(char *mess, ssize_t fsize, FILE *flashfd, FILE *srcfd);

View File

@ -285,7 +285,8 @@ int update_detector_server(int);
int receive_program(int file_des, enum PROGRAM_INDEX index); int receive_program(int file_des, enum PROGRAM_INDEX index);
void receive_program_via_blackfin(int file_des, enum PROGRAM_INDEX index, void receive_program_via_blackfin(int file_des, enum PROGRAM_INDEX index,
char *functionType, uint64_t filesize, char *functionType, uint64_t filesize,
char *checksum, char *serverName); char *checksum, char *serverName,
int forceDeleteNormalFile);
void receive_program_default(int file_des, enum PROGRAM_INDEX index, void receive_program_default(int file_des, enum PROGRAM_INDEX index,
char *functionType, uint64_t filesize, char *functionType, uint64_t filesize,
char *checksum, char *serverName); char *checksum, char *serverName);

View File

@ -7,6 +7,7 @@
#include "slsDetectorServer_defs.h" #include "slsDetectorServer_defs.h"
#include <string.h> #include <string.h>
#include <sys/stat.h>
#include <sys/sysinfo.h> #include <sys/sysinfo.h>
#include <unistd.h> // usleep #include <unistd.h> // usleep
@ -38,6 +39,9 @@
#define CMD_GET_AMD_FLASH "dmesg | grep Amd" #define CMD_GET_AMD_FLASH "dmesg | grep Amd"
#define CMD_CREATE_DEVICE_FILE_PART1 "mknod"
#define CMD_CREATE_DEVICE_FILE_PART2 "c 90 6"
#define FLASH_BUFFER_MEMORY_SIZE (128 * 1024) // 500 KB #define FLASH_BUFFER_MEMORY_SIZE (128 * 1024) // 500 KB
// clang-format on // clang-format on
@ -274,7 +278,8 @@ int allowUpdate(char *mess, char *functionType) {
getKernelVersion(retvals); getKernelVersion(retvals);
snprintf(mess, MAX_STR_LENGTH, snprintf(mess, MAX_STR_LENGTH,
"Could not update %s. Kernel version %s is too old to " "Could not update %s. Kernel version %s is too old to "
"update the Amd flash/ root directory. Most likely, blackfin needs rescue or replacement. Please contact us.\n", "update the Amd flash/ root directory. Most likely, blackfin "
"needs rescue or replacement. Please contact us.\n",
functionType, retvals); functionType, retvals);
LOG(logERROR, (mess)); LOG(logERROR, (mess));
return FAIL; return FAIL;
@ -319,7 +324,7 @@ int preparetoCopyProgram(char *mess, char *functionType, FILE **fd,
int eraseAndWriteToFlash(char *mess, enum PROGRAM_INDEX index, int eraseAndWriteToFlash(char *mess, enum PROGRAM_INDEX index,
char *functionType, char *clientChecksum, char *functionType, char *clientChecksum,
ssize_t fsize) { ssize_t fsize, int forceDeleteNormalFile) {
memset(messageType, 0, sizeof(messageType)); memset(messageType, 0, sizeof(messageType));
strcpy(messageType, functionType); strcpy(messageType, functionType);
@ -330,7 +335,8 @@ int eraseAndWriteToFlash(char *mess, enum PROGRAM_INDEX index,
FILE *flashfd = NULL; FILE *flashfd = NULL;
FILE *srcfd = NULL; FILE *srcfd = NULL;
if (openFileForFlash(mess, &flashfd, &srcfd) == FAIL) { if (openFileForFlash(mess, index, &flashfd, &srcfd, forceDeleteNormalFile) ==
FAIL) {
return FAIL; return FAIL;
} }
@ -434,7 +440,8 @@ int getDrive(char *mess, enum PROGRAM_INDEX index) {
return OK; return OK;
} }
int openFileForFlash(char *mess, FILE **flashfd, FILE **srcfd) { int openFileForFlash(char *mess, enum PROGRAM_INDEX index, FILE **flashfd, FILE **srcfd,
int forceDeleteNormalFile) {
// open src file // open src file
*srcfd = fopen(TEMP_PROG_FILE_NAME, "r"); *srcfd = fopen(TEMP_PROG_FILE_NAME, "r");
if (*srcfd == NULL) { if (*srcfd == NULL) {
@ -447,6 +454,11 @@ int openFileForFlash(char *mess, FILE **flashfd, FILE **srcfd) {
} }
LOG(logDEBUG1, ("Temp file ready for reading\n")); LOG(logDEBUG1, ("Temp file ready for reading\n"));
if (checkNormalFile(mess, index, forceDeleteNormalFile) == FAIL) {
fclose(*srcfd);
return FAIL;
}
// open flash drive for writing // open flash drive for writing
*flashfd = fopen(flashDriveName, "w"); *flashfd = fopen(flashDriveName, "w");
if (*flashfd == NULL) { if (*flashfd == NULL) {
@ -462,6 +474,95 @@ int openFileForFlash(char *mess, FILE **flashfd, FILE **srcfd) {
return OK; return OK;
} }
int checkNormalFile(char *mess, enum PROGRAM_INDEX index, int forceDeleteNormalFile) {
#ifndef VIRTUAL
// check if its a normal file or special file
struct stat buf;
if (stat(flashDriveName, &buf) == -1) {
sprintf(mess,
"Could not %s. Unable to find the flash drive %s\n",
messageType, flashDriveName);
LOG(logERROR, (mess));
return FAIL;
}
// zero = normal file (not char special drive file)
if (!S_ISCHR(buf.st_mode)) {
// kernel memory is not permanent
if (index != PROGRAM_FPGA) {
sprintf(mess,
"Could not %s. The flash drive found is a normal file. "
"Reboot board using 'rebootcontroller' command to load "
"proper device tree\n",
messageType);
LOG(logERROR, (mess));
return FAIL;
}
// user does not allow to fix it (default)
if (forceDeleteNormalFile == 0) {
sprintf(mess,
"Could not %s. The flash drive %s found for fpga programming is a normal file. To "
"fix this (by deleting this file, creating the flash drive and proceeding with "
"programming), re-run the programming command 'programfpga' with parameter "
"'--force-delete-normal-file'\n",
messageType, flashDriveName);
LOG(logERROR, (mess));
return FAIL;
}
// fpga memory stays after a reboot, user allowed to fix it
LOG(logWARNING, ("Flash drive invalidated (normal file). Fixing it...\n"));
// user allows to fix it, so force delete normal file
char cmd[MAX_STR_LENGTH] = {0};
char retvals[MAX_STR_LENGTH] = {0};
if (snprintf(cmd, MAX_STR_LENGTH, "rm %s", flashDriveName) >=
MAX_STR_LENGTH) {
sprintf(mess,
"Could not update %s. Command to delete normal file %s is "
"too long\n",
messageType, flashDriveName);
LOG(logERROR, (mess));
return FAIL;
}
if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
snprintf(
mess, MAX_STR_LENGTH,
"Could not update %s. (could not delete normal file %s: %s)\n",
messageType, flashDriveName, retvals);
LOG(logERROR, (mess));
return FAIL;
}
LOG(logINFO, ("\tDeleted Normal File (%s)\n", flashDriveName));
// create special drive
if (snprintf(cmd, MAX_STR_LENGTH, "%s %s %s",
CMD_CREATE_DEVICE_FILE_PART1, flashDriveName,
CMD_CREATE_DEVICE_FILE_PART2) >= MAX_STR_LENGTH) {
sprintf(mess,
"Could not update %s. Command to create special file %s is "
"too long\n",
messageType, flashDriveName);
LOG(logERROR, (mess));
return FAIL;
}
if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
snprintf(
mess, MAX_STR_LENGTH,
"Could not update %s. (could not create special file %s: %s)\n",
messageType, flashDriveName, retvals);
LOG(logERROR, (mess));
return FAIL;
}
LOG(logINFO, ("\tSpecial File created (%s)\n", flashDriveName));
} else {
LOG(logINFO, ("\tValidated flash drive (not a normal file)\n"));
}
#endif
return OK;
}
int eraseFlash(char *mess) { int eraseFlash(char *mess) {
LOG(logINFO, ("\tErasing Flash...\n")); LOG(logINFO, ("\tErasing Flash...\n"));

View File

@ -8,6 +8,7 @@
#include <string.h> #include <string.h>
#include <unistd.h> // usleep #include <unistd.h> // usleep
#include <sys/stat.h>
/* global variables */ /* global variables */
@ -146,6 +147,30 @@ int getDrive(char *mess, enum PROGRAM_INDEX index) {
} }
int openFileForFlash(char *mess, FILE **flashfd) { int openFileForFlash(char *mess, FILE **flashfd) {
#ifndef VIRTUAL
// check if its a normal file or special file
struct stat buf;
if (stat(flashDriveName, &buf) == -1) {
sprintf(mess,
"Could not %s. Unable to find the flash drive %s\n",
messageType, flashDriveName);
LOG(logERROR, (mess));
return FAIL;
}
// zero = normal file (not char drive special file)
if (!S_ISCHR(buf.st_mode)) {
// memory is not permanent
sprintf(mess,
"Could not %s. The flash drive found is a normal file. "
"Reboot board using 'rebootcontroller' command to load "
"proper device tree\n",
messageType);
LOG(logERROR, (mess));
return FAIL;
}
LOG(logINFO, ("\tValidated flash drive (not a normal file)\n"));
#endif
*flashfd = fopen(flashDriveName, "w"); *flashfd = fopen(flashDriveName, "w");
if (*flashfd == NULL) { if (*flashfd == NULL) {
sprintf(mess, sprintf(mess,

View File

@ -4003,7 +4003,8 @@ int check_version(int file_des) {
usleep(3 * 1000 * 1000); usleep(3 * 1000 * 1000);
if (!isInitCheckDone()) { if (!isInitCheckDone()) {
ret = FAIL; ret = FAIL;
strcpy(mess, "Server Initialization still not done done in server. Unexpected.\n"); strcpy(mess, "Server Initialization still not done done in server. "
"Unexpected.\n");
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} }
} }
@ -9443,6 +9444,15 @@ int receive_program(int file_des, enum PROGRAM_INDEX index) {
LOG(logINFO, ("\tServer Name: %s\n", serverName)); LOG(logINFO, ("\tServer Name: %s\n", serverName));
} }
#if !defined(GOTTHARD2D) && !defined(MYTHEN3D) && !defined(EIGERD)
int forceDeleteNormalFile = 0;
if (receiveData(file_des, &forceDeleteNormalFile,
sizeof(forceDeleteNormalFile), INT32) < 0)
return printSocketReadError();
LOG(logINFO,
("\tForce Delete Normal File flag? %s\n", (forceDeleteNormalFile ? "Y" : "N")));
#endif
// in same folder as current process (will also work for virtual then // in same folder as current process (will also work for virtual then
// with write permissions) // with write permissions)
{ {
@ -9467,7 +9477,7 @@ int receive_program(int file_des, enum PROGRAM_INDEX index) {
checksum, serverName); checksum, serverName);
#else #else
receive_program_via_blackfin(file_des, index, functionType, receive_program_via_blackfin(file_des, index, functionType,
filesize, checksum, serverName); filesize, checksum, serverName, forceDeleteNormalFile);
#endif #endif
} }
@ -9483,7 +9493,7 @@ int receive_program(int file_des, enum PROGRAM_INDEX index) {
void receive_program_via_blackfin(int file_des, enum PROGRAM_INDEX index, void receive_program_via_blackfin(int file_des, enum PROGRAM_INDEX index,
char *functionType, uint64_t filesize, char *functionType, uint64_t filesize,
char *checksum, char *serverName) { char *checksum, char *serverName, int forceDeleteNormalFile) {
#if !defined(JUNGFRAUD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && \ #if !defined(JUNGFRAUD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && \
!defined(GOTTHARDD) !defined(GOTTHARDD)
@ -9582,7 +9592,7 @@ void receive_program_via_blackfin(int file_des, enum PROGRAM_INDEX index,
case PROGRAM_FPGA: case PROGRAM_FPGA:
case PROGRAM_KERNEL: case PROGRAM_KERNEL:
ret = eraseAndWriteToFlash(mess, index, functionType, checksum, ret = eraseAndWriteToFlash(mess, index, functionType, checksum,
totalsize); totalsize, forceDeleteNormalFile);
break; break;
case PROGRAM_SERVER: case PROGRAM_SERVER:
ret = moveBinaryFile(mess, serverName, TEMP_PROG_FILE_NAME, ret = moveBinaryFile(mess, serverName, TEMP_PROG_FILE_NAME,
@ -9785,12 +9795,16 @@ int set_top(int file_des) {
if (Server_VerifyLock() == OK) { if (Server_VerifyLock() == OK) {
if (arg != 0 && arg != 1) { if (arg != 0 && arg != 1) {
ret = FAIL; ret = FAIL;
sprintf(mess, "Could not set top mode. Invalid value: %d. Must be 0 or 1\n", arg); sprintf(
mess,
"Could not set top mode. Invalid value: %d. Must be 0 or 1\n",
arg);
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else { } else {
ret = setTop(arg == 1 ? OW_TOP : OW_BOTTOM); ret = setTop(arg == 1 ? OW_TOP : OW_BOTTOM);
if (ret == FAIL) { if (ret == FAIL) {
sprintf(mess, "Could not set %s\n", (arg == 1 ? "Top" : "Bottom")); sprintf(mess, "Could not set %s\n",
(arg == 1 ? "Top" : "Bottom"));
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else { } else {
int retval = -1; int retval = -1;

View File

@ -1755,10 +1755,13 @@ class Detector {
/** [Jungfrau][Gotthard][CTB][Moench][Mythen3][Gotthard2] /** [Jungfrau][Gotthard][CTB][Moench][Mythen3][Gotthard2]
* Advanced user Function! * Advanced user Function!
* Program firmware from command line, after which detector controller is * Program firmware from command line, after which detector controller is
* rebooted. [Jungfrau][CTB][Moench] fname is a pof file (full path) \n * rebooted. forceDeleteNormalFile is true, if normal file found
* [Mythen3][Gotthard2] fname is an rbf file (full path) * in device tree, it must be deleted, a new device drive created and
* programming continued.[Jungfrau][CTB][Moench] fname is a pof file (full
* path) \n [Mythen3][Gotthard2] fname is an rbf file (full path)
*/ */
void programFPGA(const std::string &fname, Positions pos = {}); void programFPGA(const std::string &fname, const bool forceDeleteNormalFile,
Positions pos = {});
/** [Jungfrau][CTB][Moench] Advanced user Function! */ /** [Jungfrau][CTB][Moench] Advanced user Function! */
void resetFPGA(Positions pos = {}); void resetFPGA(Positions pos = {});

View File

@ -2876,19 +2876,31 @@ std::string CmdProxy::ProgramFpga(int action) {
std::ostringstream os; std::ostringstream os;
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {
os << "[fname.pof | fname.rbf (full path)]\n\t[Jungfrau][Ctb][Moench] " os << "[fname.pof | fname.rbf (full "
"Programs FPGA from pof file (full path). Then, detector " "path)][(opitonal)--force-delete-normal-file]\n\t[Jungfrau][Ctb]["
"controller is rebooted \n\t[Mythen3][Gotthard2] Programs FPGA " "Moench] Programs FPGA from pof file (full path). Then, detector "
"from rbf file (full path). Then, detector controller is " "controller is rebooted. \n\t\tUse --force-delete-normal-file "
"rebooted." "argument, if normal file found in device tree, it must be "
"deleted, a new device drive created and programming "
"continued.\n\t[Mythen3][Gotthard2] Programs FPGA from rbf file "
"(full path). Then, detector controller is rebooted."
<< '\n'; << '\n';
} else if (action == defs::GET_ACTION) { } else if (action == defs::GET_ACTION) {
throw sls::RuntimeError("Cannot get"); throw sls::RuntimeError("Cannot get");
} else if (action == defs::PUT_ACTION) { } else if (action == defs::PUT_ACTION) {
if (args.size() != 1) { bool forceDeteleNormalFile = false;
if (args.size() == 2) {
if (args[1] != "--force-delete-normal-file") {
throw sls::RuntimeError(
"Could not scan second argument. Did you "
"mean --force-delete-normal-file?");
}
forceDeteleNormalFile = true;
} else if (args.size() != 1) {
WrongNumberOfParameters(1); WrongNumberOfParameters(1);
} }
det->programFPGA(args[0], std::vector<int>{det_id}); det->programFPGA(args[0], forceDeteleNormalFile,
std::vector<int>{det_id});
os << "successful\n"; os << "successful\n";
} else { } else {
throw sls::RuntimeError("Unknown action"); throw sls::RuntimeError("Unknown action");

View File

@ -883,7 +883,7 @@ Result<std::string> Detector::getScanErrorMessage(Positions pos) const {
Result<int> Detector::getNumberofUDPInterfaces(Positions pos) const { Result<int> Detector::getNumberofUDPInterfaces(Positions pos) const {
// also called by vetostream (for gotthard2) // also called by vetostream (for gotthard2)
return pimpl->getNumberofUDPInterfaces(pos); return pimpl->Parallel(&Module::getNumberofUDPInterfacesFromShm, pos);
} }
void Detector::setNumberofUDPInterfaces(int n, Positions pos) { void Detector::setNumberofUDPInterfaces(int n, Positions pos) {
@ -1751,7 +1751,7 @@ Result<defs::streamingInterface> Detector::getVetoStream(Positions pos) const {
// 3gbe // 3gbe
auto r3 = pimpl->Parallel(&Module::getVetoStream, pos); auto r3 = pimpl->Parallel(&Module::getVetoStream, pos);
// 10gbe (debugging interface) opens 2nd udp interface in receiver // 10gbe (debugging interface) opens 2nd udp interface in receiver
auto r10 = pimpl->getNumberofUDPInterfaces(pos); auto r10 = getNumberofUDPInterfaces(pos);
Result<defs::streamingInterface> res(r3.size()); Result<defs::streamingInterface> res(r3.size());
for (unsigned int i = 0; i < res.size(); ++i) { for (unsigned int i = 0; i < res.size(); ++i) {
@ -1773,7 +1773,7 @@ void Detector::setVetoStream(defs::streamingInterface interface,
pimpl->Parallel(&Module::setVetoStream, pos, LOW_LATENCY_LINK); pimpl->Parallel(&Module::setVetoStream, pos, LOW_LATENCY_LINK);
// 10gbe (debugging interface) opens 2nd udp interface in receiver // 10gbe (debugging interface) opens 2nd udp interface in receiver
int old_numinterfaces = pimpl->getNumberofUDPInterfaces(pos).tsquash( int old_numinterfaces = getNumberofUDPInterfaces(pos).tsquash(
"retrieved inconsistent number of udp interfaces"); "retrieved inconsistent number of udp interfaces");
int numinterfaces = int numinterfaces =
(((interface & defs::streamingInterface::ETHERNET_10GB) == (((interface & defs::streamingInterface::ETHERNET_10GB) ==
@ -2230,10 +2230,11 @@ void Detector::setAdditionalJsonParameter(const std::string &key,
// Advanced // Advanced
void Detector::programFPGA(const std::string &fname, Positions pos) { void Detector::programFPGA(const std::string &fname,
const bool forceDeleteNormalFile, Positions pos) {
LOG(logINFO) << "Updating Firmware..."; LOG(logINFO) << "Updating Firmware...";
std::vector<char> buffer = pimpl->readProgrammingFile(fname); std::vector<char> buffer = pimpl->readProgrammingFile(fname);
pimpl->Parallel(&Module::programFPGA, pos, buffer); pimpl->Parallel(&Module::programFPGA, pos, buffer, forceDeleteNormalFile);
rebootController(pos); rebootController(pos);
} }
@ -2278,7 +2279,7 @@ void Detector::updateFirmwareAndServer(const std::string &sname,
LOG(logINFO) << "Updating Firmware and Detector Server (with tftp)..."; LOG(logINFO) << "Updating Firmware and Detector Server (with tftp)...";
LOG(logINFO) << "Updating Detector Server (via tftp)..."; LOG(logINFO) << "Updating Detector Server (via tftp)...";
pimpl->Parallel(&Module::copyDetectorServer, pos, sname, hostname); pimpl->Parallel(&Module::copyDetectorServer, pos, sname, hostname);
programFPGA(fname, pos); programFPGA(fname, false, pos);
} }
void Detector::updateFirmwareAndServer(const std::string &sname, void Detector::updateFirmwareAndServer(const std::string &sname,
@ -2289,7 +2290,7 @@ void Detector::updateFirmwareAndServer(const std::string &sname,
std::vector<char> buffer = readBinaryFile(sname, "Update Detector Server"); std::vector<char> buffer = readBinaryFile(sname, "Update Detector Server");
std::string filename = sls::getFileNameFromFilePath(sname); std::string filename = sls::getFileNameFromFilePath(sname);
pimpl->Parallel(&Module::updateDetectorServer, pos, buffer, filename); pimpl->Parallel(&Module::updateDetectorServer, pos, buffer, filename);
programFPGA(fname, pos); programFPGA(fname, false, pos);
} }
Result<bool> Detector::getUpdateMode(Positions pos) const { Result<bool> Detector::getUpdateMode(Positions pos) const {
@ -2399,7 +2400,7 @@ Result<ns> Detector::getMeasurementTime(Positions pos) const {
std::string Detector::getUserDetails() const { return pimpl->getUserDetails(); } std::string Detector::getUserDetails() const { return pimpl->getUserDetails(); }
std::vector<int> Detector::getPortNumbers(int start_port) { std::vector<int> Detector::getPortNumbers(int start_port) {
int num_sockets_per_detector = pimpl->getNumberofUDPInterfaces({}).tsquash( int num_sockets_per_detector = getNumberofUDPInterfaces({}).tsquash(
"Number of UDP Interfaces is not consistent among modules"); "Number of UDP Interfaces is not consistent among modules");
std::vector<int> res; std::vector<int> res;
res.reserve(size()); res.reserve(size());

View File

@ -32,7 +32,8 @@
namespace sls { namespace sls {
DetectorImpl::DetectorImpl(int detector_index, bool verify, bool update) DetectorImpl::DetectorImpl(int detector_index, bool verify, bool update)
: detectorIndex(detector_index), shm(detector_index, -1),ctb_shm(detector_index, -1, CtbConfig::shm_tag()) { : detectorIndex(detector_index), shm(detector_index, -1),
ctb_shm(detector_index, -1, CtbConfig::shm_tag()) {
setupDetector(verify, update); setupDetector(verify, update);
} }
@ -258,15 +259,6 @@ void DetectorImpl::setHostname(const std::vector<std::string> &name) {
} }
updateDetectorSize(); updateDetectorSize();
// update zmq port (especially for eiger)
int numInterfaces = modules[0]->getNumberofUDPInterfaces();
if (numInterfaces == 2) {
for (size_t i = 0; i < modules.size(); ++i) {
modules[i]->setClientStreamingPort(DEFAULT_ZMQ_CL_PORTNO +
i * numInterfaces);
}
}
// Here we know the detector type and can add ctb shared memory // Here we know the detector type and can add ctb shared memory
// if needed, CTB dac names are only on detector level // if needed, CTB dac names are only on detector level
@ -303,6 +295,13 @@ void DetectorImpl::addModule(const std::string &hostname) {
// get type by connecting // get type by connecting
detectorType type = Module::getTypeFromDetector(host, port); detectorType type = Module::getTypeFromDetector(host, port);
// gotthard cannot have more than 2 modules (50um=1, 25um=2
if ((type == GOTTHARD || type == GOTTHARD2) && modules.size() > 2) {
freeSharedMemory();
throw sls::RuntimeError("Gotthard cannot have more than 2 modules");
}
auto pos = modules.size(); auto pos = modules.size();
modules.emplace_back( modules.emplace_back(
sls::make_unique<Module>(type, detectorIndex, pos, false)); sls::make_unique<Module>(type, detectorIndex, pos, false));
@ -310,11 +309,20 @@ void DetectorImpl::addModule(const std::string &hostname) {
modules[pos]->setControlPort(port); modules[pos]->setControlPort(port);
modules[pos]->setStopPort(port + 1); modules[pos]->setStopPort(port + 1);
modules[pos]->setHostname(host, shm()->initialChecks); modules[pos]->setHostname(host, shm()->initialChecks);
// module type updated by now // module type updated by now
shm()->detType = Parallel(&Module::getDetectorType, {}) shm()->detType = Parallel(&Module::getDetectorType, {})
.tsquash("Inconsistent detector types."); .tsquash("Inconsistent detector types.");
// for moench and ctb // for moench and ctb
modules[pos]->updateNumberOfChannels(); modules[pos]->updateNumberOfChannels();
// for eiger, jungfrau, gotthard2
modules[pos]->updateNumberofUDPInterfaces();
// update zmq port in case numudpinterfaces changed
int numInterfaces = modules[pos]->getNumberofUDPInterfacesFromShm();
modules[pos]->setClientStreamingPort(DEFAULT_ZMQ_CL_PORTNO +
pos * numInterfaces);
} }
void DetectorImpl::updateDetectorSize() { void DetectorImpl::updateDetectorSize() {
@ -1383,10 +1391,6 @@ std::vector<char> DetectorImpl::readProgrammingFile(const std::string &fname) {
return buffer; return buffer;
} }
sls::Result<int> DetectorImpl::getNumberofUDPInterfaces(Positions pos) const {
return Parallel(&Module::getNumberofUDPInterfaces, pos);
}
sls::Result<int> DetectorImpl::getDefaultDac(defs::dacIndex index, sls::Result<int> DetectorImpl::getDefaultDac(defs::dacIndex index,
defs::detectorSettings sett, defs::detectorSettings sett,
Positions pos) { Positions pos) {
@ -1398,7 +1402,6 @@ void DetectorImpl::setDefaultDac(defs::dacIndex index, int defaultValue,
Parallel(&Module::setDefaultDac, pos, index, defaultValue, sett); Parallel(&Module::setDefaultDac, pos, index, defaultValue, sett);
} }
std::vector<std::string> DetectorImpl::getCtbDacNames() const { std::vector<std::string> DetectorImpl::getCtbDacNames() const {
return ctb_shm()->getDacNames(); return ctb_shm()->getDacNames();
} }

View File

@ -293,7 +293,6 @@ class DetectorImpl : public virtual slsDetectorDefs {
*/ */
std::vector<char> readProgrammingFile(const std::string &fname); std::vector<char> readProgrammingFile(const std::string &fname);
sls::Result<int> getNumberofUDPInterfaces(Positions pos) const;
void setNumberofUDPInterfaces(int n, Positions pos); void setNumberofUDPInterfaces(int n, Positions pos);
sls::Result<int> getDefaultDac(defs::dacIndex index, sls::Result<int> getDefaultDac(defs::dacIndex index,
defs::detectorSettings sett, defs::detectorSettings sett,

View File

@ -976,9 +976,8 @@ int Module::getNumberofUDPInterfacesFromShm() const {
return shm()->numUDPInterfaces; return shm()->numUDPInterfaces;
} }
int Module::getNumberofUDPInterfaces() const { void Module::updateNumberofUDPInterfaces() {
shm()->numUDPInterfaces = sendToDetector<int>(F_GET_NUM_INTERFACES); shm()->numUDPInterfaces = sendToDetector<int>(F_GET_NUM_INTERFACES);
return shm()->numUDPInterfaces;
} }
void Module::setNumberofUDPInterfaces(int n) { void Module::setNumberofUDPInterfaces(int n) {
@ -1186,7 +1185,7 @@ std::string Module::printReceiverConfiguration() {
<< getReceiverHostname(); << getReceiverHostname();
if (shm()->detType == JUNGFRAU) { if (shm()->detType == JUNGFRAU) {
os << "\nNumber of Interfaces:\t" << getNumberofUDPInterfaces() os << "\nNumber of Interfaces:\t" << getNumberofUDPInterfacesFromShm()
<< "\nSelected Interface:\t" << getSelectedUDPInterface(); << "\nSelected Interface:\t" << getSelectedUDPInterface();
} }
@ -2591,12 +2590,14 @@ void Module::setAdditionalJsonParameter(const std::string &key,
} }
// Advanced // Advanced
void Module::programFPGA(std::vector<char> buffer) { void Module::programFPGA(std::vector<char> buffer,
const bool forceDeleteNormalFile) {
switch (shm()->detType) { switch (shm()->detType) {
case JUNGFRAU: case JUNGFRAU:
case CHIPTESTBOARD: case CHIPTESTBOARD:
case MOENCH: case MOENCH:
sendProgram(true, buffer, F_PROGRAM_FPGA, "Update Firmware"); sendProgram(true, buffer, F_PROGRAM_FPGA, "Update Firmware", "",
forceDeleteNormalFile);
break; break;
case MYTHEN3: case MYTHEN3:
case GOTTHARD2: case GOTTHARD2:
@ -3219,10 +3220,10 @@ void Module::initializeModuleStructure(detectorType type) {
sls::strcpy_safe(shm()->rxHostname, "none"); sls::strcpy_safe(shm()->rxHostname, "none");
shm()->rxTCPPort = DEFAULT_PORTNO + 2; shm()->rxTCPPort = DEFAULT_PORTNO + 2;
shm()->useReceiverFlag = false; shm()->useReceiverFlag = false;
shm()->numUDPInterfaces = 1;
shm()->zmqport = shm()->zmqport =
DEFAULT_ZMQ_CL_PORTNO + moduleIndex * shm()->numUDPInterfaces; DEFAULT_ZMQ_CL_PORTNO + moduleIndex * shm()->numUDPInterfaces;
shm()->zmqip = IpAddr{}; shm()->zmqip = IpAddr{};
shm()->numUDPInterfaces = 1;
shm()->stoppedFlag = false; shm()->stoppedFlag = false;
// get the Module parameters based on type // get the Module parameters based on type
@ -3583,7 +3584,8 @@ sls_detector_module Module::readSettingsFile(const std::string &fname,
void Module::sendProgram(bool blackfin, std::vector<char> buffer, void Module::sendProgram(bool blackfin, std::vector<char> buffer,
const int functionEnum, const int functionEnum,
const std::string &functionType, const std::string &functionType,
const std::string serverName) { const std::string serverName,
const bool forceDeleteNormalFile) {
LOG(logINFO) << "Module " << moduleIndex << " (" << shm()->hostname LOG(logINFO) << "Module " << moduleIndex << " (" << shm()->hostname
<< "): Sending " << functionType; << "): Sending " << functionType;
@ -3607,6 +3609,11 @@ void Module::sendProgram(bool blackfin, std::vector<char> buffer,
client.Send(sname); client.Send(sname);
} }
// send forceDeleteNormalFile flag
if (blackfin) {
client.Send(static_cast<int>(forceDeleteNormalFile));
}
// validate memory allocation etc in detector // validate memory allocation etc in detector
if (client.Receive<int>() == FAIL) { if (client.Receive<int>() == FAIL) {
std::ostringstream os; std::ostringstream os;

View File

@ -219,7 +219,7 @@ class Module : public virtual slsDetectorDefs {
* * * *
* ************************************************/ * ************************************************/
int getNumberofUDPInterfacesFromShm() const; int getNumberofUDPInterfacesFromShm() const;
int getNumberofUDPInterfaces() const; void updateNumberofUDPInterfaces();
void setNumberofUDPInterfaces(int n); void setNumberofUDPInterfaces(int n);
int getSelectedUDPInterface() const; int getSelectedUDPInterface() const;
void selectUDPInterface(int n); void selectUDPInterface(int n);
@ -545,7 +545,8 @@ class Module : public virtual slsDetectorDefs {
* Advanced * * Advanced *
* * * *
* ************************************************/ * ************************************************/
void programFPGA(std::vector<char> buffer); void programFPGA(std::vector<char> buffer,
const bool forceDeleteNormalFile);
void resetFPGA(); void resetFPGA();
void copyDetectorServer(const std::string &fname, void copyDetectorServer(const std::string &fname,
const std::string &hostname); const std::string &hostname);
@ -760,7 +761,8 @@ class Module : public virtual slsDetectorDefs {
bool trimbits = true); bool trimbits = true);
void sendProgram(bool blackfin, std::vector<char> buffer, void sendProgram(bool blackfin, std::vector<char> buffer,
const int functionEnum, const std::string &functionType, const int functionEnum, const std::string &functionType,
const std::string serverName = ""); const std::string serverName = "",
const bool forceDeleteNormalFile = false);
void simulatingActivityinDetector(const std::string &functionType, void simulatingActivityinDetector(const std::string &functionType,
const int timeRequired); const int timeRequired);

View File

@ -200,7 +200,10 @@ void DataProcessor::CreateVirtualFile(
if (virtualFile_) { if (virtualFile_) {
delete virtualFile_; delete virtualFile_;
} }
virtualFile_ = new HDF5VirtualFile(hdf5Lib); bool gotthard25um =
((detectorType_ == GOTTHARD || detectorType_ == GOTTHARD2) &&
(numModX * numModY) == 2);
virtualFile_ = new HDF5VirtualFile(hdf5Lib, gotthard25um);
// maxframesperfile = 0 for infinite files // maxframesperfile = 0 for infinite files
uint32_t framesPerFile = uint32_t framesPerFile =
@ -214,7 +217,7 @@ void DataProcessor::CreateVirtualFile(
filePath, fileNamePrefix, fileIndex, overWriteEnable, silentMode, filePath, fileNamePrefix, fileIndex, overWriteEnable, silentMode,
modulePos, numUnitsPerReadout, framesPerFile, numImages, modulePos, numUnitsPerReadout, framesPerFile, numImages,
generalData_->nPixelsX, generalData_->nPixelsY, dynamicRange, generalData_->nPixelsX, generalData_->nPixelsY, dynamicRange,
numImagesProcessed, numModX, numModY, dataFile_->GetPDataType(), numFramesCaught_, numModX, numModY, dataFile_->GetPDataType(),
dataFile_->GetParameterNames(), dataFile_->GetParameterDataTypes()); dataFile_->GetParameterNames(), dataFile_->GetParameterDataTypes());
} }

View File

@ -5,8 +5,8 @@
#include <iomanip> #include <iomanip>
HDF5VirtualFile::HDF5VirtualFile(std::mutex *hdf5Lib) HDF5VirtualFile::HDF5VirtualFile(std::mutex *hdf5Lib, bool g25)
: File(HDF5), hdf5Lib_(hdf5Lib) {} : File(HDF5), hdf5Lib_(hdf5Lib), gotthard25um(g25) {}
HDF5VirtualFile::~HDF5VirtualFile() { CloseFile(); } HDF5VirtualFile::~HDF5VirtualFile() { CloseFile(); }
@ -73,12 +73,10 @@ void HDF5VirtualFile::CreateVirtualFile(
"version", PredType::NATIVE_DOUBLE, dataspace_attr); "version", PredType::NATIVE_DOUBLE, dataspace_attr);
attribute.write(PredType::NATIVE_DOUBLE, &dValue); attribute.write(PredType::NATIVE_DOUBLE, &dValue);
// virtual data dataspace // virtual dataspace
hsize_t vdsDims[3] = {numImagesCaught, numModY * nDimy, hsize_t vdsDims[3] = {numImagesCaught, numModY * nDimy,
numModZ * nDimz}; numModZ * nDimz};
DataSpace vdsDataSpace(3, vdsDims, nullptr); DataSpace vdsDataSpace(3, vdsDims, nullptr);
// virtual parameter dataspace
hsize_t vdsDimsPara[2] = {numImagesCaught, hsize_t vdsDimsPara[2] = {numImagesCaught,
(unsigned int)numModY * numModZ}; (unsigned int)numModY * numModZ};
DataSpace vdsDataSpacePara(2, vdsDimsPara, nullptr); DataSpace vdsDataSpacePara(2, vdsDimsPara, nullptr);
@ -91,37 +89,54 @@ void HDF5VirtualFile::CreateVirtualFile(
// property list for parameters (datatype) // property list for parameters (datatype)
std::vector<DSetCreatPropList> plistPara(paraSize); std::vector<DSetCreatPropList> plistPara(paraSize);
// hyperslab // hyperslab (files)
int numMajorHyperslab = numImagesCaught / maxFramesPerFile; int numFiles = numImagesCaught / maxFramesPerFile;
if (numImagesCaught % maxFramesPerFile) if (numImagesCaught % maxFramesPerFile)
++numMajorHyperslab; ++numFiles;
uint64_t framesSaved = 0; uint64_t framesSaved = 0;
// loop through files for (int iFile = 0; iFile < numFiles; ++iFile) {
for (int hyperSlab = 0; hyperSlab < numMajorHyperslab; ++hyperSlab) {
uint64_t nDimx = uint64_t nDimx =
((numImagesCaught - framesSaved) > maxFramesPerFile) ((numImagesCaught - framesSaved) > maxFramesPerFile)
? maxFramesPerFile ? maxFramesPerFile
: (numImagesCaught - framesSaved); : (numImagesCaught - framesSaved);
hsize_t start[3] = {framesSaved, 0, 0};
hsize_t count[3] = {nDimx, nDimy, nDimz};
hsize_t startPara[2] = {framesSaved, 0};
hsize_t countPara[2] = {nDimx, 1};
// loop through readouts
for (unsigned int i = 0; i < numModY * numModZ; ++i) {
// setect data hyperslabs hsize_t startLocation[3] = {framesSaved, 0, 0};
vdsDataSpace.selectHyperslab(H5S_SELECT_SET, count, start); hsize_t strideBetweenBlocks[3] = {1, 1, 1};
hsize_t numBlocks[3] = {nDimx, nDimy, nDimz};
hsize_t blockSize[3] = {1, 1, 1};
// select parameter hyperslabs hsize_t startLocationPara[2] = {framesSaved, 0};
vdsDataSpacePara.selectHyperslab(H5S_SELECT_SET, countPara, hsize_t strideBetweenBlocksPara[3] = {1, 1};
startPara); hsize_t numBlocksPara[2] = {1, 1};
hsize_t blockSizePara[3] = {nDimx, 1};
// interleaving for g2
if (gotthard25um) {
strideBetweenBlocks[2] = 2;
}
for (unsigned int iReadout = 0; iReadout < numModY * numModZ;
++iReadout) {
// interleaving for g2 (startLocation is 0 and 1)
if (gotthard25um) {
startLocation[2] = iReadout;
}
vdsDataSpace.selectHyperslab(H5S_SELECT_SET, numBlocks,
startLocation, strideBetweenBlocks,
blockSize);
vdsDataSpacePara.selectHyperslab(
H5S_SELECT_SET, numBlocksPara, startLocationPara,
strideBetweenBlocksPara, blockSizePara);
// source file name // source file name
std::ostringstream os; std::ostringstream os;
os << filePath << "/" << fileNamePrefix << "_d" os << filePath << "/" << fileNamePrefix << "_d"
<< (modulePos * numUnitsPerReadout + i) << "_f" << hyperSlab << (modulePos * numUnitsPerReadout + iReadout) << "_f"
<< '_' << fileIndex << ".h5"; << iFile << '_' << fileIndex << ".h5";
std::string srcFileName = os.str(); std::string srcFileName = os.str();
LOG(logDEBUG1) << srcFileName; LOG(logDEBUG1) << srcFileName;
@ -138,25 +153,20 @@ void HDF5VirtualFile::CreateVirtualFile(
std::ostringstream osfn; std::ostringstream osfn;
osfn << "/data"; osfn << "/data";
if (numImages > 1) if (numImages > 1)
osfn << "_f" << std::setfill('0') << std::setw(12) osfn << "_f" << std::setfill('0') << std::setw(12) << iFile;
<< hyperSlab;
std::string srcDatasetName = osfn.str(); std::string srcDatasetName = osfn.str();
// source data dataspace // source dataspace
hsize_t srcDims[3] = {nDimx, nDimy, nDimz}; hsize_t srcDims[3] = {nDimx, nDimy, nDimz};
hsize_t srcDimsMax[3] = {H5S_UNLIMITED, nDimy, nDimz}; hsize_t srcDimsMax[3] = {H5S_UNLIMITED, nDimy, nDimz};
DataSpace srcDataSpace(3, srcDims, srcDimsMax); DataSpace srcDataSpace(3, srcDims, srcDimsMax);
// source parameter dataspace
hsize_t srcDimsPara[1] = {nDimx}; hsize_t srcDimsPara[1] = {nDimx};
hsize_t srcDimsMaxPara[1] = {H5S_UNLIMITED}; hsize_t srcDimsMaxPara[1] = {H5S_UNLIMITED};
DataSpace srcDataSpacePara(1, srcDimsPara, srcDimsMaxPara); DataSpace srcDataSpacePara(1, srcDimsPara, srcDimsMaxPara);
// mapping of data property list // mapping of property list
plist.setVirtual(vdsDataSpace, relative_srcFileName.c_str(), plist.setVirtual(vdsDataSpace, relative_srcFileName.c_str(),
srcDatasetName.c_str(), srcDataSpace); srcDatasetName.c_str(), srcDataSpace);
// mapping of parameter property list
for (unsigned int p = 0; p < paraSize; ++p) { for (unsigned int p = 0; p < paraSize; ++p) {
plistPara[p].setVirtual( plistPara[p].setVirtual(
vdsDataSpacePara, relative_srcFileName.c_str(), vdsDataSpacePara, relative_srcFileName.c_str(),
@ -165,21 +175,23 @@ void HDF5VirtualFile::CreateVirtualFile(
// H5Sclose(srcDataspace); // H5Sclose(srcDataspace);
// H5Sclose(srcDataspace_para); // H5Sclose(srcDataspace_para);
start[2] += nDimz;
if (start[2] >= (numModZ * nDimz)) { if (!gotthard25um) {
start[2] = 0; startLocation[2] += nDimz;
start[1] += nDimy; if (startLocation[2] >= (numModZ * nDimz)) {
startLocation[2] = 0;
startLocation[1] += nDimy;
} }
startPara[1]++; }
startLocationPara[1]++;
} }
framesSaved += nDimx; framesSaved += nDimx;
} }
// data dataset // datasets
dataSetName_ = "data"; dataSetName_ = "data";
DataSet vdsDataSet(fd_->createDataSet(dataSetName_.c_str(), dataType, DataSet vdsDataSet(fd_->createDataSet(dataSetName_.c_str(), dataType,
vdsDataSpace, plist)); vdsDataSpace, plist));
// parameter dataset
for (unsigned int p = 0; p < paraSize; ++p) { for (unsigned int p = 0; p < paraSize; ++p) {
DataSet vdsDataSetPara(fd_->createDataSet( DataSet vdsDataSetPara(fd_->createDataSet(
parameterNames[p].c_str(), parameterDataTypes[p], parameterNames[p].c_str(), parameterDataTypes[p],

View File

@ -9,7 +9,7 @@
class HDF5VirtualFile : private virtual slsDetectorDefs, public File { class HDF5VirtualFile : private virtual slsDetectorDefs, public File {
public: public:
HDF5VirtualFile(std::mutex *hdf5Lib); HDF5VirtualFile(std::mutex *hdf5Lib, bool g25);
~HDF5VirtualFile(); ~HDF5VirtualFile();
std::array<std::string, 2> GetFileAndDatasetName() const override; std::array<std::string, 2> GetFileAndDatasetName() const override;
@ -30,4 +30,5 @@ class HDF5VirtualFile : private virtual slsDetectorDefs, public File {
H5File *fd_{nullptr}; H5File *fd_{nullptr};
std::string fileName_; std::string fileName_;
std::string dataSetName_; std::string dataSetName_;
bool gotthard25um;
}; };

View File

@ -6,10 +6,10 @@
#define APIRECEIVER 0x211124 #define APIRECEIVER 0x211124
#define APIGUI 0x211124 #define APIGUI 0x211124
#define APICTB 0x220318 #define APIEIGER 0x220324
#define APIGOTTHARD 0x220318 #define APICTB 0x220328
#define APIGOTTHARD2 0x220318 #define APIGOTTHARD 0x220328
#define APIJUNGFRAU 0x220318 #define APIGOTTHARD2 0x220328
#define APIMYTHEN3 0x220318 #define APIJUNGFRAU 0x220328
#define APIMOENCH 0x220318 #define APIMYTHEN3 0x220328
#define APIEIGER 0x220318 #define APIMOENCH 0x220328