Commit c27b46a4 authored by Samuel Jackson's avatar Samuel Jackson
Browse files

Refs #18920 Test integration with InstrumentView

parent 49b979ff
......@@ -3,6 +3,7 @@
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidAPI/Run.h"
#include "MantidAPI/Sample.h"
#include "MantidDataObjects/VirtualPeak.h"
#include "MantidGeometry/Crystal/BasicHKLFilters.h"
#include "MantidGeometry/Crystal/HKLFilterWavelength.h"
#include "MantidGeometry/Crystal/HKLGenerator.h"
......@@ -440,7 +441,23 @@ void PredictPeaks::calculateQAndAddToOutput(const V3D &hkl,
// Add it to the workspace
m_pw->addPeak(p);
} // Detector was found
} else {
auto space = m_inst->getComponentByName("extended-detector-space");
VirtualPeak vp(m_inst, q);
// Only add peaks that hit the detector
vp.setGoniometerMatrix(goniometerMatrix);
// Save the run number found before.
vp.setRunNumber(m_runNumber);
vp.setHKL(hkl * m_qConventionFactor);
if (m_sfCalculator) {
vp.setIntensity(m_sfCalculator->getFSquared(hkl));
}
// Add it to the workspace
m_pw->addPeak(vp);
}
}
} // namespace Mantid
......
......@@ -11,6 +11,11 @@ namespace DataObjects {
class DLLExport VirtualPeak : public Peak {
public:
VirtualPeak() {};
VirtualPeak(const Geometry::Instrument_const_sptr &m_inst,
const Mantid::Kernel::V3D &QLabFrame,
boost::optional<double> detectorDistance = boost::none);
// Override the detector position
Mantid::Kernel::V3D getDetPos() const override;
......
#include "MantidDataObjects/VirtualPeak.h"
#include "MantidKernel/V3D.h"
......@@ -7,8 +6,24 @@ using namespace Mantid::Kernel;
namespace Mantid {
namespace DataObjects {
V3D VirtualPeak::getDetPos() const {
return V3D(0, 0, 0);
}
//----------------------------------------------------------------------------------------------
/** Constructor that uses the Q position of the peak (in the lab frame).
* No detector ID is set.
*
* @param m_inst :: Shared pointer to the instrument for this peak detection
* @param QLabFrame :: Q of the center of the peak, in reciprocal space
* @param detectorDistance :: Optional distance between the sample and the
*detector. Calculated if not explicitly provided.
* Used to give a valid TOF. Default 1.0 meters.
*/
VirtualPeak::VirtualPeak(const Geometry::Instrument_const_sptr &m_inst,
const Mantid::Kernel::V3D &QLabFrame,
boost::optional<double> detectorDistance) : Peak(m_inst, QLabFrame, detectorDistance) {
}
V3D VirtualPeak::getDetPos() const {
return V3D(0, 0, 0);
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment