Commit 2063a17c authored by Stephen's avatar Stephen
Browse files

Fix LoadMuonNexusV2 wrongly loading PSI Muon files

The LoadMuonNexusV2 algorithm was wrongly being chosen by the Load algorithm to load PSI Muon files. This occurs as the files are very similar, with both having a /raw_data_entry and a raw_data_1/definition Muon entry.

In order to differentiate these two files, the MuonNexusV2 loader now has an additional confidence metric, which returns 0 if a top level beamline entry is not found, i.e raw_data_1/beamline. This works as the beamline entry in the PSI files is located within raw_data_1/instrument/beamline entry.
parent 283ae6fb
......@@ -35,6 +35,7 @@ namespace NeXusEntry {
const std::string RAWDATA{"/raw_data_1"};
const std::string DEFINITION{"/raw_data_1/definition"};
const std::string PERIOD{"/periods"};
const std::string BEAMLINE{"/raw_data_1/beamline"};
} // namespace NeXusEntry
/// Empty default constructor
......@@ -53,9 +54,16 @@ int LoadMuonNexusV2::confidence(NexusHDF5Descriptor &descriptor) const {
if (!descriptor.isEntry(NeXusEntry::RAWDATA, "NXentry")) {
return 0;
}
// Check if beamline entry exists beneath raw_data_1 - /raw_data_1/beamline
// Necessary to differentiate between ISIS and PSI nexus files.
if (!descriptor.isEntry(NeXusEntry::BEAMLINE))
return 0;
// Check if Muon source in definition entry
if (!descriptor.isEntry(NeXusEntry::DEFINITION))
return 0;
::NeXus::File file(descriptor.getFilename());
file.openPath(NeXusEntry::DEFINITION);
std::string def = file.getStrData();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment