mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 04:47:14 +02:00
ratecorrectiosn addded to master file
This commit is contained in:
@ -201,6 +201,7 @@ int ClientInterface::functionTable(){
|
||||
flist[F_GET_RECEIVER_THREAD_IDS] = &ClientInterface::get_thread_ids;
|
||||
flist[F_GET_RECEIVER_STREAMING_START_FNUM] = &ClientInterface::get_streaming_start_fnum;
|
||||
flist[F_SET_RECEIVER_STREAMING_START_FNUM] = &ClientInterface::set_streaming_start_fnum;
|
||||
flist[F_SET_RECEIVER_RATE_CORRECT] = &ClientInterface::set_rate_correct;
|
||||
|
||||
for (int i = NUM_DET_FUNCTIONS + 1; i < NUM_REC_FUNCTIONS ; i++) {
|
||||
LOG(logDEBUG1) << "function fnum: " << i << " (" <<
|
||||
@ -906,7 +907,8 @@ int ClientInterface::get_missing_packets(Interface &socket) {
|
||||
auto size = static_cast<int>(missing_packets.size());
|
||||
socket.Send(OK);
|
||||
socket.Send(size);
|
||||
socket.Send(missing_packets.data(), sizeof(missing_packets[0])* missing_packets.size());
|
||||
socket.Send(missing_packets.data(),
|
||||
sizeof(missing_packets[0]) * missing_packets.size());
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -1204,7 +1206,7 @@ int ClientInterface::set_additional_json_header(Interface &socket) {
|
||||
socket.Receive(&buff[0], buff.size());
|
||||
std::istringstream iss(buff);
|
||||
std::string key, value;
|
||||
while(iss >> key){
|
||||
while (iss >> key) {
|
||||
iss >> value;
|
||||
json[key] = value;
|
||||
}
|
||||
@ -1219,7 +1221,7 @@ int ClientInterface::get_additional_json_header(Interface &socket) {
|
||||
std::map<std::string, std::string> json = impl()->getAdditionalJsonHeader();
|
||||
LOG(logDEBUG1) << "additional json header:" << sls::ToString(json);
|
||||
std::ostringstream oss;
|
||||
for (auto & it : json){
|
||||
for (auto &it : json) {
|
||||
oss << it.first << ' ' << it.second << ' ';
|
||||
}
|
||||
auto buff = oss.str();
|
||||
@ -1735,3 +1737,18 @@ int ClientInterface::set_streaming_start_fnum(Interface &socket) {
|
||||
validate(index, retval, "set streaming start fnum", DEC);
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int ClientInterface::set_rate_correct(Interface &socket) {
|
||||
auto index = socket.Receive<int>();
|
||||
if (index <= 0) {
|
||||
throw RuntimeError("Invalid number of rate correction values: " +
|
||||
std::to_string(index));
|
||||
}
|
||||
LOG(logDEBUG) << "Number of detectors for rate correction: " << index;
|
||||
std::vector<int64_t> t(index);
|
||||
socket.Receive(t.data(), t.size() * sizeof(t[0]));
|
||||
verifyIdle(socket);
|
||||
LOG(logINFOBLUE) << "Setting rate corrections[" << index << ']';
|
||||
impl()->setRateCorrections(t);
|
||||
return socket.Send(OK);
|
||||
}
|
@ -157,6 +157,7 @@ class ClientInterface : private virtual slsDetectorDefs {
|
||||
int get_thread_ids(sls::ServerInterface &socket);
|
||||
int get_streaming_start_fnum(sls::ServerInterface &socket);
|
||||
int set_streaming_start_fnum(sls::ServerInterface &socket);
|
||||
int set_rate_correct(sls::ServerInterface &socket);
|
||||
|
||||
Implementation *impl() {
|
||||
if (receiver != nullptr) {
|
||||
|
@ -47,6 +47,7 @@ void Implementation::DeleteMembers() {
|
||||
fifo.clear();
|
||||
eth.clear();
|
||||
udpPortNum.clear();
|
||||
rateCorrections.clear();
|
||||
ctbDbitList.clear();
|
||||
}
|
||||
|
||||
@ -946,6 +947,7 @@ void Implementation::SetupWriter() {
|
||||
masterAttributes->subExptime = std::chrono::nanoseconds(subExpTime);
|
||||
masterAttributes->subPeriod = std::chrono::nanoseconds(subPeriod);
|
||||
masterAttributes->quad = quadEnable;
|
||||
masterAttributes->ratecorr = rateCorrections;
|
||||
masterAttributes->adcmask =
|
||||
tengigaEnable ? adcEnableMaskTenGiga : adcEnableMaskOneGiga;
|
||||
masterAttributes->analog =
|
||||
@ -1798,6 +1800,11 @@ void Implementation::setReadNLines(const int value) {
|
||||
LOG(logINFO) << "Number of Lines to readout: " << numLinesReadout;
|
||||
}
|
||||
|
||||
void Implementation::setRateCorrections(const std::vector<int64_t> &t) {
|
||||
rateCorrections = t;
|
||||
LOG(logINFO) << "Rate Corrections: " << sls::ToString(rateCorrections);
|
||||
}
|
||||
|
||||
slsDetectorDefs::readoutMode Implementation::getReadoutMode() const {
|
||||
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return readoutType;
|
||||
|
@ -211,6 +211,8 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
int getReadNLines() const;
|
||||
/* [Eiger] */
|
||||
void setReadNLines(const int value);
|
||||
/* [Eiger] */
|
||||
void setRateCorrections(const std::vector<int64_t> &t);
|
||||
readoutMode getReadoutMode() const;
|
||||
/* [Ctb] */
|
||||
void setReadoutMode(const readoutMode f);
|
||||
@ -336,6 +338,7 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
bool activated;
|
||||
bool deactivatedPaddingEnable;
|
||||
int numLinesReadout;
|
||||
std::vector<int64_t> rateCorrections;
|
||||
readoutMode readoutType;
|
||||
uint32_t adcEnableMaskOneGiga;
|
||||
uint32_t adcEnableMaskTenGiga;
|
||||
|
@ -34,6 +34,7 @@ class MasterAttributes {
|
||||
ns subExptime{0};
|
||||
ns subPeriod{0};
|
||||
uint32_t quad{0};
|
||||
std::vector<int64_t> ratecorr;
|
||||
uint32_t adcmask{0};
|
||||
uint32_t analog{0};
|
||||
uint32_t digital{0};
|
||||
@ -292,7 +293,9 @@ class EigerMasterAttributes : public MasterAttributes {
|
||||
<< '\n'
|
||||
<< "SubPeriod : " << sls::ToString(subPeriod)
|
||||
<< '\n'
|
||||
<< "Quad : " << quad << '\n';
|
||||
<< "Quad : " << quad << '\n'
|
||||
<< "Rate Corrections : " << sls::ToString(ratecorr)
|
||||
<< '\n';
|
||||
std::string message = oss.str();
|
||||
MasterAttributes::WriteBinaryAttributes(fd, message);
|
||||
};
|
||||
@ -339,6 +342,14 @@ class EigerMasterAttributes : public MasterAttributes {
|
||||
group->createDataSet("quad", PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&quad, PredType::NATIVE_INT);
|
||||
}
|
||||
// Rate corrections
|
||||
{
|
||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
||||
StrType strdatatype(PredType::C_S1, 256);
|
||||
DataSet dataset = group->createDataSet("rate corrections",
|
||||
strdatatype, dataspace);
|
||||
dataset.write(sls::ToString(ratecorr), strdatatype);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
Reference in New Issue
Block a user