Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Mantid::Algorithms::GravitySANSHelper Class Reference

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::V3DgetDetLoc (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...
 

Detailed Description

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

Author
Steve Williams, ISIS Rutherford Appleton Laboratory
Date
26/01/2009

Definition at line 22 of file GravitySANSHelper.h.

Constructor & Destructor Documentation

◆ GravitySANSHelper() [1/2]

Mantid::Algorithms::GravitySANSHelper::GravitySANSHelper ( )
inline

Definition at line 24 of file GravitySANSHelper.h.

◆ GravitySANSHelper() [2/2]

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

Parameters
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().

Member Function Documentation

◆ calcComponents()

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.

Parameters
[in]wavAngstromswavelength of the neutron in Angstrom
[out]xFracthe component in the x direction
[out]yFraccomponent in the y direction
Returns
sin of the angle theta to the detector

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().

◆ calcSinTheta() [1/2]

double Mantid::Algorithms::GravitySANSHelper::calcSinTheta ( ) const
private

getDetLoc must have been called before this is used to calculate the sin of the angle

Returns
the sin of theta

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().

◆ calcSinTheta() [2/2]

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.

Parameters
wavAngstroms:: the neutrons' wave length in Angstoms
Returns
the sin of theta

Definition at line 38 of file GravitySANSHelper.cpp.

References calcSinTheta(), and getDetLoc().

Referenced by Mantid::Algorithms::Q1D2::convertWavetoQ().

◆ getDetLoc()

const V3D & Mantid::Algorithms::GravitySANSHelper::getDetLoc ( const double  wav) const
private

Finds the location of the detector the neutron would have entered if it followed a straight line path from the sample.

Parameters
wav:: wavelength of the neutron in Angstrom
Returns
a reference to the cached location

Definition at line 63 of file GravitySANSHelper.cpp.

References gravitationalDrop(), m_cachedDrop, and m_cachedLineOfSight.

Referenced by calcComponents(), and calcSinTheta().

◆ gravitationalDrop() [1/2]

double Mantid::Algorithms::GravitySANSHelper::gravitationalDrop ( const double  l2,
const double  waveLength,
const double  extraLength 
) const
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

Parameters
l2:: distance between sample and detector the neutron entered
waveLength:: the neutrons wave length in meters
extraLength:: additional length
Returns
the deviation in meters

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.

◆ gravitationalDrop() [2/2]

double Mantid::Algorithms::GravitySANSHelper::gravitationalDrop ( const double  wav) const
inline

Member Data Documentation

◆ m_beamLine

Kernel::V3D Mantid::Algorithms::GravitySANSHelper::m_beamLine
private

the displacement from the source to the sample

Definition at line 35 of file GravitySANSHelper.h.

Referenced by calcSinTheta().

◆ m_beamLineNorm

double Mantid::Algorithms::GravitySANSHelper::m_beamLineNorm
private

twice the distance from the source to the sample

Definition at line 37 of file GravitySANSHelper.h.

Referenced by calcSinTheta().

◆ m_cachedDrop

double Mantid::Algorithms::GravitySANSHelper::m_cachedDrop
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().

◆ m_cachedLineOfSight

Kernel::V3D Mantid::Algorithms::GravitySANSHelper::m_cachedLineOfSight
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().

◆ m_dropPerAngstrom2

double Mantid::Algorithms::GravitySANSHelper::m_dropPerAngstrom2
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().

◆ m_samplePos

Kernel::V3D Mantid::Algorithms::GravitySANSHelper::m_samplePos
private

coordinates of the sample

Definition at line 33 of file GravitySANSHelper.h.

Referenced by GravitySANSHelper().


The documentation for this class was generated from the following files: