check for IDF 1/2.
This commit is contained in:
@@ -2219,7 +2219,7 @@ Bool_t PRunDataHandler::ReadNexusFile()
|
|||||||
PRawRunDataSet dataSet;
|
PRawRunDataSet dataSet;
|
||||||
TString str;
|
TString str;
|
||||||
std::string sstr;
|
std::string sstr;
|
||||||
Int_t ival;
|
Int_t ival, idf{-1};
|
||||||
Double_t dval, factor;
|
Double_t dval, factor;
|
||||||
bool ok;
|
bool ok;
|
||||||
|
|
||||||
@@ -2231,6 +2231,23 @@ Bool_t PRunDataHandler::ReadNexusFile()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check for IDF_version
|
||||||
|
if (nxs_file->HasDataset("/run/IDF_version")) {
|
||||||
|
idf = nxs_file->GetDataset<int>("/run/IDF_version").GetData()[0];
|
||||||
|
std::cout << ">> PRunDataHandler::ReadNexusFile(): IDF V" << idf << std::endl;
|
||||||
|
}
|
||||||
|
if (idf == -1) { // IDF_version not found
|
||||||
|
if (nxs_file->HasDataset("/raw_data_1/IDF_version")) {
|
||||||
|
idf = nxs_file->GetDataset<int>("/raw_data_1/IDF_version").GetData()[0];
|
||||||
|
std::cout << ">> PRunDataHandler::ReadNexusFile(): IDF V" << idf << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((idf != 1) && (idf != 2)) {
|
||||||
|
std::cerr << std::endl << ">> PRunDataHandler::ReadNexusFile(): a NeXus file with an invalid IDF V" << idf << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (idf == 1) { // HDF4 IDF V1
|
||||||
// get header information
|
// get header information
|
||||||
|
|
||||||
// get/set laboratory
|
// get/set laboratory
|
||||||
@@ -2397,7 +2414,9 @@ Bool_t PRunDataHandler::ReadNexusFile()
|
|||||||
std::cerr << std::endl << "**ERROR** nxH4::PNeXus couldn't obtain data: '/run/histogram_data_1/counts' is missing." << std::endl;
|
std::cerr << std::endl << "**ERROR** nxH4::PNeXus couldn't obtain data: '/run/histogram_data_1/counts' is missing." << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} else { // HDF4 IDF V2
|
||||||
|
// not yet implemented
|
||||||
|
}
|
||||||
#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());
|
||||||
@@ -2405,13 +2424,31 @@ Bool_t PRunDataHandler::ReadNexusFile()
|
|||||||
std::cerr << std::endl << "**ERROR** allocation of nxH5::PNeXus object failed." << std::endl;
|
std::cerr << std::endl << "**ERROR** allocation of nxH5::PNeXus object failed." << std::endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check for IDF_version
|
||||||
|
if (nxs_file->HasDataset("/run/IDF_version")) {
|
||||||
|
idf = nxs_file->GetDataset<int>("/run/IDF_version").GetData()[0];
|
||||||
|
std::cout << ">> PRunDataHandler::ReadNexusFile(): IDF V" << idf << std::endl;
|
||||||
|
}
|
||||||
|
if (idf == -1) { // IDF_version not found
|
||||||
|
if (nxs_file->HasDataset("/raw_data_1/IDF_version")) {
|
||||||
|
idf = nxs_file->GetDataset<int>("/raw_data_1/IDF_version").GetData()[0];
|
||||||
|
std::cout << ">> PRunDataHandler::ReadNexusFile(): IDF V" << idf << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((idf != 1) && (idf != 2)) {
|
||||||
|
std::cerr << std::endl << ">> PRunDataHandler::ReadNexusFile(): a NeXus file with an invalid IDF V" << idf << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (idf == 1) { // HDF5 IDF V1
|
||||||
|
// not yet implemented
|
||||||
|
} else { // HDF5 IDF V2
|
||||||
|
// not yet implemented
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* //as35
|
/* //as35
|
||||||
if (nxs_file->GetIdfVersion() == 1) {
|
|
||||||
|
|
||||||
// keep the information
|
|
||||||
fData.push_back(runData);
|
|
||||||
} else if (nxs_file->GetIdfVersion() == 2) {
|
} else if (nxs_file->GetIdfVersion() == 2) {
|
||||||
if (!nxs_file->IsValid()) {
|
if (!nxs_file->IsValid()) {
|
||||||
std::cout << std::endl << "**ERROR** invalid NeXus IDF 2 version file found." << std::endl;
|
std::cout << std::endl << "**ERROR** invalid NeXus IDF 2 version file found." << std::endl;
|
||||||
|
|||||||
Reference in New Issue
Block a user