Commit 0d061e5f authored by Russell Taylor's avatar Russell Taylor
Browse files

First batch of algorithms with Workspace2D workspace properties changed to...

First batch of algorithms with Workspace2D workspace properties changed to MatrixWorkspace. Re #1368.
parent 07a96268
......@@ -63,6 +63,9 @@ public:
MatrixWorkspace_sptr create(const std::string& className, const int& NVectors,
const int& XLength, const int& YLength) const;
void initializeFromParent(const MatrixWorkspace_const_sptr parent,
const MatrixWorkspace_sptr child, const bool differentSize) const;
/// Create a ITableWorkspace
ITableWorkspace_sptr createTable(const std::string& className = "TableWorkspace") const;
......
......@@ -125,7 +125,6 @@ bool Algorithm::execute()
std::vector<Property*> Prop=getProperties();
std::vector<Property*>::const_iterator itr;
bool bStatus=false;
for (itr=Prop.begin();itr!=Prop.end();itr++)
{
const IWorkspaceProperty *wsProp = dynamic_cast<IWorkspaceProperty*>(*itr);
......
......@@ -65,46 +65,55 @@ MatrixWorkspace_sptr WorkspaceFactoryImpl::create(const MatrixWorkspace_const_sp
std::string id (parent->id());
if ( id == "EventWorkspace" ) id = "Workspace2D";
// Create an 'empty' workspace of the appropriate type and size
MatrixWorkspace_sptr ws = create(id,NVectors,XLength,YLength);
// Copy over certain parent data members
ws->setTitle(parent->getTitle());
ws->setComment(parent->getComment());
ws->setInstrument(parent->getInstrument()); // This call also copies the parameter map
ws->m_spectramap = parent->m_spectramap;
ws->m_sample = parent->m_sample;
ws->setYUnit(parent->m_YUnit);
ws->setYUnitLabel(parent->m_YUnitLabel);
ws->isDistribution(parent->isDistribution());
initializeFromParent(parent,ws,differentSize);
return ws;
}
void WorkspaceFactoryImpl::initializeFromParent(const MatrixWorkspace_const_sptr parent,
const MatrixWorkspace_sptr child, const bool differentSize) const
{
child->setTitle(parent->getTitle());
child->setComment(parent->getComment());
child->setInstrument(parent->getInstrument()); // This call also copies the parameter map
child->m_spectramap = parent->m_spectramap;
child->m_sample = parent->m_sample;
child->setYUnit(parent->m_YUnit);
child->setYUnitLabel(parent->m_YUnitLabel);
child->isDistribution(parent->isDistribution());
// Only copy the axes over if new sizes are not given
if ( !differentSize )
{
// Only copy mask map if same size for now. Later will need to check continued validity.
ws->m_masks = parent->m_masks;
child->m_masks = parent->m_masks;
for (unsigned int i = 0; i < parent->m_axes.size(); ++i)
{
// Need to delete the existing axis created in init above
delete ws->m_axes[i];
delete child->m_axes[i];
// Now set to a copy of the parent workspace's axis
ws->m_axes[i] = parent->m_axes[i]->clone(ws.get());
child->m_axes[i] = parent->m_axes[i]->clone(child.get());
}
}
else
{
// Just copy the unit and title
for (unsigned int i = 0; i < ws->m_axes.size(); ++i)
for (unsigned int i = 0; i < parent->m_axes.size(); ++i)
{
if (parent->getAxis(i)->isNumeric())
{
ws->getAxis(i)->unit() = parent->getAxis(i)->unit();
child->getAxis(i)->unit() = parent->getAxis(i)->unit();
}
ws->getAxis(i)->title() = parent->getAxis(i)->title();
child->getAxis(i)->title() = parent->getAxis(i)->title();
}
}
return ws;
return;
}
/** Creates a new instance of the class with the given name, and allocates memory for the arrays
......
......@@ -5,7 +5,6 @@
// Includes
//----------------------------------------------------------------------
#include "MantidAPI/Algorithm.h"
#include "MantidDataObjects/Workspace2D.h"
namespace Mantid
{
......@@ -37,7 +36,7 @@ namespace Algorithms
@author Russell Taylor, Tessella Support Services plc
@date 22/01/2009
Copyright &copy; 2009 STFC Rutherford Appleton Laboratory
Copyright &copy; 2009-2010 STFC Rutherford Appleton Laboratory
This file is part of Mantid.
......@@ -78,7 +77,7 @@ private:
void exec();
/// Pull out a single spectrum from a 2D workspace
API::MatrixWorkspace_sptr extractSpectrum(DataObjects::Workspace2D_sptr WS, const int index);
API::MatrixWorkspace_sptr extractSpectrum(API::MatrixWorkspace_sptr WS, const int index);
/// Call the Linear fitting algorithm as a child algorithm
API::MatrixWorkspace_sptr fitToData(API::MatrixWorkspace_sptr WS);
......
......@@ -5,7 +5,6 @@
// Includes
//----------------------------------------------------------------------
#include "MantidAPI/Algorithm.h"
#include "MantidDataObjects/Workspace2D.h"
#include <climits>
namespace Mantid
......@@ -85,7 +84,7 @@ private:
void cropRagged(API::MatrixWorkspace_sptr outputWorkspace, int inIndex, int outIndex);
/// The input workspace
DataObjects::Workspace2D_const_sptr m_inputWorkspace;
API::MatrixWorkspace_const_sptr m_inputWorkspace;
/// The bin index to start the cropped workspace from
int m_minX;
/// The bin index to end the cropped workspace at
......
......@@ -5,11 +5,6 @@
// Includes
//----------------------------------------------------------------------
#include "MantidAPI/Algorithm.h"
#include "MantidDataObjects/Workspace2D.h"
#include "MantidGeometry/Instrument/ParametrizedComponent.h"
#include "MantidGeometry/Instrument/Component.h"
#include <vector>
#include <string>
namespace Mantid
{
......@@ -30,7 +25,7 @@ namespace Algorithms
@author Steve Williams STFC Rutherford Appleton Laboratory
@date 27/07/2009
Copyright &copy; 2008-9 STFC Rutherford Appleton Laboratory
Copyright &copy; 2008-2010 STFC Rutherford Appleton Laboratory
This file is part of Mantid.
......@@ -77,10 +72,10 @@ private:
void init();
void exec();
void getGeometry(DataObjects::Workspace2D_const_sptr WS, int mon0Spec, int mon1Spec, double &monitor0Dist, double &monitor1Dist) const;
std::vector<int> getMonitorSpecIndexs(DataObjects::Workspace2D_const_sptr WS, int specNum1, int specNum2) const;
void getGeometry(API::MatrixWorkspace_const_sptr WS, int mon0Spec, int mon1Spec, double &monitor0Dist, double &monitor1Dist) const;
std::vector<int> getMonitorSpecIndexs(API::MatrixWorkspace_const_sptr WS, int specNum1, int specNum2) const;
double timeToFly(double s, double E_KE) const;
double getPeakCentre(DataObjects::Workspace2D_const_sptr WS, const int monitIn, const double peakTime);
double getPeakCentre(API::MatrixWorkspace_const_sptr WS, const int monitIn, const double peakTime);
void extractSpec(int specInd, double start, double end);
void getPeakEstimates(double &height, int &centreInd, double &background) const;
double findHalfLoc(MantidVec::size_type startInd, const double height, const double noise, const direction go) const;
......
......@@ -15,10 +15,6 @@ namespace Mantid
{
class MatrixWorkspace;
}
namespace DataObjects
{
class Workspace2D;
}
namespace Algorithms
{
......@@ -79,13 +75,13 @@ namespace Mantid
void exec();
/// Calculate the integral asymmetry for a workspace (single period)
void calcIntAsymmetry(boost::shared_ptr<DataObjects::Workspace2D> ws, double& Y, double& E);
void calcIntAsymmetry(API::MatrixWorkspace_sptr ws, double& Y, double& E);
/// Calculate the integral asymmetry for a workspace (red & green)
void calcIntAsymmetry(boost::shared_ptr<DataObjects::Workspace2D> ws_red,
boost::shared_ptr<DataObjects::Workspace2D> ws_geen,double& Y, double& E);
void calcIntAsymmetry(API::MatrixWorkspace_sptr ws_red,
API::MatrixWorkspace_sptr ws_geen,double& Y, double& E);
/// Group detectors
void groupDetectors(boost::shared_ptr<DataObjects::Workspace2D>& ws,const std::vector<int>& spectraList);
void groupDetectors(API::MatrixWorkspace_sptr ws,const std::vector<int>& spectraList);
/// Stores property "Int"
bool m_int;
......
......@@ -16,7 +16,6 @@ DECLARE_ALGORITHM(CalculateTransmission)
using namespace Kernel;
using namespace API;
using namespace DataObjects;
CalculateTransmission::CalculateTransmission() : API::Algorithm(), logFit(false)
{}
......@@ -26,13 +25,13 @@ CalculateTransmission::~CalculateTransmission()
void CalculateTransmission::init()
{
CompositeValidator<Workspace2D> *wsValidator = new CompositeValidator<Workspace2D>;
wsValidator->add(new WorkspaceUnitValidator<Workspace2D>("Wavelength"));
wsValidator->add(new CommonBinsValidator<Workspace2D>);
wsValidator->add(new HistogramValidator<Workspace2D>);
CompositeValidator<> *wsValidator = new CompositeValidator<>;
wsValidator->add(new WorkspaceUnitValidator<>("Wavelength"));
wsValidator->add(new CommonBinsValidator<>);
wsValidator->add(new HistogramValidator<>);
declareProperty(new WorkspaceProperty<Workspace2D>("SampleRunWorkspace","",Direction::Input,wsValidator));
declareProperty(new WorkspaceProperty<Workspace2D>("DirectRunWorkspace","",Direction::Input,wsValidator->clone()));
declareProperty(new WorkspaceProperty<>("SampleRunWorkspace","",Direction::Input,wsValidator));
declareProperty(new WorkspaceProperty<>("DirectRunWorkspace","",Direction::Input,wsValidator->clone()));
declareProperty(new WorkspaceProperty<>("OutputWorkspace","",Direction::Output));
BoundedValidator<int> *oneOrMore = new BoundedValidator<int>();
......@@ -57,8 +56,8 @@ void CalculateTransmission::init()
void CalculateTransmission::exec()
{
Workspace2D_sptr sampleWS = getProperty("SampleRunWorkspace");
Workspace2D_sptr directWS = getProperty("DirectRunWorkspace");
MatrixWorkspace_sptr sampleWS = getProperty("SampleRunWorkspace");
MatrixWorkspace_sptr directWS = getProperty("DirectRunWorkspace");
// Check that the two input workspaces are from the same instrument
if ( sampleWS->getBaseInstrument() != directWS->getBaseInstrument() )
......@@ -136,7 +135,7 @@ void CalculateTransmission::exec()
{
g_log.debug("Fitting to the logarithm of the transmission");
// Take a copy of this workspace for the fitting
MatrixWorkspace_sptr logTransmission = this->extractSpectrum(boost::dynamic_pointer_cast<DataObjects::Workspace2D>(transmission),0);
MatrixWorkspace_sptr logTransmission = this->extractSpectrum(transmission,0);
// Take the log of each datapoint for fitting. Preserve errors percentage-wise.
MantidVec & Y = logTransmission->dataY(0);
......@@ -166,10 +165,10 @@ void CalculateTransmission::exec()
* @param index The workspace index of the spectrum to extract
* @return A Workspace2D containing the extracted spectrum
*/
API::MatrixWorkspace_sptr CalculateTransmission::extractSpectrum(DataObjects::Workspace2D_sptr WS, const int index)
API::MatrixWorkspace_sptr CalculateTransmission::extractSpectrum(API::MatrixWorkspace_sptr WS, const int index)
{
IAlgorithm_sptr childAlg = createSubAlgorithm("ExtractSingleSpectrum",0.0,0.4);
childAlg->setProperty<Workspace2D_sptr>("InputWorkspace", WS);
childAlg->setProperty<MatrixWorkspace_sptr>("InputWorkspace", WS);
childAlg->setProperty<int>("WorkspaceIndex", index);
// Now execute the sub-algorithm. Catch and log any error
try
......
......@@ -4,7 +4,6 @@
#include "MantidAlgorithms/ConjoinWorkspaces.h"
#include "MantidAPI/WorkspaceValidators.h"
#include "MantidAPI/SpectraDetectorMap.h"
#include "MantidDataObjects/Workspace2D.h"
namespace Mantid
{
......@@ -12,9 +11,6 @@ namespace Algorithms
{
using namespace Kernel;
using namespace API;
using DataObjects::Workspace2D;
using DataObjects::Workspace2D_sptr;
using DataObjects::Workspace2D_const_sptr;
// Register the algorithm into the AlgorithmFactory
DECLARE_ALGORITHM(ConjoinWorkspaces)
......@@ -33,11 +29,11 @@ ConjoinWorkspaces::~ConjoinWorkspaces()
void ConjoinWorkspaces::init()
{
declareProperty(new WorkspaceProperty<Workspace2D>("InputWorkspace1",
"", Direction::Input, new CommonBinsValidator<Workspace2D>),
declareProperty(new WorkspaceProperty<>("InputWorkspace1",
"", Direction::Input, new CommonBinsValidator<>),
"The name of the first input workspace");
declareProperty(new WorkspaceProperty<Workspace2D>("InputWorkspace2",
"", Direction::Input, new CommonBinsValidator<Workspace2D>),
declareProperty(new WorkspaceProperty<>("InputWorkspace2",
"", Direction::Input, new CommonBinsValidator<>),
"The name of the second input workspace");
}
......@@ -47,36 +43,37 @@ void ConjoinWorkspaces::init()
void ConjoinWorkspaces::exec()
{
// Retrieve the input workspaces
Workspace2D_const_sptr ws1 = getProperty("InputWorkspace1");
Workspace2D_const_sptr ws2 = getProperty("InputWorkspace2");
MatrixWorkspace_const_sptr ws1 = getProperty("InputWorkspace1");
MatrixWorkspace_const_sptr ws2 = getProperty("InputWorkspace2");
// Check that the input workspaces meet the requirements for this algorithm
this->validateInputs(ws1,ws2);
// Create the output workspace
const int totalHists = ws1->getNumberHistograms() + ws2->getNumberHistograms();
MatrixWorkspace_sptr output = WorkspaceFactory::Instance().create(ws1,totalHists,ws1->readX(0).size(),
MatrixWorkspace_sptr output = WorkspaceFactory::Instance().create("Workspace2D",totalHists,ws1->readX(0).size(),
ws1->readY(0).size());
Workspace2D_sptr output2D = boost::dynamic_pointer_cast<Workspace2D>(output);
// Copy over stuff from first input workspace
WorkspaceFactory::Instance().initializeFromParent(ws1,output,true);
// Create the X values inside a cow pointer - they will be shared in the output workspace
DataObjects::Histogram1D::RCtype XValues;
cow_ptr<MantidVec> XValues;
XValues.access() = ws1->readX(0);
// Initialize the progress reporting object
m_progress = new API::Progress(this, 0.0, 1.0, totalHists);
// Loop over the input workspaces in turn copying the data into the output one
Axis* outAxis = output2D->getAxis(1);
Axis* outAxis = output->getAxis(1);
const int& nhist1 = ws1->getNumberHistograms();
const Axis* axis1 = ws1->getAxis(1);
PARALLEL_FOR2(ws1, output2D)
PARALLEL_FOR2(ws1, output)
for (int i = 0; i < nhist1; ++i)
{
PARALLEL_START_INTERUPT_REGION
output2D->setX(i,XValues);
output2D->dataY(i) = ws1->readY(i);
output2D->dataE(i) = ws1->readE(i);
PARALLEL_START_INTERUPT_REGION
output->setX(i,XValues);
output->dataY(i) = ws1->readY(i);
output->dataE(i) = ws1->readE(i);
// Copy the spectrum number
outAxis->spectraNo(i) = axis1->spectraNo(i);
// Propagate masking, if needed
......@@ -90,20 +87,20 @@ void ConjoinWorkspaces::exec()
}
}
m_progress->report();
PARALLEL_END_INTERUPT_REGION
PARALLEL_END_INTERUPT_REGION
}
PARALLEL_CHECK_INTERUPT_REGION
PARALLEL_CHECK_INTERUPT_REGION
//For second loop we use the offset from the first
const int& nhist2 = ws2->getNumberHistograms();
const Axis* axis2 = ws2->getAxis(1);
PARALLEL_FOR2(ws2, output2D)
PARALLEL_FOR2(ws2, output)
for (int j = 0; j < nhist2; ++j)
{
PARALLEL_START_INTERUPT_REGION
output2D->setX(nhist1 + j,XValues);
output2D->dataY(nhist1 + j) = ws2->readY(j);
output2D->dataE(nhist1 + j) = ws2->readE(j);
PARALLEL_START_INTERUPT_REGION
output->setX(nhist1 + j,XValues);
output->dataY(nhist1 + j) = ws2->readY(j);
output->dataE(nhist1 + j) = ws2->readE(j);
// Copy the spectrum number
outAxis->spectraNo(nhist1 + j) = axis2->spectraNo(j);
// Propagate masking, if needed
......@@ -117,16 +114,16 @@ void ConjoinWorkspaces::exec()
}
}
m_progress->report();
PARALLEL_END_INTERUPT_REGION
PARALLEL_END_INTERUPT_REGION
}
PARALLEL_CHECK_INTERUPT_REGION
PARALLEL_CHECK_INTERUPT_REGION
// Delete the input workspaces from the ADS
AnalysisDataService::Instance().remove(getPropertyValue("InputWorkspace1"));
AnalysisDataService::Instance().remove(getPropertyValue("InputWorkspace2"));
// Create & assign an output workspace property with the workspace name the same as the first input
declareProperty(new WorkspaceProperty<Workspace2D>("Output",getPropertyValue("InputWorkspace1"),Direction::Output));
setProperty("Output",output2D);
declareProperty(new WorkspaceProperty<>("Output",getPropertyValue("InputWorkspace1"),Direction::Output));
setProperty("Output",output);
}
/** Checks that the two input workspace have common binning & size, the same instrument & unit.
......
......@@ -2,7 +2,6 @@
// Includes
//----------------------------------------------------------------------
#include "MantidAlgorithms/ConvertSpectrumAxis.h"
#include "MantidDataObjects/Workspace2D.h"
#include "MantidAPI/NumericAxis.h"
/// @cond
......@@ -33,12 +32,10 @@ DECLARE_ALGORITHM(ConvertSpectrumAxis)
using namespace Kernel;
using namespace API;
using namespace Geometry;
using DataObjects::Workspace2D;
using DataObjects::Workspace2D_const_sptr;
void ConvertSpectrumAxis::init()
{
declareProperty(new WorkspaceProperty<Workspace2D>("InputWorkspace","",Direction::Input));
declareProperty(new WorkspaceProperty<>("InputWorkspace","",Direction::Input));
declareProperty(new WorkspaceProperty<>("OutputWorkspace","",Direction::Output));
declareProperty("Target","",new ListValidator(std::vector<std::string>(1,"theta")),
......@@ -48,7 +45,7 @@ void ConvertSpectrumAxis::init()
void ConvertSpectrumAxis::exec()
{
// Get the input workspace
Workspace2D_const_sptr inputWS = getProperty("InputWorkspace");
MatrixWorkspace_const_sptr inputWS = getProperty("InputWorkspace");
// Check that the input workspace has a spectrum axis for axis 1
// Could put this in a validator later
......
......@@ -20,7 +20,6 @@ DECLARE_ALGORITHM(CropWorkspace)
using namespace Kernel;
using namespace API;
using DataObjects::Workspace2D;
/// Default constructor
CropWorkspace::CropWorkspace() :
......@@ -33,7 +32,7 @@ CropWorkspace::~CropWorkspace() {}
void CropWorkspace::init()
{
declareProperty(new WorkspaceProperty<Workspace2D>("InputWorkspace","",Direction::Input),
declareProperty(new WorkspaceProperty<>("InputWorkspace","",Direction::Input),
"The input Workspace2D" );
declareProperty(new WorkspaceProperty<>("OutputWorkspace","",Direction::Output),
"Name of the output workspace2D" );
......@@ -81,7 +80,7 @@ void CropWorkspace::exec()
outAxis = outputWorkspace->getAxis(1);
}
DataObjects::Histogram1D::RCtype newX;
cow_ptr<MantidVec> newX;
if ( m_commonBoundaries )
{
const MantidVec& oldX = m_inputWorkspace->readX(m_minSpec);
......
......@@ -2,7 +2,6 @@
// Includes
//----------------------------------------------------------------------
#include "MantidAlgorithms/DiffractionFocussing.h"
#include "MantidDataObjects/Workspace2D.h"
#include "MantidKernel/FileProperty.h"
#include <map>
......@@ -91,8 +90,7 @@ void DiffractionFocussing::exec()
detectorList.push_back(d->second);
// Want version 1 of GroupDetectors here
API::IAlgorithm_sptr childAlg = createSubAlgorithm("GroupDetectors",-1.0,-1.0,true,1);
DataObjects::Workspace2D_sptr tmpW2D = boost::dynamic_pointer_cast<DataObjects::Workspace2D>(tmpW);
childAlg->setProperty<DataObjects::Workspace2D_sptr>("Workspace", tmpW2D);
childAlg->setProperty("Workspace", tmpW);
childAlg->setProperty< std::vector<int> >("DetectorList",detectorList);
try
{
......
......@@ -2,7 +2,6 @@
// Includes
//----------------------------------------------------------------------
#include "MantidAlgorithms/ExtractSingleSpectrum.h"
#include "MantidDataObjects/Workspace2D.h"
namespace Mantid
{
......@@ -14,12 +13,10 @@ DECLARE_ALGORITHM(ExtractSingleSpectrum)
using namespace Kernel;
using namespace API;
using DataObjects::Workspace2D;
using DataObjects::Workspace2D_const_sptr;
void ExtractSingleSpectrum::init()
{
declareProperty(new WorkspaceProperty<Workspace2D>("InputWorkspace","",Direction::Input));
declareProperty(new WorkspaceProperty<>("InputWorkspace","",Direction::Input));
declareProperty(new WorkspaceProperty<>("OutputWorkspace","",Direction::Output));
BoundedValidator<int> *mustBePositive = new BoundedValidator<int>();
......@@ -30,7 +27,7 @@ void ExtractSingleSpectrum::init()
void ExtractSingleSpectrum::exec()
{
// Get hold of the input workspace
Workspace2D_const_sptr inputWorkspace = getProperty("InputWorkspace");
MatrixWorkspace_const_sptr inputWorkspace = getProperty("InputWorkspace");
// Get the desired spectrum number and check it's in range
const int desiredSpectrum = getProperty("WorkspaceIndex");
if ( desiredSpectrum >= inputWorkspace->getNumberHistograms() )
......
......@@ -2,7 +2,6 @@
// Includes
//----------------------------------------------------------------------
#include "MantidAlgorithms/FFT.h"
#include "MantidDataObjects/Workspace2D.h"
#include "MantidKernel/UnitFactory.h"
#include <boost/shared_array.hpp>
......@@ -32,7 +31,7 @@ using namespace API;
/// Initialisation method. Declares properties to be used in algorithm.
void FFT::init()
{
declareProperty(new WorkspaceProperty<DataObjects::Workspace2D>("InputWorkspace",
declareProperty(new WorkspaceProperty<>("InputWorkspace",
"",Direction::Input), "The name of the input workspace.");
declareProperty(new WorkspaceProperty<>("OutputWorkspace",
"",Direction::Output), "The name of the output workspace.");
......@@ -55,7 +54,7 @@ void FFT::init()
*/
void FFT::exec()
{
DataObjects::Workspace2D_const_sptr inWS = getProperty("InputWorkspace");
MatrixWorkspace_const_sptr inWS = getProperty("InputWorkspace");
const int iReal = getProperty("Real");
const int iImag = getProperty("Imaginary");
......
......@@ -2,7 +2,6 @@
// Includes
//----------------------------------------------------------------------
#include "MantidAlgorithms/FindDeadDetectors.h"
#include "MantidDataObjects/Workspace2D.h"
#include "MantidAPI/SpectraDetectorMap.h"
#include <fstream>
......@@ -16,14 +15,13 @@ namespace Mantid
using namespace Kernel;
using namespace API;
using DataObjects::Workspace2D;
/// Initialisation method.
void FindDeadDetectors::init()
{
declareProperty(
new WorkspaceProperty<Workspace2D>("InputWorkspace","",Direction::Input),
"Name of the input workspace2D" );
new WorkspaceProperty<>("InputWorkspace","",Direction::Input),
"Name of the input workspace" );
declareProperty(
new WorkspaceProperty<MatrixWorkspace>("OutputWorkspace","",Direction::Output),
"Each histogram from the input workspace maps to a histogram in this\n"
......
......@@ -19,7 +19,6 @@ DECLARE_ALGORITHM(GetEi)
using namespace Kernel;
using namespace API;
using namespace Geometry;
using namespace DataObjects;
// adjustable fit criteria, increase the first number or reduce any of the last three for more promiscuous peak fitting
// from the estimated location of the peak search forward by the following fraction and backward by the same fraction
......@@ -41,10 +40,10 @@ GetEi::GetEi() : Algorithm(),
void GetEi::init()
{// Declare required input parameters for algorithm and do some validation here
CompositeValidator<Workspace2D> *val = new CompositeValidator<Workspace2D>;
val->add(new WorkspaceUnitValidator<Workspace2D>("TOF"));
val->add(new HistogramValidator<Workspace2D>);
declareProperty(new WorkspaceProperty<Workspace2D>(
CompositeValidator<> *val = new CompositeValidator<>;
val->add(new WorkspaceUnitValidator<>("TOF"));
val->add(new HistogramValidator<>);
declareProperty(new WorkspaceProperty<>(
"InputWorkspace","",Direction::Input,val),
"The X units of this workspace must be time of flight with times in\n"
"micro-seconds");
......@@ -76,7 +75,7 @@ void GetEi::init()
*/
void GetEi::exec()
{
Workspace2D_const_sptr inWS = getProperty("InputWorkspace");
MatrixWorkspace_const_sptr inWS = getProperty("InputWorkspace");
const int mon1Spec = getProperty("Monitor1Spec");
const int mon2Spec = getProperty("Monitor2Spec");
double dist2moni0 = -1, dist2moni1 = -1;
......@@ -121,7 +120,7 @@ void GetEi::exec()
* @throw NotFoundError if no detector is found for the detector ID given
* @throw runtime_error if there is a problem with the SpectraDetectorMap
*/
void GetEi::getGeometry(DataObjects::Workspace2D_const_sptr WS, int mon0Spec, int mon1Spec, double &monitor0Dist, double &monitor1Dist) const
void GetEi::getGeometry(API::MatrixWorkspace_const_sptr WS, int mon0Spec, int mon1Spec, double &monitor0Dist, double &monitor1Dist) const
{
const IObjComponent_sptr source = WS->getInstrument()->getSource();
......@@ -154,7 +153,7 @@ void GetEi::getGeometry(DataObjects::Workspace2D_const_sptr WS, int mon0Spec, in
* @return the indexes of the histograms created by the detector whose ID were passed
* @throw NotFoundError if one of the requested spectrum numbers was not found in the workspace
*/
std::vector<int> GetEi::getMonitorSpecIndexs(DataObjects::Workspace2D_const_sptr WS, int specNum1, int specNum2) const
std::vector<int> GetEi::getMonitorSpecIndexs(API::MatrixWorkspace_const_sptr WS, int specNum1, int specNum2) const