From 95d087164d338ef56165cf53073cdf505d0bece7 Mon Sep 17 00:00:00 2001 From: Andreas Suter Date: Sat, 7 Feb 2026 20:17:23 +0100 Subject: [PATCH] first full mandatory HDF5 IDF V2 writer. --- src/classes/PRunDataHandler.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/classes/PRunDataHandler.cpp b/src/classes/PRunDataHandler.cpp index f2c2559d..df820d00 100644 --- a/src/classes/PRunDataHandler.cpp +++ b/src/classes/PRunDataHandler.cpp @@ -5165,22 +5165,24 @@ Bool_t PRunDataHandler::WriteNexusFile(TString format, TString fln) size = dataCount; } nxs->AddDataset("/raw_data_1/instrument/detector_1/counts", data, {(long unsigned int)noHisto, size}, H5::PredType::NATIVE_INT32); - nxs->AddDatasetAttribute("/raw_data_1/instrument/detector_1/counts", "axis", std::string("spectrum_index,time_bin")); + nxs->AddDatasetAttribute("/raw_data_1/instrument/detector_1/counts", "axes", std::string("spectrum_index,time_bin")); nxs->AddDatasetAttribute("/raw_data_1/instrument/detector_1/counts", "long_name", std::string("positon counts")); nxs->AddDatasetAttribute("/raw_data_1/instrument/detector_1/counts", "signal", 1); // t0_bin attributes std::vector t0_bin; for (unsigned int i=0; irebin)); -std::cerr << std::endl; -for (unsigned int i=0; iAddDatasetAttribute("/raw_data_1/instrument/detector_1/counts", "t0_bin", {t0_bin}); nxs->AddDatasetAttribute("/raw_data_1/instrument/detector_1/counts", "units", std::string("counts")); // set raw_data_1/detector info nxs->AddGroupAttribute("/raw_data_1/detector_1", "NX_class", std::string("NXdata")); + + // set detector/counts + nxs->AddDataset("/raw_data_1/detector_1/counts", data, {(long unsigned int)noHisto, size}, H5::PredType::NATIVE_INT32); + nxs->AddDatasetAttribute("/raw_data_1/detector_1/counts", "axes", std::string("spectrum_index,time_bin")); + nxs->AddDatasetAttribute("/raw_data_1/detector_1/counts", "long_name", std::string("positon counts")); + nxs->AddDatasetAttribute("/raw_data_1/detector_1/counts", "signal", 1); } int result = nxs->WriteNexusFile(fln.Data(), fAny2ManyInfo->idf);