M3settings (#228)

* added temp m3 settings files

* renames settings noise to trim

* get threshold for M3

* some changes to compile on RH7 and in the server to load the default chip status register at startup

* Updated mythen3DeectorServer_developer executable with correct initialization at startup

Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com>
Co-authored-by: Anna Bergamaschi <anna.bergamaschi@psi.ch>
This commit is contained in:
Dhanya Thattil
2021-01-14 12:34:13 +01:00
committed by GitHub
parent a62e068a9a
commit f9f50f1d84
89 changed files with 1715 additions and 8446 deletions

View File

@ -208,6 +208,7 @@ int ClientInterface::functionTable(){
flist[F_RECEIVER_SET_THRESHOLD] = &ClientInterface::set_threshold;
flist[F_GET_RECEIVER_STREAMING_HWM] = &ClientInterface::get_streaming_hwm;
flist[F_SET_RECEIVER_STREAMING_HWM] = &ClientInterface::set_streaming_hwm;
flist[F_RECEIVER_SET_ALL_THRESHOLD] = &ClientInterface::set_all_threshold;
for (int i = NUM_DET_FUNCTIONS + 1; i < NUM_REC_FUNCTIONS ; i++) {
LOG(logDEBUG1) << "function fnum: " << i << " (" <<
@ -408,7 +409,14 @@ int ClientInterface::setup_receiver(Interface &socket) {
" due to fifo strucutre memory allocation");
}
impl()->setReadNLines(arg.numLinesReadout);
impl()->setThresholdEnergy(arg.thresholdEnergyeV);
impl()->setThresholdEnergy(arg.thresholdEnergyeV[0]);
}
if (myDetectorType == MYTHEN3) {
std::array<int, 3> val;
for (int i = 0; i < 3; ++i) {
val[i] = arg.thresholdEnergyeV[i];
}
impl()->setThresholdEnergy(val);
}
if (myDetectorType == EIGER || myDetectorType == MYTHEN3) {
try {
@ -1677,3 +1685,13 @@ int ClientInterface::set_streaming_hwm(Interface &socket) {
impl()->setStreamingHwm(limit);
return socket.Send(OK);
}
int ClientInterface::set_all_threshold(Interface &socket) {
auto eVs = socket.Receive<std::array<int, 3>>();
LOG(logDEBUG) << "Threshold:" << sls::ToString(eVs);
if (myDetectorType != MYTHEN3)
functionNotImplemented();
verifyIdle(socket);
impl()->setThresholdEnergy(eVs);
return socket.Send(OK);
}

View File

@ -161,6 +161,7 @@ class ClientInterface : private virtual slsDetectorDefs {
int set_threshold(sls::ServerInterface &socket);
int get_streaming_hwm(sls::ServerInterface &socket);
int set_streaming_hwm(sls::ServerInterface &socket);
int set_all_threshold(sls::ServerInterface &socket);
Implementation *impl() {
if (receiver != nullptr) {

View File

@ -758,6 +758,7 @@ void Implementation::SetupWriter() {
masterAttributes->dynamicRange = dynamicRange;
masterAttributes->tenGiga = tengigaEnable;
masterAttributes->thresholdEnergyeV = thresholdEnergyeV;
masterAttributes->thresholdAllEnergyeV = thresholdAllEnergyeV;
masterAttributes->subExptime = subExpTime;
masterAttributes->subPeriod = subPeriod;
masterAttributes->quad = quadEnable;
@ -1533,6 +1534,12 @@ void Implementation::setThresholdEnergy(const int value) {
LOG(logINFO) << "Threshold Energy: " << thresholdEnergyeV << " eV";
}
void Implementation::setThresholdEnergy(const std::array<int, 3> value) {
thresholdAllEnergyeV = value;
LOG(logINFO) << "Threshold Energy (eV): "
<< sls::ToString(thresholdAllEnergyeV);
}
void Implementation::setRateCorrections(const std::vector<int64_t> &t) {
rateCorrections = t;
LOG(logINFO) << "Rate Corrections: " << sls::ToString(rateCorrections);

View File

@ -219,6 +219,7 @@ class Implementation : private virtual slsDetectorDefs {
void setReadNLines(const int value);
/** [Eiger] */
void setThresholdEnergy(const int value);
void setThresholdEnergy(const std::array<int, 3> value);
/* [Eiger] */
void setRateCorrections(const std::vector<int64_t> &t);
readoutMode getReadoutMode() const;
@ -348,6 +349,7 @@ class Implementation : private virtual slsDetectorDefs {
bool deactivatedPaddingEnable{true};
int numLinesReadout{MAX_EIGER_ROWS_PER_READOUT};
int thresholdEnergyeV{-1};
std::array<int, 3> thresholdAllEnergyeV={{-1, -1, -1}};
std::vector<int64_t> rateCorrections;
readoutMode readoutType{ANALOG_ONLY};
uint32_t adcEnableMaskOneGiga{BIT32_MASK};

View File

@ -36,6 +36,7 @@ struct MasterAttributes {
uint32_t dynamicRange{0};
uint32_t tenGiga{0};
int thresholdEnergyeV{0};
std::array<int, 3> thresholdAllEnergyeV={{0, 0, 0}};
ns subExptime{0};
ns subPeriod{0};
uint32_t quad{0};
@ -353,6 +354,7 @@ class EigerMasterAttributes : public MasterAttributes {
<< "Ten Giga : " << tenGiga << '\n'
<< "Exptime : " << sls::ToString(exptime) << '\n'
<< "Period : " << sls::ToString(period) << '\n'
<< "Threshold Energy : " << thresholdEnergyeV << '\n'
<< "SubExptime : " << sls::ToString(subExptime)
<< '\n'
<< "SubPeriod : " << sls::ToString(subPeriod)
@ -450,7 +452,9 @@ class Mythen3MasterAttributes : public MasterAttributes {
<< '\n'
<< "GateDelay3 : " << sls::ToString(gateDelay3)
<< '\n'
<< "Gates : " << gates << '\n';
<< "Gates : " << gates << '\n'
<< "Threshold Energies : "
<< sls::ToString(thresholdAllEnergyeV) << '\n';
std::string message = oss.str();
MasterAttributes::WriteBinaryAttributes(fd, message);
};
@ -523,6 +527,14 @@ class Mythen3MasterAttributes : public MasterAttributes {
group->createDataSet("Gates", PredType::STD_U32LE, dataspace);
dataset.write(&gates, PredType::STD_U32LE);
}
// Threshold Energies
{
DataSpace dataspace = DataSpace(H5S_SCALAR);
StrType strdatatype(PredType::C_S1, 1024);
DataSet dataset = group->createDataSet("Threshold Energies",
strdatatype, dataspace);
dataset.write(sls::ToString(thresholdAllEnergyeV), strdatatype);
}
};
#endif
};
@ -679,4 +691,4 @@ class CtbMasterAttributes : public MasterAttributes {
}
};
#endif
};
};