diff --git a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/GetDetectorOffsets.h b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/GetDetectorOffsets.h index 447c72f099300d6ca03919b4cb9e0b8f638b6bd4..a5ed80be69a11be489361521161b37056eefbb58 100644 --- a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/GetDetectorOffsets.h +++ b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/GetDetectorOffsets.h @@ -58,7 +58,7 @@ private: /// Call Gaussian as a sub-algorithm to fit the peak in a spectrum double fitSpectra(const int64_t s); /// Create a function string from the given parameters and the algorithm inputs - std::string createFunctionString(const double peakHeight, const double peakLoc); + API::IFitFunction_sptr createFunction(const double peakHeight, const double peakLoc); /// Read in all the input parameters void retrieveProperties(); diff --git a/Code/Mantid/Framework/Algorithms/src/GetDetectorOffsets.cpp b/Code/Mantid/Framework/Algorithms/src/GetDetectorOffsets.cpp index 07a854e8ea9bcd4435ed0e0840a83cc6091b87d8..dd5dd331c5466901ed029820cd6ae7e1fc1aff71 100644 --- a/Code/Mantid/Framework/Algorithms/src/GetDetectorOffsets.cpp +++ b/Code/Mantid/Framework/Algorithms/src/GetDetectorOffsets.cpp @@ -212,9 +212,9 @@ namespace Mantid fit_alg->setProperty("EndX",Xmax); fit_alg->setProperty("MaxIterations",100); - std::string fun_str = createFunctionString(peakHeight, peakLoc); + IFitFunction_sptr fun_ptr = createFunction(peakHeight, peakLoc); - fit_alg->setPropertyValue("Function",fun_str); + fit_alg->setProperty("Function",fun_ptr); fit_alg->executeAsSubAlg(); std::string fitStatus = fit_alg->getProperty("OutputStatus"); //Pixel with large offset will be masked @@ -232,7 +232,7 @@ namespace Mantid * @param peakHeight :: The height of the peak * @param peakLoc :: The location of the peak */ - std::string GetDetectorOffsets::createFunctionString(const double peakHeight, const double peakLoc) + IFitFunction_sptr GetDetectorOffsets::createFunction(const double peakHeight, const double peakLoc) { FunctionFactoryImpl & creator = FunctionFactory::Instance(); IBackgroundFunction *background = @@ -244,11 +244,11 @@ namespace Mantid const double sigma(10.0); peak->setWidth(2.0*std::sqrt(2.0*std::log(2.0))*sigma); - CompositeFunctionMW fitFunc; //Takes ownership of the functions - fitFunc.addFunction(background); - fitFunc.addFunction(peak); + CompositeFunctionMW* fitFunc = new CompositeFunctionMW(); //Takes ownership of the functions + fitFunc->addFunction(background); + fitFunc->addFunction(peak); - return fitFunc.asString(); + return boost::shared_ptr<IFitFunction>(fitFunc); }