23 const double extraLength)
24 : m_samplePos(spectrumInfo.samplePosition()), m_beamLine(m_samplePos - spectrumInfo.sourcePosition()),
25 m_beamLineNorm(2.0 * spectrumInfo.l1()), m_dropPerAngstrom2(-1), m_cachedDrop(0) {
52 const double phi = atan2(detPos.
Y(), detPos.
X());
81 return sqrt(0.5 - halfcosTheta);
103 const auto pathLengthWithExtraLength =
l2 + extraLength;
104 const auto pathLengthSquared = std::pow(pathLengthWithExtraLength, 2) - std::pow(extraLength, 2);
107 const double L2 = gm2_OVER_2h2 * pathLengthSquared;
109 return waveLength * waveLength * L2;
std::map< DeltaEMode::Type, std::string > index
API::SpectrumInfo is an intermediate step towards a SpectrumInfo that is part of Instrument-2....
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).
double m_dropPerAngstrom2
the drop is proportional to the wavelength squared, storing this drop increases calculation speed a l...
double m_cachedDrop
the drop that was last caclulated, this allows m_cachedDetLoc to be recalculated each time without it...
Kernel::V3D m_cachedLineOfSight
the location that the neutron would have been detected at if it continued in a straight line,...
double gravitationalDrop(const double wav) const
double calcSinTheta() const
getDetLoc must have been called before this is used to calculate the sin of the angle
const Kernel::V3D & getDetLoc(const double wav) const
Finds the location of the detector the neutron would have entered if it followed a straight line path...
Kernel::V3D m_samplePos
coordinates of the sample
double m_beamLineNorm
twice the distance from the source to the sample
double calcComponents(const double wavAngstroms, double &xFrac, double &yFrac) const
Calculate the sins and cosins of angles as required to calculate Q is 2 dimensions.
Kernel::V3D m_beamLine
the displacement from the source to the sample
constexpr double scalar_prod(const V3D &v) const noexcept
Calculates the cross product.
constexpr double X() const noexcept
Get x.
constexpr double Y() const noexcept
Get y.
double norm() const noexcept
A namespace containing physical constants that are required by algorithms and unit routines.
static constexpr double NeutronMass
Mass of the neutron in kg.
static constexpr double h
Planck constant in J*s.
static constexpr double g
Standard acceleration due to gravity.