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
bbab8668
Commit
bbab8668
authored
Jan 06, 2020
by
Martyn Gigg
Browse files
Consolidate code relating to Q convention.
Refs #26839
parent
eae063cb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Framework/Crystal/inc/MantidCrystal/PeakAlgorithmHelpers.h
View file @
bbab8668
...
...
@@ -14,6 +14,12 @@ class V3D;
namespace
Mantid
::
Crystal
{
/// return -1 if convention is "Crystallography" and 1 otherwise.
double
qConventionFactor
(
const
std
::
string
&
convention
);
/// convenience overload to pull the convention from the config service
double
qConventionFactor
();
/// Tie together a modulated peak number with its offset
using
MNPOffset
=
std
::
tuple
<
double
,
double
,
double
,
Kernel
::
V3D
>
;
...
...
Framework/Crystal/src/PeakAlgorithmHelpers.cpp
View file @
bbab8668
...
...
@@ -8,16 +8,35 @@
#include
"MantidKernel/ArrayLengthValidator.h"
#include
"MantidKernel/ArrayProperty.h"
#include
"MantidKernel/BoundedValidator.h"
#include
"MantidKernel/ConfigService.h"
#include
"MantidKernel/V3D.h"
using
Mantid
::
Kernel
::
ArrayLengthValidator
;
using
Mantid
::
Kernel
::
ArrayProperty
;
using
Mantid
::
Kernel
::
BoundedValidator
;
using
Mantid
::
Kernel
::
ConfigService
;
using
Mantid
::
Kernel
::
Direction
;
using
Mantid
::
Kernel
::
V3D
;
namespace
Mantid
::
Crystal
{
/**
* @return -1 if Q.convention==Crystallography, else return 1.0
*/
double
qConventionFactor
(
const
std
::
string
&
convention
)
{
if
(
convention
==
"Crystallography"
)
{
return
-
1.0
;
}
return
1.0
;
}
/**
* @return qConventionFactor for Q.convention setting in ConfigService
*/
double
qConventionFactor
()
{
return
qConventionFactor
(
ConfigService
::
Instance
().
getString
(
"Q.convention"
));
}
/**
* Append the common set of properties that relate to modulation vectors
* to the given algorithm
...
...
Framework/Crystal/src/PredictPeaks.cpp
View file @
bbab8668
...
...
@@ -9,6 +9,7 @@
#include
"MantidAPI/MatrixWorkspace.h"
#include
"MantidAPI/Run.h"
#include
"MantidAPI/Sample.h"
#include
"MantidCrystal/PeakAlgorithmHelpers.h"
#include
"MantidGeometry/Crystal/BasicHKLFilters.h"
#include
"MantidGeometry/Crystal/EdgePixel.h"
#include
"MantidGeometry/Crystal/HKLFilterWavelength.h"
...
...
@@ -38,24 +39,11 @@ using namespace Mantid::DataObjects;
using
namespace
Mantid
::
Geometry
;
using
namespace
Mantid
::
Kernel
;
namespace
{
/// Small helper function that return -1 if convention
/// is "Crystallography" and 1 otherwise.
double
get_factor_for_q_convention
(
const
std
::
string
&
convention
)
{
if
(
convention
==
"Crystallography"
)
{
return
-
1.0
;
}
return
1.0
;
}
}
// namespace
/** Constructor
*/
PredictPeaks
::
PredictPeaks
()
:
m_runNumber
(
-
1
),
m_inst
(),
m_pw
(),
m_sfCalculator
(),
m_qConventionFactor
(
get_factor_for_q_convention
(
ConfigService
::
Instance
().
getString
(
"Q.convention"
)))
{
m_qConventionFactor
(
qConventionFactor
())
{
m_refConds
=
getAllReflectionConditions
();
}
...
...
@@ -510,7 +498,7 @@ void PredictPeaks::fillPossibleHKLsUsingPeaksWorkspace(
* for the convention stored in the workspace.
*/
double
peaks_q_convention_factor
=
get_factor_for_q_c
onvention
(
peaksWorkspace
->
getConvention
());
qC
onvention
Factor
(
peaksWorkspace
->
getConvention
());
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
peaksWorkspace
->
getNumberPeaks
());
++
i
)
{
IPeak
&
p
=
peaksWorkspace
->
getPeak
(
i
);
...
...
Framework/Crystal/src/PredictSatellitePeaks.cpp
View file @
bbab8668
...
...
@@ -9,6 +9,7 @@
#include
"MantidAPI/Run.h"
#include
"MantidAPI/Sample.h"
#include
"MantidAPI/WorkspaceFactory.h"
#include
"MantidCrystal/PeakAlgorithmHelpers.h"
#include
"MantidDataObjects/PeaksWorkspace.h"
#include
"MantidGeometry/Crystal/BasicHKLFilters.h"
#include
"MantidGeometry/Crystal/HKLGenerator.h"
...
...
@@ -30,23 +31,11 @@ namespace Crystal {
DECLARE_ALGORITHM
(
PredictSatellitePeaks
)
namespace
{
/// Small helper function that return -1 if convention
/// is "Crystallography" and 1 otherwise.
double
get_factor_for_q_convention
(
const
std
::
string
&
convention
)
{
if
(
convention
==
"Crystallography"
)
{
return
-
1.0
;
}
return
1.0
;
}
}
// namespace
/** Constructor
*/
PredictSatellitePeaks
::
PredictSatellitePeaks
()
:
m_qConventionFactor
(
get_factor_for_q_convention
(
ConfigService
::
Instance
().
getString
(
"Q.convention"
)))
{}
:
m_qConventionFactor
(
qConventionFactor
())
{}
/// Initialise the properties
void
PredictSatellitePeaks
::
init
()
{
...
...
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