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
06d3370c
Commit
06d3370c
authored
Feb 26, 2021
by
Whitfield, Ross
Browse files
A LeanPeak constructor from IPeak
parent
db05e187
Changes
3
Hide whitespace changes
Inline
Side-by-side
Framework/DataObjects/inc/MantidDataObjects/LeanPeak.h
View file @
06d3370c
...
...
@@ -66,6 +66,9 @@ public:
LeanPeak
&
operator
=
(
LeanPeak
&&
)
noexcept
=
default
;
#endif
// Construct a peak from a reference to the interface
explicit
LeanPeak
(
const
Geometry
::
IPeak
&
ipeak
);
void
setDetectorID
(
int
id
)
override
;
int
getDetectorID
()
const
override
;
...
...
Framework/DataObjects/src/LeanPeak.cpp
View file @
06d3370c
...
...
@@ -145,6 +145,34 @@ LeanPeak::LeanPeak(const LeanPeak &other)
m_peakNumber
(
other
.
m_peakNumber
),
m_intHKL
(
other
.
m_intHKL
),
m_intMNP
(
other
.
m_intMNP
),
m_peakShape
(
other
.
m_peakShape
->
clone
()),
convention
(
other
.
convention
)
{}
//----------------------------------------------------------------------------------------------
/** Constructor making a LeanPeak from IPeak interface
*
* @param ipeak :: const reference to an IPeak object
* @return
*/
LeanPeak
::
LeanPeak
(
const
Geometry
::
IPeak
&
ipeak
)
:
IPeak
(
ipeak
),
m_H
(
ipeak
.
getH
()),
m_K
(
ipeak
.
getK
()),
m_L
(
ipeak
.
getL
()),
m_intensity
(
ipeak
.
getIntensity
()),
m_sigmaIntensity
(
ipeak
.
getSigmaIntensity
()),
m_binCount
(
ipeak
.
getBinCount
()),
m_initialEnergy
(
ipeak
.
getInitialEnergy
()),
m_finalEnergy
(
ipeak
.
getFinalEnergy
()),
m_absorptionWeightedPathLength
(
ipeak
.
getAbsorptionWeightedPathLength
()),
m_GoniometerMatrix
(
ipeak
.
getGoniometerMatrix
()),
m_InverseGoniometerMatrix
(
ipeak
.
getGoniometerMatrix
()),
m_runNumber
(
ipeak
.
getRunNumber
()),
m_monitorCount
(
ipeak
.
getMonitorCount
()),
m_row
(
ipeak
.
getRow
()),
m_col
(
ipeak
.
getCol
()),
m_Qsample
(
ipeak
.
getQSampleFrame
()),
m_peakNumber
(
ipeak
.
getPeakNumber
()),
m_intHKL
(
ipeak
.
getIntHKL
()),
m_intMNP
(
ipeak
.
getIntMNP
()),
m_peakShape
(
std
::
make_shared
<
NoShape
>
())
{
convention
=
Kernel
::
ConfigService
::
Instance
().
getString
(
"Q.convention"
);
if
(
fabs
(
m_InverseGoniometerMatrix
.
Invert
())
<
1e-8
)
throw
std
::
invalid_argument
(
"Peak::ctor(): Goniometer matrix must non-singular."
);
}
//----------------------------------------------------------------------------------------------
/** Set the incident wavelength of the neutron. Calculates the energy from this.
* Assumes elastic scattering.
...
...
Framework/DataObjects/test/LeanPeakTest.h
View file @
06d3370c
...
...
@@ -125,4 +125,20 @@ public:
TS_ASSERT_EQUALS
(
p
.
getQLabFrame
(),
p2
.
getQLabFrame
());
TS_ASSERT_EQUALS
(
p
.
getGoniometerMatrix
(),
p2
.
getGoniometerMatrix
());
}
void
test_ConstructorFromIPeakInterface
()
{
// This goniometer should just swap x and y of q
Mantid
::
Kernel
::
Matrix
<
double
>
gon
(
3
,
3
);
gon
[
0
][
1
]
=
1
;
gon
[
1
][
0
]
=
1
;
gon
[
2
][
2
]
=
1
;
LeanPeak
p
(
V3D
(
1
,
2
,
3
),
gon
,
1.
);
const
Mantid
::
Geometry
::
IPeak
&
ipeak
=
p
;
LeanPeak
p2
(
ipeak
);
TS_ASSERT_EQUALS
(
p
.
getQSampleFrame
(),
p2
.
getQSampleFrame
());
TS_ASSERT_EQUALS
(
p
.
getQLabFrame
(),
p2
.
getQLabFrame
());
TS_ASSERT_EQUALS
(
p
.
getGoniometerMatrix
(),
p2
.
getGoniometerMatrix
());
}
};
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