This commit is contained in:
maliakal_d 2019-08-16 09:45:49 +02:00
parent e635ff035c
commit 947252c852
11 changed files with 934 additions and 1201 deletions

View File

@ -80,8 +80,9 @@ void qDrawPlot::SetupPlots() {
setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
// default image size
nPixelsX = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::X);
nPixelsY = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::Y);
slsDetectorDefs::xy res = myDet->getNumberOfChannels();
nPixelsX = res.x;
nPixelsY = res.y;
switch(detType) {
case slsDetectorDefs::MOENCH:
npixelsy_jctb = (myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES, -1) * 2)/25;// for moench 03

View File

@ -2181,11 +2181,6 @@ int send_update(int file_des) {
n = sendData(file_des,&i32,sizeof(i32),INT32);
if (n < 0) return printSocketReadError();
// databytes
i32 = calculateDataBytes();
n = sendData(file_des,&i32,sizeof(i32),INT32);
if (n < 0) return printSocketReadError();
// settings
#if defined(EIGERD) || defined(JUNGFRAUD) || defined(GOTTHARDD)
i32 = (int)getSettings();

File diff suppressed because it is too large Load Diff

View File

@ -57,17 +57,10 @@ struct sharedMultiSlsDetector {
int numberOfDetector[2];
/** total number of channels for all detectors */
int numberOfChannels;
int numberOfChannels[2];
/** total number of channels for all detectors in one dimension*/
int numberOfChannel[2];
/** total number of channels including gap pixels in one dimension */
int numberOfChannelInclGapPixels[2];
/** max number of channels allowed for the complete set of detectors in
* one dimension */
int maxNumberOfChannelsPerDetector[2];
/** max number of channels for complete detector*/
int maxNumberOfChannels[2];
/** flag for acquiring */
bool acquiringFlag;
@ -367,91 +360,32 @@ class multiSlsDetector : public virtual slsDetectorDefs {
*/
size_t size() const;//
/**
* Returns number of detectors in dimension d
* @param d dimension d
* @returns number of detectors in dimension d
*/
int getNumberOfDetectors(dimension d) const;//
/**
* Returns the number of detectors in each direction
@param nx number of detectors in x direction
@param ny number of detectors in y direction
*/
void getNumberOfDetectors(int &nx, int &ny) const;//
slsDetectorDefs::xy getNumberOfDetectors() const;//
/**
* Returns the total number of channels of all sls detectors from shared
* memory
* @param detPos -1 for all detectors in list or specific detector position
* @returns the total number of channels of all sls detectors
*/
int getTotalNumberOfChannels(int detPos = -1);//
/**
* Returns the total number of channels of all sls detectors in dimension d
* from shared memory
* Returns the total number of channels of all sls detectors including gap pixels
* @param d dimension d
* @param detPos -1 for all detectors in list or specific detector position
* @returns the total number of channels of all sls detectors in dimension d
* @returns the total number of channels of all sls detectors including gap pixels
*/
int getTotalNumberOfChannels(dimension d, int detPos = -1);//
slsDetectorDefs::xy getNumberOfChannels(int detPos = -1);//
/**
* Returns the total number of channels from shared memory in each dimension
* @returns the total number of channels in each dimension
*/
slsDetectorDefs::coordinates getNumberOfChannels() const; //
/**
* Returns the total number of channels of all sls detectors in dimension d
* including gap pixels from shared memory
* @param d dimension d
* @param detPos -1 for all detectors in list or specific detector position
* @returns the total number of channels of all sls detectors in dimension d
* including gap pixels
*/
int getTotalNumberOfChannelsInclGapPixels(dimension d, int detPos = -1);//
/**
* Returns the total number of channels including gap pixels
* @returns the total number of channels including gap pixels
*/
slsDetectorDefs::coordinates getTotalNumberOfChannelsInclGapPixels() const; //
/**
* Returns the maximum number of channels of all sls detectors in each
* dimension d from shared memory.
* @param d dimension d
* @returns the maximum number of channels of all sls detectors in dimension
* d
*/
int getMaxNumberOfChannelsPerDetector(dimension d);//
/**
* Sets the maximum number of channels of all sls detectors in each
* dimension d from shared memory
* @param d dimension d
* @param i maximum number of channels for multi structure in dimension d
* @returns the maximum number of channels of all sls detectors in dimension
* d
*/
int setMaxNumberOfChannelsPerDetector(dimension d, int i);//
/**
* Returns maximum number of channels of all sls detectors in each
* dimension d from shared memory
* @returns maximum number of channels of all sls detectors
*/
slsDetectorDefs::coordinates getMaxNumberOfChannels() const; //
slsDetectorDefs::xy getMaxNumberOfChannels() const; //
/**
* Sets maximum number of channels of all sls detectors in each
* dimension d from shared memory
* @param c maximum number of channels of all sls detectors
*/
void setMaxNumberOfChannels(const slsDetectorDefs::coordinates c); //
void setMaxNumberOfChannels(const slsDetectorDefs::xy c); //
/**
* Get Quad Type (Only for Eiger Quad detector hardware)
@ -935,6 +869,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
std::string getDetectorMAC2(int detPos = -1); //
/**
* //TODO: custom ip (eiger 10G and other detectors), use 0.0.0.0 and test
* Validates the format of the detector IP address and sets it
* @param detectorIP detector IP address
* @param detPos -1 for all detectors in list or specific detector position
@ -985,6 +920,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
std::string getReceiverHostname(int detPos = -1) const; //
/**
* TODO: replace this with setEthernetInterface
* Validates the format of the receiver UDP IP address and sets it
* @param udpip receiver UDP IP address
* @param detPos -1 for all detectors in list or specific detector position

View File

@ -13,7 +13,7 @@
class ServerInterface;
#define SLS_SHMAPIVERSION 0x190726
#define SLS_SHMVERSION 0x190813
#define SLS_SHMVERSION 0x190815
/**
* @short structure allocated in shared memory to store detector settings for
@ -68,9 +68,6 @@ struct sharedSlsDetector {
/** dynamic range of the detector data */
int dynamicRange;
/** size of the data that are transfered from the detector */
int dataBytes;
/** roi */
slsDetectorDefs::ROI roi;
@ -171,9 +168,6 @@ struct sharedSlsDetector {
/** gap pixels in each direction */
int nGappixels[2];
/** data bytes including gap pixels */
int dataBytesInclGapPixels;
/** additional json header */
char rxAdditionalJsonHeader[MAX_STR_LENGTH];
@ -324,73 +318,17 @@ class slsDetector : public virtual slsDetectorDefs {
*/
int setDetectorType(detectorType type = GET_DETECTOR_TYPE);
/**
* Returns the total number of channels from shared memory
* @returns the total number of channels
*/
int getTotalNumberOfChannels() const;
/**
* Update total number of channels (chiptestboard or moench)
* depending on the number of samples, adenablemask, readout flags(ctb)
*/
void updateTotalNumberOfChannels();
/**
* Returns the total number of channels in dimension d from shared memory
* @param d dimension d
* @returns the total number of channels in dimension d
*/
int getTotalNumberOfChannels(dimension d) const;
/**
* Returns the total number of channels from shared memory in each dimension
* @returns the total number of channels in each dimension
*/
slsDetectorDefs::coordinates getNumberOfChannels() const;
/**
* Returns the total number of channels of in dimension d including gap
* pixels from shared memory
* @param d dimension d
* @returns the total number of channels including gap pixels in dimension d
* including gap pixels
*/
int getTotalNumberOfChannelsInclGapPixels(dimension d) const;
void updateNumberOfChannels();
/**
* Returns the total number of channels including gap pixels
* @returns the total number of channels including gap pixels
*/
slsDetectorDefs::coordinates getNumberOfChannelsInclGapPixels() const;
/**
* returns the number of channels per chip from shared memory (Mythen)
* @returns number of channels per chip
*/
int getNChans() const;
/**
* returns the number of channels per chip in dimension d from shared memory
* (Mythen)
* @param d dimension d
* @returns number of channels per chip in dimension d
*/
int getNChans(dimension d) const;
/**
* returns the number of chips per module from shared memory (Mythen)
* @returns number of chips per module
*/
int getNChips() const;
/**
* returns the number of chips per module in dimension d from shared memory
* (Mythen)
* @param d dimension d
* @returns number of chips per module in dimension d
*/
int getNChips(dimension d) const;
slsDetectorDefs::xy getNumberOfChannels() const;
/**
* Get Quad Type (Only for Eiger Quad detector hardware)
@ -654,7 +592,7 @@ class slsDetector : public virtual slsDetectorDefs {
int setSpeed(speedVariable sp, int value = -1, int mode = 0);
/**
* Set/get dynamic range and updates the number of dataBytes
* Set/get dynamic range
* (Eiger: If i is 32, also sets clkdivider to 2, if 16, sets clkdivider to
* 1)
* @param i dynamic range (-1 get)
@ -665,18 +603,6 @@ class slsDetector : public virtual slsDetectorDefs {
int getDynamicRangeFromShm();
/**
* Recalculated number of data bytes
* @returns tota number of data bytes
*/
int getDataBytes();
/**
* Recalculated number of data bytes including gap pixels
* @returns tota number of data bytes including gap pixels
*/
int getDataBytesInclGapPixels();
/**
* Set/get dacs value
* @param val value (in V)

View File

@ -8,14 +8,14 @@ namespace sls {
using defs = slsDetectorDefs;
Detector::Detector(int multi_id)
: pimpl(sls::make_unique<multiSlsDetector>(multi_id)) {}
Detector::Detector(int shm_id)
: pimpl(sls::make_unique<multiSlsDetector>(shm_id)) {}
Detector::~Detector() = default;
// Configuration
void Detector::freeSharedMemory() { pimpl->freeSharedMemory(); }
void Detector::setConfig(const std::string &fname) {
void Detector::loadConfig(const std::string &fname) {
pimpl->readConfigurationFile(fname);
}
@ -27,17 +27,9 @@ void Detector::setHostname(const std::vector<std::string> &value) {
pimpl->setHostname(value);
}
int Detector::getMultiId() const { return pimpl->getMultiId(); }
int Detector::getShmId() const { return pimpl->getMultiId(); }
void Detector::checkDetectorVersionCompatibility(Positions pos) const {
pimpl->Parallel(&slsDetector::checkDetectorVersionCompatibility, pos);
}
void Detector::checkReceiverVersionCompatibility(Positions pos) const {
pimpl->Parallel(&slsDetector::checkReceiverVersionCompatibility, pos);
}
Result<int64_t> Detector::getDetectorFirmwareVersion(Positions pos) const {
Result<int64_t> Detector::getFirmwareVersion(Positions pos) const {
return pimpl->Parallel(&slsDetector::getId, pos,
defs::DETECTOR_FIRMWARE_VERSION);
}
@ -47,40 +39,33 @@ Result<int64_t> Detector::getDetectorServerVersion(Positions pos) const {
defs::DETECTOR_SOFTWARE_VERSION);
}
Result<int64_t> Detector::getDetectorSerialNumber(Positions pos) const {
Result<int64_t> Detector::getSerialNumber(Positions pos) const {
return pimpl->Parallel(&slsDetector::getId, pos,
defs::DETECTOR_SERIAL_NUMBER);
}
int64_t Detector::getClientSoftwareVersion() const {
int64_t Detector::getClientVersion() const {
return pimpl->getClientSoftwareVersion();
}
Result<int64_t> Detector::getReceiverSoftwareVersion(Positions pos) const {
Result<int64_t> Detector::getReceiverVersion(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReceiverSoftwareVersion, pos);
}
std::string Detector::getUserDetailsFromSharedMemory() const { return pimpl->getUserDetails(); }
std::string Detector::getUserDetails() const { return pimpl->getUserDetails(); }
Result<defs::detectorType>
Detector::getDetectorType(Positions pos) const {
return pimpl->Parallel(&slsDetector::getDetectorTypeAsEnum, pos);
}
Result<std::string> Detector::getDetectorTypeAsString(Positions pos) const {
return pimpl->Parallel(&slsDetector::getDetectorTypeAsString, pos);
}
int Detector::size() const { return pimpl->size(); }
defs::coordinates Detector::getNumberOfDetectors() const {
defs::coordinates coord;
coord.x = pimpl->getNumberOfDetectors(defs::X);
coord.y = pimpl->getNumberOfDetectors(defs::Y);
return coord;
defs::xy Detector::getModuleGeometry() const {
return pimpl->getNumberOfDetectors();
}
Result<defs::coordinates> Detector::getNumberOfChannels(Positions pos) const {
Result<defs::xy> Detector::getModuleSize(Positions pos) const {
if (pos.empty() ||
(pos.size() == 1 &&
pos[0] == -1)) { // TODO: also check condition that pos.size ==
@ -90,19 +75,11 @@ Result<defs::coordinates> Detector::getNumberOfChannels(Positions pos) const {
return pimpl->Parallel(&slsDetector::getNumberOfChannels, pos);
}
Result<defs::coordinates>
Detector::getNumberOfChannelsInclGapPixels(Positions pos) const {
if (pos.empty() || (pos.size() == 1 && pos[0] == -1)) {
return {pimpl->getTotalNumberOfChannelsInclGapPixels()};
}
return pimpl->Parallel(&slsDetector::getNumberOfChannelsInclGapPixels, pos);
}
defs::coordinates Detector::getMaxNumberOfChannels() const {
defs::xy Detector::getDetectorSize() const {
return pimpl->getMaxNumberOfChannels();
}
void Detector::setMaxNumberOfChannels(const defs::coordinates value) {
void Detector::setDetectorSize(const defs::xy value) {
pimpl->setMaxNumberOfChannels(value);
}
@ -110,16 +87,16 @@ Result<bool> Detector::getQuad(Positions pos) const {
return pimpl->Parallel(&slsDetector::getQuad, pos);
}
void Detector::setQuad(const bool value, Positions pos) {
pimpl->setQuad(value, 0);
void Detector::setQuad(const bool value) {
pimpl->setQuad(value);
}
Result<int> Detector::getReadNLines(Positions pos) const {
Result<int> Detector::getPartialReadout(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReadNLines, pos);
}
void Detector::setReadNLines(const int value, Positions pos) {
pimpl->Parallel(&slsDetector::setReadNLines, pos, value);
void Detector::setPartialReadout(const int lines, Positions pos) {
pimpl->Parallel(&slsDetector::setReadNLines, pos, lines);
}
Result<int> Detector::getControlPort(Positions pos) const {
@ -138,30 +115,22 @@ void Detector::setStopPort(int value, Positions pos) {
pimpl->Parallel(&slsDetector::setStopPort, pos, value);
}
Result<bool> Detector::getLockServer(Positions pos) const {
Result<bool> Detector::getDetectorLock(Positions pos) const {
return pimpl->Parallel(&slsDetector::lockServer, pos, -1);
}
void Detector::setLockServer(bool value, Positions pos) {
pimpl->Parallel(&slsDetector::lockServer, pos, static_cast<int>(value));
void Detector::setDetectorLock(bool lock, Positions pos) {
pimpl->Parallel(&slsDetector::lockServer, pos, static_cast<int>(lock));
}
Result<std::string> Detector::getLastClientIP(Positions pos) const {
return pimpl->Parallel(&slsDetector::getLastClientIP, pos);
}
void Detector::exitServer(Positions pos) {
pimpl->Parallel(&slsDetector::exitServer, pos);
}
void Detector::execCommand(const std::string &value, Positions pos) {
pimpl->Parallel(&slsDetector::execCommand, pos, value);
}
void Detector::writeConfigurationFile(const std::string &value) {
pimpl->writeConfigurationFile(value);
}
Result<defs::detectorSettings> Detector::getSettings(Positions pos) const {
return pimpl->Parallel(&slsDetector::getSettings, pos);
}
@ -174,9 +143,9 @@ Result<int> Detector::getThresholdEnergy(Positions pos) const {
return pimpl->Parallel(&slsDetector::getThresholdEnergy, pos);
}
void Detector::setThresholdEnergy(int value, defs::detectorSettings sett,
int tb, Positions pos) {
pimpl->Parallel(&slsDetector::setThresholdEnergy, pos, value, sett, tb);
void Detector::setThresholdEnergy(int threshold_ev, defs::detectorSettings settings,
bool trimbits, Positions pos) {
pimpl->Parallel(&slsDetector::setThresholdEnergy, pos, threshold_ev, settings, static_cast<int>(trimbits));
}
Result<std::string> Detector::getSettingsDir(Positions pos) const {
@ -187,14 +156,10 @@ void Detector::setSettingsDir(const std::string &value, Positions pos) {
pimpl->Parallel(&slsDetector::setSettingsDir, pos, value);
}
void Detector::loadSettingsFile(const std::string &value, Positions pos) {
void Detector::loadTrimbits(const std::string &value, Positions pos) {
pimpl->Parallel(&slsDetector::loadSettingsFile, pos, value);
}
void Detector::saveSettingsFile(const std::string &value, Positions pos) {
pimpl->Parallel(&slsDetector::saveSettingsFile, pos, value);
}
void Detector::configureMAC(Positions pos) {
pimpl->Parallel(&slsDetector::configureMAC, pos);
}
@ -207,11 +172,11 @@ void Detector::setNumberOfFrames(int64_t value) {
pimpl->Parallel(&slsDetector::setTimer, {}, defs::FRAME_NUMBER, value);
}
Result<int64_t> Detector::getNumberOfCycles() const {
Result<int64_t> Detector::getNumberOfTriggers() const {
return pimpl->Parallel(&slsDetector::setTimer, {}, defs::CYCLES_NUMBER, -1);
}
void Detector::setNumberOfCycles(int64_t value) {
void Detector::setNumberOfTriggers(int64_t value) {
pimpl->Parallel(&slsDetector::setTimer, {}, defs::CYCLES_NUMBER, value);
}
@ -220,7 +185,7 @@ Result<int64_t> Detector::getNumberOfAdditionalStorageCells() const {
defs::STORAGE_CELL_NUMBER, -1);
}
void Detector::setNumberOfStorageCells(int64_t value) {
void Detector::setNumberOfAdditionalStorageCells(int64_t value) {
pimpl->Parallel(&slsDetector::setTimer, {}, defs::STORAGE_CELL_NUMBER,
value);
}
@ -695,10 +660,10 @@ void Detector::clearBit(uint32_t addr, int bitnr, Positions pos) {
pimpl->Parallel(&slsDetector::clearBit, pos, addr, bitnr);
}
Result<MacAddr> Detector::getDetectorMAC(Positions pos) const {
Result<MacAddr> Detector::getSourceUDPMAC(Positions pos) const {
return pimpl->Parallel(&slsDetector::getDetectorMAC, pos);
}
void Detector::setDetectorMAC(const std::string &detectorMAC, Positions pos) {
void Detector::setSourceUDPMAC(const std::string &detectorMAC, Positions pos) {
pimpl->Parallel(&slsDetector::setDetectorMAC, pos, detectorMAC);
}
@ -709,11 +674,11 @@ void Detector::setDetectorMAC2(const std::string &detectorMAC, Positions pos) {
pimpl->Parallel(&slsDetector::setDetectorMAC2, pos, detectorMAC);
}
Result<IpAddr> Detector::getDetectorIP(Positions pos) const {
Result<IpAddr> Detector::getSourceUDPIP(Positions pos) const {
return pimpl->Parallel(&slsDetector::getDetectorIP, pos);
}
void Detector::setDetectorIP(const std::string &detectorIP, Positions pos) {
void Detector::setSourceUDPIP(const std::string &detectorIP, Positions pos) {
pimpl->Parallel(&slsDetector::setDetectorIP, pos, detectorIP);
}
@ -733,11 +698,11 @@ void Detector::setReceiverHostname(const std::string &receiver, Positions pos) {
pimpl->Parallel(&slsDetector::setReceiverHostname, pos, receiver);
}
Result<IpAddr> Detector::getReceiverUDPIP(Positions pos) const {
Result<IpAddr> Detector::getDestinationUDPIP(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReceiverUDPIP, pos);
}
void Detector::setReceiverUDPIP(const std::string &udpip, Positions pos) {
void Detector::setDestinationUDPIP(const std::string &udpip, Positions pos) {
pimpl->Parallel(&slsDetector::setReceiverUDPIP, pos, udpip);
}
@ -749,11 +714,11 @@ void Detector::setReceiverUDPIP2(const std::string &udpip, Positions pos) {
pimpl->Parallel(&slsDetector::setReceiverUDPIP2, pos, udpip);
}
Result<MacAddr> Detector::getReceiverUDPMAC(Positions pos) const {
Result<MacAddr> Detector::getDestinationUDPMAC(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReceiverUDPMAC, pos);
}
void Detector::setReceiverUDPMAC(const std::string &udpmac, Positions pos) {
void Detector::setDestinationUDPMAC(const std::string &udpmac, Positions pos) {
pimpl->Parallel(&slsDetector::setReceiverUDPMAC, pos, udpmac);
}
@ -1379,14 +1344,6 @@ Result<std::string> Detector::getReceiverLastClientIP(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReceiverLastClientIP, pos);
}
void Detector::exitReceiver(Positions pos) {
pimpl->Parallel(&slsDetector::exitReceiver, pos);
}
void Detector::execReceiverCommand(const std::string &cmd, Positions pos) {
pimpl->Parallel(&slsDetector::execReceiverCommand, pos, cmd);
}
Result<int> Detector::getReceiverStreamingFrequency(Positions pos) const {
return pimpl->Parallel(&slsDetector::setReceiverStreamingTimer, pos, -1);
}
@ -1484,36 +1441,33 @@ Detector::getReceiverRealUDPSocketBufferSize(Positions pos) const {
// Acquisition
void Detector::acquire() { pimpl->acquire(); }
bool Detector::getAcquiringFlag() const { return pimpl->getAcquiringFlag(); }
void Detector::clearAcquiringFlag() { pimpl->setAcquiringFlag(0); }
void Detector::setAcquiringFlag(bool value) { pimpl->setAcquiringFlag(value); }
Result<defs::runStatus> Detector::getRunStatus(Positions pos) {
Result<defs::runStatus> Detector::getDetectorStatus(Positions pos) const{
return pimpl->Parallel(&slsDetector::getRunStatus, pos);
}
void Detector::startAcquisition() {
pimpl->startAcquisition();
if (getUseReceiverFlag({}).squash())
pimpl->Parallel(&slsDetector::startReceiver, {});
pimpl->Parallel(&slsDetector::startAcquisition, {});
}
void Detector::stopAcquisition() { pimpl->stopAcquisition(); }
void Detector::stopAcquisition() {
pimpl->Parallel(&slsDetector::stopAcquisition, {});
if (getUseReceiverFlag({}).squash()) //TODO: problem for acquire()
pimpl->Parallel(&slsDetector::stopReceiver, {});
}
void Detector::sendSoftwareTrigger(Positions pos) {
pimpl->Parallel(&slsDetector::sendSoftwareTrigger, pos);
}
void Detector::startReceiver(Positions pos) {
pimpl->Parallel(&slsDetector::startReceiver, pos);
}
void Detector::stopReceiver(Positions pos) {
pimpl->Parallel(&slsDetector::stopReceiver, pos);
}
Result<defs::runStatus> Detector::getReceiverStatus(Positions pos) {
Result<defs::runStatus> Detector::getReceiverStatus(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReceiverStatus, pos);
}
Result<int> Detector::getFramesCaughtByReceiver(Positions pos) const {
Result<int> Detector::getFramesCaught(Positions pos) const {
return pimpl->Parallel(&slsDetector::getFramesCaughtByReceiver, pos);
}
@ -1521,10 +1475,6 @@ Result<uint64_t> Detector::getReceiverCurrentFrameIndex(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReceiverCurrentFrameIndex, pos);
}
void Detector::resetFramesCaught(Positions pos) {
pimpl->Parallel(&slsDetector::resetFramesCaught, pos);
}
// pattern
void Detector::setPattern(const std::string &fname, Positions pos) {

View File

@ -278,13 +278,10 @@ void multiSlsDetector::initializeDetectorStructure() {
multi_shm()->multiDetectorType = GENERIC;
multi_shm()->numberOfDetector[X] = 0;
multi_shm()->numberOfDetector[Y] = 0;
multi_shm()->numberOfChannels = 0;
multi_shm()->numberOfChannel[X] = 0;
multi_shm()->numberOfChannel[Y] = 0;
multi_shm()->numberOfChannelInclGapPixels[X] = 0;
multi_shm()->numberOfChannelInclGapPixels[Y] = 0;
multi_shm()->maxNumberOfChannelsPerDetector[X] = -1;
multi_shm()->maxNumberOfChannelsPerDetector[Y] = -1;
multi_shm()->numberOfChannels[X] = 0;
multi_shm()->numberOfChannels[Y] = 0;
multi_shm()->maxNumberOfChannels[X] = 0;
multi_shm()->maxNumberOfChannels[Y] = 0;
multi_shm()->acquiringFlag = false;
multi_shm()->receiver_upstream = false;
}
@ -425,7 +422,6 @@ void multiSlsDetector::addSlsDetector(const std::string &hostname) {
detectors.push_back(
sls::make_unique<slsDetector>(type, multiId, pos, false));
multi_shm()->numberOfDetectors = detectors.size();
multi_shm()->numberOfChannels += detectors[pos]->getTotalNumberOfChannels();
detectors[pos]->setHostname(hostname);
multi_shm()->multiDetectorType = getDetectorTypeAsEnum(-1);// -1 needed here
}
@ -433,17 +429,12 @@ void multiSlsDetector::addSlsDetector(const std::string &hostname) {
void multiSlsDetector::updateDetectorSize() {
FILE_LOG(logDEBUG) << "Updating Multi-Detector Size: " << size();
int my = detectors[0]->getTotalNumberOfChannels(Y);
int mx = detectors[0]->getTotalNumberOfChannels(X);
int mgy = detectors[0]->getTotalNumberOfChannelsInclGapPixels(Y);
int mgx = detectors[0]->getTotalNumberOfChannelsInclGapPixels(X);
if (mgy == 0) {
mgy = my;
mgx = mx;
}
slsDetectorDefs::xy res = detectors[0]->getNumberOfChannels();
int my = res.x;
int mx = res.y;
int maxy = multi_shm()->maxNumberOfChannelsPerDetector[Y];
if (maxy == -1) {
int maxy = multi_shm()->maxNumberOfChannels[Y];
if (maxy == 0) {
maxy = my * size();
}
@ -455,10 +446,8 @@ void multiSlsDetector::updateDetectorSize() {
multi_shm()->numberOfDetector[X] = ndetx;
multi_shm()->numberOfDetector[Y] = ndety;
multi_shm()->numberOfChannel[X] = mx * ndetx;
multi_shm()->numberOfChannel[Y] = my * ndety;
multi_shm()->numberOfChannelInclGapPixels[X] = mgx * ndetx;
multi_shm()->numberOfChannelInclGapPixels[Y] = mgy * ndety;
multi_shm()->numberOfChannels[X] = mx * ndetx;
multi_shm()->numberOfChannels[Y] = my * ndety;
FILE_LOG(logDEBUG)
<< "\n\tNumber of Detectors in X direction:"
@ -466,22 +455,19 @@ void multiSlsDetector::updateDetectorSize() {
<< "\n\tNumber of Detectors in Y direction:"
<< multi_shm()->numberOfDetector[Y]
<< "\n\tNumber of Channels in X direction:"
<< multi_shm()->numberOfChannel[X]
<< multi_shm()->numberOfChannels[X]
<< "\n\tNumber of Channels in Y direction:"
<< multi_shm()->numberOfChannel[Y]
<< "\n\tNumber of Channels in X direction with Gap Pixels:"
<< multi_shm()->numberOfChannelInclGapPixels[X]
<< "\n\tNumber of Channels in Y direction with Gap Pixels:"
<< multi_shm()->numberOfChannelInclGapPixels[Y];
<< multi_shm()->numberOfChannels[Y];
multi_shm()->numberOfChannels =
multi_shm()->numberOfChannel[0] * multi_shm()->numberOfChannel[1];
for (auto &d : detectors) {
d->updateMultiSize(multi_shm()->numberOfDetector[0],
multi_shm()->numberOfDetector[1]);
}
}
multi_shm()->maxNumberOfChannels[X] = multi_shm()->numberOfChannels[X];
multi_shm()->maxNumberOfChannels[Y] = multi_shm()->numberOfChannels[Y];
}
slsDetectorDefs::detectorType multiSlsDetector::getDetectorTypeAsEnum() const {
return multi_shm()->multiDetectorType;
@ -512,86 +498,43 @@ std::string multiSlsDetector::getDetectorTypeAsString(int detPos) {
size_t multiSlsDetector::size() const { return detectors.size(); }
int multiSlsDetector::getNumberOfDetectors(dimension d) const {
return multi_shm()->numberOfDetector[d];
slsDetectorDefs::xy multiSlsDetector::getNumberOfDetectors() const {
slsDetectorDefs::xy res;
res.x = multi_shm()->numberOfDetector[X];
res.y = multi_shm()->numberOfDetector[Y];
return res;
}
void multiSlsDetector::getNumberOfDetectors(int &nx, int &ny) const {
nx = multi_shm()->numberOfDetector[X];
ny = multi_shm()->numberOfDetector[Y];
}
int multiSlsDetector::getTotalNumberOfChannels(int detPos) {
slsDetectorDefs::xy multiSlsDetector::getNumberOfChannels(int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->getTotalNumberOfChannels();
return detectors[detPos]->getNumberOfChannels();
}
// multi
return multi_shm()->numberOfChannels;
}
int multiSlsDetector::getTotalNumberOfChannels(dimension d, int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->getTotalNumberOfChannels(d);
}
// multi
return multi_shm()->numberOfChannel[d];
}
slsDetectorDefs::coordinates multiSlsDetector::getNumberOfChannels() const {
slsDetectorDefs::coordinates coord;
coord.x = multi_shm()->numberOfChannel[X];
coord.y = multi_shm()->numberOfChannel[Y];
slsDetectorDefs::xy coord;
coord.x = multi_shm()->numberOfChannels[X];
coord.y = multi_shm()->numberOfChannels[Y];
return coord;
}
int multiSlsDetector::getTotalNumberOfChannelsInclGapPixels(dimension d,
int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->getTotalNumberOfChannelsInclGapPixels(d);
}
// multi
return multi_shm()->numberOfChannelInclGapPixels[d];
}
slsDetectorDefs::coordinates multiSlsDetector::getTotalNumberOfChannelsInclGapPixels() const {
slsDetectorDefs::coordinates coord;
coord.x = multi_shm()->numberOfChannelInclGapPixels[X];
coord.y = multi_shm()->numberOfChannelInclGapPixels[Y];
slsDetectorDefs::xy multiSlsDetector::getMaxNumberOfChannels() const {
slsDetectorDefs::xy coord;
coord.x = multi_shm()->maxNumberOfChannels[X];
coord.y = multi_shm()->maxNumberOfChannels[Y];
return coord;
}
int multiSlsDetector::getMaxNumberOfChannelsPerDetector(dimension d) {
return multi_shm()->maxNumberOfChannelsPerDetector[d];
}
int multiSlsDetector::setMaxNumberOfChannelsPerDetector(dimension d, int i) {
multi_shm()->maxNumberOfChannelsPerDetector[d] = i;
return multi_shm()->maxNumberOfChannelsPerDetector[d];
}
slsDetectorDefs::coordinates multiSlsDetector::getMaxNumberOfChannels() const {
slsDetectorDefs::coordinates coord;
coord.x = multi_shm()->maxNumberOfChannelsPerDetector[X];
coord.y = multi_shm()->maxNumberOfChannelsPerDetector[Y];
return coord;
}
void multiSlsDetector::setMaxNumberOfChannels(const slsDetectorDefs::coordinates c) {
multi_shm()->maxNumberOfChannelsPerDetector[X] = c.x;
multi_shm()->maxNumberOfChannelsPerDetector[Y] = c.y;
void multiSlsDetector::setMaxNumberOfChannels(const slsDetectorDefs::xy c) {
multi_shm()->maxNumberOfChannels[X] = c.x;
multi_shm()->maxNumberOfChannels[Y] = c.y;
}
int multiSlsDetector::getQuad(int detPos) {
int retval = detectors[0]->getQuad();
if (retval && size() > 1) {
throw RuntimeError("Quad type is available only for 1 Eiger Quad Half "
"module, but it Quad is enabled for 1st readout");
"module, but Quad is enabled for 1st readout");
}
return retval;
}
@ -1959,7 +1902,7 @@ void multiSlsDetector::loadImageToDetector(imageType index,
// multi
// read image for all
int nch = multi_shm()->numberOfChannels;
int nch = getNumberOfChannels().x;
short int imageVals[nch];
if (readDataFile(fname, imageVals, nch) < nch * (int)sizeof(short int)) {
throw RuntimeError("Could not open file or not enough data in file to "
@ -1968,7 +1911,7 @@ void multiSlsDetector::loadImageToDetector(imageType index,
// send image to all
for (size_t idet = 0; idet < detectors.size(); ++idet) {
detectors[idet]->sendImageToDetector(index, imageVals + idet * detectors[idet]->getTotalNumberOfChannels());
detectors[idet]->sendImageToDetector(index, imageVals + idet * detectors[idet]->getNumberOfChannels().x);
}
}
@ -1980,11 +1923,11 @@ void multiSlsDetector::writeCounterBlockFile(const std::string &fname,
}
// multi
int nch = multi_shm()->numberOfChannels;
int nch = getNumberOfChannels().x;
short int imageVals[nch];
for (size_t idet = 0; idet < detectors.size(); ++idet) {
detectors[idet]->getCounterBlock(
imageVals + idet * detectors[idet]->getTotalNumberOfChannels(),
imageVals + idet * detectors[idet]->getNumberOfChannels().x,
startACQ);
}
@ -2255,16 +2198,27 @@ int multiSlsDetector::enableGapPixels(int val, int detPos) {
int ret = sls::minusOneIfDifferent(r);
if (val != -1) {
multi_shm()->numberOfChannelInclGapPixels[X] = sls::sum(parallelCall(&slsDetector::getTotalNumberOfChannelsInclGapPixels, X));
multi_shm()->numberOfChannelInclGapPixels[Y] = sls::sum(parallelCall(&slsDetector::getTotalNumberOfChannelsInclGapPixels, Y));
Parallel(&slsDetector::enableGapPixels, {}, val);
Result<slsDetectorDefs::xy> res = Parallel(&slsDetector::getNumberOfChannels, {});
multi_shm()->numberOfChannels[X] = 0;
multi_shm()->numberOfChannels[Y] = 0;
for (auto &it : res) {
multi_shm()->numberOfChannels[X] += it.x;
multi_shm()->numberOfChannels[Y] += it.y;
}
}
return ret;
}
void multiSlsDetector::setGapPixelsEnable(bool enable, Positions pos){
Parallel(&slsDetector::enableGapPixels, pos, static_cast<int>(enable));
multi_shm()->numberOfChannelInclGapPixels[X] = sls::sum(parallelCall(&slsDetector::getTotalNumberOfChannelsInclGapPixels, X));
multi_shm()->numberOfChannelInclGapPixels[Y] = sls::sum(parallelCall(&slsDetector::getTotalNumberOfChannelsInclGapPixels, Y));
Result<slsDetectorDefs::xy> res = Parallel(&slsDetector::getNumberOfChannels, {});
multi_shm()->numberOfChannels[X] = 0;
multi_shm()->numberOfChannels[Y] = 0;
for (auto &it : res) {
multi_shm()->numberOfChannels[X] += it.x;
multi_shm()->numberOfChannels[Y] += it.y;
}
}
int multiSlsDetector::setTrimEn(std::vector<int> energies, int detPos) {

View File

@ -414,17 +414,9 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
shm()->nChans = shm()->nChan[X] * shm()->nChan[Y];
shm()->nChips = shm()->nChip[X] * shm()->nChip[Y];
// calculating databytes
shm()->dataBytes = shm()->nChips * shm()->nChans * shm()->dynamicRange / 8;
shm()->dataBytesInclGapPixels = (shm()->nChip[X] * shm()->nChan[X] +
shm()->gappixels * shm()->nGappixels[X]) *
(shm()->nChip[Y] * shm()->nChan[Y] +
shm()->gappixels * shm()->nGappixels[Y]) *
shm()->dynamicRange / 8;
// update #nchans and databytes, as it depends on #samples, adcmask,
// update #nchans, as it depends on #samples, adcmask,
// readoutflags (ctb only)
updateTotalNumberOfChannels();
updateNumberOfChannels();
}
int slsDetector::sendModule(sls_detector_module *myMod,
@ -574,16 +566,11 @@ std::string slsDetector::getDetectorTypeAsString() const {
return slsDetectorDefs::detectorTypeToString(getDetectorTypeAsEnum());
}
int slsDetector::getTotalNumberOfChannels() const {
return shm()->nChans * shm()->nChips;
}
void slsDetector::updateTotalNumberOfChannels() {
void slsDetector::updateNumberOfChannels() {
if (shm()->myDetectorType == CHIPTESTBOARD ||
shm()->myDetectorType == MOENCH) {
int nachans = 0, ndchans = 0;
int adatabytes = 0, ddatabytes = 0;
// analog channels (normal, analog/digital readout)
if (shm()->roFlags == slsDetectorDefs::NORMAL_READOUT ||
((shm()->roFlags & slsDetectorDefs::ANALOG_AND_DIGITAL) != 0)) {
@ -596,10 +583,7 @@ void slsDetector::updateTotalNumberOfChannels() {
++nachans;
}
}
adatabytes = nachans * (shm()->dynamicRange / 8) *
shm()->timerValue[ANALOG_SAMPLES];
FILE_LOG(logDEBUG1) << "#Analog Channels:" << nachans
<< " Databytes: " << adatabytes;
FILE_LOG(logDEBUG1) << "#Analog Channels:" << nachans;
}
// digital channels (ctb only, digital, analog/digital readout)
@ -607,50 +591,20 @@ void slsDetector::updateTotalNumberOfChannels() {
(((shm()->roFlags & DIGITAL_ONLY) != 0) ||
((shm()->roFlags & ANALOG_AND_DIGITAL) != 0))) {
ndchans = 64;
ddatabytes =
(sizeof(uint64_t) * shm()->timerValue[DIGITAL_SAMPLES]);
FILE_LOG(logDEBUG1) << "#Digital Channels:" << ndchans
<< " Databytes: " << ddatabytes;
FILE_LOG(logDEBUG1) << "#Digital Channels:" << ndchans;
}
shm()->nChans = nachans + ndchans;
shm()->dataBytes = adatabytes + ddatabytes;
FILE_LOG(logDEBUG1) << "# Total #Channels:" << shm()->nChans
<< " Databytes: " << shm()->dataBytes;
FILE_LOG(logDEBUG1) << "# Total #Channels:" << shm()->nChans;
}
}
int slsDetector::getTotalNumberOfChannels(dimension d) const {
return shm()->nChan[d] * shm()->nChip[d];
}
slsDetectorDefs::coordinates slsDetector::getNumberOfChannels() const {
slsDetectorDefs::coordinates coord;
coord.x = shm()->nChan[X] * shm()->nChip[X];
coord.y = shm()->nChan[Y] * shm()->nChip[Y];
return coord;
}
int slsDetector::getTotalNumberOfChannelsInclGapPixels(dimension d) const {
return (shm()->nChan[d] * shm()->nChip[d] +
shm()->gappixels * shm()->nGappixels[d]);
}
slsDetectorDefs::coordinates slsDetector::getNumberOfChannelsInclGapPixels() const {
slsDetectorDefs::coordinates coord;
slsDetectorDefs::xy slsDetector::getNumberOfChannels() const {
slsDetectorDefs::xy coord;
coord.x = (shm()->nChan[X] * shm()->nChip[X] + shm()->gappixels * shm()->nGappixels[X]);
coord.y = (shm()->nChan[Y] * shm()->nChip[Y] + shm()->gappixels * shm()->nGappixels[Y]);
return coord;
}
int slsDetector::getNChans() const { return shm()->nChans; }
int slsDetector::getNChans(dimension d) const { return shm()->nChan[d]; }
int slsDetector::getNChips() const { return shm()->nChips; }
int slsDetector::getNChips(dimension d) const { return shm()->nChip[d]; }
bool slsDetector::getQuad() {
int retval = -1;
FILE_LOG(logDEBUG1) << "Getting Quad Type";
@ -785,11 +739,7 @@ void slsDetector::updateCachedDetectorVariables() {
// dr
n += client.Receive(&i32, sizeof(i32));
shm()->dynamicRange = i32;
// databytes
n += client.Receive(&i32, sizeof(i32));
shm()->dataBytes = i32;
shm()->dynamicRange = i32;
// settings
if ((shm()->myDetectorType != CHIPTESTBOARD) &&
@ -881,9 +831,9 @@ void slsDetector::updateCachedDetectorVariables() {
if (shm()->myDetectorType == MOENCH)
setAdditionalJsonParameter("adcmask", std::to_string(u32));
// update #nchans and databytes, as it depends on #samples, adcmask,
// update #nchans, as it depends on #samples, adcmask,
// readoutflags
updateTotalNumberOfChannels();
updateNumberOfChannels();
}
if (n == 0) {
@ -1390,10 +1340,10 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t) {
sendToDetector(F_SET_TIMER, args, retval);
FILE_LOG(logDEBUG1) << getTimerType(index) << ": " << retval;
shm()->timerValue[index] = retval;
// update #nchans and databytes, as it depends on #samples, adcmask,
// update #nchans, as it depends on #samples, adcmask,
// readoutflags
if (index == ANALOG_SAMPLES || index == DIGITAL_SAMPLES) {
updateTotalNumberOfChannels();
updateNumberOfChannels();
}
// setting timers consequences (eiger (ratecorr) )
@ -1477,27 +1427,10 @@ int slsDetector::setDynamicRange(int n) {
// TODO! Properly handle fail
int retval = -1;
FILE_LOG(logDEBUG1) << "Setting dynamic range to " << n;
int olddr = shm()->dynamicRange;
sendToDetector(F_SET_DYNAMIC_RANGE, n, retval);
FILE_LOG(logDEBUG1) << "Dynamic Range: " << retval;
shm()->dynamicRange = retval;
// only for eiger
// setting dr consequences on databytes shm
// (a get can also change timer value, hence check difference)
if (olddr != shm()->dynamicRange) {
shm()->dataBytes = shm()->nChips * shm()->nChans * retval / 8;
shm()->dataBytesInclGapPixels =
(shm()->nChip[X] * shm()->nChan[X] +
shm()->gappixels * shm()->nGappixels[X]) *
(shm()->nChip[Y] * shm()->nChan[Y] +
shm()->gappixels * shm()->nGappixels[Y]) *
retval / 8;
FILE_LOG(logDEBUG1) << "Data bytes " << shm()->dataBytes;
FILE_LOG(logDEBUG1) << "Data bytes including gap pixels"
<< shm()->dataBytesInclGapPixels;
}
if (shm()->useReceiverFlag) {
n = shm()->dynamicRange;
retval = -1;
@ -1512,12 +1445,6 @@ int slsDetector::getDynamicRangeFromShm() {
return shm()->dynamicRange;
}
int slsDetector::getDataBytes() { return shm()->dataBytes; }
int slsDetector::getDataBytesInclGapPixels() {
return shm()->dataBytesInclGapPixels;
}
int slsDetector::setDAC(int val, dacIndex index, int mV) {
int args[]{static_cast<int>(index), mV, val};
int retval = -1;
@ -1565,10 +1492,10 @@ int slsDetector::setReadOutFlags(readOutFlags flag) {
sendToDetector(F_SET_READOUT_FLAGS, arg, retval);
FILE_LOG(logDEBUG1) << "Readout flag: " << retval;
shm()->roFlags = retval;
// update #nchans and databytes, as it depends on #samples, adcmask,
// update #nchans, as it depends on #samples, adcmask,
// readoutflags
if (shm()->myDetectorType == CHIPTESTBOARD) {
updateTotalNumberOfChannels();
updateNumberOfChannels();
}
FILE_LOG(logDEBUG1) << "Setting receiver readout flags to " << arg;
if (shm()->useReceiverFlag) {
@ -2246,7 +2173,7 @@ int slsDetector::digitalTest(digitalTestMode mode, int ival) {
void slsDetector::loadImageToDetector(imageType index,
const std::string &fname) {
int nChan = getTotalNumberOfChannels();
int nChan = getNumberOfChannels().x;
int16_t args[nChan];
FILE_LOG(logDEBUG1) << "Loading " << (index == 0u ? "Dark" : "Gain")
<< "image from file " << fname;
@ -2261,7 +2188,7 @@ void slsDetector::loadImageToDetector(imageType index,
void slsDetector::sendImageToDetector(imageType index, int16_t imageVals[]) {
int fnum = F_LOAD_IMAGE;
int nChan = getTotalNumberOfChannels();
int nChan = getNumberOfChannels().x;
int args[]{static_cast<int>(index), nChan};
FILE_LOG(logDEBUG1) << "Sending image to detector";
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
@ -2281,7 +2208,7 @@ void slsDetector::sendImageToDetector(imageType index, int16_t imageVals[]) {
void slsDetector::writeCounterBlockFile(const std::string &fname,
int startACQ) {
int nChan = getTotalNumberOfChannels();
int nChan = getNumberOfChannels().x;
int16_t retvals[nChan];
FILE_LOG(logDEBUG1) << "Reading Counter to " << fname
<< (startACQ != 0 ? " and Restarting Acquisition"
@ -2292,7 +2219,7 @@ void slsDetector::writeCounterBlockFile(const std::string &fname,
void slsDetector::getCounterBlock(int16_t image[], int startACQ) {
int fnum = F_READ_COUNTER_BLOCK;
int nChan = getTotalNumberOfChannels();
int nChan = getNumberOfChannels().x;
int args[] = {startACQ, nChan};
FILE_LOG(logDEBUG1) << "Reading Counter block with startacq: " << startACQ;
sendToDetector(fnum, args, sizeof(args), image, nChan * sizeof(int16_t));
@ -2322,7 +2249,7 @@ void slsDetector::clearROI() {
void slsDetector::setROI(slsDetectorDefs::ROI arg) {
int fnum = F_SET_ROI;
int ret = FAIL;
if (arg.xmin < 0 || arg.xmax >= getTotalNumberOfChannels()) {
if (arg.xmin < 0 || arg.xmax >= getNumberOfChannels().x) {
arg.xmin = -1;
arg.xmax = -1;
}
@ -2403,9 +2330,9 @@ void slsDetector::setADCEnableMask(uint32_t mask) {
sendToDetector(F_SET_ADC_ENABLE_MASK, &arg, sizeof(arg), nullptr, 0);
shm()->adcEnableMask = mask;
// update #nchans and databytes, as it depends on #samples, adcmask,
// update #nchans, as it depends on #samples, adcmask,
// readoutflags
updateTotalNumberOfChannels();
updateNumberOfChannels();
// send to processor
if (shm()->myDetectorType == MOENCH)
@ -2592,16 +2519,6 @@ int slsDetector::enableGapPixels(int val) {
sendToReceiver(fnum, &val, sizeof(val), &retval, sizeof(retval));
FILE_LOG(logDEBUG1) << "Gap pixels enable to receiver:" << retval;
shm()->gappixels = retval;
// update databytes
shm()->dataBytesInclGapPixels = 0;
if (shm()->dynamicRange != 4) {
shm()->dataBytesInclGapPixels =
(shm()->nChip[X] * shm()->nChan[X] +
shm()->gappixels * shm()->nGappixels[X]) *
(shm()->nChip[Y] * shm()->nChan[Y] +
shm()->gappixels * shm()->nGappixels[Y]) *
shm()->dynamicRange / 8;
}
}
}
return shm()->gappixels;

View File

@ -322,7 +322,7 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
++i;
/*! \page config
- <b>detsizechan [xmax] [ymax]</b> sets the maximum number of channels in each dimension for complete detector set; -1 is no limit. Use for multi-detector system as first command in config file. \c Returns \c ("int int")
- <b>detsizechan [xmax] [ymax]</b> sets the maximum number of channels in each dimension for complete detector set; 0 is no limit. Use for multi-detector system as first command in config file. \c Returns \c ("int int")
*/
descrToFuncMap[i].m_pFuncName = "detsizechan";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdDetectorSize;
@ -3284,10 +3284,14 @@ std::string slsDetectorCommand::cmdDetectorSize(int narg, const char * const arg
}
if (cmd == "detsizechan") {
if ((sscanf(args[1], "%d", &val)) && (val > 0))
myDet->setMaxNumberOfChannelsPerDetector(X, val);
if ((narg > 2) && (sscanf(args[2], "%d", &val)) && (val > 0))
myDet->setMaxNumberOfChannelsPerDetector(Y, val);
int val2 = 0;
if ((!sscanf(args[1], "%d", &val)) || (narg <= 2) || (!sscanf(args[2], "%d", &val2))) {
return std::string("Could not scan det size chan values");
}
slsDetectorDefs::xy res;
res.x = val;
res.y = val2;
myDet->setMaxNumberOfChannels(res);
}
if(cmd=="quad"){
@ -3331,7 +3335,8 @@ std::string slsDetectorCommand::cmdDetectorSize(int narg, const char * const arg
ROI roi = myDet->getROI(detPos);
return (std::string("[") + std::to_string(roi.xmin) + std::string(",") + std::to_string(roi.xmax) + std::string("]"));
} else if (cmd == "detsizechan") {
sprintf(ans, "%d %d", myDet->getMaxNumberOfChannelsPerDetector(X), myDet->getMaxNumberOfChannelsPerDetector(Y));
slsDetectorDefs::xy res = myDet->getMaxNumberOfChannels();
sprintf(ans, "%d %d", res.x, res.y);
return std::string(ans);
} else if (cmd=="quad") {
return std::to_string(myDet->getQuad());
@ -3362,7 +3367,7 @@ std::string slsDetectorCommand::helpDetectorSize(int action) {
os << "dr i \n sets the dynamic range of the detector" << std::endl;
os << "clearroi \n resets region of interest" << std::endl;
os << "roi xmin xmax \n sets region of interest " << std::endl;
os << "detsizechan x y \n sets the maximum number of channels for complete detector set in both directions; -1 is no limit" << std::endl;
os << "detsizechan x y \n sets the maximum number of channels for complete detector set in both directions; 0 is no limit" << std::endl;
os << "quad i \n if i = 1, sets the detector size to a quad (Specific to an EIGER quad hardware). 0 by default."<< std::endl;
os << "flippeddatax x \n sets if the data should be flipped on the x axis" << std::endl;
os << "flippeddatay y \n sets if the data should be flipped on the y axis" << std::endl;
@ -3371,7 +3376,7 @@ std::string slsDetectorCommand::helpDetectorSize(int action) {
if (action == GET_ACTION || action == HELP_ACTION) {
os << "dr \n gets the dynamic range of the detector" << std::endl;
os << "roi \n gets region of interest" << std::endl;
os << "detsizechan \n gets the maximum number of channels for complete detector set in both directions; -1 is no limit" << std::endl;
os << "detsizechan \n gets the maximum number of channels for complete detector set in both directions; 0 is no limit" << std::endl;
os << "quad \n returns 1 if the detector size is a quad (Specific to an EIGER quad hardware). 0 by default."<< std::endl;
os << "flippeddatax\n gets if the data will be flipped on the x axis" << std::endl;
os << "flippeddatay\n gets if the data will be flipped on the y axis" << std::endl;

View File

@ -9,14 +9,16 @@ int slsDetectorUsers::size() const {
}
int slsDetectorUsers::getMaximumDetectorSize(int &nx, int &ny){
nx=detector.getMaxNumberOfChannelsPerDetector(slsDetectorDefs::X);
ny=detector.getMaxNumberOfChannelsPerDetector(slsDetectorDefs::Y);
slsDetectorDefs::xy res = detector.getMaxNumberOfChannels();
nx=res.x;
ny=res.y;
return nx*ny;
}
int slsDetectorUsers::getDetectorSize(int &nx, int &ny, int detPos){
nx=detector.getTotalNumberOfChannels(slsDetectorDefs::X, detPos);
ny=detector.getTotalNumberOfChannels(slsDetectorDefs::Y, detPos);
slsDetectorDefs::xy res = detector.getNumberOfChannels();
nx=res.x;
ny=res.y;
return nx*ny;
}

View File

@ -292,7 +292,7 @@ format
};
#ifdef __cplusplus
struct coordinates {
struct xy {
int x{0};
int y{0};
};