Detector

The sls::Detector is the public API to control detectors from C++. This API is also used internally for the Python bindings and the command line interface. If a receiver has been configured, this is also controlled through this class.

Most, if not all, functions are called in parallel and the return value is a thin std::vector wrapper containing results from all modules. (Result class)

Here are some examples on how to use the API.

class Detector

Configuration

Detector(int shm_id = 0)
Parameters

shm_id – detector shared memory id Default value is 0. Can be set to more values for multiple detectors.It is important only if you are controlling multiple detectors from the same pc.

~Detector()
Detector(const Detector &other) = delete
Detector &operator=(const Detector &other) = delete
Detector(Detector &&other) noexcept
Detector &operator=(Detector &&other) noexcept
void loadConfig(const std::string &fname)

Frees shared memory before loading configuration file. Set up once normally

void loadParameters(const std::string &fname)

Shared memory not freed prior. Set up per measurement.

void loadParameters(const std::vector<std::string> &parameters)
Result<std::string> getHostname(Positions pos = {}) const
void setHostname(const std::vector<std::string> &hostname)

Frees shared memory, adds detectors to the list.

void setVirtualDetectorServers(int numServers, uint16_t startingPort)

connects to n servers at local host starting at specific control port. Every virtual server will have a stop port (control port + 1)

int getShmId() const

Gets shared memory ID

std::string getPackageVersion() const
std::string getClientVersion() const
Result<int64_t> getFirmwareVersion(Positions pos = {}) const
Result<int64_t> getFrontEndFirmwareVersion(const defs::fpgaPosition fpgaPosition, Positions pos = {}) const

[Eiger] Options: FRONT_LEFT, FRONT_RIGHT

Result<std::string> getDetectorServerVersion(Positions pos = {}) const
Result<std::string> getHardwareVersion(Positions pos = {}) const
Result<std::string> getKernelVersion(Positions pos = {}) const
Result<int64_t> getSerialNumber(Positions pos = {}) const
Result<int> getModuleId(Positions pos = {}) const

[Eiger][Gotthard2][Mythen3][Jungfrau][Moench] 6 bit value (ideally unique) that is streamed out in the UDP header of the detector.

Result<std::string> getReceiverVersion(Positions pos = {}) const
Result<defs::detectorType> getDetectorType(Positions pos = {}) const

Options: EIGER, JUNGFRAU, GOTTHARD, MOENCH, MYTHEN3, GOTTHARD2, CHIPTESTBOARD, XILINX_CHIPTESTBOARD

int size() const

Gets the total number of modules in shared memory

bool empty() const
defs::xy getModuleGeometry() const
Result<defs::xy> getModuleSize(Positions pos = {}) const
defs::xy getDetectorSize() const

Gets the actual full detector size. It is the same even if ROI changes

void setDetectorSize(const defs::xy value)

Sets the detector size in both dimensions (number of channels).

This value is used to calculate row and column positions for each module and included into udp data packet header.

By default, it adds modules in y dimension for 2d detectors and in x dimension for 1d detectors.

std::vector<defs::detectorSettings> getSettingsList() const

list of possible settings for this detector

Result<defs::detectorSettings> getSettings(Positions pos = {}) const

[Jungfrau][Moench][Gotthard][Gotthard2][Mythen3]

void setSettings(defs::detectorSettings value, Positions pos = {})

[Jungfrau] GAIN0, HIGHGAIN0

[Gotthard] DYNAMICGAIN, HIGHGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN

[Gotthard2] DYNAMICGAIN, FIXGAIN1, FIXGAIN2

[Mythen3] STANDARD, FAST, HIGHGAIN. Also changes vrshaper and vrpreamp

[Eiger] Use threshold command. Settings loaded from file found in settingspath

[Moench] G1_HIGHGAIN, G1_LOWGAIN, G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN, G2_LOWCAP_HIGHGAIN, G2_LOWCAP_LOWGAIN, G4_HIGHGAIN, G4_LOWGAIN

Result<int> getThresholdEnergy(Positions pos = {}) const

[Eiger]

Result<std::array<int, 3>> getAllThresholdEnergy(Positions pos = {}) const

Mythen3] threshold energy for the three counters

void setThresholdEnergy(int threshold_ev, defs::detectorSettings settings = defs::STANDARD, bool trimbits = true, Positions pos = {})

[Eiger][Mythen3] It loads trim files from settingspath

void setThresholdEnergy(std::array<int, 3> threshold_ev, defs::detectorSettings settings = defs::STANDARD, bool trimbits = true, Positions pos = {})

[Mythen3] It loads trim files from settingspath. An energy of -1 will pick up values from detector

Result<std::string> getSettingsPath(Positions pos = {}) const

[Eiger][Mythen3]

void setSettingsPath(const std::string &value, Positions pos = {})

[Eiger][Mythen3] Directory where settings files are loaded from/to

void loadTrimbits(const std::string &fname, Positions pos = {})

[Eiger][Mythen3] If no extension specified, serial number of each module is attached.

void saveTrimbits(const std::string &fname, Positions pos = {})

[Eiger][Mythen3] If no extension specified, serial number of each module is attached.

Result<int> getAllTrimbits(Positions pos = {}) const

[Eiger][Mythen3] -1 if they are all different

void setAllTrimbits(int value, Positions pos = {})

[Eiger][Mythen3]

Result<std::vector<int>> getTrimEnergies(Positions pos = {}) const

[Eiger][Mythen3] Returns energies in eV where the module is trimmed

void setTrimEnergies(std::vector<int> energies, Positions pos = {})

[Eiger][Mythen3] List of trim energies, where corresponding default trim files exist in corresponding trim folders

bool getGapPixelsinCallback() const

[Eiger][Jungfrau][Moench]

void setGapPixelsinCallback(const bool enable)

[Eiger][Jungfrau][Moench] Include gap pixels in client data call back. Will not be in detector streaming, receiver file or streaming. Default is disabled.

Result<bool> getFlipRows(Positions pos = {}) const

[Eiger][Jungfrau][Moench]

void setFlipRows(bool value, Positions pos = {})

[Eiger] flips rows paramater sent to slsreceiver to stream as json parameter to flip rows in gui

[Jungfrau][Moench] flips rows in the detector itself. For bottom module and number of interfaces must be set to 2. slsReceiver and slsDetectorGui does not handle.slsReceiver and slsDetectorGui does not handle

Result<bool> getMaster(Positions pos = {}) const

[Eiger][Mythen3][Gotthard1][Gotthard2][Jungfrau][Moench] via stop server

void setMaster(bool value, int pos)

[Eiger][Gotthard2][Jungfrau][Moench] Set (half) module to master and the other(s) to slaves

Result<bool> getSynchronization(Positions pos = {}) const

[Jungfrau][Moench]

void setSynchronization(bool value)

[Jungfrau][Moench] Sync mode requires at least one master configured. Also requires flatband cabling between master and slave with termination board.

void getBadChannels(const std::string &fname, Positions pos = {}) const

[Gotthard2][Mythen3]

void setBadChannels(const std::string &fname, Positions pos = {})

[Gotthard2][Mythen3] [Mythen3] Also does trimming

Result<std::vector<int>> getBadChannels(Positions pos = {}) const

[Gotthard2][Mythen3]

void setBadChannels(const std::vector<int> list, Positions pos = {})

[Gotthard2][Mythen3] Empty list resets bad channel list

void setBadChannels(const std::vector<std::vector<int>> list)

[Gotthard2][Mythen3] Size of list should match number of modules. Each value is at module level and can start at 0. Empty vector resets bad channel list.

Result<int> getRow(Positions pos = {}) const
void setRow(const int value, Positions pos = {})

Set it in udp header. Gui uses it to rearrange for complete image

Result<int> getColumn(Positions pos = {}) const
void setColumn(const int value, Positions pos = {})

Set it in udp header. Gui uses it to rearrange for complete image

Result<bool> isVirtualDetectorServer(Positions pos = {}) const

Callbacks

void registerAcquisitionFinishedCallback(void (*func)(double, int, void*), void *pArg)

register callback for end of acquisition

Parameters
  • func – function to be called with parameters: current progress in percentage, detector status, pArg pointer

  • pArg – pointer that is returned in call back

void registerDataCallback(void (*func)(detectorData*, uint64_t, uint32_t, void*), void *pArg)

register callback for accessing reconstructed complete images Receiver sends out images via zmq, the client reconstructs them into complete images. Therefore, it also enables zmq streaming from receiver and the client.

Parameters
  • func – function to be called for each image with parameters: detector data structure, frame number, sub frame number (for eiger in 32 bit mode), pArg pointer

  • pArg – pointer that is returned in call back

Acquisition Parameters

Result<int64_t> getNumberOfFrames(Positions pos = {}) const
void setNumberOfFrames(int64_t value)

In trigger mode, number of frames per trigger. In scan mode, number of frames is set to number of steps

[Gotthard2] Burst mode has a maximum of 2720 frames.

Result<int64_t> getNumberOfTriggers(Positions pos = {}) const
void setNumberOfTriggers(int64_t value)
Result<ns> getExptime(Positions pos = {}) const

[Gotthard][Jungfrau][Moench][Eiger][CTB][Xilinx CTB][Gotthard2]

[Mythen3] use function with gate index

void setExptime(ns t, Positions pos = {})

[Gotthard][Jungfrau][Moench][Eiger][CTB][Xilinx CTB][Gotthard2]

[Mythen3] sets exptime for all gate signals. To specify gate index, use function with gate index

Result<ns> getPeriod(Positions pos = {}) const
void setPeriod(ns t, Positions pos = {})
Result<ns> getDelayAfterTrigger(Positions pos = {}) const

[Gotthard][Jungfrau][Moench][CTB][Mythen3][Gotthard2][Xilinx CTB]

void setDelayAfterTrigger(ns value, Positions pos = {})

[Gotthard][Jungfrau][Moench][CTB][Mythen3][Gotthard2][Xilinx CTB]

Result<int64_t> getNumberOfFramesLeft(Positions pos = {}) const

[Gotthard][Jungfrau][Moench][CTB][Mythen3][Xilinx CTB] [Gotthard2] only in continuous auto mode

Result<int64_t> getNumberOfTriggersLeft(Positions pos = {}) const

[Gotthard][Jungfrau][Moench][CTB][Mythen3][Xilinx CTB] Only when external trigger used

Result<ns> getPeriodLeft(Positions pos = {}) const

[Gotthard][Jungfrau][Moench][CTB][Mythen3][Gotthard2][Xilinx CTB] [Gotthard2] only in continuous mode

Result<ns> getDelayAfterTriggerLeft(Positions pos = {}) const

[Gotthard][Jungfrau][Moench][CTB][Mythen3][Xilinx CTB] [Gotthard2] only in continuous mode

Result<int> getDynamicRange(Positions pos = {}) const
void setDynamicRange(int value)

[Eiger] Options: 4, 8, 12, 16, 32. If i is 32, also sets clkdivider to 2, else sets clkdivider to 1

[Mythen3] Options: 8, 16, 32

[Jungfrau][Moench][Gotthard][CTB][Mythen3][Gotthard2][Xilinx CTB] 16

std::vector<int> getDynamicRangeList() const

list of possible dynamic ranges for this detector

Result<defs::timingMode> getTimingMode(Positions pos = {}) const
void setTimingMode(defs::timingMode value, Positions pos = {})

[Gotthard][Jungfrau][Moench][Gotthard][CTB][Gotthard2][Xilinx CTB] Options: AUTO_TIMING, TRIGGER_EXPOSURE

[Mythen3] Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, TRIGGER_GATED

[Eiger] Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER

std::vector<defs::timingMode> getTimingModeList() const

list of possible timing modes for this detector

Result<defs::speedLevel> getReadoutSpeed(Positions pos = {}) const

[Eiger][Jungfrau][Moench][Gotthard2][Mythen3]

void setReadoutSpeed(defs::speedLevel value, Positions pos = {})

[Eiger][Jungfrau][Moench][Gotthard2] [Jungfrau][Mythen3] Options: FULL_SPEED, HALF_SPEED (Default), QUARTER_SPEED

[Moench] Options: FULL_SPEED (Default)

[Eiger] Options: FULL_SPEED (Default), HALF_SPEED, QUARTER_SPEED

[Gotthard2] Options: G2_108MHZ (Default), G2_144MHZ

[Jungfrau][Moench] FULL_SPEED option only available from v2.0 boards and is recommended to set number of interfaces to 2.

Also overwrites adcphase to recommended default.

std::vector<defs::speedLevel> getReadoutSpeedList() const

list of possible readoutspeed modes for this detector

Result<int> getADCPhase(Positions pos = {}) const

[Jungfrau][Moench][CTB]

void setADCPhase(int value, Positions pos = {})

[Gotthard][Jungfrau][Moench][CTB] [Jungfrau][Moench] Absolute phase shift. Changing Speed also resets adcphase to recommended defaults.

[Ctb] Absolute phase shift. Changing adcclk also resets adcphase and sets it to previous values.

[Gotthard] Relative phase shift

Result<int> getMaxADCPhaseShift(Positions pos = {}) const

[Jungfrau][Moench][CTB]

Result<int> getADCPhaseInDegrees(Positions pos = {}) const

[Gotthard][Jungfrau][Moench][CTB]

void setADCPhaseInDegrees(int value, Positions pos = {})

[Gotthard][Jungfrau][Moench][CTB] [Jungfrau][Moench] Absolute phase shift. Changing Speed also resets adcphase to recommended defaults.

[Ctb] Absolute phase shift. Changing adcclk also resets adcphase and sets it to previous values.

[Gotthard] Relative phase shift

Result<int> getDBITPhase(Positions pos = {}) const

[CTB][Jungfrau]

void setDBITPhase(int value, Positions pos = {})

[CTB][Jungfrau] Absolute phase shift

[CTB] changing dbitclk also resets dbitphase and sets to previous values.

Result<int> getMaxDBITPhaseShift(Positions pos = {}) const

[CTB][Jungfrau]

Result<int> getDBITPhaseInDegrees(Positions pos = {}) const

[CTB][Jungfrau]

void setDBITPhaseInDegrees(int value, Positions pos = {})

[CTB][Jungfrau] Absolute phase shift

[CTB] changing dbitclk also resets dbitphase and sets to previous values.

Result<int> getClockFrequency(int clkIndex, Positions pos = {})

[Mythen3][Gotthard2] Hz

Result<int> getClockPhase(int clkIndex, Positions pos = {})

[Mythen3][Gotthard2]

void setClockPhase(int clkIndex, int value, Positions pos = {})

[Mythen3][Gotthard2] absolute phase shift

[Gotthard2] clkIndex: 0-5, [Mythen3] clkIndex 0 only

Result<int> getMaxClockPhaseShift(int clkIndex, Positions pos = {})

[Mythen3][Gotthard2]

Result<int> getClockPhaseinDegrees(int clkIndex, Positions pos = {})

[Mythen3][Gotthard2]

void setClockPhaseinDegrees(int clkIndex, int value, Positions pos = {})

[Mythen3][Gotthard2]

[Gotthard2] clkIndex: 0-5, [Mythen3] clkIndex 0 only

Result<int> getClockDivider(int clkIndex, Positions pos = {})

[Mythen3][Gotthard2]

void setClockDivider(int clkIndex, int value, Positions pos = {})

[Mythen3][Gotthard2] Must be greater than 1.

[Gotthard2] clkIndex: 0-5, [Mythen3] clkIndex 0 only

Result<int> getHighVoltage(Positions pos = {}) const
void setHighVoltage(int value, Positions pos = {})

[Gotthard] Options: 0, 90, 110, 120, 150, 180, 200 [Jungfrau][Moench][CTB] Options: 0, 60 - 200 [Eiger][Mythen3][Gotthard2] Options: 0 - 200

Result<bool> getPowerChip(Positions pos = {}) const

[Jungfrau][Moench][Mythen3][Gotthard2][Xilinx Ctb]

void setPowerChip(bool on, Positions pos = {})

[Jungfrau][Moench][Mythen3][Gotthard2][Xilinx Ctb] Power the chip.

Default is disabled.

[Jungfrau][Moench] Default is disabled. Get will return power status. Can be off if temperature event occured (temperature over temp_threshold with temp_control enabled. Will configure chip (only chip v1.1)

[Mythen3][Gotthard2] Default is 1. If module not connected or wrong module, powerchip will fail.

[Xilinx CTB] Default is 0. Also configures chip if powered on.

Result<int> getImageTestMode(Positions pos = {})

[Gotthard][Eiger virtual]

void setImageTestMode(const int value, Positions pos = {})

[Gotthard] If 1, adds channel intensity with precalculated values. Default is 0

[Eiger][Jungfrau][Moench] Only for virtual servers, if 1, pixels are saturated. If 0, increasing intensity

std::vector<defs::dacIndex> getTemperatureList() const

gets list of temperature indices for this detector

Result<int> getTemperature(defs::dacIndex index, Positions pos = {}) const

(Degrees) [Mythen3][Gotthard2][Xilinx Ctb] Options: TEMPERATURE_FPGA [Gotthard] Options: TEMPERATURE_ADC, TEMPERATURE_FPGA

[Jungfrau][Moench] Options: TEMPERATURE_ADC, TEMPERATURE_FPGA

[Eiger] Options: TEMPERATURE_FPGA, TEMPERATURE_FPGAEXT, TEMPERATURE_10GE, TEMPERATURE_DCDC, TEMPERATURE_SODL, TEMPERATURE_SODR, TEMPERATURE_FPGA2, TEMPERATURE_FPGA3

[CTB] Options: SLOW_ADC_TEMP

std::vector<defs::dacIndex> getDacList() const

gets list of dac enums for this detector

Result<int> getDefaultDac(defs::dacIndex index, Positions pos = {})

[Eiger][Jungfrau][Moench][Gotthard][Gotthard2][Mythen3]

void setDefaultDac(defs::dacIndex index, int defaultValue, Positions pos = {})

[Eiger][Jungfrau][Moench][Gotthard][Gotthard2][Mythen3]

Result<int> getDefaultDac(defs::dacIndex index, defs::detectorSettings sett, Positions pos = {})

[Jungfrau][Moench][Mythen3]

void setDefaultDac(defs::dacIndex index, int defaultValue, defs::detectorSettings sett, Positions pos = {})

[Jungfrau][Moench][Mythen3]

void resetToDefaultDacs(const bool hardReset, Positions pos = {})

[Eiger][Jungfrau][Moench][Gotthard][Gotthard2][Mythen3] reset to defaults, hardReset will reset to hardcoded defaults on on-board server

Result<int> getDAC(defs::dacIndex index, bool mV = false, Positions pos = {}) const
void setDAC(defs::dacIndex index, int value, bool mV = false, Positions pos = {})
Result<int> getOnChipDAC(defs::dacIndex index, int chipIndex, Positions pos = {}) const

[Gotthard2]

void setOnChipDAC(defs::dacIndex index, int chipIndex, int value, Positions pos = {})

[Gotthard2]

Result<defs::externalSignalFlag> getExternalSignalFlags(int signalIndex, Positions pos = {}) const

[Gotthard] signal index is 0 [Mythen3] signal index 0-3 for master input, 4-7 master output signals

void setExternalSignalFlags(int signalIndex, defs::externalSignalFlag value, Positions pos = {})

[Gotthard] signal index is 0 Options: TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE [Mythen3] signal index 0 is master input trigger signal, 1-3 for master input gate signals, 4 is busy out signal, 5-7 is master output gate signals. Options: TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE (for master input trigger only), INVERSION_ON, INVERSION_OFF

Result<bool> getParallelMode(Positions pos = {}) const

[Eiger][Mythen3][Gotthard2][Moench]

void setParallelMode(bool value, Positions pos = {})

[Eiger][Mythen3][Gotthard2][Moench] [Mythen3] If exposure time is too short, acquisition will return with an ERROR and take fewer frames than expected

[Mythen3][Eiger][Moench] Default: Non parallel

[Gotthard2] Default: Parallel. Non parallel mode works only in continuous mode.

Result<int> getFilterResistor(Positions pos = {}) const

[Gotthard2][Jungfrau]

void setFilterResistor(int value, Positions pos = {})

[Gotthard2][Jungfrau] Set

filter resistor. Increasing values for increasing resistance.

[Gotthard2] Options: [0|1|2|3]. Default is 0.

[Jungfrau] Options: [0|1]. Default is 1.

Result<defs::currentSrcParameters> getCurrentSource(Positions pos = {}) const

[Gotthard2][Jungfrau]

void setCurrentSource(defs::currentSrcParameters par, Positions pos = {})

[Gotthard2][Jungfrau] Please refer documentation on currentSrcParameters (sls_detector_defs.h) on the structure and its members

Result<int> getDBITPipeline(Positions pos = {}) const

[CTB][Gotthard2]

void setDBITPipeline(int value, Positions pos = {})

[CTB] Options: 0-255

[Gotthard2] Options: 0-7

Result<int> getReadNRows(Positions pos = {}) const

[Eiger][Jungfrau][Moench]

void setReadNRows(const int lines, Positions pos = {})

[Eiger] Number of rows to read out per half module Options: 0 - 256. 256 is default. The permissible values depend on dynamic range and 10Gbe enabled.

[Jungfrau][Moench] Number of rows per module starting from the centre. Options: 8 - 512, must be multiples of 8. Default is 512.

Acquisition

void acquire()

Blocking call: Acquire the number of frames set

  • sets acquiring flag

  • starts the receiver listener (if enabled)

  • starts detector acquisition for number of frames set

  • monitors detector status from running to idle

  • stops the receiver listener (if enabled)

  • increments file index if file write enabled

  • resets acquiring flag Control server is blocked and cannot accept other commands until acquisition is done.

void clearAcquiringFlag()

If acquisition aborted during blocking acquire, use this to clear acquiring flag in shared memory before starting next acquisition

void startReceiver()

Non Blocking: Start receiver listener and create data file if file write enabled

void stopReceiver()

Non Blocking: Stops receiver listener for detector data packets and closes current data file (if file write enabled).

void startDetector(Positions pos = {})

Non blocking: start detector acquisition. Status changes to RUNNING or WAITING and automatically returns to idle at the end of acquisition. [Mythen3] Master starts acquisition first

void startDetectorReadout()

[Mythen3] Non blocking: start detector readout of counters in chip. Status changes to TRANSMITTING and automatically returns to idle at the end of readout. [Eiger] Master stops acquisition last

void stopDetector(Positions pos = {})

Non blocking: Abort detector acquisition. Status changes to IDLE or STOPPED. Goes to stop server.

Result<defs::runStatus> getDetectorStatus(Positions pos = {}) const

IDLE, ERROR, WAITING, RUN_FINISHED, TRANSMITTING, RUNNING, STOPPED

Goes to stop server

Result<defs::runStatus> getReceiverStatus(Positions pos = {}) const

Options: IDLE, TRANSMITTING, RUNNING

Result<std::vector<int64_t>> getFramesCaught(Positions pos = {}) const

Gets the number of frames caught for each port in receiver.

Result<std::vector<int64_t>> getNumMissingPackets(Positions pos = {}) const

Gets the number of missing packets for each port in receiver. Negative number denotes extra packets.

Result<std::vector<int64_t>> getRxCurrentFrameIndex(Positions pos = {}) const

Gets frame index for each port in receiver.

Result<uint64_t> getNextFrameNumber(Positions pos = {}) const

[Eiger][Jungfrau][Moench][CTB][Xilinx CTB][Gotthard2]

void setNextFrameNumber(uint64_t value, Positions pos = {})

[Eiger][Jungfrau][Moench][CTB][Xilinx CTB][Gotthard2] Stopping acquisition might result in different frame numbers for different modules. So, after stopping, next frame number (max + 1) is set for all the modules afterwards.

void sendSoftwareTrigger(const bool block = false, Positions pos = {})

[Eiger][Mythen3][Jungfrau][Moench] Sends an internal software trigger to the detector block true if command blocks till frames are sent out from that trigger [Eiger][Jungfrau][Moench] Block can be true

Result<defs::scanParameters> getScan(Positions pos = {}) const
void setScan(const defs::scanParameters t)

enables/ disables scans for dac and trimbits

Enabling scan sets number of frames to number of steps in receiver.

To cancel scan configuration, set dac to ‘0’, which also sets number of frames to 1

[Eiger/ Mythen3] Trimbits using TRIMBIT_SCAN

Result<std::string> getScanErrorMessage(Positions pos = {}) const

Gets Scan error message if scan ended in error for non blocking acquisitions.

Network Configuration (Detector<->Receiver)

Result<int> getNumberofUDPInterfaces(Positions pos = {}) const

[Jungfrau][Moench][Gotthard2][Eiger]

void setNumberofUDPInterfaces(int n, Positions pos = {})

[Jungfrau][Moench][Gotthard2] Number of udp interfaces to stream data from detector. Default is 1.

Also enables second interface in receiver for listening (Writes a file per interface if writing enabled).

Also restarts client and receiver zmq sockets if zmq streaming enabled.

[Gotthard2] second interface enabled to send veto information via 10Gbps for debugging. By default, if veto enabled, it is sent via 2.5 gbps interface.

Result<int> getSelectedUDPInterface(Positions pos = {}) const

[Jungfrau][Moench]

void selectUDPInterface(int interface, Positions pos = {})

[Jungfrau][Moench] Effective only when number of interfaces is 1. Options: 0 (outer, default), 1(inner)] //TODO: enum?

Result<IpAddr> getSourceUDPIP(Positions pos = {}) const
void setSourceUDPIP(const IpAddr ip, Positions pos = {})

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 same subnet of the destination UDP IP

Result<IpAddr> getSourceUDPIP2(Positions pos = {}) const

[Jungfrau][Moench] bottom half [Gotthard2] veto debugging

void setSourceUDPIP2(const IpAddr ip, Positions pos = {})

[Jungfrau][Moench] bottom half [Gotthard2] veto debugging.

The source UDP IP must be in the same subnet of the destination UDP IP2

Result<MacAddr> getSourceUDPMAC(Positions pos = {}) const
void setSourceUDPMAC(const MacAddr mac, Positions pos = {})

For Eiger 1G, the detector will replace with its own DHCP MAC For Eiger 10G, the detector will replace with its own DHCP MAC + 1 Others can be anything (beware of certain bits)

Result<MacAddr> getSourceUDPMAC2(Positions pos = {}) const

[Jungfrau][Moench] bottom half [Gotthard2] veto debugging

void setSourceUDPMAC2(const MacAddr mac, Positions pos = {})

[Jungfrau][Moench] bottom half [Gotthard2] veto debugging

Result<UdpDestination> getDestinationUDPList(const uint32_t entry, Positions pos = {}) const
void setDestinationUDPList(const UdpDestination, const int module_id)
Result<int> getNumberofUDPDestinations(Positions pos = {}) const

[Jungfrau][Moench][Eiger][Mythen3][Gotthard2]

void clearUDPDestinations(Positions pos = {})
Result<int> getFirstUDPDestination(Positions pos = {}) const

[Jungfrau][Moench][Mythen3][Gotthard2]

void setFirstUDPDestination(const int value, Positions pos = {})

[Jungfrau][Moench][Gotthard2] Options 0-31 (or number of udp destinations)

[Mythen3] Options 0-63 (or number of udp destinations)

Result<IpAddr> getDestinationUDPIP(Positions pos = {}) const
void setDestinationUDPIP(const IpAddr ip, Positions pos = {})

IP of the interface in receiver that the detector sends data to

Result<IpAddr> getDestinationUDPIP2(Positions pos = {}) const

[Jungfrau][Moench] bottom half

[Gotthard2] veto debugging

void setDestinationUDPIP2(const IpAddr ip, Positions pos = {})

[Jungfrau][Moench] bottom half

[Gotthard2] veto debugging

Result<MacAddr> getDestinationUDPMAC(Positions pos = {}) const
void setDestinationUDPMAC(const MacAddr mac, Positions pos = {})

Mac address of the receiver (destination) udp interface. Not mandatory to set as setDestinationUDPIP (udp_dstip) retrieves it from slsReceiver process but must be set if you use a custom receiver (not slsReceiver).

Use router mac address if router in between detector and receiver.

Result<MacAddr> getDestinationUDPMAC2(Positions pos = {}) const

[Jungfrau][Moench] bottom half

[Gotthard2] veto debugging

void setDestinationUDPMAC2(const MacAddr mac, Positions pos = {})
Result<uint16_t> getDestinationUDPPort(Positions pos = {}) const
void setDestinationUDPPort(uint16_t port, int module_id = -1)

Default is 50001.

If module_id is -1, ports for each module is calculated (incremented by 1 if no 2nd interface)

Result<uint16_t> getDestinationUDPPort2(Positions pos = {}) const

[Eiger] right port[Jungfrau][Moench] bottom half [Gotthard2] veto debugging

void setDestinationUDPPort2(uint16_t port, int module_id = -1)

[Eiger] right port[Jungfrau][Moench] bottom half [Gotthard2] veto debugging

Default is 50002.

If module_id is -1, ports for each module is calculated (incremented by 1 if no 2nd interface)

void reconfigureUDPDestination(Positions pos = {})

Reconfigures Detector with UDP destination. More for debugging as the configuration is done automatically when the detector has sufficient UDP details.

void validateUDPConfiguration(Positions pos = {})

Validates that UDP configuration in the detector is valid. If not configured, it will throw with error message requesting missing udp information

Result<std::string> printRxConfiguration(Positions pos = {}) const
Result<bool> getTenGiga(Positions pos = {}) const

[Eiger][CTB][Mythen3]

void setTenGiga(bool value, Positions pos = {})

[Eiger][CTB][Mythen3]

Result<bool> getTenGigaFlowControl(Positions pos = {}) const

[Eiger][Jungfrau][Moench]

void setTenGigaFlowControl(bool enable, Positions pos = {})

[Eiger][Jungfrau][Moench]

Result<int> getTransmissionDelayFrame(Positions pos = {}) const

[Eiger][Jungfrau][Moench][Mythen3]

void setTransmissionDelayFrame(int value, Positions pos = {})

Eiger][Jungfrau][Moench][Mythen3] Transmission delay of first udp packet being streamed out of the module.

[Jungfrau][Moench] [0-31] Each value represents 1 ms

[Eiger] Additional delay to txndelay_left and txndelay_right. Each value represents 10ns. Typical value is 50000.

[Mythen3] [0-16777215] Each value represents 8 ns (125 MHz clock), max is 134 ms.

Result<int> getTransmissionDelayLeft(Positions pos = {}) const

[Eiger]

void setTransmissionDelayLeft(int value, Positions pos = {})

[Eiger] Transmission delay of first packet in an image being streamed out of the module’s left UDP port. Each value represents 10ns. Typical value is 50000.

Result<int> getTransmissionDelayRight(Positions pos = {}) const

[Eiger] Transmission delay of first packet in an image being streamed out of the module’s right UDP port. Each value represents 10ns. Typical value is 50000.

void setTransmissionDelayRight(int value, Positions pos = {})

[Eiger] Sets the transmission delay of first packet streamed ut of the right UDP port

int getTransmissionDelay() const

[Eiger][Jungfrau][Moench]

void setTransmissionDelay(int step)

[Eiger][Jungfrau][Moench][Mythen3] Set

transmission delay for all modules in the detector using the step size provided.Sets up

\t\t[Eiger] txdelay_left to (2 * mod_index * n_delay),

\t\t[Eiger] txdelay_right to ((2 * mod_index + 1) * n_delay) and

\t\t[Eiger] txdelay_frame to (2 *num_modules * n_delay)

\t\t[Jungfrau][Moench][Mythen3] txdelay_frame to (num_modules * n_delay) \nfor every module.

Receiver Configuration

Result<bool> getUseReceiverFlag(Positions pos = {}) const

true when slsReceiver is used

Result<std::string> getRxHostname(Positions pos = {}) const
void setRxHostname(const std::string &receiver, Positions pos = {})

Sets receiver hostname or IP address for each module.

Used for TCP control communication between client and receiver to configure receiver. Also updates receiver with detector parameters.

Also resets any prior receiver property (not on detector).

receiver is receiver hostname or IP address, can include tcp port eg. hostname:port

void setRxHostname(const std::vector<std::string> &name)

multiple rx hostnames. Single element will set it for all

Result<uint16_t> getRxPort(Positions pos = {}) const
void setRxPort(uint16_t port, int module_id = -1)

TCP port for client-receiver communication.

Default is 1954.

Must be different if multiple receivers on same pc.

Must be first command to set a receiver parameter to be able to communicate.

Multi command will automatically increment port for individual modules.

Result<int> getRxFifoDepth(Positions pos = {}) const
void setRxFifoDepth(int nframes, Positions pos = {})

Number of frames in fifo between udp listening and processing threads

Result<bool> getRxSilentMode(Positions pos = {}) const
void setRxSilentMode(bool value, Positions pos = {})

Switch on or off receiver text output during acquisition

Result<defs::frameDiscardPolicy> getRxFrameDiscardPolicy(Positions pos = {}) const
void setRxFrameDiscardPolicy(defs::frameDiscardPolicy f, Positions pos = {})

Options: NO_DISCARD, DISCARD_EMPTY_FRAMES, DISCARD_PARTIAL_FRAMES Default: NO_DISCARD discard partial frames is the fastest

Result<bool> getPartialFramesPadding(Positions pos = {}) const
void setPartialFramesPadding(bool value, Positions pos = {})

Default: padding enabled. Disabling padding is the fastest

Result<int> getRxUDPSocketBufferSize(Positions pos = {}) const
void setRxUDPSocketBufferSize(int udpsockbufsize, Positions pos = {})

UDP socket buffer size in receiver. Tune rmem_default and rmem_max accordingly. Max value is INT_MAX/2.

Result<int> getRxRealUDPSocketBufferSize(Positions pos = {}) const

TODO: Gets actual udp socket buffer size. Double the size of rx_udpsocksize due to kernel bookkeeping.

Result<bool> getRxLock(Positions pos = {})
void setRxLock(bool value, Positions pos = {})

Lock receiver to one client IP, 1 locks, 0 unlocks. Default is unlocked.

Result<IpAddr> getRxLastClientIP(Positions pos = {}) const

Client IP Address that last communicated with the receiver

Result<std::array<pid_t, NUM_RX_THREAD_IDS>> getRxThreadIds(Positions pos = {}) const

Get kernel thread ids from the receiver in order of [parent, tcp, listener 0, processor 0, streamer 0, listener 1, processor 1, streamer 1, arping]. If no streamer yet or there is no second interface, it gives 0 in its place.

Result<bool> getRxArping(Positions pos = {}) const
void setRxArping(bool value, Positions pos = {})

Starts a thread in slsReceiver to arping the interface it is listening every minute. Useful in 10G mode.

Result<defs::ROI> getIndividualRxROIs(Positions pos) const

at module level

defs::ROI getRxROI() const
void setRxROI(const defs::ROI value)

only at multi module level without gap pixels

void clearRxROI()

File

Result<defs::fileFormat> getFileFormat(Positions pos = {}) const
void setFileFormat(defs::fileFormat f, Positions pos = {})

default binary, Options: BINARY, HDF5 (library must be compiled with this option)

Result<std::string> getFilePath(Positions pos = {}) const
void setFilePath(const std::string &fpath, Positions pos = {})

Default is “/”. If path does not exist and fwrite enabled, it will try to create it at start of acquisition.

Result<std::string> getFileNamePrefix(Positions pos = {}) const
void setFileNamePrefix(const std::string &fname, Positions pos = {})

default run File Name: [file name prefix]_d[module index]_f[file index]_[acquisition index].[file format] eg. run_d0_f0_5.raw

Result<int64_t> getAcquisitionIndex(Positions pos = {}) const
void setAcquisitionIndex(int64_t i, Positions pos = {})

file or Acquisition index in receiver File name: [file name prefix]_d[detector index]_f[sub file index]_[acquisition/file index].[raw/h5].

Result<bool> getFileWrite(Positions pos = {}) const
void setFileWrite(bool value, Positions pos = {})

default disabled

bool getMasterFileWrite() const
void setMasterFileWrite(bool value)

default enabled

Result<bool> getFileOverWrite(Positions pos = {}) const
void setFileOverWrite(bool value, Positions pos = {})

default overwites

Result<int> getFramesPerFile(Positions pos = {}) const
void setFramesPerFile(int n, Positions pos = {})

Default depends on detector type.

0 will set frames per file in an acquisition to unlimited

ZMQ Streaming Parameters (Receiver<->Client)

Result<bool> getRxZmqDataStream(Positions pos = {}) const
void setRxZmqDataStream(bool value, Positions pos = {})

Enable/ disable data streaming from receiver via zmq (eg. to GUI or to another process for further processing).

This creates/ destroys zmq streamer threads in receiver.

Switching to Gui automatically enables data streaming in receiver.

Switching back to command line or API acquire will require disabling data streaming in receiver for fast applications (if not needed for client data call backs).

Result<int> getRxZmqFrequency(Positions pos = {}) const
void setRxZmqFrequency(int freq, Positions pos = {})

Frequency of frames streamed out from receiver via zmq.

Default: 1, Means every frame is streamed out.

If 2, every second frame is streamed out.

If 0, streaming timer is the timeout, after which current frame is sent out. (default timeout is 500 ms). Usually used for gui purposes.

Result<int> getRxZmqTimer(Positions pos = {}) const
void setRxZmqTimer(int time_in_ms, Positions pos = {})

If receiver streaming frequency is 0 (default), then this timer between each data stream is set. Default is 500 ms.

Result<int> getRxZmqStartingFrame(Positions pos = {}) const
void setRxZmqStartingFrame(int fnum, Positions pos = {})

The starting frame index to stream out. 0 by default, which streams the first frame in an acquisition, and then depending on the rx zmq frequency/ timer.

Result<uint16_t> getRxZmqPort(Positions pos = {}) const
void setRxZmqPort(uint16_t port, int module_id = -1)

Zmq port for data to be streamed out of the receiver.

Also restarts receiver zmq streaming if enabled.

Default is 30001.

Must be different for every detector (and udp port).

module_id is -1 for all detectors, ports for each module is calculated (increment by 1 if no 2nd interface).

Restarts receiver zmq sockets only if it was already enabled

Result<uint16_t> getClientZmqPort(Positions pos = {}) const
void setClientZmqPort(uint16_t port, int module_id = -1)

Port number to listen to zmq data streamed out from receiver or intermediate process.

Must be different for every detector (and udp port).

Module_id is -1 for all detectors, ports for each module is calculated (increment by 1 if no 2nd interface).

Restarts client zmq sockets only if it was already enabled

Default connects to receiver zmq streaming out port (30001).

Result<IpAddr> getClientZmqIp(Positions pos = {}) const
void setClientZmqIp(const IpAddr ip, Positions pos = {})

Ip Address to listen to zmq data streamed out from receiver or intermediate process.

Default connects to receiver zmq Ip Address (from rx_hostname).

Modified only when using an intermediate process between receiver and client(gui).

Also restarts client zmq streaming if enabled.

int getClientZmqHwm() const
void setClientZmqHwm(const int limit)

Client’s zmq receive high water mark.

Default is the zmq library’s default (1000), can also be set here using -1.

This is a high number and can be set to 2 for gui purposes.

One must also set the receiver’s send high water mark to similar value. Final effect is sum of them.

Result<int> getRxZmqHwm(Positions pos = {}) const
void setRxZmqHwm(const int limit)

Receiver

’s zmq send high water mark.

Default is the zmq library’s default (1000)

This is a high number and can be set to 2 for gui purposes.

One must also set the client’s receive high water mark to similar value. Final effect is sum of them. Also restarts receiver zmq streaming if enabled.

Can set to -1 to set default.

Eiger Specific

Result<ns> getSubExptime(Positions pos = {}) const

[Eiger] in 32 bit mode

void setSubExptime(ns t, Positions pos = {})

[Eiger] in 32 bit mode

Result<ns> getSubDeadTime(Positions pos = {}) const

[Eiger] in 32 bit mode

void setSubDeadTime(ns value, Positions pos = {})

[Eiger] in 32 bit mode

Result<bool> getOverFlowMode(Positions pos = {}) const

[Eiger]

void setOverFlowMode(bool value, Positions pos = {})

[Eiger] Overflow in 32 bit mode. Default is disabled.

Result<ns> getRateCorrection(Positions pos = {}) const

[Eiger] deadtime in ns, 0 = disabled

void setDefaultRateCorrection(Positions pos = {})

[Eiger] Sets default rate correction from trimbit file

void setRateCorrection(ns dead_time, Positions pos = {})

//TODO: default, get, set [Eiger] Set Rate correction 0 disable correction, > 0 custom deadtime, cannot be -1

Result<bool> getInterruptSubframe(Positions pos = {}) const

[Eiger]

void setInterruptSubframe(const bool enable, Positions pos = {})

[Eiger] Enable last subframe interrupt at required exposure time. Disabling will wait for last sub frame to finish exposing. Default is disabled.

Result<ns> getMeasuredPeriod(Positions pos = {}) const

[Eiger] minimum two frames

Result<ns> getMeasuredSubFramePeriod(Positions pos = {}) const

[Eiger]

Result<bool> getActive(Positions pos = {}) const

[Eiger]

void setActive(const bool active, Positions pos = {})

[Eiger] activated by default at hostname command. Deactivated does not send data or communicated with FEB or BEB

Result<bool> getPartialReset(Positions pos = {}) const

[Eiger] Advanced

void setPartialReset(bool value, Positions pos = {})

[Eiger] Advanced used for pulsing chips. Default is Complete reset

void pulsePixel(int n, defs::xy pixel, Positions pos = {})

[Eiger] Advanced Pulse Pixel n times at x and y coordinates

void pulsePixelNMove(int n, defs::xy pixel, Positions pos = {})

[Eiger] Advanced Pulse Pixel n times and move by a relative value of x and y coordinates

void pulseChip(int n, Positions pos = {})

[Eiger] Advanced Pulse chip n times.

If n is -1, resets to normal mode (reset chip completely at start of acquisition, where partialreset = 0).

Result<bool> getQuad(Positions pos = {}) const

[Eiger] with specific quad hardware

void setQuad(const bool enable)

[Eiger] Sets detector size to a quad. 0 (disabled) is default. (Specific hardware required).

Result<bool> getDataStream(const defs::portPosition port, Positions pos = {}) const

[Eiger]

void setDataStream(const defs::portPosition port, const bool enable, Positions pos = {})

[Eiger] enable or disable data streaming from left or right of detector for 10GbE. Default: enabled

Result<bool> getTop(Positions pos = {}) const

[Eiger] Advanced

void setTop(bool value, Positions pos = {})

[Eiger] Advanced. Default is hardware default

Jungfrau/Moench Specific

Result<double> getChipVersion(Positions pos = {}) const

[Jungfrau]

Result<int> getThresholdTemperature(Positions pos = {}) const

[Jungfrau][Moench]

void setThresholdTemperature(int temp, Positions pos = {})

[Jungfrau][Moench]Set

threshold temperature in degrees. If temperature crosses threshold temperature and temperature control is enabled (default is disabled), power to chip will be switched off and temperature event will be set.

To power on chip again, temperature has to be less than threshold temperature and temperature event has to be cleared.

Result<bool> getTemperatureControl(Positions pos = {}) const

[Jungfrau][Moench]

void setTemperatureControl(bool enable, Positions pos = {})

[Jungfrau][Moench] refer to setThresholdTemperature Default is disabled

Result<int> getTemperatureEvent(Positions pos = {}) const

[Jungfrau][Moench] refer to setThresdholdTemperature

void resetTemperatureEvent(Positions pos = {})

[Jungfrau][Moench] refer to setThresdholdTemperature

Result<bool> getAutoComparatorDisable(Positions pos = {}) const

[Jungfrau]

void setAutoComparatorDisable(bool value, Positions pos = {})

[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). The % is for chipv1.0. One can set the duration for chipv1.1 using setComparatorDisableTime

Default is false or this mode disabled(comparator enabled throughout). true enables mode. 0 disables mode.

Result<ns> getComparatorDisableTime(Positions pos = {}) const

[Jungfrau]

void setComparatorDisableTime(ns t, Positions pos = {})

[Jungfrau] Time before end of exposure when comparator is disabled. It is only possible for chipv1.1.

Result<int> getNumberOfAdditionalStorageCells(Positions pos = {}) const

[Jungfrau] Advanced TODO naming

void setNumberOfAdditionalStorageCells(int value)

[Jungfrau] Advanced

Only for chipv1.0. Options: 0 - 15. Default: 0.

The images = #frames x #triggers x (storagecells + 1)

Result<int> getStorageCellStart(Positions pos = {}) const

[Jungfrau] Advanced

void setStorageCellStart(int cell, Positions pos = {})

[Jungfrau] Advanced. Sets the storage cell storing the first acquisition of the series. Options: 0-max. max is 15 (default) for chipv1.0 and 3 (default) for chipv1.1.

Result<ns> getStorageCellDelay(Positions pos = {}) const

[Jungfrau] Advanced

void setStorageCellDelay(ns value, Positions pos = {})

[Jungfrau] Advanced

Additional time delay between 2 consecutive exposures in burst mode.

Options: (0-1638375 ns (resolution of 25ns)

Only applicable for chipv1.0.

std::vector<defs::gainMode> getGainModeList() const

list of possible gainmode

Result<defs::gainMode> getGainMode(Positions pos = {}) const

[Jungfrau]

void setGainMode(const defs::gainMode mode, Positions pos = {})

[Jungfrau] Options: DYNAMIC, FORCE_SWITCH_G1, FORCE_SWITCH_G2, FIX_G1, FIX_G2, FIX_G0

\CAUTION: Do not use FIX_G0 without caution, you can damage the detector!!!

Result<int> getNumberOfFilterCells(Positions pos = {}) const

[Jungfrau] Advanced

void setNumberOfFilterCells(int cell, Positions pos = {})

[Jungfrau] Advanced Options[0-12], only for chip v1.1

Result<defs::pedestalParameters> getPedestalMode(Positions pos = {}) const

[Jungfrau]

void setPedestalMode(const defs::pedestalParameters par, Positions pos = {})

[Jungfrau] In pedestal mode, the number of frames or triggers is overwritten by

(

pedestal_frames x pedestal_loops x 2). \nIn auto timing mode or in trigger mode with #frames > 1, #frames is overwritten and #triggers = 1, \nelse #triggers is overwritten and #frames = 1. One cannot set #frames, #triggers or timing mode in pedestal mode (it will throw an exception). Disabling pedestal mode will set back the original values of #frames and #triggers

Result<defs::timingInfoDecoder> getTimingInfoDecoder(Positions pos = {}) const

[Jungfrau]

void setTimingInfoDecoder(defs::timingInfoDecoder value, Positions pos = {})

[Jungfrau] Advanced Command!

Result<defs::collectionMode> getCollectionMode(Positions pos = {}) const

[Jungfrau]

void setCollectionMode(defs::collectionMode value, Positions pos = {})

[Jungfrau]

Gotthard Specific

Result<defs::ROI> getROI(Positions pos = {}) const

[Gotthard]

void setROI(defs::ROI value, int module_id)

[Gotthard] Region of interest in detector

Options: Only a single

ROI

per module

Either all channels or a single adc or 2 chips (256 channels). Default is all channels enabled (-1 -1).

module_id is position index

void clearROI(Positions pos = {})

[Gotthard] Clear ROI to all channels enabled. Default is all channels enabled.

Result<ns> getExptimeLeft(Positions pos = {}) const

[Gotthard]

Gotthard2 Specific

Result<int64_t> getNumberOfBursts(Positions pos = {}) const

[Gotthard2] only in burst mode and auto timing mode

void setNumberOfBursts(int64_t value)

[Gotthard2] only in burst mode and auto timing mode

Result<ns> getBurstPeriod(Positions pos = {}) const

[Gotthard2] only in burst mode and auto timing mode

void setBurstPeriod(ns value, Positions pos = {})

[Gotthard2] Period between 2 bursts. Only in burst mode and auto timing mode

Result<int64_t> getNumberOfBurstsLeft(Positions pos = {}) const

[Gotthard2] only in burst auto mode

Result<std::array<int, 2>> getInjectChannel(Positions pos = {})

[Gotthard2] offset channel, increment channel

void setInjectChannel(const int offsetChannel, const int incrementChannel, Positions pos = {})

[Gotthard2] Inject channels with current source for calibration. offsetChannel is starting channel to be injected incrementChannel is determines succeeding channels to be injected

void getVetoPhoton(const int chipIndex, const std::string &fname, Positions pos = {})

[Gotthard2] gain indices and adu values for each channel

void setVetoPhoton(const int chipIndex, const int numPhotons, const int energy, const std::string &fname, Positions pos = {})

[Gotthard2] energy in keV

void setVetoReference(const int gainIndex, const int value, Positions pos = {})

[Gotthard2] for all chips

void setVetoFile(const int chipIndex, const std::string &fname, Positions pos = {})

[Gotthard2] Set veto reference for each 128 channels for specific chip. The file should have 128 rows of gain index and 12 bit value in dec”

Result<defs::burstMode> getBurstMode(Positions pos = {})

[Gotthard2]

void setBurstMode(defs::burstMode value, Positions pos = {})

[Gotthard2] BURST_INTERNAL (default), BURST_EXTERNAL, CONTINUOUS_INTERNAL, CONTINUOUS_EXTERNAL. Also changes clkdiv 2, 3, 4

Result<bool> getCDSGain(Positions pos = {}) const

[Gotthard2]

void setCDSGain(bool value, Positions pos = {})

default disabled

Result<defs::timingSourceType> getTimingSource(Positions pos = {}) const

[Gotthard2]

void setTimingSource(defs::timingSourceType value, Positions pos = {})

[Gotthard2] Options: TIMING_INTERNAL (default), TIMING_EXTERNAL

Result<bool> getVeto(Positions pos = {}) const

[Gotthard2]

void setVeto(const bool enable, Positions pos = {})

[Gotthard2] Veto data in chip, Default disabled

Result<defs::streamingInterface> getVetoStream(Positions pos = {}) const

[Gotthard2]

void setVetoStream(const defs::streamingInterface value, Positions pos = {})

[Gotthard2] Options: NONE (Default), LOW_LATENCY_LINK, ETHERNET_10GB (debugging), ALL Enable or disable the 2 veto streaming interfaces available. Can concatenate more than one interface. \nLOW_LATENCY_LINK is the default interface to work with. \nETHERNET_10GB is for debugging and also enables second interface in receiver for listening to veto packets (writes a separate file if writing enabled). Also restarts client and receiver zmq sockets if zmq streaming enabled.

Result<defs::vetoAlgorithm> getVetoAlgorithm(const defs::streamingInterface value, Positions pos = {}) const

[Gotthard2]

void setVetoAlgorithm(const defs::vetoAlgorithm alg, const defs::streamingInterface value, Positions pos = {})

[Gotthard2] Options(vetoAlgorithm): ALG_HITS (default), ALG_RAW. Options(streamingInterface): LOW_LATENCY_LINK, ETHERNET_10GB

Result<int> getADCConfiguration(const int chipIndex, const int adcIndex, Positions pos = {}) const

[Gotthard2]

void setADCConfiguration(const int chipIndex, const int adcIndex, const int value, Positions pos = {})

[Gotthard2] configures one chip at a time for specific adc, chipIndex. -1 for all. Setting specific chip index not implemented in hardware yet

Mythen3 Specific

Result<uint32_t> getCounterMask(Positions pos = {}) const

[Mythen3]

void setCounterMask(uint32_t countermask, Positions pos = {})

[Mythen3] countermask bit set for each counter index enabled. Enabling counters sets vth dacs to remembered values and disabling sets them to disabled values. Setting vth dacs explicitly overwrites them.

Result<int> getNumberOfGates(Positions pos = {}) const
void setNumberOfGates(int value, Positions pos = {})

[Mythen3] external gates in gating or trigger_gating mode (external gating)

Result<ns> getExptime(int gateIndex, Positions pos = {}) const

[Mythen3] exptime for each gate signal in auto or trigger timing mode (internal gating). Gate index: 0-2

void setExptime(int gateIndex, ns t, Positions pos = {})

[Mythen3] exptime for each gate signal in auto or trigger timing mode (internal gating). Gate index: 0-2, -1 for all

Result<std::array<ns, 3>> getExptimeForAllGates(Positions pos = {}) const

[Mythen3] exptime for each gate signal in auto or trigger timing mode (internal gating). Gate index: 0-2, -1 for all

Result<ns> getGateDelay(int gateIndex, Positions pos = {}) const

[Mythen3] gate delay for each gate signal in auto or trigger timing mode (internal gating). Gate index: 0-2

void setGateDelay(int gateIndex, ns t, Positions pos = {})

[Mythen3] gate delay for each gate signal in auto or trigger timing mode (internal gating). Gate index: 0-2, -1 for all

Result<std::array<ns, 3>> getGateDelayForAllGates(Positions pos = {}) const

[Mythen3] gate delay for all gates in auto or trigger timing mode (internal gating). Gate index: 0-2, -1 for all

Result<int> getChipStatusRegister(Positions pos = {}) const
void setGainCaps(int caps, Positions pos = {})
Result<int> getGainCaps(Positions pos = {})
Result<defs::polarity> getPolarity(Positions pos = {}) const

[Mythen3]

void setPolarity(defs::polarity value, Positions pos = {})

[Mythen3]

Result<bool> getInterpolation(Positions pos = {}) const

[Mythen3]

void setInterpolation(bool value, Positions pos = {})

[Mythen3] interpolation mode enables all counters and disables vth3. Disabling sets back counter mask and vth3.

Result<bool> getPumpProbe(Positions pos = {}) const

[Mythen3]

void setPumpProbe(bool value, Positions pos = {})

[Mythen3] pump probe mode only enables vth2. Disabling sets back to previous value

Result<bool> getAnalogPulsing(Positions pos = {}) const

[Mythen3]

void setAnalogPulsing(bool value, Positions pos = {})

[Mythen3]

Result<bool> getDigitalPulsing(Positions pos = {}) const

[Mythen3]

void setDigitalPulsing(bool value, Positions pos = {})

[Mythen3]

CTB Specific

Result<int> getNumberOfAnalogSamples(Positions pos = {}) const

[CTB]

void setNumberOfAnalogSamples(int value, Positions pos = {})

[CTB]

Result<int> getADCClock(Positions pos = {}) const

[CTB]

void setADCClock(int value_in_MHz, Positions pos = {})

[CTB]

Result<int> getRUNClock(Positions pos = {}) const

[CTB]

void setRUNClock(int value_in_MHz, Positions pos = {})

[CTB]

Result<int> getSYNCClock(Positions pos = {}) const

[CTB] in MHZ

std::vector<defs::dacIndex> getPowerList() const

gets list of power enums

std::vector<defs::dacIndex> getSlowADCList() const

gets list of slow adc enums

Result<int> getPower(defs::dacIndex index, Positions pos = {}) const

[CTB][Xilinx CTB]

void setPower(defs::dacIndex index, int value, Positions pos = {})

[CTB][Xilinx CTB] mV [Ctb][Xilinx CTB] Options: V_LIMIT, V_POWER_A, V_POWER_B, V_POWER_C, V_POWER_D, V_POWER_IO, V_POWER_CHIP

Result<int> getADCVpp(bool mV = false, Positions pos = {}) const

[CTB] Options: [0- 4] or [1V, 1.14V, 1.33V, 1.6V, 2V]

void setADCVpp(int value, bool mV = false, Positions pos = {})

[CTB]

Result<uint32_t> getADCEnableMask(Positions pos = {}) const

[CTB]

void setADCEnableMask(uint32_t mask, Positions pos = {})

[CTB]

Result<uint32_t> getTenGigaADCEnableMask(Positions pos = {}) const

[CTB]

void setTenGigaADCEnableMask(uint32_t mask, Positions pos = {})

[CTB] If any of a consecutive 4 bits are enabled, the “

”complete 4 bits are enabled

Result<uint32_t> getTransceiverEnableMask(Positions pos = {}) const

[CTB][Xilinx CTB]

void setTransceiverEnableMask(uint32_t mask, Positions pos = {})

[CTB][Xilinx CTB]

Result<int> getNumberOfDigitalSamples(Positions pos = {}) const

[CTB]

void setNumberOfDigitalSamples(int value, Positions pos = {})

[CTB]

Result<int> getNumberOfTransceiverSamples(Positions pos = {}) const

[CTB][Xilinx CTB]

void setNumberOfTransceiverSamples(int value, Positions pos = {})

[CTB][Xilinx CTB]

Result<defs::readoutMode> getReadoutMode(Positions pos = {}) const

[CTB][Xilinx CTB]

void setReadoutMode(defs::readoutMode value, Positions pos = {})

[CTB] Options: ANALOG_ONLY (default), DIGITAL_ONLY, ANALOG_AND_DIGITAL, TRANSCEIVER_ONLY, DIGITAL_AND_TRANSCEIVER [Xilinx CTB] Options: TRANSCEIVER_ONLY (default)

Result<int> getDBITClock(Positions pos = {}) const

[CTB]

void setDBITClock(int value_in_MHz, Positions pos = {})

[CTB]

Result<int> getMeasuredPower(defs::dacIndex index, Positions pos = {}) const

[CTB] mV Options: V_POWER_A, V_POWER_B, V_POWER_C, V_POWER_D, V_POWER_IO

Result<int> getMeasuredCurrent(defs::dacIndex index, Positions pos = {}) const

[CTB] mA Options: I_POWER_A, I_POWER_B, I_POWER_C, I_POWER_D, I_POWER_IO

Result<int> getSlowADC(defs::dacIndex index, Positions pos = {}) const

[CTB][Xilinx CTB] Options: SLOW_ADC0 - SLOW_ADC7 in uV

Result<int> getExternalSamplingSource(Positions pos = {}) const

[CTB]

void setExternalSamplingSource(int value, Positions pos = {})

[CTB] Value between 0-63

For advanced users only.

Result<bool> getExternalSampling(Positions pos = {}) const

[CTB]

void setExternalSampling(bool value, Positions pos = {})

[CTB] For advanced users only.

Result<std::vector<int>> getRxDbitList(Positions pos = {}) const

[CTB]

void setRxDbitList(const std::vector<int> &list, Positions pos = {})

[CTB] list contains the set of digital signal bits (0-63) to save, must be non repetitive

Result<int> getRxDbitOffset(Positions pos = {}) const

[CTB]

void setRxDbitOffset(int value, Positions pos = {})

[CTB] Set number of bytes of digital data to skip in the Receiver

void setDigitalIODelay(uint64_t pinMask, int delay, Positions pos = {})

[CTB] Set Digital IO Delay cannot get pinMask is IO mask to select the pins delay is delay in ps(1 bit=25ps, max of 775 ps)

Result<bool> getLEDEnable(Positions pos = {}) const

[CTB]

void setLEDEnable(bool enable, Positions pos = {})

[CTB] Default is enabled.

void setDacNames(const std::vector<std::string> names)

[CTB][Xilinx CTB]

std::vector<std::string> getDacNames() const

[CTB][Xilinx CTB]

defs::dacIndex getDacIndex(const std::string &name) const

[CTB][Xilinx CTB]

void setDacName(const defs::dacIndex i, const std::string &name)

[CTB][Xilinx CTB]

std::string getDacName(const defs::dacIndex i) const

[CTB][Xilinx CTB]

void setAdcNames(const std::vector<std::string> names)

[CTB][Xilinx CTB]

std::vector<std::string> getAdcNames() const

[CTB][Xilinx CTB]

int getAdcIndex(const std::string &name) const

[CTB][Xilinx CTB]

void setAdcName(const int i, const std::string &name)

[CTB][Xilinx CTB]

std::string getAdcName(const int i) const

[CTB][Xilinx CTB]

void setSignalNames(const std::vector<std::string> names)

[CTB][Xilinx CTB]

std::vector<std::string> getSignalNames() const

[CTB][Xilinx CTB]

int getSignalIndex(const std::string &name) const

[CTB][Xilinx CTB]

void setSignalName(const int i, const std::string &name)

[CTB][Xilinx CTB]

std::string getSignalName(const int i) const

[CTB][Xilinx CTB]

void setPowerNames(const std::vector<std::string> names)

[CTB][Xilinx CTB]

std::vector<std::string> getPowerNames() const

[CTB][Xilinx CTB]

defs::dacIndex getPowerIndex(const std::string &name) const

[CTB][Xilinx CTB]

void setPowerName(const defs::dacIndex i, const std::string &name)

[CTB][Xilinx CTB]

std::string getPowerName(const defs::dacIndex i) const

[CTB][Xilinx CTB]

void setSlowADCNames(const std::vector<std::string> names)

[CTB][Xilinx CTB]

std::vector<std::string> getSlowADCNames() const

[CTB][Xilinx CTB]

defs::dacIndex getSlowADCIndex(const std::string &name) const

[CTB][Xilinx CTB]

void setSlowADCName(const defs::dacIndex i, const std::string &name)

[CTB][Xilinx CTB]

std::string getSlowADCName(const defs::dacIndex i) const

[CTB][Xilinx CTB]

Pattern

Result<std::string> getPatterFileName(Positions pos = {}) const

[CTB][Mythen3][Xilinx CTB] Gets the pattern file name including path of the last pattern uploaded.

Returns an empty if nothing was uploaded or via a server default file

void setPattern(const std::string &fname, Positions pos = {})

[CTB][Mythen3][Xilinx CTB] Loads ASCII pattern file directly to server (instead of executing line by line)

void setPattern(const Pattern &pat, Positions pos = {})

[CTB][Mythen3][Xilinx CTB] Loads pattern parameters structure directly to server

void savePattern(const std::string &fname)

[CTB][Mythen3][Xilinx CTB] Saves pattern to file (ascii).

[Ctb] Also executes pattern.

void loadDefaultPattern(Positions pos = {})

[Mythen3] Loads and runs default pattern

Result<uint64_t> getPatternIOControl(Positions pos = {}) const

[CTB]

void setPatternIOControl(uint64_t word, Positions pos = {})

[CTB]

Result<uint64_t> getPatternWord(int addr, Positions pos = {})

[CTB][Mythen3][Xilinx CTB] same as executing for ctb

void setPatternWord(int addr, uint64_t word, Positions pos = {})

[CTB][Xilinx CTB] Caution: If word is -1 reads the addr (same as executing the pattern) [Mythen3]

Result<std::array<int, 2>> getPatternLoopAddresses(int level, Positions pos = {}) const

[CTB][Mythen3][Xilinx CTB] Options: level: -1 (complete pattern) and 0-2 levels

Returns

array of start address and stop address

void setPatternLoopAddresses(int level, int start, int stop, Positions pos = {})

[CTB][Mythen3][Xilinx CTB] Options: level: -1 (complete pattern) and 0-2 levels

Result<int> getPatternLoopCycles(int level, Positions pos = {}) const

[CTB][Mythen3][Xilinx CTB] Options: level: -1 (complete pattern) and 0-2 levels

void setPatternLoopCycles(int level, int n, Positions pos = {})

[CTB][Mythen3][Xilinx CTB] n: 0-2, level: -1 (complete pattern) and 0-2 levels

Result<int> getPatternWaitAddr(int level, Positions pos = {}) const

[CTB][Mythen3][Xilinx CTB]

void setPatternWaitAddr(int level, int addr, Positions pos = {})

[CTB][Mythen3][Xilinx CTB] Options: level 0-2

Result<uint64_t> getPatternWaitTime(int level, Positions pos = {}) const

[CTB][Mythen3][Xilinx CTB]

void setPatternWaitTime(int level, uint64_t t, Positions pos = {})

[CTB][Mythen3][Xilinx CTB] Options: level 0-2

Result<uint64_t> getPatternMask(Positions pos = {})

[CTB][Mythen3][Xilinx CTB]

void setPatternMask(uint64_t mask, Positions pos = {})

[CTB][Mythen3][Xilinx CTB] Selects the bits that will have a pattern mask applied to the selected patmask for every pattern.

Result<uint64_t> getPatternBitMask(Positions pos = {}) const

[CTB][Mythen3][Xilinx CTB]

void setPatternBitMask(uint64_t mask, Positions pos = {})

[CTB][Mythen3][Xilinx CTB] Sets the mask applied to every pattern to the selected bits

void startPattern(Positions pos = {})

[Mythen3]

Json Header specific

Result<std::map<std::string, std::string>> getAdditionalJsonHeader(Positions pos = {}) const
void setAdditionalJsonHeader(const std::map<std::string, std::string> &jsonHeader, Positions pos = {})

If empty, reset additional json header. Default is empty. Max 20 characters for each key/value. Empty value deletes header. Use only if to be processed by an intermediate user process listening to receiver zmq packets such as in Moench

Result<std::string> getAdditionalJsonParameter(const std::string &key, Positions pos = {}) const
void setAdditionalJsonParameter(const std::string &key, const std::string &value, Positions pos = {})

Sets the value for additional json header parameters. If not found, the pair is appended. Empty value deletes parameter. Max 20 characters for each key/value.

Advanced

Result<int> getADCPipeline(Positions pos = {}) const

[CTB][Moench]

void setADCPipeline(int value, Positions pos = {})

[CTB][Moench]

void programFPGA(const std::string &fname, const bool forceDeleteNormalFile, Positions pos = {})

[Jungfrau][Moench][Gotthard][CTB][Mythen3][Gotthard2] Advanced user Function! Program firmware from command line, after which detector controller is rebooted. forceDeleteNormalFile is true, if normal file found in device tree, it must be deleted, a new device drive created and programming continued.[Jungfrau][Moench][CTB] fname is a pof file (full path)

[Mythen3][Gotthard2] fname is an rbf file (full path)

void resetFPGA(Positions pos = {})

[Jungfrau][Moench][CTB][Xilinx CTB] Advanced user Function!

void updateDetectorServer(const std::string &fname, Positions pos = {})

[Jungfrau][Moench][Eiger][Ctb][Mythen3][Gotthard2] Copies detector server via TCP (without tftp).\nMakes a symbolic link with a shorter name (without vx.x.x).\nThen, detector controller reboots (except Eiger).

[Jungfrau][Moench][Ctb] Also deletes old server binary and changes respawn server to the link, which is effective after a reboot.

void updateKernel(const std::string &fname, Positions pos = {})

[Jungfrau][Moench][Ctb][Mythen3][Gotthard2]

Advanced Command!! You could damage the detector. Please use with caution.\nUpdates the kernel image. Then, detector controller reboots with new kernel

void rebootController(Positions pos = {})

[Jungfrau][Moench][Gotthard][CTB][Mythen3][Gotthard2][Xilinx CTB] Advanced user Function!

void updateFirmwareAndServer(const std::string &sname, const std::string &fname, Positions pos = {})

Advanced user Function!

[Jungfrau][Moench][Gotthard][CTB] Updates the firmware, detector server, make a soft link and then reboots detector controller.

[Mythen3][Gotthard2] Will require a script to start up the shorter named server link at start up

sname is full path name of detector server

fname is programming file name with full path to it

Result<bool> getUpdateMode(Positions pos = {}) const
void setUpdateMode(const bool updatemode, Positions pos = {})

Restarts detector server in update mode. This is useful when server-firmware compatibility is at its worst and server cannot start up normally

Result<uint32_t> readRegister(uint32_t addr, Positions pos = {}) const

Advanced user Function!

Goes to stop server. Hence, can be called while calling blocking

acquire()

.

[Eiger] Address is +0x100 for only left, +0x200 for only right.

void writeRegister(uint32_t addr, uint32_t val, bool validate = false, Positions pos = {})

Advanced user Function!

Goes to stop server. Hence, can be called while calling blocking

acquire()

.

[Eiger] Address is +0x100 for only left, +0x200 for only right.

void setBit(uint32_t addr, int bitnr, bool validate = false, Positions pos = {})

Advanced user Function!

void clearBit(uint32_t addr, int bitnr, bool validate = false, Positions pos = {})

Advanced user Function!

Result<int> getBit(uint32_t addr, int bitnr, Positions pos = {})

Advanced user Function!

void executeFirmwareTest(Positions pos = {})

[Gotthard][Jungfrau][Moench][Mythen3][Gotthard2][CTB] Advanced user Function!

void executeBusTest(Positions pos = {})

[Gotthard][Jungfrau][Moench][Mythen3][Gotthard2][CTB] Advanced user Function! Writes different values in a R/W register and confirms the writes to check bus

void writeAdcRegister(uint32_t addr, uint32_t value, Positions pos = {})

[Gotthard][Jungfrau][Moench][CTB] Advanced user Function! not possible to read back

bool getInitialChecks() const

Advanced user Function!

void setInitialChecks(const bool value)

Enables/disabled initial compaibility and other server start up checks.

Default is enabled. Must come before ‘hostname’ command to take effect.

Can be used to reprogram fpga when current firmware is incompatible.

Advanced user Function!

Result<uint32_t> getADCInvert(Positions pos = {}) const

[CTB][Jungfrau][Moench] Advanced user Function!

void setADCInvert(uint32_t value, Positions pos = {})

[CTB][Jungfrau][Moench] Advanced user Function!

[Jungfrau][Moench] Inversions on top of default mask

Insignificant

Result<uint16_t> getControlPort(Positions pos = {}) const
void setControlPort(uint16_t value, Positions pos = {})

Detector Control TCP port (for client communication with Detector control server) Default is 1952. Normally unchanged. Set different ports for virtual servers on same pc

Result<uint16_t> getStopPort(Positions pos = {}) const
void setStopPort(uint16_t value, Positions pos = {})

Port number of the stop server on detector for detector-client tcp interface. Default is 1953. Normally unchanged.

Result<bool> getDetectorLock(Positions pos = {}) const
void setDetectorLock(bool lock, Positions pos = {})

lock detector to one client IP. default is unlocked

Result<IpAddr> getLastClientIP(Positions pos = {}) const

Client IP Address that last communicated with the detector

Result<std::string> executeCommand(const std::string &value, Positions pos = {})

Execute a command on the detector server console

Result<int64_t> getNumberOfFramesFromStart(Positions pos = {}) const

[Jungfrau][Moench][Mythen3][CTB][Xilinx CTB] [Gotthard2] only in continuous mode

Result<ns> getActualTime(Positions pos = {}) const

[Jungfrau][Moench][Mythen3][CTB][Xilinx CTB] Get time from detector start [Gotthard2] not in burst and auto mode

Result<ns> getMeasurementTime(Positions pos = {}) const

[Jungfrau][Moench][Mythen3][CTB][Xilinx CTB] Get timestamp at a frame start [Gotthard2] not in burst and auto mode

std::string getUserDetails() const

get user details from shared memory (hostname, type, PID, User, Date)

Public Functions

void configureTransceiver(Positions pos = {})

[Xilinx Ctb]