gotthard2: bursts and burst period, written to same register as triggers and delay (kept in server as variables) and set if conditions meet. bursts and burst period only in auto timing and burst mode. Also updating theses registers when switching between timing modes or burst modes

This commit is contained in:
2020-02-25 15:45:40 +01:00
parent f902bb06ad
commit 6a0a931e3e
18 changed files with 1097 additions and 201 deletions

View File

@ -572,9 +572,11 @@ class CmdProxy {
{"acquire", &CmdProxy::acquire},
{"frames", &CmdProxy::frames},
{"triggers", &CmdProxy::triggers},
{"bursts", &CmdProxy::bursts},
{"exptime", &CmdProxy::exptime},
{"period", &CmdProxy::period},
{"delay", &CmdProxy::delay},
{"burstperiod", &CmdProxy::burstperiod},
{"framesl", &CmdProxy::framesl},
{"triggersl", &CmdProxy::triggersl},
{"delayl", &CmdProxy::delayl},
@ -1017,6 +1019,10 @@ class CmdProxy {
std::stol,
"[n_triggers]\n\tNumber of triggers per aquire. Use timing command to set timing mode.");
INTEGER_COMMAND_NOID(bursts, getNumberOfBursts, setNumberOfBursts,
std::stol,
"[n_bursts]\n\t[Gotthard2] Number of bursts per aquire. Only in auto timing mode and burst mode. Use timing command to set timing mode and burstmode command to set burst mode.");
TIME_COMMAND(exptime, getExptime, setExptime,
"[duration] [(optional unit) ns|us|ms|s]\n\tExposure time"
"\n\t[Gotthard2] Uploaded to detector just before acquisition starts");
@ -1026,8 +1032,10 @@ class CmdProxy {
"\n\t[Gotthard2] Uploaded to detector just before acquisition starts");
TIME_COMMAND(delay, getDelayAfterTrigger, setDelayAfterTrigger,
"[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb] Delay after trigger"
"\n\t[Gotthard2] only in continuous mode.");
"[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb] Delay after trigger");
TIME_COMMAND(burstperiod, getBurstPeriod, setBurstPeriod,
"[duration] [(optional unit) ns|us|ms|s]\n\t[Gotthard2] Burst period. Only in burst mode and auto timing mode.");
GET_COMMAND(framesl, getNumberOfFramesLeft,
"\n\t[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB] Number of frames left in acquisition."

View File

@ -1160,6 +1160,22 @@ void Detector::setImageTestMode(int value, Positions pos) {
// Gotthard2 Specific
Result<int64_t> Detector::getNumberOfBursts(Positions pos) const {
return pimpl->Parallel(&slsDetector::getNumberOfBursts, pos);
}
void Detector::setNumberOfBursts(int64_t value) {
pimpl->Parallel(&slsDetector::setNumberOfBursts, {}, value);
}
Result<ns> Detector::getBurstPeriod(Positions pos) const {
return pimpl->Parallel(&slsDetector::getBurstPeriod, pos);
}
void Detector::setBurstPeriod(ns value, Positions pos) {
pimpl->Parallel(&slsDetector::setBurstPeriod, pos, value.count());
}
Result<std::array<int, 2>> Detector::getInjectChannel(Positions pos) {
return pimpl->Parallel(&slsDetector::getInjectChannel, pos);
}

View File

@ -338,7 +338,10 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
shm()->currentThresholdEV = -1;
shm()->nFrames = 1;
shm()->nTriggers = 1;
shm()->nBursts = 1;
shm()->nAddStorageCells = 0;
shm()->timingMode = AUTO_TIMING;
shm()->burstMode = BURST_INTERNAL;
shm()->deadTime = 0;
sls::strcpy_safe(shm()->rxHostname, "none");
shm()->rxTCPPort = DEFAULT_PORTNO + 2;
@ -756,8 +759,8 @@ void slsDetector::updateCachedDetectorVariables() {
n += client.Receive(&i64, sizeof(i64));
shm()->nFrames = i64;
// storage cell
if (shm()->myDetectorType == JUNGFRAU) {
// storage cell
n += client.Receive(&i64, sizeof(i64));
shm()->nAddStorageCells = i64;
}
@ -766,6 +769,22 @@ void slsDetector::updateCachedDetectorVariables() {
n += client.Receive(&i64, sizeof(i64));
shm()->nTriggers = i64;
// bursts
if (shm()->myDetectorType == GOTTHARD2) {
n += client.Receive(&i64, sizeof(i64));
shm()->nBursts = i64;
}
// timing mode
n += client.Receive(&i32, sizeof(i32));
shm()->timingMode = static_cast<timingMode>(i32);
// burst mode
if (shm()->myDetectorType == GOTTHARD2) {
n += client.Receive(&i32, sizeof(i32));
shm()->burstMode = static_cast<burstMode>(i32);
}
// readout mode
if (shm()->myDetectorType == CHIPTESTBOARD) {
n += client.Receive(&i32, sizeof(i32));
@ -1202,7 +1221,14 @@ uint64_t slsDetector::getStartingFrameNumber() {
void slsDetector::sendTotalNumFramestoReceiver() {
if (shm()->useReceiverFlag) {
int64_t arg = shm()->nFrames * shm()->nTriggers * (shm()->nAddStorageCells + 1);
int64_t repeats = shm()->nTriggers;
// gotthard2 & auto & burst mode, use nBursts instead of nTriggers
if (shm()->myDetectorType == GOTTHARD2) {
if (shm()->burstMode != BURST_OFF && shm()->timingMode == AUTO_TIMING) {
repeats = shm()->nBursts;
}
}
int64_t arg = shm()->nFrames * repeats * (shm()->nAddStorageCells + 1);
FILE_LOG(logDEBUG1) << "Sending total number of frames (#f x #t x #s) to Receiver: " << arg;
sendToReceiver(F_RECEIVER_SET_NUM_FRAMES, arg, nullptr);
}
@ -1253,6 +1279,29 @@ void slsDetector::setNumberOfTriggers(int64_t value) {
shm()->nTriggers = value;
sendTotalNumFramestoReceiver();
}
int64_t slsDetector::getNumberOfBurstsFromShm() {
return shm()->nBursts;
}
int64_t slsDetector::getNumberOfBursts() {
int64_t prevVal = shm()->nBursts;
int64_t retval = -1;
sendToDetector(F_GET_NUM_BURSTS, nullptr, retval);
FILE_LOG(logDEBUG1) << "number of bursts :" << retval;
shm()->nBursts = retval;
if (prevVal != retval) {
sendTotalNumFramestoReceiver();
}
return shm()->nBursts;
}
void slsDetector::setNumberOfBursts(int64_t value) {
FILE_LOG(logDEBUG1) << "Setting number of bursts to " << value;
sendToDetector(F_SET_NUM_BURSTS, value, nullptr);
shm()->nBursts = value;
sendTotalNumFramestoReceiver();
}
int slsDetector::getNumberOfAdditionalStorageCellsFromShm() {
return shm()->nAddStorageCells;
@ -1367,6 +1416,18 @@ void slsDetector::setDelayAfterTrigger(int64_t value) {
sendToDetector(F_SET_DELAY_AFTER_TRIGGER, value, nullptr);
}
int64_t slsDetector::getBurstPeriod() {
int64_t retval = -1;
sendToDetector(F_GET_BURST_PERIOD, nullptr, retval);
FILE_LOG(logDEBUG1) << "burst period :" << retval << "ns";
return retval;
}
void slsDetector::setBurstPeriod(int64_t value) {
FILE_LOG(logDEBUG1) << "Setting burst period to " << value << "ns";
sendToDetector(F_SET_BURST_PERIOD, value, nullptr);
}
int64_t slsDetector::getSubExptime() {
int64_t retval = -1;
sendToDetector(F_GET_SUB_EXPTIME, nullptr, retval);
@ -1498,6 +1559,7 @@ slsDetectorDefs::timingMode slsDetector::setTimingMode(timingMode value) {
FILE_LOG(logDEBUG1) << "Setting communication to mode " << value;
sendToDetector(fnum, static_cast<int>(value), retval);
FILE_LOG(logDEBUG1) << "Timing Mode: " << retval;
shm()->timingMode = retval;
return retval;
}
@ -2488,13 +2550,15 @@ slsDetectorDefs::burstMode slsDetector::getBurstMode() {
int retval = -1;
sendToDetector(F_GET_BURST_MODE, nullptr, retval);
FILE_LOG(logDEBUG1) << "Burst mode:" << retval;
return static_cast<slsDetectorDefs::burstMode>(retval);
shm()->burstMode = static_cast<slsDetectorDefs::burstMode>(retval);
return shm()->burstMode;
}
void slsDetector::setBurstMode(slsDetectorDefs::burstMode value) {
int arg = static_cast<int>(value);
FILE_LOG(logDEBUG1) << "Setting burst mode to " << arg;
sendToDetector(F_SET_BURST_MODE, arg, nullptr);
shm()->burstMode = value;
}
int slsDetector::setCounterBit(int cb) {

View File

@ -13,7 +13,7 @@
class ServerInterface;
#define SLS_SHMAPIVERSION 0x190726
#define SLS_SHMVERSION 0x191127
#define SLS_SHMVERSION 0x200225
/**
* @short structure allocated in shared memory to store detector settings for
@ -86,8 +86,17 @@ struct sharedSlsDetector {
/** number of triggers */
int64_t nTriggers;
/** number of bursts */
int64_t nBursts;
/** number of additional storage cells */
int nAddStorageCells;
/** timing mode */
slsDetectorDefs::timingMode timingMode;
/** burst mode */
slsDetectorDefs::burstMode burstMode;
/** rate correction in ns */
int64_t deadTime;
@ -535,6 +544,15 @@ class slsDetector : public virtual slsDetectorDefs {
void setNumberOfTriggers(int64_t value);
/** [Gotthard2] only in burst mode and in auto timing mode */
int64_t getNumberOfBurstsFromShm();
/** [Gotthard2] only in burst mode and in auto timing mode */
int64_t getNumberOfBursts();
/** [Gotthard2] only in burst mode and in auto timing mode */
void setNumberOfBursts(int64_t value);
/** [Jungfrau] Advanced */
int getNumberOfAdditionalStorageCellsFromShm();
@ -564,14 +582,18 @@ class slsDetector : public virtual slsDetectorDefs {
void setPeriod(int64_t value);
/** [Gotthard][Jungfrau][CTB][Mythen3]
* [Gotthard2] only in continuous mode */
/** [Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] */
int64_t getDelayAfterTrigger();
/** [Gotthard][Jungfrau][CTB][Mythen3]
* [Gotthard2] only in continuous mode */
/** [Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] */
void setDelayAfterTrigger(int64_t value);
/** [Gotthard2] only in burst mode and in auto timing mode */
int64_t getBurstPeriod();
/** [Gotthard2] only in burst mode and in auto timing mode */
void setBurstPeriod(int64_t value);
/** [Eiger] in 32 bit mode */
int64_t getSubExptime();