mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-14 13:57:13 +02:00
WIP
This commit is contained in:
@ -67,7 +67,8 @@ class Detector {
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
@ -82,8 +83,6 @@ class Detector {
|
||||
/** [Jungfrau][Gotthard] */
|
||||
void setSettings(defs::detectorSettings value, Positions pos = {});
|
||||
|
||||
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Acquisition Parameters *
|
||||
@ -174,9 +173,7 @@ class Detector {
|
||||
* [Gotthard, Jungfrau, CTB Options: AUTO_TIMING, TRIGGER_EXPOSURE]
|
||||
* [Eiger Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER]
|
||||
*/
|
||||
void setTimingMode(defs::timingMode value,
|
||||
Positions pos = {});
|
||||
|
||||
void setTimingMode(defs::timingMode value, Positions pos = {});
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
@ -192,14 +189,16 @@ class Detector {
|
||||
|
||||
/** Non blocking
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
@ -226,7 +225,6 @@ class Detector {
|
||||
|
||||
// TODO: remove resetframescaught in receiver
|
||||
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Network Configuration (Detector<->Receiver) *
|
||||
@ -311,15 +309,18 @@ class Detector {
|
||||
|
||||
Result<int> getDestinationUDPPort(Positions pos = {}) const;
|
||||
|
||||
/** module_id is -1 for all detectors, ports for each module is calculated (increments) */
|
||||
//TODO if Parallel takes a vector, can send multiple vaues to set in slsdetector.cp
|
||||
/** module_id is -1 for all detectors, ports for each module is calculated
|
||||
* (increments) */
|
||||
// TODO if Parallel takes a vector, can send multiple vaues to set in
|
||||
// slsdetector.cp
|
||||
void setDestinationUDPPort(int port, int module_id = -1);
|
||||
|
||||
/** [Eiger right port][Jungfrau bottom half] */
|
||||
Result<int> getDestinationUDPPort2(Positions pos = {}) const;
|
||||
|
||||
/** [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);
|
||||
|
||||
@ -343,8 +344,8 @@ class Detector {
|
||||
/**
|
||||
* [Jungfrau]: Sets the transmission delay of the first UDP packet being
|
||||
* 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
|
||||
* left and right UDP ports. Options: //TODO possible values
|
||||
* [Eiger]: Sets the transmission delay of entire frame streamed out for
|
||||
* both left and right UDP ports. Options: //TODO possible values
|
||||
*/
|
||||
void setTransmissionDelayFrame(int value, Positions pos = {});
|
||||
|
||||
@ -368,7 +369,6 @@ class Detector {
|
||||
*/
|
||||
void setTransmissionDelayRight(int value, Positions pos = {});
|
||||
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* RECEIVER CONFIG *
|
||||
@ -421,12 +421,11 @@ class Detector {
|
||||
|
||||
Result<int64_t> getRxUDPSocketBufferSize(Positions pos = {}) const;
|
||||
|
||||
void setRxUDPSocketBufferSize(int64_t udpsockbufsize,
|
||||
Positions pos = {});
|
||||
void setRxUDPSocketBufferSize(int64_t udpsockbufsize, Positions pos = {});
|
||||
/** TODO:
|
||||
* Linux kernel allocates twice the amount you set for bookkeeping purposes */
|
||||
Result<int64_t>
|
||||
getRxRealUDPSocketBufferSize(Positions pos = {}) const;
|
||||
* Linux kernel allocates twice the amount you set for bookkeeping purposes
|
||||
*/
|
||||
Result<int64_t> getRxRealUDPSocketBufferSize(Positions pos = {}) const;
|
||||
|
||||
Result<bool> getRxLock(Positions pos = {});
|
||||
|
||||
@ -435,7 +434,6 @@ class Detector {
|
||||
|
||||
Result<std::string> getRxLastClientIP(Positions pos = {}) const;
|
||||
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* FILE *
|
||||
@ -454,8 +452,8 @@ class Detector {
|
||||
Result<std::string> getFileNamePrefix(Positions pos = {}) const;
|
||||
|
||||
/** default run
|
||||
* File Name: [file name prefix]_d[module index]_f[file index]_[acquisition index].[file format]
|
||||
* eg. run_d0_f0_5.raw
|
||||
* File Name: [file name prefix]_d[module index]_f[file index]_[acquisition
|
||||
* index].[file format] eg. run_d0_f0_5.raw
|
||||
*/
|
||||
void setFileNamePrefix(const std::string &fname, Positions pos = {});
|
||||
|
||||
@ -483,7 +481,6 @@ class Detector {
|
||||
/** 0 will set frames per file to unlimited */
|
||||
void setFramesPerFile(int n, Positions pos = {});
|
||||
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* ZMQ Streaming Parameters (Receiver<->Client)*
|
||||
@ -501,7 +498,8 @@ class Detector {
|
||||
* If 0, streaming timer is the timeout,
|
||||
* after which current frame sent out. Default is 0 at 200 ms.
|
||||
* 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 = {});
|
||||
|
||||
@ -516,22 +514,22 @@ class Detector {
|
||||
Result<int> getRxZmqPort(Positions pos = {}) const;
|
||||
|
||||
/**
|
||||
* module_id is -1 for all detectors, ports for each module is calculated (increments)
|
||||
* Restarts receiver zmq sockets only if it was already enabled
|
||||
* module_id is -1 for all detectors, ports for each module is calculated
|
||||
* (increments) Restarts receiver zmq sockets only if it was already enabled
|
||||
*/
|
||||
void setRxZmqPort(int port, int module_id = -1);
|
||||
|
||||
Result<std::string> getRxZmqIP(Positions pos = {}) const;
|
||||
|
||||
void setRxZmqIP(const std::string &ip,
|
||||
Positions pos = {});
|
||||
void setRxZmqIP(const std::string &ip, Positions pos = {});
|
||||
|
||||
Result<int> getClientZmqPort(Positions pos = {}) const;
|
||||
|
||||
/**
|
||||
* Needed only when using the client call back to get reconstructed data from multi modules
|
||||
* module_id is -1 for all detectors, ports for each module is calculated (increments)
|
||||
* Restarts client zmq sockets oonly if it was already enabled
|
||||
* Needed only when using the client call back to get reconstructed data
|
||||
* from multi modules module_id is -1 for all detectors, ports for each
|
||||
* module is calculated (increments) Restarts client zmq sockets oonly if it
|
||||
* was already enabled
|
||||
*/
|
||||
void setClientZmqPort(int port, int module_id = -1);
|
||||
|
||||
@ -539,7 +537,6 @@ class Detector {
|
||||
|
||||
void setClientZmqIp(const std::string &ip, Positions pos = {});
|
||||
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Eiger Specific *
|
||||
@ -629,7 +626,8 @@ class Detector {
|
||||
|
||||
/** //TODO: default, get, set
|
||||
* [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 = {});
|
||||
|
||||
@ -692,7 +690,6 @@ class Detector {
|
||||
/** [Eiger] with specific quad hardware */
|
||||
void setQuad(const bool enable);
|
||||
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Jungfrau Specific *
|
||||
@ -735,8 +732,10 @@ class Detector {
|
||||
|
||||
/** [Jungfrau] Advanced
|
||||
* //TODO naming
|
||||
* By default, the on-chip gain switching is active during the entire exposure.
|
||||
* This mode disables the on-chip gain switching comparator automatically after 93.75% of exposure time (only for longer than 100us). */
|
||||
* By default, the on-chip gain switching is active during the entire
|
||||
* 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 = {});
|
||||
|
||||
/** [Jungfrau] Advanced TODO naming */
|
||||
@ -748,8 +747,8 @@ class Detector {
|
||||
/** [Jungfrau] Advanced */
|
||||
Result<int> getStorageCellStart(Positions pos = {}) const;
|
||||
|
||||
/** [Jungfrau] Advanced. Sets the storage cell storing the first acquisition of the
|
||||
* series. Options: 0-15
|
||||
/** [Jungfrau] Advanced. Sets the storage cell storing the first acquisition
|
||||
* of the series. Options: 0-15
|
||||
*/
|
||||
void setStoragecellStart(int cell, Positions pos = {});
|
||||
|
||||
@ -760,7 +759,6 @@ class Detector {
|
||||
* Options: (0-1638375 ns (resolution of 25ns) */
|
||||
void setStorageCellDelay(ns value, Positions pos = {});
|
||||
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Gotthard Specific *
|
||||
@ -778,7 +776,8 @@ class Detector {
|
||||
*/
|
||||
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;
|
||||
|
||||
/** [Gotthard] TODO remove */
|
||||
@ -795,7 +794,8 @@ class Detector {
|
||||
/** [Gotthard] */
|
||||
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 = {});
|
||||
|
||||
/**************************************************
|
||||
@ -819,8 +819,8 @@ class Detector {
|
||||
/** [CTB] */
|
||||
Result<int> getReadoutMode(Positions pos = {}) const;
|
||||
|
||||
/** [CTB] Options: NORMAL_READOUT = 0, DIGITAL_ONLY = 1, ANALOG_AND_DIGITAL //TODO ANALOG_ONLY, make enum
|
||||
* = 2 */
|
||||
/** [CTB] Options: NORMAL_READOUT = 0, DIGITAL_ONLY = 1, ANALOG_AND_DIGITAL
|
||||
* //TODO ANALOG_ONLY, make enum = 2 */
|
||||
void setReadoutMode(int value, Positions pos = {});
|
||||
|
||||
/** [CTB] */
|
||||
@ -955,7 +955,6 @@ class Detector {
|
||||
/** [CTB] */
|
||||
void setLEDEnable(bool enable, Positions pos = {});
|
||||
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* PATTERN *
|
||||
@ -1024,7 +1023,6 @@ class Detector {
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
|
||||
/** [Moench] */
|
||||
Result<std::string> getAdditionalJsonHeader(Positions pos = {}) const;
|
||||
|
||||
@ -1121,7 +1119,6 @@ class Detector {
|
||||
/** [Gotthard][Jungfrau][CTB] not possible to read back*/
|
||||
void writeAdcRegister(uint32_t addr, uint32_t value, Positions pos = {});
|
||||
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Insignificant *
|
||||
@ -1165,7 +1162,6 @@ class Detector {
|
||||
|
||||
private:
|
||||
std::vector<int> getPortNumbers(int start_port);
|
||||
|
||||
};
|
||||
|
||||
} // namespace sls
|
@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "Result.h"
|
||||
#include "SharedMemory.h"
|
||||
#include "logger.h"
|
||||
#include "sls_detector_defs.h"
|
||||
#include "Result.h"
|
||||
|
||||
class slsDetector;
|
||||
class ZmqSocket;
|
||||
@ -370,9 +370,11 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
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
|
||||
* @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; //
|
||||
|
||||
@ -498,7 +500,8 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns current settings
|
||||
*/
|
||||
detectorSettings setSettings(detectorSettings isettings, int detPos = -1);//
|
||||
detectorSettings setSettings(detectorSettings isettings,
|
||||
int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Get threshold energy (Eiger)
|
||||
@ -531,7 +534,8 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @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
|
||||
@ -556,8 +560,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
*/
|
||||
runStatus getRunStatus(int detPos = -1); //
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Start detector acquisition (Non blocking)
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
@ -698,7 +700,8 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @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
|
||||
@ -760,7 +763,8 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @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)
|
||||
@ -780,7 +784,8 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @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)
|
||||
@ -837,7 +842,8 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @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
|
||||
@ -870,7 +876,8 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @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
|
||||
@ -886,7 +893,8 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @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
|
||||
@ -952,7 +960,8 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @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
|
||||
@ -1311,8 +1320,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
*/
|
||||
int getExternalSamplingSource(int detPos = -1); //
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set external sampling enable (CTB only)
|
||||
* @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); //
|
||||
|
||||
|
||||
void setGapPixelsEnable(bool enable, sls::Positions pos = {});
|
||||
/**
|
||||
* Sets the number of trim energies and their value (Eiger)
|
||||
@ -2201,8 +2207,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
*/
|
||||
int kbhit();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Convert a double holding time in seconds to an int64_t with nano seconds
|
||||
* Used for conversion when sending time to detector
|
||||
|
@ -354,7 +354,6 @@ class slsDetector : public virtual slsDetectorDefs {
|
||||
*/
|
||||
void updateMultiSize(slsDetectorDefs::xy det);
|
||||
|
||||
|
||||
int setControlPort(int port_number);
|
||||
|
||||
/**
|
||||
@ -1726,7 +1725,6 @@ class slsDetector : public virtual slsDetectorDefs {
|
||||
|
||||
void sendToDetectorStop(int fnum) const;
|
||||
|
||||
|
||||
/**
|
||||
* Send function parameters to receiver
|
||||
* @param fnum function enum
|
||||
|
@ -52,8 +52,7 @@ Result<int64_t> Detector::getReceiverVersion(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getReceiverSoftwareVersion, pos);
|
||||
}
|
||||
|
||||
Result<defs::detectorType>
|
||||
Detector::getDetectorType(Positions pos) const {
|
||||
Result<defs::detectorType> Detector::getDetectorType(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getDetectorTypeAsEnum, pos);
|
||||
}
|
||||
|
||||
@ -83,8 +82,6 @@ void Detector::setSettings(defs::detectorSettings value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setSettings, pos, value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Acquisition Parameters
|
||||
|
||||
Result<int64_t> Detector::getNumberOfFrames() const {
|
||||
@ -103,7 +100,6 @@ void Detector::setNumberOfTriggers(int64_t value) {
|
||||
pimpl->Parallel(&slsDetector::setTimer, {}, defs::CYCLES_NUMBER, value);
|
||||
}
|
||||
|
||||
|
||||
Result<ns> Detector::getExptime(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setTimer, pos, defs::ACQUISITION_TIME,
|
||||
-1);
|
||||
@ -184,7 +180,8 @@ void Detector::setHighVoltage(int value, Positions pos) {
|
||||
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) {
|
||||
case defs::TEMPERATURE_ADC:
|
||||
case defs::TEMPERATURE_FPGA:
|
||||
@ -232,8 +229,6 @@ void Detector::setTimingMode(defs::timingMode value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setTimingMode, pos, value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Acquisition
|
||||
|
||||
void Detector::acquire() { pimpl->acquire(); }
|
||||
@ -276,8 +271,6 @@ void Detector::sendSoftwareTrigger(Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::sendSoftwareTrigger, pos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Network Configuration (Detector<->Receiver)
|
||||
|
||||
void Detector::configureMAC(Positions pos) {
|
||||
@ -383,7 +376,8 @@ void Detector::setDestinationUDPPort(int port, int module_id) {
|
||||
if (module_id == -1) {
|
||||
std::vector<int> port_list = getPortNumbers(port);
|
||||
for (int idet = 0; idet < size(); ++idet) {
|
||||
pimpl->Parallel(&slsDetector::setReceiverUDPPort, {idet}, port_list[idet]);
|
||||
pimpl->Parallel(&slsDetector::setReceiverUDPPort, {idet},
|
||||
port_list[idet]);
|
||||
}
|
||||
} else {
|
||||
pimpl->Parallel(&slsDetector::setReceiverUDPPort, {module_id}, port);
|
||||
@ -398,7 +392,8 @@ void Detector::setDestinationUDPPort2(int port, int module_id) {
|
||||
if (module_id == -1) {
|
||||
std::vector<int> port_list = getPortNumbers(port);
|
||||
for (int idet = 0; idet < size(); ++idet) {
|
||||
pimpl->Parallel(&slsDetector::setReceiverUDPPort2, {idet}, port_list[idet]);
|
||||
pimpl->Parallel(&slsDetector::setReceiverUDPPort2, {idet},
|
||||
port_list[idet]);
|
||||
}
|
||||
} else {
|
||||
pimpl->Parallel(&slsDetector::setReceiverUDPPort2, {module_id}, port);
|
||||
@ -458,8 +453,6 @@ void Detector::setTransmissionDelayRight(int value, Positions pos) {
|
||||
defs::DETECTOR_TXN_DELAY_RIGHT, value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Receiver
|
||||
|
||||
Result<bool> Detector::getUseReceiverFlag(Positions pos) const {
|
||||
@ -522,14 +515,12 @@ Result<int64_t> Detector::getRxUDPSocketBufferSize(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getReceiverUDPSocketBufferSize, pos);
|
||||
}
|
||||
|
||||
void Detector::setRxUDPSocketBufferSize(int64_t udpsockbufsize,
|
||||
Positions pos) {
|
||||
void Detector::setRxUDPSocketBufferSize(int64_t udpsockbufsize, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setReceiverUDPSocketBufferSize, pos,
|
||||
udpsockbufsize);
|
||||
}
|
||||
|
||||
Result<int64_t>
|
||||
Detector::getRxRealUDPSocketBufferSize(Positions pos) const {
|
||||
Result<int64_t> Detector::getRxRealUDPSocketBufferSize(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getReceiverRealUDPSocketBufferSize,
|
||||
pos);
|
||||
}
|
||||
@ -546,8 +537,6 @@ Result<std::string> Detector::getRxLastClientIP(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getReceiverLastClientIP, pos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// File
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Zmq Streaming (Receiver<->Client)
|
||||
|
||||
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) {
|
||||
@ -650,10 +638,12 @@ void Detector::setRxZmqPort(int port, int module_id) {
|
||||
if (module_id == -1) {
|
||||
std::vector<int> port_list = getPortNumbers(port);
|
||||
for (int idet = 0; idet < size(); ++idet) {
|
||||
pimpl->Parallel(&slsDetector::setReceiverStreamingPort, {idet}, port_list[idet]);
|
||||
pimpl->Parallel(&slsDetector::setReceiverStreamingPort, {idet},
|
||||
port_list[idet]);
|
||||
}
|
||||
} 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);
|
||||
}
|
||||
|
||||
void Detector::setRxZmqIP(const std::string &ip,
|
||||
Positions pos) {
|
||||
bool previouslyReceiverStreaming =
|
||||
getRxZmqDataStream(pos).squash(false);
|
||||
void Detector::setRxZmqIP(const std::string &ip, Positions pos) {
|
||||
bool previouslyReceiverStreaming = getRxZmqDataStream(pos).squash(false);
|
||||
pimpl->Parallel(&slsDetector::setReceiverStreamingIP, pos, ip);
|
||||
if (previouslyReceiverStreaming) {
|
||||
setRxZmqDataStream(false, pos);
|
||||
@ -680,10 +668,12 @@ void Detector::setClientZmqPort(int port, int module_id) {
|
||||
if (module_id == -1) {
|
||||
std::vector<int> port_list = getPortNumbers(port);
|
||||
for (int idet = 0; idet < size(); ++idet) {
|
||||
pimpl->Parallel(&slsDetector::setClientStreamingPort, {idet}, port_list[idet]);
|
||||
pimpl->Parallel(&slsDetector::setClientStreamingPort, {idet},
|
||||
port_list[idet]);
|
||||
}
|
||||
} 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);
|
||||
}
|
||||
|
||||
void Detector::setClientZmqIp(const std::string &ip,
|
||||
Positions pos) {
|
||||
void Detector::setClientZmqIp(const std::string &ip, Positions pos) {
|
||||
int previouslyClientStreaming = pimpl->enableDataStreamingToClient(-1);
|
||||
pimpl->Parallel(&slsDetector::setClientStreamingIP, pos, ip);
|
||||
if (previouslyClientStreaming != 0) {
|
||||
@ -701,8 +690,6 @@ void Detector::setClientZmqIp(const std::string &ip,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Eiger Specific
|
||||
|
||||
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); }
|
||||
|
||||
|
||||
Result<ns> Detector::getSubExptime(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setTimer, pos,
|
||||
defs::SUBFRAME_ACQUISITION_TIME, -1);
|
||||
@ -736,9 +722,11 @@ Result<int> Detector::getThresholdEnergy(Positions pos) const {
|
||||
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) {
|
||||
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 {
|
||||
@ -796,7 +784,8 @@ Result<bool> Detector::getBottom(Positions pos) const {
|
||||
}
|
||||
|
||||
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 {
|
||||
@ -890,11 +879,7 @@ Result<bool> Detector::getQuad(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getQuad, pos);
|
||||
}
|
||||
|
||||
void Detector::setQuad(const bool value) {
|
||||
pimpl->setQuad(value);
|
||||
}
|
||||
|
||||
|
||||
void Detector::setQuad(const bool value) { pimpl->setQuad(value); }
|
||||
|
||||
// Jungfrau Specific
|
||||
|
||||
@ -979,11 +964,8 @@ void Detector::setStorageCellDelay(ns value, Positions pos) {
|
||||
value.count());
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Gotthard Specific
|
||||
|
||||
|
||||
Result<defs::ROI> Detector::getROI(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getROI, pos);
|
||||
}
|
||||
@ -1016,17 +998,15 @@ void Detector::setExternalSignalFlags(defs::externalSignalFlag value,
|
||||
}
|
||||
|
||||
Result<int> Detector::getImageTestMode(Positions pos) {
|
||||
return pimpl->Parallel(&slsDetector::digitalTest, pos,
|
||||
defs::IMAGE_TEST, -1);
|
||||
return pimpl->Parallel(&slsDetector::digitalTest, pos, defs::IMAGE_TEST,
|
||||
-1);
|
||||
}
|
||||
|
||||
Result<int> Detector::setImageTestMode(int value, Positions pos) {
|
||||
return pimpl->Parallel(&slsDetector::digitalTest, pos,
|
||||
defs::IMAGE_TEST, value);
|
||||
return pimpl->Parallel(&slsDetector::digitalTest, pos, defs::IMAGE_TEST,
|
||||
value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// CTB Specific
|
||||
|
||||
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 {
|
||||
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) {
|
||||
@ -1096,7 +1077,8 @@ Result<int> Detector::getMaxDBITPhaseShift(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) {
|
||||
@ -1108,7 +1090,8 @@ Result<int> Detector::getADCClock(Positions pos) const {
|
||||
}
|
||||
|
||||
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 {
|
||||
@ -1117,7 +1100,8 @@ Result<int> Detector::getDBITClock(Positions pos) const {
|
||||
}
|
||||
|
||||
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 {
|
||||
@ -1126,7 +1110,8 @@ Result<int> Detector::getRUNClock(Positions pos) const {
|
||||
}
|
||||
|
||||
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 {
|
||||
@ -1152,7 +1137,6 @@ void Detector::setDBITPipeline(int value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setSpeed, pos, defs::DBIT_PIPELINE, value, 0);
|
||||
}
|
||||
|
||||
|
||||
Result<int> Detector::getVrefVoltage(bool mV, Positions pos) const {
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Pattern
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Moench
|
||||
|
||||
Result<std::string> Detector::getAdditionalJsonHeader(Positions pos) const {
|
||||
@ -1449,12 +1429,11 @@ void Detector::setDetectorMode(defs::detectorModeType value, Positions pos) {
|
||||
"detectorMode", defs::getDetectorModeType(value));
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Advanced
|
||||
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Insignificant
|
||||
|
||||
|
||||
Result<int> Detector::getControlPort(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getControlPort, pos);
|
||||
}
|
||||
@ -1565,7 +1541,6 @@ Result<ns> Detector::getMeasurementTime(Positions pos) const {
|
||||
|
||||
std::string Detector::getUserDetails() const { return pimpl->getUserDetails(); }
|
||||
|
||||
|
||||
Result<uint64_t> Detector::getRxCurrentFrameIndex(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getReceiverCurrentFrameIndex, pos);
|
||||
}
|
||||
|
@ -233,17 +233,23 @@ std::string multiSlsDetector::getUserDetails() {
|
||||
std::ostringstream sstream;
|
||||
sstream << "\nHostname: ";
|
||||
for (auto &d : detectors) {
|
||||
sstream << (d->isFixedPatternSharedMemoryCompatible() ? d->getHostname() : "Unknown") << "+";
|
||||
sstream << (d->isFixedPatternSharedMemoryCompatible() ? d->getHostname()
|
||||
: "Unknown")
|
||||
<< "+";
|
||||
}
|
||||
sstream << "\nType: ";
|
||||
// get type from multi shm
|
||||
if (multi_shm()->shmversion >= MULTI_SHMAPIVERSION) {
|
||||
sstream << slsDetectorDefs::detectorTypeToString(getDetectorTypeAsEnum());
|
||||
sstream << slsDetectorDefs::detectorTypeToString(
|
||||
getDetectorTypeAsEnum());
|
||||
}
|
||||
// get type from slsdet shm
|
||||
else {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
std::string multiSlsDetector::exec(const char *cmd) {
|
||||
int bufsize = 128;
|
||||
char buffer[bufsize];
|
||||
@ -349,11 +354,13 @@ std::string multiSlsDetector::exec(const char *cmd) {
|
||||
return result;
|
||||
}
|
||||
|
||||
void multiSlsDetector::setVirtualDetectorServers(const int numdet, const int port) {
|
||||
void multiSlsDetector::setVirtualDetectorServers(const int numdet,
|
||||
const int port) {
|
||||
std::vector<std::string> hostnames;
|
||||
for (int i = 0; i < numdet; ++i) {
|
||||
// * 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);
|
||||
}
|
||||
@ -434,8 +441,7 @@ void multiSlsDetector::addSlsDetector(const std::string &hostname) {
|
||||
}
|
||||
|
||||
// get type by connecting
|
||||
detectorType type =
|
||||
slsDetector::getTypeFromDetector(host, port);
|
||||
detectorType type = slsDetector::getTypeFromDetector(host, port);
|
||||
int pos = (int)detectors.size();
|
||||
detectors.push_back(
|
||||
sls::make_unique<slsDetector>(type, multiId, pos, false));
|
||||
@ -443,7 +449,8 @@ void multiSlsDetector::addSlsDetector(const std::string &hostname) {
|
||||
detectors[pos]->setControlPort(port);
|
||||
detectors[pos]->setStopPort(port + 1);
|
||||
detectors[pos]->setHostname(host);
|
||||
multi_shm()->multiDetectorType = getDetectorTypeAsEnum(-1);// -1 needed here
|
||||
multi_shm()->multiDetectorType =
|
||||
getDetectorTypeAsEnum(-1); // -1 needed here
|
||||
}
|
||||
|
||||
void multiSlsDetector::updateDetectorSize() {
|
||||
@ -467,8 +474,7 @@ void multiSlsDetector::updateDetectorSize() {
|
||||
multi_shm()->numberOfChannels.x = det_size.x * ndetx;
|
||||
multi_shm()->numberOfChannels.y = det_size.y * ndety;
|
||||
|
||||
FILE_LOG(logDEBUG)
|
||||
<< "\n\tNumber of Detectors in X direction:"
|
||||
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
|
||||
@ -477,7 +483,6 @@ void multiSlsDetector::updateDetectorSize() {
|
||||
<< "\n\tNumber of Channels in Y direction:"
|
||||
<< multi_shm()->numberOfChannels.y;
|
||||
|
||||
|
||||
for (auto &d : detectors) {
|
||||
d->updateMultiSize(multi_shm()->numberOfDetector);
|
||||
}
|
||||
@ -528,7 +533,8 @@ slsDetectorDefs::xy multiSlsDetector::getNumberOfChannels(int detPos) const {
|
||||
|
||||
void multiSlsDetector::setNumberOfChannels(const slsDetectorDefs::xy c) {
|
||||
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;
|
||||
}
|
||||
@ -1058,7 +1064,6 @@ int multiSlsDetector::setDynamicRange(int dr, int detPos) {
|
||||
auto r = parallelCall(&slsDetector::setDynamicRange, dr);
|
||||
int ret = sls::minusOneIfDifferent(r);
|
||||
|
||||
|
||||
// change in dr
|
||||
if (dr != -1 && dr != prevValue) {
|
||||
|
||||
@ -1125,7 +1130,8 @@ int multiSlsDetector::getADC(dacIndex index, int detPos) {
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
slsDetectorDefs::timingMode multiSlsDetector::setTimingMode(timingMode pol, int detPos) {
|
||||
slsDetectorDefs::timingMode multiSlsDetector::setTimingMode(timingMode pol,
|
||||
int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->setTimingMode(pol);
|
||||
@ -1712,7 +1718,6 @@ void multiSlsDetector::setReceiverDataStreamingOutIP(const std::string &ip,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string multiSlsDetector::getReceiverStreamingIP(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
@ -2139,7 +2144,8 @@ int multiSlsDetector::enableGapPixels(int val, int detPos) {
|
||||
|
||||
if (val != -1) {
|
||||
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.y = 0;
|
||||
for (auto &it : res) {
|
||||
@ -2152,7 +2158,8 @@ int multiSlsDetector::enableGapPixels(int val, int detPos) {
|
||||
|
||||
void multiSlsDetector::setGapPixelsEnable(bool enable, Positions pos) {
|
||||
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.y = 0;
|
||||
for (auto &it : res) {
|
||||
@ -2829,7 +2836,8 @@ void multiSlsDetector::readFrameFromReceiver() {
|
||||
// updates its header data
|
||||
gappixelsenable =
|
||||
(doc["gappixels"].GetUint() == 0) ? false : true;
|
||||
quadEnable = (doc["quad"].GetUint() == 0) ? false : true;
|
||||
quadEnable =
|
||||
(doc["quad"].GetUint() == 0) ? false : true;
|
||||
FILE_LOG(logDEBUG1)
|
||||
<< "One Time Header Info:"
|
||||
"\n\tsize: "
|
||||
@ -2906,8 +2914,7 @@ void multiSlsDetector::readFrameFromReceiver() {
|
||||
}
|
||||
}
|
||||
}
|
||||
FILE_LOG(logDEBUG)
|
||||
<< "Call Back Info:"
|
||||
FILE_LOG(logDEBUG) << "Call Back Info:"
|
||||
<< "\n\t nDetPixelsX: " << nDetPixelsX
|
||||
<< "\n\t nDetPixelsY: " << nDetPixelsY
|
||||
<< "\n\t databytes: " << multisize
|
||||
@ -2925,9 +2932,9 @@ void multiSlsDetector::readFrameFromReceiver() {
|
||||
nDetPixelsX = nX * (nPixelsX + 3);
|
||||
nDetPixelsY = nY * (nPixelsY + 1);
|
||||
}
|
||||
int n = processImageWithGapPixels(multiframe, multigappixels, quadEnable);
|
||||
FILE_LOG(logDEBUG)
|
||||
<< "Call Back Info Recalculated:"
|
||||
int n = processImageWithGapPixels(multiframe, multigappixels,
|
||||
quadEnable);
|
||||
FILE_LOG(logDEBUG) << "Call Back Info Recalculated:"
|
||||
<< "\n\t nDetPixelsX: " << nDetPixelsX
|
||||
<< "\n\t nDetPixelsY: " << nDetPixelsY
|
||||
<< "\n\t databytes: " << n;
|
||||
@ -2986,15 +2993,18 @@ void multiSlsDetector::readFrameFromReceiver() {
|
||||
delete[] multigappixels;
|
||||
}
|
||||
|
||||
int multiSlsDetector::processImageWithGapPixels(char *image, char *&gpImage, bool quadEnable) {
|
||||
int multiSlsDetector::processImageWithGapPixels(char *image, char *&gpImage,
|
||||
bool quadEnable) {
|
||||
// eiger 4 bit mode
|
||||
int nxb = multi_shm()->numberOfDetector.x * (512 + 3); //(divided by 2 already)
|
||||
int nxb =
|
||||
multi_shm()->numberOfDetector.x * (512 + 3); //(divided by 2 already)
|
||||
int nyb = multi_shm()->numberOfDetector.y * (256 + 1);
|
||||
int nchipInRow = 4;
|
||||
int nxchip = multi_shm()->numberOfDetector.x * 4;
|
||||
int nychip = multi_shm()->numberOfDetector.y * 1;
|
||||
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);
|
||||
nxchip /= 2;
|
||||
nychip *= 2;
|
||||
@ -3002,8 +3012,6 @@ int multiSlsDetector::processImageWithGapPixels(char *image, char *&gpImage, boo
|
||||
}
|
||||
int gapdatabytes = nxb * nyb;
|
||||
|
||||
|
||||
|
||||
// allocate
|
||||
if (gpImage == nullptr) {
|
||||
gpImage = new char[gapdatabytes];
|
||||
@ -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 ichipy = 0; ichipy < b1chipy;
|
||||
++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;
|
||||
mod = (col + 1) % nchipInRow; // get gap pixels
|
||||
// copy gap pixel(chip 0, 1, 2)
|
||||
@ -3618,15 +3627,18 @@ void multiSlsDetector::registerDataCallback(
|
||||
}
|
||||
|
||||
int multiSlsDetector::setTotalProgress() {
|
||||
int nf = Parallel(&slsDetector::setTimer, {}, FRAME_NUMBER, -1).tsquash("Inconsistent number of frames");
|
||||
int nc = Parallel(&slsDetector::setTimer, {}, CYCLES_NUMBER, -1).tsquash("Inconsistent number of cycles");
|
||||
int nf = Parallel(&slsDetector::setTimer, {}, FRAME_NUMBER, -1)
|
||||
.tsquash("Inconsistent number of frames");
|
||||
int nc = Parallel(&slsDetector::setTimer, {}, CYCLES_NUMBER, -1)
|
||||
.tsquash("Inconsistent number of cycles");
|
||||
if (nf == 0 || nc == 0) {
|
||||
throw RuntimeError("Number of frames or cycles is 0");
|
||||
}
|
||||
|
||||
int ns = 1;
|
||||
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;
|
||||
}
|
||||
|
||||
@ -3904,9 +3916,3 @@ std::vector<char> multiSlsDetector::readPofFile(const std::string &fname) {
|
||||
FILE_LOG(logINFO) << "Read file into memory";
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
|
||||
using namespace sls;
|
||||
|
||||
|
||||
// create shm
|
||||
slsDetector::slsDetector(detectorType type, int multi_id, int det_id,
|
||||
bool verify)
|
||||
@ -590,8 +589,10 @@ void slsDetector::updateNumberOfChannels() {
|
||||
|
||||
slsDetectorDefs::xy slsDetector::getNumberOfChannels() const {
|
||||
slsDetectorDefs::xy coord;
|
||||
coord.x = (shm()->nChan.x * shm()->nChip.x + shm()->gappixels * shm()->nGappixels.x);
|
||||
coord.y = (shm()->nChan.y * shm()->nChip.y + shm()->gappixels * shm()->nGappixels.y);
|
||||
coord.x = (shm()->nChan.x * shm()->nChip.x +
|
||||
shm()->gappixels * shm()->nGappixels.x);
|
||||
coord.y = (shm()->nChan.y * shm()->nChip.y +
|
||||
shm()->gappixels * shm()->nGappixels.y);
|
||||
return coord;
|
||||
}
|
||||
|
||||
@ -601,7 +602,6 @@ bool slsDetector::getQuad() {
|
||||
sendToDetector(F_GET_QUAD, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "Quad Type :" << retval;
|
||||
return (retval == 0 ? false : true);
|
||||
|
||||
}
|
||||
|
||||
void slsDetector::setQuad(const bool enable) {
|
||||
@ -617,7 +617,8 @@ void slsDetector::setQuad(const bool enable) {
|
||||
void slsDetector::setReadNLines(const int value) {
|
||||
FILE_LOG(logDEBUG1) << "Setting read n lines to " << value;
|
||||
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) {
|
||||
sendToReceiver(F_SET_RECEIVER_READ_N_LINES, value, nullptr);
|
||||
}
|
||||
@ -635,7 +636,6 @@ void slsDetector::updateMultiSize(slsDetectorDefs::xy det) {
|
||||
shm()->multiSize = det;
|
||||
}
|
||||
|
||||
|
||||
int slsDetector::setControlPort(int port_number) {
|
||||
int retval = -1;
|
||||
FILE_LOG(logDEBUG1) << "Setting control port to " << port_number;
|
||||
@ -1438,9 +1438,7 @@ int slsDetector::setDynamicRange(int n) {
|
||||
return shm()->dynamicRange;
|
||||
}
|
||||
|
||||
int slsDetector::getDynamicRangeFromShm() {
|
||||
return shm()->dynamicRange;
|
||||
}
|
||||
int slsDetector::getDynamicRangeFromShm() { return shm()->dynamicRange; }
|
||||
|
||||
int slsDetector::setDAC(int val, dacIndex index, int mV) {
|
||||
int args[]{static_cast<int>(index), mV, val};
|
||||
@ -2190,7 +2188,8 @@ void slsDetector::setROI(slsDetectorDefs::ROI arg) {
|
||||
arg.xmin = -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);
|
||||
client.Send(&fnum, sizeof(fnum));
|
||||
client.Send(&arg.xmin, sizeof(int));
|
||||
@ -2243,8 +2242,7 @@ slsDetectorDefs::ROI slsDetector::getROI() {
|
||||
client.Receive(&retval.xmin, sizeof(int));
|
||||
client.Receive(&retval.xmax, sizeof(int));
|
||||
FILE_LOG(logDEBUG1)
|
||||
<< "ROI retval [" << retval.xmin << ","
|
||||
<< retval.xmax << "]";
|
||||
<< "ROI retval [" << retval.xmin << "," << retval.xmax << "]";
|
||||
if (ret == FORCE_UPDATE) {
|
||||
updateCachedDetectorVariables();
|
||||
}
|
||||
@ -2258,8 +2256,6 @@ slsDetectorDefs::ROI slsDetector::getROI() {
|
||||
return shm()->roi;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void slsDetector::setADCEnableMask(uint32_t mask) {
|
||||
uint32_t arg = mask;
|
||||
FILE_LOG(logDEBUG1) << "Setting ADC Enable mask to 0x" << std::hex << arg
|
||||
@ -2414,9 +2410,7 @@ bool slsDetector::setDeactivatedRxrPaddingMode(int padding) {
|
||||
return shm()->rxPadDeactivatedModules;
|
||||
}
|
||||
|
||||
int slsDetector::getFlippedDataX() const {
|
||||
return shm()->flippedDataX;
|
||||
}
|
||||
int slsDetector::getFlippedDataX() const { return shm()->flippedDataX; }
|
||||
|
||||
int slsDetector::setFlippedDataX(int 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 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) {
|
||||
sendToReceiver(F_SET_FLIPPED_DATA_RECEIVER, arg, retval);
|
||||
FILE_LOG(logDEBUG1) << "Flipped data:" << retval;
|
||||
|
Reference in New Issue
Block a user