first test to read hdf4/hdf5 directly.

This commit is contained in:
2026-01-25 16:20:10 +01:00
parent 83c8f6630c
commit 65efb389c3

View File

@@ -2139,18 +2139,32 @@ Bool_t PRunDataHandler::ReadNexusFile()
#ifdef PNEXUS_ENABLED
std::cout << std::endl << ">> PRunDataHandler::ReadNexusFile(): Will read nexus file " << fRunPathName.Data() << " ...";
nxs::HDFType type = nxs::checkHDFType(fRunPathName.Data());
switch (type) {
case nxs::HDFType::HDF4:
std::cout << std::endl << ">> PRunDataHandler::ReadNexusFile(): HDF4 file." << std::endl;
break;
case nxs::HDFType::HDF5:
std::cout << std::endl << ">> PRunDataHandler::ReadNexusFile(): HDF5 file." << std::endl;
break;
case nxs::HDFType::Unknown:
std::cerr << std::endl << ">> PRunDataHandler::ReadNexusFile(): Not a valid NeXus file." << std::endl;
return false;
}
nxs::HDFType type = nxs::checkHDFType(fRunPathName.Data());
// check for type errors, missing enabled HDF4
switch (type) {
case nxs::HDFType::HDF4:
std::cout << std::endl << ">> PRunDataHandler::ReadNexusFile(): HDF4 file." << std::endl;
#ifndef HAVE_HDF4
std::cerr << std::endl << ">> PRunDataHandler::ReadNexusFile(): **ERROR**, HDF4 is not enabled." << std::endl;
return false;
#endif
break;
case nxs::HDFType::HDF5:
std::cout << std::endl << ">> PRunDataHandler::ReadNexusFile(): HDF5 file." << std::endl;
break;
case nxs::HDFType::Unknown:
std::cerr << std::endl << ">> PRunDataHandler::ReadNexusFile(): Not a valid NeXus file." << std::endl;
return false;
}
if (type == nxs::HDFType::HDF4) {
#ifdef HAVE_HDF4
std::unique_ptr<nxH4::PNeXus> nxs_file = std::make_unique<nxH4::PNeXus>(fRunPathName.Data());
#endif
} else { // HDF5
std::unique_ptr<nxH5::PNeXus> nxs_file = std::make_unique<nxH5::PNeXus>(fRunPathName.Data());
}
/* //as35
PDoubleVector histoData;
@@ -2159,7 +2173,7 @@ Bool_t PRunDataHandler::ReadNexusFile()
TString str;
std::string sstr;
Double_t dval;
bool ok;
bool ok;
std::unique_ptr<PNeXus> nxs_file = std::make_unique<PNeXus>(fRunPathName.Data());
if (!nxs_file->IsValid()) {