Mantid
|
A helper class for calculating neutron's gravitional drop. More...
#include <GravitySANSHelper.h>
Public Member Functions | |
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. More... | |
double | calcSinTheta (const double wavAngstroms) const |
Caclulates the sin of the that the neutron left the sample at, before the effect of gravity. More... | |
double | gravitationalDrop (const double wav) const |
GravitySANSHelper () | |
GravitySANSHelper (const API::SpectrumInfo &spectrumInfo, const size_t index, const double extraLength=0.0) | |
sets up the object with workspace data and calculates cached values ready to calculate gravitional effects across a spectrum More... | |
Private Member Functions | |
double | calcSinTheta () const |
getDetLoc must have been called before this is used to calculate the sin of the angle More... | |
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 from the sample. More... | |
double | gravitationalDrop (const double L2, const double waveLength, const double extraLength) const |
Calculates the distance a neutron coming from the sample will have deviated from a straight tragetory before hitting a detector. More... | |
Private Attributes | |
Kernel::V3D | m_beamLine |
the displacement from the source to the sample More... | |
double | m_beamLineNorm |
twice the distance from the source to the sample More... | |
double | m_cachedDrop |
the drop that was last caclulated, this allows m_cachedDetLoc to be recalculated each time without its original value being stored More... | |
Kernel::V3D | m_cachedLineOfSight |
the location that the neutron would have been detected at if it continued in a straight line, without gravity More... | |
double | m_dropPerAngstrom2 |
the drop is proportional to the wavelength squared, storing this drop increases calculation speed a lot More... | |
Kernel::V3D | m_samplePos |
coordinates of the sample More... | |
A helper class for calculating neutron's gravitional drop.
Only works for SANS because Mantid has no convention on which was is up or down. For this to work y must increase with distance from the earth
Definition at line 22 of file GravitySANSHelper.h.
|
inline |
Definition at line 24 of file GravitySANSHelper.h.
Mantid::Algorithms::GravitySANSHelper::GravitySANSHelper | ( | const API::SpectrumInfo & | spectrumInfo, |
const size_t | index, | ||
const double | extraLength = 0.0 |
||
) |
sets up the object with workspace data and calculates cached values ready to calculate gravitional effects across a spectrum
spectrumInfo | :: SpectrumInfo of workspace |
index | :: Workspace index of spectrum to do the calculation for |
extraLength | :: extra length for gravity correction |
Definition at line 22 of file GravitySANSHelper.cpp.
References gravitationalDrop(), index, Mantid::API::SpectrumInfo::l2(), m_cachedLineOfSight, m_dropPerAngstrom2, m_samplePos, and Mantid::API::SpectrumInfo::position().
double Mantid::Algorithms::GravitySANSHelper::calcComponents | ( | const double | wavAngstroms, |
double & | xFrac, | ||
double & | yFrac | ||
) | const |
Calculate the sins and cosins of angles as required to calculate Q is 2 dimensions.
[in] | wavAngstroms | wavelength of the neutron in Angstrom |
[out] | xFrac | the component in the x direction |
[out] | yFrac | component in the y direction |
Definition at line 49 of file GravitySANSHelper.cpp.
References calcSinTheta(), getDetLoc(), Mantid::Kernel::V3D::X(), and Mantid::Kernel::V3D::Y().
Referenced by Mantid::Algorithms::Qxy::exec().
|
private |
getDetLoc must have been called before this is used to calculate the sin of the angle
Definition at line 77 of file GravitySANSHelper.cpp.
References m_beamLine, m_beamLineNorm, m_cachedLineOfSight, Mantid::Kernel::V3D::norm(), and Mantid::Kernel::V3D::scalar_prod().
Referenced by calcComponents(), and calcSinTheta().
double Mantid::Algorithms::GravitySANSHelper::calcSinTheta | ( | const double | wavAngstroms | ) | const |
Caclulates the sin of the that the neutron left the sample at, before the effect of gravity.
wavAngstroms | :: the neutrons' wave length in Angstoms |
Definition at line 38 of file GravitySANSHelper.cpp.
References calcSinTheta(), and getDetLoc().
Referenced by Mantid::Algorithms::Q1D2::convertWavetoQ().
|
private |
Finds the location of the detector the neutron would have entered if it followed a straight line path from the sample.
wav | :: wavelength of the neutron in Angstrom |
Definition at line 63 of file GravitySANSHelper.cpp.
References gravitationalDrop(), m_cachedDrop, and m_cachedLineOfSight.
Referenced by calcComponents(), and calcSinTheta().
|
private |
Calculates the distance a neutron coming from the sample will have deviated from a straight tragetory before hitting a detector.
If calling this function many times for the same detector you can call this function once, with waveLength=1, and use the fact drop is proportional to wave length squared .This function has no knowledge of which axis is vertical for a given instrument
l2 | :: distance between sample and detector the neutron entered |
waveLength | :: the neutrons wave length in meters |
extraLength | :: additional length |
Pre-factor in gravity calculation: gm^2/2h^2
Definition at line 96 of file GravitySANSHelper.cpp.
References Mantid::PhysicalConstants::g, Mantid::PhysicalConstants::h, Mantid::Kernel::l2, and Mantid::PhysicalConstants::NeutronMass.
|
inline |
Definition at line 29 of file GravitySANSHelper.h.
References m_dropPerAngstrom2.
Referenced by Mantid::Algorithms::Q1DWeighted::calculate(), getDetLoc(), and GravitySANSHelper().
|
private |
the displacement from the source to the sample
Definition at line 35 of file GravitySANSHelper.h.
Referenced by calcSinTheta().
|
private |
twice the distance from the source to the sample
Definition at line 37 of file GravitySANSHelper.h.
Referenced by calcSinTheta().
|
mutableprivate |
the drop that was last caclulated, this allows m_cachedDetLoc to be recalculated each time without its original value being stored
Definition at line 47 of file GravitySANSHelper.h.
Referenced by getDetLoc().
|
mutableprivate |
the location that the neutron would have been detected at if it continued in a straight line, without gravity
Definition at line 44 of file GravitySANSHelper.h.
Referenced by calcSinTheta(), getDetLoc(), and GravitySANSHelper().
|
private |
the drop is proportional to the wavelength squared, storing this drop increases calculation speed a lot
Definition at line 41 of file GravitySANSHelper.h.
Referenced by gravitationalDrop(), and GravitySANSHelper().
|
private |
coordinates of the sample
Definition at line 33 of file GravitySANSHelper.h.
Referenced by GravitySANSHelper().