diff --git a/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadIDFFromNexus.h b/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadIDFFromNexus.h index 4fedeff263fa..318073899afb 100644 --- a/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadIDFFromNexus.h +++ b/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadIDFFromNexus.h @@ -8,14 +8,6 @@ namespace Mantid { - - namespace Geometry - { - class CompAssembly; - class Component; - class Instrument; - } - namespace DataHandling { /** @class LoadIDFFromNexus LoadInstrumentFromNexus.h DataHandling/LoadIDFFromNexus.h @@ -36,10 +28,7 @@ namespace Mantid
  • Workspace - The name of the workspace in which to use as a basis for any data to be added.
  • - @author Karl Palmen, ISIS, RAL (LoadInstrumentFromRaw) - - - Copyright © 2007-8 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory + Copyright © 2013 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory This file is part of Mantid. @@ -68,10 +57,10 @@ namespace Mantid virtual ~LoadIDFFromNexus() {} /// Algorithm's name for identification overriding a virtual method - virtual const std::string name() const { return "LoadIDFFromNexus";}; + virtual const std::string name() const { return "LoadIDFFromNexus";} /// Algorithm's version for identification overriding a virtual method - virtual int version() const { return 1;}; + virtual int version() const { return 1;} /// Algorithm's category for identification overriding a virtual method virtual const std::string category() const { return "DataHandling\\Instrument";} @@ -79,15 +68,12 @@ namespace Mantid private: /// Sets documentation strings for this algorithm virtual void initDocs(); - /// Overwrites Algorithm method. Does nothing at present void init(); - /// Overwrites Algorithm method void exec(); - /// The name and path of the input file - std::string m_filename; + void runLoadParameterFile(API::MatrixWorkspace_sptr workspace); }; } // namespace DataHandling diff --git a/Code/Mantid/Framework/DataHandling/src/LoadEventNexus.cpp b/Code/Mantid/Framework/DataHandling/src/LoadEventNexus.cpp index 81ccf54d2fa7..999c0bcb63a0 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadEventNexus.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadEventNexus.cpp @@ -1820,7 +1820,7 @@ bool LoadEventNexus::loadInstrument(const std::string & nexusfilename, MatrixWor bool LoadEventNexus::runLoadIDFFromNexus(const std::string & nexusfilename, API::MatrixWorkspace_sptr localWorkspace, const std::string & top_entry_name, Algorithm * alg) { - IAlgorithm_sptr loadInst= alg->createChildAlgorithm("LoadIDFFromNexus",-1,-1,false); + IAlgorithm_sptr loadInst= alg->createChildAlgorithm("LoadIDFFromNexus"); // Now execute the Child Algorithm. Catch and log any error, but don't stop. try diff --git a/Code/Mantid/Framework/DataHandling/src/LoadIDFFromNexus.cpp b/Code/Mantid/Framework/DataHandling/src/LoadIDFFromNexus.cpp index f2b2d7365c7d..430d5edd9e82 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadIDFFromNexus.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadIDFFromNexus.cpp @@ -6,17 +6,10 @@ // Includes //---------------------------------------------------------------------- #include "MantidDataHandling/LoadIDFFromNexus.h" -#include "MantidGeometry/Instrument.h" -#include "MantidGeometry/Instrument/Detector.h" -#include "MantidGeometry/Instrument/CompAssembly.h" -#include "MantidGeometry/Instrument/Component.h" -#include "MantidNexus/MuonNexusReader.h" +#include "MantidDataHandling/LoadParameterFile.h" #include "MantidKernel/ConfigService.h" #include "MantidAPI/FileProperty.h" -#include - - namespace Mantid { namespace DataHandling @@ -68,7 +61,7 @@ void LoadIDFFromNexus::init() void LoadIDFFromNexus::exec() { // Retrieve the filename from the properties - m_filename = getPropertyValue("Filename"); + const std::string filename = getPropertyValue("Filename"); // Get the input workspace const MatrixWorkspace_sptr localWorkspace = getProperty("Workspace"); @@ -77,7 +70,7 @@ void LoadIDFFromNexus::exec() std::string instrumentParentPath = getPropertyValue("InstrumentParentPath"); // Get the instrument group in the Nexus file - ::NeXus::File nxfile(m_filename); + ::NeXus::File nxfile(filename); // Assume one level in instrument path nxfile.openPath(instrumentParentPath); @@ -85,9 +78,26 @@ void LoadIDFFromNexus::exec() localWorkspace->loadExperimentInfoNexus( &nxfile, parameterString ); localWorkspace->readParameterMap(parameterString); + runLoadParameterFile(localWorkspace); + return; } +void LoadIDFFromNexus::runLoadParameterFile(MatrixWorkspace_sptr workspace) +{ + const std::string directory = ConfigService::Instance().getString("parameterDefinition.directory"); + const std::string instrumentName = workspace->getInstrument()->getName(); + const std::string paramFile = directory + instrumentName + "_Parameters.xml"; + + try { + LoadParameterFile::execManually(paramFile, workspace); + } catch ( std::runtime_error& ex) { + g_log.notice() << "File " << paramFile << " not found or un-parsable. " + "However, the instrument has been loaded successfully.\n"; + } + +} + } // namespace DataHandling } // namespace Mantid