This commit is contained in:
2019-08-21 09:23:32 +02:00
parent 28963e313b
commit 62c4bfab64
6 changed files with 339 additions and 365 deletions

View File

@ -20,8 +20,8 @@ class Detector {
public: public:
/** /**
* @param shm_id detector shared memory id * @param shm_id detector shared memory id
* Default value is 0. Can be set to more values for * Default value is 0. Can be set to more values for
* multiple detectors.It is important only if you * multiple detectors.It is important only if you
* are controlling multiple detectors from the same pc. * are controlling multiple detectors from the same pc.
*/ */
Detector(int shm_id = 0); Detector(int shm_id = 0);
@ -67,7 +67,8 @@ class Detector {
Result<defs::xy> getModuleSize(Positions pos = {}) const; Result<defs::xy> getModuleSize(Positions pos = {}) const;
/** Gets the actual full detector size. It is the same even if ROI changes */ /** Gets the actual full detector size. It is the same even if ROI changes
*/
defs::xy getDetectorSize() const; defs::xy getDetectorSize() const;
/** /**
@ -82,8 +83,6 @@ class Detector {
/** [Jungfrau][Gotthard] */ /** [Jungfrau][Gotthard] */
void setSettings(defs::detectorSettings value, Positions pos = {}); void setSettings(defs::detectorSettings value, Positions pos = {});
/************************************************** /**************************************************
* * * *
* Acquisition Parameters * * Acquisition Parameters *
@ -174,9 +173,7 @@ class Detector {
* [Gotthard, Jungfrau, CTB Options: AUTO_TIMING, TRIGGER_EXPOSURE] * [Gotthard, Jungfrau, CTB Options: AUTO_TIMING, TRIGGER_EXPOSURE]
* [Eiger Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER] * [Eiger Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER]
*/ */
void setTimingMode(defs::timingMode value, void setTimingMode(defs::timingMode value, Positions pos = {});
Positions pos = {});
/************************************************** /**************************************************
* * * *
@ -190,16 +187,18 @@ class Detector {
*/ */
void acquire(); void acquire();
/** Non blocking /** Non blocking
* Starts the reciever (if enabled) and then the detector * Starts the reciever (if enabled) and then the detector
* You have to check detector status until it is idle before you call stopACquisition * You have to check detector status until it is idle before you call
* * stopACquisition
*/ *
*/
void startAcquisition(); void startAcquisition();
/** /**
* Stops detector acquisition and then receiver (if enabled) * Stops detector acquisition and then receiver (if enabled)
* If no receiver enabled, you can skip this for normal acquisition (no abort) * If no receiver enabled, you can skip this for normal acquisition (no
* abort)
*/ */
void stopAcquisition(); void stopAcquisition();
@ -224,20 +223,19 @@ class Detector {
/** [Eiger] Sends an internal software trigger to the detector */ /** [Eiger] Sends an internal software trigger to the detector */
void sendSoftwareTrigger(Positions pos = {}); void sendSoftwareTrigger(Positions pos = {});
//TODO: remove resetframescaught in receiver // TODO: remove resetframescaught in receiver
/************************************************** /**************************************************
* * * *
* Network Configuration (Detector<->Receiver) * * Network Configuration (Detector<->Receiver) *
* * * *
* ************************************************/ * ************************************************/
/** Configures the destination for UDP packets in the detector /** Configures the destination for UDP packets in the detector
* Needed only if you use a custom receiver (not slsReceiver) * Needed only if you use a custom receiver (not slsReceiver)
* as it is already included in setReceiverHostname. * as it is already included in setReceiverHostname.
*/ */
void configureMAC(Positions pos = {});//TODO: find a reasonable name void configureMAC(Positions pos = {}); // TODO: find a reasonable name
/** [Jungfrau] */ /** [Jungfrau] */
Result<int> getNumberofUDPInterfaces(Positions pos = {}) const; Result<int> getNumberofUDPInterfaces(Positions pos = {}) const;
@ -258,12 +256,12 @@ class Detector {
Result<IpAddr> getSourceUDPIP(Positions pos = {}) const; Result<IpAddr> getSourceUDPIP(Positions pos = {}) const;
/* For Eiger 1G, the detector will replace with its own DHCP IP /* For Eiger 1G, the detector will replace with its own DHCP IP
* 10G Eiger and other detectors, the source UDP IP must be in the * 10G Eiger and other detectors, the source UDP IP must be in the
* same subnet of the destination UDP IP * same subnet of the destination UDP IP
*/ */
void setSourceUDPIP(const std::string &ip, Positions pos = {}); void setSourceUDPIP(const std::string &ip, Positions pos = {});
/** [Jungfrau] bottom half */ /** [Jungfrau] bottom half */
Result<IpAddr> getSourceUDPIP2(Positions pos = {}) const; Result<IpAddr> getSourceUDPIP2(Positions pos = {}) const;
/** [Jungfrau] bottom half */ /** [Jungfrau] bottom half */
@ -275,7 +273,7 @@ class Detector {
* For Eiger 10G, the detector will replace with its own DHCP MAC + 1 * For Eiger 10G, the detector will replace with its own DHCP MAC + 1
* Others can be anything (beware of certain bits) * Others can be anything (beware of certain bits)
*/ */
void setSourceUDPMAC(const std::string &mac, Positions pos = {}); void setSourceUDPMAC(const std::string &mac, Positions pos = {});
/** [Jungfrau] bottom half */ /** [Jungfrau] bottom half */
@ -294,13 +292,13 @@ class Detector {
/** [Jungfrau bottom half] */ /** [Jungfrau bottom half] */
void setDestinationUDPIP2(const std::string &ip, Positions pos = {}); void setDestinationUDPIP2(const std::string &ip, Positions pos = {});
Result<MacAddr> getDestinationUDPMAC(Positions pos = {}) const; Result<MacAddr> getDestinationUDPMAC(Positions pos = {}) const;
/** MAC of the interface in receiver that the detector sends data to /** MAC of the interface in receiver that the detector sends data to
* Only needed if you use a custom receiver (not slsReceiver) * Only needed if you use a custom receiver (not slsReceiver)
* Must be followed by configuremac. * Must be followed by configuremac.
*/ */
void setDestinationUDPMAC(const std::string &mac, Positions pos = {}); void setDestinationUDPMAC(const std::string &mac, Positions pos = {});
/** [Jungfrau bottom half] */ /** [Jungfrau bottom half] */
@ -311,15 +309,18 @@ class Detector {
Result<int> getDestinationUDPPort(Positions pos = {}) const; Result<int> getDestinationUDPPort(Positions pos = {}) const;
/** module_id is -1 for all detectors, ports for each module is calculated (increments) */ /** module_id is -1 for all detectors, ports for each module is calculated
//TODO if Parallel takes a vector, can send multiple vaues to set in slsdetector.cp * (increments) */
// TODO if Parallel takes a vector, can send multiple vaues to set in
// slsdetector.cp
void setDestinationUDPPort(int port, int module_id = -1); void setDestinationUDPPort(int port, int module_id = -1);
/** [Eiger right port][Jungfrau bottom half] */ /** [Eiger right port][Jungfrau bottom half] */
Result<int> getDestinationUDPPort2(Positions pos = {}) const; Result<int> getDestinationUDPPort2(Positions pos = {}) const;
/** [Eiger right port][Jungfrau bottom half] /** [Eiger right port][Jungfrau bottom half]
* module_id is -1 for all detectors, ports for each module is calculated (increments) * module_id is -1 for all detectors, ports for each module is calculated
* (increments)
*/ */
void setDestinationUDPPort2(int port, int module_id = -1); void setDestinationUDPPort2(int port, int module_id = -1);
@ -342,9 +343,9 @@ class Detector {
/** /**
* [Jungfrau]: Sets the transmission delay of the first UDP packet being * [Jungfrau]: Sets the transmission delay of the first UDP packet being
* streamed out of the module. Options: 0 - 31, each value represenets 1 ms * streamed out of the module. Options: 0 - 31, each value represenets 1 ms
* [Eiger]: Sets the transmission delay of entire frame streamed out for both * [Eiger]: Sets the transmission delay of entire frame streamed out for
* left and right UDP ports. Options: //TODO possible values * both left and right UDP ports. Options: //TODO possible values
*/ */
void setTransmissionDelayFrame(int value, Positions pos = {}); void setTransmissionDelayFrame(int value, Positions pos = {});
@ -368,7 +369,6 @@ class Detector {
*/ */
void setTransmissionDelayRight(int value, Positions pos = {}); void setTransmissionDelayRight(int value, Positions pos = {});
/************************************************** /**************************************************
* * * *
* RECEIVER CONFIG * * RECEIVER CONFIG *
@ -412,8 +412,8 @@ class Detector {
* discard partial frames is the fastest * discard partial frames is the fastest
*/ */
void setRxFrameDiscardPolicy(defs::frameDiscardPolicy f, void setRxFrameDiscardPolicy(defs::frameDiscardPolicy f,
Positions pos = {}); Positions pos = {});
Result<bool> getPartialFramesPadding(Positions pos = {}) const; Result<bool> getPartialFramesPadding(Positions pos = {}) const;
/** padding enabled. Disabling padding is the fastest */ /** padding enabled. Disabling padding is the fastest */
@ -421,12 +421,11 @@ class Detector {
Result<int64_t> getRxUDPSocketBufferSize(Positions pos = {}) const; Result<int64_t> getRxUDPSocketBufferSize(Positions pos = {}) const;
void setRxUDPSocketBufferSize(int64_t udpsockbufsize, void setRxUDPSocketBufferSize(int64_t udpsockbufsize, Positions pos = {});
Positions pos = {}); /** TODO:
/** TODO: * Linux kernel allocates twice the amount you set for bookkeeping purposes
* Linux kernel allocates twice the amount you set for bookkeeping purposes */ */
Result<int64_t> Result<int64_t> getRxRealUDPSocketBufferSize(Positions pos = {}) const;
getRxRealUDPSocketBufferSize(Positions pos = {}) const;
Result<bool> getRxLock(Positions pos = {}); Result<bool> getRxLock(Positions pos = {});
@ -435,7 +434,6 @@ class Detector {
Result<std::string> getRxLastClientIP(Positions pos = {}) const; Result<std::string> getRxLastClientIP(Positions pos = {}) const;
/************************************************** /**************************************************
* * * *
* FILE * * FILE *
@ -453,10 +451,10 @@ class Detector {
Result<std::string> getFileNamePrefix(Positions pos = {}) const; Result<std::string> getFileNamePrefix(Positions pos = {}) const;
/** default run /** default run
* File Name: [file name prefix]_d[module index]_f[file index]_[acquisition index].[file format] * File Name: [file name prefix]_d[module index]_f[file index]_[acquisition
* eg. run_d0_f0_5.raw * index].[file format] eg. run_d0_f0_5.raw
*/ */
void setFileNamePrefix(const std::string &fname, Positions pos = {}); void setFileNamePrefix(const std::string &fname, Positions pos = {});
Result<int> getAcquisitonIndex(Positions pos = {}) const; Result<int> getAcquisitonIndex(Positions pos = {}) const;
@ -483,13 +481,12 @@ class Detector {
/** 0 will set frames per file to unlimited */ /** 0 will set frames per file to unlimited */
void setFramesPerFile(int n, Positions pos = {}); void setFramesPerFile(int n, Positions pos = {});
/************************************************** /**************************************************
* * * *
* ZMQ Streaming Parameters (Receiver<->Client)* * ZMQ Streaming Parameters (Receiver<->Client)*
* * * *
* ************************************************/ * ************************************************/
//TODO callback functions // TODO callback functions
Result<bool> getRxZmqDataStream(Positions pos = {}) const; Result<bool> getRxZmqDataStream(Positions pos = {}) const;
@ -501,7 +498,8 @@ class Detector {
* If 0, streaming timer is the timeout, * If 0, streaming timer is the timeout,
* after which current frame sent out. Default is 0 at 200 ms. * after which current frame sent out. Default is 0 at 200 ms.
* Default is 1: send every frame. * Default is 1: send every frame.
* If you want just to see some frames for gui purposes, set to 0 (200ms default timer). * If you want just to see some frames for gui purposes, set to 0 (200ms
* default timer).
*/ */
void setRxZmqFrequency(int freq, Positions pos = {}); void setRxZmqFrequency(int freq, Positions pos = {});
@ -516,22 +514,22 @@ class Detector {
Result<int> getRxZmqPort(Positions pos = {}) const; Result<int> getRxZmqPort(Positions pos = {}) const;
/** /**
* module_id is -1 for all detectors, ports for each module is calculated (increments) * module_id is -1 for all detectors, ports for each module is calculated
* Restarts receiver zmq sockets only if it was already enabled * (increments) Restarts receiver zmq sockets only if it was already enabled
*/ */
void setRxZmqPort(int port, int module_id = -1); void setRxZmqPort(int port, int module_id = -1);
Result<std::string> getRxZmqIP(Positions pos = {}) const; Result<std::string> getRxZmqIP(Positions pos = {}) const;
void setRxZmqIP(const std::string &ip, void setRxZmqIP(const std::string &ip, Positions pos = {});
Positions pos = {});
Result<int> getClientZmqPort(Positions pos = {}) const; Result<int> getClientZmqPort(Positions pos = {}) const;
/** /**
* Needed only when using the client call back to get reconstructed data from multi modules * Needed only when using the client call back to get reconstructed data
* module_id is -1 for all detectors, ports for each module is calculated (increments) * from multi modules module_id is -1 for all detectors, ports for each
* Restarts client zmq sockets oonly if it was already enabled * module is calculated (increments) Restarts client zmq sockets oonly if it
* was already enabled
*/ */
void setClientZmqPort(int port, int module_id = -1); void setClientZmqPort(int port, int module_id = -1);
@ -539,7 +537,6 @@ class Detector {
void setClientZmqIp(const std::string &ip, Positions pos = {}); void setClientZmqIp(const std::string &ip, Positions pos = {});
/************************************************** /**************************************************
* * * *
* Eiger Specific * * Eiger Specific *
@ -629,7 +626,8 @@ class Detector {
/** //TODO: default, get, set /** //TODO: default, get, set
* [Eiger] Set Rate correction * [Eiger] Set Rate correction
* 0 disable correction, < 0: default dead time from trimbit file, > 0 custom deadtime (advanced) * 0 disable correction, < 0: default dead time from trimbit file, > 0
* custom deadtime (advanced)
*/ */
void setRateCorrection(ns dead_time, Positions pos = {}); void setRateCorrection(ns dead_time, Positions pos = {});
@ -669,15 +667,15 @@ class Detector {
/** [Eiger] Advanced */ /** [Eiger] Advanced */
Result<bool> getPartialReset(Positions pos = {}) const; Result<bool> getPartialReset(Positions pos = {}) const;
/** [Eiger] Advanced /** [Eiger] Advanced
* used for pulsing chips */ * used for pulsing chips */
void setPartialReset(bool enable, Positions pos = {}); void setPartialReset(bool enable, Positions pos = {});
/** [Eiger] Advanced /** [Eiger] Advanced
* Pulse Pixel n times at x and y coordinates */ * Pulse Pixel n times at x and y coordinates */
void pulsePixel(int n, defs::xy pixel, Positions pos = {}); void pulsePixel(int n, defs::xy pixel, Positions pos = {});
/** [Eiger] Advanced /** [Eiger] Advanced
* Pulse Pixel n times and move by a relative value of x and y * Pulse Pixel n times and move by a relative value of x and y
* coordinates */ * coordinates */
void pulsePixelNMove(int n, defs::xy pixel, Positions pos = {}); void pulsePixelNMove(int n, defs::xy pixel, Positions pos = {});
@ -692,7 +690,6 @@ class Detector {
/** [Eiger] with specific quad hardware */ /** [Eiger] with specific quad hardware */
void setQuad(const bool enable); void setQuad(const bool enable);
/************************************************** /**************************************************
* * * *
* Jungfrau Specific * * Jungfrau Specific *
@ -735,10 +732,12 @@ class Detector {
/** [Jungfrau] Advanced /** [Jungfrau] Advanced
* //TODO naming * //TODO naming
* By default, the on-chip gain switching is active during the entire exposure. * By default, the on-chip gain switching is active during the entire
* This mode disables the on-chip gain switching comparator automatically after 93.75% of exposure time (only for longer than 100us). */ * exposure. This mode disables the on-chip gain switching comparator
* automatically after 93.75% of exposure time (only for longer than 100us).
*/
void setAutoCompDisable(bool value, Positions pos = {}); void setAutoCompDisable(bool value, Positions pos = {});
/** [Jungfrau] Advanced TODO naming */ /** [Jungfrau] Advanced TODO naming */
Result<int64_t> getNumberOfAdditionalStorageCells() const; Result<int64_t> getNumberOfAdditionalStorageCells() const;
@ -748,8 +747,8 @@ class Detector {
/** [Jungfrau] Advanced */ /** [Jungfrau] Advanced */
Result<int> getStorageCellStart(Positions pos = {}) const; Result<int> getStorageCellStart(Positions pos = {}) const;
/** [Jungfrau] Advanced. Sets the storage cell storing the first acquisition of the /** [Jungfrau] Advanced. Sets the storage cell storing the first acquisition
* series. Options: 0-15 * of the series. Options: 0-15
*/ */
void setStoragecellStart(int cell, Positions pos = {}); void setStoragecellStart(int cell, Positions pos = {});
@ -760,7 +759,6 @@ class Detector {
* Options: (0-1638375 ns (resolution of 25ns) */ * Options: (0-1638375 ns (resolution of 25ns) */
void setStorageCellDelay(ns value, Positions pos = {}); void setStorageCellDelay(ns value, Positions pos = {});
/************************************************** /**************************************************
* * * *
* Gotthard Specific * * Gotthard Specific *
@ -778,7 +776,8 @@ class Detector {
*/ */
void setROI(defs::ROI value, int moduleId); void setROI(defs::ROI value, int moduleId);
/** [Gotthard] TODO: check with jiaguo if he needs any of these functions // TODO remove */ /** [Gotthard] TODO: check with jiaguo if he needs any of these functions //
* TODO remove */
Result<ns> getExptimeLeft(Positions pos = {}) const; Result<ns> getExptimeLeft(Positions pos = {}) const;
/** [Gotthard] TODO remove */ /** [Gotthard] TODO remove */
@ -795,7 +794,8 @@ class Detector {
/** [Gotthard] */ /** [Gotthard] */
Result<int> getImageTestMode(Positions pos = {}); Result<int> getImageTestMode(Positions pos = {});
/** [Gotthard] If 1, adds channel intensity with precalculated values. Default is 0 */ /** [Gotthard] If 1, adds channel intensity with precalculated values.
* Default is 0 */
Result<int> setImageTestMode(const int value, Positions pos = {}); Result<int> setImageTestMode(const int value, Positions pos = {});
/************************************************** /**************************************************
@ -819,8 +819,8 @@ class Detector {
/** [CTB] */ /** [CTB] */
Result<int> getReadoutMode(Positions pos = {}) const; Result<int> getReadoutMode(Positions pos = {}) const;
/** [CTB] Options: NORMAL_READOUT = 0, DIGITAL_ONLY = 1, ANALOG_AND_DIGITAL //TODO ANALOG_ONLY, make enum /** [CTB] Options: NORMAL_READOUT = 0, DIGITAL_ONLY = 1, ANALOG_AND_DIGITAL
* = 2 */ * //TODO ANALOG_ONLY, make enum = 2 */
void setReadoutMode(int value, Positions pos = {}); void setReadoutMode(int value, Positions pos = {});
/** [CTB] */ /** [CTB] */
@ -955,7 +955,6 @@ class Detector {
/** [CTB] */ /** [CTB] */
void setLEDEnable(bool enable, Positions pos = {}); void setLEDEnable(bool enable, Positions pos = {});
/************************************************** /**************************************************
* * * *
* PATTERN * * PATTERN *
@ -1024,7 +1023,6 @@ class Detector {
* * * *
* ************************************************/ * ************************************************/
/** [Moench] */ /** [Moench] */
Result<std::string> getAdditionalJsonHeader(Positions pos = {}) const; Result<std::string> getAdditionalJsonHeader(Positions pos = {}) const;
@ -1045,7 +1043,7 @@ class Detector {
const std::string &value, const std::string &value,
Positions pos = {}); Positions pos = {});
/** [Moench] TODO! How do we do this best??? Can be refactored to something /** [Moench] TODO! How do we do this best??? Can be refactored to something
* else? Use a generic zmq message passing system... * else? Use a generic zmq message passing system...
* For now limiting to all detectors working the same*/ * For now limiting to all detectors working the same*/
/** [Moench: -1 if not found or cannot convert to int] */ /** [Moench: -1 if not found or cannot convert to int] */
@ -1080,7 +1078,7 @@ class Detector {
/** [Jungfrau][CTB] */ /** [Jungfrau][CTB] */
void resetFPGA(Positions pos = {}); void resetFPGA(Positions pos = {});
/** [Jungfrau][Gotthard][CTB] /** [Jungfrau][Gotthard][CTB]
* Copy detector server fname from tftp folder of hostname to detector * Copy detector server fname from tftp folder of hostname to detector
* Also changes respawn server, which is effective after a reboot. * Also changes respawn server, which is effective after a reboot.
*/ */
@ -1121,7 +1119,6 @@ class Detector {
/** [Gotthard][Jungfrau][CTB] not possible to read back*/ /** [Gotthard][Jungfrau][CTB] not possible to read back*/
void writeAdcRegister(uint32_t addr, uint32_t value, Positions pos = {}); void writeAdcRegister(uint32_t addr, uint32_t value, Positions pos = {});
/************************************************** /**************************************************
* * * *
* Insignificant * * Insignificant *
@ -1161,11 +1158,10 @@ class Detector {
std::string getUserDetails() const; std::string getUserDetails() const;
Result<uint64_t> getRxCurrentFrameIndex(Positions pos = {}) const; Result<uint64_t> getRxCurrentFrameIndex(Positions pos = {}) const;
private:
std::vector<int> getPortNumbers(int start_port);
private:
std::vector<int> getPortNumbers(int start_port);
}; };
} // namespace sls } // namespace sls

View File

@ -1,9 +1,9 @@
#pragma once #pragma once
#include "Result.h"
#include "SharedMemory.h" #include "SharedMemory.h"
#include "logger.h" #include "logger.h"
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
#include "Result.h"
class slsDetector; class slsDetector;
class ZmqSocket; class ZmqSocket;
@ -57,7 +57,7 @@ struct sharedMultiSlsDetector {
slsDetectorDefs::xy numberOfDetector; slsDetectorDefs::xy numberOfDetector;
/** max number of channels for complete detector*/ /** max number of channels for complete detector*/
slsDetectorDefs::xy numberOfChannels; slsDetectorDefs::xy numberOfChannels;
/** flag for acquiring */ /** flag for acquiring */
bool acquiringFlag; bool acquiringFlag;
@ -309,7 +309,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* @param port starting port number * @param port starting port number
*/ */
void setVirtualDetectorServers(const int numdet, const int port); void setVirtualDetectorServers(const int numdet, const int port);
/** /**
* Sets the hostname of all sls detectors in shared memory and updates local * Sets the hostname of all sls detectors in shared memory and updates local
* cache * cache
@ -347,7 +347,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* @returns detector type of sls detector in position pos, if -1, returns * @returns detector type of sls detector in position pos, if -1, returns
* the first det type * the first det type
*/ */
detectorType getDetectorTypeAsEnum(int detPos);// detectorType getDetectorTypeAsEnum(int detPos); //
/** /**
* Concatenates string types of all sls detectors or * Concatenates string types of all sls detectors or
@ -356,25 +356,27 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* @returns detector type of sls detector in position pos, if -1, * @returns detector type of sls detector in position pos, if -1,
* concatenates * concatenates
*/ */
std::string getDetectorTypeAsString(int detPos = -1);// std::string getDetectorTypeAsString(int detPos = -1); //
/** /**
* Returns the number of detectors in the multidetector structure * Returns the number of detectors in the multidetector structure
* @returns number of detectors * @returns number of detectors
*/ */
size_t size() const;// size_t size() const; //
/** /**
* Returns the number of detectors in each direction * Returns the number of detectors in each direction
*/ */
slsDetectorDefs::xy getNumberOfDetectors() const;// slsDetectorDefs::xy getNumberOfDetectors() const; //
/** /**
* Returns the total number of channels of all sls detectors including gap pixels * Returns the total number of channels of all sls detectors including gap
* pixels
* @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 the total number of channels of all sls detectors including gap pixels * @returns the total number of channels of all sls detectors including gap
* pixels
*/ */
slsDetectorDefs::xy getNumberOfChannels(int detPos = -1) const;// slsDetectorDefs::xy getNumberOfChannels(int detPos = -1) const; //
/** /**
* Must be set before setting hostname * Must be set before setting hostname
@ -382,35 +384,35 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* dimension d from shared memory * dimension d from shared memory
* @param c maximum number of channels of all sls detectors * @param c maximum number of channels of all sls detectors
*/ */
void setNumberOfChannels(const slsDetectorDefs::xy c); // void setNumberOfChannels(const slsDetectorDefs::xy c); //
/** /**
* Get Quad Type (Only for Eiger Quad detector hardware) * Get Quad Type (Only for Eiger Quad detector hardware)
* @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 quad type * @returns quad type
*/ */
int getQuad(int detPos = -1);// int getQuad(int detPos = -1); //
/** /**
* Set Quad Type (Only for Eiger Quad detector hardware) * Set Quad Type (Only for Eiger Quad detector hardware)
* @param enable true if quad type set, else false * @param enable true if quad type set, else false
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
*/ */
void setQuad(const bool enable, int detPos = -1);// void setQuad(const bool enable, int detPos = -1); //
/** /**
* Set number of rows to read out (Only for Eiger) * Set number of rows to read out (Only for Eiger)
* @param value number of lines * @param value number of lines
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
*/ */
void setReadNLines(const int value, int detPos = -1);// void setReadNLines(const int value, int detPos = -1); //
/** /**
* Get number of rows to read out (Only for Eiger) * Get number of rows to read out (Only for Eiger)
* @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 number of lines * @returns number of lines
*/ */
int getReadNLines(int detPos = -1);// int getReadNLines(int detPos = -1); //
/** /**
* Set/Gets TCP Port of the detector * Set/Gets TCP Port of the detector
@ -418,7 +420,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 port number * @returns port number
*/ */
int setControlPort(int port_number = -1, int detPos = -1);// int setControlPort(int port_number = -1, int detPos = -1); //
/** /**
* Set/Gets TCP STOP Port of the detector * Set/Gets TCP STOP Port of the detector
@ -426,7 +428,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 port number * @returns port number
*/ */
int setStopPort(int port_number = -1, int detPos = -1);// int setStopPort(int port_number = -1, int detPos = -1); //
/** /**
* Set/Gets TCP Port of the receiver * Set/Gets TCP Port of the receiver
@ -434,14 +436,14 @@ 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 port number * @returns port number
*/ */
int setReceiverPort(int port_number = -1, int detPos = -1);// int setReceiverPort(int port_number = -1, int detPos = -1); //
/** /**
* Get Receiver port * Get Receiver port
* @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 vector of receiver port * @returns vector of receiver port
*/ */
int getReceiverPort(int detPos = -1) const;// int getReceiverPort(int detPos = -1) const; //
/** /**
* Lock server for this client IP * Lock server for this client IP
@ -449,27 +451,27 @@ 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 1 for locked or 0 for unlocked * @returns 1 for locked or 0 for unlocked
*/ */
int lockServer(int p = -1, int detPos = -1);// int lockServer(int p = -1, int detPos = -1); //
/** /**
* Get last client IP saved on detector server * Get last client IP saved on detector server
* @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 last client IP saved on detector server * @returns last client IP saved on detector server
*/ */
std::string getLastClientIP(int detPos = -1);// std::string getLastClientIP(int detPos = -1); //
/** /**
* Exit detector server * Exit detector server
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
*/ */
void exitServer(int detPos = -1);// void exitServer(int detPos = -1); //
/** /**
* Execute a command on the detector server * Execute a command on the detector server
* @param cmd command * @param cmd command
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
*/ */
void execCommand(const std::string &cmd, int detPos);// void execCommand(const std::string &cmd, int detPos); //
/** /**
* Load configuration from a configuration File * Load configuration from a configuration File
@ -481,14 +483,14 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* Write current configuration to a file * Write current configuration to a file
* @param fname configuration file name * @param fname configuration file name
*/ */
void writeConfigurationFile(const std::string &fname);// void writeConfigurationFile(const std::string &fname); //
/** /**
* Get detector settings * Get detector settings
* @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 current settings * @returns current settings
*/ */
detectorSettings getSettings(int detPos = -1);// detectorSettings getSettings(int detPos = -1); //
/** /**
* Load detector settings from the settings file picked from the * Load detector settings from the settings file picked from the
@ -498,14 +500,15 @@ 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 current settings * @returns current settings
*/ */
detectorSettings setSettings(detectorSettings isettings, int detPos = -1);// detectorSettings setSettings(detectorSettings isettings,
int detPos = -1); //
/** /**
* Get threshold energy (Eiger) * Get threshold energy (Eiger)
* @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 current threshold value for imod in ev (-1 failed) * @returns current threshold value for imod in ev (-1 failed)
*/ */
int getThresholdEnergy(int detPos = -1);// int getThresholdEnergy(int detPos = -1); //
/** /**
* Set threshold energy (Eiger) * Set threshold energy (Eiger)
@ -516,14 +519,14 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* @returns current threshold value for imod in ev (-1 failed) * @returns current threshold value for imod in ev (-1 failed)
*/ */
int setThresholdEnergy(int e_eV, detectorSettings isettings = GET_SETTINGS, int setThresholdEnergy(int e_eV, detectorSettings isettings = GET_SETTINGS,
int tb = 1, int detPos = -1);// int tb = 1, int detPos = -1); //
/** /**
* Returns the detector trimbit/settings directory * Returns the detector trimbit/settings directory
* @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 the trimbit/settings directory * @returns the trimbit/settings directory
*/ */
std::string getSettingsDir(int detPos = -1);// std::string getSettingsDir(int detPos = -1); //
/** /**
* Sets the detector trimbit/settings directory * Sets the detector trimbit/settings directory
@ -531,7 +534,8 @@ 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 the trimbit/settings directory * @returns the trimbit/settings directory
*/ */
std::string setSettingsDir(const std::string &directory, int detPos = -1);// std::string setSettingsDir(const std::string &directory,
int detPos = -1); //
/** /**
* Loads the modules settings/trimbits reading from a specific file * Loads the modules settings/trimbits reading from a specific file
@ -539,7 +543,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* @param fname specific settings/trimbits file * @param fname specific settings/trimbits file
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
*/ */
void loadSettingsFile(const std::string &fname, int detPos = -1);// void loadSettingsFile(const std::string &fname, int detPos = -1); //
/** /**
* Saves the modules settings/trimbits to a specific file * Saves the modules settings/trimbits to a specific file
@ -547,34 +551,32 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* @param fname specific settings/trimbits file * @param fname specific settings/trimbits file
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
*/ */
void saveSettingsFile(const std::string &fname, int detPos = -1);// void saveSettingsFile(const std::string &fname, int detPos = -1); //
/** /**
* Get Detector run status * Get Detector run status
* @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 status * @returns status
*/ */
runStatus getRunStatus(int detPos = -1);// runStatus getRunStatus(int detPos = -1); //
/** /**
* Start detector acquisition (Non blocking) * Start detector acquisition (Non blocking)
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
*/ */
void startAcquisition(int detPos = -1);// void startAcquisition(int detPos = -1); //
/** /**
* Stop detector acquisition * Stop detector acquisition
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
*/ */
void stopAcquisition(int detPos = -1);// void stopAcquisition(int detPos = -1); //
/** /**
* Give an internal software trigger to the detector (Eiger only) * Give an internal software trigger to the detector (Eiger only)
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
*/ */
void sendSoftwareTrigger(int detPos = -1);// void sendSoftwareTrigger(int detPos = -1); //
/** /**
* Configures in detector the destination for UDP packets * Configures in detector the destination for UDP packets
@ -601,7 +603,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* @param index timer index * @param index timer index
* @param t time in ns or number of...(e.g. frames, probes) * @param t time in ns or number of...(e.g. frames, probes)
* @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 timer set value in ns or number of...(e.g. frames, * @returns timer set value in ns or number of...(e.g. frames,
* probes) * probes)
*/ */
int64_t setTimer(timerIndex index, int64_t t = -1, int detPos = -1); // int64_t setTimer(timerIndex index, int64_t t = -1, int detPos = -1); //
@ -634,7 +636,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* @returns delay after trigger in ns, or s if specified * @returns delay after trigger in ns, or s if specified
*/ */
double setDelayAfterTrigger(double t = -1, bool inseconds = false, double setDelayAfterTrigger(double t = -1, bool inseconds = false,
int detPos = -1);// int detPos = -1); //
/** /**
* (Advanced users) * (Advanced users)
@ -656,7 +658,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* @returns sub frame dead time in ns, or s if specified * @returns sub frame dead time in ns, or s if specified
*/ */
double setSubFrameExposureDeadTime(double t = -1, bool inseconds = false, double setSubFrameExposureDeadTime(double t = -1, bool inseconds = false,
int detPos = -1);// int detPos = -1); //
/** /**
* Set/get number of frames * Set/get number of frames
@ -664,7 +666,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 number of frames * @returns number of frames
*/ */
int64_t setNumberOfFrames(int64_t t = -1, int detPos = -1);// int64_t setNumberOfFrames(int64_t t = -1, int detPos = -1); //
/** /**
* Set/get number of cycles * Set/get number of cycles
@ -672,7 +674,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 number of cycles * @returns number of cycles
*/ */
int64_t setNumberOfCycles(int64_t t = -1, int detPos = -1);// int64_t setNumberOfCycles(int64_t t = -1, int detPos = -1); //
/** /**
* Set/get number of additional storage cells (Jungfrau) * Set/get number of additional storage cells (Jungfrau)
@ -680,7 +682,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 number of additional storage cells * @returns number of additional storage cells
*/ */
int64_t setNumberOfStorageCells(int64_t t = -1, int detPos = -1);// int64_t setNumberOfStorageCells(int64_t t = -1, int detPos = -1); //
/** /**
* Get measured period between previous two frames (EIGER) * Get measured period between previous two frames (EIGER)
@ -689,7 +691,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 sub frame dead time in ns, or s if specified * @returns sub frame dead time in ns, or s if specified
*/ */
double getMeasuredPeriod(bool inseconds = false, int detPos = -1);// double getMeasuredPeriod(bool inseconds = false, int detPos = -1); //
/** /**
* Get sub period between previous two sub frames in 32 bit mode (EIGER) * Get sub period between previous two sub frames in 32 bit mode (EIGER)
@ -698,7 +700,8 @@ 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 sub frame dead time in ns, or s if specified * @returns sub frame dead time in ns, or s if specified
*/ */
double getMeasuredSubFramePeriod(bool inseconds = false, int detPos = -1);// double getMeasuredSubFramePeriod(bool inseconds = false,
int detPos = -1); //
/** /**
* Set/get timer value left in acquisition (not all implemented for all * Set/get timer value left in acquisition (not all implemented for all
@ -706,10 +709,10 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* @param index timer index * @param index timer index
* @param t time in ns or number of...(e.g. frames, probes) * @param t time in ns or number of...(e.g. frames, probes)
* @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 timer set value in ns or number of...(e.g. frames, * @returns timer set value in ns or number of...(e.g. frames,
* probes) * probes)
*/ */
int64_t getTimeLeft(timerIndex index, int detPos = -1);// int64_t getTimeLeft(timerIndex index, int detPos = -1); //
/** /**
* Set speed * Set speed
@ -723,7 +726,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* @returns value of speed set * @returns value of speed set
*/ */
int setSpeed(speedVariable index, int value = -1, int mode = 0, int setSpeed(speedVariable index, int value = -1, int mode = 0,
int detPos = -1);// int detPos = -1); //
/** /**
* Set/get dynamic range and updates the number of dataBytes * Set/get dynamic range and updates the number of dataBytes
@ -733,7 +736,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 current dynamic range * @returns current dynamic range
*/ */
int setDynamicRange(int dr = -1, int detPos = -1);// int setDynamicRange(int dr = -1, int detPos = -1); //
/** /**
* Set/get dacs value * Set/get dacs value
@ -743,7 +746,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 current DAC value * @returns current DAC value
*/ */
int setDAC(int val, dacIndex index, int mV, int detPos = -1);// int setDAC(int val, dacIndex index, int mV, int detPos = -1); //
/** /**
* Get adc value * Get adc value
@ -752,7 +755,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* @returns current adc value (temperature for eiger and jungfrau in * @returns current adc value (temperature for eiger and jungfrau in
* millidegrees) * millidegrees)
*/ */
int getADC(dacIndex index, int detPos = -1);// int getADC(dacIndex index, int detPos = -1); //
/** /**
* Set/get timing mode * Set/get timing mode
@ -760,7 +763,8 @@ 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 current timing mode * @returns current timing mode
*/ */
timingMode setTimingMode(timingMode pol = GET_TIMING_MODE, int detPos = -1);// timingMode setTimingMode(timingMode pol = GET_TIMING_MODE,
int detPos = -1); //
/** /**
* Set/get external signal flags (to specify triggerinrising edge etc) * Set/get external signal flags (to specify triggerinrising edge etc)
@ -771,7 +775,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)
@ -780,7 +784,8 @@ 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)
@ -837,7 +842,8 @@ 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 the detector MAC address * @returns the detector MAC address
*/ */
std::string setDetectorMAC(const std::string &detectorMAC, int detPos = -1); // std::string setDetectorMAC(const std::string &detectorMAC,
int detPos = -1); //
/** /**
* Returns the detector MAC address * Returns the detector MAC address
@ -870,7 +876,8 @@ 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 the detector IP address * @returns the detector IP address
*/ */
std::string setDetectorIP(const std::string &detectorIP, int detPos = -1); // std::string setDetectorIP(const std::string &detectorIP,
int detPos = -1); //
/** /**
* Returns the detector IP address * Returns the detector IP address
@ -886,7 +893,8 @@ 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 the detector IP address (bottom half) * @returns the detector IP address (bottom half)
*/ */
std::string setDetectorIP2(const std::string &detectorIP, int detPos = -1); // std::string setDetectorIP2(const std::string &detectorIP,
int detPos = -1); //
/** /**
* Returns the detector IP address (bottom half) Jungfrau only * Returns the detector IP address (bottom half) Jungfrau only
@ -952,14 +960,15 @@ 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 the receiver UDP MAC address * @returns the receiver UDP MAC address
*/ */
std::string setReceiverUDPMAC(const std::string &udpmac, int detPos = -1);// std::string setReceiverUDPMAC(const std::string &udpmac,
int detPos = -1); //
/** /**
* Returns the receiver UDP MAC address * Returns the receiver UDP MAC address
* @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 the receiver UDP MAC address * @returns the receiver UDP MAC address
*/ */
std::string getReceiverUDPMAC(int detPos = -1) const; // std::string getReceiverUDPMAC(int detPos = -1) const; //
/** /**
* Validates the format of the receiver UDP MAC address (bottom half) and * Validates the format of the receiver UDP MAC address (bottom half) and
@ -1127,7 +1136,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* @returns transmission delay * @returns transmission delay
*/ */
int setDetectorNetworkParameter(networkParameter index, int delay, int setDetectorNetworkParameter(networkParameter index, int delay,
int detPos = -1); //maybe not needed in API int detPos = -1); // maybe not needed in API
/** /**
* Sets the additional json header * Sets the additional json header
@ -1311,8 +1320,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
*/ */
int getExternalSamplingSource(int detPos = -1); // int getExternalSamplingSource(int detPos = -1); //
/** /**
* Set external sampling enable (CTB only) * Set external sampling enable (CTB only)
* @param value external sampling source (Option: 0-63) * @param value external sampling source (Option: 0-63)
@ -1414,7 +1421,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
*/ */
int enableGapPixels(int val = -1, int detPos = -1); // int enableGapPixels(int val = -1, int detPos = -1); //
void setGapPixelsEnable(bool enable, sls::Positions pos = {}); void setGapPixelsEnable(bool enable, sls::Positions pos = {});
/** /**
* Sets the number of trim energies and their value (Eiger) * Sets the number of trim energies and their value (Eiger)
@ -1450,14 +1456,14 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* @param y is relative y value * @param y is relative y value
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
*/ */
void pulsePixelNMove(int n = 0, int x = 0, int y = 0, int detPos = -1);// void pulsePixelNMove(int n = 0, int x = 0, int y = 0, int detPos = -1); //
/** /**
* Pulse Chip (Eiger) * Pulse Chip (Eiger)
* @param n is number of times to pulse * @param n is number of times to pulse
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
*/ */
void pulseChip(int n = 0, int detPos = -1);// void pulseChip(int n = 0, int detPos = -1); //
/** /**
* Set/gets threshold temperature (Jungfrau) * Set/gets threshold temperature (Jungfrau)
@ -1489,7 +1495,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 the storage cell that stores the first acquisition of the series * @returns the storage cell that stores the first acquisition of the series
*/ */
int setStoragecellStart(int pos = -1, int detPos = -1);// int setStoragecellStart(int pos = -1, int detPos = -1); //
/** /**
* Programs FPGA with pof file (Jungfrau, CTB, Moench) * Programs FPGA with pof file (Jungfrau, CTB, Moench)
@ -2066,11 +2072,11 @@ class multiSlsDetector : public virtual slsDetectorDefs {
*/ */
void updateUserdetails(); void updateUserdetails();
/** /**
* Prepares detector for acquisition (Eiger) * Prepares detector for acquisition (Eiger)
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
*/ */
void prepareAcquisition(int detPos = -1);// void prepareAcquisition(int detPos = -1); //
/** /**
* Check if acquiring flag is set, set error if set * Check if acquiring flag is set, set error if set
@ -2087,11 +2093,11 @@ class multiSlsDetector : public virtual slsDetectorDefs {
/** /**
* Appends detectors to the end of the list in shared memory * Appends detectors to the end of the list in shared memory
* Connects to them * Connects to them
* @param name concatenated hostname of the sls detectors to be appended to * @param name concatenated hostname of the sls detectors to be appended to
* the list * the list
*/ */
void addMultipleDetectors(const char *name);// void addMultipleDetectors(const char *name); //
/** /**
* Add sls detector * Add sls detector
@ -2101,11 +2107,11 @@ class multiSlsDetector : public virtual slsDetectorDefs {
/** /**
* Updates the channel size in X and Y dimension for all the sls * Updates the channel size in X and Y dimension for all the sls
* detectors * detectors
*/ */
void updateDetectorSize(); void updateDetectorSize();
/** /**
* increments file index * increments file index
* @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 the file index * @returns the file index
@ -2168,20 +2174,20 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* acquisition) * acquisition)
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
*/ */
void startAndReadAll(int detPos = -1);// void startAndReadAll(int detPos = -1); //
/** /**
* Start readout (without exposure or interrupting exposure) (Eiger store in * Start readout (without exposure or interrupting exposure) (Eiger store in
* ram) * ram)
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
*/ */
void startReadOut(int detPos = -1);// void startReadOut(int detPos = -1); //
/** /**
* Requests and receives all data from the detector (Eiger store in ram) * Requests and receives all data from the detector (Eiger store in ram)
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
*/ */
void readAll(int detPos = -1);// void readAll(int detPos = -1); //
/** /**
* Check if processing thread is ready to join main thread * Check if processing thread is ready to join main thread
@ -2201,8 +2207,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
*/ */
int kbhit(); int kbhit();
/** /**
* Convert a double holding time in seconds to an int64_t with nano seconds * Convert a double holding time in seconds to an int64_t with nano seconds
* Used for conversion when sending time to detector * Used for conversion when sending time to detector

View File

@ -322,7 +322,7 @@ class slsDetector : public virtual slsDetectorDefs {
* Returns the total number of channels including gap pixels * Returns the total number of channels including gap pixels
* @returns the total number of channels including gap pixels * @returns the total number of channels including gap pixels
*/ */
slsDetectorDefs::xy getNumberOfChannels() const; slsDetectorDefs::xy getNumberOfChannels() const;
/** /**
* Get Quad Type (Only for Eiger Quad detector hardware) * Get Quad Type (Only for Eiger Quad detector hardware)
@ -336,7 +336,7 @@ class slsDetector : public virtual slsDetectorDefs {
*/ */
void setQuad(const bool enable); void setQuad(const bool enable);
/** /**
* Set number of rows to read out (Only for Eiger) * Set number of rows to read out (Only for Eiger)
* @param value number of lines * @param value number of lines
*/ */
@ -354,7 +354,6 @@ class slsDetector : public virtual slsDetectorDefs {
*/ */
void updateMultiSize(slsDetectorDefs::xy det); void updateMultiSize(slsDetectorDefs::xy det);
int setControlPort(int port_number); int setControlPort(int port_number);
/** /**
@ -557,7 +556,7 @@ class slsDetector : public virtual slsDetectorDefs {
* Set/get timer value (not all implemented for all detectors) * Set/get timer value (not all implemented for all detectors)
* @param index timer index * @param index timer index
* @param t time in ns or number of...(e.g. frames, probes) * @param t time in ns or number of...(e.g. frames, probes)
* @returns timer set value in ns or number of...(e.g. frames, * @returns timer set value in ns or number of...(e.g. frames,
* probes) * probes)
*/ */
int64_t setTimer(timerIndex index, int64_t t = -1); int64_t setTimer(timerIndex index, int64_t t = -1);
@ -567,7 +566,7 @@ class slsDetector : public virtual slsDetectorDefs {
* detectors) * detectors)
* @param index timer index * @param index timer index
* @param t time in ns or number of...(e.g. frames, probes) * @param t time in ns or number of...(e.g. frames, probes)
* @returns timer set value in ns or number of...(e.g. frames, * @returns timer set value in ns or number of...(e.g. frames,
* probes) * probes)
*/ */
int64_t getTimeLeft(timerIndex index) const; int64_t getTimeLeft(timerIndex index) const;
@ -585,7 +584,7 @@ class slsDetector : public virtual slsDetectorDefs {
int setSpeed(speedVariable sp, int value = -1, int mode = 0); int setSpeed(speedVariable sp, int value = -1, int mode = 0);
/** /**
* Set/get dynamic range * Set/get dynamic range
* (Eiger: If i is 32, also sets clkdivider to 2, if 16, sets clkdivider to * (Eiger: If i is 32, also sets clkdivider to 2, if 16, sets clkdivider to
* 1) * 1)
* @param i dynamic range (-1 get) * @param i dynamic range (-1 get)
@ -1007,7 +1006,7 @@ class slsDetector : public virtual slsDetectorDefs {
void setROI(slsDetectorDefs::ROI arg); void setROI(slsDetectorDefs::ROI arg);
/** /**
* Send ROI from shared memory to Receiver (Gotthard) * Send ROI from shared memory to Receiver (Gotthard)
*/ */
void sendROItoReceiver(); void sendROItoReceiver();
@ -1701,31 +1700,30 @@ class slsDetector : public virtual slsDetectorDefs {
void sendToDetectorStop(int fnum, const void *args, size_t args_size, void sendToDetectorStop(int fnum, const void *args, size_t args_size,
void *retval, size_t retval_size); void *retval, size_t retval_size);
void sendToDetectorStop(int fnum, const void *args, size_t args_size, void sendToDetectorStop(int fnum, const void *args, size_t args_size,
void *retval, size_t retval_size) const; void *retval, size_t retval_size) const;
template <typename Arg, typename Ret> template <typename Arg, typename Ret>
void sendToDetectorStop(int fnum, const Arg &args, Ret &retval); void sendToDetectorStop(int fnum, const Arg &args, Ret &retval);
template <typename Arg, typename Ret> template <typename Arg, typename Ret>
void sendToDetectorStop(int fnum, const Arg &args, Ret &retval) const; void sendToDetectorStop(int fnum, const Arg &args, Ret &retval) const;
template <typename Arg> template <typename Arg>
void sendToDetectorStop(int fnum, const Arg &args, std::nullptr_t); void sendToDetectorStop(int fnum, const Arg &args, std::nullptr_t);
template <typename Arg> template <typename Arg>
void sendToDetectorStop(int fnum, const Arg &args, std::nullptr_t) const; void sendToDetectorStop(int fnum, const Arg &args, std::nullptr_t) const;
template <typename Ret> template <typename Ret>
void sendToDetectorStop(int fnum, std::nullptr_t, Ret &retval); void sendToDetectorStop(int fnum, std::nullptr_t, Ret &retval);
template <typename Ret> template <typename Ret>
void sendToDetectorStop(int fnum, std::nullptr_t, Ret &retval) const; void sendToDetectorStop(int fnum, std::nullptr_t, Ret &retval) const;
void sendToDetectorStop(int fnum); void sendToDetectorStop(int fnum);
void sendToDetectorStop(int fnum) const; void sendToDetectorStop(int fnum) const;
/** /**
* Send function parameters to receiver * Send function parameters to receiver
@ -1738,30 +1736,30 @@ class slsDetector : public virtual slsDetectorDefs {
void sendToReceiver(int fnum, const void *args, size_t args_size, void sendToReceiver(int fnum, const void *args, size_t args_size,
void *retval, size_t retval_size); void *retval, size_t retval_size);
void sendToReceiver(int fnum, const void *args, size_t args_size, void sendToReceiver(int fnum, const void *args, size_t args_size,
void *retval, size_t retval_size) const; void *retval, size_t retval_size) const;
template <typename Arg, typename Ret> template <typename Arg, typename Ret>
void sendToReceiver(int fnum, const Arg &args, Ret &retval); void sendToReceiver(int fnum, const Arg &args, Ret &retval);
template <typename Arg, typename Ret> template <typename Arg, typename Ret>
void sendToReceiver(int fnum, const Arg &args, Ret &retval) const; void sendToReceiver(int fnum, const Arg &args, Ret &retval) const;
template <typename Arg> template <typename Arg>
void sendToReceiver(int fnum, const Arg &args, std::nullptr_t); void sendToReceiver(int fnum, const Arg &args, std::nullptr_t);
template <typename Arg> template <typename Arg>
void sendToReceiver(int fnum, const Arg &args, std::nullptr_t) const; void sendToReceiver(int fnum, const Arg &args, std::nullptr_t) const;
template <typename Ret> template <typename Ret>
void sendToReceiver(int fnum, std::nullptr_t, Ret &retval); void sendToReceiver(int fnum, std::nullptr_t, Ret &retval);
template <typename Ret> template <typename Ret>
void sendToReceiver(int fnum, std::nullptr_t, Ret &retval) const; void sendToReceiver(int fnum, std::nullptr_t, Ret &retval) const;
void sendToReceiver(int fnum); void sendToReceiver(int fnum);
void sendToReceiver(int fnum) const; void sendToReceiver(int fnum) const;
/** /**
* Get Detector Type from Shared Memory (opening shm without verifying size) * Get Detector Type from Shared Memory (opening shm without verifying size)

View File

@ -52,8 +52,7 @@ Result<int64_t> Detector::getReceiverVersion(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReceiverSoftwareVersion, pos); return pimpl->Parallel(&slsDetector::getReceiverSoftwareVersion, pos);
} }
Result<defs::detectorType> Result<defs::detectorType> Detector::getDetectorType(Positions pos) const {
Detector::getDetectorType(Positions pos) const {
return pimpl->Parallel(&slsDetector::getDetectorTypeAsEnum, pos); return pimpl->Parallel(&slsDetector::getDetectorTypeAsEnum, pos);
} }
@ -83,8 +82,6 @@ void Detector::setSettings(defs::detectorSettings value, Positions pos) {
pimpl->Parallel(&slsDetector::setSettings, pos, value); pimpl->Parallel(&slsDetector::setSettings, pos, value);
} }
// Acquisition Parameters // Acquisition Parameters
Result<int64_t> Detector::getNumberOfFrames() const { Result<int64_t> Detector::getNumberOfFrames() const {
@ -103,7 +100,6 @@ void Detector::setNumberOfTriggers(int64_t value) {
pimpl->Parallel(&slsDetector::setTimer, {}, defs::CYCLES_NUMBER, value); pimpl->Parallel(&slsDetector::setTimer, {}, defs::CYCLES_NUMBER, value);
} }
Result<ns> Detector::getExptime(Positions pos) const { Result<ns> Detector::getExptime(Positions pos) const {
return pimpl->Parallel(&slsDetector::setTimer, pos, defs::ACQUISITION_TIME, return pimpl->Parallel(&slsDetector::setTimer, pos, defs::ACQUISITION_TIME,
-1); -1);
@ -184,7 +180,8 @@ void Detector::setHighVoltage(int value, Positions pos) {
pimpl->Parallel(&slsDetector::setDAC, pos, value, defs::HIGH_VOLTAGE, 0); pimpl->Parallel(&slsDetector::setDAC, pos, value, defs::HIGH_VOLTAGE, 0);
} }
Result<int> Detector::getTemperature(defs::dacIndex index, Positions pos) const { Result<int> Detector::getTemperature(defs::dacIndex index,
Positions pos) const {
switch (index) { switch (index) {
case defs::TEMPERATURE_ADC: case defs::TEMPERATURE_ADC:
case defs::TEMPERATURE_FPGA: case defs::TEMPERATURE_FPGA:
@ -232,8 +229,6 @@ void Detector::setTimingMode(defs::timingMode value, Positions pos) {
pimpl->Parallel(&slsDetector::setTimingMode, pos, value); pimpl->Parallel(&slsDetector::setTimingMode, pos, value);
} }
// Acquisition // Acquisition
void Detector::acquire() { pimpl->acquire(); } void Detector::acquire() { pimpl->acquire(); }
@ -244,15 +239,15 @@ void Detector::startAcquisition() {
pimpl->Parallel(&slsDetector::startAcquisition, {}); pimpl->Parallel(&slsDetector::startAcquisition, {});
} }
void Detector::stopAcquisition() { void Detector::stopAcquisition() {
pimpl->Parallel(&slsDetector::stopAcquisition, {}); pimpl->Parallel(&slsDetector::stopAcquisition, {});
if (getUseReceiverFlag({}).squash()) //TODO: problem for acquire() if (getUseReceiverFlag({}).squash()) // TODO: problem for acquire()
pimpl->Parallel(&slsDetector::stopReceiver, {}); pimpl->Parallel(&slsDetector::stopReceiver, {});
} }
void Detector::clearAcquiringFlag() { pimpl->setAcquiringFlag(0); } void Detector::clearAcquiringFlag() { pimpl->setAcquiringFlag(0); }
Result<defs::runStatus> Detector::getDetectorStatus(Positions pos) const{ Result<defs::runStatus> Detector::getDetectorStatus(Positions pos) const {
return pimpl->Parallel(&slsDetector::getRunStatus, pos); return pimpl->Parallel(&slsDetector::getRunStatus, pos);
} }
@ -276,8 +271,6 @@ void Detector::sendSoftwareTrigger(Positions pos) {
pimpl->Parallel(&slsDetector::sendSoftwareTrigger, pos); pimpl->Parallel(&slsDetector::sendSoftwareTrigger, pos);
} }
// Network Configuration (Detector<->Receiver) // Network Configuration (Detector<->Receiver)
void Detector::configureMAC(Positions pos) { void Detector::configureMAC(Positions pos) {
@ -383,7 +376,8 @@ void Detector::setDestinationUDPPort(int port, int module_id) {
if (module_id == -1) { if (module_id == -1) {
std::vector<int> port_list = getPortNumbers(port); std::vector<int> port_list = getPortNumbers(port);
for (int idet = 0; idet < size(); ++idet) { for (int idet = 0; idet < size(); ++idet) {
pimpl->Parallel(&slsDetector::setReceiverUDPPort, {idet}, port_list[idet]); pimpl->Parallel(&slsDetector::setReceiverUDPPort, {idet},
port_list[idet]);
} }
} else { } else {
pimpl->Parallel(&slsDetector::setReceiverUDPPort, {module_id}, port); pimpl->Parallel(&slsDetector::setReceiverUDPPort, {module_id}, port);
@ -398,10 +392,11 @@ void Detector::setDestinationUDPPort2(int port, int module_id) {
if (module_id == -1) { if (module_id == -1) {
std::vector<int> port_list = getPortNumbers(port); std::vector<int> port_list = getPortNumbers(port);
for (int idet = 0; idet < size(); ++idet) { for (int idet = 0; idet < size(); ++idet) {
pimpl->Parallel(&slsDetector::setReceiverUDPPort2, {idet}, port_list[idet]); pimpl->Parallel(&slsDetector::setReceiverUDPPort2, {idet},
port_list[idet]);
} }
} else { } else {
pimpl->Parallel(&slsDetector::setReceiverUDPPort2, {module_id}, port ); pimpl->Parallel(&slsDetector::setReceiverUDPPort2, {module_id}, port);
} }
} }
@ -458,8 +453,6 @@ void Detector::setTransmissionDelayRight(int value, Positions pos) {
defs::DETECTOR_TXN_DELAY_RIGHT, value); defs::DETECTOR_TXN_DELAY_RIGHT, value);
} }
// Receiver // Receiver
Result<bool> Detector::getUseReceiverFlag(Positions pos) const { Result<bool> Detector::getUseReceiverFlag(Positions pos) const {
@ -506,7 +499,7 @@ Detector::getRxFrameDiscardPolicy(Positions pos) const {
} }
void Detector::setRxFrameDiscardPolicy(defs::frameDiscardPolicy f, void Detector::setRxFrameDiscardPolicy(defs::frameDiscardPolicy f,
Positions pos) { Positions pos) {
pimpl->Parallel(&slsDetector::setReceiverFramesDiscardPolicy, pos, f); pimpl->Parallel(&slsDetector::setReceiverFramesDiscardPolicy, pos, f);
} }
@ -522,14 +515,12 @@ Result<int64_t> Detector::getRxUDPSocketBufferSize(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReceiverUDPSocketBufferSize, pos); return pimpl->Parallel(&slsDetector::getReceiverUDPSocketBufferSize, pos);
} }
void Detector::setRxUDPSocketBufferSize(int64_t udpsockbufsize, void Detector::setRxUDPSocketBufferSize(int64_t udpsockbufsize, Positions pos) {
Positions pos) {
pimpl->Parallel(&slsDetector::setReceiverUDPSocketBufferSize, pos, pimpl->Parallel(&slsDetector::setReceiverUDPSocketBufferSize, pos,
udpsockbufsize); udpsockbufsize);
} }
Result<int64_t> Result<int64_t> Detector::getRxRealUDPSocketBufferSize(Positions pos) const {
Detector::getRxRealUDPSocketBufferSize(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReceiverRealUDPSocketBufferSize, return pimpl->Parallel(&slsDetector::getReceiverRealUDPSocketBufferSize,
pos); pos);
} }
@ -546,8 +537,6 @@ Result<std::string> Detector::getRxLastClientIP(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReceiverLastClientIP, pos); return pimpl->Parallel(&slsDetector::getReceiverLastClientIP, pos);
} }
// File // File
Result<defs::fileFormat> Detector::getFileFormat(Positions pos) const { Result<defs::fileFormat> Detector::getFileFormat(Positions pos) const {
@ -613,12 +602,11 @@ void Detector::setFramesPerFile(int n, Positions pos) {
pimpl->Parallel(&slsDetector::setFramesPerFile, pos, n); pimpl->Parallel(&slsDetector::setFramesPerFile, pos, n);
} }
// Zmq Streaming (Receiver<->Client) // Zmq Streaming (Receiver<->Client)
Result<bool> Detector::getRxZmqDataStream(Positions pos) const { Result<bool> Detector::getRxZmqDataStream(Positions pos) const {
return pimpl->Parallel(&slsDetector::enableDataStreamingFromReceiver, pos, -1); return pimpl->Parallel(&slsDetector::enableDataStreamingFromReceiver, pos,
-1);
} }
void Detector::setRxZmqDataStream(bool enable, Positions pos) { void Detector::setRxZmqDataStream(bool enable, Positions pos) {
@ -650,10 +638,12 @@ void Detector::setRxZmqPort(int port, int module_id) {
if (module_id == -1) { if (module_id == -1) {
std::vector<int> port_list = getPortNumbers(port); std::vector<int> port_list = getPortNumbers(port);
for (int idet = 0; idet < size(); ++idet) { for (int idet = 0; idet < size(); ++idet) {
pimpl->Parallel(&slsDetector::setReceiverStreamingPort, {idet}, port_list[idet]); pimpl->Parallel(&slsDetector::setReceiverStreamingPort, {idet},
port_list[idet]);
} }
} else { } else {
pimpl->Parallel(&slsDetector::setReceiverStreamingPort, {module_id}, port); pimpl->Parallel(&slsDetector::setReceiverStreamingPort, {module_id},
port);
} }
} }
@ -661,10 +651,8 @@ Result<std::string> Detector::getRxZmqIP(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReceiverStreamingIP, pos); return pimpl->Parallel(&slsDetector::getReceiverStreamingIP, pos);
} }
void Detector::setRxZmqIP(const std::string &ip, void Detector::setRxZmqIP(const std::string &ip, Positions pos) {
Positions pos) { bool previouslyReceiverStreaming = getRxZmqDataStream(pos).squash(false);
bool previouslyReceiverStreaming =
getRxZmqDataStream(pos).squash(false);
pimpl->Parallel(&slsDetector::setReceiverStreamingIP, pos, ip); pimpl->Parallel(&slsDetector::setReceiverStreamingIP, pos, ip);
if (previouslyReceiverStreaming) { if (previouslyReceiverStreaming) {
setRxZmqDataStream(false, pos); setRxZmqDataStream(false, pos);
@ -680,10 +668,12 @@ void Detector::setClientZmqPort(int port, int module_id) {
if (module_id == -1) { if (module_id == -1) {
std::vector<int> port_list = getPortNumbers(port); std::vector<int> port_list = getPortNumbers(port);
for (int idet = 0; idet < size(); ++idet) { for (int idet = 0; idet < size(); ++idet) {
pimpl->Parallel(&slsDetector::setClientStreamingPort, {idet}, port_list[idet]); pimpl->Parallel(&slsDetector::setClientStreamingPort, {idet},
port_list[idet]);
} }
} else { } else {
pimpl->Parallel(&slsDetector::setClientStreamingPort, {module_id}, port); pimpl->Parallel(&slsDetector::setClientStreamingPort, {module_id},
port);
} }
} }
@ -691,8 +681,7 @@ Result<std::string> Detector::getClientZmqIp(Positions pos) const {
return pimpl->Parallel(&slsDetector::getClientStreamingIP, pos); return pimpl->Parallel(&slsDetector::getClientStreamingIP, pos);
} }
void Detector::setClientZmqIp(const std::string &ip, void Detector::setClientZmqIp(const std::string &ip, Positions pos) {
Positions pos) {
int previouslyClientStreaming = pimpl->enableDataStreamingToClient(-1); int previouslyClientStreaming = pimpl->enableDataStreamingToClient(-1);
pimpl->Parallel(&slsDetector::setClientStreamingIP, pos, ip); pimpl->Parallel(&slsDetector::setClientStreamingIP, pos, ip);
if (previouslyClientStreaming != 0) { if (previouslyClientStreaming != 0) {
@ -701,8 +690,6 @@ void Detector::setClientZmqIp(const std::string &ip,
} }
} }
// Eiger Specific // Eiger Specific
Result<int> Detector::getDynamicRange(Positions pos) const { Result<int> Detector::getDynamicRange(Positions pos) const {
@ -711,7 +698,6 @@ Result<int> Detector::getDynamicRange(Positions pos) const {
void Detector::setDynamicRange(int value) { pimpl->setDynamicRange(value); } void Detector::setDynamicRange(int value) { pimpl->setDynamicRange(value); }
Result<ns> Detector::getSubExptime(Positions pos) const { Result<ns> Detector::getSubExptime(Positions pos) const {
return pimpl->Parallel(&slsDetector::setTimer, pos, return pimpl->Parallel(&slsDetector::setTimer, pos,
defs::SUBFRAME_ACQUISITION_TIME, -1); defs::SUBFRAME_ACQUISITION_TIME, -1);
@ -736,9 +722,11 @@ Result<int> Detector::getThresholdEnergy(Positions pos) const {
return pimpl->Parallel(&slsDetector::getThresholdEnergy, pos); return pimpl->Parallel(&slsDetector::getThresholdEnergy, pos);
} }
void Detector::setThresholdEnergy(int threshold_ev, defs::detectorSettings settings, void Detector::setThresholdEnergy(int threshold_ev,
defs::detectorSettings settings,
bool trimbits, Positions pos) { bool trimbits, Positions pos) {
pimpl->Parallel(&slsDetector::setThresholdEnergy, pos, threshold_ev, settings, static_cast<int>(trimbits)); pimpl->Parallel(&slsDetector::setThresholdEnergy, pos, threshold_ev,
settings, static_cast<int>(trimbits));
} }
Result<std::string> Detector::getSettingsDir(Positions pos) const { Result<std::string> Detector::getSettingsDir(Positions pos) const {
@ -796,7 +784,8 @@ Result<bool> Detector::getBottom(Positions pos) const {
} }
void Detector::setBottom(bool value, Positions pos) { void Detector::setBottom(bool value, Positions pos) {
pimpl->Parallel(&slsDetector::setFlippedDataX, pos, static_cast<int>(value)); pimpl->Parallel(&slsDetector::setFlippedDataX, pos,
static_cast<int>(value));
} }
Result<int> Detector::getAllTrimbits(Positions pos) const { Result<int> Detector::getAllTrimbits(Positions pos) const {
@ -874,7 +863,7 @@ void Detector::setPartialReset(bool value, Positions pos) {
pimpl->Parallel(&slsDetector::setCounterBit, pos, !value); pimpl->Parallel(&slsDetector::setCounterBit, pos, !value);
} }
void Detector::pulsePixel(int n,defs::xy pixel, Positions pos) { void Detector::pulsePixel(int n, defs::xy pixel, Positions pos) {
pimpl->Parallel(&slsDetector::pulsePixel, pos, n, pixel.x, pixel.y); pimpl->Parallel(&slsDetector::pulsePixel, pos, n, pixel.x, pixel.y);
} }
@ -890,11 +879,7 @@ Result<bool> Detector::getQuad(Positions pos) const {
return pimpl->Parallel(&slsDetector::getQuad, pos); return pimpl->Parallel(&slsDetector::getQuad, pos);
} }
void Detector::setQuad(const bool value) { void Detector::setQuad(const bool value) { pimpl->setQuad(value); }
pimpl->setQuad(value);
}
// Jungfrau Specific // Jungfrau Specific
@ -979,11 +964,8 @@ void Detector::setStorageCellDelay(ns value, Positions pos) {
value.count()); value.count());
} }
// Gotthard Specific // Gotthard Specific
Result<defs::ROI> Detector::getROI(Positions pos) const { Result<defs::ROI> Detector::getROI(Positions pos) const {
return pimpl->Parallel(&slsDetector::getROI, pos); return pimpl->Parallel(&slsDetector::getROI, pos);
} }
@ -1016,17 +998,15 @@ void Detector::setExternalSignalFlags(defs::externalSignalFlag value,
} }
Result<int> Detector::getImageTestMode(Positions pos) { Result<int> Detector::getImageTestMode(Positions pos) {
return pimpl->Parallel(&slsDetector::digitalTest, pos, return pimpl->Parallel(&slsDetector::digitalTest, pos, defs::IMAGE_TEST,
defs::IMAGE_TEST, -1); -1);
} }
Result<int> Detector::setImageTestMode(int value, Positions pos) { Result<int> Detector::setImageTestMode(int value, Positions pos) {
return pimpl->Parallel(&slsDetector::digitalTest, pos, return pimpl->Parallel(&slsDetector::digitalTest, pos, defs::IMAGE_TEST,
defs::IMAGE_TEST, value); value);
} }
// CTB Specific // CTB Specific
Result<int64_t> Detector::getNumberOfAnalogSamples(Positions pos) const { Result<int64_t> Detector::getNumberOfAnalogSamples(Positions pos) const {
@ -1083,7 +1063,8 @@ void Detector::setReadoutMode(int value, Positions pos) {
} }
Result<int> Detector::getDBITPhase(Positions pos) const { Result<int> Detector::getDBITPhase(Positions pos) const {
return pimpl->Parallel(&slsDetector::setSpeed, pos, defs::DBIT_PHASE, -1, 0); return pimpl->Parallel(&slsDetector::setSpeed, pos, defs::DBIT_PHASE, -1,
0);
} }
void Detector::setDBITPhase(int value, Positions pos) { void Detector::setDBITPhase(int value, Positions pos) {
@ -1096,10 +1077,11 @@ Result<int> Detector::getMaxDBITPhaseShift(Positions pos) const {
} }
Result<int> Detector::getDBITPhaseInDegrees(Positions pos) const { Result<int> Detector::getDBITPhaseInDegrees(Positions pos) const {
return pimpl->Parallel(&slsDetector::setSpeed, pos, defs::DBIT_PHASE, -1, 1); return pimpl->Parallel(&slsDetector::setSpeed, pos, defs::DBIT_PHASE, -1,
1);
} }
void Detector::setDBITPhaseInDegrees(int value,Positions pos) { void Detector::setDBITPhaseInDegrees(int value, Positions pos) {
pimpl->Parallel(&slsDetector::setSpeed, pos, defs::DBIT_PHASE, value, 1); pimpl->Parallel(&slsDetector::setSpeed, pos, defs::DBIT_PHASE, value, 1);
} }
@ -1108,7 +1090,8 @@ Result<int> Detector::getADCClock(Positions pos) const {
} }
void Detector::setADCClock(int value_in_MHz, Positions pos) { void Detector::setADCClock(int value_in_MHz, Positions pos) {
pimpl->Parallel(&slsDetector::setSpeed, pos, defs::ADC_CLOCK, value_in_MHz, 0); pimpl->Parallel(&slsDetector::setSpeed, pos, defs::ADC_CLOCK, value_in_MHz,
0);
} }
Result<int> Detector::getDBITClock(Positions pos) const { Result<int> Detector::getDBITClock(Positions pos) const {
@ -1117,7 +1100,8 @@ Result<int> Detector::getDBITClock(Positions pos) const {
} }
void Detector::setDBITClock(int value_in_MHz, Positions pos) { void Detector::setDBITClock(int value_in_MHz, Positions pos) {
pimpl->Parallel(&slsDetector::setSpeed, pos, defs::DBIT_CLOCK, value_in_MHz, 0); pimpl->Parallel(&slsDetector::setSpeed, pos, defs::DBIT_CLOCK, value_in_MHz,
0);
} }
Result<int> Detector::getRUNClock(Positions pos) const { Result<int> Detector::getRUNClock(Positions pos) const {
@ -1126,7 +1110,8 @@ Result<int> Detector::getRUNClock(Positions pos) const {
} }
void Detector::setRUNClock(int value_in_MHz, Positions pos) { void Detector::setRUNClock(int value_in_MHz, Positions pos) {
pimpl->Parallel(&slsDetector::setSpeed, pos, defs::CLOCK_DIVIDER, value_in_MHz, 0); pimpl->Parallel(&slsDetector::setSpeed, pos, defs::CLOCK_DIVIDER,
value_in_MHz, 0);
} }
Result<int> Detector::getSYNCClock(Positions pos) const { Result<int> Detector::getSYNCClock(Positions pos) const {
@ -1152,7 +1137,6 @@ void Detector::setDBITPipeline(int value, Positions pos) {
pimpl->Parallel(&slsDetector::setSpeed, pos, defs::DBIT_PIPELINE, value, 0); pimpl->Parallel(&slsDetector::setSpeed, pos, defs::DBIT_PIPELINE, value, 0);
} }
Result<int> Detector::getVrefVoltage(bool mV, Positions pos) const { Result<int> Detector::getVrefVoltage(bool mV, Positions pos) const {
return pimpl->Parallel(&slsDetector::setDAC, pos, -1, defs::ADC_VPP, mV); return pimpl->Parallel(&slsDetector::setDAC, pos, -1, defs::ADC_VPP, mV);
} }
@ -1291,8 +1275,6 @@ void Detector::setLEDEnable(bool enable, Positions pos) {
pimpl->Parallel(&slsDetector::setLEDEnable, pos, static_cast<int>(enable)); pimpl->Parallel(&slsDetector::setLEDEnable, pos, static_cast<int>(enable));
} }
// Pattern // Pattern
void Detector::setPattern(const std::string &fname, Positions pos) { void Detector::setPattern(const std::string &fname, Positions pos) {
@ -1362,8 +1344,6 @@ void Detector::setPatternBitMask(uint64_t mask, Positions pos) {
pimpl->Parallel(&slsDetector::setPatternBitMask, pos, mask); pimpl->Parallel(&slsDetector::setPatternBitMask, pos, mask);
} }
// Moench // Moench
Result<std::string> Detector::getAdditionalJsonHeader(Positions pos) const { Result<std::string> Detector::getAdditionalJsonHeader(Positions pos) const {
@ -1449,12 +1429,11 @@ void Detector::setDetectorMode(defs::detectorModeType value, Positions pos) {
"detectorMode", defs::getDetectorModeType(value)); "detectorMode", defs::getDetectorModeType(value));
} }
// Advanced // Advanced
void Detector::programFPGA(const std::string &fname, Positions pos) { void Detector::programFPGA(const std::string &fname, Positions pos) {
FILE_LOG(logINFO) << "Updating Firmware. This can take awhile. Please be patient..."; FILE_LOG(logINFO)
<< "Updating Firmware. This can take awhile. Please be patient...";
std::vector<char> buffer = pimpl->readPofFile(fname); std::vector<char> buffer = pimpl->readPofFile(fname);
pimpl->Parallel(&slsDetector::programFPGA, pos, buffer); pimpl->Parallel(&slsDetector::programFPGA, pos, buffer);
} }
@ -1512,11 +1491,8 @@ void Detector::writeAdcRegister(uint32_t addr, uint32_t value, Positions pos) {
pimpl->Parallel(&slsDetector::writeAdcRegister, pos, addr, value); pimpl->Parallel(&slsDetector::writeAdcRegister, pos, addr, value);
} }
// Insignificant // Insignificant
Result<int> Detector::getControlPort(Positions pos) const { Result<int> Detector::getControlPort(Positions pos) const {
return pimpl->Parallel(&slsDetector::getControlPort, pos); return pimpl->Parallel(&slsDetector::getControlPort, pos);
} }
@ -1565,19 +1541,18 @@ Result<ns> Detector::getMeasurementTime(Positions pos) const {
std::string Detector::getUserDetails() const { return pimpl->getUserDetails(); } std::string Detector::getUserDetails() const { return pimpl->getUserDetails(); }
Result<uint64_t> Detector::getRxCurrentFrameIndex(Positions pos) const { Result<uint64_t> Detector::getRxCurrentFrameIndex(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReceiverCurrentFrameIndex, pos); return pimpl->Parallel(&slsDetector::getReceiverCurrentFrameIndex, pos);
} }
std::vector<int> Detector::getPortNumbers(int start_port) { std::vector<int> Detector::getPortNumbers(int start_port) {
int num_sockets_per_detector = 1; int num_sockets_per_detector = 1;
switch (getDetectorType({}).squash()) { switch (getDetectorType({}).squash()) {
case defs::EIGER: case defs::EIGER:
num_sockets_per_detector *= 2; num_sockets_per_detector *= 2;
break; break;
case defs::JUNGFRAU: case defs::JUNGFRAU:
if(getNumberofUDPInterfaces({}).squash() == 2) { if (getNumberofUDPInterfaces({}).squash() == 2) {
num_sockets_per_detector *= 2; num_sockets_per_detector *= 2;
} }
break; break;

View File

@ -233,17 +233,23 @@ std::string multiSlsDetector::getUserDetails() {
std::ostringstream sstream; std::ostringstream sstream;
sstream << "\nHostname: "; sstream << "\nHostname: ";
for (auto &d : detectors) { for (auto &d : detectors) {
sstream << (d->isFixedPatternSharedMemoryCompatible() ? d->getHostname() : "Unknown") << "+"; sstream << (d->isFixedPatternSharedMemoryCompatible() ? d->getHostname()
: "Unknown")
<< "+";
} }
sstream << "\nType: "; sstream << "\nType: ";
// get type from multi shm // get type from multi shm
if (multi_shm()->shmversion >= MULTI_SHMAPIVERSION) { if (multi_shm()->shmversion >= MULTI_SHMAPIVERSION) {
sstream << slsDetectorDefs::detectorTypeToString(getDetectorTypeAsEnum()); sstream << slsDetectorDefs::detectorTypeToString(
} getDetectorTypeAsEnum());
}
// get type from slsdet shm // get type from slsdet shm
else { else {
for (auto &d : detectors) { for (auto &d : detectors) {
sstream << (d->isFixedPatternSharedMemoryCompatible() ? d->getDetectorTypeAsString() : "Unknown") << "+"; sstream << (d->isFixedPatternSharedMemoryCompatible()
? d->getDetectorTypeAsString()
: "Unknown")
<< "+";
} }
} }
@ -325,7 +331,6 @@ bool multiSlsDetector::isAcquireReady() {
return OK != 0u; return OK != 0u;
} }
std::string multiSlsDetector::exec(const char *cmd) { std::string multiSlsDetector::exec(const char *cmd) {
int bufsize = 128; int bufsize = 128;
char buffer[bufsize]; char buffer[bufsize];
@ -349,11 +354,13 @@ std::string multiSlsDetector::exec(const char *cmd) {
return result; return result;
} }
void multiSlsDetector::setVirtualDetectorServers(const int numdet, const int port) { void multiSlsDetector::setVirtualDetectorServers(const int numdet,
std::vector <std::string> hostnames; const int port) {
std::vector<std::string> hostnames;
for (int i = 0; i < numdet; ++i) { for (int i = 0; i < numdet; ++i) {
// * 2 is for control and stop port // * 2 is for control and stop port
hostnames.push_back(std::string("localhost:") + std::to_string(port + i * 2)); hostnames.push_back(std::string("localhost:") +
std::to_string(port + i * 2));
} }
setHostname(hostnames); setHostname(hostnames);
} }
@ -366,7 +373,7 @@ void multiSlsDetector::setHostname(const std::vector<std::string> &name) {
"Freeing Shared memory now."; "Freeing Shared memory now.";
freeSharedMemory(); freeSharedMemory();
setupMultiDetector(); setupMultiDetector();
} }
for (const auto &hostname : name) { for (const auto &hostname : name) {
addSlsDetector(hostname); addSlsDetector(hostname);
} }
@ -412,7 +419,7 @@ void multiSlsDetector::addMultipleDetectors(const char *name) {
void multiSlsDetector::addSlsDetector(const std::string &hostname) { void multiSlsDetector::addSlsDetector(const std::string &hostname) {
FILE_LOG(logDEBUG1) << "Adding detector " << hostname; FILE_LOG(logDEBUG1) << "Adding detector " << hostname;
int port = DEFAULT_PORTNO; int port = DEFAULT_PORTNO;
std::string host = hostname; std::string host = hostname;
auto res = sls::split(hostname, ':'); auto res = sls::split(hostname, ':');
@ -434,8 +441,7 @@ void multiSlsDetector::addSlsDetector(const std::string &hostname) {
} }
// get type by connecting // get type by connecting
detectorType type = detectorType type = slsDetector::getTypeFromDetector(host, port);
slsDetector::getTypeFromDetector(host, port);
int pos = (int)detectors.size(); int pos = (int)detectors.size();
detectors.push_back( detectors.push_back(
sls::make_unique<slsDetector>(type, multiId, pos, false)); sls::make_unique<slsDetector>(type, multiId, pos, false));
@ -443,14 +449,15 @@ void multiSlsDetector::addSlsDetector(const std::string &hostname) {
detectors[pos]->setControlPort(port); detectors[pos]->setControlPort(port);
detectors[pos]->setStopPort(port + 1); detectors[pos]->setStopPort(port + 1);
detectors[pos]->setHostname(host); detectors[pos]->setHostname(host);
multi_shm()->multiDetectorType = getDetectorTypeAsEnum(-1);// -1 needed here multi_shm()->multiDetectorType =
getDetectorTypeAsEnum(-1); // -1 needed here
} }
void multiSlsDetector::updateDetectorSize() { void multiSlsDetector::updateDetectorSize() {
FILE_LOG(logDEBUG) << "Updating Multi-Detector Size: " << size(); FILE_LOG(logDEBUG) << "Updating Multi-Detector Size: " << size();
const slsDetectorDefs::xy det_size = detectors[0]->getNumberOfChannels(); const slsDetectorDefs::xy det_size = detectors[0]->getNumberOfChannels();
int maxy = multi_shm()->numberOfChannels.y; int maxy = multi_shm()->numberOfChannels.y;
if (maxy == 0) { if (maxy == 0) {
maxy = det_size.y * size(); maxy = det_size.y * size();
@ -465,23 +472,21 @@ void multiSlsDetector::updateDetectorSize() {
multi_shm()->numberOfDetector.x = ndetx; multi_shm()->numberOfDetector.x = ndetx;
multi_shm()->numberOfDetector.y = ndety; multi_shm()->numberOfDetector.y = ndety;
multi_shm()->numberOfChannels.x = det_size.x * ndetx; multi_shm()->numberOfChannels.x = det_size.x * ndetx;
multi_shm()->numberOfChannels.y = det_size.y * ndety; multi_shm()->numberOfChannels.y = det_size.y * ndety;
FILE_LOG(logDEBUG)
<< "\n\tNumber of Detectors in X direction:"
<< multi_shm()->numberOfDetector.x
<< "\n\tNumber of Detectors in Y direction:"
<< multi_shm()->numberOfDetector.y
<< "\n\tNumber of Channels in X direction:"
<< multi_shm()->numberOfChannels.x
<< "\n\tNumber of Channels in Y direction:"
<< multi_shm()->numberOfChannels.y;
FILE_LOG(logDEBUG) << "\n\tNumber of Detectors in X direction:"
<< multi_shm()->numberOfDetector.x
<< "\n\tNumber of Detectors in Y direction:"
<< multi_shm()->numberOfDetector.y
<< "\n\tNumber of Channels in X direction:"
<< multi_shm()->numberOfChannels.x
<< "\n\tNumber of Channels in Y direction:"
<< multi_shm()->numberOfChannels.y;
for (auto &d : detectors) { for (auto &d : detectors) {
d->updateMultiSize(multi_shm()->numberOfDetector); d->updateMultiSize(multi_shm()->numberOfDetector);
} }
} }
slsDetectorDefs::detectorType multiSlsDetector::getDetectorTypeAsEnum() const { slsDetectorDefs::detectorType multiSlsDetector::getDetectorTypeAsEnum() const {
return multi_shm()->multiDetectorType; return multi_shm()->multiDetectorType;
@ -528,7 +533,8 @@ slsDetectorDefs::xy multiSlsDetector::getNumberOfChannels(int detPos) const {
void multiSlsDetector::setNumberOfChannels(const slsDetectorDefs::xy c) { void multiSlsDetector::setNumberOfChannels(const slsDetectorDefs::xy c) {
if (size() > 1) { if (size() > 1) {
throw RuntimeError("Set the number of channels before setting hostname."); throw RuntimeError(
"Set the number of channels before setting hostname.");
} }
multi_shm()->numberOfChannels = c; multi_shm()->numberOfChannels = c;
} }
@ -880,7 +886,7 @@ void multiSlsDetector::readAll(int detPos) {
} }
// multi // multi
parallelCall(&slsDetector::readAll); parallelCall(&slsDetector::readAll);
} }
void multiSlsDetector::configureMAC(int detPos) { void multiSlsDetector::configureMAC(int detPos) {
@ -1058,7 +1064,6 @@ int multiSlsDetector::setDynamicRange(int dr, int detPos) {
auto r = parallelCall(&slsDetector::setDynamicRange, dr); auto r = parallelCall(&slsDetector::setDynamicRange, dr);
int ret = sls::minusOneIfDifferent(r); int ret = sls::minusOneIfDifferent(r);
// change in dr // change in dr
if (dr != -1 && dr != prevValue) { if (dr != -1 && dr != prevValue) {
@ -1125,7 +1130,8 @@ int multiSlsDetector::getADC(dacIndex index, int detPos) {
return sls::minusOneIfDifferent(r); return sls::minusOneIfDifferent(r);
} }
slsDetectorDefs::timingMode multiSlsDetector::setTimingMode(timingMode pol, int detPos) { slsDetectorDefs::timingMode multiSlsDetector::setTimingMode(timingMode pol,
int detPos) {
// single // single
if (detPos >= 0) { if (detPos >= 0) {
return detectors[detPos]->setTimingMode(pol); return detectors[detPos]->setTimingMode(pol);
@ -1712,7 +1718,6 @@ void multiSlsDetector::setReceiverDataStreamingOutIP(const std::string &ip,
} }
} }
std::string multiSlsDetector::getReceiverStreamingIP(int detPos) { std::string multiSlsDetector::getReceiverStreamingIP(int detPos) {
// single // single
if (detPos >= 0) { if (detPos >= 0) {
@ -2049,7 +2054,7 @@ int multiSlsDetector::getReceiverDbitOffset(int detPos) {
} }
void multiSlsDetector::writeAdcRegister(uint32_t addr, uint32_t val, void multiSlsDetector::writeAdcRegister(uint32_t addr, uint32_t val,
int detPos) { int detPos) {
// single // single
if (detPos >= 0) { if (detPos >= 0) {
detectors[detPos]->writeAdcRegister(addr, val); detectors[detPos]->writeAdcRegister(addr, val);
@ -2139,7 +2144,8 @@ int multiSlsDetector::enableGapPixels(int val, int detPos) {
if (val != -1) { if (val != -1) {
Parallel(&slsDetector::enableGapPixels, {}, val); Parallel(&slsDetector::enableGapPixels, {}, val);
Result<slsDetectorDefs::xy> res = Parallel(&slsDetector::getNumberOfChannels, {}); Result<slsDetectorDefs::xy> res =
Parallel(&slsDetector::getNumberOfChannels, {});
multi_shm()->numberOfChannels.x = 0; multi_shm()->numberOfChannels.x = 0;
multi_shm()->numberOfChannels.y = 0; multi_shm()->numberOfChannels.y = 0;
for (auto &it : res) { for (auto &it : res) {
@ -2150,9 +2156,10 @@ int multiSlsDetector::enableGapPixels(int val, int detPos) {
return ret; return ret;
} }
void multiSlsDetector::setGapPixelsEnable(bool enable, Positions pos){ void multiSlsDetector::setGapPixelsEnable(bool enable, Positions pos) {
Parallel(&slsDetector::enableGapPixels, pos, static_cast<int>(enable)); Parallel(&slsDetector::enableGapPixels, pos, static_cast<int>(enable));
Result<slsDetectorDefs::xy> res = Parallel(&slsDetector::getNumberOfChannels, {}); Result<slsDetectorDefs::xy> res =
Parallel(&slsDetector::getNumberOfChannels, {});
multi_shm()->numberOfChannels.x = 0; multi_shm()->numberOfChannels.x = 0;
multi_shm()->numberOfChannels.y = 0; multi_shm()->numberOfChannels.y = 0;
for (auto &it : res) { for (auto &it : res) {
@ -2276,14 +2283,14 @@ void multiSlsDetector::resetFPGA(int detPos) {
} }
void multiSlsDetector::copyDetectorServer(const std::string &fname, void multiSlsDetector::copyDetectorServer(const std::string &fname,
const std::string &hostname, const std::string &hostname,
int detPos) { int detPos) {
// single // single
if (detPos >= 0) { if (detPos >= 0) {
detectors[detPos]->copyDetectorServer(fname, hostname); detectors[detPos]->copyDetectorServer(fname, hostname);
detectors[detPos]->rebootController(); detectors[detPos]->rebootController();
// reboot and copy should be independant for // reboot and copy should be independant for
// update command // update command
} }
// multi // multi
@ -2302,8 +2309,8 @@ void multiSlsDetector::rebootController(int detPos) {
} }
void multiSlsDetector::update(const std::string &sname, void multiSlsDetector::update(const std::string &sname,
const std::string &hostname, const std::string &hostname,
const std::string &fname, int detPos) { const std::string &fname, int detPos) {
FILE_LOG(logINFO) << "This can take awhile. Please be patient..."; FILE_LOG(logINFO) << "This can take awhile. Please be patient...";
// read pof file // read pof file
std::vector<char> buffer = readPofFile(fname); std::vector<char> buffer = readPofFile(fname);
@ -2829,7 +2836,8 @@ void multiSlsDetector::readFrameFromReceiver() {
// updates its header data // updates its header data
gappixelsenable = gappixelsenable =
(doc["gappixels"].GetUint() == 0) ? false : true; (doc["gappixels"].GetUint() == 0) ? false : true;
quadEnable = (doc["quad"].GetUint() == 0) ? false : true; quadEnable =
(doc["quad"].GetUint() == 0) ? false : true;
FILE_LOG(logDEBUG1) FILE_LOG(logDEBUG1)
<< "One Time Header Info:" << "One Time Header Info:"
"\n\tsize: " "\n\tsize: "
@ -2906,12 +2914,11 @@ void multiSlsDetector::readFrameFromReceiver() {
} }
} }
} }
FILE_LOG(logDEBUG) FILE_LOG(logDEBUG) << "Call Back Info:"
<< "Call Back Info:" << "\n\t nDetPixelsX: " << nDetPixelsX
<< "\n\t nDetPixelsX: " << nDetPixelsX << "\n\t nDetPixelsY: " << nDetPixelsY
<< "\n\t nDetPixelsY: " << nDetPixelsY << "\n\t databytes: " << multisize
<< "\n\t databytes: " << multisize << "\n\t dynamicRange: " << dynamicRange;
<< "\n\t dynamicRange: " << dynamicRange;
// send data to callback // send data to callback
if (data) { if (data) {
@ -2919,18 +2926,18 @@ void multiSlsDetector::readFrameFromReceiver() {
// 4bit gap pixels // 4bit gap pixels
if (dynamicRange == 4 && gappixelsenable) { if (dynamicRange == 4 && gappixelsenable) {
if (quadEnable) { if (quadEnable) {
nDetPixelsX += 2; nDetPixelsX += 2;
nDetPixelsY += 2; nDetPixelsY += 2;
} else { } else {
nDetPixelsX = nX * (nPixelsX + 3); nDetPixelsX = nX * (nPixelsX + 3);
nDetPixelsY = nY * (nPixelsY + 1); nDetPixelsY = nY * (nPixelsY + 1);
} }
int n = processImageWithGapPixels(multiframe, multigappixels, quadEnable); int n = processImageWithGapPixels(multiframe, multigappixels,
FILE_LOG(logDEBUG) quadEnable);
<< "Call Back Info Recalculated:" FILE_LOG(logDEBUG) << "Call Back Info Recalculated:"
<< "\n\t nDetPixelsX: " << nDetPixelsX << "\n\t nDetPixelsX: " << nDetPixelsX
<< "\n\t nDetPixelsY: " << nDetPixelsY << "\n\t nDetPixelsY: " << nDetPixelsY
<< "\n\t databytes: " << n; << "\n\t databytes: " << n;
thisData = new detectorData( thisData = new detectorData(
getCurrentProgress(), currentFileName.c_str(), nDetPixelsX, getCurrentProgress(), currentFileName.c_str(), nDetPixelsX,
nDetPixelsY, multigappixels, n, dynamicRange, nDetPixelsY, multigappixels, n, dynamicRange,
@ -2986,15 +2993,18 @@ void multiSlsDetector::readFrameFromReceiver() {
delete[] multigappixels; delete[] multigappixels;
} }
int multiSlsDetector::processImageWithGapPixels(char *image, char *&gpImage, bool quadEnable) { int multiSlsDetector::processImageWithGapPixels(char *image, char *&gpImage,
// eiger 4 bit mode bool quadEnable) {
int nxb = multi_shm()->numberOfDetector.x * (512 + 3); //(divided by 2 already) // eiger 4 bit mode
int nxb =
multi_shm()->numberOfDetector.x * (512 + 3); //(divided by 2 already)
int nyb = multi_shm()->numberOfDetector.y * (256 + 1); int nyb = multi_shm()->numberOfDetector.y * (256 + 1);
int nchipInRow = 4; int nchipInRow = 4;
int nxchip = multi_shm()->numberOfDetector.x * 4; int nxchip = multi_shm()->numberOfDetector.x * 4;
int nychip = multi_shm()->numberOfDetector.y * 1; int nychip = multi_shm()->numberOfDetector.y * 1;
if (quadEnable) { if (quadEnable) {
nxb = multi_shm()->numberOfDetector.x * (256 + 1); //(divided by 2 already) nxb = multi_shm()->numberOfDetector.x *
(256 + 1); //(divided by 2 already)
nyb = multi_shm()->numberOfDetector.y * (512 + 2); nyb = multi_shm()->numberOfDetector.y * (512 + 2);
nxchip /= 2; nxchip /= 2;
nychip *= 2; nychip *= 2;
@ -3002,8 +3012,6 @@ int multiSlsDetector::processImageWithGapPixels(char *image, char *&gpImage, boo
} }
int gapdatabytes = nxb * nyb; int gapdatabytes = nxb * nyb;
// allocate // allocate
if (gpImage == nullptr) { if (gpImage == nullptr) {
gpImage = new char[gapdatabytes]; gpImage = new char[gapdatabytes];
@ -3021,8 +3029,8 @@ int multiSlsDetector::processImageWithGapPixels(char *image, char *&gpImage, boo
dst = gpImage; dst = gpImage;
for (int row = 0; row < nychip; ++row) { // for each chip row for (int row = 0; row < nychip; ++row) { // for each chip row
for (int ichipy = 0; ichipy < b1chipy; for (int ichipy = 0; ichipy < b1chipy;
++ichipy) { // for each row in a chip ++ichipy) { // for each row in a chip
for (int col = 0; col < nxchip; ++col) {// for each chip in a row for (int col = 0; col < nxchip; ++col) { // for each chip in a row
memcpy(dst, src, b1chipx); memcpy(dst, src, b1chipx);
src += b1chipx; src += b1chipx;
dst += b1chipx; dst += b1chipx;
@ -3043,7 +3051,8 @@ int multiSlsDetector::processImageWithGapPixels(char *image, char *&gpImage, boo
for (int row = 0; row < nychip; ++row) { // for each chip row for (int row = 0; row < nychip; ++row) { // for each chip row
for (int ichipy = 0; ichipy < b1chipy; for (int ichipy = 0; ichipy < b1chipy;
++ichipy) { // for each row in a chip ++ichipy) { // for each row in a chip
for (int col = 0; col < nxchip; ++col) {// for each chip in a row for (int col = 0; col < nxchip;
++col) { // for each chip in a row
dst += b1chipx; dst += b1chipx;
mod = (col + 1) % nchipInRow; // get gap pixels mod = (col + 1) % nchipInRow; // get gap pixels
// copy gap pixel(chip 0, 1, 2) // copy gap pixel(chip 0, 1, 2)
@ -3394,7 +3403,7 @@ int multiSlsDetector::setLEDEnable(int enable, int detPos) {
} }
void multiSlsDetector::setDigitalIODelay(uint64_t pinMask, int delay, void multiSlsDetector::setDigitalIODelay(uint64_t pinMask, int delay,
int detPos) { int detPos) {
// single // single
if (detPos >= 0) { if (detPos >= 0) {
detectors[detPos]->setDigitalIODelay(pinMask, delay); detectors[detPos]->setDigitalIODelay(pinMask, delay);
@ -3618,15 +3627,18 @@ void multiSlsDetector::registerDataCallback(
} }
int multiSlsDetector::setTotalProgress() { int multiSlsDetector::setTotalProgress() {
int nf = Parallel(&slsDetector::setTimer, {}, FRAME_NUMBER, -1).tsquash("Inconsistent number of frames"); int nf = Parallel(&slsDetector::setTimer, {}, FRAME_NUMBER, -1)
int nc = Parallel(&slsDetector::setTimer, {}, CYCLES_NUMBER, -1).tsquash("Inconsistent number of cycles"); .tsquash("Inconsistent number of frames");
int nc = Parallel(&slsDetector::setTimer, {}, CYCLES_NUMBER, -1)
.tsquash("Inconsistent number of cycles");
if (nf == 0 || nc == 0) { if (nf == 0 || nc == 0) {
throw RuntimeError("Number of frames or cycles is 0"); throw RuntimeError("Number of frames or cycles is 0");
} }
int ns = 1; int ns = 1;
if (getDetectorTypeAsEnum() == JUNGFRAU) { if (getDetectorTypeAsEnum() == JUNGFRAU) {
ns = Parallel(&slsDetector::setTimer, {}, STORAGE_CELL_NUMBER, -1).tsquash("Inconsistent number of additional storage cells"); ns = Parallel(&slsDetector::setTimer, {}, STORAGE_CELL_NUMBER, -1)
.tsquash("Inconsistent number of additional storage cells");
++ns; ++ns;
} }
@ -3707,12 +3719,12 @@ int multiSlsDetector::acquire() {
// stop receiver // stop receiver
if (receiver) { if (receiver) {
stopReceiver(); stopReceiver();
if (dataReady != nullptr) { if (dataReady != nullptr) {
sem_wait(&sem_endRTAcquisition); // waits for receiver's sem_wait(&sem_endRTAcquisition); // waits for receiver's
} }
// external process to be // external process to be
// done sending data to gui // done sending data to gui
incrementFileIndex(); incrementFileIndex();
} }
@ -3904,9 +3916,3 @@ std::vector<char> multiSlsDetector::readPofFile(const std::string &fname) {
FILE_LOG(logINFO) << "Read file into memory"; FILE_LOG(logINFO) << "Read file into memory";
return buffer; return buffer;
} }

View File

@ -23,7 +23,6 @@
using namespace sls; using namespace sls;
// create shm // create shm
slsDetector::slsDetector(detectorType type, int multi_id, int det_id, slsDetector::slsDetector(detectorType type, int multi_id, int det_id,
bool verify) bool verify)
@ -590,8 +589,10 @@ void slsDetector::updateNumberOfChannels() {
slsDetectorDefs::xy slsDetector::getNumberOfChannels() const { slsDetectorDefs::xy slsDetector::getNumberOfChannels() const {
slsDetectorDefs::xy coord; slsDetectorDefs::xy coord;
coord.x = (shm()->nChan.x * shm()->nChip.x + shm()->gappixels * shm()->nGappixels.x); coord.x = (shm()->nChan.x * shm()->nChip.x +
coord.y = (shm()->nChan.y * shm()->nChip.y + shm()->gappixels * shm()->nGappixels.y); shm()->gappixels * shm()->nGappixels.x);
coord.y = (shm()->nChan.y * shm()->nChip.y +
shm()->gappixels * shm()->nGappixels.y);
return coord; return coord;
} }
@ -601,7 +602,6 @@ bool slsDetector::getQuad() {
sendToDetector(F_GET_QUAD, nullptr, retval); sendToDetector(F_GET_QUAD, nullptr, retval);
FILE_LOG(logDEBUG1) << "Quad Type :" << retval; FILE_LOG(logDEBUG1) << "Quad Type :" << retval;
return (retval == 0 ? false : true); return (retval == 0 ? false : true);
} }
void slsDetector::setQuad(const bool enable) { void slsDetector::setQuad(const bool enable) {
@ -617,10 +617,11 @@ void slsDetector::setQuad(const bool enable) {
void slsDetector::setReadNLines(const int value) { void slsDetector::setReadNLines(const int value) {
FILE_LOG(logDEBUG1) << "Setting read n lines to " << value; FILE_LOG(logDEBUG1) << "Setting read n lines to " << value;
sendToDetector(F_SET_READ_N_LINES, value, nullptr); sendToDetector(F_SET_READ_N_LINES, value, nullptr);
FILE_LOG(logDEBUG1) << "Setting read n lines to " << value << " in Receiver"; FILE_LOG(logDEBUG1) << "Setting read n lines to " << value
<< " in Receiver";
if (shm()->useReceiverFlag) { if (shm()->useReceiverFlag) {
sendToReceiver(F_SET_RECEIVER_READ_N_LINES, value, nullptr); sendToReceiver(F_SET_RECEIVER_READ_N_LINES, value, nullptr);
} }
} }
int slsDetector::getReadNLines() { int slsDetector::getReadNLines() {
@ -635,7 +636,6 @@ void slsDetector::updateMultiSize(slsDetectorDefs::xy det) {
shm()->multiSize = det; shm()->multiSize = det;
} }
int slsDetector::setControlPort(int port_number) { int slsDetector::setControlPort(int port_number) {
int retval = -1; int retval = -1;
FILE_LOG(logDEBUG1) << "Setting control port to " << port_number; FILE_LOG(logDEBUG1) << "Setting control port to " << port_number;
@ -736,7 +736,7 @@ void slsDetector::updateCachedDetectorVariables() {
// dr // dr
n += client.Receive(&i32, sizeof(i32)); n += client.Receive(&i32, sizeof(i32));
shm()->dynamicRange = i32; shm()->dynamicRange = i32;
// settings // settings
if ((shm()->myDetectorType != CHIPTESTBOARD) && if ((shm()->myDetectorType != CHIPTESTBOARD) &&
@ -1438,9 +1438,7 @@ int slsDetector::setDynamicRange(int n) {
return shm()->dynamicRange; return shm()->dynamicRange;
} }
int slsDetector::getDynamicRangeFromShm() { int slsDetector::getDynamicRangeFromShm() { return shm()->dynamicRange; }
return shm()->dynamicRange;
}
int slsDetector::setDAC(int val, dacIndex index, int mV) { int slsDetector::setDAC(int val, dacIndex index, int mV) {
int args[]{static_cast<int>(index), mV, val}; int args[]{static_cast<int>(index), mV, val};
@ -2190,7 +2188,8 @@ void slsDetector::setROI(slsDetectorDefs::ROI arg) {
arg.xmin = -1; arg.xmin = -1;
arg.xmax = -1; arg.xmax = -1;
} }
FILE_LOG(logDEBUG) << "Sending ROI to detector [" << arg.xmin << ", " << arg.xmax << "]"; FILE_LOG(logDEBUG) << "Sending ROI to detector [" << arg.xmin << ", "
<< arg.xmax << "]";
auto client = DetectorSocket(shm()->hostname, shm()->controlPort); auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
client.Send(&fnum, sizeof(fnum)); client.Send(&fnum, sizeof(fnum));
client.Send(&arg.xmin, sizeof(int)); client.Send(&arg.xmin, sizeof(int));
@ -2203,7 +2202,7 @@ void slsDetector::setROI(slsDetectorDefs::ROI arg) {
throw RuntimeError("Detector " + std::to_string(detId) + throw RuntimeError("Detector " + std::to_string(detId) +
" returned error: " + std::string(mess)); " returned error: " + std::string(mess));
} else { } else {
memcpy(&shm()->roi, &arg, sizeof(ROI)); memcpy(&shm()->roi, &arg, sizeof(ROI));
if (ret == FORCE_UPDATE) { if (ret == FORCE_UPDATE) {
updateCachedDetectorVariables(); updateCachedDetectorVariables();
} }
@ -2243,14 +2242,13 @@ slsDetectorDefs::ROI slsDetector::getROI() {
client.Receive(&retval.xmin, sizeof(int)); client.Receive(&retval.xmin, sizeof(int));
client.Receive(&retval.xmax, sizeof(int)); client.Receive(&retval.xmax, sizeof(int));
FILE_LOG(logDEBUG1) FILE_LOG(logDEBUG1)
<< "ROI retval [" << retval.xmin << "," << "ROI retval [" << retval.xmin << "," << retval.xmax << "]";
<< retval.xmax << "]";
if (ret == FORCE_UPDATE) { if (ret == FORCE_UPDATE) {
updateCachedDetectorVariables(); updateCachedDetectorVariables();
} }
// if different from shm, update and send to receiver // if different from shm, update and send to receiver
if (shm()->roi.xmin != retval.xmin || shm()->roi.xmax != retval.xmax) { if (shm()->roi.xmin != retval.xmin || shm()->roi.xmax != retval.xmax) {
memcpy(&shm()->roi, &retval, sizeof(ROI)); memcpy(&shm()->roi, &retval, sizeof(ROI));
sendROItoReceiver(); sendROItoReceiver();
} }
} }
@ -2258,8 +2256,6 @@ slsDetectorDefs::ROI slsDetector::getROI() {
return shm()->roi; return shm()->roi;
} }
void slsDetector::setADCEnableMask(uint32_t mask) { void slsDetector::setADCEnableMask(uint32_t mask) {
uint32_t arg = mask; uint32_t arg = mask;
FILE_LOG(logDEBUG1) << "Setting ADC Enable mask to 0x" << std::hex << arg FILE_LOG(logDEBUG1) << "Setting ADC Enable mask to 0x" << std::hex << arg
@ -2414,9 +2410,7 @@ bool slsDetector::setDeactivatedRxrPaddingMode(int padding) {
return shm()->rxPadDeactivatedModules; return shm()->rxPadDeactivatedModules;
} }
int slsDetector::getFlippedDataX() const { int slsDetector::getFlippedDataX() const { return shm()->flippedDataX; }
return shm()->flippedDataX;
}
int slsDetector::setFlippedDataX(int value) { int slsDetector::setFlippedDataX(int value) {
// replace get with shm value (write to shm right away as it is a det value, // replace get with shm value (write to shm right away as it is a det value,
@ -2426,7 +2420,8 @@ int slsDetector::setFlippedDataX(int value) {
} }
int retval = -1; int retval = -1;
int arg = shm()->flippedDataX; int arg = shm()->flippedDataX;
FILE_LOG(logDEBUG1) << "Setting flipped data across x axis with value: " << arg; FILE_LOG(logDEBUG1) << "Setting flipped data across x axis with value: "
<< arg;
if (shm()->useReceiverFlag) { if (shm()->useReceiverFlag) {
sendToReceiver(F_SET_FLIPPED_DATA_RECEIVER, arg, retval); sendToReceiver(F_SET_FLIPPED_DATA_RECEIVER, arg, retval);
FILE_LOG(logDEBUG1) << "Flipped data:" << retval; FILE_LOG(logDEBUG1) << "Flipped data:" << retval;