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
b4ac05af
Commit
b4ac05af
authored
Mar 05, 2021
by
Whitfield, Ross
Browse files
Rename LeanPeak to LeanElasticPeak
parent
fea2eee4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Framework/DataObjects/CMakeLists.txt
View file @
b4ac05af
...
...
@@ -28,7 +28,7 @@ set(SRC_FILES
src/NoShape.cpp
src/OffsetsWorkspace.cpp
src/Peak.cpp
src/LeanPeak.cpp
src/Lean
Elastic
Peak.cpp
src/BasePeak.cpp
src/PeakColumn.cpp
src/PeakNoShapeFactory.cpp
...
...
@@ -110,7 +110,7 @@ set(INC_FILES
inc/MantidDataObjects/NoShape.h
inc/MantidDataObjects/OffsetsWorkspace.h
inc/MantidDataObjects/Peak.h
inc/MantidDataObjects/LeanPeak.h
inc/MantidDataObjects/Lean
Elastic
Peak.h
inc/MantidDataObjects/BasePeak.h
inc/MantidDataObjects/PeakColumn.h
inc/MantidDataObjects/PeakNoShapeFactory.h
...
...
@@ -179,7 +179,7 @@ set(TEST_FILES
PeakShapeSphericalFactoryTest.h
PeakShapeSphericalTest.h
PeakTest.h
LeanPeakTest.h
Lean
Elastic
PeakTest.h
PeaksWorkspaceTest.h
RebinnedOutputTest.h
RefAxisTest.h
...
...
Framework/DataObjects/inc/MantidDataObjects/LeanPeak.h
→
Framework/DataObjects/inc/MantidDataObjects/Lean
Elastic
Peak.h
View file @
b4ac05af
...
...
@@ -21,26 +21,28 @@ namespace Mantid {
namespace
DataObjects
{
/** Structure describing a single-crystal peak. This is a version of
* Peak that doesn't require the instrument. The peak is described
* only by the Q-sample position. Optionally if the wavelength and
* goniometer is provided other properties can be calculated.
* Peak that doesn't require the instrument and also assuming elastic
* scattering. The peak is described only by the Q-sample
* position. Optionally if the wavelength and goniometer is provided
* other properties can be calculated.
*
*/
class
DLLExport
LeanPeak
:
public
BasePeak
{
class
DLLExport
Lean
Elastic
Peak
:
public
BasePeak
{
public:
/// Allow PeakColumn class to directly access members.
friend
class
PeakColumn
;
LeanPeak
();
LeanPeak
(
const
Mantid
::
Kernel
::
V3D
&
QSampleFrame
);
LeanPeak
(
const
Mantid
::
Kernel
::
V3D
&
QSampleFrame
,
const
Mantid
::
Kernel
::
Matrix
<
double
>
&
goniometer
);
LeanPeak
(
const
Mantid
::
Kernel
::
V3D
&
QSampleFrame
,
double
wavelength
);
LeanPeak
(
const
Mantid
::
Kernel
::
V3D
&
QSampleFrame
,
const
Mantid
::
Kernel
::
Matrix
<
double
>
&
goniometer
,
double
wavelength
);
LeanElasticPeak
();
LeanElasticPeak
(
const
Mantid
::
Kernel
::
V3D
&
QSampleFrame
);
LeanElasticPeak
(
const
Mantid
::
Kernel
::
V3D
&
QSampleFrame
,
const
Mantid
::
Kernel
::
Matrix
<
double
>
&
goniometer
);
LeanElasticPeak
(
const
Mantid
::
Kernel
::
V3D
&
QSampleFrame
,
double
wavelength
);
LeanElasticPeak
(
const
Mantid
::
Kernel
::
V3D
&
QSampleFrame
,
const
Mantid
::
Kernel
::
Matrix
<
double
>
&
goniometer
,
double
wavelength
);
/// Copy constructor
LeanPeak
(
const
LeanPeak
&
other
);
Lean
Elastic
Peak
(
const
Lean
Elastic
Peak
&
other
);
// MSVC 2015/17 can build with noexcept = default however
// intellisense still incorrectly reports this as an error despite compiling.
...
...
@@ -48,15 +50,15 @@ public:
// For that reason we still use the supplied default which should be noexcept
// once the above is fixed we can remove this workaround
#if defined(_MSC_VER) && _MSC_VER <= 1910
LeanPeak
(
LeanPeak
&&
)
=
default
;
LeanPeak
&
operator
=
(
LeanPeak
&&
)
=
default
;
Lean
Elastic
Peak
(
Lean
Elastic
Peak
&&
)
=
default
;
Lean
Elastic
Peak
&
operator
=
(
Lean
Elastic
Peak
&&
)
=
default
;
#else
LeanPeak
(
LeanPeak
&&
)
noexcept
=
default
;
LeanPeak
&
operator
=
(
LeanPeak
&&
)
noexcept
=
default
;
Lean
Elastic
Peak
(
Lean
Elastic
Peak
&&
)
noexcept
=
default
;
Lean
Elastic
Peak
&
operator
=
(
Lean
Elastic
Peak
&&
)
noexcept
=
default
;
#endif
// Construct a peak from a reference to the interface
explicit
LeanPeak
(
const
Geometry
::
IPeak
&
ipeak
);
explicit
Lean
Elastic
Peak
(
const
Geometry
::
IPeak
&
ipeak
);
void
setDetectorID
(
int
)
override
;
int
getDetectorID
()
const
override
;
...
...
@@ -92,7 +94,7 @@ public:
double
getL2
()
const
override
;
/// Assignment
LeanPeak
&
operator
=
(
const
LeanPeak
&
other
);
Lean
Elastic
Peak
&
operator
=
(
const
Lean
Elastic
Peak
&
other
);
private:
/// Q_sample vector
...
...
Framework/DataObjects/src/LeanPeak.cpp
→
Framework/DataObjects/src/Lean
Elastic
Peak.cpp
View file @
b4ac05af
...
...
@@ -4,7 +4,7 @@
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#include
"MantidDataObjects/LeanPeak.h"
#include
"MantidDataObjects/Lean
Elastic
Peak.h"
#include
"MantidDataObjects/NoShape.h"
#include
"MantidGeometry/Instrument/RectangularDetector.h"
#include
"MantidGeometry/Instrument/ReferenceFrame.h"
...
...
@@ -30,7 +30,7 @@ namespace DataObjects {
//----------------------------------------------------------------------------------------------
/** Default constructor */
LeanPeak
::
LeanPeak
()
:
BasePeak
(),
m_Qsample
(
V3D
(
0
,
0
,
0
))
{}
Lean
Elastic
Peak
::
Lean
Elastic
Peak
()
:
BasePeak
(),
m_Qsample
(
V3D
(
0
,
0
,
0
))
{}
//----------------------------------------------------------------------------------------------
/** Constructor that uses the Q position of the peak (in the sample frame)
...
...
@@ -40,7 +40,8 @@ LeanPeak::LeanPeak() : BasePeak(), m_Qsample(V3D(0, 0, 0)) {}
* @param QSampleFrame :: Q of the center of the peak, in reciprocal space, in
*the sample frame (goniometer rotation accounted for).
*/
LeanPeak
::
LeanPeak
(
const
Mantid
::
Kernel
::
V3D
&
QSampleFrame
)
:
BasePeak
()
{
LeanElasticPeak
::
LeanElasticPeak
(
const
Mantid
::
Kernel
::
V3D
&
QSampleFrame
)
:
BasePeak
()
{
this
->
setQSampleFrame
(
QSampleFrame
);
}
...
...
@@ -51,8 +52,9 @@ LeanPeak::LeanPeak(const Mantid::Kernel::V3D &QSampleFrame) : BasePeak() {
* @param QSampleFrame :: Q of the center of the peak, in reciprocal space
* @param goniometer :: a 3x3 rotation matrix
*/
LeanPeak
::
LeanPeak
(
const
Mantid
::
Kernel
::
V3D
&
QSampleFrame
,
const
Mantid
::
Kernel
::
Matrix
<
double
>
&
goniometer
)
LeanElasticPeak
::
LeanElasticPeak
(
const
Mantid
::
Kernel
::
V3D
&
QSampleFrame
,
const
Mantid
::
Kernel
::
Matrix
<
double
>
&
goniometer
)
:
BasePeak
(
goniometer
)
{
this
->
setQSampleFrame
(
QSampleFrame
);
}
...
...
@@ -66,7 +68,8 @@ LeanPeak::LeanPeak(const Mantid::Kernel::V3D &QSampleFrame,
*the sample frame (goniometer rotation accounted for).
* @param wavelength :: wavelength in Angstroms.
*/
LeanPeak
::
LeanPeak
(
const
Mantid
::
Kernel
::
V3D
&
QSampleFrame
,
double
wavelength
)
LeanElasticPeak
::
LeanElasticPeak
(
const
Mantid
::
Kernel
::
V3D
&
QSampleFrame
,
double
wavelength
)
:
BasePeak
()
{
this
->
setQSampleFrame
(
QSampleFrame
);
this
->
setWavelength
(
wavelength
);
...
...
@@ -80,9 +83,9 @@ LeanPeak::LeanPeak(const Mantid::Kernel::V3D &QSampleFrame, double wavelength)
* @param goniometer :: a 3x3 rotation matrix
* @param wavelength :: wavelength in Angstroms.
*/
LeanPeak
::
Lean
Peak
(
const
Mantid
::
Kernel
::
V3D
&
QSampleFrame
,
const
Mantid
::
Kernel
::
Matrix
<
double
>
&
goniometer
,
double
wavelength
)
Lean
Elastic
Peak
::
Lean
ElasticPeak
(
const
Mantid
::
Kernel
::
V3D
&
QSampleFrame
,
const
Mantid
::
Kernel
::
Matrix
<
double
>
&
goniometer
,
double
wavelength
)
:
BasePeak
(
goniometer
)
{
this
->
setQSampleFrame
(
QSampleFrame
);
this
->
setWavelength
(
wavelength
);
...
...
@@ -92,15 +95,15 @@ LeanPeak::LeanPeak(const Mantid::Kernel::V3D &QSampleFrame,
* @brief Copy constructor
* @param other : Source
*/
LeanPeak
::
LeanPeak
(
const
LeanPeak
&
other
)
Lean
Elastic
Peak
::
Lean
Elastic
Peak
(
const
Lean
Elastic
Peak
&
other
)
:
BasePeak
(
other
),
m_Qsample
(
other
.
m_Qsample
)
{}
//----------------------------------------------------------------------------------------------
/** Constructor making a LeanPeak from IPeak interface
/** Constructor making a Lean
Elastic
Peak from IPeak interface
*
* @param ipeak :: const reference to an IPeak object
*/
LeanPeak
::
LeanPeak
(
const
Geometry
::
IPeak
&
ipeak
)
Lean
Elastic
Peak
::
Lean
Elastic
Peak
(
const
Geometry
::
IPeak
&
ipeak
)
:
BasePeak
(
ipeak
),
m_Qsample
(
ipeak
.
getQSampleFrame
())
{}
//----------------------------------------------------------------------------------------------
...
...
@@ -108,61 +111,65 @@ LeanPeak::LeanPeak(const Geometry::IPeak &ipeak)
* cache values related to it. It also adds it to the list of contributing
* detectors for this peak but does NOT remove the old centre.
*/
void
LeanPeak
::
setDetectorID
(
int
)
{
void
Lean
Elastic
Peak
::
setDetectorID
(
int
)
{
throw
Exception
::
NotImplementedError
(
"LeanPeak::setDetectorID(): Can't set detectorID on LeanPeak"
);
"LeanElasticPeak::setDetectorID(): Can't set detectorID on "
"LeanElasticPeak"
);
}
//----------------------------------------------------------------------------------------------
/** Get the ID of the detector at the center of the peak */
int
LeanPeak
::
getDetectorID
()
const
{
return
-
1
;
}
int
Lean
Elastic
Peak
::
getDetectorID
()
const
{
return
-
1
;
}
//----------------------------------------------------------------------------------------------
/** Set the instrument (and save the source/sample pos).
* Call setDetectorID AFTER this call.
*
*/
void
LeanPeak
::
setInstrument
(
const
Geometry
::
Instrument_const_sptr
&
)
{
void
Lean
Elastic
Peak
::
setInstrument
(
const
Geometry
::
Instrument_const_sptr
&
)
{
throw
Exception
::
NotImplementedError
(
"LeanPeak::setInstrument(): Can't set instrument on LeanPeak"
);
"LeanElasticPeak::setInstrument(): Can't set instrument on "
"LeanElasticPeak"
);
}
//----------------------------------------------------------------------------------------------
/** Return a shared ptr to the detector at center of peak. */
Geometry
::
IDetector_const_sptr
LeanPeak
::
getDetector
()
const
{
Geometry
::
IDetector_const_sptr
Lean
Elastic
Peak
::
getDetector
()
const
{
throw
Exception
::
NotImplementedError
(
"LeanPeak::getDetector(): Has no detector ID"
);
"Lean
Elastic
Peak::getDetector(): Has no detector ID"
);
}
/** Return a shared ptr to the instrument for this peak. */
Geometry
::
Instrument_const_sptr
LeanPeak
::
getInstrument
()
const
{
Geometry
::
Instrument_const_sptr
Lean
Elastic
Peak
::
getInstrument
()
const
{
throw
Exception
::
NotImplementedError
(
"LeanPeak::setInstrument(): Has no instrument"
);
"Lean
Elastic
Peak::setInstrument(): Has no instrument"
);
}
// -------------------------------------------------------------------------------------
/** Calculate the time of flight (in microseconds) of the neutrons for this
* peak,
* using the geometry of the detector */
double
LeanPeak
::
getTOF
()
const
{
double
Lean
Elastic
Peak
::
getTOF
()
const
{
return
std
::
numeric_limits
<
double
>::
quiet_NaN
();
}
// -------------------------------------------------------------------------------------
/** Calculate the scattering angle of the peak */
double
LeanPeak
::
getScattering
()
const
{
double
Lean
Elastic
Peak
::
getScattering
()
const
{
return
asin
(
getWavelength
()
/
(
2
*
getDSpacing
()))
*
2
;
}
// -------------------------------------------------------------------------------------
/** Calculate the azimuthal angle of the peak */
double
LeanPeak
::
getAzimuthal
()
const
{
double
Lean
Elastic
Peak
::
getAzimuthal
()
const
{
return
std
::
numeric_limits
<
double
>::
quiet_NaN
();
}
// -------------------------------------------------------------------------------------
/** Calculate the d-spacing of the peak, in 1/Angstroms */
double
LeanPeak
::
getDSpacing
()
const
{
return
2
*
M_PI
/
m_Qsample
.
norm
();
}
double
LeanElasticPeak
::
getDSpacing
()
const
{
return
2
*
M_PI
/
m_Qsample
.
norm
();
}
//----------------------------------------------------------------------------------------------
/** Return the Q change (of the lattice, k_i - k_f) for this peak.
...
...
@@ -170,14 +177,16 @@ double LeanPeak::getDSpacing() const { return 2 * M_PI / m_Qsample.norm(); }
*
* Note: There is a 2*pi factor used, so |Q| = 2*pi/wavelength.
* */
Mantid
::
Kernel
::
V3D
LeanPeak
::
getQLabFrame
()
const
{
Mantid
::
Kernel
::
V3D
Lean
Elastic
Peak
::
getQLabFrame
()
const
{
return
getGoniometerMatrix
()
*
m_Qsample
;
}
//----------------------------------------------------------------------------------------------
/** Return the Q change (of the lattice, k_i - k_f) for this peak.
* The Q is in the Sample frame: the goniometer rotation WAS taken out. */
Mantid
::
Kernel
::
V3D
LeanPeak
::
getQSampleFrame
()
const
{
return
m_Qsample
;
}
Mantid
::
Kernel
::
V3D
LeanElasticPeak
::
getQSampleFrame
()
const
{
return
m_Qsample
;
}
//----------------------------------------------------------------------------------------------
/** Set the peak using the peak's position in reciprocal space, in the sample
...
...
@@ -190,8 +199,8 @@ Mantid::Kernel::V3D LeanPeak::getQSampleFrame() const { return m_Qsample; }
* This is in inelastic convention: momentum transfer of the LATTICE!
* Also, q does NOT have a 2pi factor = it is equal to 1/wavelength.
*/
void
LeanPeak
::
setQSampleFrame
(
const
Mantid
::
Kernel
::
V3D
&
QSampleFrame
,
boost
::
optional
<
double
>
)
{
void
Lean
Elastic
Peak
::
setQSampleFrame
(
const
Mantid
::
Kernel
::
V3D
&
QSampleFrame
,
boost
::
optional
<
double
>
)
{
m_Qsample
=
QSampleFrame
;
}
...
...
@@ -208,47 +217,53 @@ void LeanPeak::setQSampleFrame(const Mantid::Kernel::V3D &QSampleFrame,
* Also, q does have a 2pi factor = it is equal to 2pi/wavelength (in
* Angstroms).
*/
void
LeanPeak
::
setQLabFrame
(
const
Mantid
::
Kernel
::
V3D
&
qLab
,
boost
::
optional
<
double
>
)
{
void
Lean
Elastic
Peak
::
setQLabFrame
(
const
Mantid
::
Kernel
::
V3D
&
qLab
,
boost
::
optional
<
double
>
)
{
this
->
setQSampleFrame
(
getInverseGoniometerMatrix
()
*
qLab
);
}
/** Set sample position
*
*/
void
LeanPeak
::
setSamplePos
(
double
,
double
,
double
)
{
throw
Exception
::
NotImplementedError
(
"LeanPeak has no sample information"
);
void
LeanElasticPeak
::
setSamplePos
(
double
,
double
,
double
)
{
throw
Exception
::
NotImplementedError
(
"LeanElasticPeak has no sample information"
);
}
/** Set sample position
*
*/
void
LeanPeak
::
setSamplePos
(
const
Mantid
::
Kernel
::
V3D
&
)
{
throw
Exception
::
NotImplementedError
(
"LeanPeak has no sample information"
);
void
LeanElasticPeak
::
setSamplePos
(
const
Mantid
::
Kernel
::
V3D
&
)
{
throw
Exception
::
NotImplementedError
(
"LeanElasticPeak has no sample information"
);
}
// -------------------------------------------------------------------------------------
/** Return the detector position vector */
Mantid
::
Kernel
::
V3D
LeanPeak
::
getDetPos
()
const
{
throw
Exception
::
NotImplementedError
(
"LeanPeak has no detector information"
);
Mantid
::
Kernel
::
V3D
LeanElasticPeak
::
getDetPos
()
const
{
throw
Exception
::
NotImplementedError
(
"LeanElasticPeak has no detector information"
);
}
// -------------------------------------------------------------------------------------
/** Return the sample position vector */
Mantid
::
Kernel
::
V3D
LeanPeak
::
getSamplePos
()
const
{
throw
Exception
::
NotImplementedError
(
"LeanPeak has no sample information"
);
Mantid
::
Kernel
::
V3D
LeanElasticPeak
::
getSamplePos
()
const
{
throw
Exception
::
NotImplementedError
(
"LeanElasticPeak has no sample information"
);
}
// -------------------------------------------------------------------------------------
/** Return the L1 flight path length (source to sample), in meters. */
double
LeanPeak
::
getL1
()
const
{
throw
Exception
::
NotImplementedError
(
"LeanPeak has no detector information"
);
double
LeanElasticPeak
::
getL1
()
const
{
throw
Exception
::
NotImplementedError
(
"LeanElasticPeak has no detector information"
);
}
// -------------------------------------------------------------------------------------
/** Return the L2 flight path length (sample to detector), in meters. */
double
LeanPeak
::
getL2
()
const
{
throw
Exception
::
NotImplementedError
(
"LeanPeak has no detector information"
);
double
LeanElasticPeak
::
getL2
()
const
{
throw
Exception
::
NotImplementedError
(
"LeanElasticPeak has no detector information"
);
}
/**
...
...
@@ -256,7 +271,7 @@ double LeanPeak::getL2() const {
* @param other : Other peak object to assign from
* @return this
*/
LeanPeak
&
LeanPeak
::
operator
=
(
const
LeanPeak
&
other
)
{
Lean
Elastic
Peak
&
Lean
Elastic
Peak
::
operator
=
(
const
Lean
Elastic
Peak
&
other
)
{
if
(
&
other
!=
this
)
{
BasePeak
::
operator
=
(
other
);
m_Qsample
=
other
.
m_Qsample
;
...
...
@@ -273,8 +288,9 @@ LeanPeak &LeanPeak::operator=(const LeanPeak &other) {
*
* @return true if the detector ID was found.
*/
bool
LeanPeak
::
findDetector
()
{
throw
Exception
::
NotImplementedError
(
"LeanPeak has no detector information"
);
bool
LeanElasticPeak
::
findDetector
()
{
throw
Exception
::
NotImplementedError
(
"LeanElasticPeak has no detector information"
);
}
/**
...
...
@@ -284,26 +300,29 @@ bool LeanPeak::findDetector() {
* over the same instrument.
* @return true if the detector ID was found.
*/
bool
LeanPeak
::
findDetector
(
const
InstrumentRayTracer
&
)
{
throw
Exception
::
NotImplementedError
(
"LeanPeak has no detector information"
);
bool
LeanElasticPeak
::
findDetector
(
const
InstrumentRayTracer
&
)
{
throw
Exception
::
NotImplementedError
(
"LeanElasticPeak has no detector information"
);
}
/**
Forwarding function. Exposes the detector position directly.
*/
Mantid
::
Kernel
::
V3D
LeanPeak
::
getDetectorPositionNoCheck
()
const
{
throw
Exception
::
NotImplementedError
(
"LeanPeak has no detector information"
);
Mantid
::
Kernel
::
V3D
LeanElasticPeak
::
getDetectorPositionNoCheck
()
const
{
throw
Exception
::
NotImplementedError
(
"LeanElasticPeak has no detector information"
);
}
/**
Forwarding function. Exposes the detector position directly, but checks that
the detector is not null before accessing its position. Throws if null.
*/
Mantid
::
Kernel
::
V3D
LeanPeak
::
getDetectorPosition
()
const
{
throw
Exception
::
NotImplementedError
(
"LeanPeak has no detector information"
);
Mantid
::
Kernel
::
V3D
LeanElasticPeak
::
getDetectorPosition
()
const
{
throw
Exception
::
NotImplementedError
(
"LeanElasticPeak has no detector information"
);
}
Mantid
::
Kernel
::
Logger
LeanPeak
::
g_log
(
"PeakLogger"
);
Mantid
::
Kernel
::
Logger
Lean
Elastic
Peak
::
g_log
(
"PeakLogger"
);
}
// namespace DataObjects
}
// namespace Mantid
Framework/DataObjects/test/LeanPeakTest.h
→
Framework/DataObjects/test/Lean
Elastic
PeakTest.h
View file @
b4ac05af
...
...
@@ -10,7 +10,7 @@
#include
<cxxtest/TestSuite.h>
#include
"MantidDataObjects/LeanPeak.h"
#include
"MantidDataObjects/Lean
Elastic
Peak.h"
#include
"MantidDataObjects/Peak.h"
#include
"MantidTestHelpers/ComponentCreationHelper.h"
...
...
@@ -19,15 +19,17 @@ using namespace Mantid::DataObjects;
using
namespace
Mantid
::
Geometry
;
using
namespace
Mantid
::
Kernel
;
class
LeanPeakTest
:
public
CxxTest
::
TestSuite
{
class
Lean
Elastic
PeakTest
:
public
CxxTest
::
TestSuite
{
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static
LeanPeakTest
*
createSuite
()
{
return
new
LeanPeakTest
();
}
static
void
destroySuite
(
LeanPeakTest
*
suite
)
{
delete
suite
;
}
static
LeanElasticPeakTest
*
createSuite
()
{
return
new
LeanElasticPeakTest
();
}
static
void
destroySuite
(
LeanElasticPeakTest
*
suite
)
{
delete
suite
;
}
void
test_default_constructor
()
{
LeanPeak
p
;
Lean
Elastic
Peak
p
;
TS_ASSERT_EQUALS
(
p
.
getH
(),
0.0
)
TS_ASSERT_EQUALS
(
p
.
getK
(),
0.0
)
TS_ASSERT_EQUALS
(
p
.
getL
(),
0.0
)
...
...
@@ -54,7 +56,7 @@ public:
}
void
test_Qsample_constructor
()
{
LeanPeak
p
(
V3D
(
1
,
2
,
3
));
Lean
Elastic
Peak
p
(
V3D
(
1
,
2
,
3
));
TS_ASSERT_EQUALS
(
p
.
getQSampleFrame
(),
V3D
(
1
,
2
,
3
))
TS_ASSERT_EQUALS
(
p
.
getQLabFrame
(),
V3D
(
1
,
2
,
3
))
...
...
@@ -81,14 +83,14 @@ public:
gon
[
1
][
0
]
=
1
;
gon
[
2
][
2
]
=
1
;
LeanPeak
p
(
V3D
(
1
,
2
,
3
),
gon
);
Lean
Elastic
Peak
p
(
V3D
(
1
,
2
,
3
),
gon
);
TS_ASSERT_EQUALS
(
p
.
getQSampleFrame
(),
V3D
(
1
,
2
,
3
))
TS_ASSERT_EQUALS
(
p
.
getQLabFrame
(),
V3D
(
2
,
1
,
3
))
}
void
test_Qsample_wavelength_constructor
()
{
LeanPeak
p
(
V3D
(
1
,
2
,
3
),
1.
);
Lean
Elastic
Peak
p
(
V3D
(
1
,
2
,
3
),
1.
);
TS_ASSERT_EQUALS
(
p
.
getQSampleFrame
(),
V3D
(
1
,
2
,
3
))
TS_ASSERT_EQUALS
(
p
.
getQLabFrame
(),
V3D
(
1
,
2
,
3
))
...
...
@@ -107,7 +109,7 @@ public:
gon
[
1
][
0
]
=
1
;
gon
[
2
][
2
]
=
1
;
LeanPeak
p
(
V3D
(
1
,
2
,
3
),
gon
,
1.
);
Lean
Elastic
Peak
p
(
V3D
(
1
,
2
,
3
),
gon
,
1.
);
TS_ASSERT_EQUALS
(
p
.
getQSampleFrame
(),
V3D
(
1
,
2
,
3
))
TS_ASSERT_EQUALS
(
p
.
getQLabFrame
(),
V3D
(
2
,
1
,
3
))
...
...
@@ -123,9 +125,9 @@ public:
gon
[
1
][
0
]
=
1
;
gon
[
2
][
2
]
=
1
;
LeanPeak
p
(
V3D
(
1
,
2
,
3
),
gon
,
1.
);
Lean
Elastic
Peak
p
(
V3D
(
1
,
2
,
3
),
gon
,
1.
);
// Default (not-explicit) copy constructor
LeanPeak
p2
(
p
);
Lean
Elastic
Peak
p2
(
p
);
TS_ASSERT_EQUALS
(
p
.
getQSampleFrame
(),
p2
.
getQSampleFrame
());
TS_ASSERT_EQUALS
(
p
.
getQLabFrame
(),
p2
.
getQLabFrame
());
TS_ASSERT_EQUALS
(
p
.
getGoniometerMatrix
(),
p2
.
getGoniometerMatrix
());
...
...
@@ -138,17 +140,17 @@ public:
gon
[
1
][
0
]
=
1
;
gon
[
2
][
2
]
=
1
;
LeanPeak
p
(
V3D
(
1
,
2
,
3
),
gon
,
1.
);
Lean
Elastic
Peak
p
(
V3D
(
1
,
2
,
3
),
gon
,
1.
);
const
Mantid
::
Geometry
::
IPeak
&
ipeak
=
p
;
LeanPeak
p2
(
ipeak
);
Lean
Elastic
Peak
p2
(
ipeak
);
TS_ASSERT_EQUALS
(
p
.
getQSampleFrame
(),
p2
.
getQSampleFrame
());
TS_ASSERT_EQUALS
(
p
.
getQLabFrame
(),
p2
.
getQLabFrame
());
TS_ASSERT_EQUALS
(
p
.
getGoniometerMatrix
(),
p2
.
getGoniometerMatrix
());
}
void
test_HKL
()
{
LeanPeak
p
;
Lean
Elastic
Peak
p
;
p
.
setHKL
(
1.0
,
2.0
,
3.0
);
TS_ASSERT_EQUALS
(
p
.
getH
(),
1.0
);
TS_ASSERT_EQUALS
(
p
.
getK
(),
2.0
);
...
...
@@ -167,7 +169,7 @@ public:
}
void
test_isIndexed
()
{
LeanPeak
p
;
Lean
Elastic
Peak
p
;
TS_ASSERT_EQUALS
(
false
,
p
.
isIndexed
());
p
.
setHKL
(
1
,
2
,
3
);
TS_ASSERT_EQUALS
(
true
,
p
.
isIndexed
());
...
...
@@ -176,7 +178,7 @@ public:
void
test_get_intensity_over_sigma
()
{
const
double
intensity
{
100
};
const
double
sigma
{
10
};
LeanPeak
p
;
Lean
Elastic
Peak
p
;
p
.
setIntensity
(
intensity
);
p
.
setSigmaIntensity
(
sigma
);
...
...
@@ -187,7 +189,7 @@ public:
void
test_get_intensity_over_sigma_empty_sigma
()
{
const
double
intensity
{
10
};
const
double
sigma
{
0
};
LeanPeak
p
;
Lean
Elastic
Peak
p
;
p
.
setIntensity
(
intensity
);
p
.
setSigmaIntensity
(
sigma
);
...
...
@@ -200,7 +202,7 @@ public:
void
test_get_energy
()
{
const
double
initialEnergy
{
100
};
const
double
finalEnergy
{
110
};
LeanPeak
p
;
Lean
Elastic
Peak
p
;
p
.
setInitialEnergy
(
initialEnergy
);
p
.
setFinalEnergy
(
finalEnergy
);
...
...
@@ -208,7 +210,7 @@ public:
TS_ASSERT_EQUALS
(
p
.
getEnergyTransfer
(),
initialEnergy
-
finalEnergy
);
}
void
test_Peak_to_LeanPeak_through_IPeak
()
{
void
test_Peak_to_Lean
Elastic
Peak_through_IPeak
()
{
Instrument_sptr
inst
(
ComponentCreationHelper
::
createTestInstrumentRectangular
(
5
,
100
));
...
...
@@ -227,7 +229,7 @@ public:
const
IPeak
&
ipeak
=
peak
;
LeanPeak
leanpeak
(
ipeak
);
Lean
Elastic
Peak
leanpeak
(
ipeak
);
TS_ASSERT_EQUALS
(
leanpeak
.
getQSampleFrame
(),
peak
.
getQSampleFrame
());
V3D
qsample
=
leanpeak
.
getQSampleFrame
();
...
...
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