mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-07 02:20:42 +02:00
clang-format
This commit is contained in:
parent
32662baef8
commit
959fd562d3
@ -9,7 +9,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
#include "CmdProxy.h"
|
||||
#include "Detector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
@ -52,5 +51,4 @@ int main() {
|
||||
auto help = replace_all(tmp, "\n\t", "\n\t\t");
|
||||
fs << '\t' << cmd << usage << help << "\n";
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
#include "catch.hpp"
|
||||
#include "DetectorImpl.h"
|
||||
#include "catch.hpp"
|
||||
#include "string_utils.h"
|
||||
#include "tests/globals.h"
|
||||
#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 "ClientSocket.h"
|
||||
#include "logger.h"
|
||||
#include "DetectorImpl.h"
|
||||
#include "Module.h"
|
||||
#include "logger.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#include "Timer.h"
|
||||
@ -79,7 +79,6 @@ TEST_CASE("Set control port then create a new object with this control port",
|
||||
d.freeSharedMemory();
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("single EIGER detector no receiver basic set and get",
|
||||
"[.integration][eiger]") {
|
||||
// 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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST_CASE("Locking mechanism and last ip", "[.integration][.single]") {
|
||||
Module d(test::type);
|
||||
d.setHostname(test::hostname);
|
||||
@ -160,7 +157,6 @@ TEST_CASE("Set settings", "[.integration][.single]"){
|
||||
CHECK(d.setSettings(defs::STANDARD) == defs::STANDARD);
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("Timer functions", "[.integration][cli]") {
|
||||
// FRAME_NUMBER, /**< number of real time frames: total number of
|
||||
// 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) {
|
||||
auto delay = 10000;
|
||||
d.setDelayAfterTrigger(delay);
|
||||
CHECK(d.getDelayAfterTrigger() ==
|
||||
delay);
|
||||
CHECK(d.getDelayAfterTrigger() == delay);
|
||||
}
|
||||
|
||||
auto triggers = 2;
|
||||
@ -221,7 +216,6 @@ TEST_CASE("Timer functions", "[.integration][cli]") {
|
||||
d.startAndReadAll();
|
||||
|
||||
d.freeSharedMemory();
|
||||
|
||||
}
|
||||
|
||||
// TEST_CASE("Aquire", "[.integration][eiger]"){
|
||||
@ -382,8 +376,8 @@ TEST_CASE("Chiptestboard Loading Patterns", "[.ctbintegration]") {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert", "[.ctbintegration][dbit]") {
|
||||
TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert",
|
||||
"[.ctbintegration][dbit]") {
|
||||
SingleDetectorConfig c;
|
||||
|
||||
// pick up multi detector from shm id 0
|
||||
@ -450,17 +444,20 @@ TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert", "[.ctbintegrat
|
||||
m.setExternalSampling(1);
|
||||
CHECK(m.getExternalSampling() == 1);
|
||||
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;
|
||||
|
||||
// pick up multi detector from shm id 0
|
||||
DetectorImpl m(0);
|
||||
|
||||
// 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);
|
||||
|
||||
CHECK(m.setNumberOfFrames(1) == 1);
|
||||
@ -498,7 +495,8 @@ TEST_CASE("Eiger readnlines", "[.eigerintegration][readnlines]") {
|
||||
DetectorImpl m(0);
|
||||
|
||||
// ensure detector type, hostname
|
||||
REQUIRE((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER));
|
||||
REQUIRE(
|
||||
(m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER));
|
||||
REQUIRE(m.getHostname() == c.hostname);
|
||||
|
||||
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 "catch.hpp"
|
||||
#include "string_utils.h"
|
||||
#include "tests/globals.h"
|
||||
#include <iostream>
|
||||
@ -24,8 +24,6 @@ TEST_CASE("Initialize a multi detector", "[.integration][.multi]") {
|
||||
d.freeSharedMemory();
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST_CASE("Set and read timers", "[.integration][.multi]") {
|
||||
|
||||
DetectorImpl d(0, true, true);
|
||||
@ -57,7 +55,6 @@ TEST_CASE("Set and read timers", "[.integration][.multi]") {
|
||||
// PROGRESS, /**< fraction of measurement elapsed - only get! */
|
||||
// MEASUREMENTS_NUMBER,
|
||||
|
||||
|
||||
// FRAMES_FROM_START,
|
||||
// FRAMES_FROM_START_PG,
|
||||
// SAMPLES,
|
||||
@ -78,7 +75,6 @@ TEST_CASE("Set and read timers", "[.integration][.multi]") {
|
||||
CHECK(d.setSubFrameExposureDeadTime(-1) == Approx(subframe_deadtime));
|
||||
}
|
||||
|
||||
|
||||
if (test::type == dt::EIGER) {
|
||||
// 32bit is needed for subframe exposure
|
||||
d.setDynamicRange(32);
|
||||
|
@ -3,10 +3,9 @@
|
||||
#include "network_utils.h"
|
||||
#include "sls_detector_defs.h"
|
||||
#include <chrono>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
|
||||
class detectorData;
|
||||
|
||||
@ -21,7 +20,6 @@ class IpAddr;
|
||||
// shm by mistake
|
||||
void freeSharedMemory(int multiId, int detPos = -1);
|
||||
|
||||
|
||||
/**
|
||||
* \class Detector
|
||||
*/
|
||||
@ -101,11 +99,12 @@ class Detector {
|
||||
/** [Jungfrau][Gotthard][Gotthard2] */
|
||||
Result<defs::detectorSettings> getSettings(Positions pos = {}) const;
|
||||
|
||||
/** [Jungfrau] Options:DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2
|
||||
* [Gotthard] Options: DYNAMICGAIN, HIGHGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN
|
||||
* [Gotthard2] Options: DYNAMICGAIN, FIXGAIN1, FIXGAIN2
|
||||
* [Moench] Options: G1_HIGHGAIN, G1_LOWGAIN, G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN,
|
||||
* G2_LOWCAP_HIGHGAIN, G2_LOWCAP_LOWGAIN, G4_HIGHGAIN, G4_LOWGAIN
|
||||
/** [Jungfrau] Options:DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2,
|
||||
* FORCESWITCHG1, FORCESWITCHG2 [Gotthard] Options: DYNAMICGAIN, HIGHGAIN,
|
||||
* LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN [Gotthard2] Options: DYNAMICGAIN,
|
||||
* FIXGAIN1, FIXGAIN2 [Moench] Options: G1_HIGHGAIN, G1_LOWGAIN,
|
||||
* G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN, G2_LOWCAP_HIGHGAIN,
|
||||
* G2_LOWCAP_LOWGAIN, G4_HIGHGAIN, G4_LOWGAIN
|
||||
*/
|
||||
void setSettings(defs::detectorSettings value, Positions pos = {});
|
||||
|
||||
@ -304,10 +303,12 @@ class Detector {
|
||||
void setDAC(defs::dacIndex index, int value, bool mV, Positions pos = {});
|
||||
|
||||
/* [Gotthard2] */
|
||||
Result<int> getOnChipDAC(defs::dacIndex index, int chipIndex, Positions pos = {}) const;
|
||||
Result<int> getOnChipDAC(defs::dacIndex index, int chipIndex,
|
||||
Positions pos = {}) const;
|
||||
|
||||
/* [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();
|
||||
|
||||
/** If acquisition aborted, use this to clear before starting next acquisition */
|
||||
/** If acquisition aborted, use this to clear before starting next
|
||||
* acquisition */
|
||||
void clearAcquiringFlag();
|
||||
|
||||
/** Non Blocking: Start receiver listener*/
|
||||
@ -348,7 +350,8 @@ class Detector {
|
||||
|
||||
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] */
|
||||
Result<uint64_t> getStartingFrameNumber(Positions pos = {}) const;
|
||||
@ -512,7 +515,8 @@ class Detector {
|
||||
* Validates and sets the receiver.
|
||||
* Updates local receiver cache parameters
|
||||
* 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 = {});
|
||||
|
||||
@ -659,10 +663,10 @@ class Detector {
|
||||
Result<int> getClientZmqPort(Positions pos = {}) const;
|
||||
|
||||
/**
|
||||
* Modified only when using an intermediate process between receiver and gui/client.
|
||||
* Module_id is -1 for all detectors, ports for each
|
||||
* module is calculated (increments) Restarts client zmq sockets only if it
|
||||
* was already enabled
|
||||
* Modified only when using an intermediate process between receiver and
|
||||
* gui/client. Module_id is -1 for all detectors, ports for each module is
|
||||
* calculated (increments) Restarts client zmq sockets only if it was
|
||||
* already enabled
|
||||
*/
|
||||
void setClientZmqPort(int port, int module_id = -1);
|
||||
|
||||
@ -915,7 +919,6 @@ class Detector {
|
||||
void setExternalSignalFlags(defs::externalSignalFlag value,
|
||||
Positions pos = {});
|
||||
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Gotthard2 Specific *
|
||||
@ -940,16 +943,21 @@ class Detector {
|
||||
/** [Gotthard2]
|
||||
* @param offsetChannel starting channel 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 */
|
||||
Result<std::vector<int>> getVetoPhoton(const int chipIndex, Positions pos = {});
|
||||
Result<std::vector<int>> getVetoPhoton(const int chipIndex,
|
||||
Positions pos = {});
|
||||
|
||||
/** [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] */
|
||||
void setVetoReference(const int gainIndex, const int value, Positions pos = {});
|
||||
void setVetoReference(const int gainIndex, const int value,
|
||||
Positions pos = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
Result<defs::burstMode> getBurstMode(Positions pos = {});
|
||||
@ -1150,21 +1158,26 @@ class Detector {
|
||||
* [Mythen3][Moench] */
|
||||
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
|
||||
*/
|
||||
Result<std::array<int, 2>> getPatternLoopAddresses(int level,
|
||||
Positions pos = {}) const;
|
||||
Result<std::array<int, 2>>
|
||||
getPatternLoopAddresses(int level, Positions pos = {}) const;
|
||||
|
||||
/** [CTB][Moench][Mythen3] Options: level: -1 (complete pattern) and 0-2 levels */
|
||||
void setPatternLoopAddresses(int level, int start, int stop, Positions pos = {});
|
||||
/** [CTB][Moench][Mythen3] Options: level: -1 (complete pattern) and 0-2
|
||||
* 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
|
||||
*/
|
||||
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 = {});
|
||||
|
||||
/* [CTB][Moench][Mythen3] */
|
||||
@ -1182,14 +1195,15 @@ class Detector {
|
||||
/** [CTB][Moench][Mythen3] */
|
||||
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 = {});
|
||||
|
||||
/** [CTB][Moench][Mythen3] */
|
||||
Result<uint64_t> getPatternBitMask(Positions pos = {}) const;
|
||||
|
||||
/** [CTB][Moench][Mythen3] Sets the bitmask that the mask will be applied to for every
|
||||
* pattern
|
||||
/** [CTB][Moench][Mythen3] Sets the bitmask that the mask will be applied to
|
||||
* for every pattern
|
||||
*/
|
||||
void setPatternBitMask(uint64_t mask, Positions pos = {});
|
||||
|
||||
@ -1200,10 +1214,13 @@ class Detector {
|
||||
* ************************************************/
|
||||
|
||||
/** [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 */
|
||||
void setAdditionalJsonHeader(const std::map<std::string, std::string> &jsonHeader,
|
||||
/** [Moench] If empty, reset additional json header. Max 20 characters for
|
||||
* each key/value */
|
||||
void setAdditionalJsonHeader(
|
||||
const std::map<std::string, std::string> &jsonHeader,
|
||||
Positions pos = {});
|
||||
|
||||
/** [Moench] */
|
||||
@ -1215,7 +1232,8 @@ class Detector {
|
||||
* else appends the parameter key and 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 = {});
|
||||
|
||||
/** [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
|
||||
* @param progress progress index
|
||||
* @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 d pointer to data in char* format
|
||||
* @param dbytes number of bytes of image pointed to by cval pointer
|
||||
@ -18,8 +19,11 @@ class detectorData {
|
||||
* @param fIndex file index
|
||||
* @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) :
|
||||
progressIndex(progress), fileName(fname), fileIndex(fIndex), nx(x), ny(y), data(d), databytes(dbytes), dynamicRange(dr), completeImage(complete) {};
|
||||
detectorData(double progress, std::string fname, int x, int y, char *d,
|
||||
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
|
||||
|
386
slsDetectorSoftware/include/slsDetectorUsers.h
Executable file → Normal file
386
slsDetectorSoftware/include/slsDetectorUsers.h
Executable file → Normal file
@ -1,18 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
// class detectorData;
|
||||
namespace sls
|
||||
{
|
||||
namespace sls {
|
||||
class Detector;
|
||||
}
|
||||
#include <memory>
|
||||
|
||||
|
||||
|
||||
class slsDetectorUsers {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* @param shm_id detector shared memory id
|
||||
* Default value is 0. Can be set to more values for
|
||||
@ -33,19 +29,20 @@ public:
|
||||
/** Gets the total number of detectors */
|
||||
int size() const;
|
||||
|
||||
|
||||
// /**
|
||||
// * Returns the size of detector/multi detector
|
||||
// * @param nx number of channels in horiziontal
|
||||
// * @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
|
||||
// */
|
||||
// int getDetectorSize(int &nx, int &ny, int detPos);
|
||||
|
||||
// /**
|
||||
// * 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
|
||||
// */
|
||||
// std::string getDetectorType(int detPos = -1);
|
||||
@ -72,21 +69,24 @@ public:
|
||||
|
||||
// /**
|
||||
// * 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
|
||||
// */
|
||||
// int64_t getDetectorFirmwareVersion(int detPos = -1);
|
||||
|
||||
// /**
|
||||
// * 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
|
||||
// */
|
||||
// int64_t getDetectorSerialNumber(int detPos = -1);
|
||||
|
||||
// /**
|
||||
// * 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
|
||||
// */
|
||||
// int64_t getDetectorSoftwareVersion(int detPos = -1);
|
||||
@ -100,27 +100,31 @@ public:
|
||||
|
||||
// /**
|
||||
// * 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
|
||||
// */
|
||||
// int64_t getReceiverSoftwareVersion(int detPos = -1);
|
||||
|
||||
// /**
|
||||
// * 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);
|
||||
|
||||
// /**
|
||||
// * 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);
|
||||
|
||||
// /**
|
||||
// * Performs a complete acquisition
|
||||
// * 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.
|
||||
// * @returns OK or FAIL depending on if it already started
|
||||
// */
|
||||
@ -128,13 +132,15 @@ public:
|
||||
|
||||
// /**
|
||||
// * 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);
|
||||
|
||||
// /**
|
||||
// * 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
|
||||
// */
|
||||
// int getDetectorStatus(int detPos = -1);
|
||||
@ -142,20 +148,23 @@ public:
|
||||
// /**
|
||||
// * (Advanced user, included in startMeasurement)
|
||||
// * 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);
|
||||
|
||||
// /**
|
||||
// * 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);
|
||||
|
||||
// /**
|
||||
// * (Only in non blocking acquire mode)
|
||||
// * 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);
|
||||
|
||||
@ -163,7 +172,8 @@ public:
|
||||
// * Set Rate correction ( Eiger)
|
||||
// * @param t (1) enable rate correction to default dead time,
|
||||
// * (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
|
||||
// */
|
||||
// int enableCountRateCorrection(int i = -1, int detPos = -1);
|
||||
@ -173,28 +183,34 @@ public:
|
||||
// * @param i dynamic range (-1 get)
|
||||
// * Options: Eiger(4, 8, 16, 32), Jungfrau(16), Gotthard(16)
|
||||
// * Background operation:
|
||||
// * (Eiger: If i is 32, also sets clkdivider to 2, if 16, sets clkdivider to 1)
|
||||
// * @param detPos -1 for all detectors in list or specific detector position
|
||||
// * (Eiger: If i is 32, also sets clkdivider to 2, if 16, sets clkdivider
|
||||
// to 1)
|
||||
// * @param detPos -1 for all detectors in list or specific detector
|
||||
// position
|
||||
// * @returns current dynamic range
|
||||
// */
|
||||
// int setBitDepth(int i = -1, int detPos = -1);
|
||||
|
||||
// /**
|
||||
// * 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)
|
||||
// * Options: (slsDetectorDefs::detectorSettings)
|
||||
// * 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)
|
||||
// * @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)
|
||||
// */
|
||||
// int setSettings(int isettings = -1, int detPos = -1);
|
||||
|
||||
// /**
|
||||
// * 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
|
||||
// */
|
||||
// int getThresholdEnergy(int detPos = -1);
|
||||
@ -204,62 +220,75 @@ public:
|
||||
// * @param e_eV threshold in eV
|
||||
// * @param tb 1 to load trimbits, 0 to exclude trimbits
|
||||
// * @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
|
||||
// */
|
||||
// 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
|
||||
// * @param t time (-1 gets)
|
||||
// * @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
|
||||
// */
|
||||
// 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
|
||||
// * @param t time (-1 gets)
|
||||
// * @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
|
||||
// */
|
||||
// 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))
|
||||
// * @param t time (-1 gets)
|
||||
// * @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
|
||||
// */
|
||||
// double setDelayAfterTrigger(double t = -1, bool inseconds = false, int detPos = -1);
|
||||
// double setDelayAfterTrigger(double t = -1, bool inseconds = false, int
|
||||
// detPos = -1);
|
||||
|
||||
// /**
|
||||
// * (Advanced users)
|
||||
// * Set/get sub frame exposure time (Eiger in 32 bit mode)
|
||||
// * @param t time (-1 gets)
|
||||
// * @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
|
||||
// */
|
||||
// double setSubFrameExposureTime(double t = -1, bool inseconds = false, int detPos = -1);
|
||||
// double setSubFrameExposureTime(double t = -1, bool inseconds = false, int
|
||||
// detPos = -1);
|
||||
|
||||
// /**
|
||||
// * (Advanced users)
|
||||
// * Set/get sub frame dead time (Eiger in 32 bit mode)
|
||||
// * @param t time (-1 gets)
|
||||
// * @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
|
||||
// */
|
||||
// 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
|
||||
// * @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
|
||||
// */
|
||||
// int64_t setNumberOfFrames(int64_t t = -1, int detPos = -1);
|
||||
@ -267,7 +296,8 @@ public:
|
||||
// /**
|
||||
// * Set/get number of triggers
|
||||
// * @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
|
||||
// */
|
||||
// int64_t setNumberOfTriggers(int64_t t = -1, int detPos = -1);
|
||||
@ -275,7 +305,8 @@ public:
|
||||
// /**
|
||||
// * Set/get number of additional storage cells (Jungfrau)
|
||||
// * @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
|
||||
// */
|
||||
// int64_t setNumberOfStorageCells(int64_t t = -1, int detPos = -1);
|
||||
@ -284,7 +315,8 @@ public:
|
||||
// * Get measured period between previous two frames (EIGER)
|
||||
// * @param t time (-1 gets)
|
||||
// * @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
|
||||
// */
|
||||
// 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)
|
||||
// * @param t time (-1 gets)
|
||||
// * @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
|
||||
// */
|
||||
// double getMeasuredSubFramePeriod(bool inseconds = false, int detPos = -1);
|
||||
// double getMeasuredSubFramePeriod(bool inseconds = false, int detPos =
|
||||
// -1);
|
||||
|
||||
// /**
|
||||
// * Set/get timing mode
|
||||
@ -305,7 +339,8 @@ public:
|
||||
// * (Eiger: AUTO_TIMING, TRIGGER_EXPOSURE, BURST_TRIGGER, GATED)
|
||||
// * (Jungfrau: 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
|
||||
// */
|
||||
// int setTimingMode(int pol = -1, int detPos = -1);
|
||||
@ -313,9 +348,12 @@ public:
|
||||
// /**
|
||||
// * Sets clock speed of the detector (Eiger, Jungfrau)
|
||||
// * (Jungfrau also writes adcphase to recommended default)
|
||||
// * (Eiger: 0(full speed not for 32 bit mode), 1 (half speed), 2(quarter speed))
|
||||
// * (Jungfrau: 0(full speed not implemented), 1(half speed), 2(quarter speed))
|
||||
// * @param detPos -1 for all detectors in list or specific detector position
|
||||
// * (Eiger: 0(full speed not for 32 bit mode), 1 (half speed), 2(quarter
|
||||
// speed))
|
||||
// * (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
|
||||
// */
|
||||
// int setClockDivider(int value, int detPos = -1);
|
||||
@ -324,7 +362,8 @@ public:
|
||||
// * Set parallel readout mode (Eiger)
|
||||
// * @param value readout mode (-1 gets)
|
||||
// * 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
|
||||
// */
|
||||
// int setParallelMode(bool value, int detPos = -1);
|
||||
@ -333,7 +372,8 @@ public:
|
||||
// * Set overflow readout mode (Eiger in 32 bit)
|
||||
// * @param value readout mode (-1 gets)
|
||||
// * 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
|
||||
// */
|
||||
// int setOverflowMode(bool value, int detPos = -1);
|
||||
@ -342,7 +382,8 @@ public:
|
||||
// * (Advanced user)
|
||||
// * Sets all the trimbits to a particular value (Eiger)
|
||||
// * @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
|
||||
// */
|
||||
// int setAllTrimbits(int val, int detPos = -1);
|
||||
@ -356,7 +397,8 @@ public:
|
||||
// * (Eiger: SVP up to IO_DELAY, THRESHOLD, HIGH_VOLTAGE)
|
||||
// * (Jungfrau: 0-7)
|
||||
// * (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
|
||||
// */
|
||||
// int setDAC(int val, int index , int detPos = -1);
|
||||
@ -368,24 +410,30 @@ public:
|
||||
// * (Eiger: TEMPERATURE_FPGA, TEMPERATURE_FPGAEXT upto TEMPERATURE_FPGA3)
|
||||
// * (Jungfrau: TEMPERATURE_FPGA)
|
||||
// * (Gotthard: TEMPERATURE_ADC, TEMPERATURE_FPGA)
|
||||
// * @param detPos -1 for all detectors in list or specific detector position
|
||||
// * @returns current adc value (temperature for eiger and jungfrau in millidegrees)
|
||||
// * @param detPos -1 for all detectors in list or specific detector
|
||||
// position
|
||||
// * @returns current adc value (temperature for eiger and jungfrau in
|
||||
// millidegrees)
|
||||
// */
|
||||
// int getADC(int index, int detPos = -1);
|
||||
|
||||
// /**
|
||||
// * Enable/disable or 10Gbe (Eiger)
|
||||
// * @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
|
||||
// */
|
||||
// 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 detPos -1 for all detectors in list or specific detector position
|
||||
// * @returns the storage cell that stores the first acquisition of the series
|
||||
// * @param detPos -1 for all detectors in list or specific detector
|
||||
// position
|
||||
// * @returns the storage cell that stores the first acquisition of the
|
||||
// series
|
||||
// */
|
||||
// int setStoragecellStart(int pos=-1, int detPos = -1);
|
||||
|
||||
@ -402,7 +450,8 @@ public:
|
||||
// /**
|
||||
// * Set 10GbE Flow Control (Eiger and Jungfrau)
|
||||
// * @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
|
||||
// */
|
||||
// int setFlowControl10G(int enable = -1, int detPos = -1);
|
||||
@ -416,7 +465,6 @@ public:
|
||||
// */
|
||||
// void setROI(slsDetectorDefs::ROI arg, int detPos = -1);
|
||||
|
||||
|
||||
// /**
|
||||
// * Get ROI (Gotthard)
|
||||
// * Only allowed to set one ROI per module
|
||||
@ -425,8 +473,6 @@ public:
|
||||
// */
|
||||
// slsDetectorDefs::ROI getROI(int detPos = -1);
|
||||
|
||||
|
||||
|
||||
// /************************************************************************
|
||||
|
||||
// RECEIVER FUNCTIONS
|
||||
@ -436,21 +482,24 @@ public:
|
||||
// /**
|
||||
// * (Advanced user, included in startMeasurement)
|
||||
// * 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);
|
||||
|
||||
// /**
|
||||
// * (Advanced user, included in startMeasurement)
|
||||
// * 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);
|
||||
|
||||
// /**
|
||||
// * Set/get receiver 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
|
||||
// */
|
||||
// int setReceiverSilentMode(int i = -1, int detPos = -1);
|
||||
@ -459,7 +508,8 @@ public:
|
||||
// * (Advanced user, included in startMeasurement)
|
||||
// * Resets framescaught in receiver
|
||||
// * 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);
|
||||
|
||||
@ -467,21 +517,24 @@ public:
|
||||
// * (Advanced user)
|
||||
// * Set/get receiver fifo depth
|
||||
// * @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
|
||||
// */
|
||||
// int setReceiverFifoDepth(int i = -1, int detPos = -1);
|
||||
|
||||
// /**
|
||||
// * 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
|
||||
// */
|
||||
// std::string getFilePath(int detPos = -1);
|
||||
|
||||
// /**
|
||||
// * 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
|
||||
// * @returns file dir
|
||||
// */
|
||||
@ -489,14 +542,16 @@ public:
|
||||
|
||||
// /**
|
||||
// * 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
|
||||
// */
|
||||
// std::string getFileName(int detPos = -1);
|
||||
|
||||
// /**
|
||||
// * 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
|
||||
// * @returns file name prefix
|
||||
// */
|
||||
@ -504,7 +559,8 @@ public:
|
||||
|
||||
// /**
|
||||
// * 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
|
||||
// */
|
||||
// int getFileIndex(int detPos = -1);
|
||||
@ -512,7 +568,8 @@ public:
|
||||
// /**
|
||||
// * Sets up the 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
|
||||
// */
|
||||
// int setFileIndex(int i, int detPos = -1);
|
||||
@ -520,7 +577,8 @@ public:
|
||||
// /**
|
||||
// * Sets/Gets receiver 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
|
||||
// */
|
||||
// int enableWriteToFile(int enable = -1, int detPos = -1);
|
||||
@ -528,7 +586,8 @@ public:
|
||||
// /**
|
||||
// * Sets/Gets 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
|
||||
// */
|
||||
// int enableOverwriteFile(int enable = -1, int detPos = -1);
|
||||
@ -536,9 +595,11 @@ public:
|
||||
// /**
|
||||
// * (previously setReceiverMode)
|
||||
// * 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
|
||||
// * @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
|
||||
// */
|
||||
// int setReceiverStreamingFrequency(int freq = -1, int detPos = -1);
|
||||
@ -548,22 +609,26 @@ public:
|
||||
// * If receiver streaming frequency is 0, then this timer between each
|
||||
// * data stream is set. Default is 200 ms.
|
||||
// * @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
|
||||
// */
|
||||
// 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
|
||||
// * @returns data streaming to client enable
|
||||
// */
|
||||
// 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 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
|
||||
// */
|
||||
// int enableDataStreamingFromReceiver(int enable=-1, int detPos = -1);
|
||||
@ -572,9 +637,12 @@ public:
|
||||
// * (advanced users)
|
||||
// * Set/Get receiver streaming out ZMQ port and restarts receiver sockets
|
||||
// * @param i sets, -1 gets
|
||||
// * If detPos is -1(multi module), port calculated (increments) for all the individual detectors using i
|
||||
// * @param detPos -1 for all detectors in list or specific detector position
|
||||
// * @returns receiver streaming out ZMQ port (if multiple, of first receiver socket)
|
||||
// * If detPos is -1(multi module), port calculated (increments) for all
|
||||
// the individual detectors using i
|
||||
// * @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);
|
||||
|
||||
@ -582,9 +650,12 @@ public:
|
||||
// * (advanced users)
|
||||
// * Set/Get client streaming in ZMQ port and restarts client sockets
|
||||
// * @param i sets, -1 gets
|
||||
// * If detPos is -1(multi module), port calculated (increments) for all the individual detectors using i
|
||||
// * @param detPos -1 for all detectors in list or specific detector position
|
||||
// * @returns receiver streaming out ZMQ port (if multiple, of first receiver socket)
|
||||
// * If detPos is -1(multi module), port calculated (increments) for all
|
||||
// the individual detectors using i
|
||||
// * @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);
|
||||
|
||||
@ -593,26 +664,31 @@ public:
|
||||
// * Set/Get receiver streaming out ZMQ IP and restarts receiver sockets
|
||||
// * @param i sets, empty string gets
|
||||
// * 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
|
||||
// */
|
||||
// std::string setReceiverDataStreamingOutIP(const std::string& ip="", int detPos = -1);
|
||||
// std::string setReceiverDataStreamingOutIP(const std::string& ip="", int
|
||||
// detPos = -1);
|
||||
|
||||
// /**
|
||||
// * (advanced users)
|
||||
// * Set/Get client streaming in ZMQ IP and restarts client sockets
|
||||
// * @param i sets, empty string gets
|
||||
// * 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
|
||||
// */
|
||||
// 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)
|
||||
// * 4 bit mode gap pixels only in data call back in client
|
||||
// * @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
|
||||
// */
|
||||
// int enableGapPixels(int val=-1, int detPos = -1);
|
||||
@ -621,8 +697,10 @@ public:
|
||||
// * Sets the frame discard policy in receiver
|
||||
// * @param f frame discard policy (-1 gets)
|
||||
// * Options: (slsDetectorDefs::frameDiscardPolicy)
|
||||
// * (NO_DISCARD (default), DISCARD_EMPTY_FRAMES, DISCARD_PARTIAL_FRAMES (fastest))
|
||||
// * @param detPos -1 for all detectors in list or specific detector position
|
||||
// * (NO_DISCARD (default), DISCARD_EMPTY_FRAMES, DISCARD_PARTIAL_FRAMES
|
||||
// (fastest))
|
||||
// * @param detPos -1 for all detectors in list or specific detector
|
||||
// position
|
||||
// * @returns current frame discard policy
|
||||
// */
|
||||
// int setReceiverFramesDiscardPolicy(int f = -1, int detPos = -1);
|
||||
@ -630,35 +708,43 @@ public:
|
||||
// /**
|
||||
// * Sets the frame padding in receiver
|
||||
// * @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
|
||||
// */
|
||||
// int setReceiverPartialFramesPadding(int f = -1, int detPos = -1);
|
||||
|
||||
// /**
|
||||
// * Sets the frames per file in receiver
|
||||
// * @param f frames per file, 0 is infinite ie. every frame in same file (-1 gets)
|
||||
// * @param detPos -1 for all detectors in list or specific detector position
|
||||
// * @param f frames per file, 0 is infinite ie. every frame in same file
|
||||
// (-1 gets)
|
||||
// * @param detPos -1 for all detectors in list or specific detector
|
||||
// position
|
||||
// * @returns frames per file
|
||||
// */
|
||||
// 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 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
|
||||
// */
|
||||
// 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)
|
||||
// * @param value frame mode value (-1 gets)
|
||||
// * Options (slsDetectorDefs::frameModeType)
|
||||
// * PEDESTAL, NEW_PEDESTAL, FLATFIELD, NEW_FLATFIELD
|
||||
// * @param detPos -1 for all detectors in list or specific detector position
|
||||
// * @returns frame mode (-1 for not found or error in computing json parameter value)
|
||||
// * @param detPos -1 for all detectors in list or specific detector
|
||||
// position
|
||||
// * @returns frame mode (-1 for not found or error in computing json
|
||||
// parameter value)
|
||||
// */
|
||||
// int setFrameMode(int value, int detPos = -1);
|
||||
|
||||
@ -667,8 +753,10 @@ public:
|
||||
// * @param value detector mode value (-1 gets)
|
||||
// * Options (slsDetectorDefs::detectorModeType)
|
||||
// * COUNTING, INTERPOLATING, ANALOG
|
||||
// * @param detPos -1 for all detectors in list or specific detector position
|
||||
// * @returns detector mode (-1 for not found or error in computing json parameter value)
|
||||
// * @param detPos -1 for all detectors in list or specific detector
|
||||
// position
|
||||
// * @returns detector mode (-1 for not found or error in computing json
|
||||
// parameter value)
|
||||
// */
|
||||
// int setDetectorMode(int value, int detPos = -1);
|
||||
|
||||
@ -688,7 +776,8 @@ public:
|
||||
// * @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,
|
||||
@ -696,19 +785,18 @@ public:
|
||||
// * gets detector status and progress index as arguments
|
||||
// * @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
|
||||
// \returns void
|
||||
// */
|
||||
// void putCommand(const std::string& command);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// /************************************************************************
|
||||
|
||||
// STATIC FUNCTIONS
|
||||
@ -717,25 +805,34 @@ public:
|
||||
|
||||
/** @short returns std::string from 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){ \
|
||||
switch (s) { \
|
||||
case 0: return std::string("idle"); \
|
||||
case 1: return std::string("error"); \
|
||||
case 2: return std::string("waiting"); \
|
||||
case 3: return std::string("finished"); \
|
||||
case 4: return std::string("data"); \
|
||||
case 5: return std::string("running"); \
|
||||
/* static std::string runStatusType(int s){
|
||||
\
|
||||
switch (s) {
|
||||
\
|
||||
case 0: return std::string("idle");
|
||||
\
|
||||
case 1: return std::string("error");
|
||||
\
|
||||
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"); \
|
||||
default: return std::string("unknown"); \
|
||||
default: return std::string("unknown");
|
||||
\
|
||||
}};
|
||||
*/
|
||||
|
||||
|
||||
/** @short returns detector settings std::string from index
|
||||
\param s can be standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain
|
||||
\returns setting index (-1 unknown std::string)
|
||||
\param s can be standard, fast, highgain, dynamicgain, lowgain, mediumgain,
|
||||
veryhighgain \returns setting index (-1 unknown std::string)
|
||||
*/
|
||||
/*
|
||||
static int getDetectorSettings(std::string s){ \
|
||||
@ -750,7 +847,8 @@ public:
|
||||
|
||||
/** @short returns detector settings std::string from 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){\
|
||||
switch(s) { \
|
||||
@ -760,43 +858,51 @@ public:
|
||||
case 3: return std::string("dynamicgain"); \
|
||||
case 4: return std::string("lowgain"); \
|
||||
case 5: return std::string("mediumgain"); \
|
||||
case 6: return std::string("veryhighgain"); \
|
||||
default: return std::string("undefined"); \
|
||||
case 6: return std::string("veryhighgain");
|
||||
\
|
||||
default: return std::string("undefined");
|
||||
\
|
||||
}};
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
@short returns external communication mode std::string from index
|
||||
\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){ \
|
||||
switch(f) { \
|
||||
case 0: return std::string( "auto"); \
|
||||
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 4: return std::string("triggered_gating"); \
|
||||
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
|
||||
\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){ \
|
||||
if (s== "auto") return 0; \
|
||||
if (s== "trigger") return 1; \
|
||||
if (s== "ro_trigger") return 2; \
|
||||
if (s== "gating") return 3; \
|
||||
if (s== "auto") return 0;
|
||||
\
|
||||
if (s== "trigger") return 1;
|
||||
\
|
||||
if (s== "ro_trigger") return 2;
|
||||
\
|
||||
if (s== "gating") return 3;
|
||||
\
|
||||
if (s== "triggered_gating") return 4; \
|
||||
if (s== "burst_trigger") return 5; \
|
||||
return -1; };
|
||||
if (s== "burst_trigger") return 5; \ return -1;
|
||||
};
|
||||
|
||||
*/
|
||||
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();
|
||||
arguments_.erase(std::remove_if(begin(arguments_), end(arguments_),
|
||||
[](const std::string &item) {
|
||||
return (item == "-h" || item == "--help");
|
||||
return (item == "-h" ||
|
||||
item == "--help");
|
||||
}),
|
||||
end(arguments_));
|
||||
if (old_size - arguments_.size() > 0)
|
||||
@ -100,7 +101,6 @@ std::vector<const char *> CmdParser::argv() const {
|
||||
return vec;
|
||||
}
|
||||
|
||||
|
||||
std::string CmdParser::cli_line() const {
|
||||
std::ostringstream os;
|
||||
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_; }
|
||||
|
||||
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::string cli_line() const;
|
||||
|
||||
|
@ -169,7 +169,8 @@ std::string CmdProxy::VirtualServer(int action) {
|
||||
if (det_id != -1) {
|
||||
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);
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
@ -394,20 +395,23 @@ std::string CmdProxy::Adcphase(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
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 "
|
||||
"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 "
|
||||
"resets adcphase and sets it to previous values.\n\t[Gotthard] "
|
||||
"Relative phase shift"
|
||||
<< '\n';
|
||||
} else {
|
||||
auto det_type = det->getDetectorType().squash(defs::GENERIC);
|
||||
if (det_type == defs::EIGER ||
|
||||
det_type == defs::MYTHEN3 ||
|
||||
if (det_type == defs::EIGER || det_type == defs::MYTHEN3 ||
|
||||
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) {
|
||||
Result<int> t;
|
||||
@ -416,7 +420,8 @@ std::string CmdProxy::Adcphase(int action) {
|
||||
os << OutString(t) << '\n';
|
||||
} else if (args.size() == 1) {
|
||||
if (args[0] != "deg") {
|
||||
throw sls::RuntimeError("Unknown adcphase argument " + args[0] +
|
||||
throw sls::RuntimeError("Unknown adcphase argument " +
|
||||
args[0] +
|
||||
". Did you mean deg? ");
|
||||
}
|
||||
t = det->getADCPhaseInDegrees({det_id});
|
||||
@ -449,17 +454,19 @@ std::string CmdProxy::Dbitphase(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
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 "
|
||||
"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."
|
||||
<< '\n';
|
||||
} else {
|
||||
auto det_type = det->getDetectorType().squash(defs::GENERIC);
|
||||
if (det_type == defs::EIGER ||
|
||||
det_type == defs::MYTHEN3 ||
|
||||
if (det_type == defs::EIGER || det_type == defs::MYTHEN3 ||
|
||||
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) {
|
||||
Result<int> t;
|
||||
@ -507,7 +514,8 @@ std::string CmdProxy::ClockFrequency(int action) {
|
||||
} else {
|
||||
defs::detectorType type = det->getDetectorType().squash(defs::GENERIC);
|
||||
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 (args.size() != 1) {
|
||||
@ -519,8 +527,8 @@ std::string CmdProxy::ClockFrequency(int action) {
|
||||
if (args.size() != 2) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
det->setClockFrequency(StringTo<int>(args[0]), StringTo<int>(args[1]),
|
||||
{det_id});
|
||||
det->setClockFrequency(StringTo<int>(args[0]),
|
||||
StringTo<int>(args[1]), {det_id});
|
||||
os << StringTo<int>(args[1]) << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
@ -541,7 +549,8 @@ std::string CmdProxy::ClockPhase(int action) {
|
||||
} else {
|
||||
defs::detectorType type = det->getDetectorType().squash(defs::GENERIC);
|
||||
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 (args.size() == 1) {
|
||||
@ -552,16 +561,16 @@ std::string CmdProxy::ClockPhase(int action) {
|
||||
throw sls::RuntimeError("Cannot scan argument" + args[1] +
|
||||
". Did you mean deg?");
|
||||
}
|
||||
auto t =
|
||||
det->getClockPhaseinDegrees(StringTo<int>(args[0]), {det_id});
|
||||
auto t = det->getClockPhaseinDegrees(StringTo<int>(args[0]),
|
||||
{det_id});
|
||||
os << OutString(t) << " deg\n";
|
||||
} else {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() == 2) {
|
||||
det->setClockPhase(StringTo<int>(args[0]), StringTo<int>(args[1]),
|
||||
{det_id});
|
||||
det->setClockPhase(StringTo<int>(args[0]),
|
||||
StringTo<int>(args[1]), {det_id});
|
||||
os << args[1] << '\n';
|
||||
} else if (args.size() == 3) {
|
||||
if (args[2] != "deg") {
|
||||
@ -591,13 +600,15 @@ std::string CmdProxy::MaxClockPhaseShift(int action) {
|
||||
} else {
|
||||
defs::detectorType type = det->getDetectorType().squash(defs::GENERIC);
|
||||
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 (args.size() != 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';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
throw sls::RuntimeError("Cannot put");
|
||||
@ -618,7 +629,8 @@ std::string CmdProxy::ClockDivider(int action) {
|
||||
} else {
|
||||
defs::detectorType type = det->getDetectorType().squash(defs::GENERIC);
|
||||
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 (args.size() != 1) {
|
||||
@ -649,8 +661,11 @@ std::string CmdProxy::Dac(int action) {
|
||||
os << "[dac index] [dac or mv value] [(optional unit) mv] "
|
||||
"\n\t[Ctb] Dac."
|
||||
<< '\n';
|
||||
} else if (det->getDetectorType().squash(defs::GENERIC) != 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 (det->getDetectorType().squash(defs::GENERIC) !=
|
||||
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) {
|
||||
bool mv = false;
|
||||
if (args.size() == 2) {
|
||||
@ -662,8 +677,8 @@ std::string CmdProxy::Dac(int action) {
|
||||
} else if (args.size() > 2) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
auto t = det->getDAC(static_cast<defs::dacIndex>(StringTo<int>(args[0])),
|
||||
mv, {det_id});
|
||||
auto t = det->getDAC(
|
||||
static_cast<defs::dacIndex>(StringTo<int>(args[0])), mv, {det_id});
|
||||
os << args[0] << ' ' << OutString(t)
|
||||
<< (args.size() > 1 ? " mv\n" : "\n");
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
@ -790,8 +805,7 @@ std::string CmdProxy::ReceiverStatus(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "running, idle]\n\tReceiver listener status."
|
||||
<< '\n';
|
||||
os << "running, idle]\n\tReceiver listener status." << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 0) {
|
||||
WrongNumberOfParameters(0);
|
||||
@ -799,7 +813,8 @@ std::string CmdProxy::ReceiverStatus(int action) {
|
||||
auto t = det->getReceiverStatus({det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} 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 {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
@ -810,7 +825,8 @@ std::string CmdProxy::DetectorStatus(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
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';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 0) {
|
||||
@ -819,7 +835,8 @@ std::string CmdProxy::DetectorStatus(int action) {
|
||||
auto t = det->getDetectorStatus({det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} 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 {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
@ -832,7 +849,9 @@ std::string CmdProxy::UDPDestinationIP(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
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';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
auto t = det->getDestinationUDPIP({det_id});
|
||||
@ -845,14 +864,15 @@ std::string CmdProxy::UDPDestinationIP(int action) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
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
|
||||
auto val = sls::IpAddr{rxHostname};
|
||||
if (val == 0) {
|
||||
val = HostnameToIp(rxHostname.c_str());
|
||||
}
|
||||
LOG(logINFO) << "Setting udp_dstip of detector " <<
|
||||
det_id << " to " << val;
|
||||
LOG(logINFO) << "Setting udp_dstip of detector " << det_id << " to "
|
||||
<< val;
|
||||
det->setDestinationUDPIP(val, {det_id});
|
||||
os << val << '\n';
|
||||
} else {
|
||||
@ -870,7 +890,10 @@ std::string CmdProxy::UDPDestinationIP2(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
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';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
auto t = det->getDestinationUDPIP2({det_id});
|
||||
@ -883,14 +906,15 @@ std::string CmdProxy::UDPDestinationIP2(int action) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
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
|
||||
auto val = sls::IpAddr{rxHostname};
|
||||
if (val == 0) {
|
||||
val = HostnameToIp(rxHostname.c_str());
|
||||
}
|
||||
LOG(logINFO) << "Setting udp_dstip2 of detector " <<
|
||||
det_id << " to " << val;
|
||||
LOG(logINFO) << "Setting udp_dstip2 of detector " << det_id
|
||||
<< " to " << val;
|
||||
det->setDestinationUDPIP2(val, {det_id});
|
||||
os << val << '\n';
|
||||
} else {
|
||||
@ -912,9 +936,11 @@ std::string CmdProxy::ReceiveHostname(int action) {
|
||||
os << "[hostname or ip address]\n\t"
|
||||
"[hostname or ip address]:[tcp port]\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 "
|
||||
"to configure receiver. Also updates receiver with detector parameters."
|
||||
"to configure receiver. Also updates receiver with detector "
|
||||
"parameters."
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (!args.empty()) {
|
||||
@ -930,10 +956,12 @@ std::string CmdProxy::ReceiveHostname(int action) {
|
||||
if (args.size() > 1) {
|
||||
// multiple in mulitple
|
||||
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) {
|
||||
throw sls::RuntimeError("Cannot add multiple receivers at module level");
|
||||
throw sls::RuntimeError(
|
||||
"Cannot add multiple receivers at module level");
|
||||
}
|
||||
det->setRxHostname(args);
|
||||
os << ToString(args) << '\n';
|
||||
@ -943,7 +971,8 @@ std::string CmdProxy::ReceiveHostname(int action) {
|
||||
// multiple receivers concatenated with +
|
||||
if (args[0].find('+') != std::string::npos) {
|
||||
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], '+');
|
||||
det->setRxHostname(t);
|
||||
@ -997,8 +1026,10 @@ std::string CmdProxy::Threshold(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[eV] [(optinal settings) standard, lowgain, veryhighgain, verylowgain]"
|
||||
"\n\t[Eiger] Threshold in eV" << '\n';
|
||||
os << "[eV] [(optinal settings) standard, lowgain, veryhighgain, "
|
||||
"verylowgain]"
|
||||
"\n\t[Eiger] Threshold in eV"
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (!args.empty()) {
|
||||
WrongNumberOfParameters(0);
|
||||
@ -1029,7 +1060,8 @@ std::string CmdProxy::ThresholdNoTb(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
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';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
@ -1058,12 +1090,12 @@ std::string CmdProxy::GapPixels(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
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';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (det_id != -1) {
|
||||
throw sls::RuntimeError(
|
||||
"Cannot get gap pixels at module level");
|
||||
throw sls::RuntimeError("Cannot get gap pixels at module level");
|
||||
}
|
||||
if (!args.empty()) {
|
||||
WrongNumberOfParameters(0);
|
||||
@ -1072,8 +1104,7 @@ std::string CmdProxy::GapPixels(int action) {
|
||||
os << t << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (det_id != -1) {
|
||||
throw sls::RuntimeError(
|
||||
"Cannot add gap pixels at module level");
|
||||
throw sls::RuntimeError("Cannot add gap pixels at module level");
|
||||
}
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
@ -1283,8 +1314,7 @@ std::string CmdProxy::Quad(int action) {
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (det_id != -1) {
|
||||
throw sls::RuntimeError(
|
||||
"Cannot execute quad at module level");
|
||||
throw sls::RuntimeError("Cannot execute quad at module level");
|
||||
}
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
@ -1410,7 +1440,8 @@ std::string CmdProxy::InjectChannel(int action) {
|
||||
if (args.size() != 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';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
@ -1459,7 +1490,8 @@ std::string CmdProxy::VetoReference(int action) {
|
||||
if (args.size() != 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';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
@ -1471,7 +1503,8 @@ std::string CmdProxy::BurstMode(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
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';
|
||||
} else {
|
||||
if (action == defs::GET_ACTION) {
|
||||
@ -1691,7 +1724,8 @@ std::string CmdProxy::DigitalIODelay(int action) {
|
||||
if (args.size() != 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';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
@ -1705,7 +1739,8 @@ std::string CmdProxy::Pattern(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
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"
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
@ -1726,7 +1761,8 @@ std::string CmdProxy::PatternWord(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
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."
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
@ -1739,7 +1775,8 @@ std::string CmdProxy::PatternWord(int action) {
|
||||
if (args.size() != 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';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
@ -1752,17 +1789,21 @@ std::string CmdProxy::PatternLoopAddresses(int action) {
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
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."
|
||||
<< '\n';
|
||||
} 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';
|
||||
} 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';
|
||||
} 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';
|
||||
} else {
|
||||
throw sls::RuntimeError(
|
||||
@ -1807,11 +1848,17 @@ std::string CmdProxy::PatternLoopCycles(int action) {
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
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") {
|
||||
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") {
|
||||
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 {
|
||||
throw sls::RuntimeError(
|
||||
"Unknown command, use list to list all commands");
|
||||
@ -1897,11 +1944,17 @@ std::string CmdProxy::PatternWaitTime(int action) {
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
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") {
|
||||
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") {
|
||||
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 {
|
||||
throw sls::RuntimeError(
|
||||
"Unknown command, use list to list all commands");
|
||||
@ -1928,7 +1981,8 @@ std::string CmdProxy::PatternWaitTime(int action) {
|
||||
if (args.size() != 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';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
@ -1944,8 +1998,10 @@ std::string CmdProxy::AdditionalJsonHeader(int action) {
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[key1] [value1] [key2] [value2]...[keyn] [valuen]"
|
||||
"\n\tAdditional json header to be streamed out from receiver via zmq. "
|
||||
"Default is empty. Use only if to be processed by an intermediate user process "
|
||||
"\n\tAdditional json header to be streamed out from receiver via "
|
||||
"zmq. "
|
||||
"Default is empty. Use only if to be processed by an "
|
||||
"intermediate user process "
|
||||
"listening to receiver zmq packets. Empty value deletes header. "
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
@ -1978,7 +2034,8 @@ std::string CmdProxy::JsonParameter(int action) {
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
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."
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
@ -2061,9 +2118,9 @@ std::string CmdProxy::ProgramFpga(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[fname.pof | fname.rbf]\n\t[Jungfrau][Ctb][Moench] Programs FPGA from pof file."
|
||||
<< "\n\t[Mythen3][Gotthard2] Programs FPGA from rbf file."
|
||||
<< '\n';
|
||||
os << "[fname.pof | fname.rbf]\n\t[Jungfrau][Ctb][Moench] Programs "
|
||||
"FPGA from pof file."
|
||||
<< "\n\t[Mythen3][Gotthard2] Programs FPGA from rbf file." << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
throw sls::RuntimeError("Cannot get");
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
@ -2082,7 +2139,8 @@ std::string CmdProxy::CopyDetectorServer(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
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 "
|
||||
"/etc/inittab of detector."
|
||||
<< '\n';
|
||||
@ -2104,7 +2162,8 @@ std::string CmdProxy::UpdateFirmwareAndDetectorServer(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
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 "
|
||||
"pof file and then reboots controller (blackfin)."
|
||||
<< '\n';
|
||||
@ -2142,7 +2201,8 @@ std::string CmdProxy::Register(int action) {
|
||||
if (args.size() != 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';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
@ -2154,7 +2214,8 @@ std::string CmdProxy::AdcRegister(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
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."
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
@ -2163,7 +2224,8 @@ std::string CmdProxy::AdcRegister(int action) {
|
||||
if (args.size() != 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';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
@ -2236,7 +2298,10 @@ std::string CmdProxy::InitialChecks(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
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';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (det_id != -1) {
|
||||
@ -2264,7 +2329,6 @@ std::string CmdProxy::InitialChecks(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
||||
/* Insignificant */
|
||||
|
||||
std::string CmdProxy::ExecuteCommand(int action) {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,11 +1,11 @@
|
||||
#include "Detector.h"
|
||||
#include "CmdParser.h"
|
||||
#include "CmdProxy.h"
|
||||
#include "DetectorImpl.h"
|
||||
#include "Module.h"
|
||||
#include "container_utils.h"
|
||||
#include "detectorData.h"
|
||||
#include "logger.h"
|
||||
#include "DetectorImpl.h"
|
||||
#include "Module.h"
|
||||
#include "sls_detector_defs.h"
|
||||
#include "versionAPI.h"
|
||||
|
||||
@ -72,8 +72,8 @@ void Detector::loadParameters(const std::string &fname) {
|
||||
if (current_line.find('#') != std::string::npos) {
|
||||
current_line.erase(current_line.find('#'));
|
||||
}
|
||||
LOG(logDEBUG1)
|
||||
<< "current_line after removing comments:\n\t" << current_line;
|
||||
LOG(logDEBUG1) << "current_line after removing comments:\n\t"
|
||||
<< current_line;
|
||||
if (current_line.length() > 1) {
|
||||
parser.Parse(current_line);
|
||||
proxy.Call(parser.command(), parser.arguments(),
|
||||
@ -97,13 +97,9 @@ void Detector::setVirtualDetectorServers(int numServers, int startingPort) {
|
||||
|
||||
int Detector::getShmId() const { return pimpl->getMultiId(); }
|
||||
|
||||
std::string Detector::getPackageVersion() const {
|
||||
return GITBRANCH;
|
||||
}
|
||||
std::string Detector::getPackageVersion() const { return GITBRANCH; }
|
||||
|
||||
int64_t Detector::getClientVersion() const {
|
||||
return APILIB;
|
||||
}
|
||||
int64_t Detector::getClientVersion() const { return APILIB; }
|
||||
|
||||
Result<int64_t> Detector::getFirmwareVersion(Positions pos) const {
|
||||
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 {
|
||||
auto res =
|
||||
pimpl->Parallel(&Module::getClockDivider, pos, defs::RUN_CLOCK);
|
||||
auto res = pimpl->Parallel(&Module::getClockDivider, pos, defs::RUN_CLOCK);
|
||||
Result<defs::speedLevel> speedResult(res.size());
|
||||
for (unsigned int i = 0; i < res.size(); ++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 {
|
||||
return pimpl->Parallel(&Module::getClockPhase, pos, defs::ADC_CLOCK,
|
||||
false);
|
||||
return pimpl->Parallel(&Module::getClockPhase, pos, defs::ADC_CLOCK, false);
|
||||
}
|
||||
|
||||
void Detector::setADCPhase(int value, Positions pos) {
|
||||
pimpl->Parallel(&Module::setClockPhase, pos, defs::ADC_CLOCK, value,
|
||||
false);
|
||||
pimpl->Parallel(&Module::setClockPhase, pos, defs::ADC_CLOCK, value, false);
|
||||
}
|
||||
|
||||
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 {
|
||||
return pimpl->Parallel(&Module::getClockPhase, pos, defs::ADC_CLOCK,
|
||||
true);
|
||||
return pimpl->Parallel(&Module::getClockPhase, pos, defs::ADC_CLOCK, true);
|
||||
}
|
||||
|
||||
void Detector::setADCPhaseInDegrees(int value, Positions pos) {
|
||||
pimpl->Parallel(&Module::setClockPhase, pos, defs::ADC_CLOCK, value,
|
||||
true);
|
||||
pimpl->Parallel(&Module::setClockPhase, pos, defs::ADC_CLOCK, value, true);
|
||||
}
|
||||
|
||||
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 {
|
||||
return pimpl->Parallel(&Module::getClockPhase, pos, defs::DBIT_CLOCK,
|
||||
true);
|
||||
return pimpl->Parallel(&Module::getClockPhase, pos, defs::DBIT_CLOCK, true);
|
||||
}
|
||||
|
||||
void Detector::setDBITPhaseInDegrees(int value, Positions pos) {
|
||||
pimpl->Parallel(&Module::setClockPhase, pos, defs::DBIT_CLOCK, value,
|
||||
true);
|
||||
pimpl->Parallel(&Module::setClockPhase, pos, defs::DBIT_CLOCK, value, true);
|
||||
}
|
||||
|
||||
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 {
|
||||
return pimpl->Parallel(&Module::setDAC, pos, -1, defs::HIGH_VOLTAGE,
|
||||
0);
|
||||
return pimpl->Parallel(&Module::setDAC, pos, -1, defs::HIGH_VOLTAGE, 0);
|
||||
}
|
||||
|
||||
void Detector::setHighVoltage(int value, Positions pos) {
|
||||
@ -430,13 +418,9 @@ void Detector::acquire() { pimpl->acquire(); }
|
||||
|
||||
void Detector::clearAcquiringFlag() { pimpl->setAcquiringFlag(0); }
|
||||
|
||||
void Detector::startReceiver() {
|
||||
pimpl->Parallel(&Module::startReceiver, {});
|
||||
}
|
||||
void Detector::startReceiver() { pimpl->Parallel(&Module::startReceiver, {}); }
|
||||
|
||||
void Detector::stopReceiver() {
|
||||
pimpl->Parallel(&Module::stopReceiver, {});
|
||||
}
|
||||
void Detector::stopReceiver() { pimpl->Parallel(&Module::stopReceiver, {}); }
|
||||
|
||||
void Detector::startDetector() {
|
||||
if (getDetectorType().squash() == defs::EIGER) {
|
||||
@ -445,9 +429,7 @@ void Detector::startDetector() {
|
||||
pimpl->Parallel(&Module::startAcquisition, {});
|
||||
}
|
||||
|
||||
void Detector::stopDetector() {
|
||||
pimpl->Parallel(&Module::stopAcquisition, {});
|
||||
}
|
||||
void Detector::stopDetector() { pimpl->Parallel(&Module::stopAcquisition, {}); }
|
||||
|
||||
Result<defs::runStatus> Detector::getDetectorStatus(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getRunStatus, pos);
|
||||
@ -461,7 +443,8 @@ Result<int64_t> Detector::getFramesCaught(Positions pos) const {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -607,8 +590,7 @@ void Detector::setDestinationUDPPort2(int port, int module_id) {
|
||||
port_list[idet]);
|
||||
}
|
||||
} else {
|
||||
pimpl->Parallel(&Module::setDestinationUDPPort2, {module_id},
|
||||
port);
|
||||
pimpl->Parallel(&Module::setDestinationUDPPort2, {module_id}, port);
|
||||
}
|
||||
}
|
||||
|
||||
@ -677,9 +659,9 @@ void Detector::setRxHostname(const std::vector<std::string> &name) {
|
||||
pimpl->Parallel(&Module::setReceiverHostname, {}, name[0]);
|
||||
} else {
|
||||
if ((int)name.size() != size()) {
|
||||
throw RuntimeError("Receiver hostnames size " +
|
||||
std::to_string(name.size()) + " does not match detector size " +
|
||||
std::to_string(size()));
|
||||
throw RuntimeError(
|
||||
"Receiver hostnames size " + std::to_string(name.size()) +
|
||||
" does not match detector size " + std::to_string(size()));
|
||||
}
|
||||
// set each rx_hostname
|
||||
for (int idet = 0; idet < size(); ++idet) {
|
||||
@ -699,8 +681,7 @@ void Detector::setRxPort(int port, int module_id) {
|
||||
it = port++;
|
||||
}
|
||||
for (int idet = 0; idet < size(); ++idet) {
|
||||
pimpl->Parallel(&Module::setReceiverPort, {idet},
|
||||
port_list[idet]);
|
||||
pimpl->Parallel(&Module::setReceiverPort, {idet}, port_list[idet]);
|
||||
}
|
||||
} else {
|
||||
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 {
|
||||
return pimpl->Parallel(&Module::getReceiverRealUDPSocketBufferSize,
|
||||
pos);
|
||||
return pimpl->Parallel(&Module::getReceiverRealUDPSocketBufferSize, pos);
|
||||
}
|
||||
|
||||
Result<bool> Detector::getRxLock(Positions pos) {
|
||||
@ -871,8 +851,7 @@ void Detector::setRxZmqPort(int port, int module_id) {
|
||||
port_list[idet]);
|
||||
}
|
||||
} else {
|
||||
pimpl->Parallel(&Module::setReceiverStreamingPort, {module_id},
|
||||
port);
|
||||
pimpl->Parallel(&Module::setReceiverStreamingPort, {module_id}, port);
|
||||
}
|
||||
}
|
||||
|
||||
@ -901,8 +880,7 @@ void Detector::setClientZmqPort(int port, int module_id) {
|
||||
port_list[idet]);
|
||||
}
|
||||
} else {
|
||||
pimpl->Parallel(&Module::setClientStreamingPort, {module_id},
|
||||
port);
|
||||
pimpl->Parallel(&Module::setClientStreamingPort, {module_id}, port);
|
||||
}
|
||||
}
|
||||
|
||||
@ -952,8 +930,8 @@ Result<int> Detector::getThresholdEnergy(Positions pos) const {
|
||||
void Detector::setThresholdEnergy(int threshold_ev,
|
||||
defs::detectorSettings settings,
|
||||
bool trimbits, Positions pos) {
|
||||
pimpl->Parallel(&Module::setThresholdEnergy, pos, threshold_ev,
|
||||
settings, static_cast<int>(trimbits));
|
||||
pimpl->Parallel(&Module::setThresholdEnergy, pos, threshold_ev, settings,
|
||||
static_cast<int>(trimbits));
|
||||
}
|
||||
|
||||
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 {
|
||||
return pimpl->Parallel(&Module::getNumberOfAdditionalStorageCells,
|
||||
pos);
|
||||
return pimpl->Parallel(&Module::getNumberOfAdditionalStorageCells, pos);
|
||||
}
|
||||
|
||||
void Detector::setNumberOfAdditionalStorageCells(int value) {
|
||||
@ -1224,19 +1201,26 @@ Result<std::array<int, 2>> Detector::getInjectChannel(Positions pos) {
|
||||
return pimpl->Parallel(&Module::getInjectChannel, pos);
|
||||
}
|
||||
|
||||
void Detector::setInjectChannel(const int offsetChannel, const int incrementChannel, Positions pos) {
|
||||
pimpl->Parallel(&Module::setInjectChannel, pos, offsetChannel, incrementChannel);
|
||||
void Detector::setInjectChannel(const int offsetChannel,
|
||||
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);
|
||||
}
|
||||
|
||||
void Detector::setVetoPhoton(const int chipIndex, const int numPhotons, const int energy, const std::string& fname, Positions pos) {
|
||||
pimpl->Parallel(&Module::setVetoPhoton, pos, chipIndex, numPhotons, energy, fname);
|
||||
void Detector::setVetoPhoton(const int chipIndex, const int numPhotons,
|
||||
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);
|
||||
}
|
||||
|
||||
@ -1284,10 +1268,8 @@ void Detector::setNumberOfAnalogSamples(int value, Positions pos) {
|
||||
pimpl->Parallel(&Module::setNumberOfAnalogSamples, pos, value);
|
||||
}
|
||||
|
||||
|
||||
Result<int> Detector::getADCClock(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getClockFrequency, pos,
|
||||
defs::ADC_CLOCK);
|
||||
return pimpl->Parallel(&Module::getClockFrequency, pos, defs::ADC_CLOCK);
|
||||
}
|
||||
|
||||
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 {
|
||||
return pimpl->Parallel(&Module::getClockFrequency, pos,
|
||||
defs::RUN_CLOCK);
|
||||
return pimpl->Parallel(&Module::getClockFrequency, pos, defs::RUN_CLOCK);
|
||||
}
|
||||
|
||||
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 {
|
||||
return pimpl->Parallel(&Module::getClockFrequency, pos,
|
||||
defs::SYNC_CLOCK);
|
||||
return pimpl->Parallel(&Module::getClockFrequency, pos, defs::SYNC_CLOCK);
|
||||
}
|
||||
|
||||
Result<int> Detector::getADCPipeline(Positions pos) const {
|
||||
@ -1372,7 +1352,6 @@ void Detector::setTenGigaADCEnableMask(uint32_t mask, Positions pos) {
|
||||
|
||||
// CTB Specific
|
||||
|
||||
|
||||
Result<int> Detector::getNumberOfDigitalSamples(Positions pos) const {
|
||||
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 {
|
||||
return pimpl->Parallel(&Module::getClockFrequency, pos,
|
||||
defs::DBIT_CLOCK);
|
||||
return pimpl->Parallel(&Module::getClockFrequency, pos, defs::DBIT_CLOCK);
|
||||
}
|
||||
|
||||
void Detector::setDBITClock(int value_in_MHz, Positions pos) {
|
||||
@ -1507,22 +1485,10 @@ void Detector::savePattern(const std::string &fname) {
|
||||
}
|
||||
// rest of pattern file
|
||||
const std::vector<std::string> commands{
|
||||
"patioctrl",
|
||||
"patclkctrl",
|
||||
"patlimits",
|
||||
"patloop0",
|
||||
"patnloop0",
|
||||
"patloop1",
|
||||
"patnloop1",
|
||||
"patloop2",
|
||||
"patnloop2",
|
||||
"patwait0",
|
||||
"patwaittime0",
|
||||
"patwait1",
|
||||
"patwaittime1",
|
||||
"patwait2",
|
||||
"patwaittime2",
|
||||
"patmask",
|
||||
"patioctrl", "patclkctrl", "patlimits", "patloop0",
|
||||
"patnloop0", "patloop1", "patnloop1", "patloop2",
|
||||
"patnloop2", "patwait0", "patwaittime0", "patwait1",
|
||||
"patwaittime1", "patwait2", "patwaittime2", "patmask",
|
||||
"patsetbit",
|
||||
};
|
||||
for (const auto &cmd : commands)
|
||||
@ -1559,14 +1525,13 @@ void Detector::setPatternWord(int addr, uint64_t word, Positions pos) {
|
||||
|
||||
Result<std::array<int, 2>>
|
||||
Detector::getPatternLoopAddresses(int level, Positions pos) const {
|
||||
return pimpl->Parallel(&Module::setPatternLoopAddresses, pos, level,
|
||||
-1, -1);
|
||||
return pimpl->Parallel(&Module::setPatternLoopAddresses, pos, level, -1,
|
||||
-1);
|
||||
}
|
||||
|
||||
void Detector::setPatternLoopAddresses(int level, int start, int stop,
|
||||
Positions pos) {
|
||||
pimpl->Parallel(&Module::setPatternLoopAddresses, pos, level, start,
|
||||
stop);
|
||||
pimpl->Parallel(&Module::setPatternLoopAddresses, pos, level, start, stop);
|
||||
}
|
||||
|
||||
Result<int> Detector::getPatternLoopCycles(int level, Positions pos) const {
|
||||
@ -1611,12 +1576,13 @@ void Detector::setPatternBitMask(uint64_t mask, Positions pos) {
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
void Detector::setAdditionalJsonHeader(const std::map<std::string, std::string> &jsonHeader,
|
||||
Positions pos) {
|
||||
void Detector::setAdditionalJsonHeader(
|
||||
const std::map<std::string, std::string> &jsonHeader, Positions pos) {
|
||||
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);
|
||||
}
|
||||
|
||||
void Detector::setAdditionalJsonParameter(const std::string &key, const std::string &value,
|
||||
void Detector::setAdditionalJsonParameter(const std::string &key,
|
||||
const std::string &value,
|
||||
Positions pos) {
|
||||
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 {
|
||||
auto res = pimpl->Parallel(&Module::getAdditionalJsonParameter, pos,
|
||||
"frameMode");
|
||||
auto res =
|
||||
pimpl->Parallel(&Module::getAdditionalJsonParameter, pos, "frameMode");
|
||||
Result<defs::frameModeType> intResult(res.size());
|
||||
try {
|
||||
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) {
|
||||
pimpl->Parallel(&Module::setAdditionalJsonParameter, pos,
|
||||
"detectorMode", sls::ToString(value));
|
||||
pimpl->Parallel(&Module::setAdditionalJsonParameter, pos, "detectorMode",
|
||||
sls::ToString(value));
|
||||
}
|
||||
|
||||
// Advanced
|
||||
@ -1753,9 +1720,7 @@ void Detector::writeAdcRegister(uint32_t addr, uint32_t value, Positions pos) {
|
||||
pimpl->Parallel(&Module::writeAdcRegister, pos, addr, value);
|
||||
}
|
||||
|
||||
bool Detector::getInitialChecks() const {
|
||||
return pimpl->getInitialChecks();
|
||||
}
|
||||
bool Detector::getInitialChecks() const { return pimpl->getInitialChecks(); }
|
||||
|
||||
void Detector::setInitialChecks(const bool 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 "Module.h"
|
||||
#include "SharedMemory.h"
|
||||
#include "ZmqSocket.h"
|
||||
#include "detectorData.h"
|
||||
#include "file_utils.h"
|
||||
#include "logger.h"
|
||||
#include "Module.h"
|
||||
#include "sls_detector_exceptions.h"
|
||||
#include "versionAPI.h"
|
||||
|
||||
@ -167,8 +167,7 @@ void DetectorImpl::initializeMembers(bool verify) {
|
||||
// get objects from single det shared memory (open)
|
||||
for (int i = 0; i < multi_shm()->numberOfDetectors; i++) {
|
||||
try {
|
||||
detectors.push_back(
|
||||
sls::make_unique<Module>(multiId, i, verify));
|
||||
detectors.push_back(sls::make_unique<Module>(multiId, i, verify));
|
||||
} catch (...) {
|
||||
detectors.clear();
|
||||
throw;
|
||||
@ -233,8 +232,7 @@ void DetectorImpl::setVirtualDetectorServers(const int numdet, const int port) {
|
||||
void DetectorImpl::setHostname(const std::vector<std::string> &name) {
|
||||
// this check is there only to allow the previous detsizechan command
|
||||
if (multi_shm()->numberOfDetectors != 0) {
|
||||
LOG(logWARNING)
|
||||
<< "There are already detector(s) in shared memory."
|
||||
LOG(logWARNING) << "There are already detector(s) in shared memory."
|
||||
"Freeing Shared memory now.";
|
||||
bool initialChecks = multi_shm()->initialChecks;
|
||||
freeSharedMemory();
|
||||
@ -273,8 +271,7 @@ void DetectorImpl::addSlsDetector(const std::string &hostname) {
|
||||
// get type by connecting
|
||||
detectorType type = Module::getTypeFromDetector(host, port);
|
||||
auto pos = detectors.size();
|
||||
detectors.emplace_back(
|
||||
sls::make_unique<Module>(type, multiId, pos, false));
|
||||
detectors.emplace_back(sls::make_unique<Module>(type, multiId, pos, false));
|
||||
multi_shm()->numberOfDetectors = detectors.size();
|
||||
detectors[pos]->setControlPort(port);
|
||||
detectors[pos]->setStopPort(port + 1);
|
||||
@ -359,8 +356,8 @@ void DetectorImpl::setGapPixelsinCallback(const bool enable) {
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw RuntimeError("Gap Pixels is not implemented for "
|
||||
+ multi_shm()->multiDetectorType);
|
||||
throw RuntimeError("Gap Pixels is not implemented for " +
|
||||
multi_shm()->multiDetectorType);
|
||||
}
|
||||
}
|
||||
multi_shm()->gapPixels = enable;
|
||||
@ -386,8 +383,7 @@ int DetectorImpl::createReceivingDataSockets(const bool destroy) {
|
||||
if (multi_shm()->multiDetectorType == EIGER) {
|
||||
numSocketsPerDetector = 2;
|
||||
}
|
||||
if (Parallel(&Module::getNumberofUDPInterfacesFromShm, {}).squash() ==
|
||||
2) {
|
||||
if (Parallel(&Module::getNumberofUDPInterfacesFromShm, {}).squash() == 2) {
|
||||
numSocketsPerDetector = 2;
|
||||
}
|
||||
numSockets *= numSocketsPerDetector;
|
||||
@ -406,8 +402,7 @@ int DetectorImpl::createReceivingDataSockets(const bool destroy) {
|
||||
LOG(logINFO) << "Zmq Client[" << iSocket << "] at "
|
||||
<< zmqSocket.back()->GetZmqServerAddress();
|
||||
} catch (...) {
|
||||
LOG(logERROR)
|
||||
<< "Could not create Zmq socket on port " << portnum;
|
||||
LOG(logERROR) << "Could not create Zmq socket on port " << portnum;
|
||||
createReceivingDataSockets(true);
|
||||
return FAIL;
|
||||
}
|
||||
@ -429,8 +424,7 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
int nDetPixelsY = 0;
|
||||
bool quadEnable = false;
|
||||
bool eiger = false;
|
||||
bool numInterfaces =
|
||||
Parallel(&Module::getNumberofUDPInterfacesFromShm, {})
|
||||
bool numInterfaces = Parallel(&Module::getNumberofUDPInterfacesFromShm, {})
|
||||
.squash(); // cannot pick up from zmq
|
||||
|
||||
bool runningList[zmqSocket.size()], connectList[zmqSocket.size()];
|
||||
@ -491,8 +485,8 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
{
|
||||
zmqHeader zHeader;
|
||||
if (zmqSocket[isocket]->ReceiveHeader(
|
||||
isocket, zHeader, SLS_DETECTOR_JSON_HEADER_VERSION) ==
|
||||
0) {
|
||||
isocket, zHeader,
|
||||
SLS_DETECTOR_JSON_HEADER_VERSION) == 0) {
|
||||
// parse error, version error or end of acquisition for
|
||||
// socket
|
||||
runningList[isocket] = false;
|
||||
@ -523,8 +517,8 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
// det type
|
||||
eiger = (zHeader.detType == static_cast<int>(3))
|
||||
? true
|
||||
: false; // to be changed to EIGER when firmware
|
||||
// updates its header data
|
||||
: false; // to be changed to EIGER when
|
||||
// firmware updates its header data
|
||||
quadEnable = (zHeader.quad == 0) ? false : true;
|
||||
LOG(logDEBUG1)
|
||||
<< "One Time Header Info:"
|
||||
@ -620,21 +614,21 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
int imagesize = multisize;
|
||||
|
||||
if (gapPixels) {
|
||||
int n = InsertGapPixels(multiframe, multigappixels,
|
||||
quadEnable, dynamicRange, nDetPixelsX, nDetPixelsY);
|
||||
int n = InsertGapPixels(multiframe, multigappixels, quadEnable,
|
||||
dynamicRange, nDetPixelsX, nDetPixelsY);
|
||||
image = multigappixels;
|
||||
imagesize = n;
|
||||
}
|
||||
LOG(logDEBUG)
|
||||
<< "Image Info:"
|
||||
LOG(logDEBUG) << "Image Info:"
|
||||
<< "\n\tnDetPixelsX: " << nDetPixelsX
|
||||
<< "\n\tnDetPixelsY: " << nDetPixelsY
|
||||
<< "\n\timagesize: " << imagesize
|
||||
<< "\n\tdynamicRange: " << dynamicRange;
|
||||
|
||||
thisData = new detectorData(currentProgress,
|
||||
currentFileName, nDetPixelsX, nDetPixelsY, image,
|
||||
imagesize, dynamicRange, currentFileIndex, completeImage);
|
||||
thisData =
|
||||
new detectorData(currentProgress, currentFileName, nDetPixelsX,
|
||||
nDetPixelsY, image, imagesize, dynamicRange,
|
||||
currentFileIndex, completeImage);
|
||||
|
||||
dataReady(
|
||||
thisData, currentFrameIndex,
|
||||
@ -680,14 +674,13 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
delete[] multigappixels;
|
||||
}
|
||||
|
||||
int DetectorImpl::InsertGapPixels(char *image, char *&gpImage,
|
||||
bool quadEnable, int dr, int &nPixelsx, int &nPixelsy) {
|
||||
int DetectorImpl::InsertGapPixels(char *image, char *&gpImage, bool quadEnable,
|
||||
int dr, int &nPixelsx, int &nPixelsy) {
|
||||
|
||||
LOG(logDEBUG) << "Insert Gap pixels:"
|
||||
<< "\n\t nPixelsx: " << nPixelsx
|
||||
<< "\n\t nPixelsy: " << nPixelsy
|
||||
<< "\n\t quadEnable: " << quadEnable
|
||||
<< "\n\t dr: " << dr;
|
||||
<< "\n\t quadEnable: " << quadEnable << "\n\t dr: " << dr;
|
||||
|
||||
// inter module gap pixels
|
||||
int modGapPixelsx = 8;
|
||||
@ -730,8 +723,10 @@ int DetectorImpl::InsertGapPixels(char *image, char *&gpImage,
|
||||
}
|
||||
|
||||
// total number of pixels
|
||||
int nTotx = nPixelsx + (nMod1GapPixelsx * nModx) + (modGapPixelsx * (nModx - 1));
|
||||
int nToty = nPixelsy + (nMod1GapPixelsy * nMody) + (modGapPixelsy * (nMody - 1));
|
||||
int nTotx =
|
||||
nPixelsx + (nMod1GapPixelsx * nModx) + (modGapPixelsx * (nModx - 1));
|
||||
int nToty =
|
||||
nPixelsy + (nMod1GapPixelsy * nMody) + (modGapPixelsy * (nMody - 1));
|
||||
// total number of chips
|
||||
int nChipx = nPixelsx / nChipPixelsx;
|
||||
int nChipy = nPixelsy / nChipPixelsy;
|
||||
@ -744,8 +739,10 @@ int DetectorImpl::InsertGapPixels(char *image, char *&gpImage,
|
||||
int nModGapBytesx = modGapPixelsx * bytesPerPixel; // 8 pixel bytes
|
||||
int nChipBytesy = nChipPixelsy * nTotx * bytesPerPixel; // 1 chip bytes in y
|
||||
int nChipGapBytesy = chipGapPixelsy * nTotx * bytesPerPixel; // 2 lines
|
||||
int nModGapBytesy = modGapPixelsy * nTotx * bytesPerPixel; // 36 lines
|
||||
// 4 bit mode, its 1 byte (because for 4 bit mode, we handle 1 byte at a time)
|
||||
int nModGapBytesy = modGapPixelsy * nTotx *
|
||||
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 row1Bytes = nTotx * bytesPerPixel;
|
||||
int nMod1TotPixelsx = nMod1Pixelsx + nMod1GapPixelsx;
|
||||
@ -759,8 +756,7 @@ int DetectorImpl::InsertGapPixels(char *image, char *&gpImage,
|
||||
if (detType == JUNGFRAU) {
|
||||
divisionValue = 1;
|
||||
}
|
||||
LOG(logDEBUG)
|
||||
<< "Insert Gap pixels Calculations:\n\t"
|
||||
LOG(logDEBUG) << "Insert Gap pixels Calculations:\n\t"
|
||||
<< "nPixelsx: " << nPixelsx << "\n\t"
|
||||
<< "nPixelsy: " << nPixelsy << "\n\t"
|
||||
<< "nMod1Pixelsx: " << nMod1Pixelsx << "\n\t"
|
||||
@ -872,11 +868,13 @@ int DetectorImpl::InsertGapPixels(char *image, char *&gpImage,
|
||||
break;
|
||||
case 16:
|
||||
// neighbouring gap pixels to left
|
||||
temp16 = (*((uint16_t *)(dst - pixel1))) / divisionValue;
|
||||
temp16 =
|
||||
(*((uint16_t *)(dst - pixel1))) / divisionValue;
|
||||
(*((uint16_t *)dst)) = temp16;
|
||||
(*((uint16_t *)(dst - pixel1))) = temp16;
|
||||
// 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 + 2 * pixel1))) = temp16;
|
||||
break;
|
||||
@ -973,8 +971,6 @@ int DetectorImpl::InsertGapPixels(char *image, char *&gpImage,
|
||||
return imagesize;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool DetectorImpl::enableDataStreamingToClient(int enable) {
|
||||
if (enable >= 0) {
|
||||
// destroy data threads
|
||||
@ -1024,8 +1020,7 @@ int DetectorImpl::acquire() {
|
||||
// receiver/ext process)
|
||||
sem_init(&sem_endRTAcquisition, 1, 0);
|
||||
|
||||
bool receiver =
|
||||
Parallel(&Module::getUseReceiverFlag, {}).squash(false);
|
||||
bool receiver = Parallel(&Module::getUseReceiverFlag, {}).squash(false);
|
||||
|
||||
setJoinThreadFlag(false);
|
||||
|
||||
@ -1098,12 +1093,11 @@ int DetectorImpl::acquire() {
|
||||
}
|
||||
|
||||
void DetectorImpl::printProgress(double progress) {
|
||||
std::cout << std::fixed << std::setprecision(2) << std::setw(6)
|
||||
<< progress << " \%";
|
||||
std::cout << std::fixed << std::setprecision(2) << std::setw(6) << progress
|
||||
<< " \%";
|
||||
std::cout << '\r' << std::flush;
|
||||
}
|
||||
|
||||
|
||||
void DetectorImpl::startProcessingThread() {
|
||||
dataProcessingThread = std::thread(&DetectorImpl::processData, this);
|
||||
}
|
||||
@ -1128,7 +1122,9 @@ void DetectorImpl::processData() {
|
||||
}
|
||||
}
|
||||
// get and print progress
|
||||
double temp = (double)Parallel(&Module::getReceiverProgress, {0}).squash();
|
||||
double temp =
|
||||
(double)Parallel(&Module::getReceiverProgress, {0})
|
||||
.squash();
|
||||
if (temp != progress) {
|
||||
printProgress(progress);
|
||||
progress = temp;
|
||||
@ -1137,7 +1133,9 @@ void DetectorImpl::processData() {
|
||||
// exiting loop
|
||||
if (getJoinThreadFlag()) {
|
||||
// print progress one final time before exiting
|
||||
progress = (double)Parallel(&Module::getReceiverProgress, {0}).squash();
|
||||
progress =
|
||||
(double)Parallel(&Module::getReceiverProgress, {0})
|
||||
.squash();
|
||||
printProgress(progress);
|
||||
break;
|
||||
}
|
||||
@ -1297,8 +1295,7 @@ std::vector<char> DetectorImpl::readProgrammingFile(const std::string &fname) {
|
||||
"Program FPGA: Could not close destination file after converting");
|
||||
}
|
||||
unlink(destfname); // delete temporary file
|
||||
LOG(logDEBUG1)
|
||||
<< "Successfully loaded the rawbin file to program memory";
|
||||
LOG(logDEBUG1) << "Successfully loaded the rawbin file to program memory";
|
||||
LOG(logINFO) << "Read file into memory";
|
||||
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 */
|
||||
void setAcquiringFlag(bool flag);
|
||||
|
||||
/** return multi detector shared memory ID */
|
||||
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);
|
||||
|
||||
/** 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();
|
||||
|
||||
/** Get user details of shared memory */
|
||||
@ -217,7 +218,8 @@ class DetectorImpl : public virtual slsDetectorDefs {
|
||||
*/
|
||||
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);
|
||||
|
||||
/** 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 <cmath>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
class ServerInterface;
|
||||
|
||||
@ -182,7 +182,6 @@ class Module : public virtual slsDetectorDefs {
|
||||
*/
|
||||
void updateNumberOfChannels();
|
||||
|
||||
|
||||
slsDetectorDefs::xy getNumberOfChannels() const;
|
||||
|
||||
/**
|
||||
@ -272,11 +271,12 @@ class Module : public virtual slsDetectorDefs {
|
||||
|
||||
detectorSettings getSettings();
|
||||
|
||||
/** [Jungfrau] Options:DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2
|
||||
* [Gotthard] Options: DYNAMICGAIN, HIGHGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN
|
||||
* [Gotthard2] Options: DYNAMICGAIN, FIXGAIN1, FIXGAIN2
|
||||
* [Moench] Options: G1_HIGHGAIN, G1_LOWGAIN, G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN,
|
||||
* G2_LOWCAP_HIGHGAIN, G2_LOWCAP_LOWGAIN, G4_HIGHGAIN, G4_LOWGAIN
|
||||
/** [Jungfrau] Options:DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2,
|
||||
* FORCESWITCHG1, FORCESWITCHG2 [Gotthard] Options: DYNAMICGAIN, HIGHGAIN,
|
||||
* LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN [Gotthard2] Options: DYNAMICGAIN,
|
||||
* FIXGAIN1, FIXGAIN2 [Moench] Options: G1_HIGHGAIN, G1_LOWGAIN,
|
||||
* G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN, G2_LOWCAP_HIGHGAIN,
|
||||
* G2_LOWCAP_LOWGAIN, G4_HIGHGAIN, G4_LOWGAIN
|
||||
*/
|
||||
void setSettings(detectorSettings isettings);
|
||||
|
||||
@ -499,7 +499,6 @@ class Module : public virtual slsDetectorDefs {
|
||||
* [Gotthard2] only in continuous mode */
|
||||
int64_t getMeasurementTime() const;
|
||||
|
||||
|
||||
timingMode getTimingMode();
|
||||
void setTimingMode(timingMode value);
|
||||
|
||||
@ -524,7 +523,8 @@ class Module : public virtual slsDetectorDefs {
|
||||
int getOnChipDAC(slsDetectorDefs::dacIndex index, int chipIndex);
|
||||
|
||||
/* [Gotthard2] */
|
||||
void setOnChipDAC(slsDetectorDefs::dacIndex index, int chipIndex, int value);
|
||||
void setOnChipDAC(slsDetectorDefs::dacIndex index, int chipIndex,
|
||||
int value);
|
||||
|
||||
/**
|
||||
* Get adc value
|
||||
@ -581,7 +581,8 @@ class Module : public virtual slsDetectorDefs {
|
||||
|
||||
/**
|
||||
* [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);
|
||||
|
||||
@ -702,14 +703,16 @@ class Module : public virtual slsDetectorDefs {
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
void setDestinationUDPIP(const sls::IpAddr ip);
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
sls::IpAddr getDestinationUDPIP();
|
||||
@ -717,14 +720,16 @@ class Module : public virtual slsDetectorDefs {
|
||||
/**
|
||||
* Validates the format of the receiver UDP IP address (bottom half) and
|
||||
* 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)
|
||||
*/
|
||||
void setDestinationUDPIP2(const sls::IpAddr ip);
|
||||
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
sls::IpAddr getDestinationUDPIP2();
|
||||
@ -904,13 +909,15 @@ class Module : public virtual slsDetectorDefs {
|
||||
void setTransmissionDelayRight(int value);
|
||||
|
||||
/** 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();
|
||||
|
||||
/**
|
||||
* Sets the value for the additional json header parameter key if found, else
|
||||
* append it. If value empty, then deletes parameter */
|
||||
void setAdditionalJsonParameter(const std::string &key, const std::string &value);
|
||||
* Sets the value for the additional json header parameter key if found,
|
||||
* else append it. If value empty, then deletes parameter */
|
||||
void setAdditionalJsonParameter(const std::string &key,
|
||||
const std::string &value);
|
||||
std::string getAdditionalJsonParameter(const std::string &key);
|
||||
|
||||
/**
|
||||
@ -947,7 +954,6 @@ class Module : public virtual slsDetectorDefs {
|
||||
* Only for virtual servers */
|
||||
void setImageTestMode(const int value);
|
||||
|
||||
|
||||
/** [Gotthard2] */
|
||||
std::array<int, 2> getInjectChannel();
|
||||
|
||||
@ -960,7 +966,8 @@ class Module : public virtual slsDetectorDefs {
|
||||
std::vector<int> getVetoPhoton(const int chipIndex);
|
||||
|
||||
/** [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);
|
||||
|
||||
@ -1340,7 +1347,6 @@ class Module : public virtual slsDetectorDefs {
|
||||
bool getPartialFramesPadding();
|
||||
void setPartialFramesPadding(bool padding);
|
||||
|
||||
|
||||
/**
|
||||
* Receiver starts listening to packets
|
||||
*/
|
||||
@ -1373,7 +1379,6 @@ class Module : public virtual slsDetectorDefs {
|
||||
uint64_t getReceiverCurrentFrameIndex() const;
|
||||
int getReceiverProgress() const;
|
||||
|
||||
|
||||
void setFileWrite(bool value);
|
||||
bool getFileWrite();
|
||||
void setMasterFileWrite(bool value);
|
||||
@ -1478,7 +1483,6 @@ class Module : public virtual slsDetectorDefs {
|
||||
*/
|
||||
int setPatternLoopCycles(int level = -1, int n = -1);
|
||||
|
||||
|
||||
/**
|
||||
* Sets the wait address (CTB/ Moench/ Mythen3)
|
||||
* @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);
|
||||
|
||||
template <typename Ret>
|
||||
Ret sendToDetector(int fnum);
|
||||
template <typename Ret> Ret sendToDetector(int fnum);
|
||||
|
||||
template <typename Ret, typename Arg>
|
||||
Ret sendToDetector(int fnum, const Arg &args);
|
||||
@ -1662,11 +1665,9 @@ class Module : public virtual slsDetectorDefs {
|
||||
template <typename Ret>
|
||||
void sendToReceiver(int fnum, std::nullptr_t, Ret &retval) const;
|
||||
|
||||
template <typename Ret>
|
||||
Ret sendToReceiver(int fnum);
|
||||
template <typename Ret> Ret sendToReceiver(int fnum);
|
||||
|
||||
template <typename Ret>
|
||||
Ret sendToReceiver(int fnum) const;
|
||||
template <typename Ret> Ret sendToReceiver(int fnum) const;
|
||||
|
||||
template <typename Ret, typename Arg>
|
||||
Ret sendToReceiver(int fnum, const Arg &args);
|
||||
@ -1779,4 +1780,4 @@ class Module : public virtual slsDetectorDefs {
|
||||
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 {
|
||||
|
||||
template <typename T>
|
||||
class SharedMemory {
|
||||
template <typename T> class SharedMemory {
|
||||
|
||||
public:
|
||||
/**
|
||||
@ -53,9 +52,8 @@ class SharedMemory {
|
||||
SharedMemory &operator=(const SharedMemory &other) = delete;
|
||||
|
||||
// Move constructor
|
||||
SharedMemory(SharedMemory &&other) : name(other.name),
|
||||
fd(other.fd),
|
||||
shmSize(other.shmSize),
|
||||
SharedMemory(SharedMemory &&other)
|
||||
: name(other.name), fd(other.fd), shmSize(other.shmSize),
|
||||
shared_struct(other.shared_struct) {
|
||||
|
||||
other.fd = -1;
|
||||
@ -110,29 +108,29 @@ class SharedMemory {
|
||||
/**
|
||||
* Get shared memory name
|
||||
*/
|
||||
std::string GetName() const {
|
||||
return name;
|
||||
}
|
||||
std::string GetName() const { return name; }
|
||||
|
||||
size_t size() const {
|
||||
return shmSize;
|
||||
}
|
||||
size_t size() const { return shmSize; }
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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) {
|
||||
std::string msg = "Create shared memory " + name + " failed: " + strerror(errno);
|
||||
std::string msg =
|
||||
"Create shared memory " + name + " failed: " + strerror(errno);
|
||||
LOG(logERROR) << msg;
|
||||
throw SharedMemoryError(msg);
|
||||
}
|
||||
|
||||
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;
|
||||
close(fd);
|
||||
RemoveSharedMemory();
|
||||
@ -144,14 +142,15 @@ class SharedMemory {
|
||||
}
|
||||
|
||||
/**
|
||||
* Open existing Shared memory and call MapSharedMemory to map it to an address
|
||||
* throws a SharedMemoryError exception on failure to open or map
|
||||
* Open existing Shared memory and call MapSharedMemory to map it to an
|
||||
* address throws a SharedMemoryError exception on failure to open or map
|
||||
* @param sz of shared memory
|
||||
*/
|
||||
void OpenSharedMemory() {
|
||||
fd = shm_open(name.c_str(), O_RDWR, 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;
|
||||
throw SharedMemoryError(msg);
|
||||
}
|
||||
@ -166,7 +165,8 @@ class SharedMemory {
|
||||
void UnmapSharedMemory() {
|
||||
if (shared_struct != nullptr) {
|
||||
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;
|
||||
close(fd);
|
||||
throw SharedMemoryError(msg);
|
||||
@ -184,7 +184,8 @@ class SharedMemory {
|
||||
// silent exit if shm did not exist anyway
|
||||
if (errno == ENOENT)
|
||||
return;
|
||||
std::string msg = "Free Shared Memory " + name + " Failed: " + strerror(errno);
|
||||
std::string msg =
|
||||
"Free Shared Memory " + name + " Failed: " + strerror(errno);
|
||||
LOG(logERROR) << msg;
|
||||
throw SharedMemoryError(msg);
|
||||
}
|
||||
@ -199,16 +200,12 @@ class SharedMemory {
|
||||
/**
|
||||
*Using the call operator to access the pointer
|
||||
*/
|
||||
T *operator()() {
|
||||
return shared_struct;
|
||||
}
|
||||
T *operator()() { return shared_struct; }
|
||||
|
||||
/**
|
||||
*Using the call operator to access the pointer, const overload
|
||||
*/
|
||||
const T *operator()() const {
|
||||
return shared_struct;
|
||||
}
|
||||
const T *operator()() const { return shared_struct; }
|
||||
|
||||
private:
|
||||
/**
|
||||
@ -232,11 +229,16 @@ class SharedMemory {
|
||||
if (slsId < 0)
|
||||
ss << SHM_MULTI_PREFIX << multiId << sEnvPath;
|
||||
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();
|
||||
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;
|
||||
throw SharedMemoryError(msg);
|
||||
}
|
||||
@ -250,9 +252,11 @@ class SharedMemory {
|
||||
*/
|
||||
|
||||
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) {
|
||||
std::string msg = "Mapping shared memory " + name + " failed: " + strerror(errno);
|
||||
std::string msg =
|
||||
"Mapping shared memory " + name + " failed: " + strerror(errno);
|
||||
LOG(logERROR) << msg;
|
||||
close(fd);
|
||||
throw SharedMemoryError(msg);
|
||||
@ -264,14 +268,17 @@ class SharedMemory {
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
int VerifySizeMatch(size_t expectedSize) {
|
||||
struct stat sb;
|
||||
// could not fstat
|
||||
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;
|
||||
close(fd);
|
||||
throw SharedMemoryError(msg);
|
||||
@ -280,7 +287,10 @@ class SharedMemory {
|
||||
// size does not match
|
||||
auto sz = static_cast<size_t>(sb.st_size);
|
||||
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;
|
||||
throw SharedMemoryError(msg);
|
||||
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 "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"
|
||||
|
||||
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;
|
||||
|
||||
void slsDetectorUsers::readConfigurationFile(const std::string &fname) {
|
||||
detector->loadConfig(fname);
|
||||
}
|
||||
|
||||
int slsDetectorUsers::size() const {
|
||||
return detector->size();
|
||||
}
|
||||
int slsDetectorUsers::size() const { return detector->size(); }
|
||||
|
||||
// int slsDetectorUsers::getDetectorSize(int &nx, int &ny, int detPos){
|
||||
// slsDetectorDefs::xy res = detector.getNumberOfChannels();
|
||||
@ -38,7 +38,8 @@ int slsDetectorUsers::size() const {
|
||||
// }
|
||||
|
||||
// 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){
|
||||
@ -46,7 +47,8 @@ int slsDetectorUsers::size() const {
|
||||
// }
|
||||
|
||||
// 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(){
|
||||
@ -103,37 +105,40 @@ int slsDetectorUsers::size() const {
|
||||
// }
|
||||
|
||||
// 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){
|
||||
// return detector.getThresholdEnergy(detPos);
|
||||
// }
|
||||
|
||||
// int slsDetectorUsers::setThresholdEnergy(int e_ev, int tb, int isettings, int detPos) {
|
||||
// return detector.setThresholdEnergy(e_ev,
|
||||
// (isettings == -1) ? slsDetectorDefs::GET_SETTINGS : (slsDetectorDefs::detectorSettings)isettings,
|
||||
// tb, detPos);
|
||||
// int slsDetectorUsers::setThresholdEnergy(int e_ev, int tb, int isettings, int
|
||||
// detPos) { return detector.setThresholdEnergy(e_ev,
|
||||
// (isettings == -1) ? slsDetectorDefs::GET_SETTINGS :
|
||||
// (slsDetectorDefs::detectorSettings)isettings, tb, detPos);
|
||||
// }
|
||||
|
||||
// double slsDetectorUsers::setExposureTime(double t, bool inseconds, int detPos){
|
||||
// return detector.setExposureTime(t, inseconds, detPos);
|
||||
// double slsDetectorUsers::setExposureTime(double t, bool inseconds, int
|
||||
// detPos){ return detector.setExposureTime(t, inseconds, detPos);
|
||||
// }
|
||||
|
||||
// double slsDetectorUsers::setExposurePeriod(double t, bool inseconds, int detPos){
|
||||
// return detector.setExposurePeriod(t, inseconds, detPos);
|
||||
// double slsDetectorUsers::setExposurePeriod(double t, bool inseconds, int
|
||||
// detPos){ return detector.setExposurePeriod(t, inseconds, detPos);
|
||||
// }
|
||||
|
||||
// double slsDetectorUsers::setDelayAfterTrigger(double t, bool inseconds, int detPos){
|
||||
// return detector.setDelayAfterTrigger(t, inseconds, detPos);
|
||||
// double slsDetectorUsers::setDelayAfterTrigger(double t, bool inseconds, int
|
||||
// detPos){ return detector.setDelayAfterTrigger(t, inseconds, detPos);
|
||||
// }
|
||||
|
||||
// double slsDetectorUsers::setSubFrameExposureTime(double t, bool inseconds, int detPos){
|
||||
// return detector.setSubFrameExposureTime(t, inseconds, detPos);
|
||||
// double slsDetectorUsers::setSubFrameExposureTime(double t, bool inseconds,
|
||||
// int detPos){ return detector.setSubFrameExposureTime(t, inseconds,
|
||||
// detPos);
|
||||
// }
|
||||
|
||||
// double slsDetectorUsers::setSubFrameExposureDeadTime(double t, bool inseconds, int detPos){
|
||||
// return detector.setSubFrameExposureDeadTime(t, inseconds, detPos);
|
||||
// double slsDetectorUsers::setSubFrameExposureDeadTime(double t, bool
|
||||
// inseconds, int detPos){ return detector.setSubFrameExposureDeadTime(t,
|
||||
// inseconds, detPos);
|
||||
// }
|
||||
|
||||
// int64_t slsDetectorUsers::setNumberOfFrames(int64_t t, int detPos){
|
||||
@ -152,8 +157,8 @@ int slsDetectorUsers::size() const {
|
||||
// return detector.getMeasuredPeriod(inseconds, detPos);
|
||||
// }
|
||||
|
||||
// double slsDetectorUsers::getMeasuredSubFramePeriod(bool inseconds, int detPos) {
|
||||
// return detector.getMeasuredSubFramePeriod(inseconds, detPos);
|
||||
// double slsDetectorUsers::getMeasuredSubFramePeriod(bool inseconds, int
|
||||
// detPos) { return detector.getMeasuredSubFramePeriod(inseconds, 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) {
|
||||
// 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) {
|
||||
@ -224,7 +230,6 @@ int slsDetectorUsers::size() const {
|
||||
|
||||
// *********************************************************************/
|
||||
|
||||
|
||||
// void slsDetectorUsers::startReceiver(int detPos) {
|
||||
// detector.startReceiver(detPos);
|
||||
// }
|
||||
@ -314,15 +319,15 @@ int slsDetectorUsers::size() const {
|
||||
// return detector.getClientStreamingPort(detPos);
|
||||
// }
|
||||
|
||||
// std::string slsDetectorUsers::setReceiverDataStreamingOutIP(const std::string& ip, int detPos){
|
||||
// if (ip.length()) {
|
||||
// std::string slsDetectorUsers::setReceiverDataStreamingOutIP(const
|
||||
// std::string& ip, int detPos){ if (ip.length()) {
|
||||
// detector.setReceiverDataStreamingOutIP(ip, detPos);
|
||||
// }
|
||||
// return detector.getReceiverStreamingIP(detPos);
|
||||
// }
|
||||
|
||||
// std::string slsDetectorUsers::setClientDataStreamingInIP(const std::string& ip, int detPos){
|
||||
// if (ip.length()) {
|
||||
// std::string slsDetectorUsers::setClientDataStreamingInIP(const std::string&
|
||||
// ip, int detPos){ if (ip.length()) {
|
||||
// detector.setClientDataStreamingInIP(ip, detPos);
|
||||
// }
|
||||
// return detector.getClientStreamingIP(detPos);
|
||||
@ -333,7 +338,9 @@ int slsDetectorUsers::size() const {
|
||||
// }
|
||||
|
||||
// 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) {
|
||||
@ -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);
|
||||
// }
|
||||
|
||||
// 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) {
|
||||
// return detector.setDetectorMode(slsDetectorDefs::detectorModeType(value), detPos);
|
||||
// return detector.setDetectorMode(slsDetectorDefs::detectorModeType(value),
|
||||
// detPos);
|
||||
// }
|
||||
|
||||
|
||||
// /************************************************************************
|
||||
|
||||
// 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);
|
||||
// }
|
||||
|
||||
// void slsDetectorUsers::registerAcquisitionFinishedCallback(void( *func)(double,int, void*), void *pArg) {
|
||||
// void slsDetectorUsers::registerAcquisitionFinishedCallback(void(
|
||||
// *func)(double,int, void*), void *pArg) {
|
||||
// detector.registerAcquisitionFinishedCallback(func,pArg);
|
||||
// }
|
||||
|
||||
// void slsDetectorUsers::putCommand(const std::string& command){
|
||||
// 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 <string>
|
||||
|
||||
|
||||
// tests to add
|
||||
// help for all docs
|
||||
// command for all depreciated commands
|
||||
@ -166,7 +165,6 @@ TEST_CASE("Parsing consecutive strings resets not found det id"){
|
||||
REQUIRE(p.detector_id() == -1);
|
||||
p.Parse("3:exptime 0.5");
|
||||
REQUIRE(p.detector_id() == 3);
|
||||
|
||||
}
|
||||
|
||||
TEST_CASE("Parsing consecutive strings resets not found multi id") {
|
||||
|
@ -17,7 +17,8 @@ using test::PUT;
|
||||
|
||||
/* 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
|
||||
|
||||
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();
|
||||
if (det_type == defs::CHIPTESTBOARD) {
|
||||
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
|
||||
// REQUIRE_THROWS(proxy.Call("vthreshold", {}, -1, GET));
|
||||
|
@ -14,7 +14,6 @@ using sls::Detector;
|
||||
using test::GET;
|
||||
using test::PUT;
|
||||
|
||||
|
||||
/** temperature */
|
||||
|
||||
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]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@ -519,8 +494,6 @@ TEST_CASE("quad", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// TEST_CASE("trigger", "[.cmd]") {
|
||||
// Detector det;
|
||||
// CmdProxy proxy(&det);
|
||||
|
@ -9,7 +9,6 @@ using sls::Detector;
|
||||
using test::GET;
|
||||
using test::PUT;
|
||||
|
||||
|
||||
void test_dac(defs::dacIndex index, const std::string &dacname, int dacvalue) {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@ -20,9 +19,11 @@ void test_dac(defs::dacIndex index, const std::string &dacname, int dacvalue) {
|
||||
if (dacname == "dac") {
|
||||
auto dacIndexstr = std::to_string(static_cast<int>(index));
|
||||
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);
|
||||
REQUIRE(oss_get.str() == dacname + " " + dacIndexstr + " " + dacstr + "\n");
|
||||
REQUIRE(oss_get.str() ==
|
||||
dacname + " " + dacIndexstr + " " + dacstr + "\n");
|
||||
}
|
||||
// other detectors
|
||||
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;
|
||||
CmdProxy proxy(&det);
|
||||
REQUIRE_THROWS(proxy.Call(dacname, {}, -1, GET));
|
||||
REQUIRE_THROWS(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
|
||||
REQUIRE_THROWS(
|
||||
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
|
||||
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);
|
||||
std::ostringstream oss_set, oss_get;
|
||||
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);
|
||||
REQUIRE(oss_get.str() == dacname + " " + chipIndexStr + " " + dacValueStr + "\n");
|
||||
REQUIRE(oss_get.str() ==
|
||||
dacname + " " + chipIndexStr + " " + dacValueStr + "\n");
|
||||
|
||||
// Reset all dacs to previous value
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
void test_dac(slsDetectorDefs::dacIndex index, const std::string &dacname, int dacvalue);
|
||||
void test_onchip_dac(slsDetectorDefs::dacIndex index, const std::string &dacname, int dacvalue);
|
||||
void test_dac(slsDetectorDefs::dacIndex index, const std::string &dacname,
|
||||
int dacvalue);
|
||||
void test_onchip_dac(slsDetectorDefs::dacIndex index,
|
||||
const std::string &dacname, int dacvalue);
|
||||
|
@ -18,7 +18,8 @@ using test::PUT;
|
||||
/* dacs */
|
||||
|
||||
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;
|
||||
CmdProxy proxy(&det);
|
||||
|
@ -22,9 +22,12 @@ TEST_CASE("bursts", "[.cmd][.new]") {
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
auto prev_burst = det.getNumberOfBursts().tsquash("#bursts 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_burst =
|
||||
det.getNumberOfBursts().tsquash("#bursts 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_burstMode = det.getBurstMode();
|
||||
// changing continuous mode frames and bursts
|
||||
@ -100,15 +103,25 @@ TEST_CASE("Setting and reading back GOTTHARD2 dacs", "[.cmd][.dacs][.new]") {
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
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_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("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("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("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_cds") { test_dac(defs::VREF_CDS, "vref_cds", 1200); }
|
||||
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);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
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 {
|
||||
REQUIRE_THROWS(proxy.Call("vchip_comp_fe", {}, -1, GET));
|
||||
}
|
||||
@ -189,7 +204,9 @@ TEST_CASE("vchip_opa_1st", "[.cmd][.onchipdacs][.new]") {
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
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 {
|
||||
REQUIRE_THROWS(proxy.Call("vchip_opa_1st", {}, -1, GET));
|
||||
}
|
||||
@ -200,7 +217,9 @@ TEST_CASE("vchip_opa_fd", "[.cmd][.onchipdacs][.new]") {
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
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 {
|
||||
REQUIRE_THROWS(proxy.Call("vchip_opa_fd", {}, -1, GET));
|
||||
}
|
||||
@ -211,7 +230,9 @@ TEST_CASE("vchip_comp_adc", "[.cmd][.onchipdacs][.new]") {
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
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 {
|
||||
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);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
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 {
|
||||
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]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@ -286,7 +293,6 @@ TEST_CASE("burstmode", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("vetoref", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@ -294,14 +300,14 @@ TEST_CASE("vetoref", "[.cmd]") {
|
||||
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
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));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("vetoref", {"3", "0x0"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("vetophoton", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@ -310,16 +316,17 @@ TEST_CASE("vetophoton", "[.cmd]") {
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
REQUIRE_THROWS(proxy.Call("vetophoton", {}, -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", {"-1", "0"}, -1, PUT)); // invalid photon number
|
||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1", "1", "39950"}, -1, PUT)); // invald file
|
||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"12", "1", "39950"}, -1,
|
||||
PUT)); // invalid chip index
|
||||
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 {
|
||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1"}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST_CASE("inj_ch", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@ -327,8 +334,10 @@ TEST_CASE("inj_ch", "[.cmd]") {
|
||||
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
auto inj = det.getInjectChannel();
|
||||
REQUIRE_THROWS(proxy.Call("inj_ch", {"-1", "1"}, -1, PUT));// invalid offset
|
||||
REQUIRE_THROWS(proxy.Call("inj_ch", {"0", "0"}, -1, PUT));// invalid increment
|
||||
REQUIRE_THROWS(
|
||||
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;
|
||||
proxy.Call("inj_ch", {"0", "1"}, -1, PUT, oss);
|
||||
@ -347,9 +356,6 @@ TEST_CASE("inj_ch", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
TEST_CASE("burstperiod", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@ -372,7 +378,6 @@ TEST_CASE("burstperiod", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("currentsource", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
|
@ -16,7 +16,8 @@ using test::PUT;
|
||||
/* dacs */
|
||||
|
||||
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;
|
||||
CmdProxy proxy(&det);
|
||||
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("vdd_prot") { test_dac(defs::VDD_PROT, "vdd_prot", 3000); }
|
||||
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_ds") { test_dac(defs::VB_DS, "vb_ds", 1000); }
|
||||
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]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@ -234,5 +205,3 @@ TEST_CASE("resetfpga", "[.cmd]") {
|
||||
REQUIRE_THROWS(proxy.Call("resetfpga", {}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,13 +18,16 @@ using test::PUT;
|
||||
/* dacs */
|
||||
|
||||
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;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
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("vin_cm") { test_dac(defs::VIN_CM, "vin_cm", 1400); }
|
||||
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]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
|
@ -106,7 +106,6 @@ TEST_CASE("rx_framescaught", "[.cmd][.rx][.new]") {
|
||||
// proxy.Call("rx_framescaught", {}, -1, GET, oss);
|
||||
// REQUIRE(oss.str() == "rx_framescaught 1\n");
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
/* Receiver Config */
|
||||
|
||||
TEST_CASE("rx_hostname", "[.cmd][.rx][.new]") {
|
||||
@ -149,7 +147,8 @@ TEST_CASE("rx_hostname", "[.cmd][.rx][.new]") {
|
||||
CmdProxy proxy(&det);
|
||||
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
|
||||
// std::ostringstream oss;
|
||||
@ -304,7 +303,8 @@ TEST_CASE("rx_padding", "[.cmd][.rx][.new]") {
|
||||
TEST_CASE("rx_udpsocksize", "[.cmd][.rx][.new]") {
|
||||
Detector 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::ostringstream oss;
|
||||
@ -683,7 +683,9 @@ TEST_CASE("rx_dbitlist", "[.cmd][.rx][.new]") {
|
||||
auto prev_val = det.getRxDbitList();
|
||||
{
|
||||
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");
|
||||
}
|
||||
{
|
||||
@ -745,7 +747,8 @@ TEST_CASE("rx_jsonaddheader", "[.cmd][.rx][.new]") {
|
||||
|
||||
{
|
||||
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");
|
||||
}
|
||||
{
|
||||
|
@ -2,9 +2,9 @@
|
||||
#include "Detector.h"
|
||||
#include "catch.hpp"
|
||||
#include "sls_detector_defs.h"
|
||||
#include <chrono>
|
||||
#include <sstream>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
#include "tests/globals.h"
|
||||
|
||||
@ -37,7 +37,8 @@ TEST_CASE("parameters", "[.cmd][.new]") {
|
||||
// put only
|
||||
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 ");
|
||||
std::ostringstream oss;
|
||||
@ -196,7 +197,8 @@ TEST_CASE("settings", "[.cmd][.new]") {
|
||||
TEST_CASE("frames", "[.cmd][.new]") {
|
||||
Detector 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;
|
||||
proxy.Call("frames", {"1000"}, -1, PUT, oss);
|
||||
@ -219,7 +221,8 @@ TEST_CASE("frames", "[.cmd][.new]") {
|
||||
TEST_CASE("triggers", "[.cmd][.new]") {
|
||||
Detector 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;
|
||||
proxy.Call("triggers", {"1000"}, -1, PUT, oss);
|
||||
@ -468,10 +471,8 @@ TEST_CASE("adcphase", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::GOTTHARD ||
|
||||
det_type == defs::JUNGFRAU ||
|
||||
det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::MOENCH) {
|
||||
if (det_type == defs::GOTTHARD || det_type == defs::JUNGFRAU ||
|
||||
det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
|
||||
if (det_type == defs::GOTTHARD) {
|
||||
std::ostringstream oss1;
|
||||
proxy.Call("adcphase", {"20"}, -1, PUT, oss1);
|
||||
@ -509,8 +510,7 @@ TEST_CASE("maxadcphaseshift", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU ||
|
||||
det_type == defs::CHIPTESTBOARD ||
|
||||
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3 || // 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;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU ||
|
||||
det_type == defs::CHIPTESTBOARD) {
|
||||
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD) {
|
||||
auto prev_val = det.getDBITPhase();
|
||||
{
|
||||
std::ostringstream oss1, oss2;
|
||||
@ -554,8 +553,7 @@ TEST_CASE("maxdbitphaseshift", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU ||
|
||||
det_type == defs::CHIPTESTBOARD ||
|
||||
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::MYTHEN3 || // 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));
|
||||
@ -654,7 +652,6 @@ TEST_CASE("maxclkphaseshift", "[.cmd][.new]") {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("vhighvoltage", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@ -679,8 +676,7 @@ TEST_CASE("vhighvoltage", "[.cmd][.new]") {
|
||||
}
|
||||
}
|
||||
// range 0, 60 - 200
|
||||
else if (det_type == defs::JUNGFRAU ||
|
||||
det_type == defs::CHIPTESTBOARD ||
|
||||
else if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD ||
|
||||
det_type == defs::MOENCH) {
|
||||
REQUIRE_THROWS(proxy.Call("vhighvoltage", {"50"}, -1, PUT));
|
||||
{
|
||||
@ -761,10 +757,8 @@ TEST_CASE("powerchip", "[.cmd][.new]") {
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::JUNGFRAU ||
|
||||
det_type == defs::MYTHEN3 ||
|
||||
det_type == defs::GOTTHARD2 ||
|
||||
det_type == defs::MOENCH) {
|
||||
if (det_type == defs::JUNGFRAU || det_type == defs::MYTHEN3 ||
|
||||
det_type == defs::GOTTHARD2 || det_type == defs::MOENCH) {
|
||||
auto prev_val = det.getPowerChip();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
@ -812,8 +806,7 @@ TEST_CASE("imagetest", "[.cmd][.new]") {
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setImageTestMode(prev_val[i], {i});
|
||||
}
|
||||
} else if (det_type != defs::JUNGFRAU &&
|
||||
det_type != defs::EIGER) {
|
||||
} else if (det_type != defs::JUNGFRAU && det_type != defs::EIGER) {
|
||||
// wont fail for eiger and jungfrau virtual servers
|
||||
REQUIRE_THROWS(proxy.Call("imagetest", {}, -1, GET));
|
||||
}
|
||||
@ -965,44 +958,6 @@ TEST_CASE("startingfnum", "[.cmd][.new]") {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TEST_CASE("initialchecks", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@ -1032,7 +987,6 @@ TEST_CASE("initialchecks", "[.cmd]") {
|
||||
det.setInitialChecks(check);
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("user", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@ -1313,7 +1267,6 @@ TEST_CASE("stopport", "[.cmd]") {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("rx_jsonaddheader \"\"", PUT));
|
||||
// }
|
||||
|
||||
|
||||
// TEST_CASE("patsetbit", "[.cmd][.ctb]") {
|
||||
// if (test::type == defs::CHIPTESTBOARD) {
|
||||
// uint64_t val = 0;
|
||||
@ -1932,8 +1885,6 @@ TEST_CASE("stopport", "[.cmd]") {
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// TEST_CASE("romode", "[.cmd][.ctb]") {
|
||||
// if (test::type == defs::CHIPTESTBOARD) {
|
||||
// {
|
||||
@ -2415,8 +2366,6 @@ TEST_CASE("stopport", "[.cmd]") {
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// TEST_CASE("trimval", "[.cmd][.eiger]") {
|
||||
// if (test::type == defs::EIGER) {
|
||||
// {
|
||||
@ -2460,8 +2409,6 @@ TEST_CASE("stopport", "[.cmd]") {
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// TEST_CASE("parallel", "[.cmd][.eiger]") {
|
||||
// if (test::type == defs::EIGER) {
|
||||
// {
|
||||
@ -2556,7 +2503,9 @@ TEST_CASE("zmqport", "[.cmd]") {
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
std::ostringstream 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;
|
||||
@ -2569,18 +2518,15 @@ TEST_CASE("zmqport", "[.cmd]") {
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
std::ostringstream 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) {
|
||||
det.setNumberofUDPInterfaces(prev);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// TEST_CASE("txndelay", "[.cmd][.eiger][.jungfrau]") {
|
||||
// if (test::type == defs::EIGER) {
|
||||
// {
|
||||
@ -2823,8 +2769,6 @@ TEST_CASE("zmqport", "[.cmd]") {
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("numinterfaces 0", PUT));
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// TEST_CASE("adc", "[.cmd][.ctb]") {
|
||||
// if (test::type != defs::CHIPTESTBOARD) {
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("adc 8", GET));
|
||||
@ -2838,9 +2782,6 @@ TEST_CASE("zmqport", "[.cmd]") {
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
// TEST_CASE("syncclk", "[.cmd][.ctb]") {
|
||||
// if(test::type != defs::CHIPTESTBOARD) {
|
||||
// REQUIRE_THROWS(multiSlsDetectorClient("syncclk", GET));
|
||||
@ -2934,8 +2875,6 @@ TEST_CASE("zmqport", "[.cmd]") {
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// TEST_CASE("threshold", "[.cmd]") {
|
||||
// if (test::type == defs::EIGER) {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("threshold 6400 standard",
|
||||
@ -2964,7 +2903,6 @@ TEST_CASE("zmqport", "[.cmd]") {
|
||||
// CHECK_NOTHROW(multiSlsDetectorClient("type", GET));
|
||||
// }
|
||||
|
||||
|
||||
// TEST_CASE("status", "[.cmd]") {
|
||||
// Detector det;
|
||||
// CmdProxy proxy(&det);
|
||||
@ -2999,11 +2937,6 @@ TEST_CASE("zmqport", "[.cmd]") {
|
||||
// proxy.Call("frames", {"1"}, -1, PUT);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TEST_CASE("lock", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@ -3027,8 +2960,3 @@ TEST_CASE("lock", "[.cmd]") {
|
||||
// TEST_CASE("lastclient", "[.cmd]") {
|
||||
// REQUIRE_NOTHROW(multiSlsDetectorClient("lastclient", GET));
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "Result.h"
|
||||
#include "ToString.h"
|
||||
#include "TypeTraits.h"
|
||||
#include "catch.hpp"
|
||||
#include <string>
|
||||
#include "ToString.h"
|
||||
|
||||
using sls::Result;
|
||||
|
||||
@ -41,7 +41,6 @@ TEST_CASE("Result can be iterated using modern syntax"){
|
||||
int i = 0;
|
||||
for (const auto &r : res)
|
||||
REQUIRE(r == i++);
|
||||
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("Result of vectors") {
|
||||
using VecVec = std::vector<std::vector<int>>;
|
||||
VecVec vecvec{{1, 2, 3}, {4, 5, 6}};
|
||||
@ -163,7 +161,6 @@ TEST_CASE("Printing Result<std::string>"){
|
||||
std::ostringstream os;
|
||||
os << res;
|
||||
REQUIRE(os.str() == "[ein, zwei, drei]");
|
||||
|
||||
}
|
||||
|
||||
TEST_CASE("Printing Result<int>") {
|
||||
@ -171,7 +168,6 @@ TEST_CASE("Printing Result<int>"){
|
||||
std::ostringstream os;
|
||||
os << res;
|
||||
REQUIRE(os.str() == "[1, 2, 3]");
|
||||
|
||||
}
|
||||
|
||||
TEST_CASE("String conversions") {
|
||||
@ -194,5 +190,6 @@ TEST_CASE("String conversions"){
|
||||
m2["three"] = "3";
|
||||
|
||||
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.size() == 0);
|
||||
|
||||
CHECK(shm2.GetName() == std::string("/slsDetectorPackage_multi_") +
|
||||
std::to_string(shm_id));
|
||||
CHECK(shm2.GetName() ==
|
||||
std::string("/slsDetectorPackage_multi_") + std::to_string(shm_id));
|
||||
shm2.RemoveSharedMemory();
|
||||
|
||||
}
|
||||
|
||||
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 <iostream>
|
||||
|
||||
|
||||
|
||||
// TEST_CASE("Set and get trimen", "[detector]") {
|
||||
// // Free shared memory to be sure that we start in a clean state
|
||||
// slsDetector::freeSharedMemory(20, 20);
|
||||
@ -188,12 +186,10 @@
|
||||
// d.setPartialFramesPadding(true);
|
||||
// CHECK(d.getPartialFramesPadding() == true);
|
||||
|
||||
|
||||
// d.freeSharedMemory();
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// TEST_CASE("create detParamets struct", "[detector][new]"){
|
||||
// detParameters par;
|
||||
// CHECK(sizeof(par) == 32);
|
||||
@ -206,7 +202,6 @@
|
||||
// CHECK(par.nGappixelsX == 0);
|
||||
// CHECK(par.nGappixelsY == 0);
|
||||
|
||||
|
||||
// detParameters par2{slsDetectorDefs::detectorType::EIGER};
|
||||
// CHECK(sizeof(par2) == 32);
|
||||
// CHECK(par2.nChanX == 256);
|
||||
@ -219,7 +214,6 @@
|
||||
// CHECK(par2.nGappixelsY == 1);
|
||||
// }
|
||||
|
||||
|
||||
// TEST_CASE("ctb digital offset and list", "[detector][ctb]"){
|
||||
// slsDetector::freeSharedMemory(20, 20);
|
||||
// slsDetector d(slsDetectorDefs::detectorType::CHIPTESTBOARD, 20, 20);
|
||||
@ -235,7 +229,6 @@
|
||||
// std::vector <int> list = d.getReceiverDbitList();
|
||||
// CHECK(list.empty());
|
||||
|
||||
|
||||
// for (int i = 0; i < 10; ++i)
|
||||
// list.push_back(i);
|
||||
// d.setReceiverDbitList(list);
|
||||
@ -258,6 +251,4 @@
|
||||
// d.setReceiverDbitList(list);
|
||||
// CHECK(d.getReceiverDbitList().empty());
|
||||
|
||||
|
||||
|
||||
// }
|
@ -1,12 +1,11 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
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 type_string = "Eiger";
|
||||
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::PUT_ACTION) PUT;
|
||||
|
||||
|
||||
} // namespace test
|
||||
|
Loading…
x
Reference in New Issue
Block a user