Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
909cc84f
Commit
909cc84f
authored
Mar 26, 2014
by
Anders Markvardsen
Browse files
Store sample component not as IObjComponent but IComponent. re #9133
parent
2fdde41d
Changes
47
Hide whitespace changes
Inline
Side-by-side
Code/Mantid/Framework/API/src/IFunction.cpp
View file @
909cc84f
...
...
@@ -1020,7 +1020,7 @@ void IFunction::convertValue(std::vector<double>& values, Kernel::Unit_sptr& out
{
// Get l1, l2 and theta (see also RemoveBins.calculateDetectorPosition())
Instrument_const_sptr
instrument
=
ws
->
getInstrument
();
Geometry
::
I
Obj
Component_const_sptr
sample
=
instrument
->
getSample
();
Geometry
::
IComponent_const_sptr
sample
=
instrument
->
getSample
();
if
(
sample
==
NULL
)
{
g_log
.
error
()
<<
"No sample defined instrument. Cannot convert units for function
\n
"
...
...
Code/Mantid/Framework/API/src/MatrixWorkspace.cpp
View file @
909cc84f
...
...
@@ -751,7 +751,7 @@ namespace Mantid
Instrument_const_sptr
instrument
=
getInstrument
();
Geometry
::
IObjComponent_const_sptr
source
=
instrument
->
getSource
();
Geometry
::
I
Obj
Component_const_sptr
sample
=
instrument
->
getSample
();
Geometry
::
IComponent_const_sptr
sample
=
instrument
->
getSample
();
if
(
source
==
NULL
||
sample
==
NULL
)
{
throw
Kernel
::
Exception
::
InstrumentDefinitionError
(
"Instrument not sufficiently defined: failed to get source and/or sample"
);
...
...
@@ -777,7 +777,7 @@ namespace Mantid
double
MatrixWorkspace
::
detectorTwoTheta
(
Geometry
::
IDetector_const_sptr
det
)
const
{
Geometry
::
IObjComponent_const_sptr
source
=
getInstrument
()
->
getSource
();
Geometry
::
I
Obj
Component_const_sptr
sample
=
getInstrument
()
->
getSample
();
Geometry
::
IComponent_const_sptr
sample
=
getInstrument
()
->
getSample
();
if
(
source
==
NULL
||
sample
==
NULL
)
{
throw
Kernel
::
Exception
::
InstrumentDefinitionError
(
"Instrument not sufficiently defined: failed to get source and/or sample"
);
...
...
@@ -1557,7 +1557,7 @@ namespace Mantid
try
{
Geometry
::
Instrument_const_sptr
inst
=
this
->
getInstrument
();
Geometry
::
I
Obj
Component_const_sptr
sample
=
inst
->
getSample
();
Geometry
::
IComponent_const_sptr
sample
=
inst
->
getSample
();
if
(
sample
)
{
Kernel
::
V3D
sample_pos
=
sample
->
getPos
();
...
...
Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/CorrectFlightPaths.h
View file @
909cc84f
...
...
@@ -80,7 +80,7 @@ private:
Geometry
::
Instrument_const_sptr
m_instrument
;
Geometry
::
I
Obj
Component_const_sptr
m_sample
;
Geometry
::
IComponent_const_sptr
m_sample
;
double
m_l2
;
double
m_wavelength
;
...
...
Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/RemoveLowResTOF.h
View file @
909cc84f
...
...
@@ -31,7 +31,7 @@ private:
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
Geometry
::
Instrument_const_sptr
m_instrument
;
///< The instrument
Geometry
::
I
Obj
Component_const_sptr
m_sample
;
///< The sample
Geometry
::
IComponent_const_sptr
m_sample
;
///< The sample
double
m_L1
;
///< The instrument initial flightpath
double
m_Tmin
;
///< The start of the time-of-flight frame
double
m_wavelengthMin
;
///< The minimum wavelength accessible in the frame
...
...
Code/Mantid/Framework/Algorithms/src/AddPeak.cpp
View file @
909cc84f
...
...
@@ -76,7 +76,7 @@ namespace Algorithms
Mantid
::
Geometry
::
Instrument_const_sptr
instr
=
runWS
->
getInstrument
();
Mantid
::
Geometry
::
IObjComponent_const_sptr
source
=
instr
->
getSource
();
Mantid
::
Geometry
::
I
Obj
Component_const_sptr
sample
=
instr
->
getSample
();
Mantid
::
Geometry
::
IComponent_const_sptr
sample
=
instr
->
getSample
();
Mantid
::
Geometry
::
IDetector_const_sptr
det
=
instr
->
getDetector
(
detID
);
const
Mantid
::
Kernel
::
V3D
samplePos
=
sample
->
getPos
();
...
...
Code/Mantid/Framework/Algorithms/src/ConvertSpectrumAxis.cpp
View file @
909cc84f
...
...
@@ -87,7 +87,7 @@ namespace Algorithms
Kernel
::
Unit_sptr
fromUnit
=
inputWS
->
getAxis
(
0
)
->
unit
();
Kernel
::
Unit_sptr
toUnit
=
UnitFactory
::
Instance
().
create
(
unitTarget
);
IObjComponent_const_sptr
source
=
inputWS
->
getInstrument
()
->
getSource
();
I
Obj
Component_const_sptr
sample
=
inputWS
->
getInstrument
()
->
getSample
();
IComponent_const_sptr
sample
=
inputWS
->
getInstrument
()
->
getSample
();
std
::
vector
<
double
>
emptyVector
;
const
double
l1
=
source
->
getDistance
(
*
sample
);
const
std
::
string
emodeStr
=
getProperty
(
"EMode"
);
...
...
Code/Mantid/Framework/Algorithms/src/ConvertSpectrumAxis2.cpp
View file @
909cc84f
...
...
@@ -135,7 +135,7 @@ namespace Algorithms
void
ConvertSpectrumAxis2
::
createElasticQMap
(
const
std
::
string
&
targetUnit
)
{
IObjComponent_const_sptr
source
=
m_inputWS
->
getInstrument
()
->
getSource
();
I
Obj
Component_const_sptr
sample
=
m_inputWS
->
getInstrument
()
->
getSample
();
IComponent_const_sptr
sample
=
m_inputWS
->
getInstrument
()
->
getSample
();
const
std
::
string
emodeStr
=
getProperty
(
"EMode"
);
int
emode
=
0
;
...
...
Code/Mantid/Framework/Algorithms/src/ConvertUnits.cpp
View file @
909cc84f
...
...
@@ -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)
IObjComponent_const_sptr
source
=
instrument
->
getSource
();
I
Obj
Component_const_sptr
sample
=
instrument
->
getSample
();
IComponent_const_sptr
sample
=
instrument
->
getSample
();
if
(
source
==
NULL
||
sample
==
NULL
)
{
throw
Exception
::
InstrumentDefinitionError
(
"Instrubment not sufficiently defined: failed to get source and/or sample"
);
...
...
Code/Mantid/Framework/Algorithms/src/CreateLogTimeCorrection.cpp
View file @
909cc84f
...
...
@@ -117,7 +117,7 @@ namespace Algorithms
void
CreateLogTimeCorrection
::
getInstrumentSetup
()
{
// 1. Get sample position and source position
I
Obj
Component_const_sptr
sample
=
m_instrument
->
getSample
();
IComponent_const_sptr
sample
=
m_instrument
->
getSample
();
if
(
!
sample
)
{
throw
runtime_error
(
"No sample has been set."
);
...
...
Code/Mantid/Framework/Algorithms/src/DiffractionEventCalibrateDetectors.cpp
View file @
909cc84f
...
...
@@ -410,7 +410,7 @@ namespace Algorithms
outfile
<<
"#
\n
"
;
outfile
<<
"6 L1 T0_SHIFT
\n
"
;
IObjComponent_const_sptr
source
=
inst
->
getSource
();
I
Obj
Component_const_sptr
sample
=
inst
->
getSample
();
IComponent_const_sptr
sample
=
inst
->
getSample
();
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
"
;
}
...
...
Code/Mantid/Framework/Algorithms/src/EditInstrumentGeometry.cpp
View file @
909cc84f
...
...
@@ -208,7 +208,7 @@ namespace Algorithms
throw
std
::
runtime_error
(
errmsg
);
}
Geometry
::
IObjComponent_const_sptr
source
=
originstrument
->
getSource
();
Geometry
::
I
Obj
Component_const_sptr
sample
=
originstrument
->
getSample
();
Geometry
::
IComponent_const_sptr
sample
=
originstrument
->
getSample
();
l1
=
source
->
getDistance
(
*
sample
);
g_log
.
information
()
<<
"Retrieve L1 from input data workspace.
\n
"
;
}
...
...
Code/Mantid/Framework/Algorithms/src/ModeratorTzero.cpp
View file @
909cc84f
...
...
@@ -223,7 +223,7 @@ void ModeratorTzero::execEvent()
}
//Get a pointer to the sample
I
Obj
Component_const_sptr
sample
=
outputWS
->
getInstrument
()
->
getSample
();
IComponent_const_sptr
sample
=
outputWS
->
getInstrument
()
->
getSample
();
// Loop over the spectra
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
}
else
{
I
Obj
Component_const_sptr
sample
=
m_instrument
->
getSample
();
IComponent_const_sptr
sample
=
m_instrument
->
getSample
();
try
{
L1
=
m_instrument
->
getSource
()
->
getDistance
(
*
sample
);
...
...
@@ -335,7 +335,7 @@ double ModeratorTzero::CalculateT2(MatrixWorkspace_sptr inputWS, size_t i)
}
else
{
I
Obj
Component_const_sptr
sample
=
m_instrument
->
getSample
();
IComponent_const_sptr
sample
=
m_instrument
->
getSample
();
// Get final energy E_f, final velocity v_f
std
::
vector
<
double
>
wsProp
=
det
->
getNumberParameter
(
"Efixed"
);
if
(
!
wsProp
.
empty
()
)
...
...
Code/Mantid/Framework/Algorithms/src/ModeratorTzeroLinear.cpp
View file @
909cc84f
...
...
@@ -277,7 +277,7 @@ void ModeratorTzeroLinear::calculateTfLi(MatrixWorkspace_const_sptr inputWS, siz
}
else
{
I
Obj
Component_const_sptr
sample
=
m_instrument
->
getSample
();
IComponent_const_sptr
sample
=
m_instrument
->
getSample
();
try
{
L_i
=
m_instrument
->
getSource
()
->
getDistance
(
*
sample
);
...
...
Code/Mantid/Framework/Algorithms/src/MultipleScatteringCylinderAbsorption.cpp
View file @
909cc84f
...
...
@@ -145,7 +145,7 @@ void MultipleScatteringCylinderAbsorption::exec()
if
(
instrument
==
NULL
)
throw
std
::
runtime_error
(
"Failed to find instrument attached to InputWorkspace"
);
IObjComponent_const_sptr
source
=
instrument
->
getSource
();
I
Obj
Component_const_sptr
sample
=
instrument
->
getSample
();
IComponent_const_sptr
sample
=
instrument
->
getSample
();
if
(
source
==
NULL
)
throw
std
::
runtime_error
(
"Failed to find source in the instrument for InputWorkspace"
);
if
(
sample
==
NULL
)
...
...
Code/Mantid/Framework/Algorithms/src/RemoveBins.cpp
View file @
909cc84f
...
...
@@ -298,7 +298,7 @@ void RemoveBins::calculateDetectorPosition(const int& index, double& l1, double&
// Get a pointer to the instrument contained in the workspace
Geometry
::
Instrument_const_sptr
instrument
=
m_inputWorkspace
->
getInstrument
();
// Get the distance between the source and the sample (assume in metres)
Geometry
::
I
Obj
Component_const_sptr
sample
=
instrument
->
getSample
();
Geometry
::
IComponent_const_sptr
sample
=
instrument
->
getSample
();
// Check for valid instrument
if
(
sample
==
NULL
)
{
...
...
Code/Mantid/Framework/Algorithms/src/SofQW.cpp
View file @
909cc84f
...
...
@@ -115,7 +115,7 @@ void SofQW::exec()
// Get the distance between the source and the sample (assume in metres)
IObjComponent_const_sptr
source
=
instrument
->
getSource
();
I
Obj
Component_const_sptr
sample
=
instrument
->
getSample
();
IComponent_const_sptr
sample
=
instrument
->
getSample
();
V3D
beamDir
=
sample
->
getPos
()
-
source
->
getPos
();
beamDir
.
normalize
();
...
...
Code/Mantid/Framework/Algorithms/src/SolidAngle.cpp
View file @
909cc84f
...
...
@@ -110,7 +110,7 @@ namespace Mantid
Geometry
::
Instrument_const_sptr
instrument
=
inputWS
->
getInstrument
();
// Get the distance between the source and the sample (assume in metres)
Geometry
::
I
Obj
Component_const_sptr
sample
=
instrument
->
getSample
();
Geometry
::
IComponent_const_sptr
sample
=
instrument
->
getSample
();
if
(
!
sample
)
{
g_log
.
information
(
...
...
Code/Mantid/Framework/Algorithms/src/UnwrapMonitor.cpp
View file @
909cc84f
...
...
@@ -194,7 +194,7 @@ double UnwrapMonitor::getPrimaryFlightpath() const
// Get a pointer to the instrument contained in the input workspace
Geometry
::
Instrument_const_sptr
instrument
=
m_inputWS
->
getInstrument
();
// Get the distance between the source and the sample
Geometry
::
I
Obj
Component_const_sptr
sample
=
instrument
->
getSample
();
Geometry
::
IComponent_const_sptr
sample
=
instrument
->
getSample
();
double
L1
;
try
{
...
...
Code/Mantid/Framework/Algorithms/src/UnwrapSNS.cpp
View file @
909cc84f
...
...
@@ -124,7 +124,7 @@ void UnwrapSNS::exec()
// without the primary flight path the algorithm cannot work
try
{
Geometry
::
Instrument_const_sptr
instrument
=
m_inputWS
->
getInstrument
();
Geometry
::
I
Obj
Component_const_sptr
sample
=
instrument
->
getSample
();
Geometry
::
IComponent_const_sptr
sample
=
instrument
->
getSample
();
m_L1
=
instrument
->
getSource
()
->
getDistance
(
*
sample
);
}
catch
(
NotFoundError
&
)
...
...
Code/Mantid/Framework/Crystal/src/IntegratePeakTimeSlices.cpp
View file @
909cc84f
...
...
@@ -852,7 +852,7 @@ namespace Mantid
Q
=
peak
.
getQLabFrame
().
norm
();
Geometry
::
Instrument_const_sptr
instr
=
peak
.
getInstrument
();
const
Geometry
::
I
Obj
Component_const_sptr
sample
=
instr
->
getSample
();
const
Geometry
::
IComponent_const_sptr
sample
=
instr
->
getSample
();
V3D
pos
=
peak
.
getDetPos
()
-
sample
->
getPos
();
ScatAngle
=
acos
(
pos
.
Z
()
/
pos
.
norm
());
...
...
Prev
1
2
3
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment