start populating HDF4 header info.
This commit is contained in:
@@ -2214,9 +2214,50 @@ Bool_t PRunDataHandler::ReadNexusFile()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PDoubleVector histoData;
|
||||||
|
PRawRunData runData;
|
||||||
|
PRawRunDataSet dataSet;
|
||||||
|
TString str;
|
||||||
|
std::string sstr;
|
||||||
|
Int_t ival;
|
||||||
|
Double_t dval;
|
||||||
|
bool ok;
|
||||||
|
|
||||||
if (type == nxs::HDFType::HDF4) {
|
if (type == nxs::HDFType::HDF4) {
|
||||||
#ifdef HAVE_HDF4
|
#ifdef HAVE_HDF4
|
||||||
std::unique_ptr<nxH4::PNeXus> nxs_file = std::make_unique<nxH4::PNeXus>(fRunPathName.Data());
|
std::unique_ptr<nxH4::PNeXus> nxs_file = std::make_unique<nxH4::PNeXus>(fRunPathName.Data());
|
||||||
|
|
||||||
|
// get header information
|
||||||
|
|
||||||
|
// get/set laboratory
|
||||||
|
sstr = "n/a";
|
||||||
|
if (nxs_file->HasDataset("/run/lab"))
|
||||||
|
sstr = nxs_file->GetDataset<std::string>("/run/lab").GetData()[0];
|
||||||
|
runData.SetLaboratory(sstr);
|
||||||
|
|
||||||
|
// get/set beamline
|
||||||
|
sstr = "n/a";
|
||||||
|
if (nxs_file->HasDataset("/run/beamline"))
|
||||||
|
sstr = nxs_file->GetDataset<std::string>("/run/beamline").GetData()[0];
|
||||||
|
runData.SetBeamline(sstr);
|
||||||
|
|
||||||
|
// get/set instrument
|
||||||
|
sstr = "n/a";
|
||||||
|
if (nxs_file->HasDataset("/run/instrument/name"))
|
||||||
|
sstr = nxs_file->GetDataset<std::string>("/run/instrument/name").GetData()[0];
|
||||||
|
runData.SetInstrument(sstr);
|
||||||
|
|
||||||
|
// get/set run title
|
||||||
|
str = "n/a";
|
||||||
|
if (nxs_file->HasDataset("/run/title"))
|
||||||
|
sstr = nxs_file->GetDataset<std::string>("/run/title").GetData()[0];
|
||||||
|
runData.SetRunTitle(sstr);
|
||||||
|
|
||||||
|
// get/set run number
|
||||||
|
ival = -1;
|
||||||
|
if (nxs_file->HasDataset("/run/number"))
|
||||||
|
ival = nxs_file->GetDataset<int>("/run/number").GetData()[0];
|
||||||
|
runData.SetRunNumber(ival);
|
||||||
#endif
|
#endif
|
||||||
} else { // HDF5
|
} else { // HDF5
|
||||||
std::unique_ptr<nxH5::PNeXus> nxs_file = std::make_unique<nxH5::PNeXus>(fRunPathName.Data());
|
std::unique_ptr<nxH5::PNeXus> nxs_file = std::make_unique<nxH5::PNeXus>(fRunPathName.Data());
|
||||||
|
|||||||
6
src/external/nexus/PNeXus.cpp
vendored
6
src/external/nexus/PNeXus.cpp
vendored
@@ -502,7 +502,7 @@ void nxH4::PNeXus::HandleIdfV1(int32 sd_id)
|
|||||||
std::vector<std::string> int_datasets = {
|
std::vector<std::string> int_datasets = {
|
||||||
"/run/IDF_version",
|
"/run/IDF_version",
|
||||||
"/run/number",
|
"/run/number",
|
||||||
"/run/switching_state",
|
"/run/switching_states",
|
||||||
"/run/instrument/detector/number",
|
"/run/instrument/detector/number",
|
||||||
"/run/histogram_data_1/counts",
|
"/run/histogram_data_1/counts",
|
||||||
"/run/histogram_data_1/resolution",
|
"/run/histogram_data_1/resolution",
|
||||||
@@ -3126,7 +3126,7 @@ void nxH5::PNeXus::HandleIdfV1(H5::H5File &file)
|
|||||||
ReadStringDataset(file, "/run/beamline");
|
ReadStringDataset(file, "/run/beamline");
|
||||||
ReadStringDataset(file, "/run/start_time");
|
ReadStringDataset(file, "/run/start_time");
|
||||||
ReadStringDataset(file, "/run/end_time");
|
ReadStringDataset(file, "/run/end_time");
|
||||||
ReadIntDataset(file, "/run/switching_state");
|
ReadIntDataset(file, "/run/switching_states");
|
||||||
ReadStringDataset(file, "/run/user/name");
|
ReadStringDataset(file, "/run/user/name");
|
||||||
ReadStringDataset(file, "/run/user/experiment_number");
|
ReadStringDataset(file, "/run/user/experiment_number");
|
||||||
ReadStringDataset(file, "/run/sample/name");
|
ReadStringDataset(file, "/run/sample/name");
|
||||||
@@ -3193,9 +3193,9 @@ void nxH5::PNeXus::HandleIdfV2(H5::H5File &file)
|
|||||||
// Read the mandatory key datasets and store them in the data map
|
// Read the mandatory key datasets and store them in the data map
|
||||||
try {
|
try {
|
||||||
ReadIntDataset(file, "/raw_data_1/IDF_version");
|
ReadIntDataset(file, "/raw_data_1/IDF_version");
|
||||||
ReadIntDataset(file, "/raw_data_1/good_frames");
|
|
||||||
ReadStringDataset(file, "/raw_data_1/beamline");
|
ReadStringDataset(file, "/raw_data_1/beamline");
|
||||||
ReadStringDataset(file, "/raw_data_1/definition");
|
ReadStringDataset(file, "/raw_data_1/definition");
|
||||||
|
ReadIntDataset(file, "/raw_data_1/good_frames");
|
||||||
ReadIntDataset(file, "/raw_data_1/run_number");
|
ReadIntDataset(file, "/raw_data_1/run_number");
|
||||||
ReadStringDataset(file, "/raw_data_1/title");
|
ReadStringDataset(file, "/raw_data_1/title");
|
||||||
ReadStringDataset(file, "/raw_data_1/start_time");
|
ReadStringDataset(file, "/raw_data_1/start_time");
|
||||||
|
|||||||
Reference in New Issue
Block a user