first full mandatory HDF5 IDF V2 writer.
This commit is contained in:
@@ -5165,22 +5165,24 @@ Bool_t PRunDataHandler::WriteNexusFile(TString format, TString fln)
|
||||
size = dataCount;
|
||||
}
|
||||
nxs->AddDataset<int>("/raw_data_1/instrument/detector_1/counts", data, {(long unsigned int)noHisto, size}, H5::PredType::NATIVE_INT32);
|
||||
nxs->AddDatasetAttribute<int>("/raw_data_1/instrument/detector_1/counts", "axis", std::string("spectrum_index,time_bin"));
|
||||
nxs->AddDatasetAttribute<int>("/raw_data_1/instrument/detector_1/counts", "axes", std::string("spectrum_index,time_bin"));
|
||||
nxs->AddDatasetAttribute<int>("/raw_data_1/instrument/detector_1/counts", "long_name", std::string("positon counts"));
|
||||
nxs->AddDatasetAttribute<int>("/raw_data_1/instrument/detector_1/counts", "signal", 1);
|
||||
// t0_bin attributes
|
||||
std::vector<int> t0_bin;
|
||||
for (unsigned int i=0; i<fData[0].GetNoOfHistos(); i++)
|
||||
t0_bin.push_back((int)(fData[0].GetT0Bin(i+1)/fAny2ManyInfo->rebin));
|
||||
std::cerr << std::endl;
|
||||
for (unsigned int i=0; i<fData[0].GetNoOfHistos(); i++)
|
||||
std::cerr << i << ": " << t0_bin[i] << ", ";
|
||||
std::cerr << std::endl;
|
||||
nxs->AddDatasetAttribute<int>("/raw_data_1/instrument/detector_1/counts", "t0_bin", {t0_bin});
|
||||
nxs->AddDatasetAttribute<int>("/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<int>("/raw_data_1/detector_1/counts", data, {(long unsigned int)noHisto, size}, H5::PredType::NATIVE_INT32);
|
||||
nxs->AddDatasetAttribute<int>("/raw_data_1/detector_1/counts", "axes", std::string("spectrum_index,time_bin"));
|
||||
nxs->AddDatasetAttribute<int>("/raw_data_1/detector_1/counts", "long_name", std::string("positon counts"));
|
||||
nxs->AddDatasetAttribute<int>("/raw_data_1/detector_1/counts", "signal", 1);
|
||||
}
|
||||
|
||||
int result = nxs->WriteNexusFile(fln.Data(), fAny2ManyInfo->idf);
|
||||
|
||||
Reference in New Issue
Block a user