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
f9415307
Commit
f9415307
authored
Mar 01, 2021
by
Whitfield, Ross
Browse files
Move goniometer back to private and use getters
parent
74ff5a61
Changes
4
Hide whitespace changes
Inline
Side-by-side
Framework/DataObjects/inc/MantidDataObjects/BasePeak.h
View file @
f9415307
...
...
@@ -103,6 +103,7 @@ public:
void
setBinCount
(
double
m_binCount
)
override
;
Mantid
::
Kernel
::
Matrix
<
double
>
getGoniometerMatrix
()
const
override
;
Mantid
::
Kernel
::
Matrix
<
double
>
getInverseGoniometerMatrix
()
const
;
void
setGoniometerMatrix
(
const
Mantid
::
Kernel
::
Matrix
<
double
>
&
goniometerMatrix
)
override
;
...
...
@@ -131,14 +132,6 @@ public:
void
setAbsorptionWeightedPathLength
(
double
pathLength
)
override
;
double
getAbsorptionWeightedPathLength
()
const
override
;
protected:
/// Orientation matrix of the goniometer angles.
Mantid
::
Kernel
::
Matrix
<
double
>
m_GoniometerMatrix
;
/// Inverse of the goniometer rotation matrix; used to go from Q in lab frame
/// to Q in sample frame
Mantid
::
Kernel
::
Matrix
<
double
>
m_InverseGoniometerMatrix
;
private:
/// Name of the parent bank
std
::
string
m_bankName
;
...
...
@@ -170,6 +163,13 @@ private:
/// absorption weighted path length (aka t bar)
double
m_absorptionWeightedPathLength
;
/// Orientation matrix of the goniometer angles.
Mantid
::
Kernel
::
Matrix
<
double
>
m_GoniometerMatrix
;
/// Inverse of the goniometer rotation matrix; used to go from Q in lab frame
/// to Q in sample frame
Mantid
::
Kernel
::
Matrix
<
double
>
m_InverseGoniometerMatrix
;
/// Originating run number for this peak
int
m_runNumber
;
...
...
Framework/DataObjects/src/BasePeak.cpp
View file @
f9415307
...
...
@@ -31,10 +31,10 @@ namespace DataObjects {
//----------------------------------------------------------------------------------------------
/** Default constructor */
BasePeak
::
BasePeak
()
:
m_GoniometerMatrix
(
3
,
3
,
true
),
m_InverseGoniometerMatrix
(
3
,
3
,
true
),
m_H
(
0
),
m_K
(
0
),
m_L
(
0
),
m_intensity
(
0
),
m_sigmaIntensity
(
0
),
:
m_H
(
0
),
m_K
(
0
),
m_L
(
0
),
m_intensity
(
0
),
m_sigmaIntensity
(
0
),
m_binCount
(
0
),
m_initialEnergy
(
0.
),
m_finalEnergy
(
0.
),
m_absorptionWeightedPathLength
(
0
),
m_runNumber
(
0
),
m_monitorCount
(
0
),
m_absorptionWeightedPathLength
(
0
),
m_GoniometerMatrix
(
3
,
3
,
true
),
m_InverseGoniometerMatrix
(
3
,
3
,
true
),
m_runNumber
(
0
),
m_monitorCount
(
0
),
m_row
(
-
1
),
m_col
(
-
1
),
m_peakNumber
(
0
),
m_intHKL
(
V3D
(
0
,
0
,
0
)),
m_intMNP
(
V3D
(
0
,
0
,
0
)),
m_peakShape
(
std
::
make_shared
<
NoShape
>
())
{}
...
...
@@ -45,10 +45,10 @@ BasePeak::BasePeak()
*/
BasePeak
::
BasePeak
(
const
Mantid
::
Kernel
::
Matrix
<
double
>
&
goniometer
)
:
m_GoniometerMatrix
(
goniometer
),
m_InverseGoniometerMatrix
(
goniometer
),
m_H
(
0
),
m_K
(
0
),
m_L
(
0
),
m_intensity
(
0
),
m_sigmaIntensity
(
0
),
:
m_H
(
0
),
m_K
(
0
),
m_L
(
0
),
m_intensity
(
0
),
m_sigmaIntensity
(
0
),
m_binCount
(
0
),
m_initialEnergy
(
0.
),
m_finalEnergy
(
0.
),
m_absorptionWeightedPathLength
(
0
),
m_runNumber
(
0
),
m_monitorCount
(
0
),
m_absorptionWeightedPathLength
(
0
),
m_GoniometerMatrix
(
goniometer
),
m_InverseGoniometerMatrix
(
goniometer
),
m_runNumber
(
0
),
m_monitorCount
(
0
),
m_row
(
-
1
),
m_col
(
-
1
),
m_peakNumber
(
0
),
m_intHKL
(
V3D
(
0
,
0
,
0
)),
m_intMNP
(
V3D
(
0
,
0
,
0
)),
m_peakShape
(
std
::
make_shared
<
NoShape
>
())
{
if
(
fabs
(
m_InverseGoniometerMatrix
.
Invert
())
<
1e-8
)
...
...
@@ -57,14 +57,14 @@ BasePeak::BasePeak(const Mantid::Kernel::Matrix<double> &goniometer)
}
BasePeak
::
BasePeak
(
const
BasePeak
&
other
)
:
m_GoniometerMatrix
(
other
.
m_GoniometerMatrix
),
m_InverseGoniometerMatrix
(
other
.
m_InverseGoniometerMatrix
),
m_bankName
(
other
.
m_bankName
),
m_H
(
other
.
m_H
),
m_K
(
other
.
m_K
),
:
m_bankName
(
other
.
m_bankName
),
m_H
(
other
.
m_H
),
m_K
(
other
.
m_K
),
m_L
(
other
.
m_L
),
m_intensity
(
other
.
m_intensity
),
m_sigmaIntensity
(
other
.
m_sigmaIntensity
),
m_binCount
(
other
.
m_binCount
),
m_initialEnergy
(
other
.
m_initialEnergy
),
m_finalEnergy
(
other
.
m_finalEnergy
),
m_absorptionWeightedPathLength
(
other
.
m_absorptionWeightedPathLength
),
m_GoniometerMatrix
(
other
.
m_GoniometerMatrix
),
m_InverseGoniometerMatrix
(
other
.
m_InverseGoniometerMatrix
),
m_runNumber
(
other
.
m_runNumber
),
m_monitorCount
(
other
.
m_monitorCount
),
m_row
(
other
.
m_row
),
m_col
(
other
.
m_col
),
m_peakNumber
(
other
.
m_peakNumber
),
m_intHKL
(
other
.
m_intHKL
),
m_intMNP
(
other
.
m_intMNP
),
...
...
@@ -74,17 +74,17 @@ BasePeak::BasePeak(const BasePeak &other)
/** Constructor making a LeanPeak from IPeak interface
*
* @param ipeak :: const reference to an IPeak object
* @return
*/
BasePeak
::
BasePeak
(
const
Geometry
::
IPeak
&
ipeak
)
:
IPeak
(
ipeak
),
m_GoniometerMatrix
(
ipeak
.
getGoniometerMatrix
()),
m_InverseGoniometerMatrix
(
ipeak
.
getGoniometerMatrix
()),
m_H
(
ipeak
.
getH
()),
m_K
(
ipeak
.
getK
()),
m_L
(
ipeak
.
getL
()),
m_intensity
(
ipeak
.
getIntensity
()),
:
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_peakNumber
(
ipeak
.
getPeakNumber
()),
...
...
@@ -287,6 +287,12 @@ Mantid::Kernel::Matrix<double> BasePeak::getGoniometerMatrix() const {
return
this
->
m_GoniometerMatrix
;
}
// -------------------------------------------------------------------------------------
/** Get the goniometer rotation matrix at which this peak was measured. */
Mantid
::
Kernel
::
Matrix
<
double
>
BasePeak
::
getInverseGoniometerMatrix
()
const
{
return
this
->
m_InverseGoniometerMatrix
;
}
/** Set the goniometer rotation matrix at which this peak was measured.
* @param goniometerMatrix :: 3x3 matrix that represents the rotation matrix of
* the goniometer
...
...
Framework/DataObjects/src/LeanPeak.cpp
View file @
f9415307
...
...
@@ -64,6 +64,7 @@ LeanPeak::LeanPeak(const Mantid::Kernel::V3D &QSampleFrame,
*
* @param QSampleFrame :: Q of the center of the peak, in reciprocal space, in
*the sample frame (goniometer rotation accounted for).
* @param wavelength :: wavelength in Angstroms.
*/
LeanPeak
::
LeanPeak
(
const
Mantid
::
Kernel
::
V3D
&
QSampleFrame
,
double
wavelength
)
:
BasePeak
()
{
...
...
@@ -77,6 +78,7 @@ LeanPeak::LeanPeak(const Mantid::Kernel::V3D &QSampleFrame, double wavelength)
*
* @param QSampleFrame :: Q of the center of the peak, in reciprocal space
* @param goniometer :: a 3x3 rotation matrix
* @param wavelength :: wavelength in Angstroms.
*/
LeanPeak
::
LeanPeak
(
const
Mantid
::
Kernel
::
V3D
&
QSampleFrame
,
const
Mantid
::
Kernel
::
Matrix
<
double
>
&
goniometer
,
...
...
@@ -89,7 +91,6 @@ LeanPeak::LeanPeak(const Mantid::Kernel::V3D &QSampleFrame,
/**
* @brief Copy constructor
* @param other : Source
* @return
*/
LeanPeak
::
LeanPeak
(
const
LeanPeak
&
other
)
:
BasePeak
(
other
),
m_Qsample
(
other
.
m_Qsample
)
{}
...
...
@@ -98,7 +99,6 @@ LeanPeak::LeanPeak(const LeanPeak &other)
/** Constructor making a LeanPeak from IPeak interface
*
* @param ipeak :: const reference to an IPeak object
* @return
*/
LeanPeak
::
LeanPeak
(
const
Geometry
::
IPeak
&
ipeak
)
:
BasePeak
(
ipeak
),
m_Qsample
(
ipeak
.
getQSampleFrame
())
{}
...
...
@@ -174,7 +174,7 @@ 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
{
return
m_
GoniometerMatrix
*
m_Qsample
;
return
get
GoniometerMatrix
()
*
m_Qsample
;
}
//----------------------------------------------------------------------------------------------
...
...
@@ -192,6 +192,7 @@ Mantid::Kernel::V3D LeanPeak::getQSampleFrame() const { return m_Qsample; }
* @param QSampleFrame :: Q of the center of the peak, in reciprocal space
* This is in inelastic convention: momentum transfer of the LATTICE!
* Also, q does NOT have a 2pi factor = it is equal to 1/wavelength.
* @param detectorDistance :: unused
*/
void
LeanPeak
::
setQSampleFrame
(
const
Mantid
::
Kernel
::
V3D
&
QSampleFrame
,
...
...
@@ -210,15 +211,16 @@ void LeanPeak::setQSampleFrame(
* @param qLab :: Q of the center of the peak, in reciprocal space.
* This is in inelastic convention: momentum transfer of the LATTICE!
* Also, q does have a 2pi factor = it is equal to 2pi/wavelength (in
*Angstroms).
*
Angstroms).
* @param detectorDistance :: distance between the sample and the detector. If
*this is provided. Then we do not
* ray trace to find the intersecing detector.
* this is provided. Then we do not ray trace to find the intersecing
*detector.
* @param detectorDistance :: unused
*/
void
LeanPeak
::
setQLabFrame
(
const
Mantid
::
Kernel
::
V3D
&
qLab
,
[[
maybe_unused
]]
boost
::
optional
<
double
>
detectorDistance
)
{
this
->
setQSampleFrame
(
m_
InverseGoniometerMatrix
*
qLab
);
this
->
setQSampleFrame
(
get
InverseGoniometerMatrix
()
*
qLab
);
}
/** Set sample position
...
...
Framework/DataObjects/src/Peak.cpp
View file @
f9415307
...
...
@@ -172,9 +172,6 @@ Peak::Peak(const Peak &other)
Peak
::
Peak
(
const
Geometry
::
IPeak
&
ipeak
)
:
BasePeak
(
ipeak
),
m_detectorID
(
ipeak
.
getDetectorID
())
{
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."
);
setInstrument
(
ipeak
.
getInstrument
());
detid_t
id
=
ipeak
.
getDetectorID
();
if
(
id
>=
0
)
{
...
...
@@ -413,7 +410,7 @@ Mantid::Kernel::V3D Peak::getQLabFrame() const {
Mantid
::
Kernel
::
V3D
Peak
::
getQSampleFrame
()
const
{
V3D
Qlab
=
this
->
getQLabFrame
();
// Multiply by the inverse of the goniometer matrix to get the sample frame
V3D
Qsample
=
m_
InverseGoniometerMatrix
*
Qlab
;
V3D
Qsample
=
get
InverseGoniometerMatrix
()
*
Qlab
;
return
Qsample
;
}
...
...
@@ -432,7 +429,7 @@ Mantid::Kernel::V3D Peak::getQSampleFrame() const {
*/
void
Peak
::
setQSampleFrame
(
const
Mantid
::
Kernel
::
V3D
&
QSampleFrame
,
boost
::
optional
<
double
>
detectorDistance
)
{
V3D
Qlab
=
m_
GoniometerMatrix
*
QSampleFrame
;
V3D
Qlab
=
get
GoniometerMatrix
()
*
QSampleFrame
;
this
->
setQLabFrame
(
Qlab
,
detectorDistance
);
}
...
...
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