fixed merge

This commit is contained in:
Erik Frojdh
2019-08-09 11:45:06 +02:00
15 changed files with 235 additions and 121 deletions

View File

@ -326,9 +326,7 @@ void Detector::startAcquisition() {
pimpl->Parallel(&slsDetector::startAcquisition, {});
}
void Detector::stopAcquisition() {
pimpl->Parallel(&slsDetector::stopAcquisition, {});
}
void Detector::stopAcquisition() { pimpl->stopAcquisition(); }
void Detector::sendSoftwareTrigger(Positions pos) {
pimpl->Parallel(&slsDetector::sendSoftwareTrigger, pos);
@ -351,6 +349,76 @@ void Detector::configureMAC(Positions pos) {
pimpl->Parallel(&slsDetector::configureMAC, pos);
}
Result<int64_t> Detector::getNumberOfFrames() const {
return pimpl->Parallel(&slsDetector::setTimer, {}, defs::FRAME_NUMBER, -1);
}
void Detector::setNumberOfFrames(int64_t value) {
pimpl->Parallel(&slsDetector::setTimer, {}, defs::FRAME_NUMBER, value);
}
Result<int64_t> Detector::getNumberOfCycles() const {
return pimpl->Parallel(&slsDetector::setTimer, {}, defs::CYCLES_NUMBER, -1);
}
void Detector::setNumberOfCycles(int64_t value) {
pimpl->Parallel(&slsDetector::setTimer, {}, defs::CYCLES_NUMBER, value);
}
Result<int64_t> Detector::getNumberOfStorageCells() const {
return pimpl->Parallel(&slsDetector::setTimer, {}, defs::STORAGE_CELL_NUMBER, -1);
}
void Detector::setNumberOfStorageCells(int64_t value) {
pimpl->Parallel(&slsDetector::setTimer, {}, defs::STORAGE_CELL_NUMBER, value);
}
Result<int64_t> Detector::getNumberOfAnalogSamples(Positions pos) const {
return pimpl->Parallel(&slsDetector::setTimer, pos, defs::ANALOG_SAMPLES, -1);
}
void Detector::setNumberOfAnalogSamples(int64_t value, Positions pos) {
pimpl->Parallel(&slsDetector::setTimer, pos, defs::ANALOG_SAMPLES, value);
}
Result<int64_t> Detector::getNumberOfDigitalSamples(Positions pos) const {
return pimpl->Parallel(&slsDetector::setTimer, pos, defs::DIGITAL_SAMPLES, -1);
}
void Detector::setNumberOfDigitalSamples(int64_t value, Positions pos) {
pimpl->Parallel(&slsDetector::setTimer, pos, defs::DIGITAL_SAMPLES, value);
}
Result<ns> Detector::getDelayAfterTrigger(Positions pos) const {
return pimpl->Parallel(&slsDetector::setTimer, pos,
defs::DELAY_AFTER_TRIGGER, -1);
}
void Detector::setDelayAfterTrigger(ns value, Positions pos) {
pimpl->Parallel(&slsDetector::setTimer, pos, defs::DELAY_AFTER_TRIGGER,
value.count());
}
Result<ns> Detector::getSubFrameDeadTime(Positions pos) const {
return pimpl->Parallel(&slsDetector::setTimer, pos, defs::SUBFRAME_DEADTIME,
-1);
}
void Detector::setSubFrameDeadTime(ns value, Positions pos) {
pimpl->Parallel(&slsDetector::setTimer, pos, defs::SUBFRAME_DEADTIME,
value.count());
}
Result<ns> Detector::getStorageCellDelay(Positions pos) const {
return pimpl->Parallel(&slsDetector::setTimer, pos,
defs::STORAGE_CELL_DELAY, -1);
}
void Detector::setStorageCellDelay(ns value, Positions pos) {
pimpl->Parallel(&slsDetector::setTimer, pos, defs::STORAGE_CELL_DELAY,
value.count());
}
// Erik
Result<int> Detector::getFramesCaughtByReceiver(Positions pos) const {
return pimpl->Parallel(&slsDetector::getFramesCaughtByReceiver, pos);

View File

@ -287,10 +287,6 @@ void multiSlsDetector::initializeDetectorStructure() {
multi_shm()->numberOfChannelInclGapPixels[Y] = 0;
multi_shm()->maxNumberOfChannelsPerDetector[X] = 0;
multi_shm()->maxNumberOfChannelsPerDetector[Y] = 0;
for (int64_t &i : multi_shm()->timerValue) {
i = 0;
}
multi_shm()->acquiringFlag = false;
multi_shm()->receiver_upstream = false;
}
@ -1144,41 +1140,12 @@ uint64_t multiSlsDetector::getStartingFrameNumber(int detPos) {
int64_t multiSlsDetector::setTimer(timerIndex index, int64_t t, int detPos) {
// single
if (detPos >= 0) {
// error for setting values individually
// FIXME: what else? and error code
if (t != -1) {
switch (index) {
case FRAME_NUMBER:
case CYCLES_NUMBER:
case STORAGE_CELL_NUMBER:
throw RuntimeError("Cannot set number of frames, cycles or "
"storage cells individually.");
default:
break;
}
}
return detectors[detPos]->setTimer(index, t);
}
// multi
auto r = parallelCall(&slsDetector::setTimer, index, t);
int64_t ret = sls::minusOneIfDifferent(r);
// set progress
if (t != -1) {
switch (index) {
case FRAME_NUMBER:
case CYCLES_NUMBER:
case STORAGE_CELL_NUMBER:
setTotalProgress();
break;
default:
break;
}
}
multi_shm()->timerValue[index] = ret;
return ret;
return sls::minusOneIfDifferent(r);
}
int64_t multiSlsDetector::secondsToNanoSeconds(double t) {
@ -1239,10 +1206,6 @@ int64_t multiSlsDetector::setNumberOfCycles(int64_t t, int detPos) {
return setTimer(CYCLES_NUMBER, t, detPos);
}
int64_t multiSlsDetector::setNumberOfGates(int64_t t, int detPos) {
return setTimer(GATES_NUMBER, t, detPos);
}
int64_t multiSlsDetector::setNumberOfStorageCells(int64_t t, int detPos) {
return setTimer(STORAGE_CELL_NUMBER, t, detPos);
}
@ -4199,16 +4162,28 @@ void multiSlsDetector::registerDataCallback(
int multiSlsDetector::setTotalProgress() {
int nf = 1, nc = 1, ns = 1;
if (multi_shm()->timerValue[FRAME_NUMBER] != 0) {
nf = multi_shm()->timerValue[FRAME_NUMBER];
Result<int64_t> temp = Parallel(&slsDetector::setTimer, {}, FRAME_NUMBER, -1);
if (!temp.equal()) {
throw RuntimeError("Inconsistent number of frames");
}
nf = temp.squash();
temp = Parallel(&slsDetector::setTimer, {}, CYCLES_NUMBER, -1);
if (!temp.equal()) {
throw RuntimeError("Inconsistent number of cycles");
}
nc = temp.squash();
if (getDetectorTypeAsEnum() == JUNGFRAU) {
temp = Parallel(&slsDetector::setTimer, {}, STORAGE_CELL_NUMBER, -1);
if (!temp.equal()) {
throw RuntimeError("Inconsistent number of additional storage cells");
}
ns = temp.squash() + 1;
}
if (multi_shm()->timerValue[CYCLES_NUMBER] > 0) {
nc = multi_shm()->timerValue[CYCLES_NUMBER];
}
if (multi_shm()->timerValue[STORAGE_CELL_NUMBER] > 0) {
ns = multi_shm()->timerValue[STORAGE_CELL_NUMBER] + 1;
if (nf == 0 || nc == 0) {
throw RuntimeError("Number of frames or cycles is 0");
}
totalProgress = nf * nc * ns;
@ -4269,6 +4244,7 @@ int multiSlsDetector::acquire() {
stopReceiver();
}
}
setTotalProgress();
startProcessingThread();

View File

@ -325,7 +325,6 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
shm()->timerValue[ACQUISITION_TIME] = 0;
shm()->timerValue[FRAME_PERIOD] = 0;
shm()->timerValue[DELAY_AFTER_TRIGGER] = 0;
shm()->timerValue[GATES_NUMBER] = 0;
shm()->timerValue[CYCLES_NUMBER] = 1;
shm()->timerValue[ACTUAL_TIME] = 0;
shm()->timerValue[MEASUREMENT_TIME] = 0;

View File

@ -378,9 +378,8 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
++i;
/*! \page config
- <b>extsig [flag]</b> sets/gets the mode of the external signal. Options: \c off, \c gate_in_active_high, \c gate_in_active_low, \c trigger_in_rising_edge, \c trigger_in_falling_edge,
\c ro_trigger_in_rising_edge, \c ro_trigger_in_falling_edge, \c gate_out_active_high, \c gate_out_active_low, \c trigger_out_rising_edge, \c trigger_out_falling_edge, \c ro_trigger_out_rising_edge,
\c ro_trigger_out_falling_edge. \n Used in GOTTHARDonly. \c Returns \c (string)
- <b>extsig [flag]</b> sets/gets the mode of the external signal. Options: \c off, \c trigger_in_rising_edge, \c trigger_in_falling_edge,
\c trigger_out_rising_edge, \c trigger_out_falling_edge\n Used in GOTTHARDonly. \c Returns \c (string)
*/
descrToFuncMap[i].m_pFuncName = "extsig"; /* find command! */
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdAdvanced;
@ -577,13 +576,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdTimer;
++i;
/*! \page timing
- <b>gates [i]</b> sets/gets number of gates. Used in GOTTHARD only. \c Returns \c (long long int)
*/
descrToFuncMap[i].m_pFuncName = "gates";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdTimer;
++i;
/*! \page timing
- <b>frames [i]</b> sets/gets number of frames. If \c timing is not \c auto, then it is the number of frames per cycle/trigger. \c Returns \c (long long int)
*/
@ -4333,8 +4325,6 @@ std::string slsDetectorCommand::cmdTimer(int narg, const char * const args[], in
index = SUBFRAME_DEADTIME;
else if (cmd == "delay")
index = DELAY_AFTER_TRIGGER;
else if (cmd == "gates")
index = GATES_NUMBER;
else if (cmd == "frames")
index = FRAME_NUMBER;
else if (cmd == "cycles")
@ -4825,7 +4815,7 @@ std::string slsDetectorCommand::helpAdvanced(int action) {
std::ostringstream os;
if (action == PUT_ACTION || action == HELP_ACTION) {
os << "extsig mode \t sets the mode of the external signal. can be \n \t \t \t off, \n \t \t \t gate_in_active_high, \n \t \t \t gate_in_active_low, \n \t \t \t trigger_in_rising_edge, \n \t \t \t trigger_in_falling_edge, \n \t \t \t ro_trigger_in_rising_edge, \n \t \t \t ro_trigger_in_falling_edge, \n \t \t \t gate_out_active_high, \n \t \t \t gate_out_active_low, \n \t \t \t trigger_out_rising_edge, \n \t \t \t trigger_out_falling_edge, \n \t \t \t ro_trigger_out_rising_edge, \n \t \t \t ro_trigger_out_falling_edge" << std::endl;
os << "extsig mode \t sets the mode of the external signal. can be \n \t \t \t off, \n \t \t \t trigger_in_rising_edge, \n \t \t \t trigger_in_falling_edge, \n \t \t \t trigger_out_rising_edge, \n \t \t \t trigger_out_falling_edge" << std::endl;
os << "flags mode \t sets the readout flags to mode. can be none, storeinram, tot, continous, parallel, nonparallel, digital, analog_digital, overlow, nooverflow, unknown." << std::endl;
os << "interruptsubframe flag \t sets the interrupt subframe flag. Setting it to 1 will interrupt the last subframe at the required exposure time. By default, this is disabled and set to 0, ie. it will wait for the last sub frame to finish exposing. Used for EIGER in 32 bit mode only." << std::endl;
os << "readnlines f \t sets the number of rows to read out per half module. Options: 1 - 256 (Not all values as it depends on dynamic range and 10GbE enabled). Used for EIGER only. " << std::endl;
@ -4841,7 +4831,7 @@ std::string slsDetectorCommand::helpAdvanced(int action) {
}
if (action == GET_ACTION || action == HELP_ACTION) {
os << "extsig \t gets the mode of the external signal. can be \n \t \t \t off, \n \t \t \t gate_in_active_high, \n \t \t \t gate_in_active_low, \n \t \t \t trigger_in_rising_edge, \n \t \t \t trigger_in_falling_edge, \n \t \t \t ro_trigger_in_rising_edge, \n \t \t \t ro_trigger_in_falling_edge, \n \t \t \t gate_out_active_high, \n \t \t \t gate_out_active_low, \n \t \t \t trigger_out_rising_edge, \n \t \t \t trigger_out_falling_edge, \n \t \t \t ro_trigger_out_rising_edge, \n \t \t \t ro_trigger_out_falling_edge" << std::endl;
os << "extsig \t gets the mode of the external signal. can be \n \t \t \t off, \n \t \t \t trigger_in_rising_edge, \n \t \t \t trigger_in_falling_edge, \n \t \t \t trigger_out_rising_edge, \n \t \t \t trigger_out_falling_edge" << std::endl;
os << "flags \t gets the readout flags. can be none, storeinram, tot, continous, parallel, nonparallel, digital, analog_digital, overflow, nooverflow, unknown" << std::endl;
os << "interruptsubframe \t gets the interrupt subframe flag. Setting it to 1 will interrupt the last subframe at the required exposure time. By default, this is disabled and set to 0, ie. it will wait for the last sub frame to finish exposing. Used for EIGER in 32 bit mode only." << std::endl;
os << "readnlines \t gets the number of rows to read out per half module. Used for EIGER only. " << std::endl;

View File

@ -159,10 +159,6 @@ int64_t slsDetectorUsers::setNumberOfCycles(int64_t t, int detPos){
return detector.setNumberOfCycles(t, detPos);
}
int64_t slsDetectorUsers::setNumberOfGates(int64_t t, int detPos){
return detector.setNumberOfGates(t, detPos);
}
int64_t slsDetectorUsers::setNumberOfStorageCells(int64_t t, int detPos) {
return detector.setNumberOfStorageCells(t, detPos);
}