mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 07:20:01 +02:00
Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer
This commit is contained in:
commit
7abe070ea8
@ -45,5 +45,5 @@ deploy:
|
||||
provider: script
|
||||
script: find $HOME/miniconda/conda-bld/${TRAVIS_OS_NAME}-64 -name "*.tar.bz2" -exec anaconda -t $CONDA_TOKEN upload --force {} \;
|
||||
on:
|
||||
branch: refactor
|
||||
branch: developer
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
package:
|
||||
name: sls_detector_software
|
||||
version: "refactor"
|
||||
version: "developer"
|
||||
|
||||
source:
|
||||
- path: ..
|
||||
@ -76,7 +76,7 @@ outputs:
|
||||
run:
|
||||
- python
|
||||
- numpy
|
||||
- sls_detector_lib=refactor
|
||||
- sls_detector_lib=developer
|
||||
- pyzmq
|
||||
- libstdcxx-ng
|
||||
- libgcc-ng
|
||||
|
@ -5,11 +5,19 @@ sys.path.append(os.path.join(os.getcwd(), 'bin'))
|
||||
from sls_detector import Eiger
|
||||
from sls_detector import ExperimentalDetector
|
||||
|
||||
from _sls_detector.io import read_ctb_file
|
||||
from _sls_detector.io import read_my302_file
|
||||
|
||||
d = Eiger()
|
||||
e = ExperimentalDetector()
|
||||
|
||||
|
||||
# for i in range(200):
|
||||
# a = read_my302_file('/home/l_frojdh/Downloads/run_d0_5.raw', i, 24)
|
||||
# print(f'{i}: {(a==5).sum()}')
|
||||
|
||||
|
||||
|
||||
a = read_my302_file('/home/l_frojdh/Downloads/run_d0_5.raw', 104, 24)
|
||||
# ncols = 192
|
||||
# start = 600
|
||||
# end = 1800
|
||||
|
@ -286,7 +286,7 @@ py::class_<multiSlsDetector> multiDetectorApi(m, "multiDetectorApi");
|
||||
;
|
||||
|
||||
py::module io = m.def_submodule("io", "Submodule for io");
|
||||
io.def("read_ctb_file", &read_ctb_file, "some");
|
||||
io.def("read_my302_file", &read_my302_file, "some");
|
||||
|
||||
|
||||
#ifdef VERSION_INFO
|
||||
|
@ -55,10 +55,10 @@ std::vector<int> ExtractBits(const std::vector<uint64_t> &data, int dr = 24) {
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<uint64_t> ReadFile(const std::string &fname, int offset = 8,
|
||||
std::vector<uint64_t> ReadFile(const std::string &fname, int byte_offset = 8,
|
||||
int dr = 24) {
|
||||
const int element_size = static_cast<int>(sizeof(uint64_t));
|
||||
const int byte_offset = element_size * offset;
|
||||
// const int byte_offset = element_size * offset;
|
||||
const int expected_size = dr * element_size * 32 * 3;
|
||||
std::ifstream fs(fname, std::ios::binary | std::ios::ate);
|
||||
if (!fs.is_open()) {
|
||||
@ -78,7 +78,7 @@ std::vector<uint64_t> ReadFile(const std::string &fname, int offset = 8,
|
||||
return data;
|
||||
}
|
||||
|
||||
py::array_t<uint64_t> read_ctb_file(const std::string &fname, int offset = 8,
|
||||
py::array_t<uint64_t> read_my302_file(const std::string &fname, int offset = 8,
|
||||
int dr = 24) {
|
||||
auto data = ExtractBits<17, 6>(ReadFile(fname, offset, dr));
|
||||
return py::array(data.size(), data.data());
|
||||
|
@ -1299,7 +1299,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns return value (mostly -1 as it can't read adc register)
|
||||
*/
|
||||
int writeAdcRegister(int addr, int val, int detPos = -1);
|
||||
int writeAdcRegister(uint32_t addr, uint32_t val, int detPos = -1);
|
||||
|
||||
/**
|
||||
* Activates/Deactivates the detector (Eiger only)
|
||||
@ -1488,13 +1488,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
*/
|
||||
int setAutoComparatorDisableMode(int ival = -1, int detPos = -1);
|
||||
|
||||
/**
|
||||
* Returns the trimbits from the detector's shared memmory (Mythen, Eiger)
|
||||
* @param retval is the array with the trimbits
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns total number of channels for the detector
|
||||
*/
|
||||
int getChanRegs(double *retval, int detPos = -1);
|
||||
|
||||
/**
|
||||
* Set Rate correction ( Eiger)
|
||||
|
@ -19,19 +19,7 @@ class MySocketTCP;
|
||||
#define NCHIPSMAX 10
|
||||
#define NCHANSMAX 65536
|
||||
#define NDACSMAX 16
|
||||
/**
|
||||
* parameter list that has to be initialized depending on the detector type
|
||||
*/
|
||||
struct detParameters {
|
||||
int nChanX;
|
||||
int nChanY;
|
||||
int nChipX;
|
||||
int nChipY;
|
||||
int nDacs;
|
||||
int dynamicRange;
|
||||
int nGappixelsX;
|
||||
int nGappixelsY;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @short structure allocated in shared memory to store detector settings for IPC and cache
|
||||
@ -204,7 +192,7 @@ struct sharedSlsDetector {
|
||||
int dataBytesInclGapPixels;
|
||||
|
||||
/** additional json header */
|
||||
char receiver_additionalJsonHeader[MAX_STR_LENGTH];
|
||||
char rxAdditionalJsonHeader[MAX_STR_LENGTH];
|
||||
|
||||
/** detector control server software API version */
|
||||
int64_t detectorControlAPIVersion;
|
||||
@ -225,7 +213,7 @@ struct sharedSlsDetector {
|
||||
bool activated;
|
||||
|
||||
/** padding enable in deactivated receiver */
|
||||
bool receiver_deactivatedPaddingEnable;
|
||||
bool rxPadDeactivatedModules;
|
||||
|
||||
/** silent receiver */
|
||||
bool receiver_silentMode;
|
||||
@ -1160,7 +1148,7 @@ class slsDetector : public virtual slsDetectorDefs{
|
||||
* @param val value
|
||||
* @returns return value (mostly -1 as it can't read adc register)
|
||||
*/
|
||||
int writeAdcRegister(int addr, int val);
|
||||
int writeAdcRegister(uint32_t addr, uint32_t val);
|
||||
|
||||
/**
|
||||
* Activates/Deactivates the detector (Eiger only)
|
||||
@ -1174,7 +1162,7 @@ class slsDetector : public virtual slsDetectorDefs{
|
||||
* @param padding padding option for deactivated receiver. Can be 1 (padding), 0 (no padding), -1 (gets)
|
||||
* @returns 1 (padding), 0 (no padding), -1 (inconsistent values) for padding option
|
||||
*/
|
||||
int setDeactivatedRxrPaddingMode(int padding = -1);
|
||||
bool setDeactivatedRxrPaddingMode(int padding = -1);
|
||||
|
||||
/**
|
||||
* Returns the enable if data will be flipped across x or y axis (Eiger)
|
||||
@ -1317,12 +1305,12 @@ class slsDetector : public virtual slsDetectorDefs{
|
||||
*/
|
||||
int setAutoComparatorDisableMode(int ival = -1);
|
||||
|
||||
/**
|
||||
* Returns the trimbits from the detector's shared memmory (Eiger)
|
||||
* @param retval is the array with the trimbits
|
||||
* @returns total number of channels for the detector
|
||||
|
||||
/**
|
||||
* Get trimbit filename with path for settings and energy
|
||||
*
|
||||
*/
|
||||
int getChanRegs(double *retval);
|
||||
std::string getTrimbitFilename(detectorSettings settings, int e_eV);
|
||||
|
||||
/**
|
||||
* Configure Module (Eiger)
|
||||
@ -1333,13 +1321,13 @@ class slsDetector : public virtual slsDetectorDefs{
|
||||
* @returns ok or fail
|
||||
* \sa ::sls_detector_module
|
||||
*/
|
||||
int setModule(sls_detector_module module, int tb = 1);
|
||||
int setModule(sls_detector_module& module, int tb = 1);
|
||||
|
||||
/**
|
||||
* Get module structure from detector (all detectors)
|
||||
* @returns pointer to module structure (which has been created and must then be deleted)
|
||||
*/
|
||||
sls_detector_module *getModule();
|
||||
sls_detector_module getModule();
|
||||
|
||||
/**
|
||||
* Set Rate correction (Eiger)
|
||||
@ -1747,13 +1735,6 @@ class slsDetector : public virtual slsDetectorDefs{
|
||||
*/
|
||||
void initSharedMemory(detectorType type, int multi_id, bool verify = true);
|
||||
|
||||
/**
|
||||
* Sets detector parameters depending detector type
|
||||
* @param type detector type
|
||||
* @param list structure of parameters to initialize depending on detector type
|
||||
*/
|
||||
void setDetectorSpecificParameters(detectorType type, detParameters &list);
|
||||
|
||||
/**
|
||||
* Initialize detector structure to defaults
|
||||
* Called when new shared memory is created
|
||||
@ -1761,27 +1742,6 @@ class slsDetector : public virtual slsDetectorDefs{
|
||||
*/
|
||||
void initializeDetectorStructure(detectorType type);
|
||||
|
||||
/**
|
||||
* Allocates the memory for a sls_detector_module structure and initializes it
|
||||
* Uses current detector type
|
||||
* @returns myMod the pointer to the allocate memory location
|
||||
*/
|
||||
sls_detector_module *createModule();
|
||||
|
||||
/**
|
||||
* Allocates the memory for a sls_detector_module structure and initializes it
|
||||
* Has detector type
|
||||
* @param type detector type
|
||||
* @returns myMod the pointer to the allocate dmemory location
|
||||
*/
|
||||
sls_detector_module *createModule(detectorType type);
|
||||
|
||||
/**
|
||||
* Frees the memory for a sls_detector_module structure
|
||||
* @param myMod the pointer to the memory to be freed
|
||||
*/
|
||||
void deleteModule(sls_detector_module *myMod);
|
||||
|
||||
/**
|
||||
* Send a sls_detector_module structure over socket
|
||||
* @param myMod module structure to send
|
||||
@ -1824,7 +1784,7 @@ class slsDetector : public virtual slsDetectorDefs{
|
||||
* @param tb 1 to include trimbits, 0 to exclude (used for eiger)
|
||||
* @returns the pointer to the module structure with interpolated values or NULL if error
|
||||
*/
|
||||
sls_detector_module *interpolateTrim(
|
||||
sls_detector_module interpolateTrim(
|
||||
sls_detector_module *a, sls_detector_module *b, const int energy,
|
||||
const int e1, const int e2, int tb = 1);
|
||||
|
||||
@ -1837,7 +1797,7 @@ class slsDetector : public virtual slsDetectorDefs{
|
||||
* @returns the pointer to myMod or NULL if reading the file failed
|
||||
*/
|
||||
|
||||
sls_detector_module *readSettingsFile(const std::string &fname, sls_detector_module *myMod = nullptr, int tb = 1);
|
||||
sls_detector_module readSettingsFile(const std::string &fname, int tb = 1);
|
||||
|
||||
/**
|
||||
* writes a trim/settings file
|
||||
|
@ -113,7 +113,6 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
||||
std::string cmdFileName(int narg, char *args[], int action, int detPos = -1);
|
||||
std::string cmdFileIndex(int narg, char *args[], int action, int detPos = -1);
|
||||
std::string cmdRateCorr(int narg, char *args[], int action, int detPos = -1);
|
||||
// std::string cmdThreaded(int narg, char *args[], int action, int detPos = -1);
|
||||
std::string cmdNetworkParameter(int narg, char *args[], int action, int detPos = -1);
|
||||
std::string cmdPort(int narg, char *args[], int action, int detPos = -1);
|
||||
std::string cmdLock(int narg, char *args[], int action, int detPos = -1);
|
||||
|
@ -2448,7 +2448,7 @@ const slsDetectorDefs::ROI *multiSlsDetector::getROI(int &n, int detPos) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
int multiSlsDetector::writeAdcRegister(int addr, int val, int detPos) {
|
||||
int multiSlsDetector::writeAdcRegister(uint32_t addr, uint32_t val, int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->writeAdcRegister(addr, val);
|
||||
@ -2729,18 +2729,6 @@ int multiSlsDetector::setAutoComparatorDisableMode(int ival, int detPos) {
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
int multiSlsDetector::getChanRegs(double *retval, int detPos) {
|
||||
|
||||
int offset = 0;
|
||||
std::vector<int> r;
|
||||
for (auto &d : detectors) {
|
||||
int nch = d->getTotalNumberOfChannels();
|
||||
double result[nch];
|
||||
r.push_back(d->getChanRegs(result));
|
||||
memcpy(retval + offset, result, nch * sizeof(double));
|
||||
}
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
int multiSlsDetector::setRateCorrection(int64_t t, int detPos) {
|
||||
// single
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -62,7 +62,7 @@ SCENARIO("Multi detector operation", "[detector]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Set and get partialFramesPadding", "[detector]"){
|
||||
TEST_CASE("Set and get partialFramesPadding", "[detector][somenewtag]"){
|
||||
|
||||
multiSlsDetector::freeSharedMemory(20, -1);
|
||||
multiSlsDetector m(20);
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
using namespace sls;
|
||||
|
||||
|
||||
TEST_CASE("Set and get trimen", "[detector]") {
|
||||
// Free shared memory to be sure that we start in a clean state
|
||||
@ -191,4 +191,30 @@ TEST_CASE("Padding and discard policy", "[detector][new]"){
|
||||
|
||||
d.freeSharedMemory();
|
||||
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("create detParamets struct", "[detector][new]"){
|
||||
detParameters par;
|
||||
CHECK(sizeof(par) == 32);
|
||||
CHECK(par.nChanX == 0);
|
||||
CHECK(par.nChanY == 0);
|
||||
CHECK(par.nChipX == 0);
|
||||
CHECK(par.nChipY == 0);
|
||||
CHECK(par.nDacs == 0);
|
||||
CHECK(par.dynamicRange == 0);
|
||||
CHECK(par.nGappixelsX == 0);
|
||||
CHECK(par.nGappixelsY == 0);
|
||||
|
||||
|
||||
detParameters par2{slsDetectorDefs::detectorType::EIGER};
|
||||
CHECK(sizeof(par2) == 32);
|
||||
CHECK(par2.nChanX == 256);
|
||||
CHECK(par2.nChanY == 256);
|
||||
CHECK(par2.nChipX == 4);
|
||||
CHECK(par2.nChipY == 1);
|
||||
CHECK(par2.nDacs == 16);
|
||||
CHECK(par2.dynamicRange == 16);
|
||||
CHECK(par2.nGappixelsX == 6);
|
||||
CHECK(par2.nGappixelsY == 1);
|
||||
}
|
@ -15,6 +15,8 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#ifdef __cplusplus
|
||||
#include "sls_detector_exceptions.h"
|
||||
#include <algorithm>
|
||||
#include <bitset>
|
||||
#include <string>
|
||||
#endif
|
||||
@ -63,7 +65,6 @@
|
||||
#define DEFAULT_STREAMING_TIMER_IN_MS 200
|
||||
|
||||
|
||||
|
||||
typedef char mystring[MAX_STR_LENGTH];
|
||||
|
||||
|
||||
@ -220,33 +221,7 @@ public:
|
||||
int ymax; /**< is the roi ymax (in channel number)*/
|
||||
} ROI ;
|
||||
|
||||
/**
|
||||
@short structure for a detector module
|
||||
|
||||
should not be used by unexperienced users
|
||||
|
||||
\see :: moduleRegisterBit ::chipRegisterBit :channelRegisterBit
|
||||
|
||||
@li reg is the module register (e.g. dynamic range? see moduleRegisterBit)
|
||||
@li dacs is the pointer to the array of dac values (in V)
|
||||
@li adcs is the pointer to the array of adc values (in V)
|
||||
@li chipregs is the pointer to the array of chip registers
|
||||
@li chanregs is the pointer to the array of channel registers
|
||||
@li gain is the module gain
|
||||
@li offset is the module offset
|
||||
*/
|
||||
typedef struct {
|
||||
int serialnumber; /**< is the module serial number */
|
||||
int nchan; /**< is the number of channels on the module*/
|
||||
int nchip; /**< is the number of chips on the module */
|
||||
int ndac; /**< is the number of dacs on the module */
|
||||
int reg; /**< is the module register settings (gain level) */
|
||||
int iodelay; /**< iodelay */
|
||||
int tau; /**< tau */
|
||||
int eV; /**< threshold energy */
|
||||
int *dacs; /**< is the pointer to the array of the dac values (in V) */
|
||||
int *chanregs; /**< is the pointer to the array of the channel registers */
|
||||
} sls_detector_module;
|
||||
|
||||
|
||||
/**
|
||||
@ -959,3 +934,158 @@ protected:
|
||||
};
|
||||
#endif
|
||||
;
|
||||
|
||||
#ifdef __cplusplus
|
||||
struct detParameters {
|
||||
int nChanX{0};
|
||||
int nChanY{0};
|
||||
int nChipX{0};
|
||||
int nChipY{0};
|
||||
int nDacs{0};
|
||||
int dynamicRange{0};
|
||||
int nGappixelsX{0};
|
||||
int nGappixelsY{0};
|
||||
|
||||
detParameters() {}
|
||||
detParameters(slsDetectorDefs::detectorType type) {
|
||||
switch (type) {
|
||||
case slsDetectorDefs::detectorType::GOTTHARD:
|
||||
nChanX = 128;
|
||||
nChanY = 1;
|
||||
nChipX = 10;
|
||||
nChipY = 1;
|
||||
nDacs = 8;
|
||||
dynamicRange = 16;
|
||||
nGappixelsX = 0;
|
||||
nGappixelsY = 0;
|
||||
break;
|
||||
case slsDetectorDefs::detectorType::JUNGFRAU:
|
||||
nChanX = 256;
|
||||
nChanY = 256;
|
||||
nChipX = 4;
|
||||
nChipY = 2;
|
||||
nDacs = 8;
|
||||
dynamicRange = 16;
|
||||
nGappixelsX = 0;
|
||||
nGappixelsY = 0;
|
||||
break;
|
||||
case slsDetectorDefs::detectorType::CHIPTESTBOARD:
|
||||
nChanX = 36;
|
||||
nChanY = 1;
|
||||
nChipX = 1;
|
||||
nChipY = 1;
|
||||
nDacs = 24;
|
||||
dynamicRange = 16;
|
||||
nGappixelsX = 0;
|
||||
nGappixelsY = 0;
|
||||
break;
|
||||
case slsDetectorDefs::detectorType::MOENCH:
|
||||
nChanX = 32;
|
||||
nChanY = 1;
|
||||
nChipX = 1;
|
||||
nChipY = 1;
|
||||
nDacs = 8;
|
||||
dynamicRange = 16;
|
||||
nGappixelsX = 0;
|
||||
nGappixelsY = 0;
|
||||
break;
|
||||
case slsDetectorDefs::detectorType::EIGER:
|
||||
nChanX = 256;
|
||||
nChanY = 256;
|
||||
nChipX = 4;
|
||||
nChipY = 1;
|
||||
nDacs = 16;
|
||||
dynamicRange = 16;
|
||||
nGappixelsX = 6;
|
||||
nGappixelsY = 1;
|
||||
break;
|
||||
default:
|
||||
throw sls::RuntimeError(
|
||||
"Unknown detector type! " +
|
||||
slsDetectorDefs::detectorTypeToString(type));
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
/**
|
||||
@short structure for a detector module
|
||||
|
||||
should not be used by unexperienced users
|
||||
|
||||
\see :: moduleRegisterBit ::chipRegisterBit :channelRegisterBit
|
||||
|
||||
@li reg is the module register (e.g. dynamic range? see moduleRegisterBit)
|
||||
@li dacs is the pointer to the array of dac values (in V)
|
||||
@li adcs is the pointer to the array of adc values (in V)
|
||||
@li chipregs is the pointer to the array of chip registers
|
||||
@li chanregs is the pointer to the array of channel registers
|
||||
@li gain is the module gain
|
||||
@li offset is the module offset
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
struct sls_detector_module {
|
||||
#else
|
||||
typedef struct {
|
||||
#endif
|
||||
int serialnumber; /**< is the module serial number */
|
||||
int nchan; /**< is the number of channels on the module*/
|
||||
int nchip; /**< is the number of chips on the module */
|
||||
int ndac; /**< is the number of dacs on the module */
|
||||
int reg; /**< is the module register settings (gain level) */
|
||||
int iodelay; /**< iodelay */
|
||||
int tau; /**< tau */
|
||||
int eV; /**< threshold energy */
|
||||
int *dacs; /**< is the pointer to the array of the dac values (in V) */
|
||||
int *chanregs; /**< is the pointer to the array of the channel registers */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
sls_detector_module()
|
||||
: serialnumber(0), nchan(0), nchip(0), ndac(0), reg(0), iodelay(0),
|
||||
tau(0), eV(0), dacs(nullptr), chanregs(nullptr) {}
|
||||
|
||||
sls_detector_module(slsDetectorDefs::detectorType type) {
|
||||
detParameters parameters{type};
|
||||
int nch = parameters.nChanX * parameters.nChanY;
|
||||
int nc = parameters.nChipX * parameters.nChipY;
|
||||
// int nd = parameters.nDacs;
|
||||
|
||||
ndac = parameters.nDacs;
|
||||
nchip = nc;
|
||||
nchan = nch * nc;
|
||||
dacs = new int[ndac];
|
||||
chanregs = new int[nchan];
|
||||
}
|
||||
|
||||
sls_detector_module(const sls_detector_module &other)
|
||||
: dacs(nullptr), chanregs(nullptr) {
|
||||
*this = other;
|
||||
}
|
||||
|
||||
sls_detector_module &operator=(const sls_detector_module &other) {
|
||||
delete[] dacs;
|
||||
delete[] chanregs;
|
||||
serialnumber = other.serialnumber;
|
||||
nchan = other.nchan;
|
||||
nchip = other.nchip;
|
||||
ndac = other.ndac;
|
||||
reg = other.reg;
|
||||
iodelay = other.iodelay;
|
||||
tau = other.tau;
|
||||
eV = other.eV;
|
||||
dacs = new int[ndac];
|
||||
std::copy(other.dacs, other.dacs + ndac, dacs);
|
||||
chanregs = new int[nchan];
|
||||
std::copy(other.chanregs, other.chanregs + nchan, chanregs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
~sls_detector_module() {
|
||||
delete[] dacs;
|
||||
delete[] chanregs;
|
||||
}
|
||||
};
|
||||
#else
|
||||
} sls_detector_module;
|
||||
#endif
|
||||
|
@ -5,4 +5,5 @@ target_sources(tests PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-network_utils.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-string_utils.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-Timer.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-sls_detector_defs.cpp
|
||||
)
|
53
slsSupportLib/tests/test-sls_detector_defs.cpp
Normal file
53
slsSupportLib/tests/test-sls_detector_defs.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
#include "catch.hpp"
|
||||
#include "slsDetector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
using dt = slsDetectorDefs::detectorType;
|
||||
|
||||
TEST_CASE("sls_detector_module default construction", "[support][new]") {
|
||||
sls_detector_module m;
|
||||
CHECK(m.serialnumber == 0);
|
||||
CHECK(m.nchan == 0);
|
||||
CHECK(m.nchip == 0);
|
||||
CHECK(m.ndac == 0);
|
||||
CHECK(m.reg == 0);
|
||||
CHECK(m.iodelay == 0);
|
||||
CHECK(m.tau == 0);
|
||||
CHECK(m.eV == 0);
|
||||
CHECK(m.dacs == nullptr);
|
||||
CHECK(m.chanregs == nullptr);
|
||||
}
|
||||
|
||||
TEST_CASE("sls_detector_module from type", "[support]") {
|
||||
sls_detector_module m(dt::EIGER);
|
||||
CHECK(m.serialnumber == 0);
|
||||
CHECK(m.nchan == 256 * 256 * 4);
|
||||
CHECK(m.nchip == 4);
|
||||
CHECK(m.ndac == 16);
|
||||
CHECK(m.reg == 0);
|
||||
CHECK(m.iodelay == 0);
|
||||
CHECK(m.tau == 0);
|
||||
CHECK(m.eV == 0);
|
||||
CHECK(m.dacs != nullptr);
|
||||
CHECK(m.chanregs != nullptr);
|
||||
}
|
||||
|
||||
TEST_CASE("assign module", "[support]") {
|
||||
sls_detector_module m0;
|
||||
sls_detector_module m1(dt::EIGER);
|
||||
m1.serialnumber = 14;
|
||||
m1.reg = 500;
|
||||
m1.iodelay = 750;
|
||||
|
||||
m0 = m1; // Assignment operator
|
||||
CHECK(m0.serialnumber == 14);
|
||||
CHECK(m0.reg == 500);
|
||||
CHECK(m0.iodelay == 750);
|
||||
CHECK(m0.nchan == 256 * 256 * 4);
|
||||
|
||||
auto m3 = m1; // Copy constructor
|
||||
CHECK(m3.serialnumber == 14);
|
||||
CHECK(m3.reg == 500);
|
||||
CHECK(m3.iodelay == 750);
|
||||
CHECK(m3.nchan == 256 * 256 * 4);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user