From 53820f890e8ff9c88c80a9526b30eca4cd50fa2d Mon Sep 17 00:00:00 2001 From: Dan Nixon <dan@dan-nixon.com> Date: Fri, 19 Sep 2014 09:53:17 +0100 Subject: [PATCH] Load analyser component if it is not in the file Refs #9338 --- .../MantidQt/CustomInterfaces/src/ConvFit.cpp | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/ConvFit.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/ConvFit.cpp index 574a21684cb..20370d2c432 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/ConvFit.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/ConvFit.cpp @@ -479,13 +479,30 @@ namespace IDA double resolution = 0.0; try { - MatrixWorkspace_sptr ws = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(workspaceName); - Mantid::Geometry::Instrument_const_sptr inst = ws->getInstrument(); + Mantid::Geometry::Instrument_const_sptr inst = + AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(workspaceName)->getInstrument(); std::string analyser = inst->getStringParameter("analyser")[0]; + + // If the analyser component is not already in the data file the laod it from the parameter file + if(inst->getComponentByName(analyser)->getNumberParameter("resolution").size() == 0) + { + std::string reflection = inst->getStringParameter("reflection")[0]; + + IAlgorithm_sptr loadParamFile = AlgorithmManager::Instance().create("LoadParameterFile"); + loadParamFile->initialize(); + loadParamFile->setProperty("Workspace", workspaceName); + loadParamFile->setProperty("Filename", inst->getName()+"_"+analyser+"_"+reflection+"_Parameters.xml"); + loadParamFile->execute(); + + inst = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(workspaceName)->getInstrument(); + } + resolution = inst->getComponentByName(analyser)->getNumberParameter("resolution")[0]; } catch(Mantid::Kernel::Exception::NotFoundError &e) { + UNUSED_ARG(e); + resolution = 0; } -- GitLab