This commit is contained in:
maliakal_d 2021-08-13 17:10:46 +02:00
parent 2548a0bfec
commit 5790e4961b
23 changed files with 192 additions and 91 deletions

View File

@ -1848,11 +1848,13 @@ class Detector(CppDetectorApi):
@element @element
def partialread(self): 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 Note
---- ----
Options: 0 - 256. 256 is default. \n [Eiger] Options: 1 - 256. 256 is default. \n
The permissible values depend on dynamic range and 10Gbe enabled. [Eiger]The permissible values depend on dynamic range and 10Gbe enabled.\n\n
[Jungfrau] Options: 8 - 512 (multiples of 8)
""" """
return self.getPartialReadout() return self.getPartialReadout()

View File

@ -473,7 +473,6 @@ void qTabSettings::Refresh() {
GetThresholdEnergies(); GetThresholdEnergies();
// eiger // eiger
else if (spinThreshold->isEnabled()) { else if (spinThreshold->isEnabled()) {
LOG(logINFOBLUE) << "calling it!";
GetThresholdEnergy(); GetThresholdEnergy();
} }

View File

@ -120,6 +120,7 @@ enum MASTERINDEX { MASTER_HARDWARE, OW_MASTER, OW_SLAVE };
#define MAX_TRIMBITS_VALUE (63) #define MAX_TRIMBITS_VALUE (63)
#define MIN_ROWS_PER_READOUT (1)
#define MAX_ROWS_PER_READOUT (256) #define MAX_ROWS_PER_READOUT (256)
#define MAX_PACKETS_PER_REQUEST (256) #define MAX_PACKETS_PER_REQUEST (256)

View File

@ -167,6 +167,15 @@
#define ADC_PORT_INVERT_ADC_3_OFST (24) #define ADC_PORT_INVERT_ADC_3_OFST (24)
#define ADC_PORT_INVERT_ADC_3_MSK (0x000000FF << ADC_PORT_INVERT_ADC_3_OFST) #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 */ /* Configuration Register */
#define CONFIG_REG (0x4D << MEM_MAP_SHIFT) #define CONFIG_REG (0x4D << MEM_MAP_SHIFT)

View File

@ -480,6 +480,7 @@ void setupDetector() {
setFilterCell(DEFAULT_FILTER_CELL); setFilterCell(DEFAULT_FILTER_CELL);
} }
disableCurrentSource(); disableCurrentSource();
setPartialReadout(MAX_ROWS_PER_READOUT);
} }
int resetToDefaultDacs(int hardReset) { int resetToDefaultDacs(int hardReset) {
@ -1596,6 +1597,39 @@ int *getDetectorPosition() { return detPos; }
/* jungfrau specific - powerchip, autocompdisable, asictimer, clockdiv, pll, /* jungfrau specific - powerchip, autocompdisable, asictimer, clockdiv, pll,
* flashing fpga */ * 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() { void initReadoutConfiguration() {
LOG(logINFO, ("Initializing Readout Configuration:\n" LOG(logINFO, ("Initializing Readout Configuration:\n"
@ -2263,6 +2297,8 @@ void *start_timer(void *arg) {
return NULL; return NULL;
} }
int transmissionDelayUs = getTransmissionDelayFrame() * 1000;
int numInterfaces = getNumberofUDPInterfaces(); int numInterfaces = getNumberofUDPInterfaces();
int64_t periodNs = getPeriod(); int64_t periodNs = getPeriod();
int numFrames = (getNumFrames() * getNumTriggers() * int numFrames = (getNumFrames() * getNumTriggers() *
@ -2271,17 +2307,36 @@ void *start_timer(void *arg) {
const int npixels = 256 * 256 * 8; const int npixels = 256 * 256 * 8;
const int dataSize = 8192; const int dataSize = 8192;
const int packetsize = dataSize + sizeof(sls_detector_header); const int packetsize = dataSize + sizeof(sls_detector_header);
const int packetsPerFrame = numInterfaces == 1 ? 128 : 64; int maxPacketsPerFrame = 128;
int transmissionDelayUs = getTransmissionDelayFrame() * 1000; 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 // Generate data
char imageData[DATA_BYTES]; char imageData[DATA_BYTES];
memset(imageData, 0, DATA_BYTES); memset(imageData, 0, DATA_BYTES);
const int pixelsPerPacket = dataSize / 2;
int pixelVal = 0;
for (int i = 0; i < npixels; ++i) { for (int i = 0; i < npixels; ++i) {
// avoiding gain also being divided when gappixels enabled in call // avoiding gain also being divided when gappixels enabled in call
// back // back
if (i > 0 && i % pixelsPerPacket == 0) {
++pixelVal;
}
*((uint16_t *)(imageData + i * sizeof(uint16_t))) = *((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 // Send data
@ -2289,7 +2344,6 @@ void *start_timer(void *arg) {
uint64_t frameNr = 0; uint64_t frameNr = 0;
getNextFrameNumber(&frameNr); getNextFrameNumber(&frameNr);
for (int iframes = 0; iframes != numFrames; ++iframes) { for (int iframes = 0; iframes != numFrames; ++iframes) {
usleep(transmissionDelayUs); usleep(transmissionDelayUs);
// check if manual stop // check if manual stop

View File

@ -114,6 +114,9 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
#define DAC_MIN_MV (0) #define DAC_MIN_MV (0)
#define DAC_MAX_MV (2500) #define DAC_MAX_MV (2500)
#define MAX_FILTER_CELL_VAL (12) #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 */ /* Defines in the Firmware */
#define MAX_TIMESLOT_VAL (0x1F) #define MAX_TIMESLOT_VAL (0x1F)

View File

@ -449,6 +449,8 @@ void setDigitalIODelay(uint64_t pinMask, int delay);
// jungfrau specific - powerchip, autocompdisable, clockdiv, asictimer, clock, // jungfrau specific - powerchip, autocompdisable, clockdiv, asictimer, clock,
// pll, flashing firmware // pll, flashing firmware
#ifdef JUNGFRAUD #ifdef JUNGFRAUD
int setPartialReadout(int value);
int getPartialReadout();
void initReadoutConfiguration(); void initReadoutConfiguration();
int powerChip(int on); int powerChip(int on);
int isChipConfigured(); int isChipConfigured();

View File

@ -4726,7 +4726,7 @@ int set_partial_readout(int file_des) {
return printSocketReadError(); return printSocketReadError();
LOG(logDEBUG1, ("Setting partial readout: %u\n", arg)); LOG(logDEBUG1, ("Setting partial readout: %u\n", arg));
#ifndef EIGERD #if !defined(EIGERD) && !defined(JUNGFRAUD)
functionNotImplemented(); functionNotImplemented();
#else #else
// only set // only set
@ -4734,11 +4734,12 @@ int set_partial_readout(int file_des) {
if (arg <= 0 || arg > MAX_ROWS_PER_READOUT) { if (arg <= 0 || arg > MAX_ROWS_PER_READOUT) {
ret = FAIL; ret = FAIL;
sprintf(mess, sprintf(mess,
"Could not set partial readout. Must be between 1 " "Could not set partial readout. Must be between %d "
"and %d\n", "and %d\n",
MAX_ROWS_PER_READOUT); MIN_ROWS_PER_READOUT, MAX_ROWS_PER_READOUT);
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else { } else {
#ifdef EIGERD
int dr = setDynamicRange(GET_FLAG); int dr = setDynamicRange(GET_FLAG);
int isTenGiga = enableTenGigabitEthernet(GET_FLAG); int isTenGiga = enableTenGigabitEthernet(GET_FLAG);
unsigned int maxnl = MAX_ROWS_PER_READOUT; 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, arg, dr, isTenGiga ? "enabled" : "disabled", arg, maxnp,
maxnl); maxnl);
LOG(logERROR, (mess)); 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) { if (setPartialReadout(arg) == FAIL) {
ret = FAIL; ret = FAIL;
sprintf(mess, "Could not set partial readout to %d.\n", arg); 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")); LOG(logDEBUG1, ("Getting partial readout\n"));
#ifndef EIGERD #if !defined(EIGERD) && !defined(JUNGFRAUD)
functionNotImplemented(); functionNotImplemented();
#else #else
// get only // get only

View File

@ -509,6 +509,15 @@ class Detector {
/** [CTB] Options: 0-255 \n [Gotthard2] Options: 0-7 */ /** [CTB] Options: 0-255 \n [Gotthard2] Options: 0-7 */
void setDBITPipeline(int value, Positions pos = {}); 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 */ /** @name Acquisition */
@ -1048,15 +1057,6 @@ class Detector {
*/ */
void setRateCorrection(ns dead_time, Positions pos = {}); 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] */ /** [Eiger] */
Result<bool> getInterruptSubframe(Positions pos = {}) const; Result<bool> getInterruptSubframe(Positions pos = {}) const;

View File

@ -593,6 +593,7 @@ class CmdProxy {
{"vhighvoltage", "highvoltage"}, {"vhighvoltage", "highvoltage"},
{"digitest", "imagetest"}, {"digitest", "imagetest"},
{"filter", "filterresistor"}, {"filter", "filterresistor"},
{"readnlines", "partialread"},
/** temperature */ /** temperature */
@ -716,7 +717,6 @@ class CmdProxy {
{"rx_datastream", "rx_zmqstream"}, {"rx_datastream", "rx_zmqstream"},
/* Eiger Specific */ /* Eiger Specific */
{"readnlines", "partialread"},
{"resmat", "partialreset"}, {"resmat", "partialreset"},
/* Jungfrau Specific */ /* Jungfrau Specific */
@ -807,6 +807,7 @@ class CmdProxy {
{"filterresistor", &CmdProxy::filterresistor}, {"filterresistor", &CmdProxy::filterresistor},
{"currentsource", &CmdProxy::CurrentSource}, {"currentsource", &CmdProxy::CurrentSource},
{"dbitpipeline", &CmdProxy::dbitpipeline}, {"dbitpipeline", &CmdProxy::dbitpipeline},
{"partialread", &CmdProxy::partialread},
/** temperature */ /** temperature */
{"templist", &CmdProxy::templist}, {"templist", &CmdProxy::templist},
@ -915,7 +916,6 @@ class CmdProxy {
{"subdeadtime", &CmdProxy::subdeadtime}, {"subdeadtime", &CmdProxy::subdeadtime},
{"overflow", &CmdProxy::overflow}, {"overflow", &CmdProxy::overflow},
{"ratecorr", &CmdProxy::RateCorrection}, {"ratecorr", &CmdProxy::RateCorrection},
{"partialread", &CmdProxy::partialread},
{"interruptsubframe", &CmdProxy::interruptsubframe}, {"interruptsubframe", &CmdProxy::interruptsubframe},
{"measuredperiod", &CmdProxy::measuredperiod}, {"measuredperiod", &CmdProxy::measuredperiod},
{"measuredsubperiod", &CmdProxy::measuredsubperiod}, {"measuredsubperiod", &CmdProxy::measuredsubperiod},
@ -1369,6 +1369,12 @@ class CmdProxy {
"clock for latching digital bits.\n\t[Gotthard2] " "clock for latching digital bits.\n\t[Gotthard2] "
"Options: 0-7\n\t[CTB] Options: 0-255"); "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 */ /** temperature */
GET_COMMAND_NOID( GET_COMMAND_NOID(
templist, getTemperatureList, templist, getTemperatureList,
@ -1809,12 +1815,6 @@ class CmdProxy {
"[0, 1]\n\t[Eiger] Enable or disable show overflow flag in " "[0, 1]\n\t[Eiger] Enable or disable show overflow flag in "
"32 bit mode. Default is disabled."); "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( INTEGER_COMMAND_VEC_ID(
interruptsubframe, getInterruptSubframe, setInterruptSubframe, interruptsubframe, getInterruptSubframe, setInterruptSubframe,
StringTo<int>, StringTo<int>,

View File

@ -732,6 +732,14 @@ void Detector::setDBITPipeline(int value, Positions pos) {
pimpl->Parallel(&Module::setDBITPipeline, pos, value); 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 // Acquisition
void Detector::acquire() { pimpl->acquire(); } 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 { Result<bool> Detector::getInterruptSubframe(Positions pos) const {
return pimpl->Parallel(&Module::getInterruptSubframe, pos); return pimpl->Parallel(&Module::getInterruptSubframe, pos);
} }

View File

@ -734,6 +734,17 @@ void Module::setDBITPipeline(int value) {
sendToDetector(F_SET_DBIT_PIPELINE, value, nullptr); 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 // Acquisition
void Module::startReceiver() { 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 { bool Module::getInterruptSubframe() const {
return sendToDetector<int>(F_GET_INTERRUPT_SUBFRAME); return sendToDetector<int>(F_GET_INTERRUPT_SUBFRAME);
} }

View File

@ -178,7 +178,8 @@ class Module : public virtual slsDetectorDefs {
void setCurrentSource(defs::currentSrcParameters par); void setCurrentSource(defs::currentSrcParameters par);
int getDBITPipeline() const; int getDBITPipeline() const;
void setDBITPipeline(int value); void setDBITPipeline(int value);
int getPartialReadout() const;
void setPartialReadout(const int value);
/************************************************** /**************************************************
* * * *
* Acquisition * * Acquisition *
@ -337,8 +338,6 @@ class Module : public virtual slsDetectorDefs {
void setDefaultRateCorrection(); void setDefaultRateCorrection();
void setRateCorrection(int64_t t = 0); void setRateCorrection(int64_t t = 0);
void sendReceiverRateCorrections(const std::vector<int64_t> &t); void sendReceiverRateCorrections(const std::vector<int64_t> &t);
int getPartialReadout() const;
void setPartialReadout(const int value);
bool getInterruptSubframe() const; bool getInterruptSubframe() const;
void setInterruptSubframe(const bool enable); void setInterruptSubframe(const bool enable);
int64_t getMeasuredPeriod() const; int64_t getMeasuredPeriod() const;

View File

@ -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]") { TEST_CASE("interruptsubframe", "[.cmd]") {
Detector det; Detector det;
CmdProxy proxy(&det); CmdProxy proxy(&det);

View File

@ -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]") { TEST_CASE("currentsource", "[.cmd]") {
Detector det; Detector det;
CmdProxy proxy(&det); CmdProxy proxy(&det);

View File

@ -414,9 +414,11 @@ int ClientInterface::setup_receiver(Interface &socket) {
std::to_string(arg.quad) + std::to_string(arg.quad) +
" due to fifo strucutre memory allocation"); " due to fifo strucutre memory allocation");
} }
impl()->setPartialReadout(arg.partialReadout);
impl()->setThresholdEnergy(arg.thresholdEnergyeV[0]); impl()->setThresholdEnergy(arg.thresholdEnergyeV[0]);
} }
if (myDetectorType == EIGER || myDetectorType == JUNGFRAU) {
impl()->setPartialReadout(arg.partialReadout);
}
if (myDetectorType == MYTHEN3) { if (myDetectorType == MYTHEN3) {
std::array<int, 3> val; std::array<int, 3> val;
for (int i = 0; i < 3; ++i) { for (int i = 0; i < 3; ++i) {
@ -1408,6 +1410,9 @@ int ClientInterface::set_partial_readout(Interface &socket) {
auto arg = socket.Receive<int>(); auto arg = socket.Receive<int>();
if (arg >= 0) { if (arg >= 0) {
verifyIdle(socket); 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; LOG(logDEBUG1) << "Setting Partial Readout:" << arg;
impl()->setPartialReadout(arg); impl()->setPartialReadout(arg);
} }

View File

@ -51,6 +51,7 @@ class GeneralData {
uint32_t vetoPacketSize{0}; uint32_t vetoPacketSize{0};
uint32_t vetoImageSize{0}; uint32_t vetoImageSize{0};
uint32_t vetoHsize{0}; uint32_t vetoHsize{0};
uint32_t maxRowsPerReadout{0};
GeneralData(){}; GeneralData(){};
virtual ~GeneralData(){}; virtual ~GeneralData(){};
@ -339,6 +340,7 @@ class EigerData : public GeneralData {
threadsPerReceiver = 2; threadsPerReceiver = 2;
headerPacketSize = 40; headerPacketSize = 40;
standardheader = true; standardheader = true;
maxRowsPerReadout = 256;
}; };
/** /**
@ -384,6 +386,7 @@ class JungfrauData : public GeneralData {
defaultFifoDepth = 2500; defaultFifoDepth = 2500;
standardheader = true; standardheader = true;
defaultUdpSocketBufferSize = (1000 * 1024 * 1024); defaultUdpSocketBufferSize = (1000 * 1024 * 1024);
maxRowsPerReadout = 512;
}; };
/** /**

View File

@ -477,8 +477,8 @@ std::vector<uint64_t> Implementation::getNumMissingPackets() const {
int np = generalData->packetsPerFrame; int np = generalData->packetsPerFrame;
uint64_t totnp = np; uint64_t totnp = np;
// partial readout // partial readout
if (partialReadout != MAX_EIGER_ROWS_PER_READOUT) { if (partialReadout != generalData->maxRowsPerReadout) {
totnp = ((partialReadout * np) / MAX_EIGER_ROWS_PER_READOUT); totnp = ((partialReadout * np) / generalData->maxRowsPerReadout);
} }
totnp *= numberOfTotalFrames; totnp *= numberOfTotalFrames;
mp[i] = listener[i]->GetNumMissingPacket(stoppedFlag, totnp); mp[i] = listener[i]->GetNumMissingPacket(stoppedFlag, totnp);

View File

@ -219,7 +219,7 @@ class Implementation : private virtual slsDetectorDefs {
/* [Eiger] */ /* [Eiger] */
void setDeactivatedPadding(const bool enable); void setDeactivatedPadding(const bool enable);
int getPartialReadout() const; int getPartialReadout() const;
/* [Eiger] */ /* [Eiger][Jungfrau] */
void setPartialReadout(const int value); void setPartialReadout(const int value);
/** [Eiger] */ /** [Eiger] */
void setThresholdEnergy(const int value); void setThresholdEnergy(const int value);
@ -352,7 +352,7 @@ class Implementation : private virtual slsDetectorDefs {
bool activated{true}; bool activated{true};
std::array<bool, 2> detectorDataStream = {{true, true}}; std::array<bool, 2> detectorDataStream = {{true, true}};
bool deactivatedPaddingEnable{true}; bool deactivatedPaddingEnable{true};
int partialReadout{MAX_EIGER_ROWS_PER_READOUT}; int partialReadout{0};
int thresholdEnergyeV{-1}; int thresholdEnergyeV{-1};
std::array<int, 3> thresholdAllEnergyeV = {{-1, -1, -1}}; std::array<int, 3> thresholdAllEnergyeV = {{-1, -1, -1}};
std::vector<int64_t> rateCorrections; std::vector<int64_t> rateCorrections;

View File

@ -336,7 +336,8 @@ class JungfrauMasterAttributes : public MasterAttributes {
oss << MasterAttributes::GetBinaryMasterAttributes() oss << MasterAttributes::GetBinaryMasterAttributes()
<< "Exptime : " << sls::ToString(exptime) << '\n' << "Exptime : " << sls::ToString(exptime) << '\n'
<< "Period : " << sls::ToString(period) << '\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(); std::string message = oss.str();
MasterAttributes::WriteBinaryAttributes(fd, message); MasterAttributes::WriteBinaryAttributes(fd, message);
}; };
@ -352,6 +353,13 @@ class JungfrauMasterAttributes : public MasterAttributes {
"Number of UDP Interfaces", PredType::NATIVE_INT, dataspace); "Number of UDP Interfaces", PredType::NATIVE_INT, dataspace);
dataset.write(&numUDPInterfaces, PredType::NATIVE_INT); 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 #endif
}; };

View File

@ -43,7 +43,6 @@
// parameters to calculate fifo depth // parameters to calculate fifo depth
#define SAMPLE_TIME_IN_NS (100000000) // 100ms #define SAMPLE_TIME_IN_NS (100000000) // 100ms
#define MAX_EIGER_ROWS_PER_READOUT (256)
// to differentiate between gotthard and short gotthard // to differentiate between gotthard and short gotthard
#define GOTTHARD_PACKET_SIZE (1286) #define GOTTHARD_PACKET_SIZE (1286)

View File

@ -26,7 +26,7 @@ class DataSocket {
DataSocket &operator=(DataSocket const &) = delete; DataSocket &operator=(DataSocket const &) = delete;
int getSocketId() const { return sockfd_; } int getSocketId() const { return sockfd_; }
int getFnum() const { return fnum_; } int getFnum() const { return fnum_; }
int setFnum(const int fnum); void setFnum(const int fnum);
int Send(const void *buffer, size_t size); int Send(const void *buffer, size_t size);

View File

@ -42,7 +42,7 @@ DataSocket &DataSocket::operator=(DataSocket &&move) noexcept {
return *this; return *this;
} }
int DataSocket::setFnum(const int fnum) { void DataSocket::setFnum(const int fnum) {
fnum_ = fnum; fnum_ = fnum;
} }