Mantid
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Private Member Functions | Static Private Member Functions | List of all members
Mantid::Algorithms::SofQCommon Struct Reference

#include <SofQCommon.h>

Public Member Functions

double getEFixed (const Geometry::ComponentInfo &componentInfo, const size_t componentIndex) const
 Get the efixed value for the given component index.
 
double getEFixed (const Geometry::IDetector &det) const
 Get the efixed value for the given detector.
 
void initCachedValues (const API::MatrixWorkspace &workspace, API::Algorithm const *hostAlgorithm)
 The procedure analyses emode and efixed properties provided to the algorithm and identify the energy analysis mode and the way the properties are defined.
 
double q (const double deltaE, const double twoTheta, const double efixed) const
 Calculate the Q value using the given efixed (ignored in direct mode)
 
double q (const double deltaE, const double twoTheta, const Geometry::IDetector *det) const
 Calculate the Q value.
 
std::pair< double, double > qBinHints (const API::MatrixWorkspace &ws, const double minE, const double maxE) const
 Estimate minimum and maximum momentum transfer.
 
 SofQCommon ()
 

Public Attributes

double m_efixed
 EFixed.
 
bool m_efixedGiven
 EFixed has been provided.
 
int m_emode
 E Mode.
 

Private Member Functions

double directQ (const double deltaE, const double twoTheta) const
 Calculate the Q value for a direct instrument.
 
double indirectQ (const double deltaE, const double twoTheta, const Geometry::IDetector *det) const
 Calculate the Q value for an indirect instrument.
 
std::pair< double, double > qBinHintsDirect (const API::MatrixWorkspace &ws, const double minE, const double maxE) const
 Return a pair of (minimum Q, maximum Q) for given direct geometry workspace.
 
std::pair< double, double > qBinHintsIndirect (const API::MatrixWorkspace &ws, const double minE, const double maxE) const
 Return a pair of (minimum Q, maximum Q) for given indirect geometry workspace.
 

Static Private Member Functions

static double indirectQFromEFixed (const double deltaE, const double twoTheta, const double efixed)
 Calculate the Q value for an indirect instrument.
 

Detailed Description

Definition at line 21 of file SofQCommon.h.

Constructor & Destructor Documentation

◆ SofQCommon()

Mantid::Algorithms::SofQCommon::SofQCommon ( )
inline

Definition at line 31 of file SofQCommon.h.

Member Function Documentation

◆ directQ()

double Mantid::Algorithms::SofQCommon::directQ ( const double  deltaE,
const double  twoTheta 
) const
private

Calculate the Q value for a direct instrument.

Parameters
deltaEThe energy change
twoThetaThe value of the scattering angle
Returns
The value of Q

Definition at line 165 of file SofQCommon.cpp.

References Mantid::PhysicalConstants::E_mev_toNeutronWavenumberSq, m_efixed, and Mantid::Kernel::twoTheta.

Referenced by q(), q(), and qBinHintsDirect().

◆ getEFixed() [1/2]

double Mantid::Algorithms::SofQCommon::getEFixed ( const Geometry::ComponentInfo &  componentInfo,
const size_t  componentIndex 
) const

Get the efixed value for the given component index.

Return the efixed for the component at the given index.

In Direct mode this has to be property set up earlier and in Indirect mode it may be the property of a component if not specified globally for the instrument.

Parameters
componentInfoThe ComponentInfo holding the component
componentIndexThe index of the component (detector) within componentInfo
Returns
The value of efixed

Definition at line 102 of file SofQCommon.cpp.

References Mantid::Geometry::ComponentInfo::getNumberParameter(), m_efixed, m_efixedGiven, m_emode, and Mantid::Geometry::ComponentInfo::name().

◆ getEFixed() [2/2]

double Mantid::Algorithms::SofQCommon::getEFixed ( const Geometry::IDetector &  det) const

Get the efixed value for the given detector.

Return the efixed for this detector.

In Direct mode this has to be property set up earlier and in Indirect mode it may be the property of a component if not specified globally for the instrument.

Parameters
detA pointer to a detector object
Returns
The value of efixed

Definition at line 73 of file SofQCommon.cpp.

References Mantid::Kernel::efixed, Mantid::Geometry::IComponent::getName(), Mantid::Geometry::IComponent::getNumberParameter(), m_efixed, m_efixedGiven, and m_emode.

Referenced by indirectQ(), and qBinHintsIndirect().

◆ indirectQ()

double Mantid::Algorithms::SofQCommon::indirectQ ( const double  deltaE,
const double  twoTheta,
const Geometry::IDetector *  det 
) const
private

Calculate the Q value for an indirect instrument.

Parameters
deltaEThe energy change
twoThetaThe value of the scattering angle
detA pointer to the corresponding Detector
Returns
The value of Q

Definition at line 179 of file SofQCommon.cpp.

References getEFixed(), indirectQFromEFixed(), and Mantid::Kernel::twoTheta.

Referenced by q().

◆ indirectQFromEFixed()

double Mantid::Algorithms::SofQCommon::indirectQFromEFixed ( const double  deltaE,
const double  twoTheta,
const double  efixed 
)
staticprivate

Calculate the Q value for an indirect instrument.

Parameters
deltaEThe energy change
twoThetaThe value of the scattering angle
efixedThe final energy
Returns
The value of Q

Definition at line 193 of file SofQCommon.cpp.

References Mantid::PhysicalConstants::E_mev_toNeutronWavenumberSq, Mantid::Kernel::efixed, and Mantid::Kernel::twoTheta.

Referenced by indirectQ(), q(), and qBinHintsIndirect().

◆ initCachedValues()

void Mantid::Algorithms::SofQCommon::initCachedValues ( const API::MatrixWorkspace &  workspace,
API::Algorithm const *  hostAlgorithm 
)

The procedure analyses emode and efixed properties provided to the algorithm and identify the energy analysis mode and the way the properties are defined.

Parameters
workspace:: input workspace which may or may not have incident energy property (Ei) attached to it as the run log
hostAlgorithm:: the pointer to SofQ algorithm hosting the base class. This algorithm expects to have EMode and EFixed properties attached to it.

Definition at line 26 of file SofQCommon.cpp.

References Mantid::API::Algorithm::getProperty(), m_efixed, m_efixedGiven, m_emode, and workspace.

Referenced by Mantid::Algorithms::SofQWNormalisedPolygon::exec().

◆ q() [1/2]

double Mantid::Algorithms::SofQCommon::q ( const double  deltaE,
const double  twoTheta,
const double  efixed 
) const

Calculate the Q value using the given efixed (ignored in direct mode)

Calculate the Q value.

Parameters
deltaEThe energy transfer in meV
twoThetaThe scattering angle in radians
efixedThe final energy in meV for indirect emode, e.g. from getEFixed(). Ignored for direct emode, where the cached incident energy is used.
Returns
The momentum transfer in A-1

Definition at line 137 of file SofQCommon.cpp.

References directQ(), Mantid::Kernel::efixed, indirectQFromEFixed(), m_emode, and Mantid::Kernel::twoTheta.

◆ q() [2/2]

double Mantid::Algorithms::SofQCommon::q ( const double  deltaE,
const double  twoTheta,
const Geometry::IDetector *  det 
) const

Calculate the Q value.

Parameters
deltaEThe energy transfer in meV
twoThetaThe scattering angle in radians
detA pointer to the corresponding detector, can be nullptr for direct emode.
Returns
The momentum transfer in A-1

Definition at line 122 of file SofQCommon.cpp.

References directQ(), indirectQ(), m_emode, and Mantid::Kernel::twoTheta.

Referenced by Mantid::Algorithms::SofQWNormalisedPolygon::exec().

◆ qBinHints()

std::pair< double, double > Mantid::Algorithms::SofQCommon::qBinHints ( const API::MatrixWorkspace &  ws,
const double  minE,
const double  maxE 
) const

Estimate minimum and maximum momentum transfer.

Return a pair of (minimum Q, maximum Q) for given workspace.

Parameters
wsa workspace
minEminimum energy transfer in ws
maxEmaximum energy transfer in ws
Returns
a pair containing global minimun and maximum Q

Definition at line 151 of file SofQCommon.cpp.

References m_emode, qBinHintsDirect(), and qBinHintsIndirect().

Referenced by Mantid::Algorithms::SofQW::setUpOutputWorkspace().

◆ qBinHintsDirect()

std::pair< double, double > Mantid::Algorithms::SofQCommon::qBinHintsDirect ( const API::MatrixWorkspace &  ws,
const double  minE,
const double  maxE 
) const
private

Return a pair of (minimum Q, maximum Q) for given direct geometry workspace.

Parameters
wsa workspace
minEminimum energy transfer in ws
maxEmaximum energy transfer in ws
Returns
a pair containing global minimun and maximum Q

Definition at line 208 of file SofQCommon.cpp.

References directQ(), m_efixed, Mantid::API::ExperimentInfo::spectrumInfo(), Mantid::API::SpectrumInfo::twoTheta(), and Mantid::Kernel::twoTheta.

Referenced by qBinHints().

◆ qBinHintsIndirect()

std::pair< double, double > Mantid::Algorithms::SofQCommon::qBinHintsIndirect ( const API::MatrixWorkspace &  ws,
const double  minE,
const double  maxE 
) const
private

Return a pair of (minimum Q, maximum Q) for given indirect geometry workspace.

Estimates the Q range from all detectors. If workspace contains grouped detectors/not all detectors are linked to a spectrum, the returned interval may be larger than actually needed.

Parameters
wsa workspace
minEminimum energy transfer in ws
maxEmaximum energy transfer in ws
Returns
a pair containing global minimun and maximum Q

Definition at line 250 of file SofQCommon.cpp.

References Mantid::API::ExperimentInfo::componentInfo(), Mantid::API::ExperimentInfo::detectorInfo(), Mantid::Kernel::efixed, getEFixed(), indirectQFromEFixed(), std::to_string(), and Mantid::Kernel::twoTheta.

Referenced by qBinHints().

Member Data Documentation

◆ m_efixed

double Mantid::Algorithms::SofQCommon::m_efixed

EFixed.

Definition at line 28 of file SofQCommon.h.

Referenced by directQ(), getEFixed(), getEFixed(), initCachedValues(), and qBinHintsDirect().

◆ m_efixedGiven

bool Mantid::Algorithms::SofQCommon::m_efixedGiven

EFixed has been provided.

Definition at line 26 of file SofQCommon.h.

Referenced by getEFixed(), getEFixed(), and initCachedValues().

◆ m_emode

int Mantid::Algorithms::SofQCommon::m_emode

E Mode.

Definition at line 24 of file SofQCommon.h.

Referenced by getEFixed(), getEFixed(), initCachedValues(), q(), q(), and qBinHints().


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