mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
Counters (#71)
* mythen3: adding counters mask, firmware still takes only number of counters for now * mythen3: checking if module attached before powering on chip * bug fix: loop inital declaration not allowed in c * fix scope eiger test * mythen3: renamed setCounters to setCounterMask and getCounterMask in API * mythen3 replacing counting bits with popcount Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
This commit is contained in:

committed by
Erik Fröjdh

parent
70c54f4315
commit
de53747ddd
@ -119,6 +119,7 @@ class ClientInterface : private virtual slsDetectorDefs {
|
||||
int set_udp_port2(sls::ServerInterface2 &socket);
|
||||
int set_num_interfaces(sls::ServerInterface2 &socket);
|
||||
int set_adc_mask_10g(sls::ServerInterface2 &socket);
|
||||
int set_num_counters(sls::ServerInterface2 &socket);
|
||||
|
||||
Implementation *impl() {
|
||||
if (receiver != nullptr) {
|
||||
|
@ -208,12 +208,21 @@ public:
|
||||
|
||||
/**
|
||||
* set number of interfaces (jungfrau)
|
||||
* @param number of interfaces
|
||||
* @param n number of interfaces
|
||||
*/
|
||||
virtual void SetNumberofInterfaces(const int n) {
|
||||
FILE_LOG(logERROR) << "SetNumberofInterfaces is a generic function that should be overloaded by a derived class";
|
||||
}
|
||||
|
||||
/**
|
||||
* set number of counters (mythen3)
|
||||
* @param n number of counters
|
||||
* @param dr dynamic range
|
||||
*/
|
||||
virtual void SetNumberofCounters(const int n, const int dr) {
|
||||
FILE_LOG(logERROR) << "SetNumberofCounters is a generic function that should be overloaded by a derived class";
|
||||
}
|
||||
|
||||
/**
|
||||
* Print all variables
|
||||
*/
|
||||
@ -528,16 +537,19 @@ class JungfrauData : public GeneralData {
|
||||
};
|
||||
|
||||
class Mythen3Data : public GeneralData {
|
||||
|
||||
public:
|
||||
private:
|
||||
int ncounters;
|
||||
const int NCHAN = 1280;
|
||||
public:
|
||||
|
||||
/** Constructor */
|
||||
Mythen3Data(){
|
||||
myDetectorType = slsDetectorDefs::MYTHEN3;
|
||||
nPixelsX = (1280 * 3); // 1280 channels, 3 counters
|
||||
ncounters = 3;
|
||||
nPixelsX = (NCHAN * ncounters); // max 1280 channels x 3 counters
|
||||
nPixelsY = 1;
|
||||
headerSizeinPacket = sizeof(slsDetectorDefs::sls_detector_header);
|
||||
dataSize = 7680;//8192;
|
||||
dataSize = 7680;
|
||||
packetSize = headerSizeinPacket + dataSize;
|
||||
packetsPerFrame = 2;
|
||||
imageSize = dataSize * packetsPerFrame;
|
||||
@ -547,6 +559,39 @@ class Mythen3Data : public GeneralData {
|
||||
standardheader = true;
|
||||
defaultUdpSocketBufferSize = (1000 * 1024 * 1024);
|
||||
};
|
||||
|
||||
/**
|
||||
* set number of counters (mythen3)
|
||||
* @param n number of counters
|
||||
* @param dr dynamic range
|
||||
*/
|
||||
virtual void SetNumberofCounters(const int n, const int dr) {
|
||||
if (n < 1 || n > 3) {
|
||||
throw sls::RuntimeError("Invalid number of counters " + std::to_string(n));
|
||||
}
|
||||
ncounters = n;
|
||||
nPixelsX = NCHAN * ncounters;
|
||||
imageSize = nPixelsX * nPixelsY * ((dr > 16) ? 4 : // 32 bit
|
||||
((dr > 8) ? 2 : // 16 bit
|
||||
((dr > 4) ? 0.5 : // 4 bit
|
||||
0.125))); // 1 bit
|
||||
dataSize = imageSize / packetsPerFrame;
|
||||
packetSize = headerSizeinPacket + dataSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting dynamic range changes member variables
|
||||
* @param dr dynamic range
|
||||
* @param tgEnable (discarded, of no value to mythen3)
|
||||
*/
|
||||
void SetDynamicRange(int dr, bool tgEnable) {
|
||||
imageSize = nPixelsX * nPixelsY * ((dr > 16) ? 4 : // 32 bit
|
||||
((dr > 8) ? 2 : // 16 bit
|
||||
((dr > 4) ? 0.5 : // 4 bit
|
||||
0.125))); // 1 bit
|
||||
dataSize = imageSize / packetsPerFrame;
|
||||
packetSize = headerSizeinPacket + dataSize;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -149,6 +149,8 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
uint32_t getNumberofDigitalSamples() const;
|
||||
/**[Ctb] */
|
||||
void setNumberofDigitalSamples(const uint32_t i);
|
||||
int getNumberofCounters() const;
|
||||
void setNumberofCounters(const int i);
|
||||
uint32_t getDynamicRange() const;
|
||||
void setDynamicRange(const uint32_t i);
|
||||
ROI getROI() const;
|
||||
@ -271,6 +273,7 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
uint64_t subPeriod;
|
||||
uint64_t numberOfAnalogSamples;
|
||||
uint64_t numberOfDigitalSamples;
|
||||
int numberOfCounters;
|
||||
uint32_t dynamicRange;
|
||||
ROI roi;
|
||||
bool tengigaEnable;
|
||||
|
Reference in New Issue
Block a user