mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 16:20:03 +02:00
m3: counter mask in master file
This commit is contained in:
parent
540a203139
commit
8631f5e2b0
@ -1723,9 +1723,8 @@ void Module::setCounterMask(uint32_t countermask) {
|
||||
LOG(logDEBUG1) << "Setting Counter mask to " << countermask;
|
||||
sendToDetector(F_SET_COUNTER_MASK, countermask, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
int ncounters = __builtin_popcount(countermask);
|
||||
LOG(logDEBUG1) << "Sending Reciver #counters: " << ncounters;
|
||||
sendToReceiver(F_RECEIVER_SET_NUM_COUNTERS, ncounters, nullptr);
|
||||
LOG(logDEBUG1) << "Sending Reciver counter mask: " << countermask;
|
||||
sendToReceiver(F_RECEIVER_SET_COUNTER_MASK, countermask, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ int ClientInterface::functionTable(){
|
||||
flist[F_SET_RECEIVER_UDP_PORT2] = &ClientInterface::set_udp_port2;
|
||||
flist[F_SET_RECEIVER_NUM_INTERFACES] = &ClientInterface::set_num_interfaces;
|
||||
flist[F_RECEIVER_SET_ADC_MASK_10G] = &ClientInterface::set_adc_mask_10g;
|
||||
flist[F_RECEIVER_SET_NUM_COUNTERS] = &ClientInterface::set_num_counters;
|
||||
flist[F_RECEIVER_SET_COUNTER_MASK] = &ClientInterface::set_counter_mask;
|
||||
flist[F_INCREMENT_FILE_INDEX] = &ClientInterface::increment_file_index;
|
||||
flist[F_SET_ADDITIONAL_JSON_PARAMETER] = &ClientInterface::set_additional_json_parameter;
|
||||
flist[F_GET_ADDITIONAL_JSON_PARAMETER] = &ClientInterface::get_additional_json_parameter;
|
||||
@ -468,8 +468,7 @@ int ClientInterface::setup_receiver(Interface &socket) {
|
||||
}
|
||||
}
|
||||
if (myDetectorType == MYTHEN3) {
|
||||
int ncounters = __builtin_popcount(arg.countermask);
|
||||
impl()->setNumberofCounters(ncounters);
|
||||
impl()->setCounterMask(arg.countermask);
|
||||
impl()->setAcquisitionTime1(arg.expTime1Ns);
|
||||
impl()->setAcquisitionTime2(arg.expTime2Ns);
|
||||
impl()->setAcquisitionTime3(arg.expTime3Ns);
|
||||
@ -1627,11 +1626,11 @@ int ClientInterface::set_adc_mask_10g(Interface &socket) {
|
||||
return socket.sendResult(retval);
|
||||
}
|
||||
|
||||
int ClientInterface::set_num_counters(Interface &socket) {
|
||||
auto arg = socket.Receive<int>();
|
||||
int ClientInterface::set_counter_mask(Interface &socket) {
|
||||
auto arg = socket.Receive<uint32_t>();
|
||||
verifyIdle(socket);
|
||||
LOG(logDEBUG1) << "Setting counters: " << arg;
|
||||
impl()->setNumberofCounters(arg);
|
||||
impl()->setCounterMask(arg);
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ class ClientInterface : private virtual slsDetectorDefs {
|
||||
int set_udp_port2(sls::ServerInterface &socket);
|
||||
int set_num_interfaces(sls::ServerInterface &socket);
|
||||
int set_adc_mask_10g(sls::ServerInterface &socket);
|
||||
int set_num_counters(sls::ServerInterface &socket);
|
||||
int set_counter_mask(sls::ServerInterface &socket);
|
||||
int increment_file_index(sls::ServerInterface &socket);
|
||||
int set_additional_json_parameter(sls::ServerInterface &socket);
|
||||
int get_additional_json_parameter(sls::ServerInterface &socket);
|
||||
|
@ -120,7 +120,7 @@ void Implementation::InitializeMembers() {
|
||||
subPeriod = 0;
|
||||
numberOfAnalogSamples = 0;
|
||||
numberOfDigitalSamples = 0;
|
||||
numberOfCounters = 0;
|
||||
counterMask = 0;
|
||||
dynamicRange = 16;
|
||||
roi.xmin = -1;
|
||||
roi.xmax = -1;
|
||||
@ -962,6 +962,7 @@ void Implementation::SetupWriter() {
|
||||
masterAttributes->dbitlist |= (1 << i);
|
||||
}
|
||||
masterAttributes->roi = roi;
|
||||
masterAttributes->counterMask = counterMask;
|
||||
masterAttributes->exptime1 = std::chrono::nanoseconds(acquisitionTime1);
|
||||
masterAttributes->exptime2 = std::chrono::nanoseconds(acquisitionTime2);
|
||||
masterAttributes->exptime3 = std::chrono::nanoseconds(acquisitionTime3);
|
||||
@ -1616,24 +1617,27 @@ void Implementation::setNumberofDigitalSamples(const uint32_t i) {
|
||||
LOG(logINFO) << "Packets per Frame: " << (generalData->packetsPerFrame);
|
||||
}
|
||||
|
||||
int Implementation::getNumberofCounters() const {
|
||||
uint32_t Implementation::getCounterMask() const {
|
||||
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return numberOfCounters;
|
||||
return counterMask;
|
||||
}
|
||||
|
||||
void Implementation::setNumberofCounters(const int i) {
|
||||
if (numberOfCounters != i) {
|
||||
numberOfCounters = i;
|
||||
void Implementation::setCounterMask(const uint32_t i) {
|
||||
if (counterMask != i) {
|
||||
counterMask = i;
|
||||
|
||||
if (myDetectorType == MYTHEN3) {
|
||||
generalData->SetNumberofCounters(i, dynamicRange);
|
||||
int ncounters = __builtin_popcount(i);
|
||||
generalData->SetNumberofCounters(ncounters, dynamicRange);
|
||||
// to update npixelsx, npixelsy in file writer
|
||||
for (const auto &it : dataProcessor)
|
||||
it->SetPixelDimension();
|
||||
SetupFifoStructure();
|
||||
}
|
||||
}
|
||||
LOG(logINFO) << "Number of Counters: " << numberOfCounters;
|
||||
LOG(logINFO) << "Counter mask: " << sls::ToStringHex(counterMask);
|
||||
int ncounters = __builtin_popcount(counterMask);
|
||||
LOG(logINFO) << "Number of counters: " << ncounters;
|
||||
}
|
||||
|
||||
uint32_t Implementation::getDynamicRange() const {
|
||||
|
@ -186,8 +186,9 @@ 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 getCounterMask() const;
|
||||
/** [Mythen3] */
|
||||
void setCounterMask(const uint32_t i);
|
||||
uint32_t getDynamicRange() const;
|
||||
void setDynamicRange(const uint32_t i);
|
||||
ROI getROI() const;
|
||||
@ -329,7 +330,7 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
uint64_t subPeriod;
|
||||
uint64_t numberOfAnalogSamples;
|
||||
uint64_t numberOfDigitalSamples;
|
||||
int numberOfCounters;
|
||||
uint32_t counterMask;
|
||||
uint32_t dynamicRange;
|
||||
ROI roi;
|
||||
bool tengigaEnable;
|
||||
|
@ -40,6 +40,7 @@ struct MasterAttributes {
|
||||
uint32_t dbitoffset{0};
|
||||
uint64_t dbitlist{0};
|
||||
slsDetectorDefs::ROI roi{};
|
||||
uint32_t counterMask{0};
|
||||
ns exptime1{0};
|
||||
ns exptime2{0};
|
||||
ns exptime3{0};
|
||||
@ -344,7 +345,7 @@ class EigerMasterAttributes : public MasterAttributes {
|
||||
// Rate corrections
|
||||
{
|
||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
||||
StrType strdatatype(PredType::C_S1, 256);
|
||||
StrType strdatatype(PredType::C_S1, 1024);
|
||||
DataSet dataset = group->createDataSet("rate corrections",
|
||||
strdatatype, dataspace);
|
||||
dataset.write(sls::ToString(ratecorr), strdatatype);
|
||||
@ -363,6 +364,8 @@ class Mythen3MasterAttributes : public MasterAttributes {
|
||||
<< "Dynamic Range : " << dynamicRange << '\n'
|
||||
<< "Ten Giga : " << tenGiga << '\n'
|
||||
<< "Period : " << sls::ToString(period) << '\n'
|
||||
<< "Counter Mask : " << sls::ToStringHex(counterMask)
|
||||
<< '\n'
|
||||
<< "Exptime1 : " << sls::ToString(exptime1)
|
||||
<< '\n'
|
||||
<< "Exptime2 : " << sls::ToString(exptime2)
|
||||
@ -386,6 +389,13 @@ class Mythen3MasterAttributes : public MasterAttributes {
|
||||
MasterAttributes::WriteHDF5DynamicRange(fd, group);
|
||||
MasterAttributes::WriteHDF5TenGiga(fd, group);
|
||||
MasterAttributes::WriteHDF5Period(fd, group);
|
||||
// Counter Mask
|
||||
{
|
||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
||||
DataSet dataset = group->createDataSet(
|
||||
"counter mask", PredType::STD_U32LE, dataspace);
|
||||
dataset.write(&counterMask, PredType::STD_U32LE);
|
||||
}
|
||||
// Exptime1
|
||||
{
|
||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
||||
@ -439,7 +449,7 @@ class Mythen3MasterAttributes : public MasterAttributes {
|
||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
||||
DataSet dataset =
|
||||
group->createDataSet("gates", PredType::STD_U32LE, dataspace);
|
||||
dataset.write(&gates, PredType::STD_U64LE);
|
||||
dataset.write(&gates, PredType::STD_U32LE);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
@ -298,7 +298,7 @@ enum detFuncs {
|
||||
F_SET_RECEIVER_UDP_PORT2,
|
||||
F_SET_RECEIVER_NUM_INTERFACES,
|
||||
F_RECEIVER_SET_ADC_MASK_10G,
|
||||
F_RECEIVER_SET_NUM_COUNTERS,
|
||||
F_RECEIVER_SET_COUNTER_MASK,
|
||||
F_INCREMENT_FILE_INDEX,
|
||||
F_SET_ADDITIONAL_JSON_PARAMETER,
|
||||
F_GET_ADDITIONAL_JSON_PARAMETER,
|
||||
@ -609,7 +609,7 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_SET_RECEIVER_UDP_PORT2: return "F_SET_RECEIVER_UDP_PORT2";
|
||||
case F_SET_RECEIVER_NUM_INTERFACES: return "F_SET_RECEIVER_NUM_INTERFACES";
|
||||
case F_RECEIVER_SET_ADC_MASK_10G: return "F_RECEIVER_SET_ADC_MASK_10G";
|
||||
case F_RECEIVER_SET_NUM_COUNTERS: return "F_RECEIVER_SET_NUM_COUNTERS";
|
||||
case F_RECEIVER_SET_COUNTER_MASK: return "F_RECEIVER_SET_COUNTER_MASK";
|
||||
case F_INCREMENT_FILE_INDEX: return "F_INCREMENT_FILE_INDEX";
|
||||
case F_SET_ADDITIONAL_JSON_PARAMETER: return "F_SET_ADDITIONAL_JSON_PARAMETER";
|
||||
case F_GET_ADDITIONAL_JSON_PARAMETER: return "F_GET_ADDITIONAL_JSON_PARAMETER";
|
||||
|
Loading…
x
Reference in New Issue
Block a user