This commit is contained in:
maliakal_d 2019-08-09 17:19:12 +02:00
parent cac353748e
commit b2d39d4785
10 changed files with 142 additions and 96 deletions

View File

@ -124,7 +124,7 @@ void qTabAdvanced::PopulateDetectors() {
SLOT(SetDetector(int))); SLOT(SetDetector(int)));
comboDetector->clear(); comboDetector->clear();
for (int i = 0; i < myDet->size(); ++i) for (unsigned int i = 0; i < myDet->size(); ++i)
comboDetector->addItem(QString(myDet->getHostname(i).c_str())); comboDetector->addItem(QString(myDet->getHostname(i).c_str()));
comboDetector->setCurrentIndex(0); comboDetector->setCurrentIndex(0);

View File

@ -81,7 +81,7 @@ void qTabDataOutput::PopulateDetectors() {
comboDetector->clear(); comboDetector->clear();
comboDetector->addItem("All"); comboDetector->addItem("All");
if (myDet->size() > 1) { if (myDet->size() > 1) {
for (int i = 0; i < myDet->size(); ++i) for (unsigned int i = 0; i < myDet->size(); ++i)
comboDetector->addItem(QString(myDet->getHostname(i).c_str())); comboDetector->addItem(QString(myDet->getHostname(i).c_str()));
} }
} }

View File

@ -55,7 +55,7 @@ void qTabDebugging::PopulateDetectors() {
FILE_LOG(logDEBUG) << "Populating detectors"; FILE_LOG(logDEBUG) << "Populating detectors";
comboDetector->clear(); comboDetector->clear();
for (int i = 0; i < myDet->size(); ++i) { for (unsigned int i = 0; i < myDet->size(); ++i) {
comboDetector->addItem(QString(myDet->getHostname(i).c_str())); comboDetector->addItem(QString(myDet->getHostname(i).c_str()));
} }
} }

View File

@ -125,7 +125,7 @@ void qTabDeveloper::PopulateDetectors() {
comboDetector->clear(); comboDetector->clear();
comboDetector->addItem("All"); comboDetector->addItem("All");
if (myDet->size() > 1) { if (myDet->size() > 1) {
for (int i = 0; i < myDet->size(); ++i) for (unsigned int i = 0; i < myDet->size(); ++i)
comboDetector->addItem(QString(myDet->getHostname(i).c_str())); comboDetector->addItem(QString(myDet->getHostname(i).c_str()));
} }
comboDetector->setCurrentIndex(0); comboDetector->setCurrentIndex(0);

View File

@ -908,6 +908,54 @@ class Detector {
void setDAC(int value, defs::dacIndex index, bool mV, Positions pos = {}); void setDAC(int value, defs::dacIndex index, bool mV, Positions pos = {});
Result<defs::externalCommunicationMode> getTimingMode(Positions pos = {}) const;
/**
* (Gotthard, Jungfrau, CTB Options: AUTO_TIMING, TRIGGER_EXPOSURE)
* (Eiger Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER)
*/
void setTimingMode(defs::externalCommunicationMode value, Positions pos = {});
/**
* (Gotthard)
*/
Result<defs::externalSignalFlag> getExternalSignalFlags(Positions pos = {}) const;
/**
* (Gotthard Options: TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE)
*/
void setExternalSignalFlags(defs::externalSignalFlag value, Positions pos = {});
/**
* (Eiger)
*/
Result<bool> getParallelMode(Positions pos = {}) const;
/**
* (Eiger)
*/
void setParallelMode(bool value, Positions pos = {});
/**
* (Eiger)
*/
Result<bool> getOverFlowMode(Positions pos = {}) const;
/**
* (Eiger)
*/
void setOverFlowMode(bool value, Positions pos = {});
/**
* (CTB Options: NORMAL_READOUT = 0, DIGITAL_ONLY = 1, ANALOG_AND_DIGITAL = 2)
*/
Result<int> getSignalType(Positions pos = {}) const;
/**
* (CTB Options: NORMAL_READOUT = 0, DIGITAL_ONLY = 1, ANALOG_AND_DIGITAL = 2)
*/
void setSignalType(int value, Positions pos = {});
// Erik // Erik
Result<int> getFramesCaughtByReceiver(Positions pos = {}) const; Result<int> getFramesCaughtByReceiver(Positions pos = {}) const;

View File

@ -886,7 +886,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
*/ */
externalCommunicationMode setExternalCommunicationMode( externalCommunicationMode setExternalCommunicationMode(
externalCommunicationMode pol = GET_EXTERNAL_COMMUNICATION_MODE, externalCommunicationMode pol = GET_EXTERNAL_COMMUNICATION_MODE,
int detPos = -1); int detPos = -1);//
/** /**
* Set/get external signal flags (to specify triggerinrising edge etc) * Set/get external signal flags (to specify triggerinrising edge etc)
@ -897,7 +897,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
*/ */
externalSignalFlag externalSignalFlag
setExternalSignalFlags(externalSignalFlag pol = GET_EXTERNAL_SIGNAL_FLAG, setExternalSignalFlags(externalSignalFlag pol = GET_EXTERNAL_SIGNAL_FLAG,
int detPos = -1); int detPos = -1);//
/** /**
* Set/get readout flags (Eiger, Mythen) * Set/get readout flags (Eiger, Mythen)
@ -906,7 +906,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
* @returns readout flag * @returns readout flag
*/ */
int setReadOutFlags(readOutFlags flag = GET_READOUT_FLAGS, int detPos = -1); int setReadOutFlags(readOutFlags flag = GET_READOUT_FLAGS, int detPos = -1);//
/** /**
* Set Interrupt last sub frame (Only for Eiger) * Set Interrupt last sub frame (Only for Eiger)

View File

@ -101,7 +101,7 @@ class multiSlsDetectorClient {
return; return;
} }
} }
if (parser.detector_id() >= detPtr->size()) { if (parser.detector_id() >= static_cast<int>(detPtr->size())) {
os << "position is out of bounds.\n"; os << "position is out of bounds.\n";
return; return;
} }

View File

@ -597,7 +597,7 @@ Result<int> Detector::getTemp(defs::dacIndex index, Positions pos) const {
switch (getDetectorType()) { switch (getDetectorType()) {
case defs::EIGER: case defs::EIGER:
case defs::JUNGFRAU: case defs::JUNGFRAU:
for (auto it : pos) { for (auto &it : res) {
it /= 1000; it /= 1000;
} }
break; break;
@ -694,6 +694,82 @@ void Detector::setDAC(int value, defs::dacIndex index, bool mV, Positions pos) {
pimpl->Parallel(&slsDetector::setDAC, pos, value, index, mV); pimpl->Parallel(&slsDetector::setDAC, pos, value, index, mV);
} }
Result<defs::externalCommunicationMode> Detector::getTimingMode(Positions pos) const {
return pimpl->Parallel(&slsDetector::setExternalCommunicationMode, pos, defs::GET_EXTERNAL_COMMUNICATION_MODE);
}
void Detector::setTimingMode(defs::externalCommunicationMode value, Positions pos) {
pimpl->Parallel(&slsDetector::setExternalCommunicationMode, pos, value);
}
Result<defs::externalSignalFlag> Detector::getExternalSignalFlags(Positions pos) const {
return pimpl->Parallel(&slsDetector::setExternalSignalFlags, pos, defs::GET_EXTERNAL_SIGNAL_FLAG);
}
void Detector::setExternalSignalFlags(defs::externalSignalFlag value, Positions pos) {
pimpl->Parallel(&slsDetector::setExternalSignalFlags, pos, value);
}
Result<bool> Detector::getParallelMode(Positions pos) const {
auto res = pimpl->Parallel(&slsDetector::setReadOutFlags, pos, defs::GET_READOUT_FLAGS);
Result <bool> booleanRes;
for (unsigned int i = 0; i < res.size(); ++i) {
booleanRes[i] = (res[i] & defs::PARALLEL) ? true : false;
}
return booleanRes;
}
void Detector::setParallelMode(bool value, Positions pos) {
pimpl->Parallel(&slsDetector::setReadOutFlags, pos, value ? defs::PARALLEL : defs::NONPARALLEL);
}
Result<bool> Detector::getOverFlowMode(Positions pos) const {
auto res = pimpl->Parallel(&slsDetector::setReadOutFlags, pos, defs::GET_READOUT_FLAGS);
Result <bool> booleanRes;
for (unsigned int i = 0; i < res.size(); ++i) {
booleanRes[i] = (res[i] & defs::SHOW_OVERFLOW) ? true : false;
}
return booleanRes;
}
void Detector::setOverFlowMode(bool value, Positions pos) {
pimpl->Parallel(&slsDetector::setReadOutFlags, pos, value ? defs::SHOW_OVERFLOW : defs::NOOVERFLOW);
}
Result<int> Detector::getSignalType(Positions pos) const {
auto res = pimpl->Parallel(&slsDetector::setReadOutFlags, pos, defs::GET_READOUT_FLAGS);
for (auto &it : res) {
if (it & defs::ANALOG_AND_DIGITAL) {
it = 2;
} else if (it & defs::DIGITAL_ONLY) {
it = 1;
} else if (it == defs::NORMAL_READOUT) {
it = 0;
} else {
throw RuntimeError("Unknown Signal Type");
}
}
return res;
}
void Detector::setSignalType(int value, Positions pos) {
defs::readOutFlags flag;
switch (value) {
case 0:
flag = defs::NORMAL_READOUT;
break;
case 1:
flag = defs::DIGITAL_ONLY;
break;
case 2:
flag = defs::ANALOG_AND_DIGITAL;
break;
default:
throw RuntimeError("Unknown Signal Type");
}
pimpl->Parallel(&slsDetector::setReadOutFlags, pos, flag);
}
// Erik // Erik
Result<int> Detector::getFramesCaughtByReceiver(Positions pos) const { Result<int> Detector::getFramesCaughtByReceiver(Positions pos) const {
return pimpl->Parallel(&slsDetector::getFramesCaughtByReceiver, pos); return pimpl->Parallel(&slsDetector::getFramesCaughtByReceiver, pos);
@ -912,7 +988,7 @@ Result<bool> Detector::getAutoCompDisable(Positions pos) const {
void Detector::setPowerChip(bool on, Positions pos) { void Detector::setPowerChip(bool on, Positions pos) {
if (on && pimpl->size() > 3) { if (on && pimpl->size() > 3) {
for (int i = 0; i != pimpl->size(); ++i) { for (unsigned int i = 0; i != pimpl->size(); ++i) {
pimpl->powerChip(static_cast<int>(on), i); pimpl->powerChip(static_cast<int>(on), i);
usleep(1000 * 1000); usleep(1000 * 1000);
} }

View File

@ -378,8 +378,7 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
++i; ++i;
/*! \page config /*! \page config
- <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, - <b>extsig [flag]</b> sets/gets the mode of the external signal. Options: \c trigger_in_rising_edge, \c trigger_in_falling_edge. Used in GOTTHARDonly. \c Returns \c (string)
\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_pFuncName = "extsig"; /* find command! */
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdAdvanced; descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdAdvanced;
@ -4815,7 +4814,7 @@ std::string slsDetectorCommand::helpAdvanced(int action) {
std::ostringstream os; std::ostringstream os;
if (action == PUT_ACTION || action == HELP_ACTION) { 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 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 << "extsig mode \t sets the mode of the external signal. can be trigger_out_rising_edge, trigger_out_falling_edge. Gotthard only" << 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 << "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 << "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; 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;
@ -4831,7 +4830,7 @@ std::string slsDetectorCommand::helpAdvanced(int action) {
} }
if (action == GET_ACTION || action == HELP_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 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 << "extsig \t gets the mode of the external signal. can be trigger_in_rising_edge, trigger_in_falling_edge. Gotthard only" << 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 << "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 << "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; os << "readnlines \t gets the number of rows to read out per half module. Used for EIGER only. " << std::endl;

View File

@ -673,108 +673,31 @@ format
}; };
/** returns std::string from external signal type index /** returns std::string from external signal type index
\param f can be SIGNAL_OFF, GATE_IN_ACTIVE_HIGH, GATE_IN_ACTIVE_LOW, \param f can be TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE,
TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE, \returns std::string trigger_in_rising_edge, trigger_in_falling_edge, unknown
RO_TRIGGER_IN_RISING_EDGE, RO_TRIGGER_IN_FALLING_EDGE,
GATE_OUT_ACTIVE_HIGH, GATE_OUT_ACTIVE_LOW, =TRIGGER_OUT_RISING_EDGE,
TRIGGER_OUT_FALLING_EDGE, RO_TRIGGER_OUT_RISING_EDGE,
RO_TRIGGER_OUT_FALLING_EDGE, OUTPUT_LOW, OUTPUT_HIGH,
MASTER_SLAVE_SYNCHRONIZATION, GET_EXTERNAL_SIGNAL_FLAG \returns
std::string off, gate_in_active_high, gate_in_active_low,
trigger_in_rising_edge, trigger_in_falling_edge,
ro_trigger_in_rising_edge, ro_trigger_in_falling_edge,
gate_out_active_high, gate_out_active_low, trigger_out_rising_edge,
trigger_out_falling_edge, ro_trigger_out_rising_edge,
ro_trigger_out_falling_edge, gnd, vcc, sync, unknown
*/ */
static std::string externalSignalType(externalSignalFlag f) { static std::string externalSignalType(externalSignalFlag f) {
switch (f) { switch (f) {
case SIGNAL_OFF:
return std::string("off");
case GATE_IN_ACTIVE_HIGH:
return std::string("gate_in_active_high");
case GATE_IN_ACTIVE_LOW:
return std::string("gate_in_active_low");
case TRIGGER_IN_RISING_EDGE: case TRIGGER_IN_RISING_EDGE:
return std::string("trigger_in_rising_edge"); return std::string("trigger_in_rising_edge");
case TRIGGER_IN_FALLING_EDGE: case TRIGGER_IN_FALLING_EDGE:
return std::string("trigger_in_falling_edge"); return std::string("trigger_in_falling_edge");
case RO_TRIGGER_IN_RISING_EDGE:
return std::string("ro_trigger_in_rising_edge");
case RO_TRIGGER_IN_FALLING_EDGE:
return std::string("ro_trigger_in_falling_edge");
case GATE_OUT_ACTIVE_HIGH:
return std::string("gate_out_active_high");
case GATE_OUT_ACTIVE_LOW:
return std::string("gate_out_active_low");
case TRIGGER_OUT_RISING_EDGE:
return std::string("trigger_out_rising_edge");
case TRIGGER_OUT_FALLING_EDGE:
return std::string("trigger_out_falling_edge");
case RO_TRIGGER_OUT_RISING_EDGE:
return std::string("ro_trigger_out_rising_edge");
case RO_TRIGGER_OUT_FALLING_EDGE:
return std::string("ro_trigger_out_falling_edge");
case MASTER_SLAVE_SYNCHRONIZATION:
return std::string("sync");
case OUTPUT_LOW:
return std::string("gnd");
case OUTPUT_HIGH:
return std::string("vcc");
default: default:
return std::string("unknown"); return std::string("unknown");
} }
}; };
/** returns external signal type index from std::string /** returns external signal type index from std::string
\param sval off, gate_in_active_high, gate_in_active_low, \param sval trigger_in_rising_edge, trigger_in_falling_edge, unknown
trigger_in_rising_edge, trigger_in_falling_edge, \returns can be TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE,
ro_trigger_in_rising_edge, ro_trigger_in_falling_edge, GET_EXTERNAL_SIGNAL_FLAG (if unknown)
gate_out_active_high, gate_out_active_low, trigger_out_rising_edge,
trigger_out_falling_edge, ro_trigger_out_rising_edge,
ro_trigger_out_falling_edge, gnd, vcc, sync, unknown \returns can be
SIGNAL_OFF, GATE_IN_ACTIVE_HIGH, GATE_IN_ACTIVE_LOW,
TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE,
RO_TRIGGER_IN_RISING_EDGE, RO_TRIGGER_IN_FALLING_EDGE,
GATE_OUT_ACTIVE_HIGH, GATE_OUT_ACTIVE_LOW, TRIGGER_OUT_RISING_EDGE,
TRIGGER_OUT_FALLING_EDGE, RO_TRIGGER_OUT_RISING_EDGE,
RO_TRIGGER_OUT_FALLING_EDGE, OUTPUT_LOW, OUTPUT_HIGH,
MASTER_SLAVE_SYNCHRONIZATION, GET_EXTERNAL_SIGNAL_FLAG (if unknown)
*/ */
static externalSignalFlag externalSignalType(std::string sval) { static externalSignalFlag externalSignalType(std::string sval) {
if (sval == "off")
return SIGNAL_OFF;
if (sval == "gate_in_active_high")
return GATE_IN_ACTIVE_HIGH;
if (sval == "gate_in_active_low")
return GATE_IN_ACTIVE_LOW;
if (sval == "trigger_in_rising_edge") if (sval == "trigger_in_rising_edge")
return TRIGGER_IN_RISING_EDGE; return TRIGGER_IN_RISING_EDGE;
if (sval == "trigger_in_falling_edge") if (sval == "trigger_in_falling_edge")
return TRIGGER_IN_FALLING_EDGE; return TRIGGER_IN_FALLING_EDGE;
if (sval == "ro_trigger_in_rising_edge")
return RO_TRIGGER_IN_RISING_EDGE;
if (sval == "ro_trigger_in_falling_edge")
return RO_TRIGGER_IN_FALLING_EDGE;
if (sval == "gate_out_active_high")
return GATE_OUT_ACTIVE_HIGH;
if (sval == "gate_out_active_low")
return GATE_OUT_ACTIVE_LOW;
if (sval == "trigger_out_rising_edge")
return TRIGGER_OUT_RISING_EDGE;
if (sval == "trigger_out_falling_edge")
return TRIGGER_OUT_FALLING_EDGE;
if (sval == "ro_trigger_out_rising_edge")
return RO_TRIGGER_OUT_RISING_EDGE;
if (sval == "ro_trigger_out_falling_edge")
return RO_TRIGGER_OUT_FALLING_EDGE;
if (sval == "sync")
return MASTER_SLAVE_SYNCHRONIZATION;
if (sval == "gnd")
return OUTPUT_LOW;
if (sval == "vcc")
return OUTPUT_HIGH;
return GET_EXTERNAL_SIGNAL_FLAG; return GET_EXTERNAL_SIGNAL_FLAG;
}; };