Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
d81c16c9
Commit
d81c16c9
authored
Mar 11, 2021
by
Jose Borreguero
Browse files
Refs #30857 remove findDetector from the Peak interface
parent
7e4dfc72
Changes
11
Show whitespace changes
Inline
Side-by-side
Framework/Crystal/src/PredictSatellitePeaks.cpp
View file @
d81c16c9
...
...
@@ -35,6 +35,10 @@ using namespace Mantid::Kernel;
namespace
Crystal
{
// handy shortcuts
using
Mantid
::
Geometry
::
IPeak_uptr
;
using
Mantid
::
DataObjects
::
Peak_uptr
;
DECLARE_ALGORITHM
(
PredictSatellitePeaks
)
/** Constructor
...
...
@@ -358,7 +362,8 @@ void PredictSatellitePeaks::predictOffsets(
if
(
Qs
.
Z
()
*
m_qConventionFactor
<=
0
)
continue
;
auto
peak
(
Peaks
->
createPeak
(
Qs
,
1
));
IPeak_uptr
iPeak
=
Peaks
->
createPeak
(
Qs
,
1
);
Peak_uptr
peak
(
static_cast
<
DataObjects
::
Peak
*>
(
iPeak
.
release
()));
peak
->
setGoniometerMatrix
(
goniometer
);
...
...
@@ -430,7 +435,8 @@ void PredictSatellitePeaks::predictOffsetsWithCrossTerms(
if
(
Qs
.
Z
()
*
m_qConventionFactor
<=
0
)
continue
;
auto
peak
(
Peaks
->
createPeak
(
Qs
,
1
));
IPeak_uptr
iPeak
(
Peaks
->
createPeak
(
Qs
,
1
));
Peak_uptr
peak
(
static_cast
<
DataObjects
::
Peak
*>
(
iPeak
.
release
()));
peak
->
setGoniometerMatrix
(
goniometer
);
...
...
Framework/DataObjects/inc/MantidDataObjects/LeanElasticPeak.h
View file @
d81c16c9
...
...
@@ -69,8 +69,10 @@ public:
std
::
shared_ptr
<
const
Geometry
::
ReferenceFrame
>
getReferenceFrame
()
const
override
;
/*
bool findDetector() override;
bool findDetector(const Geometry::InstrumentRayTracer &) override;
*/
void
setSamplePos
(
double
,
double
,
double
)
override
;
void
setSamplePos
(
const
Mantid
::
Kernel
::
V3D
&
)
override
;
...
...
Framework/DataObjects/inc/MantidDataObjects/Peak.h
View file @
d81c16c9
...
...
@@ -88,8 +88,12 @@ public:
std
::
shared_ptr
<
const
Geometry
::
ReferenceFrame
>
getReferenceFrame
()
const
override
;
/*
bool findDetector() override;
bool findDetector(const Geometry::InstrumentRayTracer &tracer) override;
*/
bool
findDetector
();
bool
findDetector
(
const
Geometry
::
InstrumentRayTracer
&
tracer
);
void
setSamplePos
(
double
samX
,
double
samY
,
double
samZ
)
override
;
void
setSamplePos
(
const
Mantid
::
Kernel
::
V3D
&
XYZ
)
override
;
...
...
@@ -163,5 +167,7 @@ private:
static
Mantid
::
Kernel
::
Logger
g_log
;
};
using
Peak_uptr
=
std
::
unique_ptr
<
Peak
>
;
}
// namespace DataObjects
}
// namespace Mantid
Framework/DataObjects/src/LeanElasticPeak.cpp
View file @
d81c16c9
...
...
@@ -345,10 +345,12 @@ LeanElasticPeak &LeanElasticPeak::operator=(const LeanElasticPeak &other) {
*
* @return true if the detector ID was found.
*/
/*
bool LeanElasticPeak::findDetector() {
throw Exception::NotImplementedError(
"LeanElasticPeak has no detector information");
}
*/
/**
* Performs the same algorithm as findDetector() but uses a pre-existing
...
...
@@ -357,10 +359,12 @@ bool LeanElasticPeak::findDetector() {
* over the same instrument.
* @return true if the detector ID was found.
*/
/*
bool LeanElasticPeak::findDetector(const InstrumentRayTracer &) {
throw Exception::NotImplementedError(
"LeanElasticPeak has no detector information");
}
*/
/**
Forwarding function. Exposes the detector position directly.
...
...
Framework/DataObjects/src/PeaksWorkspace.cpp
View file @
d81c16c9
...
...
@@ -390,7 +390,9 @@ PeaksWorkspace::peakInfo(const Kernel::V3D &qFrame, bool labCoords) const {
}
try
{
auto
peak
=
createPeak
(
Qlab
);
IPeak_uptr
iPeak
=
createPeak
(
Qlab
);
Peak_uptr
peak
(
static_cast
<
DataObjects
::
Peak
*>
(
iPeak
.
release
()));
if
(
sample
().
hasOrientedLattice
())
{
peak
->
setGoniometerMatrix
(
Gon
);
...
...
Framework/DataObjects/test/LeanElasticPeakTest.h
View file @
d81c16c9
...
...
@@ -41,7 +41,9 @@ public:
TS_ASSERT_EQUALS
(
p
.
getDetectorID
(),
-
1
)
TS_ASSERT_THROWS
(
p
.
getDetector
(),
const
Exception
::
NotImplementedError
&
)
TS_ASSERT_THROWS
(
p
.
getInstrument
(),
const
Exception
::
NotImplementedError
&
)
/*
TS_ASSERT_THROWS(p.findDetector(), const Exception::NotImplementedError &)
*/
TS_ASSERT_THROWS
(
p
.
getDetectorPosition
(),
const
Exception
::
NotImplementedError
&
)
TS_ASSERT_THROWS
(
p
.
getDetectorPositionNoCheck
(),
...
...
Framework/Geometry/inc/MantidGeometry/Crystal/IPeak.h
View file @
d81c16c9
...
...
@@ -62,9 +62,10 @@ public:
virtual
Mantid
::
Kernel
::
V3D
getQLabFrame
()
const
=
0
;
virtual
Mantid
::
Kernel
::
V3D
getQSampleFrame
()
const
=
0
;
/*
virtual bool findDetector() = 0;
virtual bool findDetector(const InstrumentRayTracer &tracer) = 0;
*/
virtual
void
setQSampleFrame
(
const
Mantid
::
Kernel
::
V3D
&
QSampleFrame
,
boost
::
optional
<
double
>
detectorDistance
)
=
0
;
virtual
void
setQLabFrame
(
const
Mantid
::
Kernel
::
V3D
&
QLabFrame
,
...
...
@@ -116,5 +117,7 @@ public:
virtual
double
getAbsorptionWeightedPathLength
()
const
=
0
;
};
using
IPeak_uptr
=
std
::
unique_ptr
<
IPeak
>
;
}
// namespace Geometry
}
// namespace Mantid
Framework/Geometry/test/MockObjects.h
View file @
d81c16c9
...
...
@@ -97,9 +97,11 @@ public:
MOCK_METHOD1
(
setSamplePos
,
void
(
const
Mantid
::
Kernel
::
V3D
&
XYZ
));
MOCK_CONST_METHOD0
(
getQLabFrame
,
Mantid
::
Kernel
::
V3D
());
MOCK_CONST_METHOD0
(
getQSampleFrame
,
Mantid
::
Kernel
::
V3D
());
/*
MOCK_METHOD0(findDetector, bool());
MOCK_METHOD1(findDetector,
bool(const Mantid::Geometry::InstrumentRayTracer &tracer));
*/
MOCK_METHOD2
(
setQSampleFrame
,
void
(
const
Mantid
::
Kernel
::
V3D
&
QSampleFrame
,
boost
::
optional
<
double
>
detectorDistance
));
MOCK_METHOD2
(
setQLabFrame
,
void
(
const
Mantid
::
Kernel
::
V3D
&
QLabFrame
,
...
...
Framework/MDAlgorithms/src/CentroidPeaksMD.cpp
View file @
d81c16c9
...
...
@@ -99,8 +99,7 @@ void CentroidPeaksMD::integrate(typename MDEventWorkspace<MDE, nd>::sptr ws) {
// cppcheck-suppress syntaxError
PRAGMA_OMP
(
parallel
for
schedule
(
dynamic
,
10
)
)
for
(
int
i
=
0
;
i
<
int
(
peakWS
->
getNumberPeaks
());
++
i
)
{
// Get a direct ref to that peak.
IPeak
&
p
=
peakWS
->
getPeak
(
i
);
Peak
&
p
=
peakWS
->
getPeak
(
i
);
double
detectorDistance
=
p
.
getL2
();
// Get the peak center as a position in the dimensions of the workspace
...
...
Framework/MDAlgorithms/src/CentroidPeaksMD2.cpp
View file @
d81c16c9
...
...
@@ -83,7 +83,7 @@ void CentroidPeaksMD2::integrate(typename MDEventWorkspace<MDE, nd>::sptr ws) {
PRAGMA_OMP
(
parallel
for
schedule
(
dynamic
,
10
)
)
for
(
int
i
=
0
;
i
<
int
(
peakWS
->
getNumberPeaks
());
++
i
)
{
// Get a direct ref to that peak.
I
Peak
&
p
=
peakWS
->
getPeak
(
i
);
Peak
&
p
=
peakWS
->
getPeak
(
i
);
double
detectorDistance
=
p
.
getL2
();
// Get the peak center as a position in the dimensions of the workspace
...
...
Framework/PythonInterface/mantid/api/src/Exports/IPeak.cpp
View file @
d81c16c9
...
...
@@ -123,11 +123,13 @@ void export_IPeak() {
":class:`~mantid.geometry.Goniometer` rotation was NOT taken "
"out.
\n
"
"Note: There is no 2*pi factor used, so
\\
|Q| = 1/wavelength."
)
/*
.def("findDetector", (bool (IPeak::*)()) & IPeak::findDetector,
arg("self"),
"Using the :class:`~mantid.geometry.Instrument` set in the peak, "
"perform ray tracing to find "
"the exact :class:`~mantid.geometry.Detector`.")
*/
.
def
(
"getQSampleFrame"
,
&
IPeak
::
getQSampleFrame
,
arg
(
"self"
),
"Return the Q change (of the lattice, k_i - k_f) for this peak."
"The Q is in the Sample frame: the "
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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