mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-07 18:40:42 +02:00
clang-format
This commit is contained in:
parent
32662baef8
commit
959fd562d3
@ -9,7 +9,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
#include "CmdProxy.h"
|
#include "CmdProxy.h"
|
||||||
#include "Detector.h"
|
#include "Detector.h"
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
@ -52,5 +51,4 @@ int main() {
|
|||||||
auto help = replace_all(tmp, "\n\t", "\n\t\t");
|
auto help = replace_all(tmp, "\n\t", "\n\t\t");
|
||||||
fs << '\t' << cmd << usage << help << "\n";
|
fs << '\t' << cmd << usage << help << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
#include "catch.hpp"
|
|
||||||
#include "DetectorImpl.h"
|
#include "DetectorImpl.h"
|
||||||
|
#include "catch.hpp"
|
||||||
#include "string_utils.h"
|
#include "string_utils.h"
|
||||||
#include "tests/globals.h"
|
#include "tests/globals.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
26
integrationTests/test-integrationDectector.cpp
Executable file → Normal file
26
integrationTests/test-integrationDectector.cpp
Executable file → Normal file
@ -2,9 +2,9 @@
|
|||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
|
|
||||||
#include "ClientSocket.h"
|
#include "ClientSocket.h"
|
||||||
#include "logger.h"
|
|
||||||
#include "DetectorImpl.h"
|
#include "DetectorImpl.h"
|
||||||
#include "Module.h"
|
#include "Module.h"
|
||||||
|
#include "logger.h"
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
|
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
@ -79,7 +79,6 @@ TEST_CASE("Set control port then create a new object with this control port",
|
|||||||
d.freeSharedMemory();
|
d.freeSharedMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("single EIGER detector no receiver basic set and get",
|
TEST_CASE("single EIGER detector no receiver basic set and get",
|
||||||
"[.integration][eiger]") {
|
"[.integration][eiger]") {
|
||||||
// TODO! this test should take command line arguments for config
|
// TODO! this test should take command line arguments for config
|
||||||
@ -130,8 +129,6 @@ TEST_CASE("single EIGER detector no receiver basic set and get",
|
|||||||
d.freeSharedMemory();
|
d.freeSharedMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("Locking mechanism and last ip", "[.integration][.single]") {
|
TEST_CASE("Locking mechanism and last ip", "[.integration][.single]") {
|
||||||
Module d(test::type);
|
Module d(test::type);
|
||||||
d.setHostname(test::hostname);
|
d.setHostname(test::hostname);
|
||||||
@ -160,7 +157,6 @@ TEST_CASE("Set settings", "[.integration][.single]"){
|
|||||||
CHECK(d.setSettings(defs::STANDARD) == defs::STANDARD);
|
CHECK(d.setSettings(defs::STANDARD) == defs::STANDARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("Timer functions", "[.integration][cli]") {
|
TEST_CASE("Timer functions", "[.integration][cli]") {
|
||||||
// FRAME_NUMBER, /**< number of real time frames: total number of
|
// FRAME_NUMBER, /**< number of real time frames: total number of
|
||||||
// acquisitions is number or frames*number of triggers */ ACQUISITION_TIME,
|
// acquisitions is number or frames*number of triggers */ ACQUISITION_TIME,
|
||||||
@ -204,8 +200,7 @@ TEST_CASE("Timer functions", "[.integration][cli]") {
|
|||||||
if (test::type != dt::EIGER) {
|
if (test::type != dt::EIGER) {
|
||||||
auto delay = 10000;
|
auto delay = 10000;
|
||||||
d.setDelayAfterTrigger(delay);
|
d.setDelayAfterTrigger(delay);
|
||||||
CHECK(d.getDelayAfterTrigger() ==
|
CHECK(d.getDelayAfterTrigger() == delay);
|
||||||
delay);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto triggers = 2;
|
auto triggers = 2;
|
||||||
@ -221,7 +216,6 @@ TEST_CASE("Timer functions", "[.integration][cli]") {
|
|||||||
d.startAndReadAll();
|
d.startAndReadAll();
|
||||||
|
|
||||||
d.freeSharedMemory();
|
d.freeSharedMemory();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TEST_CASE("Aquire", "[.integration][eiger]"){
|
// TEST_CASE("Aquire", "[.integration][eiger]"){
|
||||||
@ -382,8 +376,8 @@ TEST_CASE("Chiptestboard Loading Patterns", "[.ctbintegration]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert",
|
||||||
TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert", "[.ctbintegration][dbit]") {
|
"[.ctbintegration][dbit]") {
|
||||||
SingleDetectorConfig c;
|
SingleDetectorConfig c;
|
||||||
|
|
||||||
// pick up multi detector from shm id 0
|
// pick up multi detector from shm id 0
|
||||||
@ -450,17 +444,20 @@ TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert", "[.ctbintegrat
|
|||||||
m.setExternalSampling(1);
|
m.setExternalSampling(1);
|
||||||
CHECK(m.getExternalSampling() == 1);
|
CHECK(m.getExternalSampling() == 1);
|
||||||
CHECK(m.readRegister(0x7b) == 0x1003E);
|
CHECK(m.readRegister(0x7b) == 0x1003E);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Eiger or Jungfrau startingfnum", "[.eigerintegration][.jungfrauintegration][startingfnum]") {
|
TEST_CASE("Eiger or Jungfrau startingfnum",
|
||||||
|
"[.eigerintegration][.jungfrauintegration][startingfnum]") {
|
||||||
SingleDetectorConfig c;
|
SingleDetectorConfig c;
|
||||||
|
|
||||||
// pick up multi detector from shm id 0
|
// pick up multi detector from shm id 0
|
||||||
DetectorImpl m(0);
|
DetectorImpl m(0);
|
||||||
|
|
||||||
// ensure ctb detector type, hostname and online
|
// ensure ctb detector type, hostname and online
|
||||||
REQUIRE(((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER) || (m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::JUNGFRAU)));
|
REQUIRE(
|
||||||
|
((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER) ||
|
||||||
|
(m.getDetectorTypeAsEnum() ==
|
||||||
|
slsDetectorDefs::detectorType::JUNGFRAU)));
|
||||||
REQUIRE(m.getHostname() == c.hostname);
|
REQUIRE(m.getHostname() == c.hostname);
|
||||||
|
|
||||||
CHECK(m.setNumberOfFrames(1) == 1);
|
CHECK(m.setNumberOfFrames(1) == 1);
|
||||||
@ -498,7 +495,8 @@ TEST_CASE("Eiger readnlines", "[.eigerintegration][readnlines]") {
|
|||||||
DetectorImpl m(0);
|
DetectorImpl m(0);
|
||||||
|
|
||||||
// ensure detector type, hostname
|
// ensure detector type, hostname
|
||||||
REQUIRE((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER));
|
REQUIRE(
|
||||||
|
(m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER));
|
||||||
REQUIRE(m.getHostname() == c.hostname);
|
REQUIRE(m.getHostname() == c.hostname);
|
||||||
|
|
||||||
m.setDynamicRange(16);
|
m.setDynamicRange(16);
|
||||||
|
6
integrationTests/test-integrationMulti.cpp
Executable file → Normal file
6
integrationTests/test-integrationMulti.cpp
Executable file → Normal file
@ -1,5 +1,5 @@
|
|||||||
#include "catch.hpp"
|
|
||||||
#include "DetectorImpl.h"
|
#include "DetectorImpl.h"
|
||||||
|
#include "catch.hpp"
|
||||||
#include "string_utils.h"
|
#include "string_utils.h"
|
||||||
#include "tests/globals.h"
|
#include "tests/globals.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -24,8 +24,6 @@ TEST_CASE("Initialize a multi detector", "[.integration][.multi]") {
|
|||||||
d.freeSharedMemory();
|
d.freeSharedMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("Set and read timers", "[.integration][.multi]") {
|
TEST_CASE("Set and read timers", "[.integration][.multi]") {
|
||||||
|
|
||||||
DetectorImpl d(0, true, true);
|
DetectorImpl d(0, true, true);
|
||||||
@ -57,7 +55,6 @@ TEST_CASE("Set and read timers", "[.integration][.multi]") {
|
|||||||
// PROGRESS, /**< fraction of measurement elapsed - only get! */
|
// PROGRESS, /**< fraction of measurement elapsed - only get! */
|
||||||
// MEASUREMENTS_NUMBER,
|
// MEASUREMENTS_NUMBER,
|
||||||
|
|
||||||
|
|
||||||
// FRAMES_FROM_START,
|
// FRAMES_FROM_START,
|
||||||
// FRAMES_FROM_START_PG,
|
// FRAMES_FROM_START_PG,
|
||||||
// SAMPLES,
|
// SAMPLES,
|
||||||
@ -78,7 +75,6 @@ TEST_CASE("Set and read timers", "[.integration][.multi]") {
|
|||||||
CHECK(d.setSubFrameExposureDeadTime(-1) == Approx(subframe_deadtime));
|
CHECK(d.setSubFrameExposureDeadTime(-1) == Approx(subframe_deadtime));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (test::type == dt::EIGER) {
|
if (test::type == dt::EIGER) {
|
||||||
// 32bit is needed for subframe exposure
|
// 32bit is needed for subframe exposure
|
||||||
d.setDynamicRange(32);
|
d.setDynamicRange(32);
|
||||||
|
@ -3,10 +3,9 @@
|
|||||||
#include "network_utils.h"
|
#include "network_utils.h"
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
|
||||||
|
|
||||||
|
|
||||||
class detectorData;
|
class detectorData;
|
||||||
|
|
||||||
@ -21,7 +20,6 @@ class IpAddr;
|
|||||||
// shm by mistake
|
// shm by mistake
|
||||||
void freeSharedMemory(int multiId, int detPos = -1);
|
void freeSharedMemory(int multiId, int detPos = -1);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \class Detector
|
* \class Detector
|
||||||
*/
|
*/
|
||||||
@ -101,11 +99,12 @@ class Detector {
|
|||||||
/** [Jungfrau][Gotthard][Gotthard2] */
|
/** [Jungfrau][Gotthard][Gotthard2] */
|
||||||
Result<defs::detectorSettings> getSettings(Positions pos = {}) const;
|
Result<defs::detectorSettings> getSettings(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Jungfrau] Options:DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2
|
/** [Jungfrau] Options:DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2,
|
||||||
* [Gotthard] Options: DYNAMICGAIN, HIGHGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN
|
* FORCESWITCHG1, FORCESWITCHG2 [Gotthard] Options: DYNAMICGAIN, HIGHGAIN,
|
||||||
* [Gotthard2] Options: DYNAMICGAIN, FIXGAIN1, FIXGAIN2
|
* LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN [Gotthard2] Options: DYNAMICGAIN,
|
||||||
* [Moench] Options: G1_HIGHGAIN, G1_LOWGAIN, G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN,
|
* FIXGAIN1, FIXGAIN2 [Moench] Options: G1_HIGHGAIN, G1_LOWGAIN,
|
||||||
* G2_LOWCAP_HIGHGAIN, G2_LOWCAP_LOWGAIN, G4_HIGHGAIN, G4_LOWGAIN
|
* G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN, G2_LOWCAP_HIGHGAIN,
|
||||||
|
* G2_LOWCAP_LOWGAIN, G4_HIGHGAIN, G4_LOWGAIN
|
||||||
*/
|
*/
|
||||||
void setSettings(defs::detectorSettings value, Positions pos = {});
|
void setSettings(defs::detectorSettings value, Positions pos = {});
|
||||||
|
|
||||||
@ -304,10 +303,12 @@ class Detector {
|
|||||||
void setDAC(defs::dacIndex index, int value, bool mV, Positions pos = {});
|
void setDAC(defs::dacIndex index, int value, bool mV, Positions pos = {});
|
||||||
|
|
||||||
/* [Gotthard2] */
|
/* [Gotthard2] */
|
||||||
Result<int> getOnChipDAC(defs::dacIndex index, int chipIndex, Positions pos = {}) const;
|
Result<int> getOnChipDAC(defs::dacIndex index, int chipIndex,
|
||||||
|
Positions pos = {}) const;
|
||||||
|
|
||||||
/* [Gotthard2] */
|
/* [Gotthard2] */
|
||||||
void setOnChipDAC(defs::dacIndex index, int chipIndex, int value, Positions pos = {});
|
void setOnChipDAC(defs::dacIndex index, int chipIndex, int value,
|
||||||
|
Positions pos = {});
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
@ -326,7 +327,8 @@ class Detector {
|
|||||||
*/
|
*/
|
||||||
void acquire();
|
void acquire();
|
||||||
|
|
||||||
/** If acquisition aborted, use this to clear before starting next acquisition */
|
/** If acquisition aborted, use this to clear before starting next
|
||||||
|
* acquisition */
|
||||||
void clearAcquiringFlag();
|
void clearAcquiringFlag();
|
||||||
|
|
||||||
/** Non Blocking: Start receiver listener*/
|
/** Non Blocking: Start receiver listener*/
|
||||||
@ -348,7 +350,8 @@ class Detector {
|
|||||||
|
|
||||||
Result<int64_t> getFramesCaught(Positions pos = {}) const;
|
Result<int64_t> getFramesCaught(Positions pos = {}) const;
|
||||||
|
|
||||||
Result<std::vector<uint64_t>> getNumMissingPackets(Positions pos = {}) const;
|
Result<std::vector<uint64_t>>
|
||||||
|
getNumMissingPackets(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Eiger][Jungfrau] */
|
/** [Eiger][Jungfrau] */
|
||||||
Result<uint64_t> getStartingFrameNumber(Positions pos = {}) const;
|
Result<uint64_t> getStartingFrameNumber(Positions pos = {}) const;
|
||||||
@ -512,7 +515,8 @@ class Detector {
|
|||||||
* Validates and sets the receiver.
|
* Validates and sets the receiver.
|
||||||
* Updates local receiver cache parameters
|
* Updates local receiver cache parameters
|
||||||
* Configures the detector to the receiver as UDP destination
|
* Configures the detector to the receiver as UDP destination
|
||||||
* @param receiver receiver hostname or IP address, can include tcp port eg. hostname:port
|
* @param receiver receiver hostname or IP address, can include tcp port eg.
|
||||||
|
* hostname:port
|
||||||
*/
|
*/
|
||||||
void setRxHostname(const std::string &receiver, Positions pos = {});
|
void setRxHostname(const std::string &receiver, Positions pos = {});
|
||||||
|
|
||||||
@ -659,10 +663,10 @@ class Detector {
|
|||||||
Result<int> getClientZmqPort(Positions pos = {}) const;
|
Result<int> getClientZmqPort(Positions pos = {}) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modified only when using an intermediate process between receiver and gui/client.
|
* Modified only when using an intermediate process between receiver and
|
||||||
* Module_id is -1 for all detectors, ports for each
|
* gui/client. Module_id is -1 for all detectors, ports for each module is
|
||||||
* module is calculated (increments) Restarts client zmq sockets only if it
|
* calculated (increments) Restarts client zmq sockets only if it was
|
||||||
* was already enabled
|
* already enabled
|
||||||
*/
|
*/
|
||||||
void setClientZmqPort(int port, int module_id = -1);
|
void setClientZmqPort(int port, int module_id = -1);
|
||||||
|
|
||||||
@ -915,7 +919,6 @@ class Detector {
|
|||||||
void setExternalSignalFlags(defs::externalSignalFlag value,
|
void setExternalSignalFlags(defs::externalSignalFlag value,
|
||||||
Positions pos = {});
|
Positions pos = {});
|
||||||
|
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
* Gotthard2 Specific *
|
* Gotthard2 Specific *
|
||||||
@ -940,16 +943,21 @@ class Detector {
|
|||||||
/** [Gotthard2]
|
/** [Gotthard2]
|
||||||
* @param offsetChannel starting channel to be injected
|
* @param offsetChannel starting channel to be injected
|
||||||
* @param incrementChannel determines succeeding channels to be injected */
|
* @param incrementChannel determines succeeding channels to be injected */
|
||||||
void setInjectChannel(const int offsetChannel, const int incrementChannel, Positions pos = {});
|
void setInjectChannel(const int offsetChannel, const int incrementChannel,
|
||||||
|
Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] adu values for each channel */
|
/** [Gotthard2] adu values for each channel */
|
||||||
Result<std::vector<int>> getVetoPhoton(const int chipIndex, Positions pos = {});
|
Result<std::vector<int>> getVetoPhoton(const int chipIndex,
|
||||||
|
Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] energy in keV */
|
/** [Gotthard2] energy in keV */
|
||||||
void setVetoPhoton(const int chipIndex, const int numPhotons, const int energy, const std::string& fname, Positions pos = {});
|
void setVetoPhoton(const int chipIndex, const int numPhotons,
|
||||||
|
const int energy, const std::string &fname,
|
||||||
|
Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Gotthard2] */
|
||||||
void setVetoReference(const int gainIndex, const int value, Positions pos = {});
|
void setVetoReference(const int gainIndex, const int value,
|
||||||
|
Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Gotthard2] */
|
||||||
Result<defs::burstMode> getBurstMode(Positions pos = {});
|
Result<defs::burstMode> getBurstMode(Positions pos = {});
|
||||||
@ -1150,21 +1158,26 @@ class Detector {
|
|||||||
* [Mythen3][Moench] */
|
* [Mythen3][Moench] */
|
||||||
void setPatternWord(int addr, uint64_t word, Positions pos = {});
|
void setPatternWord(int addr, uint64_t word, Positions pos = {});
|
||||||
|
|
||||||
/**[CTB][Moench][Mythen3] Options: level: -1 (complete pattern) and 0-2 levels
|
/**[CTB][Moench][Mythen3] Options: level: -1 (complete pattern) and 0-2
|
||||||
|
* levels
|
||||||
* @returns array of start address and stop address
|
* @returns array of start address and stop address
|
||||||
*/
|
*/
|
||||||
Result<std::array<int, 2>> getPatternLoopAddresses(int level,
|
Result<std::array<int, 2>>
|
||||||
Positions pos = {}) const;
|
getPatternLoopAddresses(int level, Positions pos = {}) const;
|
||||||
|
|
||||||
/** [CTB][Moench][Mythen3] Options: level: -1 (complete pattern) and 0-2 levels */
|
/** [CTB][Moench][Mythen3] Options: level: -1 (complete pattern) and 0-2
|
||||||
void setPatternLoopAddresses(int level, int start, int stop, Positions pos = {});
|
* levels */
|
||||||
|
void setPatternLoopAddresses(int level, int start, int stop,
|
||||||
|
Positions pos = {});
|
||||||
|
|
||||||
/**[CTB][Moench][Mythen3] Options: level: -1 (complete pattern) and 0-2 levels
|
/**[CTB][Moench][Mythen3] Options: level: -1 (complete pattern) and 0-2
|
||||||
|
* levels
|
||||||
* @returns number of loops
|
* @returns number of loops
|
||||||
*/
|
*/
|
||||||
Result<int> getPatternLoopCycles(int level, Positions pos = {}) const;
|
Result<int> getPatternLoopCycles(int level, Positions pos = {}) const;
|
||||||
|
|
||||||
/** [CTB][Moench][Mythen3] n: 0-2, level: -1 (complete pattern) and 0-2 levels */
|
/** [CTB][Moench][Mythen3] n: 0-2, level: -1 (complete pattern) and 0-2
|
||||||
|
* levels */
|
||||||
void setPatternLoopCycles(int level, int n, Positions pos = {});
|
void setPatternLoopCycles(int level, int n, Positions pos = {});
|
||||||
|
|
||||||
/* [CTB][Moench][Mythen3] */
|
/* [CTB][Moench][Mythen3] */
|
||||||
@ -1182,14 +1195,15 @@ class Detector {
|
|||||||
/** [CTB][Moench][Mythen3] */
|
/** [CTB][Moench][Mythen3] */
|
||||||
Result<uint64_t> getPatternMask(Positions pos = {});
|
Result<uint64_t> getPatternMask(Positions pos = {});
|
||||||
|
|
||||||
/** [CTB][Moench][Mythen3] Sets the mask applied to every pattern to the selected bit mask */
|
/** [CTB][Moench][Mythen3] Sets the mask applied to every pattern to the
|
||||||
|
* selected bit mask */
|
||||||
void setPatternMask(uint64_t mask, Positions pos = {});
|
void setPatternMask(uint64_t mask, Positions pos = {});
|
||||||
|
|
||||||
/** [CTB][Moench][Mythen3] */
|
/** [CTB][Moench][Mythen3] */
|
||||||
Result<uint64_t> getPatternBitMask(Positions pos = {}) const;
|
Result<uint64_t> getPatternBitMask(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [CTB][Moench][Mythen3] Sets the bitmask that the mask will be applied to for every
|
/** [CTB][Moench][Mythen3] Sets the bitmask that the mask will be applied to
|
||||||
* pattern
|
* for every pattern
|
||||||
*/
|
*/
|
||||||
void setPatternBitMask(uint64_t mask, Positions pos = {});
|
void setPatternBitMask(uint64_t mask, Positions pos = {});
|
||||||
|
|
||||||
@ -1200,10 +1214,13 @@ class Detector {
|
|||||||
* ************************************************/
|
* ************************************************/
|
||||||
|
|
||||||
/** [Moench] */
|
/** [Moench] */
|
||||||
Result<std::map<std::string, std::string>> getAdditionalJsonHeader(Positions pos = {}) const;
|
Result<std::map<std::string, std::string>>
|
||||||
|
getAdditionalJsonHeader(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Moench] If empty, reset additional json header. Max 20 characters for each key/value */
|
/** [Moench] If empty, reset additional json header. Max 20 characters for
|
||||||
void setAdditionalJsonHeader(const std::map<std::string, std::string> &jsonHeader,
|
* each key/value */
|
||||||
|
void setAdditionalJsonHeader(
|
||||||
|
const std::map<std::string, std::string> &jsonHeader,
|
||||||
Positions pos = {});
|
Positions pos = {});
|
||||||
|
|
||||||
/** [Moench] */
|
/** [Moench] */
|
||||||
@ -1215,7 +1232,8 @@ class Detector {
|
|||||||
* else appends the parameter key and value
|
* else appends the parameter key and value
|
||||||
* If empty, deletes parameter. Max 20 characters for each key/value
|
* If empty, deletes parameter. Max 20 characters for each key/value
|
||||||
*/
|
*/
|
||||||
void setAdditionalJsonParameter(const std::string &key, const std::string &value,
|
void setAdditionalJsonParameter(const std::string &key,
|
||||||
|
const std::string &value,
|
||||||
Positions pos = {});
|
Positions pos = {});
|
||||||
|
|
||||||
/** [Moench] TODO! How do we do this best??? Can be refactored to something
|
/** [Moench] TODO! How do we do this best??? Can be refactored to something
|
||||||
|
10
slsDetectorSoftware/include/detectorData.h
Executable file → Normal file
10
slsDetectorSoftware/include/detectorData.h
Executable file → Normal file
@ -10,7 +10,8 @@ class detectorData {
|
|||||||
* Constructor
|
* Constructor
|
||||||
* @param progress progress index
|
* @param progress progress index
|
||||||
* @param fname file name prefix
|
* @param fname file name prefix
|
||||||
* @param nx number of detector channels (1D detector) or dimension in x (2D detector)
|
* @param nx number of detector channels (1D detector) or dimension in x (2D
|
||||||
|
* detector)
|
||||||
* @param ny dimension in y (2D detector)
|
* @param ny dimension in y (2D detector)
|
||||||
* @param d pointer to data in char* format
|
* @param d pointer to data in char* format
|
||||||
* @param dbytes number of bytes of image pointed to by cval pointer
|
* @param dbytes number of bytes of image pointed to by cval pointer
|
||||||
@ -18,8 +19,11 @@ class detectorData {
|
|||||||
* @param fIndex file index
|
* @param fIndex file index
|
||||||
* @param complete true if complete image, else missing packets
|
* @param complete true if complete image, else missing packets
|
||||||
*/
|
*/
|
||||||
detectorData(double progress, std::string fname, int x, int y, char *d, int dbytes, int dr, uint64_t fIndex, bool complete) :
|
detectorData(double progress, std::string fname, int x, int y, char *d,
|
||||||
progressIndex(progress), fileName(fname), fileIndex(fIndex), nx(x), ny(y), data(d), databytes(dbytes), dynamicRange(dr), completeImage(complete) {};
|
int dbytes, int dr, uint64_t fIndex, bool complete)
|
||||||
|
: progressIndex(progress), fileName(fname), fileIndex(fIndex), nx(x),
|
||||||
|
ny(y), data(d), databytes(dbytes), dynamicRange(dr),
|
||||||
|
completeImage(complete){};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor
|
* Destructor
|
||||||
|
386
slsDetectorSoftware/include/slsDetectorUsers.h
Executable file → Normal file
386
slsDetectorSoftware/include/slsDetectorUsers.h
Executable file → Normal file
@ -1,18 +1,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// class detectorData;
|
// class detectorData;
|
||||||
namespace sls
|
namespace sls {
|
||||||
{
|
|
||||||
class Detector;
|
class Detector;
|
||||||
}
|
}
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class slsDetectorUsers {
|
class slsDetectorUsers {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param shm_id detector shared memory id
|
* @param shm_id detector shared memory id
|
||||||
* Default value is 0. Can be set to more values for
|
* Default value is 0. Can be set to more values for
|
||||||
@ -33,19 +29,20 @@ public:
|
|||||||
/** Gets the total number of detectors */
|
/** Gets the total number of detectors */
|
||||||
int size() const;
|
int size() const;
|
||||||
|
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Returns the size of detector/multi detector
|
// * Returns the size of detector/multi detector
|
||||||
// * @param nx number of channels in horiziontal
|
// * @param nx number of channels in horiziontal
|
||||||
// * @param ny number of channels in vertical
|
// * @param ny number of channels in vertical
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns the total number of channels of all sls detectors
|
// * @returns the total number of channels of all sls detectors
|
||||||
// */
|
// */
|
||||||
// int getDetectorSize(int &nx, int &ny, int detPos);
|
// int getDetectorSize(int &nx, int &ny, int detPos);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Gets detector type
|
// * Gets detector type
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns detector type (EIGER, JUNGFRAU, GOTTHARD) slsDetectorDefs
|
// * @returns detector type (EIGER, JUNGFRAU, GOTTHARD) slsDetectorDefs
|
||||||
// */
|
// */
|
||||||
// std::string getDetectorType(int detPos = -1);
|
// std::string getDetectorType(int detPos = -1);
|
||||||
@ -72,21 +69,24 @@ public:
|
|||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Get detector firmware version
|
// * Get detector firmware version
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns detector firmware version
|
// * @returns detector firmware version
|
||||||
// */
|
// */
|
||||||
// int64_t getDetectorFirmwareVersion(int detPos = -1);
|
// int64_t getDetectorFirmwareVersion(int detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Get detector serial number or MAC
|
// * Get detector serial number or MAC
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns detector serial number or MAC
|
// * @returns detector serial number or MAC
|
||||||
// */
|
// */
|
||||||
// int64_t getDetectorSerialNumber(int detPos = -1);
|
// int64_t getDetectorSerialNumber(int detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Get on-board detector server software version
|
// * Get on-board detector server software version
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns on-board detector server software version
|
// * @returns on-board detector server software version
|
||||||
// */
|
// */
|
||||||
// int64_t getDetectorSoftwareVersion(int detPos = -1);
|
// int64_t getDetectorSoftwareVersion(int detPos = -1);
|
||||||
@ -100,27 +100,31 @@ public:
|
|||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Get receiver software version
|
// * Get receiver software version
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns receiver software version
|
// * @returns receiver software version
|
||||||
// */
|
// */
|
||||||
// int64_t getReceiverSoftwareVersion(int detPos = -1);
|
// int64_t getReceiverSoftwareVersion(int detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Check Detector Version Compatibility
|
// * Check Detector Version Compatibility
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// */
|
// */
|
||||||
// void isDetectorVersionCompatible(int detPos = -1);
|
// void isDetectorVersionCompatible(int detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Check Receiver Version Compatibility
|
// * Check Receiver Version Compatibility
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// */
|
// */
|
||||||
// void isReceiverVersionCompatible(int detPos = -1);
|
// void isReceiverVersionCompatible(int detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Performs a complete acquisition
|
// * Performs a complete acquisition
|
||||||
// * resets frames caught in receiver, starts receiver, starts detector,
|
// * resets frames caught in receiver, starts receiver, starts detector,
|
||||||
// * blocks till detector finished acquisition, stop receiver, increments file index,
|
// * blocks till detector finished acquisition, stop receiver, increments
|
||||||
|
// file index,
|
||||||
// * loops for measurements, calls required call backs.
|
// * loops for measurements, calls required call backs.
|
||||||
// * @returns OK or FAIL depending on if it already started
|
// * @returns OK or FAIL depending on if it already started
|
||||||
// */
|
// */
|
||||||
@ -128,13 +132,15 @@ public:
|
|||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Stop detector acquisition
|
// * Stop detector acquisition
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// */
|
// */
|
||||||
// void stopMeasurement(int detPos = -1);
|
// void stopMeasurement(int detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Get Detector run status
|
// * Get Detector run status
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns status
|
// * @returns status
|
||||||
// */
|
// */
|
||||||
// int getDetectorStatus(int detPos = -1);
|
// int getDetectorStatus(int detPos = -1);
|
||||||
@ -142,20 +148,23 @@ public:
|
|||||||
// /**
|
// /**
|
||||||
// * (Advanced user, included in startMeasurement)
|
// * (Advanced user, included in startMeasurement)
|
||||||
// * Start detector acquisition (Non blocking)
|
// * Start detector acquisition (Non blocking)
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// */
|
// */
|
||||||
// void startAcquisition(int detPos = -1);
|
// void startAcquisition(int detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Stop detector acquisition (Same as stopMeasurement)
|
// * Stop detector acquisition (Same as stopMeasurement)
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// */
|
// */
|
||||||
// void stopAcquisition(int detPos = -1);
|
// void stopAcquisition(int detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * (Only in non blocking acquire mode)
|
// * (Only in non blocking acquire mode)
|
||||||
// * Give an internal software trigger to the detector (Eiger)
|
// * Give an internal software trigger to the detector (Eiger)
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// */
|
// */
|
||||||
// void sendSoftwareTrigger(int detPos = -1);
|
// void sendSoftwareTrigger(int detPos = -1);
|
||||||
|
|
||||||
@ -163,7 +172,8 @@ public:
|
|||||||
// * Set Rate correction ( Eiger)
|
// * Set Rate correction ( Eiger)
|
||||||
// * @param t (1) enable rate correction to default dead time,
|
// * @param t (1) enable rate correction to default dead time,
|
||||||
// * (0) disable rate correction, (-1) gets
|
// * (0) disable rate correction, (-1) gets
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns rate correction tau
|
// * @returns rate correction tau
|
||||||
// */
|
// */
|
||||||
// int enableCountRateCorrection(int i = -1, int detPos = -1);
|
// int enableCountRateCorrection(int i = -1, int detPos = -1);
|
||||||
@ -173,28 +183,34 @@ public:
|
|||||||
// * @param i dynamic range (-1 get)
|
// * @param i dynamic range (-1 get)
|
||||||
// * Options: Eiger(4, 8, 16, 32), Jungfrau(16), Gotthard(16)
|
// * Options: Eiger(4, 8, 16, 32), Jungfrau(16), Gotthard(16)
|
||||||
// * Background operation:
|
// * Background operation:
|
||||||
// * (Eiger: If i is 32, also sets clkdivider to 2, if 16, sets clkdivider to 1)
|
// * (Eiger: If i is 32, also sets clkdivider to 2, if 16, sets clkdivider
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// to 1)
|
||||||
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns current dynamic range
|
// * @returns current dynamic range
|
||||||
// */
|
// */
|
||||||
// int setBitDepth(int i = -1, int detPos = -1);
|
// int setBitDepth(int i = -1, int detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Set detector settings
|
// * Set detector settings
|
||||||
// * (Eiger only stores in shared memory. A get will overwrite this. One must use set threshold energy)
|
// * (Eiger only stores in shared memory. A get will overwrite this. One
|
||||||
|
// must use set threshold energy)
|
||||||
// * @param isettings settings (-1 gets)
|
// * @param isettings settings (-1 gets)
|
||||||
// * Options: (slsDetectorDefs::detectorSettings)
|
// * Options: (slsDetectorDefs::detectorSettings)
|
||||||
// * Eiger (STANDARD, HIGHGAIN, LOWGAIN, VERYHIGHGAIN, VERYLOWGAIN)
|
// * Eiger (STANDARD, HIGHGAIN, LOWGAIN, VERYHIGHGAIN, VERYLOWGAIN)
|
||||||
// * Jungfrau (DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2)
|
// * Jungfrau (DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1,
|
||||||
|
// FORCESWITCHG2)
|
||||||
// * Gotthard (DYNAMICGAIN, HIGHGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN)
|
// * Gotthard (DYNAMICGAIN, HIGHGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN)
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns current settings (can also return UNDEFINED, UNINITIALIZED)
|
// * @returns current settings (can also return UNDEFINED, UNINITIALIZED)
|
||||||
// */
|
// */
|
||||||
// int setSettings(int isettings = -1, int detPos = -1);
|
// int setSettings(int isettings = -1, int detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Get threshold energy (Eiger)
|
// * Get threshold energy (Eiger)
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns current threshold value
|
// * @returns current threshold value
|
||||||
// */
|
// */
|
||||||
// int getThresholdEnergy(int detPos = -1);
|
// int getThresholdEnergy(int detPos = -1);
|
||||||
@ -204,62 +220,75 @@ public:
|
|||||||
// * @param e_eV threshold in eV
|
// * @param e_eV threshold in eV
|
||||||
// * @param tb 1 to load trimbits, 0 to exclude trimbits
|
// * @param tb 1 to load trimbits, 0 to exclude trimbits
|
||||||
// * @param isettings settings (-1 current settings)
|
// * @param isettings settings (-1 current settings)
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns current threshold value
|
// * @returns current threshold value
|
||||||
// */
|
// */
|
||||||
// int setThresholdEnergy(int e_ev, int tb = 1, int isettings = -1, int detPos = -1);
|
// int setThresholdEnergy(int e_ev, int tb = 1, int isettings = -1, int
|
||||||
|
// detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Set/get exposure time
|
// * Set/get exposure time
|
||||||
// * @param t time (-1 gets)
|
// * @param t time (-1 gets)
|
||||||
// * @param inseconds true if the value is in s, else ns
|
// * @param inseconds true if the value is in s, else ns
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns exposure time in ns, or s if specified
|
// * @returns exposure time in ns, or s if specified
|
||||||
// */
|
// */
|
||||||
// double setExposureTime(double t = -1, bool inseconds = false, int detPos = -1);
|
// double setExposureTime(double t = -1, bool inseconds = false, int detPos
|
||||||
|
// = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Set/get exposure period
|
// * Set/get exposure period
|
||||||
// * @param t time (-1 gets)
|
// * @param t time (-1 gets)
|
||||||
// * @param inseconds true if the value is in s, else ns
|
// * @param inseconds true if the value is in s, else ns
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns exposure period in ns, or s if specified
|
// * @returns exposure period in ns, or s if specified
|
||||||
// */
|
// */
|
||||||
// double setExposurePeriod(double t = -1, bool inseconds = false, int detPos = -1);
|
// double setExposurePeriod(double t = -1, bool inseconds = false, int
|
||||||
|
// detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Set/get delay after trigger (Gotthard, Jungfrau(not for this release))
|
// * Set/get delay after trigger (Gotthard, Jungfrau(not for this release))
|
||||||
// * @param t time (-1 gets)
|
// * @param t time (-1 gets)
|
||||||
// * @param inseconds true if the value is in s, else ns
|
// * @param inseconds true if the value is in s, else ns
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns delay after trigger in ns, or s if specified
|
// * @returns delay after trigger in ns, or s if specified
|
||||||
// */
|
// */
|
||||||
// double setDelayAfterTrigger(double t = -1, bool inseconds = false, int detPos = -1);
|
// double setDelayAfterTrigger(double t = -1, bool inseconds = false, int
|
||||||
|
// detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * (Advanced users)
|
// * (Advanced users)
|
||||||
// * Set/get sub frame exposure time (Eiger in 32 bit mode)
|
// * Set/get sub frame exposure time (Eiger in 32 bit mode)
|
||||||
// * @param t time (-1 gets)
|
// * @param t time (-1 gets)
|
||||||
// * @param inseconds true if the value is in s, else ns
|
// * @param inseconds true if the value is in s, else ns
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns sub frame exposure time in ns, or s if specified
|
// * @returns sub frame exposure time in ns, or s if specified
|
||||||
// */
|
// */
|
||||||
// double setSubFrameExposureTime(double t = -1, bool inseconds = false, int detPos = -1);
|
// double setSubFrameExposureTime(double t = -1, bool inseconds = false, int
|
||||||
|
// detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * (Advanced users)
|
// * (Advanced users)
|
||||||
// * Set/get sub frame dead time (Eiger in 32 bit mode)
|
// * Set/get sub frame dead time (Eiger in 32 bit mode)
|
||||||
// * @param t time (-1 gets)
|
// * @param t time (-1 gets)
|
||||||
// * @param inseconds true if the value is in s, else ns
|
// * @param inseconds true if the value is in s, else ns
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns sub frame dead time in ns, or s if specified
|
// * @returns sub frame dead time in ns, or s if specified
|
||||||
// */
|
// */
|
||||||
// double setSubFrameExposureDeadTime(double t = -1, bool inseconds = false, int detPos = -1);
|
// double setSubFrameExposureDeadTime(double t = -1, bool inseconds = false,
|
||||||
|
// int detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Set/get number of frames
|
// * Set/get number of frames
|
||||||
// * @param t number of frames (-1 gets)
|
// * @param t number of frames (-1 gets)
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns number of frames
|
// * @returns number of frames
|
||||||
// */
|
// */
|
||||||
// int64_t setNumberOfFrames(int64_t t = -1, int detPos = -1);
|
// int64_t setNumberOfFrames(int64_t t = -1, int detPos = -1);
|
||||||
@ -267,7 +296,8 @@ public:
|
|||||||
// /**
|
// /**
|
||||||
// * Set/get number of triggers
|
// * Set/get number of triggers
|
||||||
// * @param t number of triggers (-1 gets)
|
// * @param t number of triggers (-1 gets)
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns number of triggers
|
// * @returns number of triggers
|
||||||
// */
|
// */
|
||||||
// int64_t setNumberOfTriggers(int64_t t = -1, int detPos = -1);
|
// int64_t setNumberOfTriggers(int64_t t = -1, int detPos = -1);
|
||||||
@ -275,7 +305,8 @@ public:
|
|||||||
// /**
|
// /**
|
||||||
// * Set/get number of additional storage cells (Jungfrau)
|
// * Set/get number of additional storage cells (Jungfrau)
|
||||||
// * @param t number of additional storage cells. Default is 0. (-1 gets)
|
// * @param t number of additional storage cells. Default is 0. (-1 gets)
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns number of additional storage cells
|
// * @returns number of additional storage cells
|
||||||
// */
|
// */
|
||||||
// int64_t setNumberOfStorageCells(int64_t t = -1, int detPos = -1);
|
// int64_t setNumberOfStorageCells(int64_t t = -1, int detPos = -1);
|
||||||
@ -284,7 +315,8 @@ public:
|
|||||||
// * Get measured period between previous two frames (EIGER)
|
// * Get measured period between previous two frames (EIGER)
|
||||||
// * @param t time (-1 gets)
|
// * @param t time (-1 gets)
|
||||||
// * @param inseconds true if the value is in s, else ns
|
// * @param inseconds true if the value is in s, else ns
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns sub frame dead time in ns, or s if specified
|
// * @returns sub frame dead time in ns, or s if specified
|
||||||
// */
|
// */
|
||||||
// double getMeasuredPeriod(bool inseconds = false, int detPos = -1);
|
// double getMeasuredPeriod(bool inseconds = false, int detPos = -1);
|
||||||
@ -293,10 +325,12 @@ public:
|
|||||||
// * Get sub period between previous two sub frames in 32 bit mode (EIGER)
|
// * Get sub period between previous two sub frames in 32 bit mode (EIGER)
|
||||||
// * @param t time (-1 gets)
|
// * @param t time (-1 gets)
|
||||||
// * @param inseconds true if the value is in s, else ns
|
// * @param inseconds true if the value is in s, else ns
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns sub frame dead time in ns, or s if specified
|
// * @returns sub frame dead time in ns, or s if specified
|
||||||
// */
|
// */
|
||||||
// double getMeasuredSubFramePeriod(bool inseconds = false, int detPos = -1);
|
// double getMeasuredSubFramePeriod(bool inseconds = false, int detPos =
|
||||||
|
// -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Set/get timing mode
|
// * Set/get timing mode
|
||||||
@ -305,7 +339,8 @@ public:
|
|||||||
// * (Eiger: AUTO_TIMING, TRIGGER_EXPOSURE, BURST_TRIGGER, GATED)
|
// * (Eiger: AUTO_TIMING, TRIGGER_EXPOSURE, BURST_TRIGGER, GATED)
|
||||||
// * (Jungfrau: AUTO_TIMING, TRIGGER_EXPOSURE)
|
// * (Jungfrau: AUTO_TIMING, TRIGGER_EXPOSURE)
|
||||||
// * (Gotthard: AUTO_TIMING, TRIGGER_EXPOSURE)
|
// * (Gotthard: AUTO_TIMING, TRIGGER_EXPOSURE)
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns current timing mode
|
// * @returns current timing mode
|
||||||
// */
|
// */
|
||||||
// int setTimingMode(int pol = -1, int detPos = -1);
|
// int setTimingMode(int pol = -1, int detPos = -1);
|
||||||
@ -313,9 +348,12 @@ public:
|
|||||||
// /**
|
// /**
|
||||||
// * Sets clock speed of the detector (Eiger, Jungfrau)
|
// * Sets clock speed of the detector (Eiger, Jungfrau)
|
||||||
// * (Jungfrau also writes adcphase to recommended default)
|
// * (Jungfrau also writes adcphase to recommended default)
|
||||||
// * (Eiger: 0(full speed not for 32 bit mode), 1 (half speed), 2(quarter speed))
|
// * (Eiger: 0(full speed not for 32 bit mode), 1 (half speed), 2(quarter
|
||||||
// * (Jungfrau: 0(full speed not implemented), 1(half speed), 2(quarter speed))
|
// speed))
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * (Jungfrau: 0(full speed not implemented), 1(half speed), 2(quarter
|
||||||
|
// speed))
|
||||||
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns clock speed
|
// * @returns clock speed
|
||||||
// */
|
// */
|
||||||
// int setClockDivider(int value, int detPos = -1);
|
// int setClockDivider(int value, int detPos = -1);
|
||||||
@ -324,7 +362,8 @@ public:
|
|||||||
// * Set parallel readout mode (Eiger)
|
// * Set parallel readout mode (Eiger)
|
||||||
// * @param value readout mode (-1 gets)
|
// * @param value readout mode (-1 gets)
|
||||||
// * false for NonParallel (Default), true for Parallel
|
// * false for NonParallel (Default), true for Parallel
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns 1 for parallel, 0 for non parallel, -1 if different
|
// * @returns 1 for parallel, 0 for non parallel, -1 if different
|
||||||
// */
|
// */
|
||||||
// int setParallelMode(bool value, int detPos = -1);
|
// int setParallelMode(bool value, int detPos = -1);
|
||||||
@ -333,7 +372,8 @@ public:
|
|||||||
// * Set overflow readout mode (Eiger in 32 bit)
|
// * Set overflow readout mode (Eiger in 32 bit)
|
||||||
// * @param value readout mode (-1 gets)
|
// * @param value readout mode (-1 gets)
|
||||||
// * Options: true to Show overflow, false to not show overflow
|
// * Options: true to Show overflow, false to not show overflow
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns 1 for overflow, 0 for no overflow, -1 if different
|
// * @returns 1 for overflow, 0 for no overflow, -1 if different
|
||||||
// */
|
// */
|
||||||
// int setOverflowMode(bool value, int detPos = -1);
|
// int setOverflowMode(bool value, int detPos = -1);
|
||||||
@ -342,7 +382,8 @@ public:
|
|||||||
// * (Advanced user)
|
// * (Advanced user)
|
||||||
// * Sets all the trimbits to a particular value (Eiger)
|
// * Sets all the trimbits to a particular value (Eiger)
|
||||||
// * @param val trimbit value
|
// * @param val trimbit value
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns OK or FAIL
|
// * @returns OK or FAIL
|
||||||
// */
|
// */
|
||||||
// int setAllTrimbits(int val, int detPos = -1);
|
// int setAllTrimbits(int val, int detPos = -1);
|
||||||
@ -356,7 +397,8 @@ public:
|
|||||||
// * (Eiger: SVP up to IO_DELAY, THRESHOLD, HIGH_VOLTAGE)
|
// * (Eiger: SVP up to IO_DELAY, THRESHOLD, HIGH_VOLTAGE)
|
||||||
// * (Jungfrau: 0-7)
|
// * (Jungfrau: 0-7)
|
||||||
// * (Gotthard: VREF_DS up to IB_TESTC, HIGH_VOLTAGE)
|
// * (Gotthard: VREF_DS up to IB_TESTC, HIGH_VOLTAGE)
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns current DAC value
|
// * @returns current DAC value
|
||||||
// */
|
// */
|
||||||
// int setDAC(int val, int index , int detPos = -1);
|
// int setDAC(int val, int index , int detPos = -1);
|
||||||
@ -368,24 +410,30 @@ public:
|
|||||||
// * (Eiger: TEMPERATURE_FPGA, TEMPERATURE_FPGAEXT upto TEMPERATURE_FPGA3)
|
// * (Eiger: TEMPERATURE_FPGA, TEMPERATURE_FPGAEXT upto TEMPERATURE_FPGA3)
|
||||||
// * (Jungfrau: TEMPERATURE_FPGA)
|
// * (Jungfrau: TEMPERATURE_FPGA)
|
||||||
// * (Gotthard: TEMPERATURE_ADC, TEMPERATURE_FPGA)
|
// * (Gotthard: TEMPERATURE_ADC, TEMPERATURE_FPGA)
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
// * @returns current adc value (temperature for eiger and jungfrau in millidegrees)
|
// position
|
||||||
|
// * @returns current adc value (temperature for eiger and jungfrau in
|
||||||
|
// millidegrees)
|
||||||
// */
|
// */
|
||||||
// int getADC(int index, int detPos = -1);
|
// int getADC(int index, int detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Enable/disable or 10Gbe (Eiger)
|
// * Enable/disable or 10Gbe (Eiger)
|
||||||
// * @param i is -1 to get, 0 to disable and 1 to enable
|
// * @param i is -1 to get, 0 to disable and 1 to enable
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns if 10Gbe is enabled
|
// * @returns if 10Gbe is enabled
|
||||||
// */
|
// */
|
||||||
// int setTenGigabitEthernet(int i = -1, int detPos = -1);
|
// int setTenGigabitEthernet(int i = -1, int detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Set storage cell that stores first acquisition of the series (Jungfrau)
|
// * Set storage cell that stores first acquisition of the series
|
||||||
|
// (Jungfrau)
|
||||||
// * @param value storage cell index. Value can be 0 to 15. (-1 gets)
|
// * @param value storage cell index. Value can be 0 to 15. (-1 gets)
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
// * @returns the storage cell that stores the first acquisition of the series
|
// position
|
||||||
|
// * @returns the storage cell that stores the first acquisition of the
|
||||||
|
// series
|
||||||
// */
|
// */
|
||||||
// int setStoragecellStart(int pos=-1, int detPos = -1);
|
// int setStoragecellStart(int pos=-1, int detPos = -1);
|
||||||
|
|
||||||
@ -402,7 +450,8 @@ public:
|
|||||||
// /**
|
// /**
|
||||||
// * Set 10GbE Flow Control (Eiger and Jungfrau)
|
// * Set 10GbE Flow Control (Eiger and Jungfrau)
|
||||||
// * @param enable 1 to set, 0 to unset, -1 gets
|
// * @param enable 1 to set, 0 to unset, -1 gets
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns 10GbE flow Control
|
// * @returns 10GbE flow Control
|
||||||
// */
|
// */
|
||||||
// int setFlowControl10G(int enable = -1, int detPos = -1);
|
// int setFlowControl10G(int enable = -1, int detPos = -1);
|
||||||
@ -416,7 +465,6 @@ public:
|
|||||||
// */
|
// */
|
||||||
// void setROI(slsDetectorDefs::ROI arg, int detPos = -1);
|
// void setROI(slsDetectorDefs::ROI arg, int detPos = -1);
|
||||||
|
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Get ROI (Gotthard)
|
// * Get ROI (Gotthard)
|
||||||
// * Only allowed to set one ROI per module
|
// * Only allowed to set one ROI per module
|
||||||
@ -425,8 +473,6 @@ public:
|
|||||||
// */
|
// */
|
||||||
// slsDetectorDefs::ROI getROI(int detPos = -1);
|
// slsDetectorDefs::ROI getROI(int detPos = -1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// /************************************************************************
|
// /************************************************************************
|
||||||
|
|
||||||
// RECEIVER FUNCTIONS
|
// RECEIVER FUNCTIONS
|
||||||
@ -436,21 +482,24 @@ public:
|
|||||||
// /**
|
// /**
|
||||||
// * (Advanced user, included in startMeasurement)
|
// * (Advanced user, included in startMeasurement)
|
||||||
// * Receiver starts listening to packets
|
// * Receiver starts listening to packets
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// */
|
// */
|
||||||
// void startReceiver(int detPos = -1);
|
// void startReceiver(int detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * (Advanced user, included in startMeasurement)
|
// * (Advanced user, included in startMeasurement)
|
||||||
// * Stops the listening mode of receiver
|
// * Stops the listening mode of receiver
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// */
|
// */
|
||||||
// void stopReceiver(int detPos = -1);
|
// void stopReceiver(int detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Set/get receiver silent mode
|
// * Set/get receiver silent mode
|
||||||
// * @param i is -1 to get, 0 unsets silent mode, 1 sets silent mode
|
// * @param i is -1 to get, 0 unsets silent mode, 1 sets silent mode
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns the receiver silent mode enable
|
// * @returns the receiver silent mode enable
|
||||||
// */
|
// */
|
||||||
// int setReceiverSilentMode(int i = -1, int detPos = -1);
|
// int setReceiverSilentMode(int i = -1, int detPos = -1);
|
||||||
@ -459,7 +508,8 @@ public:
|
|||||||
// * (Advanced user, included in startMeasurement)
|
// * (Advanced user, included in startMeasurement)
|
||||||
// * Resets framescaught in receiver
|
// * Resets framescaught in receiver
|
||||||
// * Use this when using startAcquisition instead of acquire
|
// * Use this when using startAcquisition instead of acquire
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// */
|
// */
|
||||||
// void resetFramesCaughtInReceiver(int detPos = -1);
|
// void resetFramesCaughtInReceiver(int detPos = -1);
|
||||||
|
|
||||||
@ -467,21 +517,24 @@ public:
|
|||||||
// * (Advanced user)
|
// * (Advanced user)
|
||||||
// * Set/get receiver fifo depth
|
// * Set/get receiver fifo depth
|
||||||
// * @param i is -1 to get, any other value to set the fifo deph
|
// * @param i is -1 to get, any other value to set the fifo deph
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns the receiver fifo depth
|
// * @returns the receiver fifo depth
|
||||||
// */
|
// */
|
||||||
// int setReceiverFifoDepth(int i = -1, int detPos = -1);
|
// int setReceiverFifoDepth(int i = -1, int detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Returns output file directory
|
// * Returns output file directory
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns output file directory
|
// * @returns output file directory
|
||||||
// */
|
// */
|
||||||
// std::string getFilePath(int detPos = -1);
|
// std::string getFilePath(int detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Sets up the file directory
|
// * Sets up the file directory
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @param s file directory
|
// * @param s file directory
|
||||||
// * @returns file dir
|
// * @returns file dir
|
||||||
// */
|
// */
|
||||||
@ -489,14 +542,16 @@ public:
|
|||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Returns file name prefix
|
// * Returns file name prefix
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns file name prefix
|
// * @returns file name prefix
|
||||||
// */
|
// */
|
||||||
// std::string getFileName(int detPos = -1);
|
// std::string getFileName(int detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Sets up the file name prefix
|
// * Sets up the file name prefix
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @param s file name prefix
|
// * @param s file name prefix
|
||||||
// * @returns file name prefix
|
// * @returns file name prefix
|
||||||
// */
|
// */
|
||||||
@ -504,7 +559,8 @@ public:
|
|||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Returns file index
|
// * Returns file index
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns file index
|
// * @returns file index
|
||||||
// */
|
// */
|
||||||
// int getFileIndex(int detPos = -1);
|
// int getFileIndex(int detPos = -1);
|
||||||
@ -512,7 +568,8 @@ public:
|
|||||||
// /**
|
// /**
|
||||||
// * Sets up the file index
|
// * Sets up the file index
|
||||||
// * @param i file index
|
// * @param i file index
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns file index
|
// * @returns file index
|
||||||
// */
|
// */
|
||||||
// int setFileIndex(int i, int detPos = -1);
|
// int setFileIndex(int i, int detPos = -1);
|
||||||
@ -520,7 +577,8 @@ public:
|
|||||||
// /**
|
// /**
|
||||||
// * Sets/Gets receiver file write enable
|
// * Sets/Gets receiver file write enable
|
||||||
// * @param enable 1 or 0 to set/reset file write enable
|
// * @param enable 1 or 0 to set/reset file write enable
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns file write enable
|
// * @returns file write enable
|
||||||
// */
|
// */
|
||||||
// int enableWriteToFile(int enable = -1, int detPos = -1);
|
// int enableWriteToFile(int enable = -1, int detPos = -1);
|
||||||
@ -528,7 +586,8 @@ public:
|
|||||||
// /**
|
// /**
|
||||||
// * Sets/Gets file overwrite enable
|
// * Sets/Gets file overwrite enable
|
||||||
// * @param enable 1 or 0 to set/reset file overwrite enable
|
// * @param enable 1 or 0 to set/reset file overwrite enable
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns file overwrite enable
|
// * @returns file overwrite enable
|
||||||
// */
|
// */
|
||||||
// int enableOverwriteFile(int enable = -1, int detPos = -1);
|
// int enableOverwriteFile(int enable = -1, int detPos = -1);
|
||||||
@ -536,9 +595,11 @@ public:
|
|||||||
// /**
|
// /**
|
||||||
// * (previously setReceiverMode)
|
// * (previously setReceiverMode)
|
||||||
// * Sets the receiver streaming frequency
|
// * Sets the receiver streaming frequency
|
||||||
// * @param freq nth frame streamed out, if 0, streamed out at a timer of 200 ms
|
// * @param freq nth frame streamed out, if 0, streamed out at a timer of
|
||||||
|
// 200 ms
|
||||||
// * frames in between are not streamed
|
// * frames in between are not streamed
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns receiver streaming frequency
|
// * @returns receiver streaming frequency
|
||||||
// */
|
// */
|
||||||
// int setReceiverStreamingFrequency(int freq = -1, int detPos = -1);
|
// int setReceiverStreamingFrequency(int freq = -1, int detPos = -1);
|
||||||
@ -548,22 +609,26 @@ public:
|
|||||||
// * If receiver streaming frequency is 0, then this timer between each
|
// * If receiver streaming frequency is 0, then this timer between each
|
||||||
// * data stream is set. Default is 200 ms.
|
// * data stream is set. Default is 200 ms.
|
||||||
// * @param time_in_ms timer between frames
|
// * @param time_in_ms timer between frames
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns receiver streaming timer in ms
|
// * @returns receiver streaming timer in ms
|
||||||
// */
|
// */
|
||||||
// int setReceiverStreamingTimer(int time_in_ms=500, int detPos = -1);
|
// int setReceiverStreamingTimer(int time_in_ms=500, int detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Enable data streaming to client (data call back in client processing thread)
|
// * Enable data streaming to client (data call back in client processing
|
||||||
|
// thread)
|
||||||
// * @param enable 0 to disable, 1 to enable, -1 to get the value
|
// * @param enable 0 to disable, 1 to enable, -1 to get the value
|
||||||
// * @returns data streaming to client enable
|
// * @returns data streaming to client enable
|
||||||
// */
|
// */
|
||||||
// int enableDataStreamingToClient(int enable=-1);
|
// int enableDataStreamingToClient(int enable=-1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Enable or disable streaming data from receiver (starts streaming threads)
|
// * Enable or disable streaming data from receiver (starts streaming
|
||||||
|
// threads)
|
||||||
// * @param enable 0 to disable 1 to enable -1 to only get the value
|
// * @param enable 0 to disable 1 to enable -1 to only get the value
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns data streaming from receiver enable
|
// * @returns data streaming from receiver enable
|
||||||
// */
|
// */
|
||||||
// int enableDataStreamingFromReceiver(int enable=-1, int detPos = -1);
|
// int enableDataStreamingFromReceiver(int enable=-1, int detPos = -1);
|
||||||
@ -572,9 +637,12 @@ public:
|
|||||||
// * (advanced users)
|
// * (advanced users)
|
||||||
// * Set/Get receiver streaming out ZMQ port and restarts receiver sockets
|
// * Set/Get receiver streaming out ZMQ port and restarts receiver sockets
|
||||||
// * @param i sets, -1 gets
|
// * @param i sets, -1 gets
|
||||||
// * If detPos is -1(multi module), port calculated (increments) for all the individual detectors using i
|
// * If detPos is -1(multi module), port calculated (increments) for all
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// the individual detectors using i
|
||||||
// * @returns receiver streaming out ZMQ port (if multiple, of first receiver socket)
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
|
// * @returns receiver streaming out ZMQ port (if multiple, of first
|
||||||
|
// receiver socket)
|
||||||
// */
|
// */
|
||||||
// int setReceiverDataStreamingOutPort(int i = -1, int detPos = -1);
|
// int setReceiverDataStreamingOutPort(int i = -1, int detPos = -1);
|
||||||
|
|
||||||
@ -582,9 +650,12 @@ public:
|
|||||||
// * (advanced users)
|
// * (advanced users)
|
||||||
// * Set/Get client streaming in ZMQ port and restarts client sockets
|
// * Set/Get client streaming in ZMQ port and restarts client sockets
|
||||||
// * @param i sets, -1 gets
|
// * @param i sets, -1 gets
|
||||||
// * If detPos is -1(multi module), port calculated (increments) for all the individual detectors using i
|
// * If detPos is -1(multi module), port calculated (increments) for all
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// the individual detectors using i
|
||||||
// * @returns receiver streaming out ZMQ port (if multiple, of first receiver socket)
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
|
// * @returns receiver streaming out ZMQ port (if multiple, of first
|
||||||
|
// receiver socket)
|
||||||
// */
|
// */
|
||||||
// int setClientDataStreamingInPort(int i = -1, int detPos = -1);
|
// int setClientDataStreamingInPort(int i = -1, int detPos = -1);
|
||||||
|
|
||||||
@ -593,26 +664,31 @@ public:
|
|||||||
// * Set/Get receiver streaming out ZMQ IP and restarts receiver sockets
|
// * Set/Get receiver streaming out ZMQ IP and restarts receiver sockets
|
||||||
// * @param i sets, empty string gets
|
// * @param i sets, empty string gets
|
||||||
// * By default, it is the IP of receiver hostname
|
// * By default, it is the IP of receiver hostname
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns receiver streaming out ZMQ IP
|
// * @returns receiver streaming out ZMQ IP
|
||||||
// */
|
// */
|
||||||
// std::string setReceiverDataStreamingOutIP(const std::string& ip="", int detPos = -1);
|
// std::string setReceiverDataStreamingOutIP(const std::string& ip="", int
|
||||||
|
// detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * (advanced users)
|
// * (advanced users)
|
||||||
// * Set/Get client streaming in ZMQ IP and restarts client sockets
|
// * Set/Get client streaming in ZMQ IP and restarts client sockets
|
||||||
// * @param i sets, empty string gets
|
// * @param i sets, empty string gets
|
||||||
// * By default, it is the IP of receiver hostname
|
// * By default, it is the IP of receiver hostname
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns client streaming in ZMQ IP
|
// * @returns client streaming in ZMQ IP
|
||||||
// */
|
// */
|
||||||
// std::string setClientDataStreamingInIP(const std::string& ip = "", int detPos = -1);
|
// std::string setClientDataStreamingInIP(const std::string& ip = "", int
|
||||||
|
// detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Enable gap pixels in receiver (Eiger for 8,16 and 32 bit mode)
|
// * Enable gap pixels in receiver (Eiger for 8,16 and 32 bit mode)
|
||||||
// * 4 bit mode gap pixels only in data call back in client
|
// * 4 bit mode gap pixels only in data call back in client
|
||||||
// * @param val 1 sets, 0 unsets, -1 gets
|
// * @param val 1 sets, 0 unsets, -1 gets
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns gap pixel enable
|
// * @returns gap pixel enable
|
||||||
// */
|
// */
|
||||||
// int enableGapPixels(int val=-1, int detPos = -1);
|
// int enableGapPixels(int val=-1, int detPos = -1);
|
||||||
@ -621,8 +697,10 @@ public:
|
|||||||
// * Sets the frame discard policy in receiver
|
// * Sets the frame discard policy in receiver
|
||||||
// * @param f frame discard policy (-1 gets)
|
// * @param f frame discard policy (-1 gets)
|
||||||
// * Options: (slsDetectorDefs::frameDiscardPolicy)
|
// * Options: (slsDetectorDefs::frameDiscardPolicy)
|
||||||
// * (NO_DISCARD (default), DISCARD_EMPTY_FRAMES, DISCARD_PARTIAL_FRAMES (fastest))
|
// * (NO_DISCARD (default), DISCARD_EMPTY_FRAMES, DISCARD_PARTIAL_FRAMES
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// (fastest))
|
||||||
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns current frame discard policy
|
// * @returns current frame discard policy
|
||||||
// */
|
// */
|
||||||
// int setReceiverFramesDiscardPolicy(int f = -1, int detPos = -1);
|
// int setReceiverFramesDiscardPolicy(int f = -1, int detPos = -1);
|
||||||
@ -630,35 +708,43 @@ public:
|
|||||||
// /**
|
// /**
|
||||||
// * Sets the frame padding in receiver
|
// * Sets the frame padding in receiver
|
||||||
// * @param f 0 does not partial frames, 1 pads partial frames (-1 gets)
|
// * @param f 0 does not partial frames, 1 pads partial frames (-1 gets)
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns partial frames padding enable
|
// * @returns partial frames padding enable
|
||||||
// */
|
// */
|
||||||
// int setReceiverPartialFramesPadding(int f = -1, int detPos = -1);
|
// int setReceiverPartialFramesPadding(int f = -1, int detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Sets the frames per file in receiver
|
// * Sets the frames per file in receiver
|
||||||
// * @param f frames per file, 0 is infinite ie. every frame in same file (-1 gets)
|
// * @param f frames per file, 0 is infinite ie. every frame in same file
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// (-1 gets)
|
||||||
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns frames per file
|
// * @returns frames per file
|
||||||
// */
|
// */
|
||||||
// int setReceiverFramesPerFile(int f = -1, int detPos = -1);
|
// int setReceiverFramesPerFile(int f = -1, int detPos = -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Sets the detector minimum/maximum energy threshold in processor (for Moench only)
|
// * Sets the detector minimum/maximum energy threshold in processor (for
|
||||||
|
// Moench only)
|
||||||
// * @param index 0 for emin, antyhing else for emax
|
// * @param index 0 for emin, antyhing else for emax
|
||||||
// * @param v value to set (-1 gets)
|
// * @param v value to set (-1 gets)
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
|
// position
|
||||||
// * @returns detector minimum/maximum energy threshold
|
// * @returns detector minimum/maximum energy threshold
|
||||||
// */
|
// */
|
||||||
// int setDetectorMinMaxEnergyThreshold(const int index, int v, int detPos = -1);
|
// int setDetectorMinMaxEnergyThreshold(const int index, int v, int detPos =
|
||||||
|
// -1);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Sets the frame mode in processor (Moench only)
|
// * Sets the frame mode in processor (Moench only)
|
||||||
// * @param value frame mode value (-1 gets)
|
// * @param value frame mode value (-1 gets)
|
||||||
// * Options (slsDetectorDefs::frameModeType)
|
// * Options (slsDetectorDefs::frameModeType)
|
||||||
// * PEDESTAL, NEW_PEDESTAL, FLATFIELD, NEW_FLATFIELD
|
// * PEDESTAL, NEW_PEDESTAL, FLATFIELD, NEW_FLATFIELD
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
// * @returns frame mode (-1 for not found or error in computing json parameter value)
|
// position
|
||||||
|
// * @returns frame mode (-1 for not found or error in computing json
|
||||||
|
// parameter value)
|
||||||
// */
|
// */
|
||||||
// int setFrameMode(int value, int detPos = -1);
|
// int setFrameMode(int value, int detPos = -1);
|
||||||
|
|
||||||
@ -667,8 +753,10 @@ public:
|
|||||||
// * @param value detector mode value (-1 gets)
|
// * @param value detector mode value (-1 gets)
|
||||||
// * Options (slsDetectorDefs::detectorModeType)
|
// * Options (slsDetectorDefs::detectorModeType)
|
||||||
// * COUNTING, INTERPOLATING, ANALOG
|
// * COUNTING, INTERPOLATING, ANALOG
|
||||||
// * @param detPos -1 for all detectors in list or specific detector position
|
// * @param detPos -1 for all detectors in list or specific detector
|
||||||
// * @returns detector mode (-1 for not found or error in computing json parameter value)
|
// position
|
||||||
|
// * @returns detector mode (-1 for not found or error in computing json
|
||||||
|
// parameter value)
|
||||||
// */
|
// */
|
||||||
// int setDetectorMode(int value, int detPos = -1);
|
// int setDetectorMode(int value, int detPos = -1);
|
||||||
|
|
||||||
@ -688,7 +776,8 @@ public:
|
|||||||
// * @param pArg argument
|
// * @param pArg argument
|
||||||
// */
|
// */
|
||||||
|
|
||||||
// void registerDataCallback(void( *userCallback)(detectorData* d, uint64_t f, uint32_t s, void*), void *pArg);
|
// void registerDataCallback(void( *userCallback)(detectorData* d, uint64_t
|
||||||
|
// f, uint32_t s, void*), void *pArg);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * register callback for accessing acquisition final data in client,
|
// * register callback for accessing acquisition final data in client,
|
||||||
@ -696,19 +785,18 @@ public:
|
|||||||
// * gets detector status and progress index as arguments
|
// * gets detector status and progress index as arguments
|
||||||
// * @param pArg argument
|
// * @param pArg argument
|
||||||
// */
|
// */
|
||||||
// void registerAcquisitionFinishedCallback(void( *func)(double,int, void*), void *pArg);
|
// void registerAcquisitionFinishedCallback(void( *func)(double,int, void*),
|
||||||
|
// void *pArg);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// @short [usage strongly discouraged] sets parameters trough command line interface http://www.psi.ch/detectors/UsersSupportEN/slsDetectorClientHowTo.pdf
|
// @short [usage strongly discouraged] sets parameters trough command line
|
||||||
|
// interface
|
||||||
|
// http://www.psi.ch/detectors/UsersSupportEN/slsDetectorClientHowTo.pdf
|
||||||
// \param command string as it would be written on the command line
|
// \param command string as it would be written on the command line
|
||||||
// \returns void
|
// \returns void
|
||||||
// */
|
// */
|
||||||
// void putCommand(const std::string& command);
|
// void putCommand(const std::string& command);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// /************************************************************************
|
// /************************************************************************
|
||||||
|
|
||||||
// STATIC FUNCTIONS
|
// STATIC FUNCTIONS
|
||||||
@ -717,25 +805,34 @@ public:
|
|||||||
|
|
||||||
/** @short returns std::string from run status index
|
/** @short returns std::string from run status index
|
||||||
\param s run status index
|
\param s run status index
|
||||||
\returns std::string error, waiting, running, data, finished or unknown when wrong index
|
\returns std::string error, waiting, running, data, finished or unknown when
|
||||||
|
wrong index
|
||||||
*/
|
*/
|
||||||
/* static std::string runStatusType(int s){ \
|
/* static std::string runStatusType(int s){
|
||||||
switch (s) { \
|
\
|
||||||
case 0: return std::string("idle"); \
|
switch (s) {
|
||||||
case 1: return std::string("error"); \
|
\
|
||||||
case 2: return std::string("waiting"); \
|
case 0: return std::string("idle");
|
||||||
case 3: return std::string("finished"); \
|
\
|
||||||
case 4: return std::string("data"); \
|
case 1: return std::string("error");
|
||||||
case 5: return std::string("running"); \
|
\
|
||||||
|
case 2: return std::string("waiting");
|
||||||
|
\
|
||||||
|
case 3: return std::string("finished");
|
||||||
|
\
|
||||||
|
case 4: return std::string("data");
|
||||||
|
\
|
||||||
|
case 5: return std::string("running");
|
||||||
|
\
|
||||||
case 6: return std::string("stopped"); \
|
case 6: return std::string("stopped"); \
|
||||||
default: return std::string("unknown"); \
|
default: return std::string("unknown");
|
||||||
|
\
|
||||||
}};
|
}};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/** @short returns detector settings std::string from index
|
/** @short returns detector settings std::string from index
|
||||||
\param s can be standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain
|
\param s can be standard, fast, highgain, dynamicgain, lowgain, mediumgain,
|
||||||
\returns setting index (-1 unknown std::string)
|
veryhighgain \returns setting index (-1 unknown std::string)
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
static int getDetectorSettings(std::string s){ \
|
static int getDetectorSettings(std::string s){ \
|
||||||
@ -750,7 +847,8 @@ public:
|
|||||||
|
|
||||||
/** @short returns detector settings std::string from index
|
/** @short returns detector settings std::string from index
|
||||||
\param s settings index
|
\param s settings index
|
||||||
\returns standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain, undefined when wrong index
|
\returns standard, fast, highgain, dynamicgain, lowgain, mediumgain,
|
||||||
|
veryhighgain, undefined when wrong index
|
||||||
*/
|
*/
|
||||||
/* static std::string getDetectorSettings(int s){\
|
/* static std::string getDetectorSettings(int s){\
|
||||||
switch(s) { \
|
switch(s) { \
|
||||||
@ -760,43 +858,51 @@ public:
|
|||||||
case 3: return std::string("dynamicgain"); \
|
case 3: return std::string("dynamicgain"); \
|
||||||
case 4: return std::string("lowgain"); \
|
case 4: return std::string("lowgain"); \
|
||||||
case 5: return std::string("mediumgain"); \
|
case 5: return std::string("mediumgain"); \
|
||||||
case 6: return std::string("veryhighgain"); \
|
case 6: return std::string("veryhighgain");
|
||||||
default: return std::string("undefined"); \
|
\
|
||||||
|
default: return std::string("undefined");
|
||||||
|
\
|
||||||
}};
|
}};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@short returns external communication mode std::string from index
|
@short returns external communication mode std::string from index
|
||||||
\param f index for communication mode
|
\param f index for communication mode
|
||||||
\returns auto, trigger, ro_trigger, gating, triggered_gating, unknown when wrong mode
|
\returns auto, trigger, ro_trigger, gating, triggered_gating, unknown when
|
||||||
|
wrong mode
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* static std::string getTimingMode(int f){ \
|
/* static std::string getTimingMode(int f){ \
|
||||||
switch(f) { \
|
switch(f) { \
|
||||||
case 0: return std::string( "auto"); \
|
case 0: return std::string( "auto"); \
|
||||||
case 1: return std::string("trigger"); \
|
case 1: return std::string("trigger"); \
|
||||||
case 2: return std::string("ro_trigger"); \
|
case 2: return std::string("ro_trigger");
|
||||||
|
\
|
||||||
case 3: return std::string("gating"); \
|
case 3: return std::string("gating"); \
|
||||||
case 4: return std::string("triggered_gating"); \
|
case 4: return std::string("triggered_gating"); \
|
||||||
case 5: return std::string("burst_trigger"); \
|
case 5: return std::string("burst_trigger"); \
|
||||||
default: return std::string( "unknown"); \
|
default: return std::string( "unknown");
|
||||||
} };
|
\ } };
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
@short returns external communication mode std::string from index
|
@short returns external communication mode std::string from index
|
||||||
\param s index for communication mode
|
\param s index for communication mode
|
||||||
\returns auto, trigger, ro_trigger, gating, triggered_gating, burst_trigger, unknown when wrong mode
|
\returns auto, trigger, ro_trigger, gating, triggered_gating, burst_trigger,
|
||||||
|
unknown when wrong mode
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* static int getTimingMode(std::string s){ \
|
/* static int getTimingMode(std::string s){ \
|
||||||
if (s== "auto") return 0; \
|
if (s== "auto") return 0;
|
||||||
if (s== "trigger") return 1; \
|
\
|
||||||
if (s== "ro_trigger") return 2; \
|
if (s== "trigger") return 1;
|
||||||
if (s== "gating") return 3; \
|
\
|
||||||
|
if (s== "ro_trigger") return 2;
|
||||||
|
\
|
||||||
|
if (s== "gating") return 3;
|
||||||
|
\
|
||||||
if (s== "triggered_gating") return 4; \
|
if (s== "triggered_gating") return 4; \
|
||||||
if (s== "burst_trigger") return 5; \
|
if (s== "burst_trigger") return 5; \ return -1;
|
||||||
return -1; };
|
};
|
||||||
|
|
||||||
*/
|
*/
|
||||||
private:
|
private:
|
||||||
|
4
slsDetectorSoftware/src/CmdParser.cpp
Executable file → Normal file
4
slsDetectorSoftware/src/CmdParser.cpp
Executable file → Normal file
@ -45,7 +45,8 @@ void CmdParser::Parse(const std::string &s) {
|
|||||||
auto old_size = arguments_.size();
|
auto old_size = arguments_.size();
|
||||||
arguments_.erase(std::remove_if(begin(arguments_), end(arguments_),
|
arguments_.erase(std::remove_if(begin(arguments_), end(arguments_),
|
||||||
[](const std::string &item) {
|
[](const std::string &item) {
|
||||||
return (item == "-h" || item == "--help");
|
return (item == "-h" ||
|
||||||
|
item == "--help");
|
||||||
}),
|
}),
|
||||||
end(arguments_));
|
end(arguments_));
|
||||||
if (old_size - arguments_.size() > 0)
|
if (old_size - arguments_.size() > 0)
|
||||||
@ -100,7 +101,6 @@ std::vector<const char *> CmdParser::argv() const {
|
|||||||
return vec;
|
return vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string CmdParser::cli_line() const {
|
std::string CmdParser::cli_line() const {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << command_;
|
os << command_;
|
||||||
|
4
slsDetectorSoftware/src/CmdParser.h
Executable file → Normal file
4
slsDetectorSoftware/src/CmdParser.h
Executable file → Normal file
@ -33,7 +33,9 @@ class CmdParser {
|
|||||||
bool isHelp() const noexcept { return help_; }
|
bool isHelp() const noexcept { return help_; }
|
||||||
|
|
||||||
const std::string &executable() const noexcept { return executable_; }
|
const std::string &executable() const noexcept { return executable_; }
|
||||||
const std::vector<std::string> &arguments() const noexcept{ return arguments_; };
|
const std::vector<std::string> &arguments() const noexcept {
|
||||||
|
return arguments_;
|
||||||
|
};
|
||||||
std::vector<const char *> argv() const;
|
std::vector<const char *> argv() const;
|
||||||
std::string cli_line() const;
|
std::string cli_line() const;
|
||||||
|
|
||||||
|
@ -169,7 +169,8 @@ std::string CmdProxy::VirtualServer(int action) {
|
|||||||
if (det_id != -1) {
|
if (det_id != -1) {
|
||||||
throw sls::RuntimeError("Cannot execute this at module level");
|
throw sls::RuntimeError("Cannot execute this at module level");
|
||||||
}
|
}
|
||||||
det->setVirtualDetectorServers(StringTo<int>(args[0]), StringTo<int>(args[1]));
|
det->setVirtualDetectorServers(StringTo<int>(args[0]),
|
||||||
|
StringTo<int>(args[1]));
|
||||||
os << sls::ToString(args);
|
os << sls::ToString(args);
|
||||||
} else {
|
} else {
|
||||||
throw sls::RuntimeError("Unknown action");
|
throw sls::RuntimeError("Unknown action");
|
||||||
@ -394,20 +395,23 @@ std::string CmdProxy::Adcphase(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[n_value] [(optional)deg]\n\t[Jungfrau][Ctb][Moench][Moench][Gotthard] Phase "
|
os << "[n_value] "
|
||||||
|
"[(optional)deg]\n\t[Jungfrau][Ctb][Moench][Moench][Gotthard] "
|
||||||
|
"Phase "
|
||||||
"shift of ADC clock. \n\t[Jungfrau] Absolute phase shift. If deg "
|
"shift of ADC clock. \n\t[Jungfrau] Absolute phase shift. If deg "
|
||||||
"used, then shift in degrees. Changing Speed also resets "
|
"used, then shift in degrees. Changing Speed also resets "
|
||||||
"adcphase to recommended defaults.\n\t[Ctb][Moench] Absolute phase "
|
"adcphase to recommended defaults.\n\t[Ctb][Moench] Absolute "
|
||||||
|
"phase "
|
||||||
"shift. If deg used, then shift in degrees. Changing adcclk also "
|
"shift. If deg used, then shift in degrees. Changing adcclk also "
|
||||||
"resets adcphase and sets it to previous values.\n\t[Gotthard] "
|
"resets adcphase and sets it to previous values.\n\t[Gotthard] "
|
||||||
"Relative phase shift"
|
"Relative phase shift"
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else {
|
} else {
|
||||||
auto det_type = det->getDetectorType().squash(defs::GENERIC);
|
auto det_type = det->getDetectorType().squash(defs::GENERIC);
|
||||||
if (det_type == defs::EIGER ||
|
if (det_type == defs::EIGER || det_type == defs::MYTHEN3 ||
|
||||||
det_type == defs::MYTHEN3 ||
|
|
||||||
det_type == defs::GOTTHARD2) {
|
det_type == defs::GOTTHARD2) {
|
||||||
throw sls::RuntimeError("adcphase not implemented for this detector");
|
throw sls::RuntimeError(
|
||||||
|
"adcphase not implemented for this detector");
|
||||||
}
|
}
|
||||||
if (action == defs::GET_ACTION) {
|
if (action == defs::GET_ACTION) {
|
||||||
Result<int> t;
|
Result<int> t;
|
||||||
@ -416,7 +420,8 @@ std::string CmdProxy::Adcphase(int action) {
|
|||||||
os << OutString(t) << '\n';
|
os << OutString(t) << '\n';
|
||||||
} else if (args.size() == 1) {
|
} else if (args.size() == 1) {
|
||||||
if (args[0] != "deg") {
|
if (args[0] != "deg") {
|
||||||
throw sls::RuntimeError("Unknown adcphase argument " + args[0] +
|
throw sls::RuntimeError("Unknown adcphase argument " +
|
||||||
|
args[0] +
|
||||||
". Did you mean deg? ");
|
". Did you mean deg? ");
|
||||||
}
|
}
|
||||||
t = det->getADCPhaseInDegrees({det_id});
|
t = det->getADCPhaseInDegrees({det_id});
|
||||||
@ -449,17 +454,19 @@ std::string CmdProxy::Dbitphase(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[n_value] [(optional)deg]\n\t[Ctb][Jungfrau] Phase shift of clock to "
|
os << "[n_value] [(optional)deg]\n\t[Ctb][Jungfrau] Phase shift of "
|
||||||
|
"clock to "
|
||||||
"latch digital bits. Absolute phase shift. If deg used, then "
|
"latch digital bits. Absolute phase shift. If deg used, then "
|
||||||
"shift in degrees. \n\t[Ctb]Changing dbitclk also resets dbitphase and "
|
"shift in degrees. \n\t[Ctb]Changing dbitclk also resets "
|
||||||
|
"dbitphase and "
|
||||||
"sets to previous values."
|
"sets to previous values."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else {
|
} else {
|
||||||
auto det_type = det->getDetectorType().squash(defs::GENERIC);
|
auto det_type = det->getDetectorType().squash(defs::GENERIC);
|
||||||
if (det_type == defs::EIGER ||
|
if (det_type == defs::EIGER || det_type == defs::MYTHEN3 ||
|
||||||
det_type == defs::MYTHEN3 ||
|
|
||||||
det_type == defs::GOTTHARD2) {
|
det_type == defs::GOTTHARD2) {
|
||||||
throw sls::RuntimeError("dbitphase not implemented for this detector");
|
throw sls::RuntimeError(
|
||||||
|
"dbitphase not implemented for this detector");
|
||||||
}
|
}
|
||||||
if (action == defs::GET_ACTION) {
|
if (action == defs::GET_ACTION) {
|
||||||
Result<int> t;
|
Result<int> t;
|
||||||
@ -507,7 +514,8 @@ std::string CmdProxy::ClockFrequency(int action) {
|
|||||||
} else {
|
} else {
|
||||||
defs::detectorType type = det->getDetectorType().squash(defs::GENERIC);
|
defs::detectorType type = det->getDetectorType().squash(defs::GENERIC);
|
||||||
if (type != defs::GOTTHARD2 && type != defs::MYTHEN3) {
|
if (type != defs::GOTTHARD2 && type != defs::MYTHEN3) {
|
||||||
throw sls::RuntimeError("clkfreq not implemented for this detector.");
|
throw sls::RuntimeError(
|
||||||
|
"clkfreq not implemented for this detector.");
|
||||||
}
|
}
|
||||||
if (action == defs::GET_ACTION) {
|
if (action == defs::GET_ACTION) {
|
||||||
if (args.size() != 1) {
|
if (args.size() != 1) {
|
||||||
@ -519,8 +527,8 @@ std::string CmdProxy::ClockFrequency(int action) {
|
|||||||
if (args.size() != 2) {
|
if (args.size() != 2) {
|
||||||
WrongNumberOfParameters(2);
|
WrongNumberOfParameters(2);
|
||||||
}
|
}
|
||||||
det->setClockFrequency(StringTo<int>(args[0]), StringTo<int>(args[1]),
|
det->setClockFrequency(StringTo<int>(args[0]),
|
||||||
{det_id});
|
StringTo<int>(args[1]), {det_id});
|
||||||
os << StringTo<int>(args[1]) << '\n';
|
os << StringTo<int>(args[1]) << '\n';
|
||||||
} else {
|
} else {
|
||||||
throw sls::RuntimeError("Unknown action");
|
throw sls::RuntimeError("Unknown action");
|
||||||
@ -541,7 +549,8 @@ std::string CmdProxy::ClockPhase(int action) {
|
|||||||
} else {
|
} else {
|
||||||
defs::detectorType type = det->getDetectorType().squash(defs::GENERIC);
|
defs::detectorType type = det->getDetectorType().squash(defs::GENERIC);
|
||||||
if (type != defs::GOTTHARD2 && type != defs::MYTHEN3) {
|
if (type != defs::GOTTHARD2 && type != defs::MYTHEN3) {
|
||||||
throw sls::RuntimeError("clkphase not implemented for this detector.");
|
throw sls::RuntimeError(
|
||||||
|
"clkphase not implemented for this detector.");
|
||||||
}
|
}
|
||||||
if (action == defs::GET_ACTION) {
|
if (action == defs::GET_ACTION) {
|
||||||
if (args.size() == 1) {
|
if (args.size() == 1) {
|
||||||
@ -552,16 +561,16 @@ std::string CmdProxy::ClockPhase(int action) {
|
|||||||
throw sls::RuntimeError("Cannot scan argument" + args[1] +
|
throw sls::RuntimeError("Cannot scan argument" + args[1] +
|
||||||
". Did you mean deg?");
|
". Did you mean deg?");
|
||||||
}
|
}
|
||||||
auto t =
|
auto t = det->getClockPhaseinDegrees(StringTo<int>(args[0]),
|
||||||
det->getClockPhaseinDegrees(StringTo<int>(args[0]), {det_id});
|
{det_id});
|
||||||
os << OutString(t) << " deg\n";
|
os << OutString(t) << " deg\n";
|
||||||
} else {
|
} else {
|
||||||
WrongNumberOfParameters(1);
|
WrongNumberOfParameters(1);
|
||||||
}
|
}
|
||||||
} else if (action == defs::PUT_ACTION) {
|
} else if (action == defs::PUT_ACTION) {
|
||||||
if (args.size() == 2) {
|
if (args.size() == 2) {
|
||||||
det->setClockPhase(StringTo<int>(args[0]), StringTo<int>(args[1]),
|
det->setClockPhase(StringTo<int>(args[0]),
|
||||||
{det_id});
|
StringTo<int>(args[1]), {det_id});
|
||||||
os << args[1] << '\n';
|
os << args[1] << '\n';
|
||||||
} else if (args.size() == 3) {
|
} else if (args.size() == 3) {
|
||||||
if (args[2] != "deg") {
|
if (args[2] != "deg") {
|
||||||
@ -591,13 +600,15 @@ std::string CmdProxy::MaxClockPhaseShift(int action) {
|
|||||||
} else {
|
} else {
|
||||||
defs::detectorType type = det->getDetectorType().squash(defs::GENERIC);
|
defs::detectorType type = det->getDetectorType().squash(defs::GENERIC);
|
||||||
if (type != defs::GOTTHARD2 && type != defs::MYTHEN3) {
|
if (type != defs::GOTTHARD2 && type != defs::MYTHEN3) {
|
||||||
throw sls::RuntimeError("maxclkphaseshift not implemented for this detector.");
|
throw sls::RuntimeError(
|
||||||
|
"maxclkphaseshift not implemented for this detector.");
|
||||||
}
|
}
|
||||||
if (action == defs::GET_ACTION) {
|
if (action == defs::GET_ACTION) {
|
||||||
if (args.size() != 1) {
|
if (args.size() != 1) {
|
||||||
WrongNumberOfParameters(1);
|
WrongNumberOfParameters(1);
|
||||||
}
|
}
|
||||||
auto t = det->getMaxClockPhaseShift(StringTo<int>(args[0]), {det_id});
|
auto t =
|
||||||
|
det->getMaxClockPhaseShift(StringTo<int>(args[0]), {det_id});
|
||||||
os << OutString(t) << '\n';
|
os << OutString(t) << '\n';
|
||||||
} else if (action == defs::PUT_ACTION) {
|
} else if (action == defs::PUT_ACTION) {
|
||||||
throw sls::RuntimeError("Cannot put");
|
throw sls::RuntimeError("Cannot put");
|
||||||
@ -618,7 +629,8 @@ std::string CmdProxy::ClockDivider(int action) {
|
|||||||
} else {
|
} else {
|
||||||
defs::detectorType type = det->getDetectorType().squash(defs::GENERIC);
|
defs::detectorType type = det->getDetectorType().squash(defs::GENERIC);
|
||||||
if (type != defs::GOTTHARD2 && type != defs::MYTHEN3) {
|
if (type != defs::GOTTHARD2 && type != defs::MYTHEN3) {
|
||||||
throw sls::RuntimeError("clkdiv not implemented for this detector.");
|
throw sls::RuntimeError(
|
||||||
|
"clkdiv not implemented for this detector.");
|
||||||
}
|
}
|
||||||
if (action == defs::GET_ACTION) {
|
if (action == defs::GET_ACTION) {
|
||||||
if (args.size() != 1) {
|
if (args.size() != 1) {
|
||||||
@ -649,8 +661,11 @@ std::string CmdProxy::Dac(int action) {
|
|||||||
os << "[dac index] [dac or mv value] [(optional unit) mv] "
|
os << "[dac index] [dac or mv value] [(optional unit) mv] "
|
||||||
"\n\t[Ctb] Dac."
|
"\n\t[Ctb] Dac."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (det->getDetectorType().squash(defs::GENERIC) != defs::CHIPTESTBOARD) {
|
} else if (det->getDetectorType().squash(defs::GENERIC) !=
|
||||||
throw sls::RuntimeError("Dac command can only be used for chip test board. Use daclist to get list of dac commands for current detector.");
|
defs::CHIPTESTBOARD) {
|
||||||
|
throw sls::RuntimeError(
|
||||||
|
"Dac command can only be used for chip test board. Use daclist to "
|
||||||
|
"get list of dac commands for current detector.");
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
bool mv = false;
|
bool mv = false;
|
||||||
if (args.size() == 2) {
|
if (args.size() == 2) {
|
||||||
@ -662,8 +677,8 @@ std::string CmdProxy::Dac(int action) {
|
|||||||
} else if (args.size() > 2) {
|
} else if (args.size() > 2) {
|
||||||
WrongNumberOfParameters(1);
|
WrongNumberOfParameters(1);
|
||||||
}
|
}
|
||||||
auto t = det->getDAC(static_cast<defs::dacIndex>(StringTo<int>(args[0])),
|
auto t = det->getDAC(
|
||||||
mv, {det_id});
|
static_cast<defs::dacIndex>(StringTo<int>(args[0])), mv, {det_id});
|
||||||
os << args[0] << ' ' << OutString(t)
|
os << args[0] << ' ' << OutString(t)
|
||||||
<< (args.size() > 1 ? " mv\n" : "\n");
|
<< (args.size() > 1 ? " mv\n" : "\n");
|
||||||
} else if (action == defs::PUT_ACTION) {
|
} else if (action == defs::PUT_ACTION) {
|
||||||
@ -790,8 +805,7 @@ std::string CmdProxy::ReceiverStatus(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "running, idle]\n\tReceiver listener status."
|
os << "running, idle]\n\tReceiver listener status." << '\n';
|
||||||
<< '\n';
|
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
if (args.size() != 0) {
|
if (args.size() != 0) {
|
||||||
WrongNumberOfParameters(0);
|
WrongNumberOfParameters(0);
|
||||||
@ -799,7 +813,8 @@ std::string CmdProxy::ReceiverStatus(int action) {
|
|||||||
auto t = det->getReceiverStatus({det_id});
|
auto t = det->getReceiverStatus({det_id});
|
||||||
os << OutString(t) << '\n';
|
os << OutString(t) << '\n';
|
||||||
} else if (action == defs::PUT_ACTION) {
|
} else if (action == defs::PUT_ACTION) {
|
||||||
throw sls::RuntimeError("Cannot put. Did you mean to use command 'rx_start' or 'rx_stop'?");
|
throw sls::RuntimeError(
|
||||||
|
"Cannot put. Did you mean to use command 'rx_start' or 'rx_stop'?");
|
||||||
} else {
|
} else {
|
||||||
throw sls::RuntimeError("Unknown action");
|
throw sls::RuntimeError("Unknown action");
|
||||||
}
|
}
|
||||||
@ -810,7 +825,8 @@ std::string CmdProxy::DetectorStatus(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[running, error, transmitting, finished, waiting, idle]\n\tDetector status."
|
os << "[running, error, transmitting, finished, waiting, "
|
||||||
|
"idle]\n\tDetector status."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
if (args.size() != 0) {
|
if (args.size() != 0) {
|
||||||
@ -819,7 +835,8 @@ std::string CmdProxy::DetectorStatus(int action) {
|
|||||||
auto t = det->getDetectorStatus({det_id});
|
auto t = det->getDetectorStatus({det_id});
|
||||||
os << OutString(t) << '\n';
|
os << OutString(t) << '\n';
|
||||||
} else if (action == defs::PUT_ACTION) {
|
} else if (action == defs::PUT_ACTION) {
|
||||||
throw sls::RuntimeError("Cannot put. Did you mean to use command 'start' or 'stop'?");
|
throw sls::RuntimeError(
|
||||||
|
"Cannot put. Did you mean to use command 'start' or 'stop'?");
|
||||||
} else {
|
} else {
|
||||||
throw sls::RuntimeError("Unknown action");
|
throw sls::RuntimeError("Unknown action");
|
||||||
}
|
}
|
||||||
@ -832,7 +849,9 @@ std::string CmdProxy::UDPDestinationIP(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[x.x.x.x] or auto\n\tIp address of the receiver (destination) udp interface. If 'auto' used, then ip is set to ip of rx_hostname."
|
os << "[x.x.x.x] or auto\n\tIp address of the receiver (destination) "
|
||||||
|
"udp interface. If 'auto' used, then ip is set to ip of "
|
||||||
|
"rx_hostname."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
auto t = det->getDestinationUDPIP({det_id});
|
auto t = det->getDestinationUDPIP({det_id});
|
||||||
@ -845,14 +864,15 @@ std::string CmdProxy::UDPDestinationIP(int action) {
|
|||||||
WrongNumberOfParameters(1);
|
WrongNumberOfParameters(1);
|
||||||
}
|
}
|
||||||
if (args[0] == "auto") {
|
if (args[0] == "auto") {
|
||||||
std::string rxHostname = det->getRxHostname({det_id}).squash("none");
|
std::string rxHostname =
|
||||||
|
det->getRxHostname({det_id}).squash("none");
|
||||||
// Hostname could be ip try to decode otherwise look up the hostname
|
// Hostname could be ip try to decode otherwise look up the hostname
|
||||||
auto val = sls::IpAddr{rxHostname};
|
auto val = sls::IpAddr{rxHostname};
|
||||||
if (val == 0) {
|
if (val == 0) {
|
||||||
val = HostnameToIp(rxHostname.c_str());
|
val = HostnameToIp(rxHostname.c_str());
|
||||||
}
|
}
|
||||||
LOG(logINFO) << "Setting udp_dstip of detector " <<
|
LOG(logINFO) << "Setting udp_dstip of detector " << det_id << " to "
|
||||||
det_id << " to " << val;
|
<< val;
|
||||||
det->setDestinationUDPIP(val, {det_id});
|
det->setDestinationUDPIP(val, {det_id});
|
||||||
os << val << '\n';
|
os << val << '\n';
|
||||||
} else {
|
} else {
|
||||||
@ -870,7 +890,10 @@ std::string CmdProxy::UDPDestinationIP2(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[x.x.x.x] or auto\n\t[Jungfrau] Ip address of the receiver (destination) udp interface where the second half of detector data is sent to. If 'auto' used, then ip is set to ip of rx_hostname."
|
os << "[x.x.x.x] or auto\n\t[Jungfrau] Ip address of the receiver "
|
||||||
|
"(destination) udp interface where the second half of detector "
|
||||||
|
"data is sent to. If 'auto' used, then ip is set to ip of "
|
||||||
|
"rx_hostname."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
auto t = det->getDestinationUDPIP2({det_id});
|
auto t = det->getDestinationUDPIP2({det_id});
|
||||||
@ -883,14 +906,15 @@ std::string CmdProxy::UDPDestinationIP2(int action) {
|
|||||||
WrongNumberOfParameters(1);
|
WrongNumberOfParameters(1);
|
||||||
}
|
}
|
||||||
if (args[0] == "auto") {
|
if (args[0] == "auto") {
|
||||||
std::string rxHostname = det->getRxHostname({det_id}).squash("none");
|
std::string rxHostname =
|
||||||
|
det->getRxHostname({det_id}).squash("none");
|
||||||
// Hostname could be ip try to decode otherwise look up the hostname
|
// Hostname could be ip try to decode otherwise look up the hostname
|
||||||
auto val = sls::IpAddr{rxHostname};
|
auto val = sls::IpAddr{rxHostname};
|
||||||
if (val == 0) {
|
if (val == 0) {
|
||||||
val = HostnameToIp(rxHostname.c_str());
|
val = HostnameToIp(rxHostname.c_str());
|
||||||
}
|
}
|
||||||
LOG(logINFO) << "Setting udp_dstip2 of detector " <<
|
LOG(logINFO) << "Setting udp_dstip2 of detector " << det_id
|
||||||
det_id << " to " << val;
|
<< " to " << val;
|
||||||
det->setDestinationUDPIP2(val, {det_id});
|
det->setDestinationUDPIP2(val, {det_id});
|
||||||
os << val << '\n';
|
os << val << '\n';
|
||||||
} else {
|
} else {
|
||||||
@ -912,9 +936,11 @@ std::string CmdProxy::ReceiveHostname(int action) {
|
|||||||
os << "[hostname or ip address]\n\t"
|
os << "[hostname or ip address]\n\t"
|
||||||
"[hostname or ip address]:[tcp port]\n\t"
|
"[hostname or ip address]:[tcp port]\n\t"
|
||||||
"[hostname1]:[tcp_port1]+[hostname2]:[tcp_port2]+\n\t"
|
"[hostname1]:[tcp_port1]+[hostname2]:[tcp_port2]+\n\t"
|
||||||
"Receiver hostname or IP. If port included, then the receiver tcp port.\n\t"
|
"Receiver hostname or IP. If port included, then the receiver "
|
||||||
|
"tcp port.\n\t"
|
||||||
"Used for TCP control communication between client and receiver "
|
"Used for TCP control communication between client and receiver "
|
||||||
"to configure receiver. Also updates receiver with detector parameters."
|
"to configure receiver. Also updates receiver with detector "
|
||||||
|
"parameters."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
if (!args.empty()) {
|
if (!args.empty()) {
|
||||||
@ -930,10 +956,12 @@ std::string CmdProxy::ReceiveHostname(int action) {
|
|||||||
if (args.size() > 1) {
|
if (args.size() > 1) {
|
||||||
// multiple in mulitple
|
// multiple in mulitple
|
||||||
if (args[0].find('+') != std::string::npos) {
|
if (args[0].find('+') != std::string::npos) {
|
||||||
throw sls::RuntimeError("Cannot add multiple receivers at module level");
|
throw sls::RuntimeError(
|
||||||
|
"Cannot add multiple receivers at module level");
|
||||||
}
|
}
|
||||||
if (det_id != -1) {
|
if (det_id != -1) {
|
||||||
throw sls::RuntimeError("Cannot add multiple receivers at module level");
|
throw sls::RuntimeError(
|
||||||
|
"Cannot add multiple receivers at module level");
|
||||||
}
|
}
|
||||||
det->setRxHostname(args);
|
det->setRxHostname(args);
|
||||||
os << ToString(args) << '\n';
|
os << ToString(args) << '\n';
|
||||||
@ -943,7 +971,8 @@ std::string CmdProxy::ReceiveHostname(int action) {
|
|||||||
// multiple receivers concatenated with +
|
// multiple receivers concatenated with +
|
||||||
if (args[0].find('+') != std::string::npos) {
|
if (args[0].find('+') != std::string::npos) {
|
||||||
if (det_id != -1) {
|
if (det_id != -1) {
|
||||||
throw sls::RuntimeError("Cannot add multiple receivers at module level");
|
throw sls::RuntimeError(
|
||||||
|
"Cannot add multiple receivers at module level");
|
||||||
}
|
}
|
||||||
auto t = sls::split(args[0], '+');
|
auto t = sls::split(args[0], '+');
|
||||||
det->setRxHostname(t);
|
det->setRxHostname(t);
|
||||||
@ -997,8 +1026,10 @@ std::string CmdProxy::Threshold(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[eV] [(optinal settings) standard, lowgain, veryhighgain, verylowgain]"
|
os << "[eV] [(optinal settings) standard, lowgain, veryhighgain, "
|
||||||
"\n\t[Eiger] Threshold in eV" << '\n';
|
"verylowgain]"
|
||||||
|
"\n\t[Eiger] Threshold in eV"
|
||||||
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
if (!args.empty()) {
|
if (!args.empty()) {
|
||||||
WrongNumberOfParameters(0);
|
WrongNumberOfParameters(0);
|
||||||
@ -1029,7 +1060,8 @@ std::string CmdProxy::ThresholdNoTb(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[eV] [(optional settings) standard, lowgain, veryhighgain, verylowgain]"
|
os << "[eV] [(optional settings) standard, lowgain, veryhighgain, "
|
||||||
|
"verylowgain]"
|
||||||
"\n\t[Eiger] Threshold in eV set without setting trimbits"
|
"\n\t[Eiger] Threshold in eV set without setting trimbits"
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
@ -1058,12 +1090,12 @@ std::string CmdProxy::GapPixels(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[0, 1]\n\t[Eiger][Jungfrau] Include Gap pixels only in data call back."
|
os << "[0, 1]\n\t[Eiger][Jungfrau] Include Gap pixels only in data "
|
||||||
|
"call back."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
if (det_id != -1) {
|
if (det_id != -1) {
|
||||||
throw sls::RuntimeError(
|
throw sls::RuntimeError("Cannot get gap pixels at module level");
|
||||||
"Cannot get gap pixels at module level");
|
|
||||||
}
|
}
|
||||||
if (!args.empty()) {
|
if (!args.empty()) {
|
||||||
WrongNumberOfParameters(0);
|
WrongNumberOfParameters(0);
|
||||||
@ -1072,8 +1104,7 @@ std::string CmdProxy::GapPixels(int action) {
|
|||||||
os << t << '\n';
|
os << t << '\n';
|
||||||
} else if (action == defs::PUT_ACTION) {
|
} else if (action == defs::PUT_ACTION) {
|
||||||
if (det_id != -1) {
|
if (det_id != -1) {
|
||||||
throw sls::RuntimeError(
|
throw sls::RuntimeError("Cannot add gap pixels at module level");
|
||||||
"Cannot add gap pixels at module level");
|
|
||||||
}
|
}
|
||||||
if (args.size() != 1) {
|
if (args.size() != 1) {
|
||||||
WrongNumberOfParameters(1);
|
WrongNumberOfParameters(1);
|
||||||
@ -1283,8 +1314,7 @@ std::string CmdProxy::Quad(int action) {
|
|||||||
os << OutString(t) << '\n';
|
os << OutString(t) << '\n';
|
||||||
} else if (action == defs::PUT_ACTION) {
|
} else if (action == defs::PUT_ACTION) {
|
||||||
if (det_id != -1) {
|
if (det_id != -1) {
|
||||||
throw sls::RuntimeError(
|
throw sls::RuntimeError("Cannot execute quad at module level");
|
||||||
"Cannot execute quad at module level");
|
|
||||||
}
|
}
|
||||||
if (args.size() != 1) {
|
if (args.size() != 1) {
|
||||||
WrongNumberOfParameters(1);
|
WrongNumberOfParameters(1);
|
||||||
@ -1410,7 +1440,8 @@ std::string CmdProxy::InjectChannel(int action) {
|
|||||||
if (args.size() != 2) {
|
if (args.size() != 2) {
|
||||||
WrongNumberOfParameters(2);
|
WrongNumberOfParameters(2);
|
||||||
}
|
}
|
||||||
det->setInjectChannel(StringTo<int>(args[0]), StringTo<int>(args[1]), {det_id});
|
det->setInjectChannel(StringTo<int>(args[0]), StringTo<int>(args[1]),
|
||||||
|
{det_id});
|
||||||
os << sls::ToString(args) << '\n';
|
os << sls::ToString(args) << '\n';
|
||||||
} else {
|
} else {
|
||||||
throw sls::RuntimeError("Unknown action");
|
throw sls::RuntimeError("Unknown action");
|
||||||
@ -1459,7 +1490,8 @@ std::string CmdProxy::VetoReference(int action) {
|
|||||||
if (args.size() != 2) {
|
if (args.size() != 2) {
|
||||||
WrongNumberOfParameters(2);
|
WrongNumberOfParameters(2);
|
||||||
}
|
}
|
||||||
det->setVetoReference(StringTo<int>(args[0]), StringTo<int>(args[1]), {det_id});
|
det->setVetoReference(StringTo<int>(args[0]), StringTo<int>(args[1]),
|
||||||
|
{det_id});
|
||||||
os << sls::ToString(args) << '\n';
|
os << sls::ToString(args) << '\n';
|
||||||
} else {
|
} else {
|
||||||
throw sls::RuntimeError("Unknown action");
|
throw sls::RuntimeError("Unknown action");
|
||||||
@ -1471,7 +1503,8 @@ std::string CmdProxy::BurstMode(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[off or 0, internal or 1, external or 2]\n\t[Gotthard2] Default is burst internal type"
|
os << "[off or 0, internal or 1, external or 2]\n\t[Gotthard2] Default "
|
||||||
|
"is burst internal type"
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else {
|
} else {
|
||||||
if (action == defs::GET_ACTION) {
|
if (action == defs::GET_ACTION) {
|
||||||
@ -1691,7 +1724,8 @@ std::string CmdProxy::DigitalIODelay(int action) {
|
|||||||
if (args.size() != 2) {
|
if (args.size() != 2) {
|
||||||
WrongNumberOfParameters(2);
|
WrongNumberOfParameters(2);
|
||||||
}
|
}
|
||||||
det->setDigitalIODelay(StringTo<uint64_t>(args[0]), StringTo<int>(args[1]), {det_id});
|
det->setDigitalIODelay(StringTo<uint64_t>(args[0]),
|
||||||
|
StringTo<int>(args[1]), {det_id});
|
||||||
os << sls::ToString(args) << '\n';
|
os << sls::ToString(args) << '\n';
|
||||||
} else {
|
} else {
|
||||||
throw sls::RuntimeError("Unknown action");
|
throw sls::RuntimeError("Unknown action");
|
||||||
@ -1705,7 +1739,8 @@ std::string CmdProxy::Pattern(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[fname]\n\t[Mythen3][Moench][Ctb][Moench] Loads binary pattern file with only pattern "
|
os << "[fname]\n\t[Mythen3][Moench][Ctb][Moench] Loads binary pattern "
|
||||||
|
"file with only pattern "
|
||||||
"words"
|
"words"
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
@ -1726,7 +1761,8 @@ std::string CmdProxy::PatternWord(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[step or address] [64 bit mask]\n\t[Ctb][Moench][Mythen3] 64 bit pattern at "
|
os << "[step or address] [64 bit mask]\n\t[Ctb][Moench][Mythen3] 64 "
|
||||||
|
"bit pattern at "
|
||||||
"address of pattern memory."
|
"address of pattern memory."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
@ -1739,7 +1775,8 @@ std::string CmdProxy::PatternWord(int action) {
|
|||||||
if (args.size() != 2) {
|
if (args.size() != 2) {
|
||||||
WrongNumberOfParameters(2);
|
WrongNumberOfParameters(2);
|
||||||
}
|
}
|
||||||
det->setPatternWord(StringTo<int>(args[0]), StringTo<uint64_t>(args[1]), {det_id});
|
det->setPatternWord(StringTo<int>(args[0]), StringTo<uint64_t>(args[1]),
|
||||||
|
{det_id});
|
||||||
os << sls::ToString(args) << '\n';
|
os << sls::ToString(args) << '\n';
|
||||||
} else {
|
} else {
|
||||||
throw sls::RuntimeError("Unknown action");
|
throw sls::RuntimeError("Unknown action");
|
||||||
@ -1752,17 +1789,21 @@ std::string CmdProxy::PatternLoopAddresses(int action) {
|
|||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
if (cmd == "patlimits") {
|
if (cmd == "patlimits") {
|
||||||
os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits of complete "
|
os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits "
|
||||||
|
"of complete "
|
||||||
"pattern."
|
"pattern."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (cmd == "patloop0") {
|
} else if (cmd == "patloop0") {
|
||||||
os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits of loop 0."
|
os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits "
|
||||||
|
"of loop 0."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (cmd == "patloop1") {
|
} else if (cmd == "patloop1") {
|
||||||
os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits of loop 1."
|
os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits "
|
||||||
|
"of loop 1."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (cmd == "patloop2") {
|
} else if (cmd == "patloop2") {
|
||||||
os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits of loop 2."
|
os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits "
|
||||||
|
"of loop 2."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else {
|
} else {
|
||||||
throw sls::RuntimeError(
|
throw sls::RuntimeError(
|
||||||
@ -1807,11 +1848,17 @@ std::string CmdProxy::PatternLoopCycles(int action) {
|
|||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
if (cmd == "patnloop0") {
|
if (cmd == "patnloop0") {
|
||||||
os << "[n_cycles] \n\t[Ctb][Moench][Mythen3] Number of cycles of loop 0." << '\n';
|
os << "[n_cycles] \n\t[Ctb][Moench][Mythen3] Number of cycles of "
|
||||||
|
"loop 0."
|
||||||
|
<< '\n';
|
||||||
} else if (cmd == "patnloop1") {
|
} else if (cmd == "patnloop1") {
|
||||||
os << "[n_cycles] \n\t[Ctb][Moench][Mythen3] Number of cycles of loop 1." << '\n';
|
os << "[n_cycles] \n\t[Ctb][Moench][Mythen3] Number of cycles of "
|
||||||
|
"loop 1."
|
||||||
|
<< '\n';
|
||||||
} else if (cmd == "patnloop2") {
|
} else if (cmd == "patnloop2") {
|
||||||
os << "[n_cycles] \n\t[Ctb][Moench][Mythen3] Number of cycles of loop 2." << '\n';
|
os << "[n_cycles] \n\t[Ctb][Moench][Mythen3] Number of cycles of "
|
||||||
|
"loop 2."
|
||||||
|
<< '\n';
|
||||||
} else {
|
} else {
|
||||||
throw sls::RuntimeError(
|
throw sls::RuntimeError(
|
||||||
"Unknown command, use list to list all commands");
|
"Unknown command, use list to list all commands");
|
||||||
@ -1897,11 +1944,17 @@ std::string CmdProxy::PatternWaitTime(int action) {
|
|||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
if (cmd == "patwaittime0") {
|
if (cmd == "patwaittime0") {
|
||||||
os << "[n_clk] \n\t[Ctb][Moench][Mythen3] Wait 0 time in clock cycles." << '\n';
|
os << "[n_clk] \n\t[Ctb][Moench][Mythen3] Wait 0 time in clock "
|
||||||
|
"cycles."
|
||||||
|
<< '\n';
|
||||||
} else if (cmd == "patwaittime1") {
|
} else if (cmd == "patwaittime1") {
|
||||||
os << "[n_clk] \n\t[Ctb][Moench][Mythen3] Wait 1 time in clock cycles." << '\n';
|
os << "[n_clk] \n\t[Ctb][Moench][Mythen3] Wait 1 time in clock "
|
||||||
|
"cycles."
|
||||||
|
<< '\n';
|
||||||
} else if (cmd == "patwaittime2") {
|
} else if (cmd == "patwaittime2") {
|
||||||
os << "[n_clk] \n\t[Ctb][Moench][Mythen3] Wait 2 time in clock cycles." << '\n';
|
os << "[n_clk] \n\t[Ctb][Moench][Mythen3] Wait 2 time in clock "
|
||||||
|
"cycles."
|
||||||
|
<< '\n';
|
||||||
} else {
|
} else {
|
||||||
throw sls::RuntimeError(
|
throw sls::RuntimeError(
|
||||||
"Unknown command, use list to list all commands");
|
"Unknown command, use list to list all commands");
|
||||||
@ -1928,7 +1981,8 @@ std::string CmdProxy::PatternWaitTime(int action) {
|
|||||||
if (args.size() != 1) {
|
if (args.size() != 1) {
|
||||||
WrongNumberOfParameters(1);
|
WrongNumberOfParameters(1);
|
||||||
}
|
}
|
||||||
det->setPatternWaitTime(level, StringTo<uint64_t>(args[0]), {det_id});
|
det->setPatternWaitTime(level, StringTo<uint64_t>(args[0]),
|
||||||
|
{det_id});
|
||||||
os << args.front() << '\n';
|
os << args.front() << '\n';
|
||||||
} else {
|
} else {
|
||||||
throw sls::RuntimeError("Unknown action");
|
throw sls::RuntimeError("Unknown action");
|
||||||
@ -1944,8 +1998,10 @@ std::string CmdProxy::AdditionalJsonHeader(int action) {
|
|||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[key1] [value1] [key2] [value2]...[keyn] [valuen]"
|
os << "[key1] [value1] [key2] [value2]...[keyn] [valuen]"
|
||||||
"\n\tAdditional json header to be streamed out from receiver via zmq. "
|
"\n\tAdditional json header to be streamed out from receiver via "
|
||||||
"Default is empty. Use only if to be processed by an intermediate user process "
|
"zmq. "
|
||||||
|
"Default is empty. Use only if to be processed by an "
|
||||||
|
"intermediate user process "
|
||||||
"listening to receiver zmq packets. Empty value deletes header. "
|
"listening to receiver zmq packets. Empty value deletes header. "
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
@ -1978,7 +2034,8 @@ std::string CmdProxy::JsonParameter(int action) {
|
|||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[key1] [value1]\n\tAdditional json header parameter streamed "
|
os << "[key1] [value1]\n\tAdditional json header parameter streamed "
|
||||||
"out from receiver. If not found in header, the pair is appended. "
|
"out from receiver. If not found in header, the pair is "
|
||||||
|
"appended. "
|
||||||
"An empty values deletes parameter."
|
"An empty values deletes parameter."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
@ -2061,9 +2118,9 @@ std::string CmdProxy::ProgramFpga(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[fname.pof | fname.rbf]\n\t[Jungfrau][Ctb][Moench] Programs FPGA from pof file."
|
os << "[fname.pof | fname.rbf]\n\t[Jungfrau][Ctb][Moench] Programs "
|
||||||
<< "\n\t[Mythen3][Gotthard2] Programs FPGA from rbf file."
|
"FPGA from pof file."
|
||||||
<< '\n';
|
<< "\n\t[Mythen3][Gotthard2] Programs FPGA from rbf file." << '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
throw sls::RuntimeError("Cannot get");
|
throw sls::RuntimeError("Cannot get");
|
||||||
} else if (action == defs::PUT_ACTION) {
|
} else if (action == defs::PUT_ACTION) {
|
||||||
@ -2082,7 +2139,8 @@ std::string CmdProxy::CopyDetectorServer(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[server_name] [pc_host_name]\n\t[Jungfrau][Ctb][Moench] Copies detector "
|
os << "[server_name] [pc_host_name]\n\t[Jungfrau][Ctb][Moench] Copies "
|
||||||
|
"detector "
|
||||||
"server via tftp from pc and changes respawn server name in "
|
"server via tftp from pc and changes respawn server name in "
|
||||||
"/etc/inittab of detector."
|
"/etc/inittab of detector."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
@ -2104,7 +2162,8 @@ std::string CmdProxy::UpdateFirmwareAndDetectorServer(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[server_name] [pc_host_name] [fname.pof]\n\t[Jungfrau][Ctb][Moench] "
|
os << "[server_name] [pc_host_name] "
|
||||||
|
"[fname.pof]\n\t[Jungfrau][Ctb][Moench] "
|
||||||
"Updates detector server via tftp from pc, updates firmware to "
|
"Updates detector server via tftp from pc, updates firmware to "
|
||||||
"pof file and then reboots controller (blackfin)."
|
"pof file and then reboots controller (blackfin)."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
@ -2142,7 +2201,8 @@ std::string CmdProxy::Register(int action) {
|
|||||||
if (args.size() != 2) {
|
if (args.size() != 2) {
|
||||||
WrongNumberOfParameters(2);
|
WrongNumberOfParameters(2);
|
||||||
}
|
}
|
||||||
det->writeRegister(StringTo<uint32_t>(args[0]), StringTo<uint32_t>(args[1]), {det_id});
|
det->writeRegister(StringTo<uint32_t>(args[0]),
|
||||||
|
StringTo<uint32_t>(args[1]), {det_id});
|
||||||
os << sls::ToString(args) << '\n';
|
os << sls::ToString(args) << '\n';
|
||||||
} else {
|
} else {
|
||||||
throw sls::RuntimeError("Unknown action");
|
throw sls::RuntimeError("Unknown action");
|
||||||
@ -2154,7 +2214,8 @@ std::string CmdProxy::AdcRegister(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[address] [value]\n\t[Jungfrau][Ctb][Moench][Gotthard] Writes to an adc "
|
os << "[address] [value]\n\t[Jungfrau][Ctb][Moench][Gotthard] Writes "
|
||||||
|
"to an adc "
|
||||||
"register in hex."
|
"register in hex."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
@ -2163,7 +2224,8 @@ std::string CmdProxy::AdcRegister(int action) {
|
|||||||
if (args.size() != 2) {
|
if (args.size() != 2) {
|
||||||
WrongNumberOfParameters(2);
|
WrongNumberOfParameters(2);
|
||||||
}
|
}
|
||||||
det->writeAdcRegister(StringTo<uint32_t>(args[0]), StringTo<uint32_t>(args[1]), {det_id});
|
det->writeAdcRegister(StringTo<uint32_t>(args[0]),
|
||||||
|
StringTo<uint32_t>(args[1]), {det_id});
|
||||||
os << sls::ToString(args) << '\n';
|
os << sls::ToString(args) << '\n';
|
||||||
} else {
|
} else {
|
||||||
throw sls::RuntimeError("Unknown action");
|
throw sls::RuntimeError("Unknown action");
|
||||||
@ -2236,7 +2298,10 @@ std::string CmdProxy::InitialChecks(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[0, 1]\n\tEnable or disable intial compatibility and other checks at detector start up. It is enabled by default. Must come before 'hostname' command to take effect. Can be used to reprogram fpga when current firmware is incompatible."
|
os << "[0, 1]\n\tEnable or disable intial compatibility and other "
|
||||||
|
"checks at detector start up. It is enabled by default. Must "
|
||||||
|
"come before 'hostname' command to take effect. Can be used to "
|
||||||
|
"reprogram fpga when current firmware is incompatible."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
if (det_id != -1) {
|
if (det_id != -1) {
|
||||||
@ -2264,7 +2329,6 @@ std::string CmdProxy::InitialChecks(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Insignificant */
|
/* Insignificant */
|
||||||
|
|
||||||
std::string CmdProxy::ExecuteCommand(int action) {
|
std::string CmdProxy::ExecuteCommand(int action) {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,11 +1,11 @@
|
|||||||
#include "Detector.h"
|
#include "Detector.h"
|
||||||
#include "CmdParser.h"
|
#include "CmdParser.h"
|
||||||
#include "CmdProxy.h"
|
#include "CmdProxy.h"
|
||||||
|
#include "DetectorImpl.h"
|
||||||
|
#include "Module.h"
|
||||||
#include "container_utils.h"
|
#include "container_utils.h"
|
||||||
#include "detectorData.h"
|
#include "detectorData.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "DetectorImpl.h"
|
|
||||||
#include "Module.h"
|
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
#include "versionAPI.h"
|
#include "versionAPI.h"
|
||||||
|
|
||||||
@ -72,8 +72,8 @@ void Detector::loadParameters(const std::string &fname) {
|
|||||||
if (current_line.find('#') != std::string::npos) {
|
if (current_line.find('#') != std::string::npos) {
|
||||||
current_line.erase(current_line.find('#'));
|
current_line.erase(current_line.find('#'));
|
||||||
}
|
}
|
||||||
LOG(logDEBUG1)
|
LOG(logDEBUG1) << "current_line after removing comments:\n\t"
|
||||||
<< "current_line after removing comments:\n\t" << current_line;
|
<< current_line;
|
||||||
if (current_line.length() > 1) {
|
if (current_line.length() > 1) {
|
||||||
parser.Parse(current_line);
|
parser.Parse(current_line);
|
||||||
proxy.Call(parser.command(), parser.arguments(),
|
proxy.Call(parser.command(), parser.arguments(),
|
||||||
@ -97,13 +97,9 @@ void Detector::setVirtualDetectorServers(int numServers, int startingPort) {
|
|||||||
|
|
||||||
int Detector::getShmId() const { return pimpl->getMultiId(); }
|
int Detector::getShmId() const { return pimpl->getMultiId(); }
|
||||||
|
|
||||||
std::string Detector::getPackageVersion() const {
|
std::string Detector::getPackageVersion() const { return GITBRANCH; }
|
||||||
return GITBRANCH;
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t Detector::getClientVersion() const {
|
int64_t Detector::getClientVersion() const { return APILIB; }
|
||||||
return APILIB;
|
|
||||||
}
|
|
||||||
|
|
||||||
Result<int64_t> Detector::getFirmwareVersion(Positions pos) const {
|
Result<int64_t> Detector::getFirmwareVersion(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getFirmwareVersion, pos);
|
return pimpl->Parallel(&Module::getFirmwareVersion, pos);
|
||||||
@ -242,8 +238,7 @@ void Detector::setTimingMode(defs::timingMode value, Positions pos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result<defs::speedLevel> Detector::getSpeed(Positions pos) const {
|
Result<defs::speedLevel> Detector::getSpeed(Positions pos) const {
|
||||||
auto res =
|
auto res = pimpl->Parallel(&Module::getClockDivider, pos, defs::RUN_CLOCK);
|
||||||
pimpl->Parallel(&Module::getClockDivider, pos, defs::RUN_CLOCK);
|
|
||||||
Result<defs::speedLevel> speedResult(res.size());
|
Result<defs::speedLevel> speedResult(res.size());
|
||||||
for (unsigned int i = 0; i < res.size(); ++i) {
|
for (unsigned int i = 0; i < res.size(); ++i) {
|
||||||
speedResult[i] = static_cast<defs::speedLevel>(res[i]);
|
speedResult[i] = static_cast<defs::speedLevel>(res[i]);
|
||||||
@ -257,13 +252,11 @@ void Detector::setSpeed(defs::speedLevel value, Positions pos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getADCPhase(Positions pos) const {
|
Result<int> Detector::getADCPhase(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getClockPhase, pos, defs::ADC_CLOCK,
|
return pimpl->Parallel(&Module::getClockPhase, pos, defs::ADC_CLOCK, false);
|
||||||
false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setADCPhase(int value, Positions pos) {
|
void Detector::setADCPhase(int value, Positions pos) {
|
||||||
pimpl->Parallel(&Module::setClockPhase, pos, defs::ADC_CLOCK, value,
|
pimpl->Parallel(&Module::setClockPhase, pos, defs::ADC_CLOCK, value, false);
|
||||||
false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getMaxADCPhaseShift(Positions pos) const {
|
Result<int> Detector::getMaxADCPhaseShift(Positions pos) const {
|
||||||
@ -272,13 +265,11 @@ Result<int> Detector::getMaxADCPhaseShift(Positions pos) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getADCPhaseInDegrees(Positions pos) const {
|
Result<int> Detector::getADCPhaseInDegrees(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getClockPhase, pos, defs::ADC_CLOCK,
|
return pimpl->Parallel(&Module::getClockPhase, pos, defs::ADC_CLOCK, true);
|
||||||
true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setADCPhaseInDegrees(int value, Positions pos) {
|
void Detector::setADCPhaseInDegrees(int value, Positions pos) {
|
||||||
pimpl->Parallel(&Module::setClockPhase, pos, defs::ADC_CLOCK, value,
|
pimpl->Parallel(&Module::setClockPhase, pos, defs::ADC_CLOCK, value, true);
|
||||||
true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getDBITPhase(Positions pos) const {
|
Result<int> Detector::getDBITPhase(Positions pos) const {
|
||||||
@ -297,13 +288,11 @@ Result<int> Detector::getMaxDBITPhaseShift(Positions pos) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getDBITPhaseInDegrees(Positions pos) const {
|
Result<int> Detector::getDBITPhaseInDegrees(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getClockPhase, pos, defs::DBIT_CLOCK,
|
return pimpl->Parallel(&Module::getClockPhase, pos, defs::DBIT_CLOCK, true);
|
||||||
true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setDBITPhaseInDegrees(int value, Positions pos) {
|
void Detector::setDBITPhaseInDegrees(int value, Positions pos) {
|
||||||
pimpl->Parallel(&Module::setClockPhase, pos, defs::DBIT_CLOCK, value,
|
pimpl->Parallel(&Module::setClockPhase, pos, defs::DBIT_CLOCK, value, true);
|
||||||
true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getClockFrequency(int clkIndex, Positions pos) {
|
Result<int> Detector::getClockFrequency(int clkIndex, Positions pos) {
|
||||||
@ -343,8 +332,7 @@ void Detector::setClockDivider(int clkIndex, int value, Positions pos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getHighVoltage(Positions pos) const {
|
Result<int> Detector::getHighVoltage(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::setDAC, pos, -1, defs::HIGH_VOLTAGE,
|
return pimpl->Parallel(&Module::setDAC, pos, -1, defs::HIGH_VOLTAGE, 0);
|
||||||
0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setHighVoltage(int value, Positions pos) {
|
void Detector::setHighVoltage(int value, Positions pos) {
|
||||||
@ -430,13 +418,9 @@ void Detector::acquire() { pimpl->acquire(); }
|
|||||||
|
|
||||||
void Detector::clearAcquiringFlag() { pimpl->setAcquiringFlag(0); }
|
void Detector::clearAcquiringFlag() { pimpl->setAcquiringFlag(0); }
|
||||||
|
|
||||||
void Detector::startReceiver() {
|
void Detector::startReceiver() { pimpl->Parallel(&Module::startReceiver, {}); }
|
||||||
pimpl->Parallel(&Module::startReceiver, {});
|
|
||||||
}
|
|
||||||
|
|
||||||
void Detector::stopReceiver() {
|
void Detector::stopReceiver() { pimpl->Parallel(&Module::stopReceiver, {}); }
|
||||||
pimpl->Parallel(&Module::stopReceiver, {});
|
|
||||||
}
|
|
||||||
|
|
||||||
void Detector::startDetector() {
|
void Detector::startDetector() {
|
||||||
if (getDetectorType().squash() == defs::EIGER) {
|
if (getDetectorType().squash() == defs::EIGER) {
|
||||||
@ -445,9 +429,7 @@ void Detector::startDetector() {
|
|||||||
pimpl->Parallel(&Module::startAcquisition, {});
|
pimpl->Parallel(&Module::startAcquisition, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::stopDetector() {
|
void Detector::stopDetector() { pimpl->Parallel(&Module::stopAcquisition, {}); }
|
||||||
pimpl->Parallel(&Module::stopAcquisition, {});
|
|
||||||
}
|
|
||||||
|
|
||||||
Result<defs::runStatus> Detector::getDetectorStatus(Positions pos) const {
|
Result<defs::runStatus> Detector::getDetectorStatus(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getRunStatus, pos);
|
return pimpl->Parallel(&Module::getRunStatus, pos);
|
||||||
@ -461,7 +443,8 @@ Result<int64_t> Detector::getFramesCaught(Positions pos) const {
|
|||||||
return pimpl->Parallel(&Module::getFramesCaughtByReceiver, pos);
|
return pimpl->Parallel(&Module::getFramesCaughtByReceiver, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<std::vector<uint64_t>> Detector::getNumMissingPackets(Positions pos) const {
|
Result<std::vector<uint64_t>>
|
||||||
|
Detector::getNumMissingPackets(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getNumMissingPackets, pos);
|
return pimpl->Parallel(&Module::getNumMissingPackets, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -607,8 +590,7 @@ void Detector::setDestinationUDPPort2(int port, int module_id) {
|
|||||||
port_list[idet]);
|
port_list[idet]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pimpl->Parallel(&Module::setDestinationUDPPort2, {module_id},
|
pimpl->Parallel(&Module::setDestinationUDPPort2, {module_id}, port);
|
||||||
port);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -677,9 +659,9 @@ void Detector::setRxHostname(const std::vector<std::string> &name) {
|
|||||||
pimpl->Parallel(&Module::setReceiverHostname, {}, name[0]);
|
pimpl->Parallel(&Module::setReceiverHostname, {}, name[0]);
|
||||||
} else {
|
} else {
|
||||||
if ((int)name.size() != size()) {
|
if ((int)name.size() != size()) {
|
||||||
throw RuntimeError("Receiver hostnames size " +
|
throw RuntimeError(
|
||||||
std::to_string(name.size()) + " does not match detector size " +
|
"Receiver hostnames size " + std::to_string(name.size()) +
|
||||||
std::to_string(size()));
|
" does not match detector size " + std::to_string(size()));
|
||||||
}
|
}
|
||||||
// set each rx_hostname
|
// set each rx_hostname
|
||||||
for (int idet = 0; idet < size(); ++idet) {
|
for (int idet = 0; idet < size(); ++idet) {
|
||||||
@ -699,8 +681,7 @@ void Detector::setRxPort(int port, int module_id) {
|
|||||||
it = port++;
|
it = port++;
|
||||||
}
|
}
|
||||||
for (int idet = 0; idet < size(); ++idet) {
|
for (int idet = 0; idet < size(); ++idet) {
|
||||||
pimpl->Parallel(&Module::setReceiverPort, {idet},
|
pimpl->Parallel(&Module::setReceiverPort, {idet}, port_list[idet]);
|
||||||
port_list[idet]);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pimpl->Parallel(&Module::setReceiverPort, {module_id}, port);
|
pimpl->Parallel(&Module::setReceiverPort, {module_id}, port);
|
||||||
@ -751,8 +732,7 @@ void Detector::setRxUDPSocketBufferSize(int64_t udpsockbufsize, Positions pos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result<int64_t> Detector::getRxRealUDPSocketBufferSize(Positions pos) const {
|
Result<int64_t> Detector::getRxRealUDPSocketBufferSize(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getReceiverRealUDPSocketBufferSize,
|
return pimpl->Parallel(&Module::getReceiverRealUDPSocketBufferSize, pos);
|
||||||
pos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<bool> Detector::getRxLock(Positions pos) {
|
Result<bool> Detector::getRxLock(Positions pos) {
|
||||||
@ -871,8 +851,7 @@ void Detector::setRxZmqPort(int port, int module_id) {
|
|||||||
port_list[idet]);
|
port_list[idet]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pimpl->Parallel(&Module::setReceiverStreamingPort, {module_id},
|
pimpl->Parallel(&Module::setReceiverStreamingPort, {module_id}, port);
|
||||||
port);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -901,8 +880,7 @@ void Detector::setClientZmqPort(int port, int module_id) {
|
|||||||
port_list[idet]);
|
port_list[idet]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pimpl->Parallel(&Module::setClientStreamingPort, {module_id},
|
pimpl->Parallel(&Module::setClientStreamingPort, {module_id}, port);
|
||||||
port);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -952,8 +930,8 @@ Result<int> Detector::getThresholdEnergy(Positions pos) const {
|
|||||||
void Detector::setThresholdEnergy(int threshold_ev,
|
void Detector::setThresholdEnergy(int threshold_ev,
|
||||||
defs::detectorSettings settings,
|
defs::detectorSettings settings,
|
||||||
bool trimbits, Positions pos) {
|
bool trimbits, Positions pos) {
|
||||||
pimpl->Parallel(&Module::setThresholdEnergy, pos, threshold_ev,
|
pimpl->Parallel(&Module::setThresholdEnergy, pos, threshold_ev, settings,
|
||||||
settings, static_cast<int>(trimbits));
|
static_cast<int>(trimbits));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<std::string> Detector::getSettingsPath(Positions pos) const {
|
Result<std::string> Detector::getSettingsPath(Positions pos) const {
|
||||||
@ -1146,8 +1124,7 @@ void Detector::setAutoCompDisable(bool value, Positions pos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getNumberOfAdditionalStorageCells(Positions pos) const {
|
Result<int> Detector::getNumberOfAdditionalStorageCells(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getNumberOfAdditionalStorageCells,
|
return pimpl->Parallel(&Module::getNumberOfAdditionalStorageCells, pos);
|
||||||
pos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setNumberOfAdditionalStorageCells(int value) {
|
void Detector::setNumberOfAdditionalStorageCells(int value) {
|
||||||
@ -1224,19 +1201,26 @@ Result<std::array<int, 2>> Detector::getInjectChannel(Positions pos) {
|
|||||||
return pimpl->Parallel(&Module::getInjectChannel, pos);
|
return pimpl->Parallel(&Module::getInjectChannel, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setInjectChannel(const int offsetChannel, const int incrementChannel, Positions pos) {
|
void Detector::setInjectChannel(const int offsetChannel,
|
||||||
pimpl->Parallel(&Module::setInjectChannel, pos, offsetChannel, incrementChannel);
|
const int incrementChannel, Positions pos) {
|
||||||
|
pimpl->Parallel(&Module::setInjectChannel, pos, offsetChannel,
|
||||||
|
incrementChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<std::vector<int>> Detector::getVetoPhoton(const int chipIndex, Positions pos) {
|
Result<std::vector<int>> Detector::getVetoPhoton(const int chipIndex,
|
||||||
|
Positions pos) {
|
||||||
return pimpl->Parallel(&Module::getVetoPhoton, pos, chipIndex);
|
return pimpl->Parallel(&Module::getVetoPhoton, pos, chipIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setVetoPhoton(const int chipIndex, const int numPhotons, const int energy, const std::string& fname, Positions pos) {
|
void Detector::setVetoPhoton(const int chipIndex, const int numPhotons,
|
||||||
pimpl->Parallel(&Module::setVetoPhoton, pos, chipIndex, numPhotons, energy, fname);
|
const int energy, const std::string &fname,
|
||||||
|
Positions pos) {
|
||||||
|
pimpl->Parallel(&Module::setVetoPhoton, pos, chipIndex, numPhotons, energy,
|
||||||
|
fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setVetoReference(const int gainIndex, const int value, Positions pos) {
|
void Detector::setVetoReference(const int gainIndex, const int value,
|
||||||
|
Positions pos) {
|
||||||
pimpl->Parallel(&Module::setVetoReference, pos, gainIndex, value);
|
pimpl->Parallel(&Module::setVetoReference, pos, gainIndex, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1284,10 +1268,8 @@ void Detector::setNumberOfAnalogSamples(int value, Positions pos) {
|
|||||||
pimpl->Parallel(&Module::setNumberOfAnalogSamples, pos, value);
|
pimpl->Parallel(&Module::setNumberOfAnalogSamples, pos, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Result<int> Detector::getADCClock(Positions pos) const {
|
Result<int> Detector::getADCClock(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getClockFrequency, pos,
|
return pimpl->Parallel(&Module::getClockFrequency, pos, defs::ADC_CLOCK);
|
||||||
defs::ADC_CLOCK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setADCClock(int value_in_MHz, Positions pos) {
|
void Detector::setADCClock(int value_in_MHz, Positions pos) {
|
||||||
@ -1296,8 +1278,7 @@ void Detector::setADCClock(int value_in_MHz, Positions pos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getRUNClock(Positions pos) const {
|
Result<int> Detector::getRUNClock(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getClockFrequency, pos,
|
return pimpl->Parallel(&Module::getClockFrequency, pos, defs::RUN_CLOCK);
|
||||||
defs::RUN_CLOCK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setRUNClock(int value_in_MHz, Positions pos) {
|
void Detector::setRUNClock(int value_in_MHz, Positions pos) {
|
||||||
@ -1306,8 +1287,7 @@ void Detector::setRUNClock(int value_in_MHz, Positions pos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getSYNCClock(Positions pos) const {
|
Result<int> Detector::getSYNCClock(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getClockFrequency, pos,
|
return pimpl->Parallel(&Module::getClockFrequency, pos, defs::SYNC_CLOCK);
|
||||||
defs::SYNC_CLOCK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getADCPipeline(Positions pos) const {
|
Result<int> Detector::getADCPipeline(Positions pos) const {
|
||||||
@ -1372,7 +1352,6 @@ void Detector::setTenGigaADCEnableMask(uint32_t mask, Positions pos) {
|
|||||||
|
|
||||||
// CTB Specific
|
// CTB Specific
|
||||||
|
|
||||||
|
|
||||||
Result<int> Detector::getNumberOfDigitalSamples(Positions pos) const {
|
Result<int> Detector::getNumberOfDigitalSamples(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getNumberOfDigitalSamples, pos);
|
return pimpl->Parallel(&Module::getNumberOfDigitalSamples, pos);
|
||||||
}
|
}
|
||||||
@ -1390,8 +1369,7 @@ void Detector::setReadoutMode(defs::readoutMode value, Positions pos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getDBITClock(Positions pos) const {
|
Result<int> Detector::getDBITClock(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getClockFrequency, pos,
|
return pimpl->Parallel(&Module::getClockFrequency, pos, defs::DBIT_CLOCK);
|
||||||
defs::DBIT_CLOCK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setDBITClock(int value_in_MHz, Positions pos) {
|
void Detector::setDBITClock(int value_in_MHz, Positions pos) {
|
||||||
@ -1507,22 +1485,10 @@ void Detector::savePattern(const std::string &fname) {
|
|||||||
}
|
}
|
||||||
// rest of pattern file
|
// rest of pattern file
|
||||||
const std::vector<std::string> commands{
|
const std::vector<std::string> commands{
|
||||||
"patioctrl",
|
"patioctrl", "patclkctrl", "patlimits", "patloop0",
|
||||||
"patclkctrl",
|
"patnloop0", "patloop1", "patnloop1", "patloop2",
|
||||||
"patlimits",
|
"patnloop2", "patwait0", "patwaittime0", "patwait1",
|
||||||
"patloop0",
|
"patwaittime1", "patwait2", "patwaittime2", "patmask",
|
||||||
"patnloop0",
|
|
||||||
"patloop1",
|
|
||||||
"patnloop1",
|
|
||||||
"patloop2",
|
|
||||||
"patnloop2",
|
|
||||||
"patwait0",
|
|
||||||
"patwaittime0",
|
|
||||||
"patwait1",
|
|
||||||
"patwaittime1",
|
|
||||||
"patwait2",
|
|
||||||
"patwaittime2",
|
|
||||||
"patmask",
|
|
||||||
"patsetbit",
|
"patsetbit",
|
||||||
};
|
};
|
||||||
for (const auto &cmd : commands)
|
for (const auto &cmd : commands)
|
||||||
@ -1559,14 +1525,13 @@ void Detector::setPatternWord(int addr, uint64_t word, Positions pos) {
|
|||||||
|
|
||||||
Result<std::array<int, 2>>
|
Result<std::array<int, 2>>
|
||||||
Detector::getPatternLoopAddresses(int level, Positions pos) const {
|
Detector::getPatternLoopAddresses(int level, Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::setPatternLoopAddresses, pos, level,
|
return pimpl->Parallel(&Module::setPatternLoopAddresses, pos, level, -1,
|
||||||
-1, -1);
|
-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setPatternLoopAddresses(int level, int start, int stop,
|
void Detector::setPatternLoopAddresses(int level, int start, int stop,
|
||||||
Positions pos) {
|
Positions pos) {
|
||||||
pimpl->Parallel(&Module::setPatternLoopAddresses, pos, level, start,
|
pimpl->Parallel(&Module::setPatternLoopAddresses, pos, level, start, stop);
|
||||||
stop);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getPatternLoopCycles(int level, Positions pos) const {
|
Result<int> Detector::getPatternLoopCycles(int level, Positions pos) const {
|
||||||
@ -1611,12 +1576,13 @@ void Detector::setPatternBitMask(uint64_t mask, Positions pos) {
|
|||||||
|
|
||||||
// Moench
|
// Moench
|
||||||
|
|
||||||
Result<std::map<std::string, std::string>> Detector::getAdditionalJsonHeader(Positions pos) const {
|
Result<std::map<std::string, std::string>>
|
||||||
|
Detector::getAdditionalJsonHeader(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getAdditionalJsonHeader, pos);
|
return pimpl->Parallel(&Module::getAdditionalJsonHeader, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setAdditionalJsonHeader(const std::map<std::string, std::string> &jsonHeader,
|
void Detector::setAdditionalJsonHeader(
|
||||||
Positions pos) {
|
const std::map<std::string, std::string> &jsonHeader, Positions pos) {
|
||||||
pimpl->Parallel(&Module::setAdditionalJsonHeader, pos, jsonHeader);
|
pimpl->Parallel(&Module::setAdditionalJsonHeader, pos, jsonHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1625,7 +1591,8 @@ Result<std::string> Detector::getAdditionalJsonParameter(const std::string &key,
|
|||||||
return pimpl->Parallel(&Module::getAdditionalJsonParameter, pos, key);
|
return pimpl->Parallel(&Module::getAdditionalJsonParameter, pos, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setAdditionalJsonParameter(const std::string &key, const std::string &value,
|
void Detector::setAdditionalJsonParameter(const std::string &key,
|
||||||
|
const std::string &value,
|
||||||
Positions pos) {
|
Positions pos) {
|
||||||
pimpl->Parallel(&Module::setAdditionalJsonParameter, pos, key, value);
|
pimpl->Parallel(&Module::setAdditionalJsonParameter, pos, key, value);
|
||||||
}
|
}
|
||||||
@ -1654,8 +1621,8 @@ void Detector::setDetectorMinMaxEnergyThreshold(const bool isEmax,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result<defs::frameModeType> Detector::getFrameMode(Positions pos) const {
|
Result<defs::frameModeType> Detector::getFrameMode(Positions pos) const {
|
||||||
auto res = pimpl->Parallel(&Module::getAdditionalJsonParameter, pos,
|
auto res =
|
||||||
"frameMode");
|
pimpl->Parallel(&Module::getAdditionalJsonParameter, pos, "frameMode");
|
||||||
Result<defs::frameModeType> intResult(res.size());
|
Result<defs::frameModeType> intResult(res.size());
|
||||||
try {
|
try {
|
||||||
for (unsigned int i = 0; i < res.size(); ++i) {
|
for (unsigned int i = 0; i < res.size(); ++i) {
|
||||||
@ -1691,8 +1658,8 @@ Result<defs::detectorModeType> Detector::getDetectorMode(Positions pos) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setDetectorMode(defs::detectorModeType value, Positions pos) {
|
void Detector::setDetectorMode(defs::detectorModeType value, Positions pos) {
|
||||||
pimpl->Parallel(&Module::setAdditionalJsonParameter, pos,
|
pimpl->Parallel(&Module::setAdditionalJsonParameter, pos, "detectorMode",
|
||||||
"detectorMode", sls::ToString(value));
|
sls::ToString(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Advanced
|
// Advanced
|
||||||
@ -1753,9 +1720,7 @@ void Detector::writeAdcRegister(uint32_t addr, uint32_t value, Positions pos) {
|
|||||||
pimpl->Parallel(&Module::writeAdcRegister, pos, addr, value);
|
pimpl->Parallel(&Module::writeAdcRegister, pos, addr, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Detector::getInitialChecks() const {
|
bool Detector::getInitialChecks() const { return pimpl->getInitialChecks(); }
|
||||||
return pimpl->getInitialChecks();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Detector::setInitialChecks(const bool value) {
|
void Detector::setInitialChecks(const bool value) {
|
||||||
pimpl->setInitialChecks(value);
|
pimpl->setInitialChecks(value);
|
||||||
|
95
slsDetectorSoftware/src/DetectorImpl.cpp
Executable file → Normal file
95
slsDetectorSoftware/src/DetectorImpl.cpp
Executable file → Normal file
@ -1,10 +1,10 @@
|
|||||||
#include "DetectorImpl.h"
|
#include "DetectorImpl.h"
|
||||||
|
#include "Module.h"
|
||||||
#include "SharedMemory.h"
|
#include "SharedMemory.h"
|
||||||
#include "ZmqSocket.h"
|
#include "ZmqSocket.h"
|
||||||
#include "detectorData.h"
|
#include "detectorData.h"
|
||||||
#include "file_utils.h"
|
#include "file_utils.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "Module.h"
|
|
||||||
#include "sls_detector_exceptions.h"
|
#include "sls_detector_exceptions.h"
|
||||||
#include "versionAPI.h"
|
#include "versionAPI.h"
|
||||||
|
|
||||||
@ -167,8 +167,7 @@ void DetectorImpl::initializeMembers(bool verify) {
|
|||||||
// get objects from single det shared memory (open)
|
// get objects from single det shared memory (open)
|
||||||
for (int i = 0; i < multi_shm()->numberOfDetectors; i++) {
|
for (int i = 0; i < multi_shm()->numberOfDetectors; i++) {
|
||||||
try {
|
try {
|
||||||
detectors.push_back(
|
detectors.push_back(sls::make_unique<Module>(multiId, i, verify));
|
||||||
sls::make_unique<Module>(multiId, i, verify));
|
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
detectors.clear();
|
detectors.clear();
|
||||||
throw;
|
throw;
|
||||||
@ -233,8 +232,7 @@ void DetectorImpl::setVirtualDetectorServers(const int numdet, const int port) {
|
|||||||
void DetectorImpl::setHostname(const std::vector<std::string> &name) {
|
void DetectorImpl::setHostname(const std::vector<std::string> &name) {
|
||||||
// this check is there only to allow the previous detsizechan command
|
// this check is there only to allow the previous detsizechan command
|
||||||
if (multi_shm()->numberOfDetectors != 0) {
|
if (multi_shm()->numberOfDetectors != 0) {
|
||||||
LOG(logWARNING)
|
LOG(logWARNING) << "There are already detector(s) in shared memory."
|
||||||
<< "There are already detector(s) in shared memory."
|
|
||||||
"Freeing Shared memory now.";
|
"Freeing Shared memory now.";
|
||||||
bool initialChecks = multi_shm()->initialChecks;
|
bool initialChecks = multi_shm()->initialChecks;
|
||||||
freeSharedMemory();
|
freeSharedMemory();
|
||||||
@ -273,8 +271,7 @@ void DetectorImpl::addSlsDetector(const std::string &hostname) {
|
|||||||
// get type by connecting
|
// get type by connecting
|
||||||
detectorType type = Module::getTypeFromDetector(host, port);
|
detectorType type = Module::getTypeFromDetector(host, port);
|
||||||
auto pos = detectors.size();
|
auto pos = detectors.size();
|
||||||
detectors.emplace_back(
|
detectors.emplace_back(sls::make_unique<Module>(type, multiId, pos, false));
|
||||||
sls::make_unique<Module>(type, multiId, pos, false));
|
|
||||||
multi_shm()->numberOfDetectors = detectors.size();
|
multi_shm()->numberOfDetectors = detectors.size();
|
||||||
detectors[pos]->setControlPort(port);
|
detectors[pos]->setControlPort(port);
|
||||||
detectors[pos]->setStopPort(port + 1);
|
detectors[pos]->setStopPort(port + 1);
|
||||||
@ -359,8 +356,8 @@ void DetectorImpl::setGapPixelsinCallback(const bool enable) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw RuntimeError("Gap Pixels is not implemented for "
|
throw RuntimeError("Gap Pixels is not implemented for " +
|
||||||
+ multi_shm()->multiDetectorType);
|
multi_shm()->multiDetectorType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
multi_shm()->gapPixels = enable;
|
multi_shm()->gapPixels = enable;
|
||||||
@ -386,8 +383,7 @@ int DetectorImpl::createReceivingDataSockets(const bool destroy) {
|
|||||||
if (multi_shm()->multiDetectorType == EIGER) {
|
if (multi_shm()->multiDetectorType == EIGER) {
|
||||||
numSocketsPerDetector = 2;
|
numSocketsPerDetector = 2;
|
||||||
}
|
}
|
||||||
if (Parallel(&Module::getNumberofUDPInterfacesFromShm, {}).squash() ==
|
if (Parallel(&Module::getNumberofUDPInterfacesFromShm, {}).squash() == 2) {
|
||||||
2) {
|
|
||||||
numSocketsPerDetector = 2;
|
numSocketsPerDetector = 2;
|
||||||
}
|
}
|
||||||
numSockets *= numSocketsPerDetector;
|
numSockets *= numSocketsPerDetector;
|
||||||
@ -406,8 +402,7 @@ int DetectorImpl::createReceivingDataSockets(const bool destroy) {
|
|||||||
LOG(logINFO) << "Zmq Client[" << iSocket << "] at "
|
LOG(logINFO) << "Zmq Client[" << iSocket << "] at "
|
||||||
<< zmqSocket.back()->GetZmqServerAddress();
|
<< zmqSocket.back()->GetZmqServerAddress();
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
LOG(logERROR)
|
LOG(logERROR) << "Could not create Zmq socket on port " << portnum;
|
||||||
<< "Could not create Zmq socket on port " << portnum;
|
|
||||||
createReceivingDataSockets(true);
|
createReceivingDataSockets(true);
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@ -429,8 +424,7 @@ void DetectorImpl::readFrameFromReceiver() {
|
|||||||
int nDetPixelsY = 0;
|
int nDetPixelsY = 0;
|
||||||
bool quadEnable = false;
|
bool quadEnable = false;
|
||||||
bool eiger = false;
|
bool eiger = false;
|
||||||
bool numInterfaces =
|
bool numInterfaces = Parallel(&Module::getNumberofUDPInterfacesFromShm, {})
|
||||||
Parallel(&Module::getNumberofUDPInterfacesFromShm, {})
|
|
||||||
.squash(); // cannot pick up from zmq
|
.squash(); // cannot pick up from zmq
|
||||||
|
|
||||||
bool runningList[zmqSocket.size()], connectList[zmqSocket.size()];
|
bool runningList[zmqSocket.size()], connectList[zmqSocket.size()];
|
||||||
@ -491,8 +485,8 @@ void DetectorImpl::readFrameFromReceiver() {
|
|||||||
{
|
{
|
||||||
zmqHeader zHeader;
|
zmqHeader zHeader;
|
||||||
if (zmqSocket[isocket]->ReceiveHeader(
|
if (zmqSocket[isocket]->ReceiveHeader(
|
||||||
isocket, zHeader, SLS_DETECTOR_JSON_HEADER_VERSION) ==
|
isocket, zHeader,
|
||||||
0) {
|
SLS_DETECTOR_JSON_HEADER_VERSION) == 0) {
|
||||||
// parse error, version error or end of acquisition for
|
// parse error, version error or end of acquisition for
|
||||||
// socket
|
// socket
|
||||||
runningList[isocket] = false;
|
runningList[isocket] = false;
|
||||||
@ -523,8 +517,8 @@ void DetectorImpl::readFrameFromReceiver() {
|
|||||||
// det type
|
// det type
|
||||||
eiger = (zHeader.detType == static_cast<int>(3))
|
eiger = (zHeader.detType == static_cast<int>(3))
|
||||||
? true
|
? true
|
||||||
: false; // to be changed to EIGER when firmware
|
: false; // to be changed to EIGER when
|
||||||
// updates its header data
|
// firmware updates its header data
|
||||||
quadEnable = (zHeader.quad == 0) ? false : true;
|
quadEnable = (zHeader.quad == 0) ? false : true;
|
||||||
LOG(logDEBUG1)
|
LOG(logDEBUG1)
|
||||||
<< "One Time Header Info:"
|
<< "One Time Header Info:"
|
||||||
@ -620,21 +614,21 @@ void DetectorImpl::readFrameFromReceiver() {
|
|||||||
int imagesize = multisize;
|
int imagesize = multisize;
|
||||||
|
|
||||||
if (gapPixels) {
|
if (gapPixels) {
|
||||||
int n = InsertGapPixels(multiframe, multigappixels,
|
int n = InsertGapPixels(multiframe, multigappixels, quadEnable,
|
||||||
quadEnable, dynamicRange, nDetPixelsX, nDetPixelsY);
|
dynamicRange, nDetPixelsX, nDetPixelsY);
|
||||||
image = multigappixels;
|
image = multigappixels;
|
||||||
imagesize = n;
|
imagesize = n;
|
||||||
}
|
}
|
||||||
LOG(logDEBUG)
|
LOG(logDEBUG) << "Image Info:"
|
||||||
<< "Image Info:"
|
|
||||||
<< "\n\tnDetPixelsX: " << nDetPixelsX
|
<< "\n\tnDetPixelsX: " << nDetPixelsX
|
||||||
<< "\n\tnDetPixelsY: " << nDetPixelsY
|
<< "\n\tnDetPixelsY: " << nDetPixelsY
|
||||||
<< "\n\timagesize: " << imagesize
|
<< "\n\timagesize: " << imagesize
|
||||||
<< "\n\tdynamicRange: " << dynamicRange;
|
<< "\n\tdynamicRange: " << dynamicRange;
|
||||||
|
|
||||||
thisData = new detectorData(currentProgress,
|
thisData =
|
||||||
currentFileName, nDetPixelsX, nDetPixelsY, image,
|
new detectorData(currentProgress, currentFileName, nDetPixelsX,
|
||||||
imagesize, dynamicRange, currentFileIndex, completeImage);
|
nDetPixelsY, image, imagesize, dynamicRange,
|
||||||
|
currentFileIndex, completeImage);
|
||||||
|
|
||||||
dataReady(
|
dataReady(
|
||||||
thisData, currentFrameIndex,
|
thisData, currentFrameIndex,
|
||||||
@ -680,14 +674,13 @@ void DetectorImpl::readFrameFromReceiver() {
|
|||||||
delete[] multigappixels;
|
delete[] multigappixels;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DetectorImpl::InsertGapPixels(char *image, char *&gpImage,
|
int DetectorImpl::InsertGapPixels(char *image, char *&gpImage, bool quadEnable,
|
||||||
bool quadEnable, int dr, int &nPixelsx, int &nPixelsy) {
|
int dr, int &nPixelsx, int &nPixelsy) {
|
||||||
|
|
||||||
LOG(logDEBUG) << "Insert Gap pixels:"
|
LOG(logDEBUG) << "Insert Gap pixels:"
|
||||||
<< "\n\t nPixelsx: " << nPixelsx
|
<< "\n\t nPixelsx: " << nPixelsx
|
||||||
<< "\n\t nPixelsy: " << nPixelsy
|
<< "\n\t nPixelsy: " << nPixelsy
|
||||||
<< "\n\t quadEnable: " << quadEnable
|
<< "\n\t quadEnable: " << quadEnable << "\n\t dr: " << dr;
|
||||||
<< "\n\t dr: " << dr;
|
|
||||||
|
|
||||||
// inter module gap pixels
|
// inter module gap pixels
|
||||||
int modGapPixelsx = 8;
|
int modGapPixelsx = 8;
|
||||||
@ -730,8 +723,10 @@ int DetectorImpl::InsertGapPixels(char *image, char *&gpImage,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// total number of pixels
|
// total number of pixels
|
||||||
int nTotx = nPixelsx + (nMod1GapPixelsx * nModx) + (modGapPixelsx * (nModx - 1));
|
int nTotx =
|
||||||
int nToty = nPixelsy + (nMod1GapPixelsy * nMody) + (modGapPixelsy * (nMody - 1));
|
nPixelsx + (nMod1GapPixelsx * nModx) + (modGapPixelsx * (nModx - 1));
|
||||||
|
int nToty =
|
||||||
|
nPixelsy + (nMod1GapPixelsy * nMody) + (modGapPixelsy * (nMody - 1));
|
||||||
// total number of chips
|
// total number of chips
|
||||||
int nChipx = nPixelsx / nChipPixelsx;
|
int nChipx = nPixelsx / nChipPixelsx;
|
||||||
int nChipy = nPixelsy / nChipPixelsy;
|
int nChipy = nPixelsy / nChipPixelsy;
|
||||||
@ -744,8 +739,10 @@ int DetectorImpl::InsertGapPixels(char *image, char *&gpImage,
|
|||||||
int nModGapBytesx = modGapPixelsx * bytesPerPixel; // 8 pixel bytes
|
int nModGapBytesx = modGapPixelsx * bytesPerPixel; // 8 pixel bytes
|
||||||
int nChipBytesy = nChipPixelsy * nTotx * bytesPerPixel; // 1 chip bytes in y
|
int nChipBytesy = nChipPixelsy * nTotx * bytesPerPixel; // 1 chip bytes in y
|
||||||
int nChipGapBytesy = chipGapPixelsy * nTotx * bytesPerPixel; // 2 lines
|
int nChipGapBytesy = chipGapPixelsy * nTotx * bytesPerPixel; // 2 lines
|
||||||
int nModGapBytesy = modGapPixelsy * nTotx * bytesPerPixel; // 36 lines
|
int nModGapBytesy = modGapPixelsy * nTotx *
|
||||||
// 4 bit mode, its 1 byte (because for 4 bit mode, we handle 1 byte at a time)
|
bytesPerPixel; // 36 lines
|
||||||
|
// 4 bit mode, its 1 byte (because for 4
|
||||||
|
// bit mode, we handle 1 byte at a time)
|
||||||
int pixel1 = (int)(ceil(bytesPerPixel));
|
int pixel1 = (int)(ceil(bytesPerPixel));
|
||||||
int row1Bytes = nTotx * bytesPerPixel;
|
int row1Bytes = nTotx * bytesPerPixel;
|
||||||
int nMod1TotPixelsx = nMod1Pixelsx + nMod1GapPixelsx;
|
int nMod1TotPixelsx = nMod1Pixelsx + nMod1GapPixelsx;
|
||||||
@ -759,8 +756,7 @@ int DetectorImpl::InsertGapPixels(char *image, char *&gpImage,
|
|||||||
if (detType == JUNGFRAU) {
|
if (detType == JUNGFRAU) {
|
||||||
divisionValue = 1;
|
divisionValue = 1;
|
||||||
}
|
}
|
||||||
LOG(logDEBUG)
|
LOG(logDEBUG) << "Insert Gap pixels Calculations:\n\t"
|
||||||
<< "Insert Gap pixels Calculations:\n\t"
|
|
||||||
<< "nPixelsx: " << nPixelsx << "\n\t"
|
<< "nPixelsx: " << nPixelsx << "\n\t"
|
||||||
<< "nPixelsy: " << nPixelsy << "\n\t"
|
<< "nPixelsy: " << nPixelsy << "\n\t"
|
||||||
<< "nMod1Pixelsx: " << nMod1Pixelsx << "\n\t"
|
<< "nMod1Pixelsx: " << nMod1Pixelsx << "\n\t"
|
||||||
@ -872,11 +868,13 @@ int DetectorImpl::InsertGapPixels(char *image, char *&gpImage,
|
|||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
// neighbouring gap pixels to left
|
// neighbouring gap pixels to left
|
||||||
temp16 = (*((uint16_t *)(dst - pixel1))) / divisionValue;
|
temp16 =
|
||||||
|
(*((uint16_t *)(dst - pixel1))) / divisionValue;
|
||||||
(*((uint16_t *)dst)) = temp16;
|
(*((uint16_t *)dst)) = temp16;
|
||||||
(*((uint16_t *)(dst - pixel1))) = temp16;
|
(*((uint16_t *)(dst - pixel1))) = temp16;
|
||||||
// neighbouring gap pixels to right
|
// neighbouring gap pixels to right
|
||||||
temp16 = (*((uint16_t *)(dst + 2 * pixel1))) / divisionValue;
|
temp16 =
|
||||||
|
(*((uint16_t *)(dst + 2 * pixel1))) / divisionValue;
|
||||||
(*((uint16_t *)(dst + pixel1))) = temp16;
|
(*((uint16_t *)(dst + pixel1))) = temp16;
|
||||||
(*((uint16_t *)(dst + 2 * pixel1))) = temp16;
|
(*((uint16_t *)(dst + 2 * pixel1))) = temp16;
|
||||||
break;
|
break;
|
||||||
@ -973,8 +971,6 @@ int DetectorImpl::InsertGapPixels(char *image, char *&gpImage,
|
|||||||
return imagesize;
|
return imagesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool DetectorImpl::enableDataStreamingToClient(int enable) {
|
bool DetectorImpl::enableDataStreamingToClient(int enable) {
|
||||||
if (enable >= 0) {
|
if (enable >= 0) {
|
||||||
// destroy data threads
|
// destroy data threads
|
||||||
@ -1024,8 +1020,7 @@ int DetectorImpl::acquire() {
|
|||||||
// receiver/ext process)
|
// receiver/ext process)
|
||||||
sem_init(&sem_endRTAcquisition, 1, 0);
|
sem_init(&sem_endRTAcquisition, 1, 0);
|
||||||
|
|
||||||
bool receiver =
|
bool receiver = Parallel(&Module::getUseReceiverFlag, {}).squash(false);
|
||||||
Parallel(&Module::getUseReceiverFlag, {}).squash(false);
|
|
||||||
|
|
||||||
setJoinThreadFlag(false);
|
setJoinThreadFlag(false);
|
||||||
|
|
||||||
@ -1098,12 +1093,11 @@ int DetectorImpl::acquire() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DetectorImpl::printProgress(double progress) {
|
void DetectorImpl::printProgress(double progress) {
|
||||||
std::cout << std::fixed << std::setprecision(2) << std::setw(6)
|
std::cout << std::fixed << std::setprecision(2) << std::setw(6) << progress
|
||||||
<< progress << " \%";
|
<< " \%";
|
||||||
std::cout << '\r' << std::flush;
|
std::cout << '\r' << std::flush;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DetectorImpl::startProcessingThread() {
|
void DetectorImpl::startProcessingThread() {
|
||||||
dataProcessingThread = std::thread(&DetectorImpl::processData, this);
|
dataProcessingThread = std::thread(&DetectorImpl::processData, this);
|
||||||
}
|
}
|
||||||
@ -1128,7 +1122,9 @@ void DetectorImpl::processData() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// get and print progress
|
// get and print progress
|
||||||
double temp = (double)Parallel(&Module::getReceiverProgress, {0}).squash();
|
double temp =
|
||||||
|
(double)Parallel(&Module::getReceiverProgress, {0})
|
||||||
|
.squash();
|
||||||
if (temp != progress) {
|
if (temp != progress) {
|
||||||
printProgress(progress);
|
printProgress(progress);
|
||||||
progress = temp;
|
progress = temp;
|
||||||
@ -1137,7 +1133,9 @@ void DetectorImpl::processData() {
|
|||||||
// exiting loop
|
// exiting loop
|
||||||
if (getJoinThreadFlag()) {
|
if (getJoinThreadFlag()) {
|
||||||
// print progress one final time before exiting
|
// print progress one final time before exiting
|
||||||
progress = (double)Parallel(&Module::getReceiverProgress, {0}).squash();
|
progress =
|
||||||
|
(double)Parallel(&Module::getReceiverProgress, {0})
|
||||||
|
.squash();
|
||||||
printProgress(progress);
|
printProgress(progress);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1297,8 +1295,7 @@ std::vector<char> DetectorImpl::readProgrammingFile(const std::string &fname) {
|
|||||||
"Program FPGA: Could not close destination file after converting");
|
"Program FPGA: Could not close destination file after converting");
|
||||||
}
|
}
|
||||||
unlink(destfname); // delete temporary file
|
unlink(destfname); // delete temporary file
|
||||||
LOG(logDEBUG1)
|
LOG(logDEBUG1) << "Successfully loaded the rawbin file to program memory";
|
||||||
<< "Successfully loaded the rawbin file to program memory";
|
|
||||||
LOG(logINFO) << "Read file into memory";
|
LOG(logINFO) << "Read file into memory";
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
10
slsDetectorSoftware/src/DetectorImpl.h
Executable file → Normal file
10
slsDetectorSoftware/src/DetectorImpl.h
Executable file → Normal file
@ -188,17 +188,18 @@ class DetectorImpl : public virtual slsDetectorDefs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** set acquiring flag in shared memory */
|
/** set acquiring flag in shared memory */
|
||||||
void setAcquiringFlag(bool flag);
|
void setAcquiringFlag(bool flag);
|
||||||
|
|
||||||
/** return multi detector shared memory ID */
|
/** return multi detector shared memory ID */
|
||||||
int getMultiId() const;
|
int getMultiId() const;
|
||||||
|
|
||||||
/** Free specific shared memory from the command line without creating object */
|
/** Free specific shared memory from the command line without creating
|
||||||
|
* object */
|
||||||
static void freeSharedMemory(int multiId, int detPos = -1);
|
static void freeSharedMemory(int multiId, int detPos = -1);
|
||||||
|
|
||||||
/** Free all modules from current multi Id shared memory and delete members */
|
/** Free all modules from current multi Id shared memory and delete members
|
||||||
|
*/
|
||||||
void freeSharedMemory();
|
void freeSharedMemory();
|
||||||
|
|
||||||
/** Get user details of shared memory */
|
/** Get user details of shared memory */
|
||||||
@ -217,7 +218,8 @@ class DetectorImpl : public virtual slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
void setVirtualDetectorServers(const int numdet, const int port);
|
void setVirtualDetectorServers(const int numdet, const int port);
|
||||||
|
|
||||||
/** Sets the hostname of all sls detectors in shared memory and updates local cache */
|
/** Sets the hostname of all sls detectors in shared memory and updates
|
||||||
|
* local cache */
|
||||||
void setHostname(const std::vector<std::string> &name);
|
void setHostname(const std::vector<std::string> &name);
|
||||||
|
|
||||||
/** Gets the total number of detectors */
|
/** Gets the total number of detectors */
|
||||||
|
508
slsDetectorSoftware/src/Module.cpp
Executable file → Normal file
508
slsDetectorSoftware/src/Module.cpp
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
61
slsDetectorSoftware/src/Module.h
Executable file → Normal file
61
slsDetectorSoftware/src/Module.h
Executable file → Normal file
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <vector>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
class ServerInterface;
|
class ServerInterface;
|
||||||
|
|
||||||
@ -182,7 +182,6 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
void updateNumberOfChannels();
|
void updateNumberOfChannels();
|
||||||
|
|
||||||
|
|
||||||
slsDetectorDefs::xy getNumberOfChannels() const;
|
slsDetectorDefs::xy getNumberOfChannels() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -272,11 +271,12 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
|
|
||||||
detectorSettings getSettings();
|
detectorSettings getSettings();
|
||||||
|
|
||||||
/** [Jungfrau] Options:DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2
|
/** [Jungfrau] Options:DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2,
|
||||||
* [Gotthard] Options: DYNAMICGAIN, HIGHGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN
|
* FORCESWITCHG1, FORCESWITCHG2 [Gotthard] Options: DYNAMICGAIN, HIGHGAIN,
|
||||||
* [Gotthard2] Options: DYNAMICGAIN, FIXGAIN1, FIXGAIN2
|
* LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN [Gotthard2] Options: DYNAMICGAIN,
|
||||||
* [Moench] Options: G1_HIGHGAIN, G1_LOWGAIN, G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN,
|
* FIXGAIN1, FIXGAIN2 [Moench] Options: G1_HIGHGAIN, G1_LOWGAIN,
|
||||||
* G2_LOWCAP_HIGHGAIN, G2_LOWCAP_LOWGAIN, G4_HIGHGAIN, G4_LOWGAIN
|
* G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN, G2_LOWCAP_HIGHGAIN,
|
||||||
|
* G2_LOWCAP_LOWGAIN, G4_HIGHGAIN, G4_LOWGAIN
|
||||||
*/
|
*/
|
||||||
void setSettings(detectorSettings isettings);
|
void setSettings(detectorSettings isettings);
|
||||||
|
|
||||||
@ -499,7 +499,6 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
* [Gotthard2] only in continuous mode */
|
* [Gotthard2] only in continuous mode */
|
||||||
int64_t getMeasurementTime() const;
|
int64_t getMeasurementTime() const;
|
||||||
|
|
||||||
|
|
||||||
timingMode getTimingMode();
|
timingMode getTimingMode();
|
||||||
void setTimingMode(timingMode value);
|
void setTimingMode(timingMode value);
|
||||||
|
|
||||||
@ -524,7 +523,8 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
int getOnChipDAC(slsDetectorDefs::dacIndex index, int chipIndex);
|
int getOnChipDAC(slsDetectorDefs::dacIndex index, int chipIndex);
|
||||||
|
|
||||||
/* [Gotthard2] */
|
/* [Gotthard2] */
|
||||||
void setOnChipDAC(slsDetectorDefs::dacIndex index, int chipIndex, int value);
|
void setOnChipDAC(slsDetectorDefs::dacIndex index, int chipIndex,
|
||||||
|
int value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get adc value
|
* Get adc value
|
||||||
@ -581,7 +581,8 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* [Ctb]
|
* [Ctb]
|
||||||
* @param mode readout mode Options: ANALOG_ONLY, DIGITAL_ONLY, ANALOG_AND_DIGITAL
|
* @param mode readout mode Options: ANALOG_ONLY, DIGITAL_ONLY,
|
||||||
|
* ANALOG_AND_DIGITAL
|
||||||
*/
|
*/
|
||||||
void setReadoutMode(const readoutMode mode);
|
void setReadoutMode(const readoutMode mode);
|
||||||
|
|
||||||
@ -702,14 +703,16 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Validates the format of the receiver UDP IP address and sets it
|
* Validates the format of the receiver UDP IP address and sets it
|
||||||
* If slsReceiver used, Gets receiver udp mac address and sends it to the detector
|
* If slsReceiver used, Gets receiver udp mac address and sends it to the
|
||||||
|
* detector
|
||||||
* @param ip receiver UDP IP address
|
* @param ip receiver UDP IP address
|
||||||
*/
|
*/
|
||||||
void setDestinationUDPIP(const sls::IpAddr ip);
|
void setDestinationUDPIP(const sls::IpAddr ip);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the receiver UDP IP address
|
* Returns the receiver UDP IP address
|
||||||
* If slsReceiver used, Gets receiver udp mac address and sends it to the detector
|
* If slsReceiver used, Gets receiver udp mac address and sends it to the
|
||||||
|
* detector
|
||||||
* @returns the receiver UDP IP address
|
* @returns the receiver UDP IP address
|
||||||
*/
|
*/
|
||||||
sls::IpAddr getDestinationUDPIP();
|
sls::IpAddr getDestinationUDPIP();
|
||||||
@ -717,14 +720,16 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
/**
|
/**
|
||||||
* Validates the format of the receiver UDP IP address (bottom half) and
|
* Validates the format of the receiver UDP IP address (bottom half) and
|
||||||
* sets it(Jungfrau only)
|
* sets it(Jungfrau only)
|
||||||
* If slsReceiver used, Gets receiver udp mac address2 and sends it to the detector
|
* If slsReceiver used, Gets receiver udp mac address2 and sends it to the
|
||||||
|
* detector
|
||||||
* @param ip receiver UDP IP address (bottom half)
|
* @param ip receiver UDP IP address (bottom half)
|
||||||
*/
|
*/
|
||||||
void setDestinationUDPIP2(const sls::IpAddr ip);
|
void setDestinationUDPIP2(const sls::IpAddr ip);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the receiver UDP IP address (bottom half) Jungfrau only
|
* Returns the receiver UDP IP address (bottom half) Jungfrau only
|
||||||
* If slsReceiver used, Gets receiver udp mac address2 and sends it to the detector
|
* If slsReceiver used, Gets receiver udp mac address2 and sends it to the
|
||||||
|
* detector
|
||||||
* @returns the receiver UDP IP address (bottom half)
|
* @returns the receiver UDP IP address (bottom half)
|
||||||
*/
|
*/
|
||||||
sls::IpAddr getDestinationUDPIP2();
|
sls::IpAddr getDestinationUDPIP2();
|
||||||
@ -904,13 +909,15 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
void setTransmissionDelayRight(int value);
|
void setTransmissionDelayRight(int value);
|
||||||
|
|
||||||
/** empty vector deletes entire additional json header */
|
/** empty vector deletes entire additional json header */
|
||||||
void setAdditionalJsonHeader(const std::map<std::string, std::string> &jsonHeader);
|
void setAdditionalJsonHeader(
|
||||||
|
const std::map<std::string, std::string> &jsonHeader);
|
||||||
std::map<std::string, std::string> getAdditionalJsonHeader();
|
std::map<std::string, std::string> getAdditionalJsonHeader();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the value for the additional json header parameter key if found, else
|
* Sets the value for the additional json header parameter key if found,
|
||||||
* append it. If value empty, then deletes parameter */
|
* else append it. If value empty, then deletes parameter */
|
||||||
void setAdditionalJsonParameter(const std::string &key, const std::string &value);
|
void setAdditionalJsonParameter(const std::string &key,
|
||||||
|
const std::string &value);
|
||||||
std::string getAdditionalJsonParameter(const std::string &key);
|
std::string getAdditionalJsonParameter(const std::string &key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -947,7 +954,6 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
* Only for virtual servers */
|
* Only for virtual servers */
|
||||||
void setImageTestMode(const int value);
|
void setImageTestMode(const int value);
|
||||||
|
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Gotthard2] */
|
||||||
std::array<int, 2> getInjectChannel();
|
std::array<int, 2> getInjectChannel();
|
||||||
|
|
||||||
@ -960,7 +966,8 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
std::vector<int> getVetoPhoton(const int chipIndex);
|
std::vector<int> getVetoPhoton(const int chipIndex);
|
||||||
|
|
||||||
/** [Gotthard2] energy in keV */
|
/** [Gotthard2] energy in keV */
|
||||||
void setVetoPhoton(const int chipIndex, const int numPhotons, const int energy, const std::string& fname);
|
void setVetoPhoton(const int chipIndex, const int numPhotons,
|
||||||
|
const int energy, const std::string &fname);
|
||||||
|
|
||||||
void setVetoReference(const int gainIndex, const int value);
|
void setVetoReference(const int gainIndex, const int value);
|
||||||
|
|
||||||
@ -1340,7 +1347,6 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
bool getPartialFramesPadding();
|
bool getPartialFramesPadding();
|
||||||
void setPartialFramesPadding(bool padding);
|
void setPartialFramesPadding(bool padding);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Receiver starts listening to packets
|
* Receiver starts listening to packets
|
||||||
*/
|
*/
|
||||||
@ -1373,7 +1379,6 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
uint64_t getReceiverCurrentFrameIndex() const;
|
uint64_t getReceiverCurrentFrameIndex() const;
|
||||||
int getReceiverProgress() const;
|
int getReceiverProgress() const;
|
||||||
|
|
||||||
|
|
||||||
void setFileWrite(bool value);
|
void setFileWrite(bool value);
|
||||||
bool getFileWrite();
|
bool getFileWrite();
|
||||||
void setMasterFileWrite(bool value);
|
void setMasterFileWrite(bool value);
|
||||||
@ -1478,7 +1483,6 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
int setPatternLoopCycles(int level = -1, int n = -1);
|
int setPatternLoopCycles(int level = -1, int n = -1);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the wait address (CTB/ Moench/ Mythen3)
|
* Sets the wait address (CTB/ Moench/ Mythen3)
|
||||||
* @param level 0,1,2, wait level
|
* @param level 0,1,2, wait level
|
||||||
@ -1588,8 +1592,7 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
void sendToDetector(int fnum, std::nullptr_t, Ret &retval);
|
void sendToDetector(int fnum, std::nullptr_t, Ret &retval);
|
||||||
void sendToDetector(int fnum);
|
void sendToDetector(int fnum);
|
||||||
|
|
||||||
template <typename Ret>
|
template <typename Ret> Ret sendToDetector(int fnum);
|
||||||
Ret sendToDetector(int fnum);
|
|
||||||
|
|
||||||
template <typename Ret, typename Arg>
|
template <typename Ret, typename Arg>
|
||||||
Ret sendToDetector(int fnum, const Arg &args);
|
Ret sendToDetector(int fnum, const Arg &args);
|
||||||
@ -1662,11 +1665,9 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
template <typename Ret>
|
template <typename Ret>
|
||||||
void sendToReceiver(int fnum, std::nullptr_t, Ret &retval) const;
|
void sendToReceiver(int fnum, std::nullptr_t, Ret &retval) const;
|
||||||
|
|
||||||
template <typename Ret>
|
template <typename Ret> Ret sendToReceiver(int fnum);
|
||||||
Ret sendToReceiver(int fnum);
|
|
||||||
|
|
||||||
template <typename Ret>
|
template <typename Ret> Ret sendToReceiver(int fnum) const;
|
||||||
Ret sendToReceiver(int fnum) const;
|
|
||||||
|
|
||||||
template <typename Ret, typename Arg>
|
template <typename Ret, typename Arg>
|
||||||
Ret sendToReceiver(int fnum, const Arg &args);
|
Ret sendToReceiver(int fnum, const Arg &args);
|
||||||
@ -1779,4 +1780,4 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
mutable sls::SharedMemory<sharedSlsDetector> shm{0, 0};
|
mutable sls::SharedMemory<sharedSlsDetector> shm{0, 0};
|
||||||
};
|
};
|
||||||
|
|
||||||
}// sls
|
} // namespace sls
|
76
slsDetectorSoftware/src/SharedMemory.h
Executable file → Normal file
76
slsDetectorSoftware/src/SharedMemory.h
Executable file → Normal file
@ -31,8 +31,7 @@
|
|||||||
|
|
||||||
namespace sls {
|
namespace sls {
|
||||||
|
|
||||||
template <typename T>
|
template <typename T> class SharedMemory {
|
||||||
class SharedMemory {
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@ -53,9 +52,8 @@ class SharedMemory {
|
|||||||
SharedMemory &operator=(const SharedMemory &other) = delete;
|
SharedMemory &operator=(const SharedMemory &other) = delete;
|
||||||
|
|
||||||
// Move constructor
|
// Move constructor
|
||||||
SharedMemory(SharedMemory &&other) : name(other.name),
|
SharedMemory(SharedMemory &&other)
|
||||||
fd(other.fd),
|
: name(other.name), fd(other.fd), shmSize(other.shmSize),
|
||||||
shmSize(other.shmSize),
|
|
||||||
shared_struct(other.shared_struct) {
|
shared_struct(other.shared_struct) {
|
||||||
|
|
||||||
other.fd = -1;
|
other.fd = -1;
|
||||||
@ -110,29 +108,29 @@ class SharedMemory {
|
|||||||
/**
|
/**
|
||||||
* Get shared memory name
|
* Get shared memory name
|
||||||
*/
|
*/
|
||||||
std::string GetName() const {
|
std::string GetName() const { return name; }
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t size() const {
|
size_t size() const { return shmSize; }
|
||||||
return shmSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create Shared memory and call MapSharedMemory to map it to an address
|
* Create Shared memory and call MapSharedMemory to map it to an address
|
||||||
* throws a SharedMemoryError exception on failure to create, ftruncate or map
|
* throws a SharedMemoryError exception on failure to create, ftruncate or
|
||||||
|
* map
|
||||||
* @param sz of shared memory
|
* @param sz of shared memory
|
||||||
*/
|
*/
|
||||||
void CreateSharedMemory() {
|
void CreateSharedMemory() {
|
||||||
fd = shm_open(name.c_str(), O_CREAT | O_TRUNC | O_EXCL | O_RDWR, S_IRUSR | S_IWUSR);
|
fd = shm_open(name.c_str(), O_CREAT | O_TRUNC | O_EXCL | O_RDWR,
|
||||||
|
S_IRUSR | S_IWUSR);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
std::string msg = "Create shared memory " + name + " failed: " + strerror(errno);
|
std::string msg =
|
||||||
|
"Create shared memory " + name + " failed: " + strerror(errno);
|
||||||
LOG(logERROR) << msg;
|
LOG(logERROR) << msg;
|
||||||
throw SharedMemoryError(msg);
|
throw SharedMemoryError(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ftruncate(fd, sizeof(T)) < 0) {
|
if (ftruncate(fd, sizeof(T)) < 0) {
|
||||||
std::string msg = "Create shared memory " + name + " failed at ftruncate: " + strerror(errno);
|
std::string msg = "Create shared memory " + name +
|
||||||
|
" failed at ftruncate: " + strerror(errno);
|
||||||
LOG(logERROR) << msg;
|
LOG(logERROR) << msg;
|
||||||
close(fd);
|
close(fd);
|
||||||
RemoveSharedMemory();
|
RemoveSharedMemory();
|
||||||
@ -144,14 +142,15 @@ class SharedMemory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open existing Shared memory and call MapSharedMemory to map it to an address
|
* Open existing Shared memory and call MapSharedMemory to map it to an
|
||||||
* throws a SharedMemoryError exception on failure to open or map
|
* address throws a SharedMemoryError exception on failure to open or map
|
||||||
* @param sz of shared memory
|
* @param sz of shared memory
|
||||||
*/
|
*/
|
||||||
void OpenSharedMemory() {
|
void OpenSharedMemory() {
|
||||||
fd = shm_open(name.c_str(), O_RDWR, 0);
|
fd = shm_open(name.c_str(), O_RDWR, 0);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
std::string msg = "Open existing shared memory " + name + " failed: " + strerror(errno);
|
std::string msg = "Open existing shared memory " + name +
|
||||||
|
" failed: " + strerror(errno);
|
||||||
LOG(logERROR) << msg;
|
LOG(logERROR) << msg;
|
||||||
throw SharedMemoryError(msg);
|
throw SharedMemoryError(msg);
|
||||||
}
|
}
|
||||||
@ -166,7 +165,8 @@ class SharedMemory {
|
|||||||
void UnmapSharedMemory() {
|
void UnmapSharedMemory() {
|
||||||
if (shared_struct != nullptr) {
|
if (shared_struct != nullptr) {
|
||||||
if (munmap(shared_struct, shmSize) < 0) {
|
if (munmap(shared_struct, shmSize) < 0) {
|
||||||
std::string msg = "Unmapping shared memory " + name + " failed: " + strerror(errno);
|
std::string msg = "Unmapping shared memory " + name +
|
||||||
|
" failed: " + strerror(errno);
|
||||||
LOG(logERROR) << msg;
|
LOG(logERROR) << msg;
|
||||||
close(fd);
|
close(fd);
|
||||||
throw SharedMemoryError(msg);
|
throw SharedMemoryError(msg);
|
||||||
@ -184,7 +184,8 @@ class SharedMemory {
|
|||||||
// silent exit if shm did not exist anyway
|
// silent exit if shm did not exist anyway
|
||||||
if (errno == ENOENT)
|
if (errno == ENOENT)
|
||||||
return;
|
return;
|
||||||
std::string msg = "Free Shared Memory " + name + " Failed: " + strerror(errno);
|
std::string msg =
|
||||||
|
"Free Shared Memory " + name + " Failed: " + strerror(errno);
|
||||||
LOG(logERROR) << msg;
|
LOG(logERROR) << msg;
|
||||||
throw SharedMemoryError(msg);
|
throw SharedMemoryError(msg);
|
||||||
}
|
}
|
||||||
@ -199,16 +200,12 @@ class SharedMemory {
|
|||||||
/**
|
/**
|
||||||
*Using the call operator to access the pointer
|
*Using the call operator to access the pointer
|
||||||
*/
|
*/
|
||||||
T *operator()() {
|
T *operator()() { return shared_struct; }
|
||||||
return shared_struct;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*Using the call operator to access the pointer, const overload
|
*Using the call operator to access the pointer, const overload
|
||||||
*/
|
*/
|
||||||
const T *operator()() const {
|
const T *operator()() const { return shared_struct; }
|
||||||
return shared_struct;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
@ -232,11 +229,16 @@ class SharedMemory {
|
|||||||
if (slsId < 0)
|
if (slsId < 0)
|
||||||
ss << SHM_MULTI_PREFIX << multiId << sEnvPath;
|
ss << SHM_MULTI_PREFIX << multiId << sEnvPath;
|
||||||
else
|
else
|
||||||
ss << SHM_MULTI_PREFIX << multiId << SHM_SLS_PREFIX << slsId << sEnvPath;
|
ss << SHM_MULTI_PREFIX << multiId << SHM_SLS_PREFIX << slsId
|
||||||
|
<< sEnvPath;
|
||||||
|
|
||||||
std::string temp = ss.str();
|
std::string temp = ss.str();
|
||||||
if (temp.length() > NAME_MAX_LENGTH) {
|
if (temp.length() > NAME_MAX_LENGTH) {
|
||||||
std::string msg = "Shared memory initialization failed. " + temp + " has " + std::to_string(temp.length()) + " characters. \n" + "Maximum is " + std::to_string(NAME_MAX_LENGTH) + ". Change the environment variable " + SHM_ENV_NAME;
|
std::string msg =
|
||||||
|
"Shared memory initialization failed. " + temp + " has " +
|
||||||
|
std::to_string(temp.length()) + " characters. \n" +
|
||||||
|
"Maximum is " + std::to_string(NAME_MAX_LENGTH) +
|
||||||
|
". Change the environment variable " + SHM_ENV_NAME;
|
||||||
LOG(logERROR) << msg;
|
LOG(logERROR) << msg;
|
||||||
throw SharedMemoryError(msg);
|
throw SharedMemoryError(msg);
|
||||||
}
|
}
|
||||||
@ -250,9 +252,11 @@ class SharedMemory {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
T *MapSharedMemory() {
|
T *MapSharedMemory() {
|
||||||
void *addr = mmap(nullptr, sizeof(T), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
void *addr =
|
||||||
|
mmap(nullptr, sizeof(T), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||||
if (addr == MAP_FAILED) {
|
if (addr == MAP_FAILED) {
|
||||||
std::string msg = "Mapping shared memory " + name + " failed: " + strerror(errno);
|
std::string msg =
|
||||||
|
"Mapping shared memory " + name + " failed: " + strerror(errno);
|
||||||
LOG(logERROR) << msg;
|
LOG(logERROR) << msg;
|
||||||
close(fd);
|
close(fd);
|
||||||
throw SharedMemoryError(msg);
|
throw SharedMemoryError(msg);
|
||||||
@ -264,14 +268,17 @@ class SharedMemory {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify if existing shared memory size matches expected size
|
* Verify if existing shared memory size matches expected size
|
||||||
* @param expectedSize expected size of shared memory, replaced with smaller size if size does not match
|
* @param expectedSize expected size of shared memory, replaced with smaller
|
||||||
|
* size if size does not match
|
||||||
* @return 0 for success, 1 for fail
|
* @return 0 for success, 1 for fail
|
||||||
*/
|
*/
|
||||||
int VerifySizeMatch(size_t expectedSize) {
|
int VerifySizeMatch(size_t expectedSize) {
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
// could not fstat
|
// could not fstat
|
||||||
if (fstat(fd, &sb) < 0) {
|
if (fstat(fd, &sb) < 0) {
|
||||||
std::string msg = "Could not verify existing shared memory " + name + " size match " + "(could not fstat): " + strerror(errno);
|
std::string msg = "Could not verify existing shared memory " +
|
||||||
|
name + " size match " +
|
||||||
|
"(could not fstat): " + strerror(errno);
|
||||||
LOG(logERROR) << msg;
|
LOG(logERROR) << msg;
|
||||||
close(fd);
|
close(fd);
|
||||||
throw SharedMemoryError(msg);
|
throw SharedMemoryError(msg);
|
||||||
@ -280,7 +287,10 @@ class SharedMemory {
|
|||||||
// size does not match
|
// size does not match
|
||||||
auto sz = static_cast<size_t>(sb.st_size);
|
auto sz = static_cast<size_t>(sb.st_size);
|
||||||
if (sz != expectedSize) {
|
if (sz != expectedSize) {
|
||||||
std::string msg = "Existing shared memory " + name + " size does not match" + "Expected " + std::to_string(expectedSize) + ", found " + std::to_string(sz);
|
std::string msg = "Existing shared memory " + name +
|
||||||
|
" size does not match" + "Expected " +
|
||||||
|
std::to_string(expectedSize) + ", found " +
|
||||||
|
std::to_string(sz);
|
||||||
LOG(logERROR) << msg;
|
LOG(logERROR) << msg;
|
||||||
throw SharedMemoryError(msg);
|
throw SharedMemoryError(msg);
|
||||||
return 1;
|
return 1;
|
||||||
|
97
slsDetectorSoftware/src/slsDetectorUsers.cpp
Executable file → Normal file
97
slsDetectorSoftware/src/slsDetectorUsers.cpp
Executable file → Normal file
@ -1,18 +1,18 @@
|
|||||||
#include "slsDetectorUsers.h"
|
#include "slsDetectorUsers.h"
|
||||||
//#include "detectorData.h"
|
//#include "detectorData.h"
|
||||||
//#include "multiSlsDetectorClient.h" TODO: do we need this put and get in users api
|
//#include "multiSlsDetectorClient.h" TODO: do we need this put and get in users
|
||||||
|
// api
|
||||||
#include "Detector.h"
|
#include "Detector.h"
|
||||||
|
|
||||||
slsDetectorUsers::slsDetectorUsers(int shm_id) : detector(sls::make_unique<sls::Detector>(shm_id)){}
|
slsDetectorUsers::slsDetectorUsers(int shm_id)
|
||||||
|
: detector(sls::make_unique<sls::Detector>(shm_id)) {}
|
||||||
slsDetectorUsers::~slsDetectorUsers() = default;
|
slsDetectorUsers::~slsDetectorUsers() = default;
|
||||||
|
|
||||||
void slsDetectorUsers::readConfigurationFile(const std::string &fname) {
|
void slsDetectorUsers::readConfigurationFile(const std::string &fname) {
|
||||||
detector->loadConfig(fname);
|
detector->loadConfig(fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
int slsDetectorUsers::size() const {
|
int slsDetectorUsers::size() const { return detector->size(); }
|
||||||
return detector->size();
|
|
||||||
}
|
|
||||||
|
|
||||||
// int slsDetectorUsers::getDetectorSize(int &nx, int &ny, int detPos){
|
// int slsDetectorUsers::getDetectorSize(int &nx, int &ny, int detPos){
|
||||||
// slsDetectorDefs::xy res = detector.getNumberOfChannels();
|
// slsDetectorDefs::xy res = detector.getNumberOfChannels();
|
||||||
@ -38,7 +38,8 @@ int slsDetectorUsers::size() const {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// int64_t slsDetectorUsers::getDetectorFirmwareVersion(int detPos){
|
// int64_t slsDetectorUsers::getDetectorFirmwareVersion(int detPos){
|
||||||
// return detector.getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION, detPos);
|
// return detector.getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION,
|
||||||
|
// detPos);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// int64_t slsDetectorUsers::getDetectorSerialNumber(int detPos){
|
// int64_t slsDetectorUsers::getDetectorSerialNumber(int detPos){
|
||||||
@ -46,7 +47,8 @@ int slsDetectorUsers::size() const {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// int64_t slsDetectorUsers::getDetectorSoftwareVersion(int detPos){
|
// int64_t slsDetectorUsers::getDetectorSoftwareVersion(int detPos){
|
||||||
// return detector.getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION, detPos);
|
// return detector.getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION,
|
||||||
|
// detPos);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// int64_t slsDetectorUsers::getClientSoftwareVersion(){
|
// int64_t slsDetectorUsers::getClientSoftwareVersion(){
|
||||||
@ -103,37 +105,40 @@ int slsDetectorUsers::size() const {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// int slsDetectorUsers::setSettings(int isettings, int detPos){
|
// int slsDetectorUsers::setSettings(int isettings, int detPos){
|
||||||
// return detector.setSettings((slsDetectorDefs::detectorSettings)isettings, detPos);
|
// return
|
||||||
|
// detector.setSettings((slsDetectorDefs::detectorSettings)isettings, detPos);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// int slsDetectorUsers::getThresholdEnergy(int detPos){
|
// int slsDetectorUsers::getThresholdEnergy(int detPos){
|
||||||
// return detector.getThresholdEnergy(detPos);
|
// return detector.getThresholdEnergy(detPos);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// int slsDetectorUsers::setThresholdEnergy(int e_ev, int tb, int isettings, int detPos) {
|
// int slsDetectorUsers::setThresholdEnergy(int e_ev, int tb, int isettings, int
|
||||||
// return detector.setThresholdEnergy(e_ev,
|
// detPos) { return detector.setThresholdEnergy(e_ev,
|
||||||
// (isettings == -1) ? slsDetectorDefs::GET_SETTINGS : (slsDetectorDefs::detectorSettings)isettings,
|
// (isettings == -1) ? slsDetectorDefs::GET_SETTINGS :
|
||||||
// tb, detPos);
|
// (slsDetectorDefs::detectorSettings)isettings, tb, detPos);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// double slsDetectorUsers::setExposureTime(double t, bool inseconds, int detPos){
|
// double slsDetectorUsers::setExposureTime(double t, bool inseconds, int
|
||||||
// return detector.setExposureTime(t, inseconds, detPos);
|
// detPos){ return detector.setExposureTime(t, inseconds, detPos);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// double slsDetectorUsers::setExposurePeriod(double t, bool inseconds, int detPos){
|
// double slsDetectorUsers::setExposurePeriod(double t, bool inseconds, int
|
||||||
// return detector.setExposurePeriod(t, inseconds, detPos);
|
// detPos){ return detector.setExposurePeriod(t, inseconds, detPos);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// double slsDetectorUsers::setDelayAfterTrigger(double t, bool inseconds, int detPos){
|
// double slsDetectorUsers::setDelayAfterTrigger(double t, bool inseconds, int
|
||||||
// return detector.setDelayAfterTrigger(t, inseconds, detPos);
|
// detPos){ return detector.setDelayAfterTrigger(t, inseconds, detPos);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// double slsDetectorUsers::setSubFrameExposureTime(double t, bool inseconds, int detPos){
|
// double slsDetectorUsers::setSubFrameExposureTime(double t, bool inseconds,
|
||||||
// return detector.setSubFrameExposureTime(t, inseconds, detPos);
|
// int detPos){ return detector.setSubFrameExposureTime(t, inseconds,
|
||||||
|
// detPos);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// double slsDetectorUsers::setSubFrameExposureDeadTime(double t, bool inseconds, int detPos){
|
// double slsDetectorUsers::setSubFrameExposureDeadTime(double t, bool
|
||||||
// return detector.setSubFrameExposureDeadTime(t, inseconds, detPos);
|
// inseconds, int detPos){ return detector.setSubFrameExposureDeadTime(t,
|
||||||
|
// inseconds, detPos);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// int64_t slsDetectorUsers::setNumberOfFrames(int64_t t, int detPos){
|
// int64_t slsDetectorUsers::setNumberOfFrames(int64_t t, int detPos){
|
||||||
@ -152,8 +157,8 @@ int slsDetectorUsers::size() const {
|
|||||||
// return detector.getMeasuredPeriod(inseconds, detPos);
|
// return detector.getMeasuredPeriod(inseconds, detPos);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// double slsDetectorUsers::getMeasuredSubFramePeriod(bool inseconds, int detPos) {
|
// double slsDetectorUsers::getMeasuredSubFramePeriod(bool inseconds, int
|
||||||
// return detector.getMeasuredSubFramePeriod(inseconds, detPos);
|
// detPos) { return detector.getMeasuredSubFramePeriod(inseconds, detPos);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// int slsDetectorUsers::setTimingMode(int pol, int detPos){
|
// int slsDetectorUsers::setTimingMode(int pol, int detPos){
|
||||||
@ -187,7 +192,8 @@ int slsDetectorUsers::size() const {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// int slsDetectorUsers::setDAC(int val, int index , int detPos) {
|
// int slsDetectorUsers::setDAC(int val, int index , int detPos) {
|
||||||
// return detector.setDAC(val, slsDetectorDefs::dacIndex(index), 0, detPos);
|
// return detector.setDAC(val, slsDetectorDefs::dacIndex(index), 0,
|
||||||
|
// detPos);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// int slsDetectorUsers::getADC(int index, int detPos) {
|
// int slsDetectorUsers::getADC(int index, int detPos) {
|
||||||
@ -224,7 +230,6 @@ int slsDetectorUsers::size() const {
|
|||||||
|
|
||||||
// *********************************************************************/
|
// *********************************************************************/
|
||||||
|
|
||||||
|
|
||||||
// void slsDetectorUsers::startReceiver(int detPos) {
|
// void slsDetectorUsers::startReceiver(int detPos) {
|
||||||
// detector.startReceiver(detPos);
|
// detector.startReceiver(detPos);
|
||||||
// }
|
// }
|
||||||
@ -314,15 +319,15 @@ int slsDetectorUsers::size() const {
|
|||||||
// return detector.getClientStreamingPort(detPos);
|
// return detector.getClientStreamingPort(detPos);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// std::string slsDetectorUsers::setReceiverDataStreamingOutIP(const std::string& ip, int detPos){
|
// std::string slsDetectorUsers::setReceiverDataStreamingOutIP(const
|
||||||
// if (ip.length()) {
|
// std::string& ip, int detPos){ if (ip.length()) {
|
||||||
// detector.setReceiverDataStreamingOutIP(ip, detPos);
|
// detector.setReceiverDataStreamingOutIP(ip, detPos);
|
||||||
// }
|
// }
|
||||||
// return detector.getReceiverStreamingIP(detPos);
|
// return detector.getReceiverStreamingIP(detPos);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// std::string slsDetectorUsers::setClientDataStreamingInIP(const std::string& ip, int detPos){
|
// std::string slsDetectorUsers::setClientDataStreamingInIP(const std::string&
|
||||||
// if (ip.length()) {
|
// ip, int detPos){ if (ip.length()) {
|
||||||
// detector.setClientDataStreamingInIP(ip, detPos);
|
// detector.setClientDataStreamingInIP(ip, detPos);
|
||||||
// }
|
// }
|
||||||
// return detector.getClientStreamingIP(detPos);
|
// return detector.getClientStreamingIP(detPos);
|
||||||
@ -333,7 +338,9 @@ int slsDetectorUsers::size() const {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// int slsDetectorUsers::setReceiverFramesDiscardPolicy(int f, int detPos) {
|
// int slsDetectorUsers::setReceiverFramesDiscardPolicy(int f, int detPos) {
|
||||||
// return detector.setReceiverFramesDiscardPolicy(slsDetectorDefs::frameDiscardPolicy(f), detPos);
|
// return
|
||||||
|
// detector.setReceiverFramesDiscardPolicy(slsDetectorDefs::frameDiscardPolicy(f),
|
||||||
|
// detPos);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// int slsDetectorUsers::setReceiverPartialFramesPadding(int f, int detPos) {
|
// int slsDetectorUsers::setReceiverPartialFramesPadding(int f, int detPos) {
|
||||||
@ -352,45 +359,37 @@ int slsDetectorUsers::size() const {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// int slsDetectorUsers::setDetectorMinMaxEnergyThreshold(const int index, int v, int detPos) {
|
// int slsDetectorUsers::setDetectorMinMaxEnergyThreshold(const int index, int
|
||||||
|
// v, int detPos) {
|
||||||
// return detector.setDetectorMinMaxEnergyThreshold(index, v, detPos);
|
// return detector.setDetectorMinMaxEnergyThreshold(index, v, detPos);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// int slsDetectorUsers::setFrameMode(int value, int detPos) {
|
// int slsDetectorUsers::setFrameMode(int value, int detPos) {
|
||||||
// return detector.setFrameMode(slsDetectorDefs::frameModeType(value), detPos);
|
// return detector.setFrameMode(slsDetectorDefs::frameModeType(value),
|
||||||
|
// detPos);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// int slsDetectorUsers::setDetectorMode(int value, int detPos) {
|
// int slsDetectorUsers::setDetectorMode(int value, int detPos) {
|
||||||
// return detector.setDetectorMode(slsDetectorDefs::detectorModeType(value), detPos);
|
// return detector.setDetectorMode(slsDetectorDefs::detectorModeType(value),
|
||||||
|
// detPos);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
// /************************************************************************
|
// /************************************************************************
|
||||||
|
|
||||||
// CALLBACKS & COMMAND LINE PARSING
|
// CALLBACKS & COMMAND LINE PARSING
|
||||||
|
|
||||||
// *********************************************************************/
|
// *********************************************************************/
|
||||||
|
|
||||||
// void slsDetectorUsers::registerDataCallback(void( *userCallback)(detectorData*, uint64_t, uint32_t, void*), void *pArg) {
|
// void slsDetectorUsers::registerDataCallback(void(
|
||||||
|
// *userCallback)(detectorData*, uint64_t, uint32_t, void*), void *pArg) {
|
||||||
// detector.registerDataCallback(userCallback,pArg);
|
// detector.registerDataCallback(userCallback,pArg);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// void slsDetectorUsers::registerAcquisitionFinishedCallback(void( *func)(double,int, void*), void *pArg) {
|
// void slsDetectorUsers::registerAcquisitionFinishedCallback(void(
|
||||||
|
// *func)(double,int, void*), void *pArg) {
|
||||||
// detector.registerAcquisitionFinishedCallback(func,pArg);
|
// detector.registerAcquisitionFinishedCallback(func,pArg);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// void slsDetectorUsers::putCommand(const std::string& command){
|
// void slsDetectorUsers::putCommand(const std::string& command){
|
||||||
// multiSlsDetectorClient(command, slsDetectorDefs::PUT_ACTION, &detector);
|
// multiSlsDetectorClient(command, slsDetectorDefs::PUT_ACTION, &detector);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
2
slsDetectorSoftware/tests/test-CmdParser.cpp
Executable file → Normal file
2
slsDetectorSoftware/tests/test-CmdParser.cpp
Executable file → Normal file
@ -3,7 +3,6 @@
|
|||||||
#include <exception>
|
#include <exception>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
// tests to add
|
// tests to add
|
||||||
// help for all docs
|
// help for all docs
|
||||||
// command for all depreciated commands
|
// command for all depreciated commands
|
||||||
@ -166,7 +165,6 @@ TEST_CASE("Parsing consecutive strings resets not found det id"){
|
|||||||
REQUIRE(p.detector_id() == -1);
|
REQUIRE(p.detector_id() == -1);
|
||||||
p.Parse("3:exptime 0.5");
|
p.Parse("3:exptime 0.5");
|
||||||
REQUIRE(p.detector_id() == 3);
|
REQUIRE(p.detector_id() == 3);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Parsing consecutive strings resets not found multi id") {
|
TEST_CASE("Parsing consecutive strings resets not found multi id") {
|
||||||
|
@ -17,7 +17,8 @@ using test::PUT;
|
|||||||
|
|
||||||
/* dacs */
|
/* dacs */
|
||||||
|
|
||||||
TEST_CASE("Setting and reading back Chip test board dacs", "[.cmd][.dacs][.new]") {
|
TEST_CASE("Setting and reading back Chip test board dacs",
|
||||||
|
"[.cmd][.dacs][.new]") {
|
||||||
// dac 0 to dac 17
|
// dac 0 to dac 17
|
||||||
|
|
||||||
Detector det;
|
Detector det;
|
||||||
@ -25,7 +26,9 @@ TEST_CASE("Setting and reading back Chip test board dacs", "[.cmd][.dacs][.new]"
|
|||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::CHIPTESTBOARD) {
|
if (det_type == defs::CHIPTESTBOARD) {
|
||||||
for (int i = 0; i < 18; ++i) {
|
for (int i = 0; i < 18; ++i) {
|
||||||
SECTION("dac " + std::to_string(i)) { test_dac(static_cast<defs::dacIndex>(i), "dac", 0); }
|
SECTION("dac " + std::to_string(i)) {
|
||||||
|
test_dac(static_cast<defs::dacIndex>(i), "dac", 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// eiger
|
// eiger
|
||||||
// REQUIRE_THROWS(proxy.Call("vthreshold", {}, -1, GET));
|
// REQUIRE_THROWS(proxy.Call("vthreshold", {}, -1, GET));
|
||||||
|
@ -14,7 +14,6 @@ using sls::Detector;
|
|||||||
using test::GET;
|
using test::GET;
|
||||||
using test::PUT;
|
using test::PUT;
|
||||||
|
|
||||||
|
|
||||||
/** temperature */
|
/** temperature */
|
||||||
|
|
||||||
TEST_CASE("temp_fpgaext", "[.cmd][.new]") {
|
TEST_CASE("temp_fpgaext", "[.cmd][.new]") {
|
||||||
@ -229,30 +228,6 @@ TEST_CASE("Setting and reading back EIGER dacs", "[.cmd][.dacs][.new]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("Eiger transmission delay", "[.cmd]") {
|
TEST_CASE("Eiger transmission delay", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
@ -519,8 +494,6 @@ TEST_CASE("quad", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TEST_CASE("trigger", "[.cmd]") {
|
// TEST_CASE("trigger", "[.cmd]") {
|
||||||
// Detector det;
|
// Detector det;
|
||||||
// CmdProxy proxy(&det);
|
// CmdProxy proxy(&det);
|
||||||
|
@ -9,7 +9,6 @@ using sls::Detector;
|
|||||||
using test::GET;
|
using test::GET;
|
||||||
using test::PUT;
|
using test::PUT;
|
||||||
|
|
||||||
|
|
||||||
void test_dac(defs::dacIndex index, const std::string &dacname, int dacvalue) {
|
void test_dac(defs::dacIndex index, const std::string &dacname, int dacvalue) {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
@ -20,9 +19,11 @@ void test_dac(defs::dacIndex index, const std::string &dacname, int dacvalue) {
|
|||||||
if (dacname == "dac") {
|
if (dacname == "dac") {
|
||||||
auto dacIndexstr = std::to_string(static_cast<int>(index));
|
auto dacIndexstr = std::to_string(static_cast<int>(index));
|
||||||
proxy.Call(dacname, {dacIndexstr, dacstr}, -1, PUT, oss_set);
|
proxy.Call(dacname, {dacIndexstr, dacstr}, -1, PUT, oss_set);
|
||||||
REQUIRE(oss_set.str() == dacname + " " + dacIndexstr + " " + dacstr + "\n");
|
REQUIRE(oss_set.str() ==
|
||||||
|
dacname + " " + dacIndexstr + " " + dacstr + "\n");
|
||||||
proxy.Call(dacname, {dacIndexstr}, -1, GET, oss_get);
|
proxy.Call(dacname, {dacIndexstr}, -1, GET, oss_get);
|
||||||
REQUIRE(oss_get.str() == dacname + " " + dacIndexstr + " " + dacstr + "\n");
|
REQUIRE(oss_get.str() ==
|
||||||
|
dacname + " " + dacIndexstr + " " + dacstr + "\n");
|
||||||
}
|
}
|
||||||
// other detectors
|
// other detectors
|
||||||
else {
|
else {
|
||||||
@ -37,12 +38,15 @@ void test_dac(defs::dacIndex index, const std::string &dacname, int dacvalue) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_onchip_dac(defs::dacIndex index, const std::string &dacname, int dacvalue) {
|
void test_onchip_dac(defs::dacIndex index, const std::string &dacname,
|
||||||
|
int dacvalue) {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
REQUIRE_THROWS(proxy.Call(dacname, {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call(dacname, {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call(dacname, {"10", "0x0"}, -1, PUT)); // chip index (-1 to 9)
|
REQUIRE_THROWS(
|
||||||
REQUIRE_THROWS(proxy.Call(dacname, {"-1", "0x400"}, -1, PUT)); // max val is 0x3ff
|
proxy.Call(dacname, {"10", "0x0"}, -1, PUT)); // chip index (-1 to 9)
|
||||||
|
REQUIRE_THROWS(
|
||||||
|
proxy.Call(dacname, {"-1", "0x400"}, -1, PUT)); // max val is 0x3ff
|
||||||
|
|
||||||
int chipIndex = -1; // for now, it is -1 only
|
int chipIndex = -1; // for now, it is -1 only
|
||||||
auto prev_val = det.getOnChipDAC(index, chipIndex);
|
auto prev_val = det.getOnChipDAC(index, chipIndex);
|
||||||
@ -50,9 +54,11 @@ void test_onchip_dac(defs::dacIndex index, const std::string &dacname, int dacva
|
|||||||
auto chipIndexStr = std::to_string(chipIndex);
|
auto chipIndexStr = std::to_string(chipIndex);
|
||||||
std::ostringstream oss_set, oss_get;
|
std::ostringstream oss_set, oss_get;
|
||||||
proxy.Call(dacname, {chipIndexStr, dacValueStr}, -1, PUT, oss_set);
|
proxy.Call(dacname, {chipIndexStr, dacValueStr}, -1, PUT, oss_set);
|
||||||
REQUIRE(oss_set.str() == dacname + " " + chipIndexStr + " " + dacValueStr + "\n");
|
REQUIRE(oss_set.str() ==
|
||||||
|
dacname + " " + chipIndexStr + " " + dacValueStr + "\n");
|
||||||
proxy.Call(dacname, {chipIndexStr}, -1, GET, oss_get);
|
proxy.Call(dacname, {chipIndexStr}, -1, GET, oss_get);
|
||||||
REQUIRE(oss_get.str() == dacname + " " + chipIndexStr + " " + dacValueStr + "\n");
|
REQUIRE(oss_get.str() ==
|
||||||
|
dacname + " " + chipIndexStr + " " + dacValueStr + "\n");
|
||||||
|
|
||||||
// Reset all dacs to previous value
|
// Reset all dacs to previous value
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
|
|
||||||
void test_dac(slsDetectorDefs::dacIndex index, const std::string &dacname, int dacvalue);
|
void test_dac(slsDetectorDefs::dacIndex index, const std::string &dacname,
|
||||||
void test_onchip_dac(slsDetectorDefs::dacIndex index, const std::string &dacname, int dacvalue);
|
int dacvalue);
|
||||||
|
void test_onchip_dac(slsDetectorDefs::dacIndex index,
|
||||||
|
const std::string &dacname, int dacvalue);
|
||||||
|
@ -18,7 +18,8 @@ using test::PUT;
|
|||||||
/* dacs */
|
/* dacs */
|
||||||
|
|
||||||
TEST_CASE("Setting and reading back GOTTHARD dacs", "[.cmd][.dacs][.new]") {
|
TEST_CASE("Setting and reading back GOTTHARD dacs", "[.cmd][.dacs][.new]") {
|
||||||
// vref_ds, vcascn_pb, vcascp_pb, vout_cm, vcasc_out, vin_cm, vref_comp, ib_test_c
|
// vref_ds, vcascn_pb, vcascp_pb, vout_cm, vcasc_out, vin_cm, vref_comp,
|
||||||
|
// ib_test_c
|
||||||
|
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
|
@ -22,9 +22,12 @@ TEST_CASE("bursts", "[.cmd][.new]") {
|
|||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
auto prev_burst = det.getNumberOfBursts().tsquash("#bursts should be same to test");
|
auto prev_burst =
|
||||||
auto prev_trigger = det.getNumberOfFrames().tsquash("#frames should be same to test");
|
det.getNumberOfBursts().tsquash("#bursts should be same to test");
|
||||||
auto prev_frames = det.getNumberOfTriggers().tsquash("#triggers should be same to test");
|
auto prev_trigger =
|
||||||
|
det.getNumberOfFrames().tsquash("#frames should be same to test");
|
||||||
|
auto prev_frames = det.getNumberOfTriggers().tsquash(
|
||||||
|
"#triggers should be same to test");
|
||||||
auto prev_timingMode = det.getTimingMode();
|
auto prev_timingMode = det.getTimingMode();
|
||||||
auto prev_burstMode = det.getBurstMode();
|
auto prev_burstMode = det.getBurstMode();
|
||||||
// changing continuous mode frames and bursts
|
// changing continuous mode frames and bursts
|
||||||
@ -100,15 +103,25 @@ TEST_CASE("Setting and reading back GOTTHARD2 dacs", "[.cmd][.dacs][.new]") {
|
|||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
SECTION("vref_h_adc") { test_dac(defs::VREF_H_ADC, "vref_h_adc", 2099); }
|
SECTION("vref_h_adc") {
|
||||||
|
test_dac(defs::VREF_H_ADC, "vref_h_adc", 2099);
|
||||||
|
}
|
||||||
SECTION("vb_comp_fe") { test_dac(defs::VB_COMP_FE, "vb_comp_fe", 0); }
|
SECTION("vb_comp_fe") { test_dac(defs::VB_COMP_FE, "vb_comp_fe", 0); }
|
||||||
SECTION("vb_comp_adc") { test_dac(defs::VB_COMP_ADC, "vb_comp_adc", 0); }
|
SECTION("vb_comp_adc") {
|
||||||
|
test_dac(defs::VB_COMP_ADC, "vb_comp_adc", 0);
|
||||||
|
}
|
||||||
SECTION("vcom_cds") { test_dac(defs::VCOM_CDS, "vcom_cds", 1400); }
|
SECTION("vcom_cds") { test_dac(defs::VCOM_CDS, "vcom_cds", 1400); }
|
||||||
SECTION("vref_rstore") { test_dac(defs::VREF_RSTORE, "vref_rstore", 640); }
|
SECTION("vref_rstore") {
|
||||||
|
test_dac(defs::VREF_RSTORE, "vref_rstore", 640);
|
||||||
|
}
|
||||||
SECTION("vb_opa_1st") { test_dac(defs::VB_OPA_1ST, "vb_opa_1st", 0); }
|
SECTION("vb_opa_1st") { test_dac(defs::VB_OPA_1ST, "vb_opa_1st", 0); }
|
||||||
SECTION("vref_comp_fe") { test_dac(defs::VREF_COMP_FE, "vref_comp_fe", 0); }
|
SECTION("vref_comp_fe") {
|
||||||
|
test_dac(defs::VREF_COMP_FE, "vref_comp_fe", 0);
|
||||||
|
}
|
||||||
SECTION("vcom_adc1") { test_dac(defs::VCOM_ADC1, "vcom_adc1", 1400); }
|
SECTION("vcom_adc1") { test_dac(defs::VCOM_ADC1, "vcom_adc1", 1400); }
|
||||||
SECTION("vref_prech") { test_dac(defs::VREF_PRECH, "vref_prech", 1720); }
|
SECTION("vref_prech") {
|
||||||
|
test_dac(defs::VREF_PRECH, "vref_prech", 1720);
|
||||||
|
}
|
||||||
SECTION("vref_l_adc") { test_dac(defs::VREF_L_ADC, "vref_l_adc", 700); }
|
SECTION("vref_l_adc") { test_dac(defs::VREF_L_ADC, "vref_l_adc", 700); }
|
||||||
SECTION("vref_cds") { test_dac(defs::VREF_CDS, "vref_cds", 1200); }
|
SECTION("vref_cds") { test_dac(defs::VREF_CDS, "vref_cds", 1200); }
|
||||||
SECTION("vb_cs") { test_dac(defs::VB_CS, "vb_cs", 2799); }
|
SECTION("vb_cs") { test_dac(defs::VB_CS, "vb_cs", 2799); }
|
||||||
@ -178,7 +191,9 @@ TEST_CASE("vchip_comp_fe", "[.cmd][.onchipdacs][.new]") {
|
|||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
SECTION("vchip_comp_fe") { test_onchip_dac(defs::VB_COMP_FE, "vchip_comp_fe", 0x137); }
|
SECTION("vchip_comp_fe") {
|
||||||
|
test_onchip_dac(defs::VB_COMP_FE, "vchip_comp_fe", 0x137);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("vchip_comp_fe", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("vchip_comp_fe", {}, -1, GET));
|
||||||
}
|
}
|
||||||
@ -189,7 +204,9 @@ TEST_CASE("vchip_opa_1st", "[.cmd][.onchipdacs][.new]") {
|
|||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
SECTION("vchip_opa_1st") { test_onchip_dac(defs::VB_OPA_1ST, "vchip_opa_1st", 0x000); }
|
SECTION("vchip_opa_1st") {
|
||||||
|
test_onchip_dac(defs::VB_OPA_1ST, "vchip_opa_1st", 0x000);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("vchip_opa_1st", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("vchip_opa_1st", {}, -1, GET));
|
||||||
}
|
}
|
||||||
@ -200,7 +217,9 @@ TEST_CASE("vchip_opa_fd", "[.cmd][.onchipdacs][.new]") {
|
|||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
SECTION("vchip_opa_fd") { test_onchip_dac(defs::VB_OPA_FD, "vchip_opa_fd", 0x134); }
|
SECTION("vchip_opa_fd") {
|
||||||
|
test_onchip_dac(defs::VB_OPA_FD, "vchip_opa_fd", 0x134);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("vchip_opa_fd", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("vchip_opa_fd", {}, -1, GET));
|
||||||
}
|
}
|
||||||
@ -211,7 +230,9 @@ TEST_CASE("vchip_comp_adc", "[.cmd][.onchipdacs][.new]") {
|
|||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
SECTION("vchip_comp_adc") { test_onchip_dac(defs::VB_COMP_ADC, "vchip_comp_adc", 0x3FF); }
|
SECTION("vchip_comp_adc") {
|
||||||
|
test_onchip_dac(defs::VB_COMP_ADC, "vchip_comp_adc", 0x3FF);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("vchip_comp_adc", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("vchip_comp_adc", {}, -1, GET));
|
||||||
}
|
}
|
||||||
@ -222,7 +243,9 @@ TEST_CASE("vchip_ref_comp_fe", "[.cmd][.onchipdacs][.new]") {
|
|||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
SECTION("vchip_ref_comp_fe") { test_onchip_dac(defs::VREF_COMP_FE, "vchip_ref_comp_fe", 0x100); }
|
SECTION("vchip_ref_comp_fe") {
|
||||||
|
test_onchip_dac(defs::VREF_COMP_FE, "vchip_ref_comp_fe", 0x100);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("vchip_ref_comp_fe", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("vchip_ref_comp_fe", {}, -1, GET));
|
||||||
}
|
}
|
||||||
@ -239,22 +262,6 @@ TEST_CASE("vchip_cs", "[.cmd][.onchipdacs][.new]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("burstmode", "[.cmd]") {
|
TEST_CASE("burstmode", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
@ -286,7 +293,6 @@ TEST_CASE("burstmode", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("vetoref", "[.cmd]") {
|
TEST_CASE("vetoref", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
@ -294,14 +300,14 @@ TEST_CASE("vetoref", "[.cmd]") {
|
|||||||
|
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
REQUIRE_THROWS(proxy.Call("vetoref", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("vetoref", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vetoref", {"3", "0x3ff"}, -1, PUT)); // invalid chip index
|
REQUIRE_THROWS(proxy.Call("vetoref", {"3", "0x3ff"}, -1,
|
||||||
|
PUT)); // invalid chip index
|
||||||
REQUIRE_NOTHROW(proxy.Call("vetoref", {"1", "0x010"}, -1, PUT));
|
REQUIRE_NOTHROW(proxy.Call("vetoref", {"1", "0x010"}, -1, PUT));
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("vetoref", {"3", "0x0"}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("vetoref", {"3", "0x0"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("vetophoton", "[.cmd]") {
|
TEST_CASE("vetophoton", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
@ -310,16 +316,17 @@ TEST_CASE("vetophoton", "[.cmd]") {
|
|||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
REQUIRE_THROWS(proxy.Call("vetophoton", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("vetophoton", {}, -1, GET));
|
||||||
REQUIRE_NOTHROW(proxy.Call("vetophoton", {"-1"}, -1, GET));
|
REQUIRE_NOTHROW(proxy.Call("vetophoton", {"-1"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"12", "1", "39950"}, -1, PUT));// invalid chip index
|
REQUIRE_THROWS(proxy.Call("vetophoton", {"12", "1", "39950"}, -1,
|
||||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1", "0"}, -1, PUT)); // invalid photon number
|
PUT)); // invalid chip index
|
||||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1", "1", "39950"}, -1, PUT)); // invald file
|
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1", "0"}, -1,
|
||||||
|
PUT)); // invalid photon number
|
||||||
|
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1", "1", "39950"}, -1,
|
||||||
|
PUT)); // invald file
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1"}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1"}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("inj_ch", "[.cmd]") {
|
TEST_CASE("inj_ch", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
@ -327,8 +334,10 @@ TEST_CASE("inj_ch", "[.cmd]") {
|
|||||||
|
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
auto inj = det.getInjectChannel();
|
auto inj = det.getInjectChannel();
|
||||||
REQUIRE_THROWS(proxy.Call("inj_ch", {"-1", "1"}, -1, PUT));// invalid offset
|
REQUIRE_THROWS(
|
||||||
REQUIRE_THROWS(proxy.Call("inj_ch", {"0", "0"}, -1, PUT));// invalid increment
|
proxy.Call("inj_ch", {"-1", "1"}, -1, PUT)); // invalid offset
|
||||||
|
REQUIRE_THROWS(
|
||||||
|
proxy.Call("inj_ch", {"0", "0"}, -1, PUT)); // invalid increment
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("inj_ch", {"0", "1"}, -1, PUT, oss);
|
proxy.Call("inj_ch", {"0", "1"}, -1, PUT, oss);
|
||||||
@ -347,9 +356,6 @@ TEST_CASE("inj_ch", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("burstperiod", "[.cmd]") {
|
TEST_CASE("burstperiod", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
@ -372,7 +378,6 @@ TEST_CASE("burstperiod", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("currentsource", "[.cmd]") {
|
TEST_CASE("currentsource", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
|
@ -16,7 +16,8 @@ using test::PUT;
|
|||||||
/* dacs */
|
/* dacs */
|
||||||
|
|
||||||
TEST_CASE("Setting and reading back Jungfrau dacs", "[.cmd][.dacs][.new]") {
|
TEST_CASE("Setting and reading back Jungfrau dacs", "[.cmd][.dacs][.new]") {
|
||||||
// vb_comp, vdd_prot, vin_com, vref_prech, vb_pixbuf, vb_ds, vref_ds, vref_comp
|
// vb_comp, vdd_prot, vin_com, vref_prech, vb_pixbuf, vb_ds, vref_ds,
|
||||||
|
// vref_comp
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
@ -24,7 +25,9 @@ TEST_CASE("Setting and reading back Jungfrau dacs", "[.cmd][.dacs][.new]") {
|
|||||||
SECTION("vb_comp") { test_dac(defs::VB_COMP, "vb_comp", 1220); }
|
SECTION("vb_comp") { test_dac(defs::VB_COMP, "vb_comp", 1220); }
|
||||||
SECTION("vdd_prot") { test_dac(defs::VDD_PROT, "vdd_prot", 3000); }
|
SECTION("vdd_prot") { test_dac(defs::VDD_PROT, "vdd_prot", 3000); }
|
||||||
SECTION("vin_com") { test_dac(defs::VIN_COM, "vin_com", 1053); }
|
SECTION("vin_com") { test_dac(defs::VIN_COM, "vin_com", 1053); }
|
||||||
SECTION("vref_prech") { test_dac(defs::VREF_PRECH, "vref_prech", 1450); }
|
SECTION("vref_prech") {
|
||||||
|
test_dac(defs::VREF_PRECH, "vref_prech", 1450);
|
||||||
|
}
|
||||||
SECTION("vb_pixbuf") { test_dac(defs::VB_PIXBUF, "vb_pixbuf", 750); }
|
SECTION("vb_pixbuf") { test_dac(defs::VB_PIXBUF, "vb_pixbuf", 750); }
|
||||||
SECTION("vb_ds") { test_dac(defs::VB_DS, "vb_ds", 1000); }
|
SECTION("vb_ds") { test_dac(defs::VB_DS, "vb_ds", 1000); }
|
||||||
SECTION("vref_ds") { test_dac(defs::VREF_DS, "vref_ds", 480); }
|
SECTION("vref_ds") { test_dac(defs::VREF_DS, "vref_ds", 480); }
|
||||||
@ -91,38 +94,6 @@ TEST_CASE("Setting and reading back Jungfrau dacs", "[.cmd][.dacs][.new]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("nframes", "[.cmd]") {
|
TEST_CASE("nframes", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
@ -234,5 +205,3 @@ TEST_CASE("resetfpga", "[.cmd]") {
|
|||||||
REQUIRE_THROWS(proxy.Call("resetfpga", {}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("resetfpga", {}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,13 +18,16 @@ using test::PUT;
|
|||||||
/* dacs */
|
/* dacs */
|
||||||
|
|
||||||
TEST_CASE("Setting and reading back MOENCH dacs", "[.cmd][.dacs][.new]") {
|
TEST_CASE("Setting and reading back MOENCH dacs", "[.cmd][.dacs][.new]") {
|
||||||
// vbp_colbuf, vipre, vin_cm", vb_sda, vcasc_sfp, vout_cm, vipre_cds, ibias_sfp
|
// vbp_colbuf, vipre, vin_cm", vb_sda, vcasc_sfp, vout_cm, vipre_cds,
|
||||||
|
// ibias_sfp
|
||||||
|
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::MOENCH) {
|
if (det_type == defs::MOENCH) {
|
||||||
SECTION("vbp_colbuf") { test_dac(defs::VBP_COLBUF, "vbp_colbuf", 1300); }
|
SECTION("vbp_colbuf") {
|
||||||
|
test_dac(defs::VBP_COLBUF, "vbp_colbuf", 1300);
|
||||||
|
}
|
||||||
SECTION("vipre") { test_dac(defs::VIPRE, "vipre", 1000); }
|
SECTION("vipre") { test_dac(defs::VIPRE, "vipre", 1000); }
|
||||||
SECTION("vin_cm") { test_dac(defs::VIN_CM, "vin_cm", 1400); }
|
SECTION("vin_cm") { test_dac(defs::VIN_CM, "vin_cm", 1400); }
|
||||||
SECTION("vb_sda") { test_dac(defs::VB_SDA, "vb_sda", 680); }
|
SECTION("vb_sda") { test_dac(defs::VB_SDA, "vb_sda", 680); }
|
||||||
|
@ -89,22 +89,6 @@ TEST_CASE("Setting and reading back MYTHEN3 dacs", "[.cmd][.dacs][.new]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("counters", "[.cmd]") {
|
TEST_CASE("counters", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
|
@ -106,7 +106,6 @@ TEST_CASE("rx_framescaught", "[.cmd][.rx][.new]") {
|
|||||||
// proxy.Call("rx_framescaught", {}, -1, GET, oss);
|
// proxy.Call("rx_framescaught", {}, -1, GET, oss);
|
||||||
// REQUIRE(oss.str() == "rx_framescaught 1\n");
|
// REQUIRE(oss.str() == "rx_framescaught 1\n");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("rx_missingpackets", "[.cmd][.rx][.new]") {
|
TEST_CASE("rx_missingpackets", "[.cmd][.rx][.new]") {
|
||||||
@ -141,7 +140,6 @@ TEST_CASE("rx_printconfig", "[.cmd][.rx][.new]") {
|
|||||||
REQUIRE_NOTHROW(proxy.Call("rx_printconfig", {}, -1, GET));
|
REQUIRE_NOTHROW(proxy.Call("rx_printconfig", {}, -1, GET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Receiver Config */
|
/* Receiver Config */
|
||||||
|
|
||||||
TEST_CASE("rx_hostname", "[.cmd][.rx][.new]") {
|
TEST_CASE("rx_hostname", "[.cmd][.rx][.new]") {
|
||||||
@ -149,7 +147,8 @@ TEST_CASE("rx_hostname", "[.cmd][.rx][.new]") {
|
|||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto prev_val = det.getRxHostname();
|
auto prev_val = det.getRxHostname();
|
||||||
|
|
||||||
// Cannot set rx_hostname (will reset parameters in rxr and no shm variables to update)
|
// Cannot set rx_hostname (will reset parameters in rxr and no shm variables
|
||||||
|
// to update)
|
||||||
// {
|
// {
|
||||||
// // disable receiver
|
// // disable receiver
|
||||||
// std::ostringstream oss;
|
// std::ostringstream oss;
|
||||||
@ -304,7 +303,8 @@ TEST_CASE("rx_padding", "[.cmd][.rx][.new]") {
|
|||||||
TEST_CASE("rx_udpsocksize", "[.cmd][.rx][.new]") {
|
TEST_CASE("rx_udpsocksize", "[.cmd][.rx][.new]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
int64_t prev_val = det.getRxUDPSocketBufferSize().tsquash("Need same udp socket buffer size to test");
|
int64_t prev_val = det.getRxUDPSocketBufferSize().tsquash(
|
||||||
|
"Need same udp socket buffer size to test");
|
||||||
std::string s_new_val = std::to_string(prev_val - 1000);
|
std::string s_new_val = std::to_string(prev_val - 1000);
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
@ -683,7 +683,9 @@ TEST_CASE("rx_dbitlist", "[.cmd][.rx][.new]") {
|
|||||||
auto prev_val = det.getRxDbitList();
|
auto prev_val = det.getRxDbitList();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("rx_dbitlist", {"0", "4", "5", "8", "9", "10", "52", "63"}, -1, PUT, oss);
|
proxy.Call("rx_dbitlist",
|
||||||
|
{"0", "4", "5", "8", "9", "10", "52", "63"}, -1, PUT,
|
||||||
|
oss);
|
||||||
REQUIRE(oss.str() == "rx_dbitlist [0, 4, 5, 8, 9, 10, 52, 63]\n");
|
REQUIRE(oss.str() == "rx_dbitlist [0, 4, 5, 8, 9, 10, 52, 63]\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -745,7 +747,8 @@ TEST_CASE("rx_jsonaddheader", "[.cmd][.rx][.new]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("rx_jsonaddheader", {"key1", "value1", "key2", "value2"}, -1, PUT, oss);
|
proxy.Call("rx_jsonaddheader", {"key1", "value1", "key2", "value2"}, -1,
|
||||||
|
PUT, oss);
|
||||||
REQUIRE(oss.str() == "rx_jsonaddheader {key1: value1, key2: value2}\n");
|
REQUIRE(oss.str() == "rx_jsonaddheader {key1: value1, key2: value2}\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
#include "Detector.h"
|
#include "Detector.h"
|
||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
|
#include <chrono>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <chrono>
|
|
||||||
|
|
||||||
#include "tests/globals.h"
|
#include "tests/globals.h"
|
||||||
|
|
||||||
@ -37,7 +37,8 @@ TEST_CASE("parameters", "[.cmd][.new]") {
|
|||||||
// put only
|
// put only
|
||||||
REQUIRE_THROWS(proxy.Call("parameters", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("parameters", {}, -1, GET));
|
||||||
/*
|
/*
|
||||||
auto prev_val = det.getNumberOfFrames().tsquash("Number of frames has to be same to test");
|
auto prev_val = det.getNumberOfFrames().tsquash("Number of frames has to
|
||||||
|
be same to test");
|
||||||
{
|
{
|
||||||
system("echo 'frames 2' > /tmp/tempsetup.det ");
|
system("echo 'frames 2' > /tmp/tempsetup.det ");
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
@ -196,7 +197,8 @@ TEST_CASE("settings", "[.cmd][.new]") {
|
|||||||
TEST_CASE("frames", "[.cmd][.new]") {
|
TEST_CASE("frames", "[.cmd][.new]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto prev_val = det.getNumberOfFrames().tsquash("#frames must be same to test");
|
auto prev_val =
|
||||||
|
det.getNumberOfFrames().tsquash("#frames must be same to test");
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("frames", {"1000"}, -1, PUT, oss);
|
proxy.Call("frames", {"1000"}, -1, PUT, oss);
|
||||||
@ -219,7 +221,8 @@ TEST_CASE("frames", "[.cmd][.new]") {
|
|||||||
TEST_CASE("triggers", "[.cmd][.new]") {
|
TEST_CASE("triggers", "[.cmd][.new]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto prev_val = det.getNumberOfTriggers().tsquash("#triggers must be same to test");
|
auto prev_val =
|
||||||
|
det.getNumberOfTriggers().tsquash("#triggers must be same to test");
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("triggers", {"1000"}, -1, PUT, oss);
|
proxy.Call("triggers", {"1000"}, -1, PUT, oss);
|
||||||
@ -468,10 +471,8 @@ TEST_CASE("adcphase", "[.cmd][.new]") {
|
|||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::GOTTHARD ||
|
if (det_type == defs::GOTTHARD || det_type == defs::JUNGFRAU ||
|
||||||
det_type == defs::JUNGFRAU ||
|
det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
|
||||||
det_type == defs::CHIPTESTBOARD ||
|
|
||||||
det_type == defs::MOENCH) {
|
|
||||||
if (det_type == defs::GOTTHARD) {
|
if (det_type == defs::GOTTHARD) {
|
||||||
std::ostringstream oss1;
|
std::ostringstream oss1;
|
||||||
proxy.Call("adcphase", {"20"}, -1, PUT, oss1);
|
proxy.Call("adcphase", {"20"}, -1, PUT, oss1);
|
||||||
@ -509,8 +510,7 @@ TEST_CASE("maxadcphaseshift", "[.cmd][.new]") {
|
|||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU ||
|
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD ||
|
||||||
det_type == defs::CHIPTESTBOARD ||
|
|
||||||
det_type == defs::MOENCH ||
|
det_type == defs::MOENCH ||
|
||||||
det_type == defs::MYTHEN3 || // only because clk index of 0 exists
|
det_type == defs::MYTHEN3 || // only because clk index of 0 exists
|
||||||
det_type == defs::GOTTHARD2) { // only because clk index of 0 exists
|
det_type == defs::GOTTHARD2) { // only because clk index of 0 exists
|
||||||
@ -524,8 +524,7 @@ TEST_CASE("dbitphase", "[.cmd][.new]") {
|
|||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU ||
|
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD) {
|
||||||
det_type == defs::CHIPTESTBOARD) {
|
|
||||||
auto prev_val = det.getDBITPhase();
|
auto prev_val = det.getDBITPhase();
|
||||||
{
|
{
|
||||||
std::ostringstream oss1, oss2;
|
std::ostringstream oss1, oss2;
|
||||||
@ -554,8 +553,7 @@ TEST_CASE("maxdbitphaseshift", "[.cmd][.new]") {
|
|||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU ||
|
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD ||
|
||||||
det_type == defs::CHIPTESTBOARD ||
|
|
||||||
det_type == defs::MYTHEN3 || // only because clk index of 0 exists
|
det_type == defs::MYTHEN3 || // only because clk index of 0 exists
|
||||||
det_type == defs::GOTTHARD2) { // only because clk index of 0 exists
|
det_type == defs::GOTTHARD2) { // only because clk index of 0 exists
|
||||||
REQUIRE_NOTHROW(proxy.Call("maxdbitphaseshift", {}, -1, GET));
|
REQUIRE_NOTHROW(proxy.Call("maxdbitphaseshift", {}, -1, GET));
|
||||||
@ -654,7 +652,6 @@ TEST_CASE("maxclkphaseshift", "[.cmd][.new]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("vhighvoltage", "[.cmd][.new]") {
|
TEST_CASE("vhighvoltage", "[.cmd][.new]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
@ -679,8 +676,7 @@ TEST_CASE("vhighvoltage", "[.cmd][.new]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// range 0, 60 - 200
|
// range 0, 60 - 200
|
||||||
else if (det_type == defs::JUNGFRAU ||
|
else if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD ||
|
||||||
det_type == defs::CHIPTESTBOARD ||
|
|
||||||
det_type == defs::MOENCH) {
|
det_type == defs::MOENCH) {
|
||||||
REQUIRE_THROWS(proxy.Call("vhighvoltage", {"50"}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("vhighvoltage", {"50"}, -1, PUT));
|
||||||
{
|
{
|
||||||
@ -761,10 +757,8 @@ TEST_CASE("powerchip", "[.cmd][.new]") {
|
|||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::JUNGFRAU ||
|
if (det_type == defs::JUNGFRAU || det_type == defs::MYTHEN3 ||
|
||||||
det_type == defs::MYTHEN3 ||
|
det_type == defs::GOTTHARD2 || det_type == defs::MOENCH) {
|
||||||
det_type == defs::GOTTHARD2 ||
|
|
||||||
det_type == defs::MOENCH) {
|
|
||||||
auto prev_val = det.getPowerChip();
|
auto prev_val = det.getPowerChip();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
@ -812,8 +806,7 @@ TEST_CASE("imagetest", "[.cmd][.new]") {
|
|||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setImageTestMode(prev_val[i], {i});
|
det.setImageTestMode(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else if (det_type != defs::JUNGFRAU &&
|
} else if (det_type != defs::JUNGFRAU && det_type != defs::EIGER) {
|
||||||
det_type != defs::EIGER) {
|
|
||||||
// wont fail for eiger and jungfrau virtual servers
|
// wont fail for eiger and jungfrau virtual servers
|
||||||
REQUIRE_THROWS(proxy.Call("imagetest", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("imagetest", {}, -1, GET));
|
||||||
}
|
}
|
||||||
@ -965,44 +958,6 @@ TEST_CASE("startingfnum", "[.cmd][.new]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("initialchecks", "[.cmd]") {
|
TEST_CASE("initialchecks", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
@ -1032,7 +987,6 @@ TEST_CASE("initialchecks", "[.cmd]") {
|
|||||||
det.setInitialChecks(check);
|
det.setInitialChecks(check);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("user", "[.cmd]") {
|
TEST_CASE("user", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
@ -1313,7 +1267,6 @@ TEST_CASE("stopport", "[.cmd]") {
|
|||||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("rx_jsonaddheader \"\"", PUT));
|
// REQUIRE_NOTHROW(multiSlsDetectorClient("rx_jsonaddheader \"\"", PUT));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
// TEST_CASE("patsetbit", "[.cmd][.ctb]") {
|
// TEST_CASE("patsetbit", "[.cmd][.ctb]") {
|
||||||
// if (test::type == defs::CHIPTESTBOARD) {
|
// if (test::type == defs::CHIPTESTBOARD) {
|
||||||
// uint64_t val = 0;
|
// uint64_t val = 0;
|
||||||
@ -1932,8 +1885,6 @@ TEST_CASE("stopport", "[.cmd]") {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TEST_CASE("romode", "[.cmd][.ctb]") {
|
// TEST_CASE("romode", "[.cmd][.ctb]") {
|
||||||
// if (test::type == defs::CHIPTESTBOARD) {
|
// if (test::type == defs::CHIPTESTBOARD) {
|
||||||
// {
|
// {
|
||||||
@ -2415,8 +2366,6 @@ TEST_CASE("stopport", "[.cmd]") {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TEST_CASE("trimval", "[.cmd][.eiger]") {
|
// TEST_CASE("trimval", "[.cmd][.eiger]") {
|
||||||
// if (test::type == defs::EIGER) {
|
// if (test::type == defs::EIGER) {
|
||||||
// {
|
// {
|
||||||
@ -2460,8 +2409,6 @@ TEST_CASE("stopport", "[.cmd]") {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TEST_CASE("parallel", "[.cmd][.eiger]") {
|
// TEST_CASE("parallel", "[.cmd][.eiger]") {
|
||||||
// if (test::type == defs::EIGER) {
|
// if (test::type == defs::EIGER) {
|
||||||
// {
|
// {
|
||||||
@ -2556,7 +2503,9 @@ TEST_CASE("zmqport", "[.cmd]") {
|
|||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("zmqport", {}, i, GET, oss);
|
proxy.Call("zmqport", {}, i, GET, oss);
|
||||||
REQUIRE(oss.str() == "zmqport " + std::to_string(port + i * socketsperdetector) + '\n');
|
REQUIRE(oss.str() == "zmqport " +
|
||||||
|
std::to_string(port + i * socketsperdetector) +
|
||||||
|
'\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
port = 1954;
|
port = 1954;
|
||||||
@ -2569,18 +2518,15 @@ TEST_CASE("zmqport", "[.cmd]") {
|
|||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("zmqport", {}, i, GET, oss);
|
proxy.Call("zmqport", {}, i, GET, oss);
|
||||||
REQUIRE(oss.str() == "zmqport " + std::to_string(port + i * socketsperdetector) + '\n');
|
REQUIRE(oss.str() == "zmqport " +
|
||||||
|
std::to_string(port + i * socketsperdetector) +
|
||||||
|
'\n');
|
||||||
}
|
}
|
||||||
if (det_type == defs::JUNGFRAU) {
|
if (det_type == defs::JUNGFRAU) {
|
||||||
det.setNumberofUDPInterfaces(prev);
|
det.setNumberofUDPInterfaces(prev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TEST_CASE("txndelay", "[.cmd][.eiger][.jungfrau]") {
|
// TEST_CASE("txndelay", "[.cmd][.eiger][.jungfrau]") {
|
||||||
// if (test::type == defs::EIGER) {
|
// if (test::type == defs::EIGER) {
|
||||||
// {
|
// {
|
||||||
@ -2823,8 +2769,6 @@ TEST_CASE("zmqport", "[.cmd]") {
|
|||||||
// REQUIRE_THROWS(multiSlsDetectorClient("numinterfaces 0", PUT));
|
// REQUIRE_THROWS(multiSlsDetectorClient("numinterfaces 0", PUT));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TEST_CASE("adc", "[.cmd][.ctb]") {
|
// TEST_CASE("adc", "[.cmd][.ctb]") {
|
||||||
// if (test::type != defs::CHIPTESTBOARD) {
|
// if (test::type != defs::CHIPTESTBOARD) {
|
||||||
// REQUIRE_THROWS(multiSlsDetectorClient("adc 8", GET));
|
// REQUIRE_THROWS(multiSlsDetectorClient("adc 8", GET));
|
||||||
@ -2838,9 +2782,6 @@ TEST_CASE("zmqport", "[.cmd]") {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TEST_CASE("syncclk", "[.cmd][.ctb]") {
|
// TEST_CASE("syncclk", "[.cmd][.ctb]") {
|
||||||
// if(test::type != defs::CHIPTESTBOARD) {
|
// if(test::type != defs::CHIPTESTBOARD) {
|
||||||
// REQUIRE_THROWS(multiSlsDetectorClient("syncclk", GET));
|
// REQUIRE_THROWS(multiSlsDetectorClient("syncclk", GET));
|
||||||
@ -2934,8 +2875,6 @@ TEST_CASE("zmqport", "[.cmd]") {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TEST_CASE("threshold", "[.cmd]") {
|
// TEST_CASE("threshold", "[.cmd]") {
|
||||||
// if (test::type == defs::EIGER) {
|
// if (test::type == defs::EIGER) {
|
||||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("threshold 6400 standard",
|
// REQUIRE_NOTHROW(multiSlsDetectorClient("threshold 6400 standard",
|
||||||
@ -2964,7 +2903,6 @@ TEST_CASE("zmqport", "[.cmd]") {
|
|||||||
// CHECK_NOTHROW(multiSlsDetectorClient("type", GET));
|
// CHECK_NOTHROW(multiSlsDetectorClient("type", GET));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
// TEST_CASE("status", "[.cmd]") {
|
// TEST_CASE("status", "[.cmd]") {
|
||||||
// Detector det;
|
// Detector det;
|
||||||
// CmdProxy proxy(&det);
|
// CmdProxy proxy(&det);
|
||||||
@ -2999,11 +2937,6 @@ TEST_CASE("zmqport", "[.cmd]") {
|
|||||||
// proxy.Call("frames", {"1"}, -1, PUT);
|
// proxy.Call("frames", {"1"}, -1, PUT);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("lock", "[.cmd]") {
|
TEST_CASE("lock", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
@ -3027,8 +2960,3 @@ TEST_CASE("lock", "[.cmd]") {
|
|||||||
// TEST_CASE("lastclient", "[.cmd]") {
|
// TEST_CASE("lastclient", "[.cmd]") {
|
||||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("lastclient", GET));
|
// REQUIRE_NOTHROW(multiSlsDetectorClient("lastclient", GET));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "Result.h"
|
#include "Result.h"
|
||||||
|
#include "ToString.h"
|
||||||
#include "TypeTraits.h"
|
#include "TypeTraits.h"
|
||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "ToString.h"
|
|
||||||
|
|
||||||
using sls::Result;
|
using sls::Result;
|
||||||
|
|
||||||
@ -41,7 +41,6 @@ TEST_CASE("Result can be iterated using modern syntax"){
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
for (const auto &r : res)
|
for (const auto &r : res)
|
||||||
REQUIRE(r == i++);
|
REQUIRE(r == i++);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Calling squash on an empty Result produces default value") {
|
TEST_CASE("Calling squash on an empty Result produces default value") {
|
||||||
@ -136,7 +135,6 @@ TEST_CASE("Convert from Result<int> to Result<ns>") {
|
|||||||
REQUIRE(res2[2] == ns(236));
|
REQUIRE(res2[2] == ns(236));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("Result of vectors") {
|
TEST_CASE("Result of vectors") {
|
||||||
using VecVec = std::vector<std::vector<int>>;
|
using VecVec = std::vector<std::vector<int>>;
|
||||||
VecVec vecvec{{1, 2, 3}, {4, 5, 6}};
|
VecVec vecvec{{1, 2, 3}, {4, 5, 6}};
|
||||||
@ -163,7 +161,6 @@ TEST_CASE("Printing Result<std::string>"){
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << res;
|
os << res;
|
||||||
REQUIRE(os.str() == "[ein, zwei, drei]");
|
REQUIRE(os.str() == "[ein, zwei, drei]");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Printing Result<int>") {
|
TEST_CASE("Printing Result<int>") {
|
||||||
@ -171,7 +168,6 @@ TEST_CASE("Printing Result<int>"){
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << res;
|
os << res;
|
||||||
REQUIRE(os.str() == "[1, 2, 3]");
|
REQUIRE(os.str() == "[1, 2, 3]");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("String conversions") {
|
TEST_CASE("String conversions") {
|
||||||
@ -194,5 +190,6 @@ TEST_CASE("String conversions"){
|
|||||||
m2["three"] = "3";
|
m2["three"] = "3";
|
||||||
|
|
||||||
Result<Smap> res4{m, m2, m};
|
Result<Smap> res4{m, m2, m};
|
||||||
REQUIRE(ToString(res4) == "[{one: 1}, {one: 1, three: 3, two: 2}, {one: 1}]");
|
REQUIRE(ToString(res4) ==
|
||||||
|
"[{one: 1}, {one: 1, three: 3, two: 2}, {one: 1}]");
|
||||||
}
|
}
|
||||||
|
5
slsDetectorSoftware/tests/test-SharedMemory.cpp
Executable file → Normal file
5
slsDetectorSoftware/tests/test-SharedMemory.cpp
Executable file → Normal file
@ -104,10 +104,9 @@ TEST_CASE("Move SharedMemory", "[detector]") {
|
|||||||
CHECK(shm() == nullptr);
|
CHECK(shm() == nullptr);
|
||||||
CHECK(shm.size() == 0);
|
CHECK(shm.size() == 0);
|
||||||
|
|
||||||
CHECK(shm2.GetName() == std::string("/slsDetectorPackage_multi_") +
|
CHECK(shm2.GetName() ==
|
||||||
std::to_string(shm_id));
|
std::string("/slsDetectorPackage_multi_") + std::to_string(shm_id));
|
||||||
shm2.RemoveSharedMemory();
|
shm2.RemoveSharedMemory();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Create several shared memories", "[detector]") {
|
TEST_CASE("Create several shared memories", "[detector]") {
|
||||||
|
9
slsDetectorSoftware/tests/test-slsDetector.cpp
Executable file → Normal file
9
slsDetectorSoftware/tests/test-slsDetector.cpp
Executable file → Normal file
@ -7,8 +7,6 @@
|
|||||||
// #include <algorithm>
|
// #include <algorithm>
|
||||||
// #include <iostream>
|
// #include <iostream>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TEST_CASE("Set and get trimen", "[detector]") {
|
// TEST_CASE("Set and get trimen", "[detector]") {
|
||||||
// // Free shared memory to be sure that we start in a clean state
|
// // Free shared memory to be sure that we start in a clean state
|
||||||
// slsDetector::freeSharedMemory(20, 20);
|
// slsDetector::freeSharedMemory(20, 20);
|
||||||
@ -188,12 +186,10 @@
|
|||||||
// d.setPartialFramesPadding(true);
|
// d.setPartialFramesPadding(true);
|
||||||
// CHECK(d.getPartialFramesPadding() == true);
|
// CHECK(d.getPartialFramesPadding() == true);
|
||||||
|
|
||||||
|
|
||||||
// d.freeSharedMemory();
|
// d.freeSharedMemory();
|
||||||
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
// TEST_CASE("create detParamets struct", "[detector][new]"){
|
// TEST_CASE("create detParamets struct", "[detector][new]"){
|
||||||
// detParameters par;
|
// detParameters par;
|
||||||
// CHECK(sizeof(par) == 32);
|
// CHECK(sizeof(par) == 32);
|
||||||
@ -206,7 +202,6 @@
|
|||||||
// CHECK(par.nGappixelsX == 0);
|
// CHECK(par.nGappixelsX == 0);
|
||||||
// CHECK(par.nGappixelsY == 0);
|
// CHECK(par.nGappixelsY == 0);
|
||||||
|
|
||||||
|
|
||||||
// detParameters par2{slsDetectorDefs::detectorType::EIGER};
|
// detParameters par2{slsDetectorDefs::detectorType::EIGER};
|
||||||
// CHECK(sizeof(par2) == 32);
|
// CHECK(sizeof(par2) == 32);
|
||||||
// CHECK(par2.nChanX == 256);
|
// CHECK(par2.nChanX == 256);
|
||||||
@ -219,7 +214,6 @@
|
|||||||
// CHECK(par2.nGappixelsY == 1);
|
// CHECK(par2.nGappixelsY == 1);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
// TEST_CASE("ctb digital offset and list", "[detector][ctb]"){
|
// TEST_CASE("ctb digital offset and list", "[detector][ctb]"){
|
||||||
// slsDetector::freeSharedMemory(20, 20);
|
// slsDetector::freeSharedMemory(20, 20);
|
||||||
// slsDetector d(slsDetectorDefs::detectorType::CHIPTESTBOARD, 20, 20);
|
// slsDetector d(slsDetectorDefs::detectorType::CHIPTESTBOARD, 20, 20);
|
||||||
@ -235,7 +229,6 @@
|
|||||||
// std::vector <int> list = d.getReceiverDbitList();
|
// std::vector <int> list = d.getReceiverDbitList();
|
||||||
// CHECK(list.empty());
|
// CHECK(list.empty());
|
||||||
|
|
||||||
|
|
||||||
// for (int i = 0; i < 10; ++i)
|
// for (int i = 0; i < 10; ++i)
|
||||||
// list.push_back(i);
|
// list.push_back(i);
|
||||||
// d.setReceiverDbitList(list);
|
// d.setReceiverDbitList(list);
|
||||||
@ -258,6 +251,4 @@
|
|||||||
// d.setReceiverDbitList(list);
|
// d.setReceiverDbitList(list);
|
||||||
// CHECK(d.getReceiverDbitList().empty());
|
// CHECK(d.getReceiverDbitList().empty());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
// }
|
@ -1,12 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
struct SingleDetectorConfig {
|
struct SingleDetectorConfig {
|
||||||
slsDetectorDefs::detectorType type_enum = slsDetectorDefs::detectorType::EIGER;
|
slsDetectorDefs::detectorType type_enum =
|
||||||
|
slsDetectorDefs::detectorType::EIGER;
|
||||||
const std::string hostname = "beb031+beb032+";
|
const std::string hostname = "beb031+beb032+";
|
||||||
const std::string type_string = "Eiger";
|
const std::string type_string = "Eiger";
|
||||||
const std::string my_ip = "129.129.205.171";
|
const std::string my_ip = "129.129.205.171";
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -12,5 +12,4 @@ extern std::string my_ip;
|
|||||||
extern decltype(defs::GET_ACTION) GET;
|
extern decltype(defs::GET_ACTION) GET;
|
||||||
extern decltype(defs::PUT_ACTION) PUT;
|
extern decltype(defs::PUT_ACTION) PUT;
|
||||||
|
|
||||||
|
|
||||||
} // namespace test
|
} // namespace test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user