mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-06-30 17:38:29 +02:00
works in file. still needs refactoring
This commit is contained in:
@@ -55,8 +55,6 @@ void MasterAttributes::GetJungfrauBinaryAttributes(writer *w) {
|
||||
WriteBinaryNumberOfUDPInterfaces(w);
|
||||
WriteBinaryNumberOfRows(w);
|
||||
WriteBinaryReadoutSpeed(w);
|
||||
if (numUDPInterfaces == 2)
|
||||
WriteBinaryUDPPortEnables(w);
|
||||
}
|
||||
|
||||
#ifdef HDF5C
|
||||
@@ -67,8 +65,6 @@ void MasterAttributes::WriteJungfrauHDF5Attributes(H5::Group *group) {
|
||||
WriteHDF5NumberOfUDPInterfaces(group);
|
||||
WriteHDF5NumberOfRows(group);
|
||||
WriteHDF5ReadoutSpeed(group);
|
||||
if (numUDPInterfaces == 2)
|
||||
WriteHDF5UDPPortEnables(group);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -79,8 +75,6 @@ void MasterAttributes::GetMoenchBinaryAttributes(writer *w) {
|
||||
WriteBinaryNumberOfUDPInterfaces(w);
|
||||
WriteBinaryNumberOfRows(w);
|
||||
WriteBinaryReadoutSpeed(w);
|
||||
if (numUDPInterfaces == 2)
|
||||
WriteBinaryUDPPortEnables(w);
|
||||
}
|
||||
|
||||
#ifdef HDF5C
|
||||
@@ -91,8 +85,6 @@ void MasterAttributes::WriteMoenchHDF5Attributes(H5::Group *group) {
|
||||
WriteHDF5NumberOfUDPInterfaces(group);
|
||||
WriteHDF5NumberOfRows(group);
|
||||
WriteHDF5ReadoutSpeed(group);
|
||||
if (numUDPInterfaces == 2)
|
||||
WriteHDF5UDPPortEnables(group);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -109,7 +101,6 @@ void MasterAttributes::GetEigerBinaryAttributes(writer *w) {
|
||||
WriteBinaryNumberOfRows(w);
|
||||
WriteBinaryRateCorrections(w);
|
||||
WriteBinaryReadoutSpeed(w);
|
||||
WriteBinaryUDPPortEnables(w);
|
||||
}
|
||||
|
||||
#ifdef HDF5C
|
||||
@@ -126,7 +117,6 @@ void MasterAttributes::WriteEigerHDF5Attributes(H5::Group *group) {
|
||||
WriteHDF5NumberOfRows(group);
|
||||
WriteHDF5RateCorrections(group);
|
||||
WriteHDF5ReadoutSpeed(group);
|
||||
WriteHDF5UDPPortEnables(group);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -423,11 +413,19 @@ void MasterAttributes::WriteHDF5AcquisitionPeriod(H5::Group *group) {
|
||||
|
||||
void MasterAttributes::WriteBinaryNumberOfUDPInterfaces(writer *w) {
|
||||
WriteBinary(w, N_NUM_UDP_INTERFACES.data(), numUDPInterfaces);
|
||||
if (numUDPInterfaces == 2 && detType != defs::GOTTHARD2) {
|
||||
WriteBinaryUDPPortsType(w);
|
||||
WriteBinaryUDPPortsDisabled(w);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HDF5C
|
||||
void MasterAttributes::WriteHDF5NumberOfUDPInterfaces(H5::Group *group) {
|
||||
WriteHDF5Int(group, N_NUM_UDP_INTERFACES.data(), numUDPInterfaces);
|
||||
if (numUDPInterfaces == 2 && detType != defs::GOTTHARD2) {
|
||||
WriteHDF5UDPPortsType(group);
|
||||
WriteHDF5UDPPortsDisabled(group);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -700,35 +698,23 @@ void MasterAttributes::WriteHDF5TransceiverSamples(H5::Group *group) {
|
||||
}
|
||||
#endif
|
||||
|
||||
void MasterAttributes::WriteBinaryUDPPortEnables(writer *w) {
|
||||
for (size_t i = 0; i != udpPortType.size(); ++i) {
|
||||
std::string key = udpPortType[i] + std::string(N_UDP_PORT_ENABLES);
|
||||
w->Key(key.c_str());
|
||||
w->StartArray();
|
||||
for (const int u : udpPortEnables[i]) {
|
||||
w->Int(u);
|
||||
}
|
||||
w->EndArray();
|
||||
}
|
||||
void MasterAttributes::WriteBinaryUDPPortsType(writer *w) {
|
||||
WriteBinary(w, N_UDP_PORTS_TYPE.data(), udpPortTypes);
|
||||
}
|
||||
|
||||
#ifdef HDF5C
|
||||
void MasterAttributes::WriteHDF5UDPPortEnables(H5::Group *group) {
|
||||
for (size_t i = 0; i != udpPortType.size(); ++i) {
|
||||
// convert vector<bool> -> vector<uint8_t>
|
||||
std::vector<int> vals(udpPortEnables[i].begin(),
|
||||
udpPortEnables[i].end());
|
||||
void MasterAttributes::WriteHDF5UDPPortsType(H5::Group *group) {
|
||||
WriteHDF5StringArray(group, N_UDP_PORTS_TYPE.data(), udpPortTypes);
|
||||
}
|
||||
#endif
|
||||
|
||||
hsize_t dims[1] = {vals.size()};
|
||||
H5::DataSpace dataspace(1, dims);
|
||||
void MasterAttributes::WriteBinaryUDPPortsDisabled(writer *w) {
|
||||
WriteBinary(w, N_UDP_PORTS_DISBLED.data(), udpPortsDisabled);
|
||||
}
|
||||
|
||||
std::string key = udpPortType[i] + std::string(N_UDP_PORT_ENABLES);
|
||||
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet(key, H5::PredType::NATIVE_UINT32, dataspace);
|
||||
|
||||
dataset.write(vals.data(), H5::PredType::NATIVE_UINT32);
|
||||
}
|
||||
#ifdef HDF5C
|
||||
void MasterAttributes::WriteHDF5UDPPortsDisabled(H5::Group *group) {
|
||||
WriteHDF5Int(group, N_UDP_PORTS_DISBLED.data(), udpPortsDisabled);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user