Commit 909cc84f authored by Anders Markvardsen's avatar Anders Markvardsen
Browse files

Store sample component not as IObjComponent but IComponent. re #9133

parent 2fdde41d
...@@ -1020,7 +1020,7 @@ void IFunction::convertValue(std::vector<double>& values, Kernel::Unit_sptr& out ...@@ -1020,7 +1020,7 @@ void IFunction::convertValue(std::vector<double>& values, Kernel::Unit_sptr& out
{ {
// Get l1, l2 and theta (see also RemoveBins.calculateDetectorPosition()) // Get l1, l2 and theta (see also RemoveBins.calculateDetectorPosition())
Instrument_const_sptr instrument = ws->getInstrument(); Instrument_const_sptr instrument = ws->getInstrument();
Geometry::IObjComponent_const_sptr sample = instrument->getSample(); Geometry::IComponent_const_sptr sample = instrument->getSample();
if (sample == NULL) if (sample == NULL)
{ {
g_log.error() << "No sample defined instrument. Cannot convert units for function\n" g_log.error() << "No sample defined instrument. Cannot convert units for function\n"
......
...@@ -751,7 +751,7 @@ namespace Mantid ...@@ -751,7 +751,7 @@ namespace Mantid
Instrument_const_sptr instrument = getInstrument(); Instrument_const_sptr instrument = getInstrument();
Geometry::IObjComponent_const_sptr source = instrument->getSource(); Geometry::IObjComponent_const_sptr source = instrument->getSource();
Geometry::IObjComponent_const_sptr sample = instrument->getSample(); Geometry::IComponent_const_sptr sample = instrument->getSample();
if ( source == NULL || sample == NULL ) if ( source == NULL || sample == NULL )
{ {
throw Kernel::Exception::InstrumentDefinitionError("Instrument not sufficiently defined: failed to get source and/or sample"); throw Kernel::Exception::InstrumentDefinitionError("Instrument not sufficiently defined: failed to get source and/or sample");
...@@ -777,7 +777,7 @@ namespace Mantid ...@@ -777,7 +777,7 @@ namespace Mantid
double MatrixWorkspace::detectorTwoTheta(Geometry::IDetector_const_sptr det) const double MatrixWorkspace::detectorTwoTheta(Geometry::IDetector_const_sptr det) const
{ {
Geometry::IObjComponent_const_sptr source = getInstrument()->getSource(); Geometry::IObjComponent_const_sptr source = getInstrument()->getSource();
Geometry::IObjComponent_const_sptr sample = getInstrument()->getSample(); Geometry::IComponent_const_sptr sample = getInstrument()->getSample();
if ( source == NULL || sample == NULL ) if ( source == NULL || sample == NULL )
{ {
throw Kernel::Exception::InstrumentDefinitionError("Instrument not sufficiently defined: failed to get source and/or sample"); throw Kernel::Exception::InstrumentDefinitionError("Instrument not sufficiently defined: failed to get source and/or sample");
...@@ -1557,7 +1557,7 @@ namespace Mantid ...@@ -1557,7 +1557,7 @@ namespace Mantid
try try
{ {
Geometry::Instrument_const_sptr inst = this->getInstrument(); Geometry::Instrument_const_sptr inst = this->getInstrument();
Geometry::IObjComponent_const_sptr sample = inst->getSample(); Geometry::IComponent_const_sptr sample = inst->getSample();
if (sample) if (sample)
{ {
Kernel::V3D sample_pos = sample->getPos(); Kernel::V3D sample_pos = sample->getPos();
......
...@@ -80,7 +80,7 @@ private: ...@@ -80,7 +80,7 @@ private:
Geometry::Instrument_const_sptr m_instrument; Geometry::Instrument_const_sptr m_instrument;
Geometry::IObjComponent_const_sptr m_sample; Geometry::IComponent_const_sptr m_sample;
double m_l2; double m_l2;
double m_wavelength; double m_wavelength;
......
...@@ -31,7 +31,7 @@ private: ...@@ -31,7 +31,7 @@ private:
double m_DIFCref; ///< The reference value for DIFC to filter with double m_DIFCref; ///< The reference value for DIFC to filter with
double m_K; ///< Mystery variable that I'm not sure what it is for double m_K; ///< Mystery variable that I'm not sure what it is for
Geometry::Instrument_const_sptr m_instrument; ///< The instrument Geometry::Instrument_const_sptr m_instrument; ///< The instrument
Geometry::IObjComponent_const_sptr m_sample; ///< The sample Geometry::IComponent_const_sptr m_sample; ///< The sample
double m_L1; ///< The instrument initial flightpath double m_L1; ///< The instrument initial flightpath
double m_Tmin; ///< The start of the time-of-flight frame double m_Tmin; ///< The start of the time-of-flight frame
double m_wavelengthMin; ///< The minimum wavelength accessible in the frame double m_wavelengthMin; ///< The minimum wavelength accessible in the frame
......
...@@ -76,7 +76,7 @@ namespace Algorithms ...@@ -76,7 +76,7 @@ namespace Algorithms
Mantid::Geometry::Instrument_const_sptr instr = runWS->getInstrument(); Mantid::Geometry::Instrument_const_sptr instr = runWS->getInstrument();
Mantid::Geometry::IObjComponent_const_sptr source = instr->getSource(); Mantid::Geometry::IObjComponent_const_sptr source = instr->getSource();
Mantid::Geometry::IObjComponent_const_sptr sample = instr->getSample(); Mantid::Geometry::IComponent_const_sptr sample = instr->getSample();
Mantid::Geometry::IDetector_const_sptr det = instr->getDetector(detID); Mantid::Geometry::IDetector_const_sptr det = instr->getDetector(detID);
const Mantid::Kernel::V3D samplePos = sample->getPos(); const Mantid::Kernel::V3D samplePos = sample->getPos();
......
...@@ -87,7 +87,7 @@ namespace Algorithms ...@@ -87,7 +87,7 @@ namespace Algorithms
Kernel::Unit_sptr fromUnit = inputWS->getAxis(0)->unit(); Kernel::Unit_sptr fromUnit = inputWS->getAxis(0)->unit();
Kernel::Unit_sptr toUnit = UnitFactory::Instance().create(unitTarget); Kernel::Unit_sptr toUnit = UnitFactory::Instance().create(unitTarget);
IObjComponent_const_sptr source = inputWS->getInstrument()->getSource(); IObjComponent_const_sptr source = inputWS->getInstrument()->getSource();
IObjComponent_const_sptr sample = inputWS->getInstrument()->getSample(); IComponent_const_sptr sample = inputWS->getInstrument()->getSample();
std::vector<double> emptyVector; std::vector<double> emptyVector;
const double l1 = source->getDistance(*sample); const double l1 = source->getDistance(*sample);
const std::string emodeStr = getProperty("EMode"); const std::string emodeStr = getProperty("EMode");
......
...@@ -135,7 +135,7 @@ namespace Algorithms ...@@ -135,7 +135,7 @@ namespace Algorithms
void ConvertSpectrumAxis2::createElasticQMap(const std::string & targetUnit) void ConvertSpectrumAxis2::createElasticQMap(const std::string & targetUnit)
{ {
IObjComponent_const_sptr source = m_inputWS->getInstrument()->getSource(); IObjComponent_const_sptr source = m_inputWS->getInstrument()->getSource();
IObjComponent_const_sptr sample = m_inputWS->getInstrument()->getSample(); IComponent_const_sptr sample = m_inputWS->getInstrument()->getSample();
const std::string emodeStr = getProperty("EMode"); const std::string emodeStr = getProperty("EMode");
int emode = 0; int emode = 0;
......
...@@ -395,7 +395,7 @@ void ConvertUnits::convertViaTOF(Kernel::Unit_const_sptr fromUnit, API::MatrixWo ...@@ -395,7 +395,7 @@ void ConvertUnits::convertViaTOF(Kernel::Unit_const_sptr fromUnit, API::MatrixWo
// Get the distance between the source and the sample (assume in metres) // Get the distance between the source and the sample (assume in metres)
IObjComponent_const_sptr source = instrument->getSource(); IObjComponent_const_sptr source = instrument->getSource();
IObjComponent_const_sptr sample = instrument->getSample(); IComponent_const_sptr sample = instrument->getSample();
if ( source == NULL || sample == NULL ) if ( source == NULL || sample == NULL )
{ {
throw Exception::InstrumentDefinitionError("Instrubment not sufficiently defined: failed to get source and/or sample"); throw Exception::InstrumentDefinitionError("Instrubment not sufficiently defined: failed to get source and/or sample");
......
...@@ -117,7 +117,7 @@ namespace Algorithms ...@@ -117,7 +117,7 @@ namespace Algorithms
void CreateLogTimeCorrection::getInstrumentSetup() void CreateLogTimeCorrection::getInstrumentSetup()
{ {
// 1. Get sample position and source position // 1. Get sample position and source position
IObjComponent_const_sptr sample = m_instrument->getSample(); IComponent_const_sptr sample = m_instrument->getSample();
if (!sample) if (!sample)
{ {
throw runtime_error("No sample has been set."); throw runtime_error("No sample has been set.");
......
...@@ -410,7 +410,7 @@ namespace Algorithms ...@@ -410,7 +410,7 @@ namespace Algorithms
outfile << "#\n"; outfile << "#\n";
outfile << "6 L1 T0_SHIFT\n"; outfile << "6 L1 T0_SHIFT\n";
IObjComponent_const_sptr source = inst->getSource(); IObjComponent_const_sptr source = inst->getSource();
IObjComponent_const_sptr sample = inst->getSample(); IComponent_const_sptr sample = inst->getSample();
outfile << "7 "<<source->getDistance(*sample)*100<<" 0\n"; outfile << "7 "<<source->getDistance(*sample)*100<<" 0\n";
outfile << "4 DETNUM NROWS NCOLS WIDTH HEIGHT DEPTH DETD CenterX CenterY CenterZ BaseX BaseY BaseZ UpX UpY UpZ\n"; outfile << "4 DETNUM NROWS NCOLS WIDTH HEIGHT DEPTH DETD CenterX CenterY CenterZ BaseX BaseY BaseZ UpX UpY UpZ\n";
} }
......
...@@ -208,7 +208,7 @@ namespace Algorithms ...@@ -208,7 +208,7 @@ namespace Algorithms
throw std::runtime_error(errmsg); throw std::runtime_error(errmsg);
} }
Geometry::IObjComponent_const_sptr source = originstrument->getSource(); Geometry::IObjComponent_const_sptr source = originstrument->getSource();
Geometry::IObjComponent_const_sptr sample = originstrument->getSample(); Geometry::IComponent_const_sptr sample = originstrument->getSample();
l1 = source->getDistance(*sample); l1 = source->getDistance(*sample);
g_log.information() << "Retrieve L1 from input data workspace. \n"; g_log.information() << "Retrieve L1 from input data workspace. \n";
} }
......
...@@ -223,7 +223,7 @@ void ModeratorTzero::execEvent() ...@@ -223,7 +223,7 @@ void ModeratorTzero::execEvent()
} }
//Get a pointer to the sample //Get a pointer to the sample
IObjComponent_const_sptr sample = outputWS->getInstrument()->getSample(); IComponent_const_sptr sample = outputWS->getInstrument()->getSample();
// Loop over the spectra // Loop over the spectra
Progress prog(this,0.0,1.0,numHists); //report progress of algorithm Progress prog(this,0.0,1.0,numHists); //report progress of algorithm
...@@ -299,7 +299,7 @@ double ModeratorTzero::CalculateL1(Mantid::API::MatrixWorkspace_sptr inputWS, si ...@@ -299,7 +299,7 @@ double ModeratorTzero::CalculateL1(Mantid::API::MatrixWorkspace_sptr inputWS, si
} }
else else
{ {
IObjComponent_const_sptr sample = m_instrument->getSample(); IComponent_const_sptr sample = m_instrument->getSample();
try try
{ {
L1 = m_instrument->getSource()->getDistance(*sample); L1 = m_instrument->getSource()->getDistance(*sample);
...@@ -335,7 +335,7 @@ double ModeratorTzero::CalculateT2(MatrixWorkspace_sptr inputWS, size_t i) ...@@ -335,7 +335,7 @@ double ModeratorTzero::CalculateT2(MatrixWorkspace_sptr inputWS, size_t i)
} }
else else
{ {
IObjComponent_const_sptr sample = m_instrument->getSample(); IComponent_const_sptr sample = m_instrument->getSample();
// Get final energy E_f, final velocity v_f // Get final energy E_f, final velocity v_f
std::vector< double > wsProp=det->getNumberParameter("Efixed"); std::vector< double > wsProp=det->getNumberParameter("Efixed");
if ( !wsProp.empty() ) if ( !wsProp.empty() )
......
...@@ -277,7 +277,7 @@ void ModeratorTzeroLinear::calculateTfLi(MatrixWorkspace_const_sptr inputWS, siz ...@@ -277,7 +277,7 @@ void ModeratorTzeroLinear::calculateTfLi(MatrixWorkspace_const_sptr inputWS, siz
} }
else else
{ {
IObjComponent_const_sptr sample = m_instrument->getSample(); IComponent_const_sptr sample = m_instrument->getSample();
try try
{ {
L_i = m_instrument->getSource()->getDistance(*sample); L_i = m_instrument->getSource()->getDistance(*sample);
......
...@@ -145,7 +145,7 @@ void MultipleScatteringCylinderAbsorption::exec() ...@@ -145,7 +145,7 @@ void MultipleScatteringCylinderAbsorption::exec()
if (instrument == NULL) if (instrument == NULL)
throw std::runtime_error("Failed to find instrument attached to InputWorkspace"); throw std::runtime_error("Failed to find instrument attached to InputWorkspace");
IObjComponent_const_sptr source = instrument->getSource(); IObjComponent_const_sptr source = instrument->getSource();
IObjComponent_const_sptr sample = instrument->getSample(); IComponent_const_sptr sample = instrument->getSample();
if (source == NULL) if (source == NULL)
throw std::runtime_error("Failed to find source in the instrument for InputWorkspace"); throw std::runtime_error("Failed to find source in the instrument for InputWorkspace");
if (sample == NULL) if (sample == NULL)
......
...@@ -298,7 +298,7 @@ void RemoveBins::calculateDetectorPosition(const int& index, double& l1, double& ...@@ -298,7 +298,7 @@ void RemoveBins::calculateDetectorPosition(const int& index, double& l1, double&
// Get a pointer to the instrument contained in the workspace // Get a pointer to the instrument contained in the workspace
Geometry::Instrument_const_sptr instrument = m_inputWorkspace->getInstrument(); Geometry::Instrument_const_sptr instrument = m_inputWorkspace->getInstrument();
// Get the distance between the source and the sample (assume in metres) // Get the distance between the source and the sample (assume in metres)
Geometry::IObjComponent_const_sptr sample = instrument->getSample(); Geometry::IComponent_const_sptr sample = instrument->getSample();
// Check for valid instrument // Check for valid instrument
if (sample == NULL) if (sample == NULL)
{ {
......
...@@ -115,7 +115,7 @@ void SofQW::exec() ...@@ -115,7 +115,7 @@ void SofQW::exec()
// Get the distance between the source and the sample (assume in metres) // Get the distance between the source and the sample (assume in metres)
IObjComponent_const_sptr source = instrument->getSource(); IObjComponent_const_sptr source = instrument->getSource();
IObjComponent_const_sptr sample = instrument->getSample(); IComponent_const_sptr sample = instrument->getSample();
V3D beamDir = sample->getPos() - source->getPos(); V3D beamDir = sample->getPos() - source->getPos();
beamDir.normalize(); beamDir.normalize();
......
...@@ -110,7 +110,7 @@ namespace Mantid ...@@ -110,7 +110,7 @@ namespace Mantid
Geometry::Instrument_const_sptr instrument = inputWS->getInstrument(); Geometry::Instrument_const_sptr instrument = inputWS->getInstrument();
// Get the distance between the source and the sample (assume in metres) // Get the distance between the source and the sample (assume in metres)
Geometry::IObjComponent_const_sptr sample = instrument->getSample(); Geometry::IComponent_const_sptr sample = instrument->getSample();
if ( !sample ) if ( !sample )
{ {
g_log.information( g_log.information(
......
...@@ -194,7 +194,7 @@ double UnwrapMonitor::getPrimaryFlightpath() const ...@@ -194,7 +194,7 @@ double UnwrapMonitor::getPrimaryFlightpath() const
// Get a pointer to the instrument contained in the input workspace // Get a pointer to the instrument contained in the input workspace
Geometry::Instrument_const_sptr instrument = m_inputWS->getInstrument(); Geometry::Instrument_const_sptr instrument = m_inputWS->getInstrument();
// Get the distance between the source and the sample // Get the distance between the source and the sample
Geometry::IObjComponent_const_sptr sample = instrument->getSample(); Geometry::IComponent_const_sptr sample = instrument->getSample();
double L1; double L1;
try try
{ {
......
...@@ -124,7 +124,7 @@ void UnwrapSNS::exec() ...@@ -124,7 +124,7 @@ void UnwrapSNS::exec()
// without the primary flight path the algorithm cannot work // without the primary flight path the algorithm cannot work
try { try {
Geometry::Instrument_const_sptr instrument = m_inputWS->getInstrument(); Geometry::Instrument_const_sptr instrument = m_inputWS->getInstrument();
Geometry::IObjComponent_const_sptr sample = instrument->getSample(); Geometry::IComponent_const_sptr sample = instrument->getSample();
m_L1 = instrument->getSource()->getDistance(*sample); m_L1 = instrument->getSource()->getDistance(*sample);
} }
catch (NotFoundError&) catch (NotFoundError&)
......
...@@ -852,7 +852,7 @@ namespace Mantid ...@@ -852,7 +852,7 @@ namespace Mantid
Q = peak.getQLabFrame().norm(); Q = peak.getQLabFrame().norm();
Geometry::Instrument_const_sptr instr = peak.getInstrument(); Geometry::Instrument_const_sptr instr = peak.getInstrument();
const Geometry::IObjComponent_const_sptr sample = instr->getSample(); const Geometry::IComponent_const_sptr sample = instr->getSample();
V3D pos = peak.getDetPos()-sample->getPos(); V3D pos = peak.getDetPos()-sample->getPos();
ScatAngle = acos(pos.Z() / pos.norm()); ScatAngle = acos(pos.Z() / pos.norm());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment