mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-20 02:40:03 +02:00
wip
This commit is contained in:
parent
2548a0bfec
commit
5790e4961b
@ -1848,11 +1848,13 @@ class Detector(CppDetectorApi):
|
||||
@element
|
||||
def partialread(self):
|
||||
"""
|
||||
[Eiger] Number of rows to read out per half module
|
||||
[Eiger] Number of rows to read out per half module starting from the centre.
|
||||
[Jungfrau] Number of rows to read per module starting from the centre.
|
||||
Note
|
||||
----
|
||||
Options: 0 - 256. 256 is default. \n
|
||||
The permissible values depend on dynamic range and 10Gbe enabled.
|
||||
[Eiger] Options: 1 - 256. 256 is default. \n
|
||||
[Eiger]The permissible values depend on dynamic range and 10Gbe enabled.\n\n
|
||||
[Jungfrau] Options: 8 - 512 (multiples of 8)
|
||||
"""
|
||||
return self.getPartialReadout()
|
||||
|
||||
|
@ -473,7 +473,6 @@ void qTabSettings::Refresh() {
|
||||
GetThresholdEnergies();
|
||||
// eiger
|
||||
else if (spinThreshold->isEnabled()) {
|
||||
LOG(logINFOBLUE) << "calling it!";
|
||||
GetThresholdEnergy();
|
||||
}
|
||||
|
||||
|
@ -120,6 +120,7 @@ enum MASTERINDEX { MASTER_HARDWARE, OW_MASTER, OW_SLAVE };
|
||||
|
||||
#define MAX_TRIMBITS_VALUE (63)
|
||||
|
||||
#define MIN_ROWS_PER_READOUT (1)
|
||||
#define MAX_ROWS_PER_READOUT (256)
|
||||
#define MAX_PACKETS_PER_REQUEST (256)
|
||||
|
||||
|
@ -167,6 +167,15 @@
|
||||
#define ADC_PORT_INVERT_ADC_3_OFST (24)
|
||||
#define ADC_PORT_INVERT_ADC_3_MSK (0x000000FF << ADC_PORT_INVERT_ADC_3_OFST)
|
||||
|
||||
/** Partial Readout Register */
|
||||
#define PARTIAL_READOUT_REG (0x44 << MEM_MAP_SHIFT)
|
||||
|
||||
#define PARTIAL_READOUT_NUM_ROWS_OFST (0)
|
||||
#define PARTIAL_READOUT_NUM_ROWS_MSK (0x0000003F << PARTIAL_READOUT_NUM_ROWS_OFST)
|
||||
#define PARTIAL_READOUT_ENBL_OFST (7)
|
||||
#define PARTIAL_READOUT_ENBL_MSK (0x00000001 << PARTIAL_READOUT_ENBL_OFST)
|
||||
|
||||
|
||||
/* Configuration Register */
|
||||
#define CONFIG_REG (0x4D << MEM_MAP_SHIFT)
|
||||
|
||||
|
@ -480,6 +480,7 @@ void setupDetector() {
|
||||
setFilterCell(DEFAULT_FILTER_CELL);
|
||||
}
|
||||
disableCurrentSource();
|
||||
setPartialReadout(MAX_ROWS_PER_READOUT);
|
||||
}
|
||||
|
||||
int resetToDefaultDacs(int hardReset) {
|
||||
@ -1596,6 +1597,39 @@ int *getDetectorPosition() { return detPos; }
|
||||
/* jungfrau specific - powerchip, autocompdisable, asictimer, clockdiv, pll,
|
||||
* flashing fpga */
|
||||
|
||||
int setPartialReadout(int value) {
|
||||
if (value < 0 || (value % PARTIAL_READOUT_MULTIPLE != 0))
|
||||
return FAIL;
|
||||
|
||||
// regval is numpackets - 1
|
||||
int regval = (value / PARTIAL_READOUT_MULTIPLE) - 1;
|
||||
uint32_t addr = PARTIAL_READOUT_REG;
|
||||
LOG(logINFO, ("Setting Partial Readout: %d (regval:%d)\n", value, regval));
|
||||
bus_w(addr, bus_r(addr) &~PARTIAL_READOUT_NUM_ROWS_MSK);
|
||||
bus_w(addr, bus_r(addr) | ((regval << PARTIAL_READOUT_NUM_ROWS_OFST) & PARTIAL_READOUT_NUM_ROWS_MSK));
|
||||
|
||||
if (value == MAX_ROWS_PER_READOUT) {
|
||||
LOG(logINFO, ("Disabling Partial Readout\n"));
|
||||
bus_w(addr, bus_r(addr) &~PARTIAL_READOUT_ENBL_MSK);
|
||||
} else {
|
||||
LOG(logINFO, ("Enabling Partial Readout\n"));
|
||||
bus_w(addr, bus_r(addr) | PARTIAL_READOUT_ENBL_MSK);
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int getPartialReadout() {
|
||||
int enable = (bus_r(PARTIAL_READOUT_REG) & PARTIAL_READOUT_ENBL_MSK);
|
||||
int regval = ((bus_r(PARTIAL_READOUT_REG) & PARTIAL_READOUT_NUM_ROWS_MSK) >> PARTIAL_READOUT_NUM_ROWS_OFST);
|
||||
|
||||
int maxRegval = (MAX_ROWS_PER_READOUT/ PARTIAL_READOUT_MULTIPLE) - 1;
|
||||
if ((regval == maxRegval && enable) || (regval != maxRegval && !enable)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return (regval + 1) * PARTIAL_READOUT_MULTIPLE;
|
||||
}
|
||||
|
||||
void initReadoutConfiguration() {
|
||||
|
||||
LOG(logINFO, ("Initializing Readout Configuration:\n"
|
||||
@ -2263,6 +2297,8 @@ void *start_timer(void *arg) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int transmissionDelayUs = getTransmissionDelayFrame() * 1000;
|
||||
|
||||
int numInterfaces = getNumberofUDPInterfaces();
|
||||
int64_t periodNs = getPeriod();
|
||||
int numFrames = (getNumFrames() * getNumTriggers() *
|
||||
@ -2271,17 +2307,36 @@ void *start_timer(void *arg) {
|
||||
const int npixels = 256 * 256 * 8;
|
||||
const int dataSize = 8192;
|
||||
const int packetsize = dataSize + sizeof(sls_detector_header);
|
||||
const int packetsPerFrame = numInterfaces == 1 ? 128 : 64;
|
||||
int transmissionDelayUs = getTransmissionDelayFrame() * 1000;
|
||||
int maxPacketsPerFrame = 128;
|
||||
int maxRows = MAX_ROWS_PER_READOUT;
|
||||
if (numInterfaces == 2) {
|
||||
maxPacketsPerFrame /= 2;
|
||||
maxRows /= 2;
|
||||
}
|
||||
int partialReadout = getPartialReadout();
|
||||
if (partialReadout == -1) {
|
||||
partialReadout = MAX_ROWS_PER_READOUT;
|
||||
}
|
||||
const int packetsPerFrame = (maxPacketsPerFrame * partialReadout) / maxRows;
|
||||
|
||||
//LOG(logINFOBLUE, ("packetsperframe:%d numFrames:%d partial:%d maxpacketsperframe:%d maxrows:%d \n", packetsPerFrame, numFrames, partialReadout, maxPacketsPerFrame, maxRows));
|
||||
|
||||
// starting packet number
|
||||
//const int startPnum = (128 / 2) - ()
|
||||
|
||||
// Generate data
|
||||
char imageData[DATA_BYTES];
|
||||
memset(imageData, 0, DATA_BYTES);
|
||||
const int pixelsPerPacket = dataSize / 2;
|
||||
int pixelVal = 0;
|
||||
for (int i = 0; i < npixels; ++i) {
|
||||
// avoiding gain also being divided when gappixels enabled in call
|
||||
// back
|
||||
if (i > 0 && i % pixelsPerPacket == 0) {
|
||||
++pixelVal;
|
||||
}
|
||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
||||
virtual_image_test_mode ? 0x0FFE : (uint16_t)i;
|
||||
virtual_image_test_mode ? 0x0FFE : (uint16_t)pixelVal;
|
||||
}
|
||||
|
||||
// Send data
|
||||
@ -2289,7 +2344,6 @@ void *start_timer(void *arg) {
|
||||
uint64_t frameNr = 0;
|
||||
getNextFrameNumber(&frameNr);
|
||||
for (int iframes = 0; iframes != numFrames; ++iframes) {
|
||||
|
||||
usleep(transmissionDelayUs);
|
||||
|
||||
// check if manual stop
|
||||
|
@ -114,6 +114,9 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
|
||||
#define DAC_MIN_MV (0)
|
||||
#define DAC_MAX_MV (2500)
|
||||
#define MAX_FILTER_CELL_VAL (12)
|
||||
#define MIN_ROWS_PER_READOUT (8)
|
||||
#define MAX_ROWS_PER_READOUT (512)
|
||||
#define PARTIAL_READOUT_MULTIPLE (8) //512 rows/128packets * 2 interfaces
|
||||
|
||||
/* Defines in the Firmware */
|
||||
#define MAX_TIMESLOT_VAL (0x1F)
|
||||
|
@ -449,6 +449,8 @@ void setDigitalIODelay(uint64_t pinMask, int delay);
|
||||
// jungfrau specific - powerchip, autocompdisable, clockdiv, asictimer, clock,
|
||||
// pll, flashing firmware
|
||||
#ifdef JUNGFRAUD
|
||||
int setPartialReadout(int value);
|
||||
int getPartialReadout();
|
||||
void initReadoutConfiguration();
|
||||
int powerChip(int on);
|
||||
int isChipConfigured();
|
||||
|
@ -4726,7 +4726,7 @@ int set_partial_readout(int file_des) {
|
||||
return printSocketReadError();
|
||||
LOG(logDEBUG1, ("Setting partial readout: %u\n", arg));
|
||||
|
||||
#ifndef EIGERD
|
||||
#if !defined(EIGERD) && !defined(JUNGFRAUD)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
@ -4734,11 +4734,12 @@ int set_partial_readout(int file_des) {
|
||||
if (arg <= 0 || arg > MAX_ROWS_PER_READOUT) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,
|
||||
"Could not set partial readout. Must be between 1 "
|
||||
"Could not set partial readout. Must be between %d "
|
||||
"and %d\n",
|
||||
MAX_ROWS_PER_READOUT);
|
||||
MIN_ROWS_PER_READOUT, MAX_ROWS_PER_READOUT);
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
#ifdef EIGERD
|
||||
int dr = setDynamicRange(GET_FLAG);
|
||||
int isTenGiga = enableTenGigabitEthernet(GET_FLAG);
|
||||
unsigned int maxnl = MAX_ROWS_PER_READOUT;
|
||||
@ -4753,7 +4754,16 @@ int set_partial_readout(int file_des) {
|
||||
arg, dr, isTenGiga ? "enabled" : "disabled", arg, maxnp,
|
||||
maxnl);
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
} else
|
||||
#elif JUNGFRAU
|
||||
if (arg % PARTIAL_READOUT_MULTIPLE != 0) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,
|
||||
"Could not set %d partial readout. %d must be a multiple of %d\n", arg, PARTIAL_READOUT_MULTIPLE);
|
||||
LOG(logERROR, (mess));
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (setPartialReadout(arg) == FAIL) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Could not set partial readout to %d.\n", arg);
|
||||
@ -4783,7 +4793,7 @@ int get_partial_readout(int file_des) {
|
||||
|
||||
LOG(logDEBUG1, ("Getting partial readout\n"));
|
||||
|
||||
#ifndef EIGERD
|
||||
#if !defined(EIGERD) && !defined(JUNGFRAUD)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// get only
|
||||
|
@ -509,6 +509,15 @@ class Detector {
|
||||
/** [CTB] Options: 0-255 \n [Gotthard2] Options: 0-7 */
|
||||
void setDBITPipeline(int value, Positions pos = {});
|
||||
|
||||
/** [Eiger][Jungfrau] */
|
||||
Result<int> getPartialReadout(Positions pos = {}) const;
|
||||
|
||||
/** [Eiger] Number of lines to read out per half module
|
||||
* Options: 0 - 256. 256 is default. The permissible values depend on
|
||||
* dynamic range and 10Gbe enabled. \n[Jungfrau] Number of rows per module starting from the centre. Options: 8 - 512, must be multiples of 8. Default is 512.
|
||||
*/
|
||||
void setPartialReadout(const int lines, Positions pos = {});
|
||||
|
||||
///@{
|
||||
|
||||
/** @name Acquisition */
|
||||
@ -1048,15 +1057,6 @@ class Detector {
|
||||
*/
|
||||
void setRateCorrection(ns dead_time, Positions pos = {});
|
||||
|
||||
/** [Eiger] */
|
||||
Result<int> getPartialReadout(Positions pos = {}) const;
|
||||
|
||||
/** [Eiger] Number of lines to read out per half module
|
||||
* Options: 0 - 256. 256 is default. The permissible values depend on
|
||||
* dynamic range and 10Gbe enabled.
|
||||
*/
|
||||
void setPartialReadout(const int lines, Positions pos = {});
|
||||
|
||||
/** [Eiger] */
|
||||
Result<bool> getInterruptSubframe(Positions pos = {}) const;
|
||||
|
||||
|
@ -593,6 +593,7 @@ class CmdProxy {
|
||||
{"vhighvoltage", "highvoltage"},
|
||||
{"digitest", "imagetest"},
|
||||
{"filter", "filterresistor"},
|
||||
{"readnlines", "partialread"},
|
||||
|
||||
/** temperature */
|
||||
|
||||
@ -716,7 +717,6 @@ class CmdProxy {
|
||||
{"rx_datastream", "rx_zmqstream"},
|
||||
|
||||
/* Eiger Specific */
|
||||
{"readnlines", "partialread"},
|
||||
{"resmat", "partialreset"},
|
||||
|
||||
/* Jungfrau Specific */
|
||||
@ -807,6 +807,7 @@ class CmdProxy {
|
||||
{"filterresistor", &CmdProxy::filterresistor},
|
||||
{"currentsource", &CmdProxy::CurrentSource},
|
||||
{"dbitpipeline", &CmdProxy::dbitpipeline},
|
||||
{"partialread", &CmdProxy::partialread},
|
||||
|
||||
/** temperature */
|
||||
{"templist", &CmdProxy::templist},
|
||||
@ -915,7 +916,6 @@ class CmdProxy {
|
||||
{"subdeadtime", &CmdProxy::subdeadtime},
|
||||
{"overflow", &CmdProxy::overflow},
|
||||
{"ratecorr", &CmdProxy::RateCorrection},
|
||||
{"partialread", &CmdProxy::partialread},
|
||||
{"interruptsubframe", &CmdProxy::interruptsubframe},
|
||||
{"measuredperiod", &CmdProxy::measuredperiod},
|
||||
{"measuredsubperiod", &CmdProxy::measuredsubperiod},
|
||||
@ -1369,6 +1369,12 @@ class CmdProxy {
|
||||
"clock for latching digital bits.\n\t[Gotthard2] "
|
||||
"Options: 0-7\n\t[CTB] Options: 0-255");
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(
|
||||
partialread, getPartialReadout, setPartialReadout, StringTo<int>,
|
||||
"[1 - 256]\n\t[Eiger] Number of rows to readout per half module "
|
||||
"starting from the centre. Options: 0 - 256. 256 is default. The "
|
||||
"permissible values depend on dynamic range and 10Gbe enabled.\n[8-512 (multiple of 8)]\n\t[Jungfrau] Number of rows per module starting from the centre. Options: 8 - 512, must be multiples of 8. Default is 512.");
|
||||
|
||||
/** temperature */
|
||||
GET_COMMAND_NOID(
|
||||
templist, getTemperatureList,
|
||||
@ -1809,12 +1815,6 @@ class CmdProxy {
|
||||
"[0, 1]\n\t[Eiger] Enable or disable show overflow flag in "
|
||||
"32 bit mode. Default is disabled.");
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(
|
||||
partialread, getPartialReadout, setPartialReadout, StringTo<int>,
|
||||
"[1 - 256]\n\t[Eiger] Number of rows to readout per half module "
|
||||
"starting from the centre. Options: 0 - 256. 256 is default. The "
|
||||
"permissible values depend on dynamic range and 10Gbe enabled.");
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(
|
||||
interruptsubframe, getInterruptSubframe, setInterruptSubframe,
|
||||
StringTo<int>,
|
||||
|
@ -732,6 +732,14 @@ void Detector::setDBITPipeline(int value, Positions pos) {
|
||||
pimpl->Parallel(&Module::setDBITPipeline, pos, value);
|
||||
}
|
||||
|
||||
Result<int> Detector::getPartialReadout(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getPartialReadout, pos);
|
||||
}
|
||||
|
||||
void Detector::setPartialReadout(const int lines, Positions pos) {
|
||||
pimpl->Parallel(&Module::setPartialReadout, pos, lines);
|
||||
}
|
||||
|
||||
// Acquisition
|
||||
|
||||
void Detector::acquire() { pimpl->acquire(); }
|
||||
@ -1372,14 +1380,6 @@ void Detector::updateRxRateCorrections() {
|
||||
}
|
||||
}
|
||||
|
||||
Result<int> Detector::getPartialReadout(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getPartialReadout, pos);
|
||||
}
|
||||
|
||||
void Detector::setPartialReadout(const int lines, Positions pos) {
|
||||
pimpl->Parallel(&Module::setPartialReadout, pos, lines);
|
||||
}
|
||||
|
||||
Result<bool> Detector::getInterruptSubframe(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getInterruptSubframe, pos);
|
||||
}
|
||||
|
@ -734,6 +734,17 @@ void Module::setDBITPipeline(int value) {
|
||||
sendToDetector(F_SET_DBIT_PIPELINE, value, nullptr);
|
||||
}
|
||||
|
||||
int Module::getPartialReadout() const {
|
||||
return sendToDetector<int>(F_GET_PARTIAL_READOUT);
|
||||
}
|
||||
|
||||
void Module::setPartialReadout(const int value) {
|
||||
sendToDetector(F_SET_PARTIAL_READOUT, value, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
sendToReceiver(F_SET_RECEIVER_PARTIAL_READOUT, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
// Acquisition
|
||||
|
||||
void Module::startReceiver() {
|
||||
@ -1469,17 +1480,6 @@ void Module::sendReceiverRateCorrections(const std::vector<int64_t> &t) {
|
||||
}
|
||||
}
|
||||
|
||||
int Module::getPartialReadout() const {
|
||||
return sendToDetector<int>(F_GET_PARTIAL_READOUT);
|
||||
}
|
||||
|
||||
void Module::setPartialReadout(const int value) {
|
||||
sendToDetector(F_SET_PARTIAL_READOUT, value, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
sendToReceiver(F_SET_RECEIVER_PARTIAL_READOUT, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
bool Module::getInterruptSubframe() const {
|
||||
return sendToDetector<int>(F_GET_INTERRUPT_SUBFRAME);
|
||||
}
|
||||
|
@ -178,7 +178,8 @@ class Module : public virtual slsDetectorDefs {
|
||||
void setCurrentSource(defs::currentSrcParameters par);
|
||||
int getDBITPipeline() const;
|
||||
void setDBITPipeline(int value);
|
||||
|
||||
int getPartialReadout() const;
|
||||
void setPartialReadout(const int value);
|
||||
/**************************************************
|
||||
* *
|
||||
* Acquisition *
|
||||
@ -337,8 +338,6 @@ class Module : public virtual slsDetectorDefs {
|
||||
void setDefaultRateCorrection();
|
||||
void setRateCorrection(int64_t t = 0);
|
||||
void sendReceiverRateCorrections(const std::vector<int64_t> &t);
|
||||
int getPartialReadout() const;
|
||||
void setPartialReadout(const int value);
|
||||
bool getInterruptSubframe() const;
|
||||
void setInterruptSubframe(const bool enable);
|
||||
int64_t getMeasuredPeriod() const;
|
||||
|
@ -374,36 +374,6 @@ TEST_CASE("ratecorr", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("partialread", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER) {
|
||||
auto prev_val = det.getPartialReadout();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("partialread", {"256"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "partialread 256\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("partialread", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "partialread 256\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("partialread", {"16"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "partialread 16\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("partialread", {"0"}, -1, PUT));
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPartialReadout(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("partialread", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("interruptsubframe", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
|
@ -1494,6 +1494,43 @@ TEST_CASE("dbitpipeline", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("partialread", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER || det_type == defs::JUNGFRAU) {
|
||||
auto prev_val = det.getPartialReadout();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("partialread", {"256"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "partialread 256\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("partialread", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "partialread 256\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("partialread", {"16"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "partialread 16\n");
|
||||
}
|
||||
if (det_type == defs::JUNGFRAU) {
|
||||
REQUIRE_THROWS(proxy.Call("partialread", {"7"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("partialread", {"20"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("partialread", {"44"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("partialread", {"513"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("partialread", {"1"}, -1, PUT));
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("partialread", {"0"}, -1, PUT));
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPartialReadout(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("partialread", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("currentsource", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
|
@ -414,9 +414,11 @@ int ClientInterface::setup_receiver(Interface &socket) {
|
||||
std::to_string(arg.quad) +
|
||||
" due to fifo strucutre memory allocation");
|
||||
}
|
||||
impl()->setPartialReadout(arg.partialReadout);
|
||||
impl()->setThresholdEnergy(arg.thresholdEnergyeV[0]);
|
||||
}
|
||||
if (myDetectorType == EIGER || myDetectorType == JUNGFRAU) {
|
||||
impl()->setPartialReadout(arg.partialReadout);
|
||||
}
|
||||
if (myDetectorType == MYTHEN3) {
|
||||
std::array<int, 3> val;
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
@ -1408,6 +1410,9 @@ int ClientInterface::set_partial_readout(Interface &socket) {
|
||||
auto arg = socket.Receive<int>();
|
||||
if (arg >= 0) {
|
||||
verifyIdle(socket);
|
||||
if (myDetectorType != EIGER && myDetectorType != JUNGFRAU) {
|
||||
throw RuntimeError("Could not set partial readout. Not implemented for this detector");
|
||||
}
|
||||
LOG(logDEBUG1) << "Setting Partial Readout:" << arg;
|
||||
impl()->setPartialReadout(arg);
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ class GeneralData {
|
||||
uint32_t vetoPacketSize{0};
|
||||
uint32_t vetoImageSize{0};
|
||||
uint32_t vetoHsize{0};
|
||||
uint32_t maxRowsPerReadout{0};
|
||||
|
||||
GeneralData(){};
|
||||
virtual ~GeneralData(){};
|
||||
@ -339,6 +340,7 @@ class EigerData : public GeneralData {
|
||||
threadsPerReceiver = 2;
|
||||
headerPacketSize = 40;
|
||||
standardheader = true;
|
||||
maxRowsPerReadout = 256;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -384,6 +386,7 @@ class JungfrauData : public GeneralData {
|
||||
defaultFifoDepth = 2500;
|
||||
standardheader = true;
|
||||
defaultUdpSocketBufferSize = (1000 * 1024 * 1024);
|
||||
maxRowsPerReadout = 512;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -477,8 +477,8 @@ std::vector<uint64_t> Implementation::getNumMissingPackets() const {
|
||||
int np = generalData->packetsPerFrame;
|
||||
uint64_t totnp = np;
|
||||
// partial readout
|
||||
if (partialReadout != MAX_EIGER_ROWS_PER_READOUT) {
|
||||
totnp = ((partialReadout * np) / MAX_EIGER_ROWS_PER_READOUT);
|
||||
if (partialReadout != generalData->maxRowsPerReadout) {
|
||||
totnp = ((partialReadout * np) / generalData->maxRowsPerReadout);
|
||||
}
|
||||
totnp *= numberOfTotalFrames;
|
||||
mp[i] = listener[i]->GetNumMissingPacket(stoppedFlag, totnp);
|
||||
|
@ -219,7 +219,7 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
/* [Eiger] */
|
||||
void setDeactivatedPadding(const bool enable);
|
||||
int getPartialReadout() const;
|
||||
/* [Eiger] */
|
||||
/* [Eiger][Jungfrau] */
|
||||
void setPartialReadout(const int value);
|
||||
/** [Eiger] */
|
||||
void setThresholdEnergy(const int value);
|
||||
@ -352,7 +352,7 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
bool activated{true};
|
||||
std::array<bool, 2> detectorDataStream = {{true, true}};
|
||||
bool deactivatedPaddingEnable{true};
|
||||
int partialReadout{MAX_EIGER_ROWS_PER_READOUT};
|
||||
int partialReadout{0};
|
||||
int thresholdEnergyeV{-1};
|
||||
std::array<int, 3> thresholdAllEnergyeV = {{-1, -1, -1}};
|
||||
std::vector<int64_t> rateCorrections;
|
||||
|
@ -336,7 +336,8 @@ class JungfrauMasterAttributes : public MasterAttributes {
|
||||
oss << MasterAttributes::GetBinaryMasterAttributes()
|
||||
<< "Exptime : " << sls::ToString(exptime) << '\n'
|
||||
<< "Period : " << sls::ToString(period) << '\n'
|
||||
<< "Number of UDP Interfaces : " << numUDPInterfaces << '\n';
|
||||
<< "Number of UDP Interfaces : " << numUDPInterfaces << '\n'
|
||||
<< "Partial Readout (rows) : " << partialReadout << '\n';
|
||||
std::string message = oss.str();
|
||||
MasterAttributes::WriteBinaryAttributes(fd, message);
|
||||
};
|
||||
@ -352,6 +353,13 @@ class JungfrauMasterAttributes : public MasterAttributes {
|
||||
"Number of UDP Interfaces", PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&numUDPInterfaces, PredType::NATIVE_INT);
|
||||
}
|
||||
// partialReadout
|
||||
{
|
||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
||||
DataSet dataset = group->createDataSet(
|
||||
"Partial readout (rows)", PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&partialReadout, PredType::NATIVE_INT);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
@ -43,7 +43,6 @@
|
||||
|
||||
// parameters to calculate fifo depth
|
||||
#define SAMPLE_TIME_IN_NS (100000000) // 100ms
|
||||
#define MAX_EIGER_ROWS_PER_READOUT (256)
|
||||
|
||||
// to differentiate between gotthard and short gotthard
|
||||
#define GOTTHARD_PACKET_SIZE (1286)
|
||||
|
@ -26,7 +26,7 @@ class DataSocket {
|
||||
DataSocket &operator=(DataSocket const &) = delete;
|
||||
int getSocketId() const { return sockfd_; }
|
||||
int getFnum() const { return fnum_; }
|
||||
int setFnum(const int fnum);
|
||||
void setFnum(const int fnum);
|
||||
|
||||
int Send(const void *buffer, size_t size);
|
||||
|
||||
|
@ -42,7 +42,7 @@ DataSocket &DataSocket::operator=(DataSocket &&move) noexcept {
|
||||
return *this;
|
||||
}
|
||||
|
||||
int DataSocket::setFnum(const int fnum) {
|
||||
void DataSocket::setFnum(const int fnum) {
|
||||
fnum_ = fnum;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user