diff --git a/Framework/DataHandling/inc/MantidDataHandling/LoadEventNexus.h b/Framework/DataHandling/inc/MantidDataHandling/LoadEventNexus.h index 53ec17abe7400ac2efceea69b06cc6507cb7253e..a6c93a95321ac4add52048b92998b6c357765e52 100644 --- a/Framework/DataHandling/inc/MantidDataHandling/LoadEventNexus.h +++ b/Framework/DataHandling/inc/MantidDataHandling/LoadEventNexus.h @@ -113,11 +113,10 @@ public: /// Load instrument from Nexus file if possible, else from IDF spacified by /// Nexus file template <typename T> - static bool loadInstrument( - const std::string &nexusfilename, T localWorkspace, - const std::string &top_entry_name, Algorithm *alg, - const std::shared_ptr<Kernel::NexusHDF5Descriptor> &descriptor = - std::shared_ptr<Kernel::NexusHDF5Descriptor>()); + static bool + loadInstrument(const std::string &nexusfilename, T localWorkspace, + const std::string &top_entry_name, Algorithm *alg, + const Kernel::NexusHDF5Descriptor *descriptor = nullptr); /// Load instrument for Nexus file template <typename T> @@ -127,11 +126,10 @@ public: /// Load instrument from IDF file specified by Nexus file template <typename T> - static bool runLoadInstrument( - const std::string &nexusfilename, T localWorkspace, - const std::string &top_entry_name, Algorithm *alg, - const std::shared_ptr<Kernel::NexusHDF5Descriptor> &descriptor = - std::shared_ptr<Kernel::NexusHDF5Descriptor>()); + static bool + runLoadInstrument(const std::string &nexusfilename, T localWorkspace, + const std::string &top_entry_name, Algorithm *alg, + const Kernel::NexusHDF5Descriptor *descriptor = nullptr); static void loadSampleDataISIScompatibility(::NeXus::File &file, EventWorkspaceCollection &WS); @@ -487,14 +485,14 @@ template <typename T> bool LoadEventNexus::runLoadInstrument( const std::string &nexusfilename, T localWorkspace, const std::string &top_entry_name, Algorithm *alg, - const std::shared_ptr<Kernel::NexusHDF5Descriptor> &descriptor) { + const Kernel::NexusHDF5Descriptor *descriptor) { std::string instrument; std::string instFilename; const bool isNexus = - descriptor - ? LoadGeometry::isNexus(nexusfilename, descriptor->getAllEntries()) - : LoadGeometry::isNexus(nexusfilename); + (descriptor == nullptr) + ? LoadGeometry::isNexus(nexusfilename) + : LoadGeometry::isNexus(nexusfilename, descriptor->getAllEntries()); // Check if the geometry can be loaded directly from the Nexus file if (isNexus) { @@ -753,7 +751,7 @@ template <typename T> bool LoadEventNexus::loadInstrument( const std::string &nexusfilename, T localWorkspace, const std::string &top_entry_name, Algorithm *alg, - const std::shared_ptr<Kernel::NexusHDF5Descriptor> &descriptor) { + const Kernel::NexusHDF5Descriptor *descriptor) { bool loadNexusInstrumentXML = true; if (alg->existsProperty("LoadNexusInstrumentXML")) diff --git a/Framework/DataHandling/src/LoadEventNexus.cpp b/Framework/DataHandling/src/LoadEventNexus.cpp index b55fb9ccc4419827a3a4478d092b9d90f451ada8..90b3d2640ec56d9a024d6d1d29db7d43c9d71968 100644 --- a/Framework/DataHandling/src/LoadEventNexus.cpp +++ b/Framework/DataHandling/src/LoadEventNexus.cpp @@ -816,8 +816,8 @@ void LoadEventNexus::loadEvents(API::Progress *const prog, // This may not be needed in the future if both LoadEventNexus and // LoadInstrument are made to use the same Nexus/HDF5 library m_file->close(); - m_instrument_loaded_correctly = - loadInstrument(m_filename, m_ws, m_top_entry_name, this, descriptor); + m_instrument_loaded_correctly = loadInstrument( + m_filename, m_ws, m_top_entry_name, this, descriptor.get()); if (!m_instrument_loaded_correctly) throw std::runtime_error("Instrument was not initialized correctly! " @@ -867,8 +867,9 @@ void LoadEventNexus::loadEvents(API::Progress *const prog, } // get the number of events const std::string prefix = "/" + m_top_entry_name + "/" + entry_name; - std::size_t num = - numEvents(*m_file, true, oldNeXusFileNames, prefix, *descriptor); + bool hasTotalCounts = true; + std::size_t num = numEvents(*m_file, hasTotalCounts, oldNeXusFileNames, + prefix, *descriptor); bankNames.emplace_back(entry_name); bankNumEvents.emplace_back(num); @@ -1183,7 +1184,7 @@ bool LoadEventNexus::runLoadInstrument<EventWorkspaceCollection_sptr>( const std::string &nexusfilename, EventWorkspaceCollection_sptr localWorkspace, const std::string &top_entry_name, Algorithm *alg, - const std::shared_ptr<NexusHDF5Descriptor> &descriptor) { + const Kernel::NexusHDF5Descriptor *descriptor) { auto ws = localWorkspace->getSingleHeldWorkspace(); auto hasLoaded = runLoadInstrument<MatrixWorkspace_sptr>( nexusfilename, ws, top_entry_name, alg, descriptor); diff --git a/Framework/DataHandling/src/LoadNexusLogs.cpp b/Framework/DataHandling/src/LoadNexusLogs.cpp index faf5bb4567ec9d89c0409634b3ed63f580fd16be..983c1941724706113058ba991e78126b5d83d810 100644 --- a/Framework/DataHandling/src/LoadNexusLogs.cpp +++ b/Framework/DataHandling/src/LoadNexusLogs.cpp @@ -729,16 +729,10 @@ void LoadNexusLogs::loadLogs( void LoadNexusLogs::loadNXLog( ::NeXus::File &file, const std::string &absolute_entry_name, const std::string &entry_class, -<<<<<<< HEAD const std::shared_ptr<API::MatrixWorkspace> &workspace) const { - g_log.debug() << "processing " << entry_name << ":" << entry_class << "\n"; -======= - const boost::shared_ptr<API::MatrixWorkspace> &workspace) const { ->>>>>>> Refactored LoadNexusLogs const std::string entry_name = absolute_entry_name.substr(absolute_entry_name.find_last_of("/") + 1); - g_log.debug() << "processing " << entry_name << ":" << entry_class << "\n"; file.openGroup(entry_name, entry_class); // Validate the NX log class. @@ -795,17 +789,12 @@ void LoadNexusLogs::loadNXLog( * @param workspace :: A pointer to the workspace to store the logs */ void LoadNexusLogs::loadSELog( -<<<<<<< HEAD - ::NeXus::File &file, const std::string &entry_name, + ::NeXus::File &file, const std::string &absolute_entry_name, const std::shared_ptr<API::MatrixWorkspace> &workspace) const { // Open the entry -======= - ::NeXus::File &file, const std::string &absolute_entry_name, - const boost::shared_ptr<API::MatrixWorkspace> &workspace) const { - const std::string entry_name = absolute_entry_name.substr(absolute_entry_name.find_last_of("/") + 1); ->>>>>>> Refactored LoadNexusLogs + file.openGroup(entry_name, "IXseblock"); std::string propName = entry_name; if (workspace->run().hasProperty(propName)) { diff --git a/Framework/Kernel/src/NexusHDF5Descriptor.cpp b/Framework/Kernel/src/NexusHDF5Descriptor.cpp index 696f886aa2822e66717033d9b20831b8a9de0d35..aed0a895af3f88d030b52b34a0261ee4cf0b7bf6 100644 --- a/Framework/Kernel/src/NexusHDF5Descriptor.cpp +++ b/Framework/Kernel/src/NexusHDF5Descriptor.cpp @@ -246,7 +246,7 @@ bool NexusHDF5Descriptor::isEntry(const std::string &entryName, bool NexusHDF5Descriptor::isEntry(const std::string &entryName) const noexcept { - for (auto itClass = m_allEntries.cbegin(); itClass != m_allEntries.cend(); + for (auto itClass = m_allEntries.rbegin(); itClass != m_allEntries.rend(); ++itClass) { if (itClass->second.count(entryName) == 1) { return true;