30 : m_spectrumInfo(ws->spectrumInfo()), m_L1s(m_spectrumInfo.l1()),
31 m_beamDir(ws->componentInfo().referenceFrame()->vecPointingAlongBeam()), m_componentInfo(ws->componentInfo()),
32 m_detectorInfo(ws->detectorInfo()) {}
44 const auto noEfixed = [&]() {
45 std::stringstream errmsg;
46 errmsg <<
"Inelastic instrument detector " <<
m_detectorInfo.
detid(detIndex) <<
" of spectrum " << workspace_index
47 <<
" does not have EFixed ";
48 return std::runtime_error(errmsg.str());
56 if (!values.empty()) {
59 }
catch (std::runtime_error &) {
79 const double scale = std::abs(
m_L1s / L1m);
82 const double efix = this->
getEfixed(workspace_index);
84 const double shift = -1. *
l2 / sqrt(efix * TWO_MEV_OVER_MASS);
87 constexpr double NO_MULTIPLY_TOF{1.};
bool isMonitor(const size_t index) const
Returns true if the detector(s) associated with the spectrum are monitors.
Kernel::V3D sourcePosition() const
Returns the source position.
bool hasDetectors(const size_t index) const
Returns true if the spectrum is associated with detectors in the instrument.
Kernel::V3D position(const size_t index) const
Returns the position of the spectrum with given index.
double l2(const size_t index) const
Returns L2 (distance from sample to spectrum).
bool hasUniqueDetector(const size_t index) const
Returns true if the spectrum is associated with exactly one detector.
const SpectrumDefinition & spectrumDefinition(const size_t index) const
Returns a const reference to the SpectrumDefinition of the spectrum.
Correction calculate(const size_t &workspace_index) const override
double getEfixed(const size_t &workspace_index) const
This will throw an exception if efixed is not found or negative.
const API::SpectrumInfo & m_spectrumInfo
const Geometry::DetectorInfo & m_detectorInfo
const Kernel::V3D m_beamDir
const Geometry::ComponentInfo & m_componentInfo
TimeAtSampleStrategyIndirect(std::shared_ptr< const Mantid::API::MatrixWorkspace > ws)
Constructor.
std::vector< double > getNumberParameter(const size_t componentIndex, const std::string &name, bool recursive=true) const
detid_t detid(const size_t index) const
Returns the detector ID for the given logical detector index.
Exception for when an item is not found in a collection.
constexpr double scalar_prod(const V3D &v) const noexcept
Calculates the cross product.
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
static constexpr double NeutronMass
Mass of the neutron in kg.
static constexpr double meV
1 meV in Joules.
std::string to_string(const wide_integer< Bits, Signed > &n)
The Correction struct to be applied as factor * TOF + offset multiplicativeFactor: TOF correction fac...